[openrtm-commit:01293] r2488 - in branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest: ComponentActionServant ConfigurationServant DataFlowComponentActionServant ExecutionContextServant ExecutionContextServiceServant FsmObjectServant FsmParticipantActionServant FsmServiceServant LightweightRTObjectServant ModeCapableServant MultiModeComponentActionServant OrganizationServant stubs
openrtm @ openrtm.org
openrtm @ openrtm.org
2014年 2月 15日 (土) 01:48:47 JST
Author: win-ei
Date: 2014-02-15 01:48:47 +0900 (Sat, 15 Feb 2014)
New Revision: 2488
Modified:
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ComponentActionServant/ComponentActionServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ComponentActionServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ConfigurationServant/ConfigurationServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ConfigurationServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/DataFlowComponentActionServant/DataFlowComponentActionServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/DataFlowComponentActionServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServant/ExecutionContextServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServiceServant/ExecutionContextServiceServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServiceServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmObjectServant/FsmObjectServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmObjectServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmParticipantActionServant/FsmParticipantActionServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmParticipantActionServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmServiceServant/FsmServiceServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmServiceServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/LightweightRTObjectServant/LightweightRTObjectServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/LightweightRTObjectServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ModeCapableServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ModeCapableServant/ModeCapableServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/MultiModeComponentActionServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/MultiModeComponentActionServant/MultiModeComponentActionServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/OrganizationServant/Makefile.am
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/OrganizationServant/OrganizationServantTests.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ComponentActionImpl.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ComponentActionImpl.h
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ConfigurationImpl.cpp
branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/Makefile.am
Log:
Daily work.
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ComponentActionServant/ComponentActionServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ComponentActionServant/ComponentActionServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ComponentActionServant/ComponentActionServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -17,9 +17,15 @@
#ifndef ComponentActionServant_cpp
#define ComponentActionServant_cpp
+#include <unistd.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <ComponentActionServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/ComponentActionImpl.h>
+#include <stubs/Logger.h>
/*!
* @class ComponentActionServantTests class
@@ -44,6 +50,10 @@
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::ComponentActionImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::ComponentActionServant * CServant;
public:
@@ -52,6 +62,14 @@
*/
ComponentActionServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::ComponentActionImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::ComponentActionServant>,
+ doil::Delete<RTC::CORBA::ComponentActionServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::ComponentActionServant*>(Servant);
}
/*!
@@ -59,6 +77,8 @@
*/
~ComponentActionServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -77,30 +97,100 @@
void test_call_on_initialize()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_initialize");
+ ::RTC::ReturnCode_t result;
+ result = CServant->on_initialize();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
}
void test_call_on_finalize()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_finalize");
+ ::RTC::ReturnCode_t result;
+ result = CServant->on_finalize();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
}
void test_call_on_startup()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_startup");
+ ::RTC::ReturnCode_t result;
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ result = CServant->on_startup(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
}
void test_call_on_shutdown()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_shutdown");
+ ::RTC::ReturnCode_t result;
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ result = CServant->on_shutdown(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
}
void test_call_on_activated()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_activated");
+ ::RTC::ReturnCode_t result;
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ result = CServant->on_activated(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
}
void test_call_on_deactivated()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_deactivated");
+ ::RTC::ReturnCode_t result;
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ result = CServant->on_deactivated(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
}
void test_call_on_aborting()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_aborting");
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ ::RTC::ReturnCode_t result;
+ result = CServant->on_aborting(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
}
void test_call_on_error()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_error");
+ ::RTC::ReturnCode_t result;
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ result = CServant->on_error(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
}
void test_call_on_reset()
{
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_reset");
+ ::RTC::ReturnCode_t result;
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ result = CServant->on_reset(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
}
/* test case */
void test_case0()
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ComponentActionServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ComponentActionServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ComponentActionServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -31,6 +31,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I$(open_rtm_dir)/coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -46,14 +48,18 @@
ComponentActionServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
ComponentActionServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
ComponentActionServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+ComponentActionServantTests_SOURCES += ../stubs/ComponentActionImpl.cpp
+ComponentActionServantTests_SOURCES += ../stubs/Logger.cpp
ComponentActionServantTests_LDFLAGS = -L$(libdir)
+#ComponentActionServantTests_LDFLAGS += -L../stubs
ComponentActionServantTests_LDADD = -lomniORB4
ComponentActionServantTests_LDADD += -lomnithread
ComponentActionServantTests_LDADD += -lomniDynamic4
ComponentActionServantTests_LDADD += -lcoil
ComponentActionServantTests_LDADD += -lcppunit
+#ComponentActionServantTests_LDADD += -lstubs
ComponentActionServantTests_LDADD += $(target_srcdir)/ComponentActionServant.o
ComponentActionServantTests_LDADD += $(target_srcdir)/RTCTypeConversion.o
ComponentActionServantTests_LDADD += $(target_srcdir)/SDOPackageTypeConversion.o
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ConfigurationServant/ConfigurationServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ConfigurationServant/ConfigurationServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ConfigurationServant/ConfigurationServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -316,13 +316,11 @@
CPPUNIT_ASSERT(CServant);
std::string str("set_configuration_set_values");
- std::string config_id("hoge");
::SDOPackage::ConfigurationSet set;
::CORBA::Boolean result;
result = CServant->set_configuration_set_values(set);
CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("not argument", Log.pop(), config_id);
}
/*!
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ConfigurationServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ConfigurationServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ConfigurationServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -36,6 +36,7 @@
AM_CPPFLAGS += -I../../../../../../
AM_CPPFLAGS += -I/usr/include/omniORB4/
AM_CPPFLAGS += -I/usr/include/omniORB4/internal/
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -51,6 +52,7 @@
ConfigurationServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
ConfigurationServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
ConfigurationServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+ConfigurationServantTests_SOURCES += ../stubs/ConfigurationImpl.cpp
ConfigurationServantTests_LDFLAGS = -L$(libdir)
ConfigurationServantTests_LDFLAGS += -L../stubs
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/DataFlowComponentActionServant/DataFlowComponentActionServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/DataFlowComponentActionServant/DataFlowComponentActionServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/DataFlowComponentActionServant/DataFlowComponentActionServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,11 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <DataFlowComponentActionServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/DataFlowComponentActionImpl.h>
+#include <stubs/Logger.h>
/*!
* @class DataFlowComponentActionServantTests class
@@ -31,10 +36,17 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(DataFlowComponentActionServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_on_execute);
+ CPPUNIT_TEST(test_call_on_state_update);
+ CPPUNIT_TEST(test_call_on_rate_changed);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::DataFlowComponentActionImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::DataFlowComponentActionServant * CServant;
public:
@@ -43,6 +55,14 @@
*/
DataFlowComponentActionServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::DataFlowComponentActionImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::DataFlowComponentActionServant>,
+ doil::Delete<RTC::CORBA::DataFlowComponentActionServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::DataFlowComponentActionServant*>(Servant);
}
/*!
@@ -50,6 +70,8 @@
*/
~DataFlowComponentActionServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -66,6 +88,39 @@
{
}
+ void test_call_on_execute()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_execute");
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ ::RTC::ReturnCode_t result;
+ result = CServant->on_execute(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_on_state_update()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_state_update");
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ ::RTC::ReturnCode_t result;
+ result = CServant->on_state_update(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_on_rate_changed()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_rate_changed");
+ ::RTC::ExecutionContextHandle_t exec_handle;
+ ::RTC::ReturnCode_t result;
+ result = CServant->on_rate_changed(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
{
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/DataFlowComponentActionServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/DataFlowComponentActionServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/DataFlowComponentActionServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -31,6 +31,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -46,6 +48,8 @@
DataFlowComponentActionServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
DataFlowComponentActionServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
DataFlowComponentActionServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+DataFlowComponentActionServantTests_SOURCES += ../stubs/DataFlowComponentActionImpl.cpp
+DataFlowComponentActionServantTests_SOURCES += ../stubs/Logger.cpp
DataFlowComponentActionServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServant/ExecutionContextServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServant/ExecutionContextServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServant/ExecutionContextServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,14 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <ExecutionContextServant.h>
+#include <doil/ImplBase.h>
+#include <doil/ServantFactory.h>
+#include <doil/corba/CORBAManager.h>
+#include <doil/corba/CORBAServantBase.h>
+#include <IExecutionContext.h>
+#include <stubs/ExecutionContextImpl.h>
+#include <stubs/Logger.h>
/*!
* @class ExecutionContextServantTests class
@@ -31,10 +39,27 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(ExecutionContextServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_is_running);
+ CPPUNIT_TEST(test_call_start);
+ CPPUNIT_TEST(test_call_stop);
+ CPPUNIT_TEST(test_call_get_rate);
+ CPPUNIT_TEST(test_call_set_rate);
+ CPPUNIT_TEST(test_call_add_component);
+ CPPUNIT_TEST(test_call_remove_component);
+ CPPUNIT_TEST(test_call_activate_component);
+ CPPUNIT_TEST(test_call_deactivate_component);
+ CPPUNIT_TEST(test_call_reset_component);
+ CPPUNIT_TEST(test_call_get_component_state);
+ CPPUNIT_TEST(test_call_get_kind);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::ExecutionContextImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::ExecutionContextServant * CServant;
+
public:
@@ -43,6 +68,14 @@
*/
ExecutionContextServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::ExecutionContextImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::ExecutionContextServant>,
+ doil::Delete<RTC::CORBA::ExecutionContextServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::ExecutionContextServant*>(Servant);
}
/*!
@@ -50,6 +83,8 @@
*/
~ExecutionContextServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -65,6 +100,126 @@
virtual void tearDown()
{
}
+ void test_call_is_running()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("is_running");
+ ::CORBA::Boolean result;
+ result = CServant->is_running();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_start()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("start");
+ ::RTC::ReturnCode_t result;
+ result = CServant->start();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_stop()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("stop");
+ ::RTC::ReturnCode_t result;
+ result = CServant->stop();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_get_rate()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_rate");
+ ::CORBA::Double result;
+ result = CServant->get_rate();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", 100.0, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_set_rate()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("set_rate");
+ ::RTC::ReturnCode_t result;
+ result = CServant->set_rate(100.0);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_add_component()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("add_component");
+ ::RTC::ReturnCode_t result;
+ result = CServant->add_component(NULL);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_remove_component()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("remove_component");
+ ::RTC::ReturnCode_t result;
+ result = CServant->remove_component(NULL);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_activate_component()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("activate_component");
+ ::RTC::ReturnCode_t result;
+ result = CServant->activate_component(NULL);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_deactivate_component()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("deactivate_component");
+ ::RTC::ReturnCode_t result;
+ result = CServant->deactivate_component(NULL);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_reset_component()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("reset_component");
+ ::RTC::ReturnCode_t result;
+ result = CServant->reset_component(NULL);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_get_component_state()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_component_state");
+ ::RTC::LifeCycleState result;
+ result = CServant->get_component_state(NULL);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::CREATED_STATE, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_get_kind()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_kind");
+ ::RTC::ExecutionKind result;
+ result = CServant->get_kind();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::PERIODIC, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,8 +20,10 @@
IDLFLAGS = @IDL_FLAGS@
LIBS = @LIBS@
-open_rtm_dir = $(top_builddir)/../../../../..
-target_srcdir = $(top_builddir)/..
+#open_rtm_dir = $(top_builddir)/../../../../..
+open_rtm_dir = ../../../../../..
+#target_srcdir = $(top_builddir)/..
+target_srcdir = ../..
AM_CPPFLAGS = -I.
AM_CPPFLAGS += -I$(includedir)
@@ -29,6 +31,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -44,6 +48,8 @@
ExecutionContextServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
ExecutionContextServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
ExecutionContextServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+ExecutionContextServantTests_SOURCES += ../stubs/ExecutionContextImpl.cpp
+ExecutionContextServantTests_SOURCES += ../stubs/Logger.cpp
ExecutionContextServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServiceServant/ExecutionContextServiceServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServiceServant/ExecutionContextServiceServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServiceServant/ExecutionContextServiceServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,7 +20,13 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <ExecutionContextServiceServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/ExecutionContextServiceImpl.h>
+#include <stubs/Logger.h>
+
/*!
* @class ExecutionContextServiceServantTests class
* @brief ExecutionContextServiceServant test
@@ -31,10 +37,15 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(ExecutionContextServiceServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_get_profile);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::ExecutionContextServiceImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::ExecutionContextServiceServant * CServant;
public:
@@ -43,6 +54,14 @@
*/
ExecutionContextServiceServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::ExecutionContextServiceImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::ExecutionContextServiceServant>,
+ doil::Delete<RTC::CORBA::ExecutionContextServiceServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::ExecutionContextServiceServant*>(Servant);
}
/*!
@@ -50,6 +69,8 @@
*/
~ExecutionContextServiceServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -66,6 +87,16 @@
{
}
+ void test_call_get_profile()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_profile");
+ ::RTC::ExecutionContextProfile* result;
+ result = CServant->get_profile();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
{
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServiceServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServiceServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ExecutionContextServiceServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -29,6 +29,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -44,6 +46,8 @@
ExecutionContextServiceServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
ExecutionContextServiceServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
ExecutionContextServiceServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+ExecutionContextServiceServantTests_SOURCES += ../stubs/ExecutionContextServiceImpl.cpp
+ExecutionContextServiceServantTests_SOURCES += ../stubs/Logger.cpp
ExecutionContextServiceServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmObjectServant/FsmObjectServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmObjectServant/FsmObjectServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmObjectServant/FsmObjectServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,11 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <FsmObjectServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/FsmObjectImpl.h>
+#include <stubs/Logger.h>
/*!
* @class FsmObjectServantTests class
@@ -31,10 +36,15 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(FsmObjectServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_send_stimulus);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::FsmObjectImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::FsmObjectServant * CServant;
public:
@@ -43,6 +53,14 @@
*/
FsmObjectServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::FsmObjectImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::FsmObjectServant>,
+ doil::Delete<RTC::CORBA::FsmObjectServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::FsmObjectServant*>(Servant);
}
/*!
@@ -50,6 +68,8 @@
*/
~FsmObjectServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -65,6 +85,17 @@
virtual void tearDown()
{
}
+ void test_call_send_stimulus()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("send_stimulus");
+ ::RTC::ReturnCode_t result;
+ ::RTC::Local::ExecutionContextHandle_t exec_handle;
+ result = CServant->send_stimulus("bar",exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmObjectServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmObjectServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmObjectServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -29,6 +29,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -44,6 +46,8 @@
FsmObjectServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
FsmObjectServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
FsmObjectServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+FsmObjectServantTests_SOURCES += ../stubs/FsmObjectImpl.cpp
+FsmObjectServantTests_SOURCES += ../stubs/Logger.cpp
FsmObjectServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmParticipantActionServant/FsmParticipantActionServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmParticipantActionServant/FsmParticipantActionServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmParticipantActionServant/FsmParticipantActionServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,11 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <FsmParticipantActionServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/FsmParticipantActionImpl.h>
+#include <stubs/Logger.h>
/*!
* @class FsmParticipantActionServantTests class
@@ -31,10 +36,15 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(FsmParticipantActionServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_on_action);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::FsmParticipantActionImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::FsmParticipantActionServant * CServant;
public:
@@ -43,6 +53,14 @@
*/
FsmParticipantActionServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::FsmParticipantActionImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::FsmParticipantActionServant>,
+ doil::Delete<RTC::CORBA::FsmParticipantActionServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::FsmParticipantActionServant*>(Servant);
}
/*!
@@ -50,6 +68,8 @@
*/
~FsmParticipantActionServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -66,6 +86,17 @@
{
}
+ void test_call_on_action()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_action");
+ ::RTC::ReturnCode_t result;
+ ::RTC::Local::ExecutionContextHandle_t exec_handle;
+ result = CServant->on_action(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
{
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmParticipantActionServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmParticipantActionServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmParticipantActionServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -29,6 +29,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -44,6 +46,8 @@
FsmParticipantActionServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
FsmParticipantActionServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
FsmParticipantActionServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+FsmParticipantActionServantTests_SOURCES += ../stubs/FsmParticipantActionImpl.cpp
+FsmParticipantActionServantTests_SOURCES += ../stubs/Logger.cpp
FsmParticipantActionServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmServiceServant/FsmServiceServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmServiceServant/FsmServiceServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmServiceServant/FsmServiceServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,11 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <FsmServiceServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/FsmServiceImpl.h>
+#include <stubs/Logger.h>
/*!
* @class FsmServiceServantTests class
@@ -31,10 +36,16 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(FsmServiceServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_get_fsm_profile);
+ CPPUNIT_TEST(test_call_set_fsm_profile);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::FsmServiceImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::FsmServiceServant * CServant;
public:
@@ -43,6 +54,14 @@
*/
FsmServiceServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::FsmServiceImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::FsmServiceServant>,
+ doil::Delete<RTC::CORBA::FsmServiceServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::FsmServiceServant*>(Servant);
}
/*!
@@ -50,6 +69,8 @@
*/
~FsmServiceServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -65,6 +86,28 @@
virtual void tearDown()
{
}
+
+ void test_call_get_fsm_profile()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_fsm_profile");
+ ::RTC::FsmProfile* result;
+ result = CServant->get_fsm_profile();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_set_fsm_profile()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("set_fsm_profile");
+ ::RTC::ReturnCode_t result;
+ ::RTC::FsmProfile fsm_profile;
+ result = CServant->set_fsm_profile(fsm_profile);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmServiceServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmServiceServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/FsmServiceServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -29,6 +29,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -44,6 +46,8 @@
FsmServiceServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
FsmServiceServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
FsmServiceServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+FsmServiceServantTests_SOURCES += ../stubs/FsmServiceImpl.cpp
+FsmServiceServantTests_SOURCES += ../stubs/Logger.cpp
FsmServiceServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/LightweightRTObjectServant/LightweightRTObjectServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/LightweightRTObjectServant/LightweightRTObjectServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/LightweightRTObjectServant/LightweightRTObjectServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,11 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <LightweightRTObjectServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/LightweightRTObjectImpl.h>
+#include <stubs/Logger.h>
/*!
* @class LightweightRTObjectServantTests class
@@ -31,10 +36,25 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(LightweightRTObjectServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_initialize);
+ CPPUNIT_TEST(test_finalize);
+ CPPUNIT_TEST(test_is_alive);
+ CPPUNIT_TEST(test_exit);
+ CPPUNIT_TEST(test_attach_context);
+ CPPUNIT_TEST(test_detach_context);
+ CPPUNIT_TEST(test_get_context);
+ CPPUNIT_TEST(test_get_owned_contexts);
+ CPPUNIT_TEST(test_get_participating_contexts);
+ CPPUNIT_TEST(test_get_context_handle);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::LightweightRTObjectImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::LightweightRTObjectServant * CServant;
+
public:
@@ -43,6 +63,14 @@
*/
LightweightRTObjectServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::LightweightRTObjectImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::LightweightRTObjectServant>,
+ doil::Delete<RTC::CORBA::LightweightRTObjectServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::LightweightRTObjectServant*>(Servant);
}
/*!
@@ -50,6 +78,8 @@
*/
~LightweightRTObjectServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -66,6 +96,108 @@
{
}
+ void test_initialize()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("initialize");
+ ::RTC::ReturnCode_t result;
+ result = CServant->initialize();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_finalize()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("finalize");
+ ::RTC::ReturnCode_t result;
+ result = CServant->finalize();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_is_alive()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("is_alive");
+ ::CORBA::Boolean result;
+ result = CServant->is_alive(NULL);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_exit()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("exit");
+ ::RTC::ReturnCode_t result;
+ result = CServant->exit();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_attach_context()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("attach_context");
+ ::RTC::ExecutionContextHandle_t result;
+ result = CServant->attach_context(NULL);
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_detach_context()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("detach_context");
+ ::RTC::ExecutionContextHandle_t result;
+ result = CServant->detach_context(NULL);
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_get_context()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_context");
+ RTC::ExecutionContext_ptr result;
+ result = CServant->get_context(0);
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_get_owned_contexts()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_owned_contexts");
+ //::RTC::ExecutionContextList result;
+ RTC::ExecutionContextList_var result;
+ result = CServant->get_owned_contexts();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_get_participating_contexts()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_participating_contexts");
+ //::RTC::ExecutionContextList result;
+ RTC::ExecutionContextList_var result;
+ result = CServant->get_participating_contexts();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_get_context_handle()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_context_handle");
+ ::RTC::ExecutionContextHandle_t result;
+ result = CServant->get_context_handle(NULL);
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
{
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/LightweightRTObjectServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/LightweightRTObjectServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/LightweightRTObjectServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -36,6 +36,8 @@
AM_CPPFLAGS += -I../../../../../../
AM_CPPFLAGS += -I/usr/include/omniORB4/
AM_CPPFLAGS += -I/usr/include/omniORB4/internal/
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -51,6 +53,9 @@
LightweightRTObjectServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
LightweightRTObjectServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
LightweightRTObjectServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+LightweightRTObjectServantTests_SOURCES += ../stubs/LightweightRTObjectImpl.cpp
+LightweightRTObjectServantTests_SOURCES += ../stubs/ExecutionContextImpl.cpp
+LightweightRTObjectServantTests_SOURCES += ../stubs/Logger.cpp
LightweightRTObjectServantTests_LDFLAGS = -L$(libdir)
#LightweightRTObjectServantTests_LDFLAGS += -L../stubs
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ModeCapableServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ModeCapableServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ModeCapableServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -29,6 +29,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -44,6 +46,8 @@
ModeCapableServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
ModeCapableServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
ModeCapableServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+ModeCapableServantTests_SOURCES += ../stubs/ModeCapableImpl.cpp
+ModeCapableServantTests_SOURCES += ../stubs/Logger.cpp
ModeCapableServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ModeCapableServant/ModeCapableServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ModeCapableServant/ModeCapableServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/ModeCapableServant/ModeCapableServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,11 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <ModeCapableServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/ModeCapableImpl.h>
+#include <stubs/Logger.h>
/*!
* @class ModeCapableServantTests class
@@ -31,10 +36,20 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(ModeCapableServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_get_default_mode);
+ CPPUNIT_TEST(test_call_get_current_mode);
+ CPPUNIT_TEST(test_call_get_current_mode_in_context);
+ CPPUNIT_TEST(test_call_get_pending_mode);
+ CPPUNIT_TEST(test_call_get_pending_mode_in_context);
+ CPPUNIT_TEST(test_call_set_mode);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::ModeCapableImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::ModeCapableServant * CServant;
public:
@@ -43,6 +58,14 @@
*/
ModeCapableServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::ModeCapableImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::ModeCapableServant>,
+ doil::Delete<RTC::CORBA::ModeCapableServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::ModeCapableServant*>(Servant);
}
/*!
@@ -50,6 +73,8 @@
*/
~ModeCapableServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -65,6 +90,68 @@
virtual void tearDown()
{
}
+
+ void test_call_get_default_mode()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_default_mode");
+ ::RTC::Mode_var result;
+ //::RTC::Mode result;
+ result = CServant->get_default_mode();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_get_current_mode()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_current_mode");
+ ::RTC::Mode_var result;
+ result = CServant->get_current_mode();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_get_current_mode_in_context()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_current_mode_in_context");
+ ::RTC::Mode_var result;
+ result = CServant->get_current_mode_in_context(NULL);
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_get_pending_mode()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_pending_mode");
+ ::RTC::Mode_var result;
+ result = CServant->get_pending_mode();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_get_pending_mode_in_context()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_pending_mode_in_context");
+ ::RTC::Mode_var result;
+ result = CServant->get_pending_mode_in_context(NULL);
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_set_mode()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("set_mode");
+ ::RTC::ReturnCode_t result;
+ result = CServant->set_mode(NULL,true);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/MultiModeComponentActionServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/MultiModeComponentActionServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/MultiModeComponentActionServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -29,6 +29,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -44,6 +46,8 @@
MultiModeComponentActionServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
MultiModeComponentActionServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
MultiModeComponentActionServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+MultiModeComponentActionServantTests_SOURCES += ../stubs/MultiModeComponentActionImpl.cpp
+MultiModeComponentActionServantTests_SOURCES += ../stubs/Logger.cpp
MultiModeComponentActionServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/MultiModeComponentActionServant/MultiModeComponentActionServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/MultiModeComponentActionServant/MultiModeComponentActionServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/MultiModeComponentActionServant/MultiModeComponentActionServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,11 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <MultiModeComponentActionServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/MultiModeComponentActionImpl.h>
+#include <stubs/Logger.h>
/*!
* @class MultiModeComponentActionServantTests class
@@ -31,10 +36,15 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(MultiModeComponentActionServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_on_mode_changed);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::MultiModeComponentActionImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::RTC::CORBA::MultiModeComponentActionServant * CServant;
public:
@@ -43,6 +53,14 @@
*/
MultiModeComponentActionServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::MultiModeComponentActionImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<RTC::CORBA::MultiModeComponentActionServant>,
+ doil::Delete<RTC::CORBA::MultiModeComponentActionServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<RTC::CORBA::MultiModeComponentActionServant*>(Servant);
}
/*!
@@ -50,6 +68,8 @@
*/
~MultiModeComponentActionServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -65,6 +85,17 @@
virtual void tearDown()
{
}
+ void test_call_on_mode_changed()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("on_mode_changed");
+ ::RTC::ReturnCode_t result;
+ ::RTC::Local::ExecutionContextHandle_t exec_handle;
+ result = CServant->on_mode_changed(exec_handle);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/OrganizationServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/OrganizationServant/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/OrganizationServant/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -29,6 +29,8 @@
AM_CPPFLAGS += -I$(open_rtm_dir)
AM_CPPFLAGS += -I$(open_rtm_dir)/rtc/corba/idl
AM_CPPFLAGS += -I../../../../../../coil/posix
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
AM_LDFLAGS = -L.
AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -44,6 +46,8 @@
OrganizationServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
OrganizationServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
OrganizationServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+OrganizationServantTests_SOURCES += ../stubs/OrganizationImpl.cpp
+OrganizationServantTests_SOURCES += ../stubs/Logger.cpp
OrganizationServantTests_LDFLAGS = -L$(libdir)
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/OrganizationServant/OrganizationServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/OrganizationServant/OrganizationServantTests.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/OrganizationServant/OrganizationServantTests.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -20,6 +20,11 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>
+#include <OrganizationServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/OrganizationImpl.h>
+#include <stubs/Logger.h>
/*!
* @class OrganizationServantTests class
@@ -31,10 +36,28 @@
: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(OrganizationServantTests);
- CPPUNIT_TEST(test_case0);
+ CPPUNIT_TEST(test_call_get_organization_id);
+ CPPUNIT_TEST(test_call_get_organization_property);
+ CPPUNIT_TEST(test_call_get_organization_property_value);
+ CPPUNIT_TEST(test_call_add_organization_property);
+ CPPUNIT_TEST(test_call_set_organization_property_value);
+ CPPUNIT_TEST(test_call_remove_organization_property);
+ CPPUNIT_TEST(test_call_get_owner);
+ CPPUNIT_TEST(test_call_set_owner);
+ CPPUNIT_TEST(test_call_get_members);
+ CPPUNIT_TEST(test_call_set_members);
+ CPPUNIT_TEST(test_call_add_members);
+ CPPUNIT_TEST(test_call_remove_member);
+ CPPUNIT_TEST(test_call_get_dependency);
+ CPPUNIT_TEST(test_call_set_dependency);
+ //CPPUNIT_TEST(test_case0);
CPPUNIT_TEST_SUITE_END();
private:
+ ::UnitTest::Servant::OrganizationImpl* Impl;
+ ::UnitTest::Servant::Logger Log;
+ ::doil::ServantBase* Servant;
+ ::SDOPackage::CORBA::OrganizationServant * CServant;
public:
@@ -43,6 +66,14 @@
*/
OrganizationServantTests()
{
+ // registerFactory
+ Impl = new UnitTest::Servant::OrganizationImpl(Log);
+ doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+ doil::New<SDOPackage::CORBA::OrganizationServant>,
+ doil::Delete<SDOPackage::CORBA::OrganizationServant>);
+ doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+ Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+ CServant = dynamic_cast<SDOPackage::CORBA::OrganizationServant*>(Servant);
}
/*!
@@ -50,6 +81,8 @@
*/
~OrganizationServantTests()
{
+ delete Impl;
+ Impl = 0;
}
/*!
@@ -65,6 +98,172 @@
virtual void tearDown()
{
}
+ void test_call_get_organization_id()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_organization_id");
+ std::string str2("foo");
+ ::std::string result;
+ result = CServant->get_organization_id();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", str2, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+ void test_call_get_organization_property()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_organization_property");
+ ::SDOPackage::OrganizationProperty* result;
+ result = CServant->get_organization_property();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_get_organization_property_value()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_organization_property_value");
+ CORBA::Any* result;
+ result = CServant->get_organization_property_value("foo");
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", str2, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_add_organization_property()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("add_organization_property");
+ ::CORBA::Boolean result;
+ ::SDOPackage::OrganizationProperty organization_property;
+ result = CServant->add_organization_property(organization_property);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_set_organization_property_value()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("set_organization_property_value");
+ const std::string str1 = "bar";
+ const std::string str2 = "foo";
+ CORBA::Any any;
+ any <<= str.c_str();
+ ::CORBA::Boolean result;
+ result = CServant->set_organization_property_value("bar",any);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_remove_organization_property()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("remove_organization_property");
+ ::CORBA::Boolean result;
+ result = CServant->remove_organization_property("bar");
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_get_owner()
+ {
+std::cout<<"test_call_get_owner"<<std::endl;
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_owner");
+ SDOPackage::SDOSystemElement_var varOwner;
+ SDOPackage::SDOSystemElement_ptr ptrOwner;
+ varOwner = CServant->get_owner();
+ CPPUNIT_ASSERT(!::CORBA::is_nil(varOwner));
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_set_owner()
+ {
+std::cout<<"test_call_set_owner"<<std::endl;
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("set_owner");
+ ::CORBA::Boolean result;
+ ::SDOPackage::SDOSystemElement_ptr sdo;
+ result = CServant->set_owner(sdo);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_get_members()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_members");
+ ::SDOPackage::SDOList* result;
+ result = CServant->get_members();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_set_members()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("set_members");
+ ::CORBA::Boolean result;
+ ::SDOPackage::SDOList sdo_list;
+ result = CServant->set_members(sdo_list);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_add_members()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("add_members");
+ ::CORBA::Boolean result;
+ ::SDOPackage::SDOList sdo_list;
+ result = CServant->add_members(sdo_list);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_remove_member()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("remove_member");
+ ::CORBA::Boolean result;
+ result = CServant->remove_member("bar");
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_get_dependency()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("get_dependency");
+ ::SDOPackage::DependencyType result;
+ result = CServant->get_dependency();
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", ::RTC::RTC_OK, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
+
+ void test_call_set_dependency()
+ {
+ CPPUNIT_ASSERT(CServant);
+
+ std::string str("send_stimulus");
+ ::CORBA::Boolean result;
+ ::SDOPackage::DependencyType dependency;
+ result = CServant->set_dependency(dependency);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", true, result);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+ }
/* test case */
void test_case0()
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ComponentActionImpl.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ComponentActionImpl.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ComponentActionImpl.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <ComponentActionImpl.h>
#include <iostream>
+#include <string>
#include <Logger.h>
namespace UnitTest
@@ -27,6 +28,8 @@
* @brief ComponentAction implementation class for ComponentActionServant' unittest.
* @endif
*/
+ int ComponentActionImpl::count = 0;
+
ComponentActionImpl::ComponentActionImpl()
{
++count;
@@ -102,22 +105,24 @@
return RTC::Local::RTC_OK;
}
- ::RTC::Local::ReturnCode_t ComponentActionImpl::on_aborting(::RTC::Local::ExecutionContextHandle_t exec_handle)
+ ::RTC::Local::ReturnCode_t ComponentActionImpl::on_error(::RTC::Local::ExecutionContextHandle_t exec_handle)
throw ()
{
if (m_logger != NULL)
{
- m_logger->push("on_aborting");
+ m_logger->push("on_error");
}
return RTC::Local::RTC_OK;
}
- ::RTC::Local::ReturnCode_t ComponentActionImpl::on_error(::RTC::Local::ExecutionContextHandle_t exec_handle)
+ ::RTC::Local::ReturnCode_t ComponentActionImpl::on_aborting(::RTC::Local::ExecutionContextHandle_t exec_handle)
throw ()
{
if (m_logger != NULL)
{
- m_logger->push("on_error");
+ //std::cout<<"size:"<<m_logger->size()<<std::endl;
+ m_logger->push("on_aborting");
+ //std::cout<<"size:"<<m_logger->size()<<std::endl;
}
return RTC::Local::RTC_OK;
}
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ComponentActionImpl.h
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ComponentActionImpl.h 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ComponentActionImpl.h 2014-02-14 16:48:47 UTC (rev 2488)
@@ -69,6 +69,10 @@
virtual ::RTC::Local::ReturnCode_t on_reset(::RTC::Local::ExecutionContextHandle_t exec_handle)
throw ();
+ const char* id() { return "ComponentAction"; }
+ const char* name() { return m_name; }
+ void incRef() { refcount++; }
+ void decRef() { refcount--; }
private:
static int count;
char m_name[32];
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ConfigurationImpl.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ConfigurationImpl.cpp 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/ConfigurationImpl.cpp 2014-02-14 16:48:47 UTC (rev 2488)
@@ -64,7 +64,7 @@
::SDOPackage::Local::NotAvailable,
::SDOPackage::Local::InternalError)
{
- m_logger->push("set_service_profile");
+ m_logger->push("add_service_profile");
return true;
}
Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/Makefile.am 2014-02-13 14:23:51 UTC (rev 2487)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/Makefile.am 2014-02-14 16:48:47 UTC (rev 2488)
@@ -39,6 +39,17 @@
libstubs_a_SOURCES = ConfigurationImpl.cpp
libstubs_a_SOURCES += Logger.cpp
libstubs_a_SOURCES += ComponentActionImpl.cpp
+libstubs_a_SOURCES += DataFlowComponentActionImpl.cpp
+libstubs_a_SOURCES += LightweightRTObjectImpl.cpp
+libstubs_a_SOURCES += DataFlowComponentImpl.cpp
+libstubs_a_SOURCES += ExecutionContextServiceImpl.cpp
+libstubs_a_SOURCES += FsmObjectImpl.cpp
+libstubs_a_SOURCES += FsmParticipantActionImpl.cpp
+libstubs_a_SOURCES += FsmServiceImpl.cpp
+libstubs_a_SOURCES += ModeImpl.cpp
+libstubs_a_SOURCES += ModeCapableImpl.cpp
+libstubs_a_SOURCES += MultiModeComponentActionImpl.cpp
+libstubs_a_SOURCES += OrganizationImpl.cpp
stubsdir = .
noinst_LIBRARIES = libstubs.a
More information about the openrtm-commit
mailing list