24 #include "cheetah/exporters/test/DataExportTest.h" 25 #include "cheetah/exporters/DataExport.h" 26 #include "panda/test/TestChunk.h" 27 #include "panda/test/TestChunkHandler.h" 28 #include "panda/ProcessingEngineConfig.h" 38 DataExportTest::DataExportTest()
43 DataExportTest::~DataExportTest()
47 void DataExportTest::SetUp()
51 void DataExportTest::TearDown()
59 template<
typename... TestChunks>
67 void init() { BaseT::init(); }
69 template<
typename DataType>
70 void set_factory(
ExporterType const& type_id,
typename ExportInitialiser<BaseT, DataType>::FactoryType
const& factory)
72 BaseT::template set_factory<DataType>(type_id, factory);
78 panda::ChannelId channel_id(
"channel_1");
82 panda::ProcessingEngineConfig engine_config;
88 bool factory_called =
false;
89 panda::test::TestChunkHandler<panda::test::TestChunk_A> handler(
false);
90 exporter.set_factory<panda::test::TestChunk_A>(exporter_type, [&handler, &factory_called](
exporters::DataExportStreamConfig) { factory_called=
true;
return handler; } );
92 ASSERT_FALSE(factory_called);
95 std::set<ExporterType> expected_types({exporter_type});
96 ASSERT_EQ(expected_types, exporter.
available());
99 std::shared_ptr<panda::test::TestChunk_A> chunk = std::make_shared<panda::test::TestChunk_A>(
"ooo");
100 exporter.send(channel_id, chunk);
101 ASSERT_FALSE(handler.executed());
107 void add_options(OptionsDescriptionEasyInit&) {}
117 panda::ChannelId channel_id(
"channel_1");
122 panda::ProcessingEngineConfig engine_config;
125 config.activate(channel_id);
131 panda::test::TestChunkHandler<panda::test::TestChunk_A> handler(
false);
132 bool factory_called =
false;
133 exporter.set_factory<panda::test::TestChunk_A>(exporter_type,
140 ASSERT_TRUE(factory_called);
143 std::shared_ptr<panda::test::TestChunk_A> chunk = std::make_shared<panda::test::TestChunk_A>(
"ooo");
144 exporter.send(channel_id, chunk);
146 ASSERT_TRUE(handler.executed());
147 ASSERT_EQ(*chunk, handler.chunk());
157 panda::ChannelId channel_id(
"channel_1");
163 panda::Engine engine;
166 config.activate(channel_id);
170 bool factory_called =
false;
171 panda::test::TestChunkHandler<panda::test::TestChunk_A> handler(
true);
172 exporter.set_factory<panda::test::TestChunk_A>(exporter_type, [&handler, &factory_called](
exporters::DataExportStreamConfig) { factory_called=
true;
return handler; } );
174 ASSERT_TRUE(factory_called);
177 std::shared_ptr<panda::test::TestChunk_A> chunk = std::make_shared<panda::test::TestChunk_A>(
"ooo");
178 exporter.send(channel_id, chunk);
180 ASSERT_TRUE(handler.executed());
181 ASSERT_EQ(*chunk, handler.chunk());
186 panda::ChannelId channel_id(
"channel_1");
193 std::shared_ptr<panda::test::TestChunk_A> chunk = std::make_shared<panda::test::TestChunk_A>(
"ooo");
194 exporter.send(channel_id, chunk);
195 ASSERT_EQ(&*probe.
data(), &*chunk);
std::shared_ptr< const T > data()
return the data data received
Configuration Object for DataExport module.
Base class for module configuration.
panda::Engine & engine(panda::ChannelId const &)
return the engine allocated to the specified channel
Defines the mapping of a sinks configuration block with the sink type, and the channel to associate i...
void set_engine_config(panda::ChannelId const &channel_id, panda::ProcessingEngineConfig const &config)
set the engine confugration for a specified channel
std::set< ExporterType > const & available() const
return the exporter types available in this class
void add_exporter(DataExportStreamConfig)
set an export streamer configurations
Some limits and constants for FLDO.
string based tag for refering to the type of Exporter, based on a std::string
Attach to a stream to record the data sent.
This class initialises a suitable panda::DataSwitch according to the exporters::DataExportConfigurati...
TestProbe< DataType > & activate_test_probe(panda::ChannelId const &)
activates a TestProbe object for monitoring the streamed data of DataType to a specific ...
void number_of_threads(unsigned const &number_of_threads)
set the number of dedicated threads to service exporters export (default 0)