[openrtm-commit:01299] r2494 - in branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest: PortServiceServant RTObjectServant stubs

openrtm @ openrtm.org openrtm @ openrtm.org
2014年 2月 15日 (土) 11:22:13 JST


Author: win-ei
Date: 2014-02-15 11:22:13 +0900 (Sat, 15 Feb 2014)
New Revision: 2494

Modified:
   branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/PortServiceServant/Makefile.am
   branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/PortServiceServant/PortServiceServantTests.cpp
   branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/RTObjectServant/Makefile.am
   branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/RTObjectServant/RTObjectServantTests.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/PortServiceServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/PortServiceServant/Makefile.am	2014-02-14 18:28:11 UTC (rev 2493)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/PortServiceServant/Makefile.am	2014-02-15 02:22:13 UTC (rev 2494)
@@ -34,6 +34,8 @@
 AM_CPPFLAGS += -I../../
 AM_CPPFLAGS += -I../../../../../../coil/posix
 AM_CPPFLAGS += -I../../../../../../
+AM_CPPFLAGS += -I../
+AM_CPPFLAGS += -I../stubs
 
 AM_LDFLAGS = -L.
 AM_LDFLAGS += -L$(open_rtm_dir)/coil/lib
@@ -49,6 +51,9 @@
 PortServiceServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
 PortServiceServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
 PortServiceServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+PortServiceServantTests_SOURCES += ../stubs/PortServiceImpl.cpp 
+PortServiceServantTests_SOURCES += ../stubs/ExecutionContextImpl.cpp 
+PortServiceServantTests_SOURCES += ../stubs/Logger.cpp 
 
 PortServiceServantTests_LDFLAGS = -L$(libdir)
 

Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/PortServiceServant/PortServiceServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/PortServiceServant/PortServiceServantTests.cpp	2014-02-14 18:28:11 UTC (rev 2493)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/PortServiceServant/PortServiceServantTests.cpp	2014-02-15 02:22:13 UTC (rev 2494)
@@ -20,6 +20,11 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/TestAssert.h>
+#include <PortServiceServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/PortServiceImpl.h>
+#include <stubs/Logger.h>
 
 /*!
  * @class PortServiceServantTests class
@@ -31,10 +36,22 @@
    : public CppUnit::TestFixture
   {
     CPPUNIT_TEST_SUITE(PortServiceServantTests);
-    CPPUNIT_TEST(test_case0);
+    CPPUNIT_TEST(test_call_get_port_profile);
+    CPPUNIT_TEST(test_call_get_connector_profiles);
+    CPPUNIT_TEST(test_call_get_connector_profile);
+    CPPUNIT_TEST(test_call_connect);
+    CPPUNIT_TEST(test_call_disconnect);
+    CPPUNIT_TEST(test_call_disconnect_all);
+    CPPUNIT_TEST(test_call_notify_connect);
+    CPPUNIT_TEST(test_call_notify_disconnect);
+    //CPPUNIT_TEST(test_case0);
     CPPUNIT_TEST_SUITE_END();
   
   private:
+    ::UnitTest::Servant::PortServiceImpl* Impl;
+    ::UnitTest::Servant::Logger Log;
+    ::doil::ServantBase* Servant;
+    ::RTC::CORBA::PortServiceServant * CServant;
   
   public:
   
@@ -43,6 +60,14 @@
      */
     PortServiceServantTests()
     {
+        // registerFactory
+        Impl = new UnitTest::Servant::PortServiceImpl(Log);
+        doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+            doil::New<RTC::CORBA::PortServiceServant>,
+            doil::Delete<RTC::CORBA::PortServiceServant>);
+        doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+        Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+        CServant = dynamic_cast<RTC::CORBA::PortServiceServant*>(Servant);
     }
     
     /*!
@@ -50,6 +75,8 @@
      */
     ~PortServiceServantTests()
     {
+      delete Impl;
+      Impl = 0;
     }
   
     /*!
@@ -66,6 +93,92 @@
     { 
     }
   
+    void test_call_get_port_profile()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_port_profile");
+      ::RTC::PortProfile *result;
+      result = CServant->get_port_profile();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_connector_profiles()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_connector_profiles");
+      ::RTC::ConnectorProfileList *result;
+      result = CServant->get_connector_profiles();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_connector_profile()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_connector_profile");
+      std::string str2("foo");
+      ::RTC::ConnectorProfile *result;
+      result = CServant->get_connector_profile(str2.c_str());
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_connect()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("connect");
+      ::RTC::ConnectorProfile connector_profile;
+      ::RTC::ReturnCode_t result;
+      result = CServant->connect(connector_profile);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_disconnect()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("disconnect");
+      std::string str2("foo");
+      ::RTC::ReturnCode_t result;
+      result = CServant->disconnect(str2.c_str());
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_disconnect_all()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("disconnect_all");
+      ::RTC::ReturnCode_t result;
+      result = CServant->disconnect_all();
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_notify_connect()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("notify_connect");
+      ::RTC::ConnectorProfile connector_profile;
+      ::RTC::ReturnCode_t result;
+      result = CServant->notify_connect(connector_profile);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_notify_disconnect()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("notify_disconnect");
+      std::string str2("foo");
+      ::RTC::ReturnCode_t result;
+      result = CServant->notify_disconnect(str2.c_str());
+      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/RTObjectServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/RTObjectServant/Makefile.am	2014-02-14 18:28:11 UTC (rev 2493)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/RTObjectServant/Makefile.am	2014-02-15 02:22:13 UTC (rev 2494)
@@ -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
@@ -55,6 +57,9 @@
 RTObjectServantTests_LDADD  += $(target_srcdir)/RTObjectServant.o
 RTObjectServantTests_LDADD  += $(target_srcdir)/RTCTypeConversion.o
 RTObjectServantTests_LDADD  += $(target_srcdir)/SDOPackageTypeConversion.o
+RTObjectServantTests_SOURCES += ../stubs/RTObjectImpl.cpp 
+RTObjectServantTests_SOURCES += ../stubs/ExecutionContextImpl.cpp 
+RTObjectServantTests_SOURCES += ../stubs/Logger.cpp 
 
 RTObjectServantTests_LDADD  += $(target_srcdir)/ComponentActionServant.o
 RTObjectServantTests_LDADD  += $(target_srcdir)/LightweightRTObjectServant.o

Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/RTObjectServant/RTObjectServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/RTObjectServant/RTObjectServantTests.cpp	2014-02-14 18:28:11 UTC (rev 2493)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/RTObjectServant/RTObjectServantTests.cpp	2014-02-15 02:22:13 UTC (rev 2494)
@@ -20,6 +20,11 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/TestAssert.h>
+#include <RTObjectServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/RTObjectImpl.h>
+#include <stubs/Logger.h>
 
 /*!
  * @class RTObjectServantTests class
@@ -31,10 +36,16 @@
    : public CppUnit::TestFixture
   {
     CPPUNIT_TEST_SUITE(RTObjectServantTests);
-    CPPUNIT_TEST(test_case0);
+    CPPUNIT_TEST(test_call_get_component_profile);
+    CPPUNIT_TEST(test_call_get_ports);
+    //CPPUNIT_TEST(test_case0);
     CPPUNIT_TEST_SUITE_END();
   
   private:
+    ::UnitTest::Servant::RTObjectImpl* Impl;
+    ::UnitTest::Servant::Logger Log;
+    ::doil::ServantBase* Servant;
+    ::RTC::CORBA::RTObjectServant * CServant;
   
   public:
   
@@ -43,6 +54,14 @@
      */
     RTObjectServantTests()
     {
+        // registerFactory
+        Impl = new UnitTest::Servant::RTObjectImpl(Log);
+        doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+            doil::New<RTC::CORBA::RTObjectServant>,
+            doil::Delete<RTC::CORBA::RTObjectServant>);
+        doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+        Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+        CServant = dynamic_cast<RTC::CORBA::RTObjectServant*>(Servant);
     }
     
     /*!
@@ -50,6 +69,8 @@
      */
     ~RTObjectServantTests()
     {
+      delete Impl;
+      Impl = 0;
     }
   
     /*!
@@ -65,6 +86,30 @@
     virtual void tearDown()
     { 
     }
+
+
+    void test_call_get_component_profile()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_component_profile");
+      ::RTC::ComponentProfile *result;
+      result = CServant->get_component_profile();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", RTC::RTC_OK, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+
+    void test_call_get_ports()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_ports");
+      ::RTC::PortServiceList *result;
+      result = CServant->get_ports();
+      //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/stubs/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/Makefile.am	2014-02-14 18:28:11 UTC (rev 2493)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/stubs/Makefile.am	2014-02-15 02:22:13 UTC (rev 2494)
@@ -52,6 +52,8 @@
 libstubs_a_SOURCES += OrganizationImpl.cpp
 libstubs_a_SOURCES += SDOSystemElementImpl.cpp
 libstubs_a_SOURCES += SDOImpl.cpp
+libstubs_a_SOURCES += RTObjectImpl.cpp
+libstubs_a_SOURCES += PortServiceImpl.cpp
 stubsdir = .
 
 noinst_LIBRARIES = libstubs.a



More information about the openrtm-commit mailing list