Commit 693c0bbe authored by Floris Berendsen's avatar Floris Berendsen
Browse files

BUG: overlord->Execute was not using new interfacecriteria functionality

parent 22616699
......@@ -121,7 +121,7 @@ Overlord::ApplyNodeConfiguration()
{
currentComponentSelector->AddCriterion( criterion );
std::cout << currentComponentSelector->NumberOfComponents() << " " << criterion.first << ": ";
std::cout << " " << currentComponentSelector->NumberOfComponents() << " " << criterion.first << ": ";
if( criterion.second.size() > 1 )
{
std::cout << "[ ";
......@@ -172,9 +172,9 @@ Overlord::ApplyConnectionConfiguration()
this->m_ComponentSelectorContainer[name]->AddProvidingInterfaceCriteria(interfaceCriteria);
this->m_ComponentSelectorContainer[outgoingName]->AddAcceptingInterfaceCriteria(interfaceCriteria);
std::cout << "Has Interface: " << std::endl;
std::cout << this->m_ComponentSelectorContainer[name]->NumberOfComponents() << name << ": Providing" << std::endl;
std::cout << this->m_ComponentSelectorContainer[outgoingName]->NumberOfComponents() << outgoingName << ": Accepting" << std::endl;
std::cout << " Has Interface: " << std::endl;
std::cout << " " << this->m_ComponentSelectorContainer[name]->NumberOfComponents() << ' ' << name << ": Providing" << std::endl;
std::cout << " " << this->m_ComponentSelectorContainer[outgoingName]->NumberOfComponents() << ' ' << outgoingName << ": Accepting" << std::endl;
std::for_each(interfaceCriteria.begin(), interfaceCriteria.end(), [](ComponentBase::InterfaceCriteriaType::value_type kv) mutable { std::cout << " { " << kv.first << ": " << kv.second << " }\n"; });
......@@ -295,12 +295,10 @@ void
Overlord::Execute()
{
/** Scans all Components to find those with RegistrationControllerStart capability and call them */
const CriterionType criterion = CriterionType( keys::HasProvidingInterface, { keys::RegistrationControllerStartInterface } );
for( auto const & componentSelector : this->m_ComponentSelectorContainer )
{
ComponentBase::Pointer component = componentSelector.second->GetComponent();
if( component->MeetsCriterionBase( criterion ) )
if (component->CountProvidingInterfaces({ { keys::NameOfInterface, keys::RegistrationControllerStartInterface } }) == 1)
{
RegistrationControllerStartInterface * providingInterface = dynamic_cast< RegistrationControllerStartInterface * >( component.GetPointer() );
if( providingInterface == nullptr ) // is actually a double-check for sanity: based on criterion cast should be successful
......
......@@ -174,14 +174,14 @@ TEST_F( ComponentFactoryTest, InterfacedObjects )
NodePointer Node3 = ComponentSelector::New();
Node3->AddAcceptingInterfaceCriteria( { "NameOfInterface", "MetricDerivativeInterface" } );
Node3->AddAcceptingInterfaceCriteria({ { "NameOfInterface", "MetricDerivativeInterface" } });
ComponentType::Pointer Node3Component;
EXPECT_NO_THROW( Node3Component = Node3->GetComponent() );
EXPECT_STREQ( Node3Component->GetNameOfClass(), "GDOptimizer3rdPartyComponent" );
NodePointer Node4 = ComponentSelector::New();
Node4->AddProvidingInterfaceCriteria( { "NameOfInterface", "MetricDerivativeInterface" } );
Node4->AddProvidingInterfaceCriteria({ { "NameOfInterface", "MetricDerivativeInterface" } });
ComponentType::Pointer Node4Component;
EXPECT_NO_THROW( Node4Component = Node4->GetComponent() );
EXPECT_STREQ( Node4Component->GetNameOfClass(), "SSDMetric3rdPartyComponent" );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment