Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / engine / Test / engineIntegrationTest.cxx
index 92cc1a16b5ecd9508cf90192db9ba6aadc68f9e3..30c54f9b82206a8b48ac7bb1e7c3d4e41d730e0c 100644 (file)
@@ -172,10 +172,26 @@ void EngineIntegrationTest::testBloc3()
   delete clonedGraph;
 }
 
+/*!
+ * Test for cross hierarchy detection when defining a hierarchy.
+ */
+void EngineIntegrationTest::testBloc4()
+{
+  Bloc *graph=new Bloc("Graph");
+  Bloc *g1=new Bloc("g1");
+  Bloc *g2=new Bloc("g2");
+  
+  graph->edAddChild(g1);
+  g1->edAddChild(g2);
+  CPPUNIT_ASSERT_THROW(g2->edAddChild(graph),YACS::Exception);
+  delete graph;
+}
+
 void EngineIntegrationTest::testForLoop1()
 {
   TypeCode *tc_double    = Runtime::_tc_double;
   TypeCode *tc_int       = Runtime::_tc_int;
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   ToyNode *n1=new ToyNode("T1");
   InputPort *i11=n1->edAddInputPort("i11",tc_double);
   i11->edInit(3.14);
@@ -202,6 +218,8 @@ void EngineIntegrationTest::testForLoop1()
   graph->edAddLink(o1,i21);
   graph->edAddCFLink(n1,loop);
   graph->edAddLink(o21,i21);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe;
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue(),19.397, DBL_PRECISION_COMPARE);
@@ -216,6 +234,8 @@ void EngineIntegrationTest::testForLoop1()
   Bloc *clonedGraph=(Bloc *)graph->clone(0);
   delete graph;
   Executor exe2;
+  clonedGraph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe2.RunW(clonedGraph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)clonedGraph->getOutputPort("toto.titi.T2.o1"))->get()->getDoubleValue(),19.397, DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(((Loop *)clonedGraph->getChildByName("toto"))->getNbOfTurns(),3);
@@ -228,6 +248,7 @@ void EngineIntegrationTest::testForLoop2()
 {
   TypeCode *tc_double    = Runtime::_tc_double;
   TypeCode *tc_int       = Runtime::_tc_int;
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   ToyNode *n1=new ToyNode("T1");
   InputPort *i11=n1->edAddInputPort("i11",tc_double);
   i11->edInit(3.14);
@@ -252,12 +273,16 @@ void EngineIntegrationTest::testForLoop2()
   graph->edAddLink(o1,i21);
   graph->edAddCFLink(n1,loop);
   graph->edAddLink(o21,i21);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe;
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue(),19.397, DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),3);
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)n2->getOutputPort("o1"))->get()->getDoubleValue(),19.397, DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),3);
@@ -271,6 +296,7 @@ void EngineIntegrationTest::testForLoop3()
 {
   TypeCode *tc_double    = Runtime::_tc_double;
   TypeCode *tc_int       = Runtime::_tc_int;
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   ToyNode *n1=new ToyNode("T1");
   InputPort *i11=n1->edAddInputPort("i11",tc_double);
   i11->edInit(3.14);
@@ -298,6 +324,8 @@ void EngineIntegrationTest::testForLoop3()
   graph->edAddLink(o12,loop->edGetNbOfTimesInputPort());
   graph->edAddLink(o21,i21);
   graph->edAddLink(o21,i31);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe;
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)graph->getOutputPort("T3.o1"))->get()->getDoubleValue(),10.12, DBL_PRECISION_COMPARE);
@@ -306,6 +334,8 @@ void EngineIntegrationTest::testForLoop3()
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n1->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n3->getState(),YACS::DONE);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)graph->getOutputPort("T3.o1"))->get()->getDoubleValue(),10.12, DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),2);
@@ -318,12 +348,16 @@ void EngineIntegrationTest::testForLoop3()
   n1->edRemovePort(i12);
   graph->edRemoveLink(o21,i31);
   graph->edAddLink(o11,i31);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),0);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n1->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n3->getState(),YACS::DONE);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),0);
@@ -331,6 +365,8 @@ void EngineIntegrationTest::testForLoop3()
   CPPUNIT_ASSERT_EQUAL(n1->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n3->getState(),YACS::DONE);
   Bloc *clonedGraph=(Bloc *)graph->clone(0);
+  clonedGraph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe2;
   exe2.RunW(clonedGraph);
   CPPUNIT_ASSERT_EQUAL(((Loop *)clonedGraph->getChildByName("toto"))->getState(),YACS::DONE);
@@ -348,6 +384,8 @@ void EngineIntegrationTest::testForLoop3()
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::FAILED);
   CPPUNIT_ASSERT_EQUAL(n1->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n3->getState(),YACS::FAILED);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::ERROR);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),0);
@@ -355,6 +393,8 @@ void EngineIntegrationTest::testForLoop3()
   CPPUNIT_ASSERT_EQUAL(n1->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n3->getState(),YACS::FAILED);
   clonedGraph=(Bloc *)graph->clone(0);
+  clonedGraph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe2.RunW(clonedGraph);
   CPPUNIT_ASSERT_EQUAL(((Loop *)clonedGraph->getChildByName("toto"))->getState(),YACS::ERROR);
   CPPUNIT_ASSERT_EQUAL(((Loop *)clonedGraph->getChildByName("toto"))->getNbOfTurns(),0);
@@ -366,12 +406,16 @@ void EngineIntegrationTest::testForLoop3()
   //retrieves back state and retest
   graph->edRemoveLink(o21,i31);
   graph->edAddLink(o11,i31);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),0);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n1->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n3->getState(),YACS::DONE);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),0);
@@ -385,6 +429,8 @@ void EngineIntegrationTest::testForLoop3()
   i11->edInit(3.14);
   i12=n1->edAddInputPort("i12",tc_double);
   i12->edInit(2.78);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)graph->getOutputPort("T3.o1"))->get()->getDoubleValue(),10.12, DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),2);
@@ -392,6 +438,8 @@ void EngineIntegrationTest::testForLoop3()
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n1->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(n3->getState(),YACS::DONE);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)graph->getOutputPort("T3.o1"))->get()->getDoubleValue(),10.12, DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(loop->getNbOfTurns(),2);
@@ -404,6 +452,7 @@ void EngineIntegrationTest::testForLoop3()
 
 void EngineIntegrationTest::testForLoop4()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("Graph");
   ToyNode *n1=new ToyNode("T1"); graph->edAddChild(n1);
   ForLoop *loop=new ForLoop("loop"); graph->edAddChild(loop); graph->edAddCFLink(n1,loop);
@@ -420,6 +469,8 @@ void EngineIntegrationTest::testForLoop4()
   graph->edAddLink(n1->edGetNbOfInputsOutputPort(),loop->edGetNbOfTimesInputPort());
   Bloc *graph2=(Bloc *)graph->clone(0);
   loop->edGetNbOfTimesInputPort()->edInit(0);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe;
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
@@ -438,6 +489,8 @@ void EngineIntegrationTest::testForLoop4()
   graph->edAddCFLink(n1,blocInt);
   graph->edAddLink(o11,i21);
   graph->edAddLink(n1->edGetNbOfInputsOutputPort(),loop->edGetNbOfTimesInputPort());
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
@@ -457,7 +510,8 @@ void EngineIntegrationTest::testForLoop4()
   CPPUNIT_ASSERT_EQUAL(loop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(0,loop->getNbOfTurns());
-  
+  graph2->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph2);
   ForLoop *loop2=(ForLoop *)graph2->getChildByName("loop");
   CPPUNIT_ASSERT_EQUAL(loop2->getState(),YACS::DONE);
@@ -479,6 +533,11 @@ void EngineIntegrationTest::testForLoop4()
   i21=graph2->getInputPort("blocInt.loop.T2.i21");
   graph2->edAddLink(o11,i21);
   graph2->edAddLink(n1->edGetNbOfInputsOutputPort(),loop2->edGetNbOfTimesInputPort());
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
+  exe.RunW(graph);
+  graph2->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph2);
   CPPUNIT_ASSERT_EQUAL(loop2->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(graph2->getState(),YACS::DONE);
@@ -496,6 +555,7 @@ void EngineIntegrationTest::testForLoop4()
 //multi loop inclusion
 void EngineIntegrationTest::testForLoop5()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("Graph");
   ToyNode *n1=new ToyNode("T1"); graph->edAddChild(n1);
   Bloc *b1=new Bloc("b1"); graph->edAddChild(b1); graph->edAddCFLink(n1,b1);
@@ -516,6 +576,8 @@ void EngineIntegrationTest::testForLoop5()
   graph->edAddLink(o21,i21);
   graph->edAddLink(o11,i21);
   Executor exe;
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)loop2->getOutputPort("b3.loop4.b5.T2.o21"))->get()->getDoubleValue(),54., DBL_PRECISION_COMPARE);
@@ -533,6 +595,7 @@ void EngineIntegrationTest::testWhileLoop1()
 {
   TypeCode *tc_double    = Runtime::_tc_double;
   TypeCode *tc_int       = Runtime::_tc_int;
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   ToyNode *n1=new ToyNode("T1");
   InputPort *i11=n1->edAddInputPort("i11",tc_double);
   i11->edInit(3.14);
@@ -573,6 +636,14 @@ void EngineIntegrationTest::testWhileLoop1()
   graph->edAddLink(l2->getSwitchPort(),whileLoop->edGetConditionPort());
   graph->edAddLink(o1,i21);
   graph->edAddLink(o1,l1->getEntry());
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
+  CPPUNIT_ASSERT(1==info.getNumberOfInfoLinks(I_CF_USELESS));
+  graph->edRemoveCFLink(n1,whileLoop);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
+  CPPUNIT_ASSERT(0==info.getNumberOfInfoLinks(I_CF_USELESS));
   Executor exe;
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputLimitPort*)l2->getCounterPort())->get()->getDoubleValue(),207.0922, DBL_PRECISION_COMPARE);
@@ -587,6 +658,7 @@ void EngineIntegrationTest::testSwitch()
 {
   RuntimeForEngineIntegrationTest::setRuntime();
   Runtime *myRuntime = getRuntime();
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   TypeCode *tc_double    = Runtime::_tc_double;
   TypeCode *tc_int       = Runtime::_tc_int;
   Bloc *graph=new Bloc("Graph");
@@ -633,6 +705,8 @@ void EngineIntegrationTest::testSwitch()
   mySwitch->edSetNode(2,n4);
   graph->edAddLink(o1,i41);
   Executor exe;
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)o31)->get()->getDoubleValue(),19., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(((OutputToyPort*)o21)->get(),(Any *)0);
@@ -641,6 +715,8 @@ void EngineIntegrationTest::testSwitch()
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   InputPort *i12=n1->edAddInputPort("i12",tc_double);
   i12->edInit(17.);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)o41)->get()->getDoubleValue(),37., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(((OutputToyPort*)o21)->get(),(Any *)0);
@@ -654,6 +730,7 @@ void EngineIntegrationTest::testSwitch2()
 {
   TypeCode *tc_double    = Runtime::_tc_double;
   TypeCode *tc_int       = Runtime::_tc_int;
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("Graph");
 
   ToyNode *n1=new ToyNode("T1");
@@ -718,30 +795,22 @@ void EngineIntegrationTest::testSwitch2()
   inLoop->edAddLink(l2->getCounterPort(),ii21);
   graph->edAddLink(l1->getSwitchPort(),whileLoop->edGetConditionPort());
   graph->edAddLink(l2->getSwitchPort(),whileLoop->edGetConditionPort());
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   graph->edRemoveLink(o31,ii22);
-  try
-    {
-      mySwitch->checkConsistency();
-      CPPUNIT_ASSERT(0);
-    }
-  catch(Exception& e)
-    {
-      CPPUNIT_ASSERT(std::string(e.what())=="CollectorSwOutPort::checkCompletenessOfCases : For link to ii2 of node TT2 the cases of switch node named mySwitch do not define links for following cases ids :1 ");
-    }
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_ALL) );
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_UNCOMPLETE_SW) );
+  CPPUNIT_ASSERT(info.getErrRepr()=="For link to ii2 of node TT2 the cases of switch node named mySwitch do not define links for following cases ids :1 \n");
   graph->edRemoveLink(o41,ii22);
-  try
-    {
-      mySwitch->checkConsistency();
-      CPPUNIT_ASSERT(0);
-    }
-  catch(Exception& e)
-    {
-      CPPUNIT_ASSERT(std::string(e.what())=="CollectorSwOutPort::checkCompletenessOfCases : For link to ii2 of node TT2 the cases of switch node named mySwitch do not define links for following cases ids :1 2 ");
-    }
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_ALL) );
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_UNCOMPLETE_SW) );
+  CPPUNIT_ASSERT(info.getErrRepr()=="For link to ii2 of node TT2 the cases of switch node named mySwitch do not define links for following cases ids :1 2 \n");
   graph->edAddLink(o31,ii22);
   graph->edAddLink(o41,ii22);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe;
   DEBTRACE("Run graph");
   exe.RunW(graph);
@@ -750,6 +819,8 @@ void EngineIntegrationTest::testSwitch2()
   CPPUNIT_ASSERT_EQUAL(whileLoop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)l2->getCounterPort())->get()->getDoubleValue(),161., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(3,whileLoop->getNbOfTurns());
@@ -763,24 +834,22 @@ void EngineIntegrationTest::testSwitch2()
   i52->edInit(4.);
   mySwitch->edSetDefaultNode(n5);
   graph->edAddLink(o1,i51);
-  try
-    {
-      mySwitch->checkConsistency();
-      CPPUNIT_ASSERT(0);
-    }
-  catch(Exception& e)
-    {
-      CPPUNIT_ASSERT(std::string(e.what())=="CollectorSwOutPort::checkCompletenessOfCases : For link to ii2 of node TT2 the cases of switch node named mySwitch do not define links for following cases ids :default ");
-    }
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_ALL) );
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_UNCOMPLETE_SW) );
+  CPPUNIT_ASSERT(info.getErrRepr()=="For link to ii2 of node TT2 the cases of switch node named mySwitch do not define links for following cases ids :default \n");
   graph->edAddLink(o51,ii22);
-  mySwitch->checkConsistency();
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)l2->getCounterPort())->get()->getDoubleValue(),161., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(3,whileLoop->getNbOfTurns());
   CPPUNIT_ASSERT_EQUAL(whileLoop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)l2->getCounterPort())->get()->getDoubleValue(),161., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(3,whileLoop->getNbOfTurns());
@@ -796,14 +865,17 @@ void EngineIntegrationTest::testSwitch2()
       CPPUNIT_ASSERT(std::string(e.what())=="Switch::edReleaseCase : the case # 4 is not set yet.");
     }
   mySwitch->edReleaseCase(1);
-  mySwitch->checkConsistency();
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)l2->getCounterPort())->get()->getDoubleValue(),175., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(3,whileLoop->getNbOfTurns());
   CPPUNIT_ASSERT_EQUAL(whileLoop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)l2->getCounterPort())->get()->getDoubleValue(),175., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(3,whileLoop->getNbOfTurns());
@@ -811,13 +883,16 @@ void EngineIntegrationTest::testSwitch2()
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   //now test when unexpected value is recieved and no default node specifies
   mySwitch->edReleaseDefaultNode();
-  mySwitch->checkConsistency();
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(whileLoop->getState(),YACS::FAILED);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::FAILED);
   CPPUNIT_ASSERT_EQUAL(mySwitch->getState(),YACS::ERROR);
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(whileLoop->getState(),YACS::FAILED);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::FAILED);
@@ -825,17 +900,13 @@ void EngineIntegrationTest::testSwitch2()
   //retrieving back state
   mySwitch->edSetDefaultNode(n5);
   graph->edAddLink(o1,i51);
-  try
-    {
-      mySwitch->checkConsistency();
-      CPPUNIT_ASSERT(0);
-    }
-  catch(Exception& e)
-    {
-      CPPUNIT_ASSERT(std::string(e.what())=="CollectorSwOutPort::checkCompletenessOfCases : For link to ii2 of node TT2 the cases of switch node named mySwitch do not define links for following cases ids :default ");
-    }
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_ALL) );
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_UNCOMPLETE_SW) );
+  CPPUNIT_ASSERT(info.getErrRepr()=="For link to ii2 of node TT2 the cases of switch node named mySwitch do not define links for following cases ids :default \n");
   graph->edAddLink(o51,ii22);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   DEBTRACE("Run graph");
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)l2->getCounterPort())->get()->getDoubleValue(),175., DBL_PRECISION_COMPARE);
@@ -853,12 +924,16 @@ void EngineIntegrationTest::testSwitch2()
   graph->edAddLink(o1,i31);
   graph->edAddLink(o31,ii22);
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)l2->getCounterPort())->get()->getDoubleValue(),161., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(3,whileLoop->getNbOfTurns());
   CPPUNIT_ASSERT_EQUAL(whileLoop->getState(),YACS::DONE);
   CPPUNIT_ASSERT_EQUAL(graph->getState(),YACS::DONE);
   DEBTRACE("Run graph");
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)l2->getCounterPort())->get()->getDoubleValue(),161., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(3,whileLoop->getNbOfTurns());
@@ -867,6 +942,8 @@ void EngineIntegrationTest::testSwitch2()
   Bloc *clonedGraph=(Bloc *)graph->clone(0);
   delete graph;
   Executor exe2;
+  clonedGraph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe2.RunW(clonedGraph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(((OutputToyPort*)clonedGraph->getOutPort("MyWhile.inLoop.L2.SwitchPort2"))->get()->getDoubleValue(),161., DBL_PRECISION_COMPARE);
   CPPUNIT_ASSERT_EQUAL(3,((WhileLoop *)clonedGraph->getChildByName("MyWhile"))->getNbOfTurns());
@@ -880,6 +957,7 @@ void EngineIntegrationTest::testSwitch2()
  */
 void EngineIntegrationTest::testSwitch3()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("Graph");
   Switch *mySwitch1=new Switch("mySwitch1");
   graph->edAddChild(mySwitch1);
@@ -907,8 +985,10 @@ void EngineIntegrationTest::testSwitch3()
   graph->edAddLink(o31,i61);
   graph->edAddLink(o41,i61);
   graph->edAddLink(o51,i61);
-  mySwitch1->checkConsistency();
-  mySwitch2->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,n6->getInGate()->getNumberOfBackLinks());
   CPPUNIT_ASSERT_EQUAL(1,i61->edGetNumberOfLinks());// <-- important
   CPPUNIT_ASSERT_EQUAL(4,o11->edGetNumberOfOutLinks()); 
@@ -929,19 +1009,15 @@ void EngineIntegrationTest::testSwitch3()
   CPPUNIT_ASSERT_EQUAL(1,i61->edGetNumberOfLinks());
   graph->edAddLink(o41,i61);
   CPPUNIT_ASSERT_EQUAL(1,i61->edGetNumberOfLinks());
-  try
-    {
-      mySwitch2->checkConsistency();
-      CPPUNIT_ASSERT(0);
-    }
-  catch(Exception& e)
-    {
-      CPPUNIT_ASSERT(std::string(e.what())=="CollectorSwOutPort::checkCompletenessOfCases : For link to i61 of node T6 the cases of switch node named mySwitch2 do not define links for following cases ids :2 8 ");
-    }
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_ALL) );
+  CPPUNIT_ASSERT( 1==info.getNumberOfErrLinks(E_UNCOMPLETE_SW) );
+  CPPUNIT_ASSERT(info.getErrRepr()=="For link to i61 of node T6 the cases of switch node named mySwitch2 do not define links for following cases ids :2 8 \n");
   graph->edAddLink(o31,i61);
   graph->edAddLink(o51,i61);
-  mySwitch2->checkConsistency();
   CPPUNIT_ASSERT_EQUAL(1,i61->edGetNumberOfLinks());
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe;
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL( ((OutputToyPort*)graph->getOutputPort("T6.o61"))->get()->getDoubleValue(),21., DBL_PRECISION_COMPARE);
@@ -958,6 +1034,7 @@ void EngineIntegrationTest::testSwitch3()
 void EngineIntegrationTest::testWhileLoop2()//Test of 0 turn of loop
 {
   //first test without any link to condition port on start of loop that is to say WhileLoop is considered has while and NOT dowhile.
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   TypeCode *tc_double    = Runtime::_tc_double;
   TypeCode *tc_int       = Runtime::_tc_int;
   ToyNode *n1=new ToyNode("T1");
@@ -994,6 +1071,8 @@ void EngineIntegrationTest::testWhileLoop2()//Test of 0 turn of loop
   graph->edAddLink(ol2s,loop->edGetConditionPort());
   graph->edAddLink(o21,i21);
   graph->edAddLink(o21,i31);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe;
   DEBTRACE("Run graph");
   exe.RunW(graph);
@@ -1179,7 +1258,7 @@ void EngineIntegrationTest::testEdInitOnLoops()
 void EngineIntegrationTest::testLinkUpdate1()
 {
   Bloc *graph=new Bloc("Graph");
-
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   ToyNode *n1=new ToyNode("T1");
   InputPort *i11=n1->edAddInputPort("i11",Runtime::_tc_double);
   i11->edInit(17.);
@@ -1219,7 +1298,8 @@ void EngineIntegrationTest::testLinkUpdate1()
   graph->edAddCFLink(mySwitch,n4);
   graph->edAddLink(o21,i41);
   graph->edAddLink(o31,i41);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o21->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o31->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,i41->edGetNumberOfLinks());// <-- important
@@ -1247,7 +1327,8 @@ void EngineIntegrationTest::testLinkUpdate1()
   //
   graph->edAddLink(o21,i41);
   graph->edAddLink(o31,i41);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o21->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o31->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,i41->edGetNumberOfLinks());
@@ -1264,7 +1345,8 @@ void EngineIntegrationTest::testLinkUpdate1()
   CPPUNIT_ASSERT_EQUAL(0,o51->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,i41->edGetNumberOfLinks());
   graph->edAddLink(o51,i41);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o21->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o31->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o51->edGetNumberOfOutLinks());
@@ -1275,11 +1357,13 @@ void EngineIntegrationTest::testLinkUpdate1()
   CPPUNIT_ASSERT_EQUAL(1,o51->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,i41->edGetNumberOfLinks());
   graph->edAddLink(o31,i41);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   graph->edAddLink(o22,i42);
   graph->edAddLink(o32,i42);
   graph->edAddLink(o52,i42);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o21->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o31->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o51->edGetNumberOfOutLinks());
@@ -1306,7 +1390,8 @@ void EngineIntegrationTest::testLinkUpdate1()
   CPPUNIT_ASSERT_EQUAL(1,i42->edGetNumberOfLinks());
   CPPUNIT_ASSERT_EQUAL(1,i62->edGetNumberOfLinks());
   graph->edRemoveChild(n6);//normally implies collector inputport deletion
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o22->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o32->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o52->edGetNumberOfOutLinks());
@@ -1365,7 +1450,7 @@ void EngineIntegrationTest::testLinkUpdate1()
 void EngineIntegrationTest::testLinkUpdate1DS()
 {
   Bloc *graph=new Bloc("Graph");
-
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   ToyNode *n1=new ToyNode("T1");
   InputDataStreamPort *i11=n1->edAddInputDataStreamPort("i11",Runtime::_tc_double);
   OutputDataStreamPort *o1=n1->edAddOutputDataStreamPort("o1",Runtime::_tc_double);
@@ -1401,7 +1486,8 @@ void EngineIntegrationTest::testLinkUpdate1DS()
   graph->edAddCFLink(mySwitch,n4);
   graph->edAddLink(o21,i41);
   graph->edAddLink(o31,i41);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o21->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o31->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,i41->edGetNumberOfLinks());// <-- important
@@ -1429,7 +1515,8 @@ void EngineIntegrationTest::testLinkUpdate1DS()
   //
   graph->edAddLink(o21,i41);
   graph->edAddLink(o31,i41);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o21->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o31->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,i41->edGetNumberOfLinks());
@@ -1445,7 +1532,8 @@ void EngineIntegrationTest::testLinkUpdate1DS()
   CPPUNIT_ASSERT_EQUAL(0,o51->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,i41->edGetNumberOfLinks());
   graph->edAddLink(o51,i41);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o21->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o31->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o51->edGetNumberOfOutLinks());
@@ -1456,11 +1544,13 @@ void EngineIntegrationTest::testLinkUpdate1DS()
   CPPUNIT_ASSERT_EQUAL(1,o51->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,i41->edGetNumberOfLinks());
   graph->edAddLink(o31,i41);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   graph->edAddLink(o22,i42);
   graph->edAddLink(o32,i42);
   graph->edAddLink(o52,i42);
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o21->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o31->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o51->edGetNumberOfOutLinks());
@@ -1487,7 +1577,8 @@ void EngineIntegrationTest::testLinkUpdate1DS()
   CPPUNIT_ASSERT_EQUAL(1,i42->edGetNumberOfLinks());
   CPPUNIT_ASSERT_EQUAL(1,i62->edGetNumberOfLinks());
   graph->edRemoveChild(n6);//normally implies collector inputport deletion
-  mySwitch->checkConsistency();
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   CPPUNIT_ASSERT_EQUAL(1,o22->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o32->edGetNumberOfOutLinks());
   CPPUNIT_ASSERT_EQUAL(1,o52->edGetNumberOfOutLinks());
@@ -1855,6 +1946,52 @@ void EngineIntegrationTest::testLinkUpdate2DS()
   delete graph;
 }
 
+void EngineIntegrationTest::testLinkUpdate3()
+{
+  Bloc *graph=new Bloc("Graph");
+  WhileLoop *loop2=new WhileLoop("loop2");
+  graph->edAddChild(loop2);
+  LimitNode *n1=new LimitNode("T1"); graph->edAddChild(n1);
+  OutputPort *o1s=n1->getSwitchPort();
+  graph->edAddCFLink(n1,loop2);
+  LimitNode *n2=new LimitNode("T2"); loop2->edSetNode(n2);
+  OutputPort *o2s=n2->getSwitchPort();
+  graph->edAddLink(o1s,loop2->edGetConditionPort());
+  graph->edAddLink(o2s,loop2->edGetConditionPort());
+  graph->edRemoveLink(o2s,loop2->edGetConditionPort());
+  graph->edRemoveLink(o1s,loop2->edGetConditionPort());
+  delete graph;
+}
+
+void EngineIntegrationTest::testLinkUpdate4()
+{
+  Bloc *graph1=new Bloc("graph1");
+  Bloc *graph2=new Bloc("graph2");
+  graph1->edAddChild(graph2);
+  ForEachLoop *forEach=new ForEachLoop("myFE",Runtime::_tc_double);
+  graph2->edAddChild(forEach);
+  ToyNode *n1=new ToyNode("T1");
+  OutputPort *o11=n1->edAddOutputPort("o11",Runtime::_tc_double);
+  Seq2ToyNode *n2=new Seq2ToyNode("n2");
+  graph2->edAddChild(n2);
+  graph2->edAddCFLink(forEach,n2);
+  forEach->edSetNode(n1);
+  Seq2ToyNode *n3=new Seq2ToyNode("n3");
+  graph1->edAddChild(n3);
+  graph1->edAddCFLink(graph2,n3);
+  //
+  CPPUNIT_ASSERT(graph1->edAddLink(o11,n2->edGetInValue1()));
+  CPPUNIT_ASSERT(!graph1->edAddLink(o11,n2->edGetInValue1()));
+  CPPUNIT_ASSERT(graph1->edAddLink(o11,n3->edGetInValue1()));
+  CPPUNIT_ASSERT(!graph1->edAddLink(o11,n3->edGetInValue1()));
+  graph1->edRemoveLink(o11,n2->edGetInValue1());
+  graph1->edRemoveLink(o11,n3->edGetInValue1());
+  //
+  graph1->edRemoveChild(graph2);
+  delete graph2;
+  delete graph1;
+}
+
 /*!
  * test of links between 2 loops to simulate coupling.
  */
@@ -2004,6 +2141,7 @@ void EngineIntegrationTest::deathTestForLinks()
 
 void EngineIntegrationTest::testForEachLoop1()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("graph");
   ForEachLoop *forEach=new ForEachLoop("myFE",Runtime::_tc_double);
   graph->edAddChild(forEach);
@@ -2034,6 +2172,8 @@ void EngineIntegrationTest::testForEachLoop1()
   int tab[]={12,14,16,18,20};
   vector<int> tabv(tab,tab+5);
   SequenceAnyPtr tmp=SequenceAny::New(tabv);//expected sequence
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   Executor exe;
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(3,(int)forEach->getNumberOfBranchesCreatedDyn());
@@ -2052,6 +2192,8 @@ void EngineIntegrationTest::testForEachLoop1()
   CPPUNIT_ASSERT_EQUAL(2,(int)forEach->getNumberOfBranchesCreatedDyn());
   Bloc *graph2=(Bloc *)graph->clone(0);
   delete graph;
+  graph2->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph2);
   CPPUNIT_ASSERT_EQUAL(2,(int)((ForEachLoop *)graph2->getChildByName("myFE"))->getNumberOfBranchesCreatedDyn());
   exe.RunW(graph2);
@@ -2064,6 +2206,7 @@ void EngineIntegrationTest::testForEachLoop1()
 
 void EngineIntegrationTest::testForEachLoop2()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("graph");
   ForEachLoop *forEach=new ForEachLoop("myFE",Runtime::_tc_double);
   graph->edAddChild(forEach);
@@ -2098,6 +2241,8 @@ void EngineIntegrationTest::testForEachLoop2()
   vector<int> tabv(tab,tab+5);
   SequenceAnyPtr tmp=SequenceAny::New(tabv);//expected sequence
   Executor exe;
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(3,(int)forEach->getNumberOfBranchesCreatedDyn());
   Any *val=n4->edGetSeqOut()->get();
@@ -2115,6 +2260,8 @@ void EngineIntegrationTest::testForEachLoop2()
   CPPUNIT_ASSERT_EQUAL(2,(int)forEach->getNumberOfBranchesCreatedDyn());
   Bloc *graph2=(Bloc *)graph->clone(0);
   delete graph;
+  graph2->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph2);
   CPPUNIT_ASSERT_EQUAL(2,(int)((ForEachLoop *)graph2->getChildByName("myFE"))->getNumberOfBranchesCreatedDyn());
   exe.RunW(graph2);
@@ -2128,6 +2275,7 @@ void EngineIntegrationTest::testForEachLoop2()
 //Multi inclusion of ForEach
 void EngineIntegrationTest::testForEachLoop3()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("graph");
   ForEachLoop *forEach1=new ForEachLoop("myFE1",Runtime::_tc_double);
   TypeCodeSeq *tc1=new TypeCodeSeq("","",Runtime::_tc_double);
@@ -2183,6 +2331,8 @@ void EngineIntegrationTest::testForEachLoop3()
   tmp=SequenceAny::New(tabvI3);
   tmpO->setEltAtRank(2,tmp);
   Executor exe;
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(3,(int)forEach2->getNumberOfBranchesCreatedDyn());
   Any *val=n2->edGetSeqOut()->get();
@@ -2203,6 +2353,10 @@ void EngineIntegrationTest::testForEachLoop3()
     }
   Bloc *graphCloned=(Bloc *)graph->clone(0);
   delete graph;
+  clone->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
+  graphCloned->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(clone);
   CPPUNIT_ASSERT_EQUAL(3,(int)clone->getNumberOfBranchesCreatedDyn());
   exe.RunW(clone);
@@ -2221,6 +2375,7 @@ void EngineIntegrationTest::testForEachLoop3()
 
 void EngineIntegrationTest::testForEachLoop4()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("graph");
   ForEachLoop *forEach1=new ForEachLoop("myFE1",Runtime::_tc_int);
   Switch *sw=new Switch("Sw1");
@@ -2269,6 +2424,9 @@ void EngineIntegrationTest::testForEachLoop4()
   //graph->edAddLink(n0->edGetSeqOut(),forEach1->edGetSeqOfSamplesPort());
   graph->edAddLink(n0->edGetSeqOut(),n2->edGetInValue2());
   Executor exe;
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(1==info.getNumberOfErrLinks(E_NEVER_SET_INPUTPORT));
   try
     {
       exe.RunW(graph);
@@ -2283,6 +2441,8 @@ void EngineIntegrationTest::testForEachLoop4()
   int tabI2[]={29,44,44,29,44,29,29,44};
   vector<int> tabvI2(tabI2,tabI2+8);
   SequenceAnyPtr tmp2=SequenceAny::New(tabvI2);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   Any *val=n2->edGetSeqOut()->get();
   CPPUNIT_ASSERT( *val==*tmp2 );
@@ -2293,6 +2453,8 @@ void EngineIntegrationTest::testForEachLoop4()
   CPPUNIT_ASSERT_EQUAL(7,(int)forEach1->getNumberOfBranchesCreatedDyn());
   Bloc *graphCloned=(Bloc *)graph->clone(0);
   delete graph;
+  graphCloned->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graphCloned);
   val=((Seq2ToyNode *)graphCloned->getChildByName("T2"))->edGetSeqOut()->get();
   delete graphCloned;
@@ -2303,6 +2465,7 @@ void EngineIntegrationTest::testForEachLoop4()
  */
 void EngineIntegrationTest::testForEachLoop5()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("graph");
   ForEachLoop *forEach=new ForEachLoop("myFE",Runtime::_tc_double);
   graph->edAddChild(forEach);
@@ -2335,6 +2498,8 @@ void EngineIntegrationTest::testForEachLoop5()
   vector<int> tabv(tab,tab+5);
   SequenceAnyPtr tmp=SequenceAny::New(tabv);//expected sequence
   Executor exe;
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_EQUAL(3,(int)forEach->getNumberOfBranchesCreatedDyn());
   Any *val=n4->edGetSeqOut()->get();
@@ -2367,6 +2532,7 @@ void EngineIntegrationTest::testForEachLoop5()
  */
 void EngineIntegrationTest::testForOptimizerLoop1()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("Global");
   OptimizerLoop *opt=new OptimizerLoop("myOptWthAlgSync",".libs/libPluginOptEvTest1","PluginOptEvTest1Factory",true);
   graph->edAddChild(opt);
@@ -2385,6 +2551,8 @@ void EngineIntegrationTest::testForOptimizerLoop1()
   opt->edGetNbOfBranchesPort()->edInit(2);
   opt->edGetPortForInitFile()->edInit("toto");
   Executor exe;
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)o2_1)->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
   CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() or 7==(int)opt->getNumberOfEltsConsumed());
@@ -2395,6 +2563,8 @@ void EngineIntegrationTest::testForOptimizerLoop1()
   CPPUNIT_ASSERT_EQUAL(2,(int)((DynParaLoop *)(opt))->getNumberOfBranchesCreatedDyn());
   Bloc *clone=(Bloc *)graph->clone(0);
   delete graph;
+  clone->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(clone);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)(clone->getOutPort("T2.o1")))->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
   CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
@@ -2412,6 +2582,7 @@ void EngineIntegrationTest::testForOptimizerLoop1()
  */
 void EngineIntegrationTest::testForOptimizerLoop2()
 {
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
   Bloc *graph=new Bloc("Global");
   OptimizerLoop *opt=new OptimizerLoop("myOptWthAlgSync",".libs/libPluginOptEvTest1","PluginOptEvTest1Factory",true);
   graph->edAddChild(opt);
@@ -2432,6 +2603,8 @@ void EngineIntegrationTest::testForOptimizerLoop2()
   opt->edGetNbOfBranchesPort()->edInit(2);
   opt->edGetPortForInitFile()->edInit("toto");
   Executor exe;
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(graph);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)o2_1)->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
   CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() or 7==(int)opt->getNumberOfEltsConsumed());
@@ -2442,13 +2615,15 @@ void EngineIntegrationTest::testForOptimizerLoop2()
   CPPUNIT_ASSERT_EQUAL(2,(int)((DynParaLoop *)(opt))->getNumberOfBranchesCreatedDyn());
   Bloc *clone=(Bloc *)graph->clone(0);
   delete graph;
+  clone->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
   exe.RunW(clone);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)(clone->getOutPort("T2.o1")))->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
-  CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("Bloc.myOptWthAlgSync")))->getNumberOfEltsConsumed());
+  CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
   CPPUNIT_ASSERT_EQUAL(2,(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfBranchesCreatedDyn());
   exe.RunW(clone);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)(clone->getOutPort("T2.o1")))->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
-  CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("Bloc.myOptWthAlgSync")))->getNumberOfEltsConsumed());
+  CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
   CPPUNIT_ASSERT_EQUAL(2,(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfBranchesCreatedDyn());
   delete clone;
 }
@@ -2774,8 +2949,9 @@ void EngineIntegrationTest::testForCheckConsistency1()
   checkSetsEqual(setExpected,s3); s3.clear(); setExpected.clear();
   list< vector<Node *> > vec;
   graph->findAllPathsStartingFrom<false>(n7, vec,accelStr);
-  graph->findAllNodesStartingFrom<false>(n7,s3,accelStr,info); accelStr.clear();setExpected=graph->edGetDirectDescendants(); setExpected.erase(n8); setExpected.erase(n7);
-  checkSetsEqual(setExpected,s3); s3.clear(); setExpected.clear();
+  graph->findAllNodesStartingFrom<false>(n7,s3,accelStr,info); accelStr.clear();//setExpected=graph->edGetDirectDescendants(); setExpected.erase(n8); setExpected.erase(n7);
+  //checkSetsEqual(setExpected,s3); 
+  s3.clear(); setExpected.clear();
   //Testing good reinitialisation
   setExpected.insert(n2); setExpected.insert(n4); setExpected.insert(n3); setExpected.insert(n10);
   setExpected.insert(n11); setExpected.insert(n12); setExpected.insert(n5); setExpected.insert(n6); setExpected.insert(n7); setExpected.insert(n8);
@@ -2840,7 +3016,7 @@ void EngineIntegrationTest::testForCheckConsistency1()
   OutputPort *o1_1=n1->edAddOutputPort("o1_1",Runtime::_tc_double);
   graph->edAddLink(o1_1,i11_1);
   graph->checkConsistency(info);
-  CPPUNIT_ASSERT_EQUAL(1,(int)info.getNumberOfInfoLinks(I_ALL)); CPPUNIT_ASSERT_EQUAL(2,(int)info.getNumberOfInfoLinks(I_USELESS)); CPPUNIT_ASSERT_EQUAL(0,(int)info.getNumberOfWarnLinksGrp(W_ALL));
+  CPPUNIT_ASSERT_EQUAL(2,(int)info.getNumberOfInfoLinks(I_ALL)); CPPUNIT_ASSERT_EQUAL(2,(int)info.getNumberOfInfoLinks(I_USELESS)); CPPUNIT_ASSERT_EQUAL(0,(int)info.getNumberOfWarnLinksGrp(W_ALL));
   CPPUNIT_ASSERT_EQUAL(0,(int)info.getNumberOfErrLinks(E_ALL));
   // collapse and useless ; useless
   OutputPort *o3_1=n3->edAddOutputPort("o3_1",Runtime::_tc_double);
@@ -2879,7 +3055,7 @@ void EngineIntegrationTest::testForCheckConsistency1()
   CPPUNIT_ASSERT( (pair<OutPort*,InPort *>(o12_1,i11_1)==info.getInfoLink(0,I_BACK_USELESS)) );
   graph->edAddLink(o11_1,i11_1);
   graph->checkConsistency(info);
-  CPPUNIT_ASSERT_EQUAL(2,(int)info.getNumberOfInfoLinks(I_ALL)); CPPUNIT_ASSERT_EQUAL(0,(int)info.getNumberOfWarnLinksGrp(W_ALL)); CPPUNIT_ASSERT_EQUAL(0,(int)info.getNumberOfErrLinks(E_ALL));
+  CPPUNIT_ASSERT_EQUAL(3,(int)info.getNumberOfInfoLinks(I_ALL)); CPPUNIT_ASSERT_EQUAL(0,(int)info.getNumberOfWarnLinksGrp(W_ALL)); CPPUNIT_ASSERT_EQUAL(0,(int)info.getNumberOfErrLinks(E_ALL));
   CPPUNIT_ASSERT_EQUAL(1,(int)info.getNumberOfInfoLinks(I_BACK)); CPPUNIT_ASSERT_EQUAL(2,(int)info.getNumberOfInfoLinks(I_BACK_USELESS));
   delete graph;
 }
@@ -2903,3 +3079,110 @@ void EngineIntegrationTest::testForCheckConsistency2()
   graph->findAllNodesStartingFrom<true>(n1,s3,accelStr,info); accelStr.clear();
   delete graph;
 }
+
+/*!
+ * Testing forwarding of check consistency.
+ */
+void EngineIntegrationTest::testForCheckConsistency3()
+{
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
+  ToyNode *n1=new ToyNode("T1"); ToyNode *n2=new ToyNode("T2"); ToyNode *n3=new ToyNode("T3");
+  Bloc *graph=new Bloc("Global");
+  Bloc *g1=new Bloc("G1"); Bloc *g2=new Bloc("G2");
+  graph->edAddChild(g1);
+  graph->edAddChild(g2);
+  g1->edAddChild(n1);
+  g2->edAddChild(n2);
+  g2->edAddChild(n3);
+  g2->edAddCFLink(n2,n3);
+  graph->edAddCFLink(g1,g2);
+  InputPort *i1_3=n3->edAddInputPort("i1_3",Runtime::_tc_double);
+  OutputPort *o1_1=n1->edAddOutputPort("o1_1",Runtime::_tc_double);
+  OutputPort *o2_1=n2->edAddOutputPort("o1_2",Runtime::_tc_double);
+  graph->edAddLink(o1_1,i1_3);
+  graph->edAddLink(o2_1,i1_3);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
+  CPPUNIT_ASSERT(1==info.getNumberOfInfoLinks(I_ALL)); CPPUNIT_ASSERT(1==info.getNumberOfInfoLinks(I_USELESS));
+  pair<OutPort *, InPort *> p=info.getInfoLink(0,I_USELESS);
+  CPPUNIT_ASSERT(p.first==o1_1); CPPUNIT_ASSERT(p.second==i1_3);
+  //now substituting g2 and graph in superv graph (by keeping same address)
+  graph->edRemoveChild(g1);
+  graph->edRemoveChild(g2);
+  g2->edRemoveChild(n2);
+  g2->edRemoveChild(n3);
+  g2->edAddChild(g1); g2->edAddChild(graph);
+  graph->edAddChild(n2); graph->edAddChild(n3);
+  graph->edAddCFLink(n2,n3);
+  g2->edAddCFLink(g1,graph);
+  g2->edAddLink(o1_1,i1_3);
+  g2->edAddLink(o2_1,i1_3);
+  g2->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
+  CPPUNIT_ASSERT(1==info.getNumberOfInfoLinks(I_ALL)); CPPUNIT_ASSERT(1==info.getNumberOfInfoLinks(I_USELESS));
+  p=info.getInfoLink(0,I_USELESS);
+  CPPUNIT_ASSERT(p.first==o1_1); CPPUNIT_ASSERT(p.second==i1_3);
+  g2->edRemoveLink(o1_1,i1_3);
+  g2->checkConsistency(info);
+  CPPUNIT_ASSERT(0==info.getNumberOfInfoLinks(I_ALL));
+  //Now back-links
+  InputPort *i1_1=n1->edAddInputPort("i1_1",Runtime::_tc_double);
+  InputPort *i1_2=n2->edAddInputPort("i1_2",Runtime::_tc_double);
+  OutputPort *o1_3=n3->edAddOutputPort("o1_3",Runtime::_tc_double);
+  g2->edAddLink(o1_3,i1_1);
+  g2->edAddLink(o1_3,i1_2);
+  g2->checkConsistency(info);
+  CPPUNIT_ASSERT(2==info.getNumberOfErrLinks(E_ALL)); CPPUNIT_ASSERT(2==info.getNumberOfErrLinks(E_ONLY_BACKWARD_DEFINED));
+  i1_1->edInit(0.); i1_2->edInit(0.);
+  g2->checkConsistency(info);
+  CPPUNIT_ASSERT(2==info.getNumberOfInfoLinks(I_ALL)); CPPUNIT_ASSERT(2==info.getNumberOfInfoLinks(I_BACK));
+  delete g2;
+}
+
+void EngineIntegrationTest::testForCheckConsistency4()
+{
+  LinkInfo info(LinkInfo::ALL_DONT_STOP);
+  ToyNode *n1=new ToyNode("T1"); ToyNode *n2=new ToyNode("T2"); ToyNode *n3=new ToyNode("T3"); ToyNode *n4=new ToyNode("T4");
+  Bloc *graph=new Bloc("Global");
+  InputPort *i1_4=n4->edAddInputPort("i1_4",Runtime::_tc_double);
+  OutputPort *o1_1=n1->edAddOutputPort("o1_1",Runtime::_tc_double);
+  OutputPort *o1_2=n2->edAddOutputPort("o1_2",Runtime::_tc_double);
+  OutputPort *o1_3=n3->edAddOutputPort("o1_3",Runtime::_tc_double);
+  Switch *mySwitch=new Switch("mySwitch");
+  mySwitch->edSetNode(0,n1);
+  mySwitch->edSetNode(7,n2);
+  graph->edAddChild(n3);
+  graph->edAddChild(n4);
+  graph->edAddChild(mySwitch);
+  graph->edAddCFLink(mySwitch,n4);
+  graph->edAddCFLink(n3,n4);
+  graph->edAddLink(o1_1,i1_4);
+  graph->edAddLink(o1_2,i1_4);
+  mySwitch->edGetConditionPort()->edInit(7);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(!info.areWarningsOrErrors());
+  graph->edAddLink(o1_3,i1_4);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(1==info.getNumberOfWarnLinksGrp(W_ALL));
+  graph->edRemoveLink(o1_1,i1_4);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(1==info.getNumberOfWarnLinksGrp(W_ALL));
+  CPPUNIT_ASSERT(1==info.getNumberOfErrLinks(E_ALL));
+  CPPUNIT_ASSERT(1==info.getNumberOfErrLinks(E_UNCOMPLETE_SW));
+  CPPUNIT_ASSERT(info.getErrRepr()=="For link to i1_4 of node T4 the cases of switch node named mySwitch do not define links for following cases ids :0 \n");
+  graph->edRemoveChild(mySwitch);
+  Bloc *bloc4Fun=new Bloc("bloc4Fun");
+  graph->edAddChild(bloc4Fun);
+  bloc4Fun->edAddChild(mySwitch);
+  graph->edAddCFLink(bloc4Fun,n4);
+  graph->edAddLink(o1_1,i1_4);
+  graph->edAddLink(o1_2,i1_4);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(1==info.getNumberOfWarnLinksGrp(W_ALL));
+  graph->edRemoveLink(o1_1,i1_4);
+  graph->checkConsistency(info);
+  CPPUNIT_ASSERT(1==info.getNumberOfWarnLinksGrp(W_ALL));
+  CPPUNIT_ASSERT(1==info.getNumberOfErrLinks(E_ALL));
+  CPPUNIT_ASSERT(1==info.getNumberOfErrLinks(E_UNCOMPLETE_SW));
+  delete graph;
+}