[openrtm-commit:01297] r2492 - branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant

openrtm @ openrtm.org openrtm @ openrtm.org
2014年 2月 15日 (土) 03:26:36 JST


Author: win-ei
Date: 2014-02-15 03:26:36 +0900 (Sat, 15 Feb 2014)
New Revision: 2492

Modified:
   branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant/Makefile.am
   branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant/SDOServantTests.cpp
Log:
Daily work. 

Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant/Makefile.am
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant/Makefile.am	2014-02-14 17:22:36 UTC (rev 2491)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant/Makefile.am	2014-02-14 18:26:36 UTC (rev 2492)
@@ -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 @@
 SDOServantTests_SOURCES += $(IDL_SOURCES:.idl=Stub.cpp)
 SDOServantTests_SOURCES += $(open_rtm_dir)/doil/ORBManager.cpp
 SDOServantTests_SOURCES += $(open_rtm_dir)/doil/corba/CORBAManager.cpp
+SDOServantTests_SOURCES += ../stubs/SDOImpl.cpp 
+SDOServantTests_SOURCES += ../stubs/Logger.cpp 
 
 SDOServantTests_LDFLAGS = -L$(libdir)
 

Modified: branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant/SDOServantTests.cpp
===================================================================
--- branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant/SDOServantTests.cpp	2014-02-14 17:22:36 UTC (rev 2491)
+++ branches/work_ForDoil/OpenRTM-aist/src/lib/doil/utils/omniidl_be/tests/unitTest/SDOServant/SDOServantTests.cpp	2014-02-14 18:26:36 UTC (rev 2492)
@@ -20,6 +20,11 @@
 #include <cppunit/ui/text/TestRunner.h>
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/TestAssert.h>
+#include <SDOServant.h>
+#include <doil/ServantBase.h>
+#include <doil/corba/CORBAManager.h>
+#include <stubs/SDOImpl.h>
+#include <stubs/Logger.h>
 
 /*!
  * @class SDOServantTests class
@@ -31,10 +36,25 @@
    : public CppUnit::TestFixture
   {
     CPPUNIT_TEST_SUITE(SDOServantTests);
-    CPPUNIT_TEST(test_case0);
+    CPPUNIT_TEST(test_call_get_sdo_id);
+    CPPUNIT_TEST(test_call_get_sdo_type);
+    CPPUNIT_TEST(test_call_get_device_profile);
+    CPPUNIT_TEST(test_call_get_service_profiles);
+    CPPUNIT_TEST(test_call_get_service_profile);
+    CPPUNIT_TEST(test_call_get_sdo_service);
+    CPPUNIT_TEST(test_call_get_configuration);
+    CPPUNIT_TEST(test_call_get_monitoring);
+    CPPUNIT_TEST(test_call_get_organizations);
+    CPPUNIT_TEST(test_call_get_status_list);
+    CPPUNIT_TEST(test_call_get_status);
+    //CPPUNIT_TEST(test_case0);
     CPPUNIT_TEST_SUITE_END();
   
   private:
+    ::UnitTest::Servant::SDOImpl* Impl;
+    ::UnitTest::Servant::Logger Log;
+    ::doil::ServantBase* Servant;
+    ::SDOPackage::CORBA::SDOServant * CServant;
   
   public:
   
@@ -43,6 +63,14 @@
      */
     SDOServantTests()
     {
+        // registerFactory
+        Impl = new UnitTest::Servant::SDOImpl(Log);
+        doil::CORBA::CORBAManager::instance().registerFactory(Impl->id(),
+            doil::New<SDOPackage::CORBA::SDOServant>,
+            doil::Delete<SDOPackage::CORBA::SDOServant>);
+        doil::ReturnCode_t ret = doil::CORBA::CORBAManager::instance().activateObject(Impl);
+        Servant = doil::CORBA::CORBAManager::instance().toServant(Impl);
+        CServant = dynamic_cast<SDOPackage::CORBA::SDOServant*>(Servant);
     }
     
     /*!
@@ -50,6 +78,8 @@
      */
     ~SDOServantTests()
     {
+      delete Impl;
+      Impl = 0;
     }
   
     /*!
@@ -65,6 +95,118 @@
     virtual void tearDown()
     { 
     }
+    void test_call_get_sdo_id()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_sdo_id");
+      std::string str2("bar");
+      ::std::string result;
+      result = CServant->get_sdo_id();
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", str2, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_sdo_type()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_sdo_type");
+      std::string str2("bar");
+      ::std::string result;
+      result = CServant->get_sdo_type();
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", str2, result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_device_profile()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_device_profile");
+      ::SDOPackage::DeviceProfile* result;
+      result = CServant->get_device_profile();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_service_profiles()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_service_profiles");
+      ::SDOPackage::ServiceProfileList* result;
+      result = CServant->get_service_profiles();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_service_profile()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_service_profile");
+      ::SDOPackage::ServiceProfile* result;
+      result = CServant->get_service_profile("foo");
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_sdo_service()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_sdo_service");
+      ::SDOPackage::SDOService_ptr result;
+      result = CServant->get_sdo_service("foo");
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_configuration()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_configuration");
+      ::SDOPackage::Configuration_ptr result;
+      result = CServant->get_configuration();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_monitoring()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_monitoring");
+      ::SDOPackage::Monitoring_ptr result;
+      result = CServant->get_monitoring();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_organizations()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_organizations");
+      ::SDOPackage::OrganizationList_var result;
+      result = CServant->get_organizations();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_status_list()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_status_list");
+      ::SDOPackage::NVList* result;
+      result = CServant->get_status_list();
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
+    void test_call_get_status()
+    {
+      CPPUNIT_ASSERT(CServant);
+
+      std::string str("get_status");
+      CORBA::Any* result;
+      result = CServant->get_status("foo");
+      //CPPUNIT_ASSERT_EQUAL_MESSAGE("not true", "bar", result);
+      CPPUNIT_ASSERT_EQUAL_MESSAGE("not method name", Log.pop(), str);
+    }
   
     /* test case */
     void test_case0()



More information about the openrtm-commit mailing list