void KmfCppTest::testKmfSerializer(){ DeployUnit *d =new DeployUnit(); d->name = "CPPNodeType"; d->groupName = "org.kevoree.library"; d->version = "1.0"; d->type ="elf32-i386"; DeployUnit *d2 =new DeployUnit(); d2->name = "CPPNodeType"; d2->groupName = "org.kevoree.library"; d2->version = "1.0"; d2->type ="elf32-i386"; JSONModelSerializer ser; CPPUNIT_ASSERT( ser.serialize(d).compare(ser.serialize(d2)) == 0); }
void KevScriptTest::theUltimeTest(){ DefaultkevoreeFactory factory; JSONModelLoader loader; JSONModelSerializer jml ; KevScriptEngine kse; ContainerRoot *model=NULL; ifstream f; f.open ("./dataTest/KevScriptTest/kevscriptKevCPP.kevs"); loader.setFactory(&factory); ifstream json_file; json_file.open ("./dataTest/KevScriptTest/model_to_check.json"); if(!json_file){ cout << "no json_file trace" << endl; } ContainerRoot *model_to_compare = (ContainerRoot*)loader.loadModelFromStream(json_file)->front(); CPPUNIT_ASSERT(model_to_compare !=NULL); try { model = factory.createContainerRoot(); CPPUNIT_ASSERT(model !=NULL); if(f){ kse.executeFromStream(f,model); ofstream myfile; myfile.open ("/Users/Aymeric/Documents/dev_Kevoree/kevoree-cpp/debug/bin/kev.json"); myfile << jml.serialize(model); myfile.close(); ModelCompare *compare= new ModelCompare(); list<ModelTrace*>* lst2 =model->toTraces(true, true) ; for(list<ModelTrace*>::iterator it = lst2->begin() ; it != lst2->end(); ++it){ ModelTrace* mt = *it ; //cout << mt->toString()<< endl ; } // cout <<"-----------"<< endl ; lst2 =model_to_compare->toTraces(true, true) ; for(list<ModelTrace*>::iterator it = lst2->begin() ; it != lst2->end(); ++it){ ModelTrace* mt = *it ; //cout << mt->toString()<< endl ; } // cout <<"-----------"<< endl ; // FIX ME TraceSequence *sequencediff = compare->diff(model,model_to_compare); list<ModelTrace*> lst = sequencediff->traces; //cout <<sequencediff->traces.size() << endl ; for(list<ModelTrace*>::iterator it = lst.begin() ; it != lst.end(); ++it){ ModelTrace* mt = *it ; //cout << mt->toString()<< endl ; } CPPUNIT_ASSERT(sequencediff->traces.size() != 0); delete compare; delete sequencediff; } } catch(std::exception const& e) { LOGGER_WRITE(Logger::ERROR," "+string(e.what())); } // TODO AYMERIC CPPUNIT_ASSERT(1); delete model; }