- for (int iter = 0; iter < 3 ; iter++)
- {
- INFOS("----------------------------------------------------" << iter);
- string dirn = getenv("SALOME_ROOT_DIR");
- dirn += "/lib/libSalomeTestComponentEngine.so";
- obj = iGenFact->load_impl("SalomeTestComponent",dirn.c_str());
- m1 = Engines::TestComponent::_narrow(obj);
- INFOS("recup m1");
- SCRUTE(m1->instanceName());
- INFOS("Coucou " << m1->Coucou(1L));
- iGenFact->remove_impl(m1) ;
- //iGenFact->finalize_removal() ; // unpredictable results ...
- sleep(5);
- }
+ MESSAGE("------------------------------- create instances ");
+ for (int iter = 0; iter < nbInstances ; iter++)
+ {
+ instances[iter] = create_instance(iGenFact,"SalomeTestComponent");
+ }
+
+ MESSAGE("------------------------------ set env instances ");
+ for (int iter = 0; iter < nbInstances ; iter++)
+ {
+ Engines::TestComponent_var anInstance = instances[iter];
+ SCRUTE(anInstance->instanceName());
+ Engines::FieldsDict_var dico = new Engines::FieldsDict;
+ dico->length(3);
+ dico[0].key=CORBA::string_dup("key_0");
+ dico[0].value <<="value_0";
+ dico[1].key=CORBA::string_dup("key_1");
+ dico[1].value <<=(CORBA::UShort)72;
+ dico[2].key=CORBA::string_dup("key_2");
+ dico[2].value <<=(CORBA::ULong)iter;
+ anInstance->setProperties(dico);
+ MESSAGE("Coucou " << anInstance->Coucou(iter));
+ anInstance->Setenv();
+ }
+
+ MESSAGE("---------------------------------- get instances ");
+ for (int iter = 0; iter < nbInstances ; iter++)
+ {
+ Engines::TestComponent_var anInstance = instances[iter];
+ SCRUTE(anInstance->instanceName());
+ Engines::FieldsDict_var dico2 = anInstance->getProperties();
+ for (CORBA::ULong i=0; i<dico2->length(); i++)
+ {
+ MESSAGE("dico2["<<i<<"].key="<<dico2[i].key);
+ MESSAGE("dico2["<<i<<"].value type ="<<dico2[i].value.type()->kind());
+ if (dico2[i].value.type()->kind() == CORBA::tk_string)
+ {
+ const char* value;
+ dico2[i].value >>= value;
+ MESSAGE("dico2["<<i<<"].value="<<value);
+ }
+ }
+ }
+
+ MESSAGE("------------------------------- remove instances ");
+ for (int iter = 0; iter < nbInstances ; iter++)
+ {
+ Engines::TestComponent_var anInstance = instances[iter];
+ SCRUTE(anInstance->instanceName());
+ iGenFact->remove_impl(anInstance) ;
+ //iGenFact->finalize_removal() ; // unpredictable results ...
+ }
+ MESSAGE("------------------------------- PYTHON ");
+ {
+// bool isLib =
+// iGenFact->load_component_Library("SALOME_TestComponentPy");
+// ASSERT(isLib);
+// CORBA::Object_var obj =
+// iGenFact->create_component_instance("SALOME_TestComponentPy",
+// 0);
+// Engines::TestComponent_var anInstance =
+// Engines::TestComponent::_narrow(obj);
+// MESSAGE("create anInstance");
+// SCRUTE(anInstance->instanceName());
+ MESSAGE("------------------------------- create instances ");
+ for (int iter = 0; iter < nbInstances ; iter++)
+ {
+ instances[iter] = create_instance(iGenFact,"SALOME_TestComponentPy");
+ }
+
+ MESSAGE("---------------------------------- get instances ");
+ for (int iter = 0; iter < nbInstances ; iter++)
+ {
+ Engines::TestComponent_var anInstance = instances[iter];
+ SCRUTE(anInstance->instanceName());
+ MESSAGE("Coucou " << anInstance->Coucou(iter));
+ }
+ }
+