23 #ifndef ManagerTests_cpp 24 #define ManagerTests_cpp 26 #include <cppunit/ui/text/TestRunner.h> 27 #include <cppunit/TextOutputter.h> 28 #include <cppunit/extensions/TestFactoryRegistry.h> 29 #include <cppunit/extensions/HelperMacros.h> 30 #include <cppunit/TestAssert.h> 32 #include <coil/Task.h> 33 #include <coil/DynamicLib.h> 70 if(CORBA::is_nil(mgr->
getORB()))
76 while (mgr->
getORB()->work_pending())
78 if (mgr->
getORB()->work_pending())
79 mgr->
getORB()->perform_work();
84 std::cout<<
"Caught SystemException during perform_work."<<std::endl;
87 if (!CORBA::is_nil(mgr->
getPOA()))
95 mgr->
getPOA()->destroy(
false,
true);
97 catch (CORBA::SystemException& ex)
99 std::cout<<
"Caught SystemException during root POA destruction"<<std::endl;
103 std::cout<<
"Caught unknown exception during POA destruction."<<std::endl;
106 if(!CORBA::is_nil(mgr->
getORB()))
110 mgr->
getORB()->shutdown(
true);
113 catch (CORBA::SystemException& ex)
115 std::cout<<
"Caught CORBA::SystemException during ORB shutdown"<<std::endl;;
119 std::cout<<
"Caught unknown exception during ORB shutdown."<<std::endl;;
127 void log(
const std::string& msg)
129 m_log.push_back(msg);
135 for (
int i = 0; i < (int)
m_log.size(); ++i)
137 if (
m_log[i] == msg) ++count;
143 std::vector<std::string>
m_log;
187 if (m_logger != NULL) m_logger->log(
"InitProc");
202 :
RTC::RTObject_impl(orb, poa), m_logger(NULL)
207 throw (CORBA::SystemException)
210 if (m_logger != NULL) m_logger->log(
"initialize");
229 :
RTC::RTObject_impl(orb, poa)
234 throw (CORBA::SystemException)
242 CORBA::ORB_ptr orb = manager->
getORB();
243 PortableServer::POA_ptr poa = manager->
getPOA();
251 if (rtc != NULL) rtc->_remove_ref();
256 :
public CppUnit::TestFixture
261 CPPUNIT_TEST(test_getLogLevel);
262 CPPUNIT_TEST(test_getLoadedModules);
263 CPPUNIT_TEST(test_getFactoryProfiles);
264 CPPUNIT_TEST(test_createContext);
265 CPPUNIT_TEST(test_init2);
266 CPPUNIT_TEST(test_initFactories);
267 CPPUNIT_TEST(test_initComposite);
268 CPPUNIT_TEST(test_procContextArgs);
269 CPPUNIT_TEST(test_init_without_arguments);
270 CPPUNIT_TEST(test_instance);
271 CPPUNIT_TEST(test_instance_without_init);
276 CPPUNIT_TEST(test_getConfig);
277 CPPUNIT_TEST(test_setModuleInitProc);
281 CPPUNIT_TEST(test_load);
282 CPPUNIT_TEST(test_unload);
283 CPPUNIT_TEST(test_unloadAll);
284 CPPUNIT_TEST(test_registerFactory);
285 CPPUNIT_TEST(test_registerECFactory);
286 CPPUNIT_TEST(test_getModulesFactories);
288 CPPUNIT_TEST(test_getLoadableModules);
289 CPPUNIT_TEST(test_notifyFinalized);
305 CPPUNIT_TEST_SUITE_END();
312 bool isFound(
const std::vector<std::string>& list,
const std::string& target)
314 return ! (list.end() ==
std::find(list.begin(), list.end(), target));
320 = std::string(
"corbaloc::")
322 + std::string(
"/NameService");
324 CORBA::Object_var obj = m_mgr->
getORB()->string_to_object(nsName.c_str());
325 CosNaming::NamingContext_var rootContext = CosNaming::NamingContext::_narrow(obj);
326 if (CORBA::is_nil(rootContext))
328 throw std::bad_alloc();
334 bool canResolve(
const char* name_server,
const char*
id,
const char* kind)
336 CosNaming::NamingContext_var nc = getRootContext(name_server);
337 if (CORBA::is_nil(nc))
return false;
338 CosNaming::Name name;
343 CORBA::Object_var obj;
346 obj = nc->resolve(name);
348 catch (CosNaming::NamingContext::NotFound e)
354 std::cout <<
"nameserver->resolve() failed" << std::endl;
357 return !CORBA::is_nil(obj);
416 CPPUNIT_ASSERT(m_mgr != NULL);
431 CPPUNIT_ASSERT(m_mgr != NULL);
435 CPPUNIT_ASSERT_EQUAL(m_mgr, &instance);
461 CPPUNIT_ASSERT(m_mgr != NULL);
462 CPPUNIT_ASSERT(m_mgr->
getORB() != NULL);
463 CPPUNIT_ASSERT(m_mgr->
getPOA() != NULL);
466 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getORB()));
467 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
470 CPPUNIT_ASSERT(CORBA::is_nil(m_mgr->
getORB()));
471 CPPUNIT_ASSERT(CORBA::is_nil(m_mgr->
getPOA()));
487 CPPUNIT_ASSERT(m_mgr != NULL);
488 CPPUNIT_ASSERT(m_mgr->
getORB() != NULL);
491 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
498 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getORB()));
499 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
502 CPPUNIT_ASSERT(CORBA::is_nil(m_mgr->
getORB()));
503 CPPUNIT_ASSERT(CORBA::is_nil(m_mgr->
getPOA()));
531 char* argv[] = {
"ManagerTests",
"-f",
"fixture2.conf" };
534 CPPUNIT_ASSERT(m_mgr != NULL);
538 CPPUNIT_ASSERT_EQUAL(std::string(
"NO"),
540 CPPUNIT_ASSERT_EQUAL(std::string(
"fixture2.log"),
560 CPPUNIT_ASSERT(m_mgr != NULL);
566 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"InitProc"));
568 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"InitProc"));
587 CPPUNIT_ASSERT(m_mgr != NULL);
590 CORBA::ORB_ptr orb = m_mgr->
getORB();
591 CPPUNIT_ASSERT(! CORBA::is_nil(orb));
592 PortableServer::POA_ptr poa = m_mgr->
getPOA();
593 CPPUNIT_ASSERT(! CORBA::is_nil(poa));
596 CPPUNIT_ASSERT(rto != NULL);
599 PortableServer::ObjectId_var rtoId;
602 rtoId = poa->activate_object(rto);
604 catch(const ::PortableServer::POA::ServantAlreadyActive &)
606 rtoId = poa->servant_to_id(rto);
610 RTC::DataFlowComponent_ptr rtoRef
611 = RTC::DataFlowComponent::_narrow(poa->id_to_reference(rtoId));
612 CPPUNIT_ASSERT(! CORBA::is_nil(rtoRef));
624 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"initialize"));
625 rtoRef->initialize();
627 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"initialize"));
629 poa->deactivate_object(rtoId);
645 CPPUNIT_ASSERT(m_mgr != NULL);
648 CORBA::ORB_ptr orb = m_mgr->
getORB();
649 CPPUNIT_ASSERT(! CORBA::is_nil(orb));
650 PortableServer::POA_ptr poa = m_mgr->
getPOA();
651 CPPUNIT_ASSERT(! CORBA::is_nil(poa));
654 CPPUNIT_ASSERT(rto != NULL);
656 PortableServer::ObjectId_var rtoId;
659 rtoId = poa->activate_object(rto);
661 catch(const ::PortableServer::POA::ServantAlreadyActive &)
663 rtoId = poa->servant_to_id(rto);
666 RTC::DataFlowComponent_ptr rtoRef
667 = RTC::DataFlowComponent::_narrow(poa->id_to_reference(rtoId));
668 CPPUNIT_ASSERT(! CORBA::is_nil(rtoRef));
676 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"initialize"));
682 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"initialize"));
684 poa->deactivate_object(rtoId);
694 m_rtoRef = RTC::DataFlowComponent::_duplicate(rtoRef);
706 m_rtoRef->initialize();
731 char* argv[] = {
"ManagerTests",
"-f",
"fixture3.conf" };
734 CPPUNIT_ASSERT(m_mgr != NULL);
737 typedef int (*FUNC_GETINITPROCCOUNT)();
738 typedef void (*FUNC_RESETINITPROCCOUNT)();
741 FUNC_GETINITPROCCOUNT pGetInitProcCount
742 = (FUNC_GETINITPROCCOUNT) loader.symbol(
"getInitProcCount");
743 CPPUNIT_ASSERT(pGetInitProcCount != NULL);
745 FUNC_RESETINITPROCCOUNT pResetInitProcCount
746 = (FUNC_RESETINITPROCCOUNT) loader.symbol(
"resetInitProcCount");
747 CPPUNIT_ASSERT(pResetInitProcCount != NULL);
749 (*pResetInitProcCount)();
752 CPPUNIT_ASSERT_EQUAL(0, (*pGetInitProcCount)());
754 m_mgr->
load(
"./.libs/DummyModule.so",
"InitProc");
769 char* argv[] = {
"-f fixture3.conf" };
772 CPPUNIT_ASSERT(m_mgr != NULL);
775 typedef int (*FUNC_GETINITPROCCOUNT)();
776 typedef void (*FUNC_RESETINITPROCCOUNT)();
779 FUNC_GETINITPROCCOUNT pGetInitProcCount
780 = (FUNC_GETINITPROCCOUNT) loader.symbol(
"getInitProcCount");
781 CPPUNIT_ASSERT(pGetInitProcCount != NULL);
783 FUNC_RESETINITPROCCOUNT pResetInitProcCount
784 = (FUNC_RESETINITPROCCOUNT) loader.symbol(
"resetInitProcCount");
785 CPPUNIT_ASSERT(pResetInitProcCount != NULL);
787 (*pResetInitProcCount)();
790 CPPUNIT_ASSERT_EQUAL(0, (*pGetInitProcCount)());
791 m_mgr->
load(
"./.libs/DummyModule.so",
"InitProc");
810 char* argv[] = {
"ManagerTests",
"-f",
"fixture3.conf" };
813 CPPUNIT_ASSERT(m_mgr != NULL);
816 typedef int (*FUNC_GETINITPROCCOUNT)();
817 typedef void (*FUNC_RESETINITPROCCOUNT)();
822 FUNC_GETINITPROCCOUNT pGetInitProcCount1
823 = (FUNC_GETINITPROCCOUNT) loader1.symbol(
"getInitProcCount");
824 CPPUNIT_ASSERT(pGetInitProcCount1 != NULL);
826 FUNC_RESETINITPROCCOUNT pResetInitProcCount1
827 = (FUNC_RESETINITPROCCOUNT) loader1.symbol(
"resetInitProcCount");
828 CPPUNIT_ASSERT(pResetInitProcCount1 != NULL);
830 FUNC_GETINITPROCCOUNT pGetInitProcCount2
831 = (FUNC_GETINITPROCCOUNT) loader2.
symbol(
"getInitProcCount");
832 CPPUNIT_ASSERT(pGetInitProcCount2 != NULL);
834 FUNC_RESETINITPROCCOUNT pResetInitProcCount2
835 = (FUNC_RESETINITPROCCOUNT) loader2.
symbol(
"resetInitProcCount");
836 CPPUNIT_ASSERT(pResetInitProcCount2 != NULL);
838 (*pResetInitProcCount1)();
839 (*pResetInitProcCount2)();
842 CPPUNIT_ASSERT_EQUAL(0, (*pGetInitProcCount1)());
843 CPPUNIT_ASSERT_EQUAL(0, (*pGetInitProcCount2)());
847 m_mgr->
load(
"./.libs/DummyModule.so",
"InitProc");
848 m_mgr->
load(
"./.libs/DummyModule2.so",
"InitProc");
870 char* argv[] = {
"ManagerTests",
"-f",
"fixture3.conf" };
873 CPPUNIT_ASSERT(m_mgr != NULL);
876 typedef int (*FUNC_GETINITPROCCOUNT)();
877 typedef void (*FUNC_RESETINITPROCCOUNT)();
880 FUNC_GETINITPROCCOUNT pGetInitProcCount
881 = (FUNC_GETINITPROCCOUNT) loader.symbol(
"getInitProcCount");
882 CPPUNIT_ASSERT(pGetInitProcCount != NULL);
884 FUNC_RESETINITPROCCOUNT pResetInitProcCount
885 = (FUNC_RESETINITPROCCOUNT) loader.symbol(
"resetInitProcCount");
886 CPPUNIT_ASSERT(pResetInitProcCount != NULL);
888 (*pResetInitProcCount)();
890 CPPUNIT_ASSERT_EQUAL(0, (*pGetInitProcCount)());
891 m_mgr->
load(
"./.libs/DummyModule.so",
"InitProc");
895 CPPUNIT_ASSERT(props.size() > 0);
902 CPPUNIT_ASSERT_EQUAL(std::string(
"./.libs/DummyModule2.so"),
903 props[0].getProperty(
"module_file_path"));
918 CPPUNIT_ASSERT(m_mgr != NULL);
942 CPPUNIT_ASSERT(m_mgr != NULL);
947 RTC::ECCreate<RTC::PeriodicExecutionContext>,
948 RTC::ECDelete<RTC::PeriodicExecutionContext>));
953 RTC::ECCreate<RTC::PeriodicExecutionContext>,
954 RTC::ECDelete<RTC::PeriodicExecutionContext>));
969 CPPUNIT_ASSERT(m_mgr != NULL);
973 properties1.
setProperty(
"implementation_id",
"ID 1");
978 properties2.
setProperty(
"implementation_id",
"ID 2");
998 char* argv[] = {
"ManagerTests",
"-f",
"fixture4.conf" };
1001 CPPUNIT_ASSERT(m_mgr != NULL);
1002 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getORB()));
1003 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
1012 properties.
setProperty(
"implementation_id",
"DataFlowComponentFactory");
1013 properties.
setProperty(
"type_name",
"DataFlowComponent");
1020 RTC::ECCreate<RTC::PeriodicExecutionContext>,
1021 RTC::ECDelete<RTC::PeriodicExecutionContext>));
1025 CPPUNIT_ASSERT(comp != NULL);
1026 CPPUNIT_ASSERT(dynamic_cast<DataFlowComponentMock*>(comp) != NULL);
1027 CPPUNIT_ASSERT(! CORBA::is_nil(comp->_this()));
1028 CPPUNIT_ASSERT_EQUAL(
1029 std::string(
"DataFlowComponent0"),
1030 std::string(comp->getInstanceName()));
1034 CPPUNIT_ASSERT(ecList != NULL);
1035 CPPUNIT_ASSERT_EQUAL(1, (
int) ecList->length());
1040 const char* name_server =
"localhost:2809";
1041 nmgr.registerNameServer(
"corba", name_server);
1042 CPPUNIT_ASSERT(canResolve(name_server,
"DataFlowComponent0",
"rtc"));
1066 CPPUNIT_ASSERT(m_mgr != NULL);
1067 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getORB()));
1068 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
1073 CPPUNIT_ASSERT(comp1 == NULL);
1077 CPPUNIT_ASSERT(comp2 == NULL);
1084 char* argv[] = {
"ManagerTests",
"-f",
"fixture4.conf" };
1087 CPPUNIT_ASSERT(m_mgr != NULL);
1088 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getORB()));
1089 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
1098 properties.
setProperty(
"implementation_id",
"DataFlowComponentFactory");
1099 properties.
setProperty(
"type_name",
"DataFlowComponent");
1107 CPPUNIT_ASSERT(comp == NULL);
1125 char* argv[] = {
"ManagerTests",
"-f",
"fixture4.conf" };
1128 CPPUNIT_ASSERT(m_mgr != NULL);
1129 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getORB()));
1130 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
1139 properties.
setProperty(
"implementation_id",
"DataFlowComponentFactory");
1140 properties.
setProperty(
"type_name",
"DataFlowComponent");
1147 RTC::ECCreate<RTC::PeriodicExecutionContext>,
1148 RTC::ECDelete<RTC::PeriodicExecutionContext>));
1153 const char* name_server =
"localhost:2809";
1154 nmgr.registerNameServer(
"corba", name_server);
1159 CPPUNIT_ASSERT(comp != NULL);
1160 CPPUNIT_ASSERT(dynamic_cast<DataFlowComponentMock*>(comp) != NULL);
1161 CPPUNIT_ASSERT(! CORBA::is_nil(comp->_this()));
1162 CPPUNIT_ASSERT_EQUAL(
1163 std::string(
"DataFlowComponent0"),
1168 CPPUNIT_ASSERT(ecList != NULL);
1169 CPPUNIT_ASSERT_EQUAL(1, (
int) ecList->length());
1174 CPPUNIT_ASSERT(!canResolve(name_server,
"DataFlowComponent0",
"rtc"));
1175 CPPUNIT_ASSERT_EQUAL(comp, m_mgr->
getComponent(
"DataFlowComponent0"));
1178 CPPUNIT_ASSERT(! canResolve(name_server,
"DataFlowComponent0",
"rtc"));
1179 CPPUNIT_ASSERT(m_mgr->
getComponent(
"DataFlowComponent0") == NULL);
1212 char* argv[] = {
"ManagerTests",
"-f",
"fixture4.conf" };
1215 CPPUNIT_ASSERT(m_mgr != NULL);
1216 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getORB()));
1217 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
1226 properties.
setProperty(
"implementation_id",
"DataFlowComponentFactory");
1227 properties.
setProperty(
"type_name",
"DataFlowComponent");
1234 RTC::ECCreate<RTC::PeriodicExecutionContext>,
1235 RTC::ECDelete<RTC::PeriodicExecutionContext>));
1239 CPPUNIT_ASSERT(comp1 != NULL);
1240 CPPUNIT_ASSERT(dynamic_cast<DataFlowComponentMock*>(comp1) != NULL);
1241 CPPUNIT_ASSERT(! CORBA::is_nil(comp1->_this()));
1244 CPPUNIT_ASSERT(comp2 != NULL);
1245 CPPUNIT_ASSERT(dynamic_cast<DataFlowComponentMock*>(comp2) != NULL);
1246 CPPUNIT_ASSERT(! CORBA::is_nil(comp2->_this()));
1248 CPPUNIT_ASSERT(comp1 != comp2);
1252 CPPUNIT_ASSERT_EQUAL(2, (
int) comps.size());
1253 CPPUNIT_ASSERT(
std::find(comps.begin(), comps.end(), comp1) != comps.end());
1254 CPPUNIT_ASSERT(
std::find(comps.begin(), comps.end(), comp2) != comps.end());
1259 CPPUNIT_ASSERT(
std::find(comps.begin(), comps.end(), comp1) == comps.end());
1260 CPPUNIT_ASSERT(
std::find(comps.begin(), comps.end(), comp2) != comps.end());
1291 CPPUNIT_ASSERT(m_mgr != NULL);
1295 CPPUNIT_ASSERT(bret);
1298 CPPUNIT_ASSERT(bret);
1301 CPPUNIT_ASSERT(bret);
1304 CPPUNIT_ASSERT(bret);
1307 CPPUNIT_ASSERT(bret);
1311 CPPUNIT_ASSERT(bret);
1315 CPPUNIT_ASSERT(bret);
1319 CPPUNIT_ASSERT(bret);
1323 CPPUNIT_ASSERT(bret);
1335 CPPUNIT_ASSERT(m_mgr != NULL);
1349 std::string ec_args;
1359 CPPUNIT_ASSERT(!bret);
1362 ec_args =
"periodic?rate=1000?policy=skip";
1364 CPPUNIT_ASSERT(!bret);
1367 ec_args =
"?rate=1000";
1369 CPPUNIT_ASSERT(!bret);
1372 ec_args =
"periodic?rate=1000";
1374 CPPUNIT_ASSERT(bret);
1375 std::string chk_val(
"periodic");
1376 CPPUNIT_ASSERT_EQUAL(chk_val, ec_id);
1378 CPPUNIT_ASSERT_EQUAL(chk_val, ec_prop[
"rate"]);
1391 CPPUNIT_ASSERT(m_mgr != NULL);
1393 CPPUNIT_ASSERT_EQUAL(std::string(
"INFO"), log_level);
1404 char* argv[] = {
"ManagerTests",
"-f",
"fixture3.conf" };
1407 CPPUNIT_ASSERT(m_mgr != NULL);
1410 typedef int (*FUNC_GETINITPROCCOUNT)();
1411 typedef void (*FUNC_RESETINITPROCCOUNT)();
1444 CPPUNIT_ASSERT(m_mgr != NULL);
1448 properties.
setProperty(
"implementation_id",
"ID");
1456 CPPUNIT_ASSERT(props.size() > 0);
1458 CPPUNIT_ASSERT_EQUAL(std::string(
"PeriodicECSharedComposite"),
1459 props[0].getProperty(
"implementation_id"));
1460 CPPUNIT_ASSERT_EQUAL(std::string(
"ID"),
1461 props[1].getProperty(
"implementation_id"));
1472 std::string ec_args;
1475 CPPUNIT_ASSERT(m_mgr != NULL);
1480 CPPUNIT_ASSERT(ec == NULL);
1483 ec_args =
"periodic?rate=1000";
1485 CPPUNIT_ASSERT(ec == NULL);
1489 RTC::ECCreate<RTC::PeriodicExecutionContext>,
1490 RTC::ECDelete<RTC::PeriodicExecutionContext>);
1491 ec_args =
"PeriodicEC?rate=1000";
1493 CPPUNIT_ASSERT(ec != NULL);
1504 char* argv[] = {
"ManagerTests",
"-f",
"fixture4.conf" };
1507 CPPUNIT_ASSERT(m_mgr != NULL);
1508 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getORB()));
1509 CPPUNIT_ASSERT(! CORBA::is_nil(m_mgr->
getPOA()));
1518 properties.
setProperty(
"implementation_id",
"DataFlowComponentFactory");
1519 properties.
setProperty(
"type_name",
"DataFlowComponent");
1526 RTC::ECCreate<RTC::PeriodicExecutionContext>,
1527 RTC::ECDelete<RTC::PeriodicExecutionContext>));
1531 CPPUNIT_ASSERT(comp != NULL);
1532 CPPUNIT_ASSERT(dynamic_cast<DataFlowComponentMock*>(comp) != NULL);
1533 CPPUNIT_ASSERT(! CORBA::is_nil(comp->_this()));
1534 CPPUNIT_ASSERT_EQUAL(
1535 std::string(
"DataFlowComponent0"),
1536 std::string(comp->getInstanceName()));
1538 CPPUNIT_ASSERT(m_mgr->
getComponent(
"DataFlowComponent0") != NULL);
1539 std::vector<RTC::RTObject_impl*> comps = m_mgr->
getComponents();
1540 CPPUNIT_ASSERT(comps.size() > 0);
1544 CPPUNIT_ASSERT(m_mgr->
getComponent(
"DataFlowComponent0") == NULL);
1584 int main(
int argc,
char* argv[])
1597 std::string arg(argv[i]);
1598 std::string next_arg;
1599 if (i + 1 < argc) next_arg = argv[i + 1];
1602 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
1615 ofs.open(fname.c_str());
1617 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
1618 if ( arg ==
"--cerr" ) { target = 1;
break; }
1619 if ( arg ==
"--xsl" )
1621 if (next_arg ==
"") xsl =
"default.xsl";
1622 else xsl = next_arg;
1624 if ( arg ==
"--namespace" )
1628 std::cerr <<
"no namespace specified" << std::endl;
1638 CppUnit::TextUi::TestRunner runner;
1640 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
1642 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
1643 CppUnit::Outputter* outputter = 0;
1644 std::ostream* stream = target ? &std::cerr : &std::cout;
1648 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
1651 std::cout <<
"XML_OUT" << std::endl;
1652 outputter =
new CppUnit::XmlOutputter(&runner.result(),
1654 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
1657 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
1660 runner.setOutputter(outputter);
1665 #endif // ManagerTests_cpp void test_registerECFactory()
registerECFactory()
int main(int argc, char **argv)
PortableServer::POAManager_ptr getPOAManager()
Get POAManager that Manager has.
void test_bindExecutionContext()
void test_notifyFinalized()
RTObject_impl * createComponent(const char *comp_args)
Create RT-Components.
void test_init2()
init()、shutdown()から呼ばれるprotected関数のテスト
bool procContextArgs(const char *ec_args, std::string &ec_id, coil::Properties &ec_conf)
Extracting ExecutionContext's name/properties from the given string.
InPortCorbaCdrConsumer class.
void deleteComponent(RTObject_impl *comp)
Unregister RT-Components that have been registered to Manager.
void DeleteDataFlowComponentMock(RTC::RtcBase *rtc)
virtual ReturnCode_t initialize()
[CORBA interface] Initialize the RTC that realizes this interface.
void test_unload()
unload()メソッドのテスト
bool hasFactory(const Identifier &id)
Factory presence check.
unsigned int sleep(unsigned int seconds)
Stop a processing at specified second time.
void test_getLoadableModules()
getLoadableModules()メソッドのテスト
void test_createComponent_DataFlowComponent()
createComponent()メソッドのテスト(DataFlowComponentの場合)
PortableServer::POA_ptr getPOA()
Get a pointer to RootPOA held by Manager.
InvokerMock(const RTC::DataFlowComponent_ptr &rtoRef, RTC::Manager *mgr)
void log(const std::string &msg)
void * symbol(const char *symbol_name)
Return an address of the memory where a symbol was loaded.
void runManager(bool no_block=false)
Run the Manager.
RTObject_impl * getComponent(const char *instance_name)
Get RT-Component's pointer.
void test_createComponent_with_illegal_module_name()
createComponent()メソッドのテスト
void test_terminate_after_the_activation()
terminate()メソッドのテスト
void test_init_without_arguments()
init()メソッドのテスト
std::vector< coil::Properties > getLoadableModules()
Get a list of loadable modules.
void test_runManager_no_block()
runManager()メソッドのテスト(非ブロッキングモード)
bool canResolve(const char *name_server, const char *id, const char *kind)
void test_getPOAManager()
void shutdown()
Shutdown Manager.
A base class for ExecutionContext.
std::string & getLogLevel()
Get the log level of the configuration.
void test_terminate_immediately_after_the_initialization()
terminate()メソッドのテスト
void terminate()
Terminate manager.
void test_registerFactory()
registerFactory()メソッドのテスト
void load(const char *fname, const char *initfunc)
[CORBA interface] Load module
void test_unloadAll()
unloadAll()メソッドのテスト
std::vector< std::string > m_log
void test_cleanupComponent()
cleanupComponent()メソッドのテスト
static void setLogger(Logger *logger)
void test_getFactoryProfiles()
getFactoryProfiles()メソッドのテスト
CORBA::ORB_ptr getORB()
Get the pointer to ORB.
bool isFound(const std::vector< std::string > &list, const std::string &target)
void test_getModulesFactories()
getModulesFactories()メソッドのテスト
void test_createContext()
createContext()メソッドのテスト
static GlobalFactory< AbstractClass, Identifier, Compare, Creator, Destructor > & instance()
Create instance.
static Manager & instance()
Get instance of the manager.
UniqueId attach_context(ExecutionContext_ptr exec_context)
[CORBA interface] Attach ExecutionContext
GlobalFactory template class.
OutPortCorbaCdrConsumer class.
RTComponent manager class.
InPortCorbaCdrProvider class.
virtual ~ManagerTests()
Destructor.
virtual void tearDown()
Test finalization.
void test_getLogLevel()
getLogLevel()メソッドのテスト
RTObjectMock(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
std::vector< coil::Properties > getFactoryProfiles()
Get profiles of factories.
std::vector< ExecutionContext * > ExecutionContextList
static void InitProc(RTC::Manager *manager)
coil::Properties & getConfig()
Get the manager configuration.
virtual RTC::ReturnCode_t initialize()
[CORBA interface] Initialize the RTC that realizes this interface.
void test_instance()
instance()メソッドのテスト
Periodic Execution Context Shared Composite Component class.
void setObjRef(const RTObject_ptr rtobj)
[local interface] Set the object reference
ExecutionContextHandle_t UniqueId
PeiodicTaskFactory class.
void test_procContextArgs()
procContextArgs()メソッドのテスト
std::vector< std::string > getModulesFactories()
Get the list of all Factories.
CORBA::Long find(const CorbaSequence &seq, Functor f)
Return the index of CORBA sequence element that functor matches.
static Manager * init(int argc, char **argv)
Initialize manager.
void test_activateManager()
DataFlowComponentMock(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
std::string setProperty(const std::string &key, const std::string &value)
Set a value associated with key in the property list.
RTC::UniqueId attach_context(RTC::ExecutionContext_ptr exec_context)
ExtTrigExecutionContext class.
RTC::RtcBase * CreateDataFlowComponentMock(RTC::Manager *manager)
ExecutionContextBase * createContext(const char *ec_args)
Create Context.
int countLog(const std::string &line)
void test_getComponents()
getComponents()メソッドのテスト
CPPUNIT_TEST_SUITE_REGISTRATION(Tests::ManagerTests)
void join()
Wait for Manager's termination.
virtual ReturnCode_t exit()
[CORBA interface]top the RTC's execution context(s) and finalize it along with its contents...
void test_setModuleInitProc()
setModuleInitProc()メソッドのテスト
void test_createComponent_failed_in_bindExecutionContext()
const char * getInstanceName()
[local interface] Get instance name
bool activateManager()
Activate the Manager.
bool registerECFactory(const char *name, ECNewFunc new_func, ECDeleteFunc delete_func)
Register ExecutionContext Factory.
ManagerTests()
Constructor.
void shutdown_ORB(RTC::Manager *mgr)
naming Service helper class
virtual ExecutionContextList * get_owned_contexts()
[CORBA interface] Get ExecutionContextList.
RTC::DataFlowComponent_ptr m_rtoRef
void unloadAll()
Unload all modules.
Class represents a set of properties.
void test_runManager_block()
runManager()メソッドのテスト(ブロッキングモード)
ExecutionContext Factory class.
CosNaming::NamingContext_var getRootContext(const std::string &name_server)
int countLog(const std::string &msg)
virtual void setUp()
Test initialization.
void setModuleInitProc(ModuleInitProc proc)
Set initial procedure.
PeriodicExecutionContext class.
void test_initFactories()
initFactories()メソッドのテスト
void test_instance_without_init()
instance()メソッドのテスト
PeiodicTaskFactory class.
::OutPortBase::Logger logger
void test_unregisterComponent()
void setLogger(Logger *logger)
void cleanupComponent(RTObject_impl *comp)
Unregister RT-Components.
bool procContextArgs(const char *ec_args, std::string &ec_id, coil::Properties &ec_conf)
void test_createComponent_Non_DataFlowComponent()
virtual ~ManagerTestMock(void)
void test_load()
load()メソッドのテスト
void test_getLoadedModules()
getLoadedModules()メソッドのテスト
void test_initComposite()
initComposite()メソッドのテスト
NamingServer management class.
void test_deleteComponent()
deleteComponent()メソッドのテスト
virtual int svc(void)
Execute thread.
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
Register RT-Component Factory.
void test_getConfig()
getConfig()メソッドのテスト
static void clearInstance()
const std::string & getProperty(const std::string &key) const
Search for the property with the specified key in this property.
OutPortCorbaCdrProvider class.
std::vector< RTObject_impl * > getComponents()
Get all RT-Components registered in the Manager.
int usleep(useconds_t usec)
Stop a processing at specified micro second time.