-
Notifications
You must be signed in to change notification settings - Fork 778
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #20625: Fix MonitorService Unittests
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
- Loading branch information
Showing
2 changed files
with
96 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
test/unittest/statistics/rtps/mock/Publisher/fastdds/publisher/DataWriterHistory.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef _FASTDDS_PUBLISHER_DATAWRITERHISTORY_HPP_ | ||
#define _FASTDDS_PUBLISHER_DATAWRITERHISTORY_HPP_ | ||
|
||
#include <chrono> | ||
#include <functional> | ||
#include <mutex> | ||
|
||
#include <gmock/gmock.h> | ||
|
||
#include <fastdds/rtps/history/WriterHistory.h> | ||
#include <fastdds/rtps/resources/ResourceManagement.h> | ||
#include <fastrtps/utils/TimedMutex.hpp> | ||
|
||
namespace eprosima { | ||
namespace fastrtps { | ||
|
||
class TopicAttributes; | ||
|
||
namespace rtps { | ||
|
||
class WriteParams; | ||
|
||
} // namespace rtps | ||
} // namespace fastrtps | ||
|
||
|
||
namespace fastdds { | ||
namespace dds { | ||
|
||
class DomainParticipant; | ||
class PublisherListener; | ||
class DataWriter; | ||
class DataWriterListener; | ||
class Topic; | ||
|
||
|
||
static fastrtps::rtps::HistoryAttributes to_history_attributes( | ||
const fastrtps::TopicAttributes&, | ||
uint32_t, | ||
fastrtps::rtps::MemoryManagementPolicy_t) | ||
{ | ||
|
||
return fastrtps::rtps::HistoryAttributes(); | ||
} | ||
|
||
class DataWriterHistory : public fastrtps::rtps::WriterHistory | ||
{ | ||
public: | ||
|
||
DataWriterHistory( | ||
const fastrtps::TopicAttributes& topic_att, | ||
uint32_t payloadMaxSize, | ||
fastrtps::rtps::MemoryManagementPolicy_t mempolicy, | ||
std::function<void (const fastrtps::rtps::InstanceHandle_t&)>) | ||
: WriterHistory(to_history_attributes(topic_att, payloadMaxSize, mempolicy)) | ||
{ | ||
} | ||
|
||
MOCK_METHOD4(add_pub_change, bool( | ||
fastrtps::rtps::CacheChange_t*, | ||
fastrtps::rtps::WriteParams&, | ||
std::unique_lock<fastrtps::RecursiveTimedMutex>&, | ||
const std::chrono::time_point<std::chrono::steady_clock>&)); | ||
|
||
}; | ||
|
||
} // namespace dds | ||
} // namespace fastdds | ||
} // namespace eprosima | ||
|
||
#endif // _FASTDDS_PUBLISHER_DATAWRITERHISTORY_HPP_ |