@@ -172,39 +172,72 @@ BOOST_AUTO_TEST_CASE(DataSamplingTimePipelineFlow)
172172BOOST_AUTO_TEST_CASE (InputSpecsForPolicy)
173173{
174174 std::string configFilePath = " json:/" + std::string (getenv (" O2_ROOT" )) + " /share/tests/test_DataSampling.json" ;
175- std::vector<InputSpec> inputs = DataSampling::InputSpecsForPolicy (configFilePath, " tpcclusters" );
175+ std::unique_ptr<ConfigurationInterface> config = ConfigurationFactory::getConfiguration (configFilePath);
176+ auto policiesTree = config->getRecursive (" dataSamplingPolicies" );
177+
178+ {
179+ std::vector<InputSpec> inputs = DataSampling::InputSpecsForPolicy (policiesTree, " tpcclusters" );
176180
177- BOOST_CHECK_EQUAL (inputs.size (), 2 );
178- BOOST_CHECK (DataSpecUtils::match (inputs[0 ], ConcreteDataTypeMatcher{" DS" , " tpcclusters0" }));
179- BOOST_CHECK_EQUAL (inputs[0 ].binding , " clusters" );
180- BOOST_CHECK (DataSpecUtils::match (inputs[1 ], ConcreteDataTypeMatcher{" DS" , " tpcclusters1" }));
181- BOOST_CHECK_EQUAL (inputs[1 ].binding , " clusters_p" );
181+ BOOST_CHECK_EQUAL (inputs.size (), 2 );
182+ BOOST_CHECK (DataSpecUtils::match (inputs[0 ], ConcreteDataTypeMatcher{" DS" , " tpcclusters0" }));
183+ BOOST_CHECK_EQUAL (inputs[0 ].binding , " clusters" );
184+ BOOST_CHECK (DataSpecUtils::match (inputs[1 ], ConcreteDataTypeMatcher{" DS" , " tpcclusters1" }));
185+ BOOST_CHECK_EQUAL (inputs[1 ].binding , " clusters_p" );
186+ }
187+ {
188+ std::vector<InputSpec> inputs = DataSampling::InputSpecsForPolicy (policiesTree, " tpcraw" );
182189
190+ BOOST_CHECK_EQUAL (inputs.size (), 1 );
191+ BOOST_CHECK (DataSpecUtils::match (inputs[0 ], ConcreteDataTypeMatcher{" TPC" , " SMP_RAWDATA" }));
192+ BOOST_CHECK_EQUAL (inputs[0 ].binding , " clusters" );
193+ }
194+ }
195+
196+ BOOST_AUTO_TEST_CASE (OutputSpecsForPolicy)
197+ {
198+ std::string configFilePath = " json:/" + std::string (getenv (" O2_ROOT" )) + " /share/tests/test_DataSampling.json" ;
183199 std::unique_ptr<ConfigurationInterface> config = ConfigurationFactory::getConfiguration (configFilePath);
184- inputs = DataSampling::InputSpecsForPolicy (config.get (), " tpcclusters" );
200+ auto policiesTree = config->getRecursive (" dataSamplingPolicies" );
201+
202+ {
203+ auto outputs = DataSampling::OutputSpecsForPolicy (policiesTree, " tpcclusters" );
204+
205+ BOOST_REQUIRE_EQUAL (outputs.size (), 2 );
206+ BOOST_CHECK (DataSpecUtils::match (outputs[0 ], ConcreteDataTypeMatcher{" DS" , " tpcclusters0" }));
207+ BOOST_CHECK_EQUAL (outputs[0 ].binding .value , " clusters" );
208+ BOOST_CHECK (DataSpecUtils::match (outputs[1 ], ConcreteDataTypeMatcher{" DS" , " tpcclusters1" }));
209+ BOOST_CHECK_EQUAL (outputs[1 ].binding .value , " clusters_p" );
210+ }
211+ {
212+ auto outputs = DataSampling::OutputSpecsForPolicy (policiesTree, " tpcraw" );
185213
186- BOOST_CHECK_EQUAL (inputs.size (), 2 );
214+ BOOST_REQUIRE_EQUAL (outputs.size (), 1 );
215+ BOOST_CHECK (DataSpecUtils::match (outputs[0 ], ConcreteDataTypeMatcher{" TPC" , " SMP_RAWDATA" }));
216+ BOOST_CHECK_EQUAL (outputs[0 ].binding .value , " clusters" );
217+ }
187218}
188219
189220BOOST_AUTO_TEST_CASE (MultinodeUtilities)
190221{
191222 std::string configFilePath = " json:/" + std::string (getenv (" O2_ROOT" )) + " /share/tests/test_DataSampling.json" ;
223+ std::unique_ptr<ConfigurationInterface> config = ConfigurationFactory::getConfiguration (configFilePath);
224+ auto policiesTree = config->getRecursive (" dataSamplingPolicies" );
192225
193226 {
194- BOOST_CHECK_THROW (DataSampling::PortForPolicy (configFilePath , " no such policy" ), std::runtime_error);
195- BOOST_CHECK_THROW (DataSampling::MachinesForPolicy (configFilePath , " no such policy" ), std::runtime_error);
227+ BOOST_CHECK_THROW (DataSampling::PortForPolicy (policiesTree , " no such policy" ), std::runtime_error);
228+ BOOST_CHECK_THROW (DataSampling::MachinesForPolicy (policiesTree , " no such policy" ), std::runtime_error);
196229 }
197230 {
198- auto port = DataSampling::PortForPolicy (configFilePath , " tpcclusters" );
231+ auto port = DataSampling::PortForPolicy (policiesTree , " tpcclusters" );
199232 BOOST_CHECK (!port.has_value ());
200- auto machines = DataSampling::MachinesForPolicy (configFilePath , " tpcclusters" );
233+ auto machines = DataSampling::MachinesForPolicy (policiesTree , " tpcclusters" );
201234 BOOST_CHECK (machines.empty ());
202235 }
203236 {
204- auto port = DataSampling::PortForPolicy (configFilePath , " tpcraw" );
237+ auto port = DataSampling::PortForPolicy (policiesTree , " tpcraw" );
205238 BOOST_REQUIRE (port.has_value ());
206239 BOOST_CHECK_EQUAL (port.value (), 1234 );
207- auto machines = DataSampling::MachinesForPolicy (configFilePath , " tpcraw" );
240+ auto machines = DataSampling::MachinesForPolicy (policiesTree , " tpcraw" );
208241 BOOST_CHECK_EQUAL (machines.size (), 2 );
209242 }
210243 {
0 commit comments