-// Copyright (C) 2006-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
graph->edAddLink(forEach->edGetSamplePort(),i32);
graph->edAddLink(o31,n4->edGetInValue1());
graph->edAddLink(n2->edGetSeqOut(),n4->edGetInValue2());
- CPPUNIT_ASSERT(dynamic_cast<AnySplitOutputPort *>(graph->getOutputPort("myFE.blocToShakeBaby.T3.o31")));
+ CPPUNIT_ASSERT(graph->getOutputPort("myFE.blocToShakeBaby.T3.o31"));
int tab[]={12,14,16,18,20};
vector<int> tabv(tab,tab+5);
SequenceAnyPtr tmp=SequenceAny::New(tabv);//expected sequence
delete graph2;
}
+
/*!
* Here a test for OptimizerLoop with an evenemential (or synchronous) algorithm
*/
InputPort *i1=n1->edAddInputPort("i1",Runtime::_tc_double);
OutputPort *o1=n1->edAddOutputPort("o1",Runtime::_tc_double);
graph->edAddLink(opt->edGetSamplePort(),i1);
- InputPort *i2=n2->edAddInputPort("i2",Runtime::_tc_double);
+ InputPort *i2=n2->edAddInputPort("i2",opt->edGetAlgoResultPort()->edGetType());
OutputPort *o2_1=n2->edAddOutputPort("o1",Runtime::_tc_double);
- graph->edAddLink(o1,i2);
+ graph->edAddLink(opt->edGetAlgoResultPort(),i2);
graph->edAddLink(n1->edGetNbOfInputsOutputPort(),opt->edGetPortForOutPool());
opt->edGetNbOfBranchesPort()->edInit(2);
opt->edGetAlgoInitPort()->edInit("toto");
InputPort *i1=n1->edAddInputPort("i1",Runtime::_tc_double);
OutputPort *o1=n1->edAddOutputPort("o1",Runtime::_tc_double);
graph->edAddLink(opt->edGetSamplePort(),i1);
- InputPort *i2=n2->edAddInputPort("i2",Runtime::_tc_double);
+ InputPort *i2=n2->edAddInputPort("i2",opt->edGetAlgoResultPort()->edGetType());
OutputPort *o2_1=n2->edAddOutputPort("o1",Runtime::_tc_double);
- graph->edAddLink(o1,i2);
+ graph->edAddLink(opt->edGetAlgoResultPort(),i2);
graph->edAddLink(n1->edGetNbOfInputsOutputPort(),opt->edGetPortForOutPool());
opt->edGetNbOfBranchesPort()->edInit(2);
opt->edGetAlgoInitPort()->edInit("toto");
delete clone;
}
+/*!
+ * Test of illegal links within an OptimizerLoop.
+ */
+void EngineIntegrationTest::testForOptimizerLoop3()
+{
+ LinkInfo info(LinkInfo::ALL_DONT_STOP);
+ Bloc *graph=new Bloc("Global");
+ OptimizerLoop *opt=new OptimizerLoop("myOptWthAlgSync","libPluginOptEvTest1","PluginOptEvTest1Factory",true);
+ graph->edAddChild(opt);
+ ToyNode *n1=new ToyNode("T1");
+ ToyNode *n2=new ToyNode("T2");
+ Bloc *bloc=new Bloc("Bloc");
+ graph->edAddChild(n2);
+ graph->edAddCFLink(opt,n2);
+ opt->edSetNode(bloc);
+ bloc->edAddChild(n1);
+ InputPort *i1=n1->edAddInputPort("i1",Runtime::_tc_double);
+ OutputPort *o1=n1->edAddOutputPort("o1",Runtime::_tc_double);
+ InputPort *i2=n2->edAddInputPort("i2",opt->edGetAlgoResultPort()->edGetType());
+ try
+ {
+ graph->edAddLink(opt->edGetAlgoResultPort(),i1);
+ CPPUNIT_FAIL("Construction of an illegal link: the result port linked to a node inside the OptimizerLoop.");
+ }
+ catch(Exception& e)
+ {
+ }
+
+ try
+ {
+ graph->edAddLink(o1,i2);
+ CPPUNIT_FAIL("Construction of an illegal link: a node inside the loop linked to a node outside the OptimizerLoop.");
+ }
+ catch(Exception& e)
+ {
+ }
+
+ delete graph;
+}
+
/*!
* Test to check that in for compil-time known connectivity of a graph, deployment calculation is OK.
*/
CPPUNIT_ASSERT(!tree.presenceOfDefaultContainer());
//Check that compatibility is checked...
ComponentInstanceTest1 *comp1=new ComponentInstanceTest1("FLICA");
- n1S->setComponent(comp1);
+ /*n1S->setComponent(comp1);
CPPUNIT_ASSERT_THROW(n4S->setComponent(comp1),YACS::Exception);//Impossible not compatible between ToyNode1S and ToyNode2S
- CPPUNIT_ASSERT_THROW(n2S->setComponent(comp1),YACS::Exception);//Failure here to but due to incompatibility of scopes n2S is in a ForEachLoop and not n1S and comp1 is NOT attached here.
+ CPPUNIT_ASSERT_THROW(n2S->setComponent(comp1),YACS::Exception);//Failure here to but due to incompatibility of scopes n2S is in a ForEachLoop and not n1S and comp1 is NOT attached here.*/
+ n1S->setComponent(comp1);
comp1->attachOnCloning();
n2S->setComponent(comp1);//here it's ok because comp1 is attached...
tree=graph->getDeploymentTree();
CPPUNIT_ASSERT_EQUAL(1, (int) tree.getNumberOfCTDefComponentInstances()); CPPUNIT_ASSERT_EQUAL(1, (int) tree.getNumberOfRTODefComponentInstances());
ComponentInstanceTest2 *comp3=new ComponentInstanceTest2("DKCORE");
n4S->setComponent(comp3);
- CPPUNIT_ASSERT_THROW(n5S->setComponent(comp3),YACS::Exception);//For fun just like 19 lines before.
+ //CPPUNIT_ASSERT_THROW(n5S->setComponent(comp3),YACS::Exception);//For fun just like 19 lines before.
comp3->attachOnCloning();
n5S->setComponent(comp3);//ok
tree=graph->getDeploymentTree();