17 #ifndef ConfigurationProxy_cpp 18 #define ConfigurationProxy_cpp 20 #include <cppunit/ui/text/TestRunner.h> 21 #include <cppunit/TextOutputter.h> 22 #include <cppunit/extensions/TestFactoryRegistry.h> 23 #include <cppunit/extensions/HelperMacros.h> 24 #include <cppunit/TestAssert.h> 27 #include <idl/SDOPackageSkel.h> 28 #include <idl/RTCSkel.h> 29 #include <ConfigurationProxy.h> 31 #include <ISDOService.h> 32 #include <ISDOSystemElement.h> 33 #include <IOrganization.h> 46 void log(
const std::string& msg)
54 for (
int i = 0; i < (int)
m_log.size(); ++i)
56 if (
m_log[i] == msg) ++count;
72 :
public virtual ::POA_SDOPackage::Organization,
77 : ::
doil::CORBA::CORBAServantBase(impl), m_impl(NULL)
79 m_impl =
dynamic_cast< ::SDOPackage::Local::IOrganization*
>(impl);
85 ::SDOPackage::OrganizationProperty_var
ret 86 = new ::SDOPackage::OrganizationProperty ();
92 value =
new CORBA::Any();
97 const ::SDOPackage::OrganizationProperty& organization_property)
102 const char* name,
const CORBA::Any& value)
112 return m_varOwner._retn();
115 ::SDOPackage::SDOSystemElement_ptr sdo)
123 ::SDOPackage::SDOList_var sdos;
124 sdos = new ::SDOPackage::SDOList(m_memberList);
128 const ::SDOPackage::SDOList& sdos)
134 const ::SDOPackage::SDOList& sdo_list)
144 ::SDOPackage::DependencyType dependency)
146 m_dependency = dependency;
152 ::SDOPackage::Local::IOrganization*
m_impl;
164 :
public virtual ::POA_SDOPackage::SDOService,
169 : ::
doil::CORBA::CORBAServantBase(impl)
171 m_impl =
dynamic_cast< ::SDOPackage::Local::ISDOService*
>(impl);
177 ::SDOPackage::Local::ISDOService*
m_impl;
185 :
public virtual ::SDOPackage::Local::ISDOService
192 const char*
id() {
return "ISDOServiceMock";}
193 const char*
name() {
return "ISDOServiceMock";}
215 :
public virtual ::SDOPackage::Local::IOrganization
228 return "IOrganizationMock";
235 ::SDOPackage::Local::OrganizationProperty
ret;
240 throw (::SDOPackage::Local::InvalidParameter,
241 ::SDOPackage::Local::NotAvailable,
242 ::SDOPackage::Local::InternalError)
244 return "IOrganizationMock";
247 throw (::SDOPackage::Local::InvalidParameter,
248 ::SDOPackage::Local::NotAvailable,
249 ::SDOPackage::Local::InternalError)
255 throw (::SDOPackage::Local::InvalidParameter,
256 ::SDOPackage::Local::NotAvailable,
257 ::SDOPackage::Local::InternalError)
263 throw (::SDOPackage::Local::InvalidParameter,
264 ::SDOPackage::Local::NotAvailable,
265 ::SDOPackage::Local::InternalError)
270 virtual ::SDOPackage::Local::ISDOSystemElement*
get_owner()
277 virtual bool set_owner(const ::SDOPackage::Local::ISDOSystemElement* sdo)
278 throw (::SDOPackage::Local::InvalidParameter,
279 ::SDOPackage::Local::NotAvailable,
280 ::SDOPackage::Local::InternalError)
289 ::SDOPackage::Local::SDOList
ret;
293 virtual bool set_members(const ::SDOPackage::Local::SDOList& sdos)
294 throw (::SDOPackage::Local::InvalidParameter,
295 ::SDOPackage::Local::NotAvailable,
296 ::SDOPackage::Local::InternalError)
301 virtual bool add_members(const ::SDOPackage::Local::SDOList& sdo_list)
302 throw (::SDOPackage::Local::InvalidParameter,
303 ::SDOPackage::Local::NotAvailable,
304 ::SDOPackage::Local::InternalError)
310 throw (::SDOPackage::Local::InvalidParameter,
311 ::SDOPackage::Local::NotAvailable,
312 ::SDOPackage::Local::InternalError)
325 throw (::SDOPackage::Local::NotAvailable,
326 ::SDOPackage::Local::InternalError)
328 m_dependency = dependency;
333 const char*
id() {
return "IOrganizationMock";}
334 const char*
name() {
return "IOrganizationMock";}
357 :
public virtual ::POA_SDOPackage::Configuration
384 throw (CORBA::SystemException,
385 ::SDOPackage::InvalidParameter,
386 ::SDOPackage::NotAvailable,
387 ::SDOPackage::InternalError)
389 if (m_logger != NULL) m_logger->log(
"set_device_profile");
396 throw (CORBA::SystemException,
397 ::SDOPackage::InvalidParameter,
398 ::SDOPackage::NotAvailable,
399 ::SDOPackage::InternalError)
401 if (m_logger != NULL) m_logger->log(
"set_service_profile");
408 throw (CORBA::SystemException,
409 ::SDOPackage::InvalidParameter,
410 ::SDOPackage::NotAvailable,
411 ::SDOPackage::InternalError)
413 if (m_logger != NULL) m_logger->log(
"add_organization");
420 throw (CORBA::SystemException,
421 ::SDOPackage::InvalidParameter,
422 ::SDOPackage::NotAvailable,
423 ::SDOPackage::InternalError)
425 if (m_logger != NULL)
427 m_logger->log(
"remove_service_profile");
436 throw (CORBA::SystemException,
437 ::SDOPackage::InvalidParameter,
438 ::SDOPackage::NotAvailable,
439 ::SDOPackage::InternalError)
441 if (m_logger != NULL)
443 m_logger->log(
"remove_organization");
444 m_logger->log(organization_id);
452 throw (CORBA::SystemException,
456 if (m_logger != NULL)
458 m_logger->log(
"get_configuration_parameters");
460 m_name =
"test_get_configuration_parameters";
464 m_par.name = m_name.c_str();
465 m_par.type = m_any.type();
467 ::SDOPackage::StringList* stlist;
468 stlist = new ::SDOPackage::StringList((::CORBA::ULong)1,
471 (::CORBA::Boolean)0);
473 m_etype.enumerated_values = m_stlist;
475 m_par.allowed_values.allowed_enum(m_etype);
477 ::SDOPackage::ParameterList_var param;
478 param = new ::SDOPackage::ParameterList((::CORBA::ULong)1,
481 (::CORBA::Boolean)0);
484 return param._retn();
490 throw (CORBA::SystemException,
494 if (m_logger != NULL)
496 m_logger->log(
"get_configuration_parameter_values");
499 const char* name_str =
"get_configuration_parameter_values_name";
500 const char* value_str =
"5";
503 ::CORBA::string_dup(name_str),
504 ::CORBA::string_dup(value_str));
505 ::SDOPackage::NVList_var nvlist;
507 return nvlist._retn();
513 throw (CORBA::SystemException,
514 ::SDOPackage::InvalidParameter,
515 ::SDOPackage::NotAvailable,
516 ::SDOPackage::InternalError)
518 if (m_logger != NULL)
520 m_logger->log(
"get_configuration_parameter_value");
523 if (::std::string(name).empty())
524 throw ::SDOPackage::InvalidParameter(
"Name is empty.");
528 CORBA::Any_var value;
529 value =
new CORBA::Any(val);
530 return value._retn();
536 const CORBA::Any& value)
537 throw (CORBA::SystemException,
538 ::SDOPackage::InvalidParameter,
539 ::SDOPackage::NotAvailable,
540 ::SDOPackage::InternalError)
542 if (m_logger != NULL)
544 m_logger->log(
"set_configuration_parameter");
548 ::CORBA::ULong ul = 4;
549 ::CORBA::Any::to_string to_str(ch, ul);
551 m_logger->log(to_str.val);
560 throw (CORBA::SystemException,
564 const char* id_str =
"test_get_configuration_sets_id";
565 const char* description_str =
566 "test_get_configuration_sets_description";
567 const char* name_str =
"test_get_configuration_sets_nv_name";
568 const char* value_str =
"5";
569 if (m_logger != NULL)
571 m_logger->log(
"get_configuration_sets");
575 ::SDOPackage::ConfigurationSetList_var config_sets;
577 = new ::SDOPackage::ConfigurationSetList((CORBA::ULong)0);
578 config_sets->length(1);
579 config_sets[0].id = ::CORBA::string_dup(id_str);
580 config_sets[0].description = ::CORBA::string_dup(description_str);
582 ::CORBA::string_dup(name_str),
583 ::CORBA::string_dup(value_str));
585 return config_sets._retn();
593 throw (CORBA::SystemException,
594 ::SDOPackage::NotAvailable,
595 ::SDOPackage::InternalError)
597 const char* id_str =
"test_get_configuration_set_id";
598 const char* description_str =
599 "test_get_configuration_set_description";
600 const char* name_str =
"test_get_configuration_set_nv_name";
601 const char* value_str =
"5";
603 if (m_logger != NULL)
605 m_logger->log(
"get_configuration_set");
608 if (std::string(
id).empty())
609 throw ::SDOPackage::InternalError(
"ID is empty");
611 ::SDOPackage::ConfigurationSet_var
config;
612 config = new ::SDOPackage::ConfigurationSet();
618 config->id.out() = ::CORBA::string_dup(id_str);
619 config->description.out() = ::CORBA::string_dup(description_str);
621 ::CORBA::string_dup(name_str),
622 ::CORBA::string_dup(value_str));
624 return config._retn();
633 const ::SDOPackage::ConfigurationSet& configuration_set)
634 throw (CORBA::SystemException,
635 ::SDOPackage::InvalidParameter,
636 ::SDOPackage::NotAvailable,
637 ::SDOPackage::InternalError)
639 if (m_logger != NULL)
641 m_logger->log(
"set_configuration_set_values");
643 m_logger->log(configuration_set.id.in());
644 m_logger->log(configuration_set.description.in());
645 m_logger->log(configuration_set.configuration_data[0].name.in());
650 any = configuration_set.configuration_data[0].value;
652 ::CORBA::ULong ul = 1;
653 ::CORBA::Any::to_string to_str(ch, ul);
655 m_logger->log(to_str.val);
657 if (std::string(
id).empty())
658 throw ::SDOPackage::InvalidParameter(
"ID is empty.");
665 throw (CORBA::SystemException,
669 const char* id_str =
"test_get_active_configuration_set_id";
670 const char* description_str =
671 "test_get_active_configuration_set_description";
672 const char* name_str =
"test_get_active_configuration_set_nv_name";
673 const char* value_str =
"5";
674 if (m_logger != NULL)
676 m_logger->log(
"get_active_configuration_set");
678 ::SDOPackage::ConfigurationSet_var
config;
679 config = new ::SDOPackage::ConfigurationSet();
680 config->id.out() = ::CORBA::string_dup(id_str);
681 config->description.out() = ::CORBA::string_dup(description_str);
683 ::CORBA::string_dup(name_str),
684 ::CORBA::string_dup(value_str));
685 return config._retn();
691 const ::SDOPackage::ConfigurationSet& configuration_set)
692 throw (CORBA::SystemException,
693 ::SDOPackage::InvalidParameter,
694 ::SDOPackage::NotAvailable,
695 ::SDOPackage::InternalError)
697 if (m_logger != NULL)
699 m_logger->log(
"add_configuration_set");
700 m_logger->log(configuration_set.id.in());
701 m_logger->log(configuration_set.description.in());
702 m_logger->log(configuration_set.configuration_data[0].name.in());
704 any = configuration_set.configuration_data[0].value;
706 ::CORBA::ULong ul = 1;
707 ::CORBA::Any::to_string to_str(ch, ul);
709 m_logger->log(to_str.val);
717 throw (CORBA::SystemException,
718 ::SDOPackage::InvalidParameter,
719 ::SDOPackage::NotAvailable,
720 ::SDOPackage::InternalError)
722 if (m_logger != NULL)
724 m_logger->log(
"remove_configuration_set");
727 if (std::string(
id).empty())
728 throw ::SDOPackage::InvalidParameter(
"ID is empty.");
735 throw (CORBA::SystemException,
736 ::SDOPackage::InvalidParameter,
737 ::SDOPackage::NotAvailable,
738 ::SDOPackage::InternalError)
740 if (m_logger != NULL)
742 m_logger->log(
"activate_configuration_set");
745 if (std::string(
id).empty())
746 throw ::SDOPackage::InvalidParameter(
"ID is empty.");
755 :
public CppUnit::TestFixture
758 CPPUNIT_TEST(test_set_device_profile);
759 CPPUNIT_TEST(test_set_service_profile);
760 CPPUNIT_TEST(test_add_organization);
761 CPPUNIT_TEST(test_remove_service_profile);
762 CPPUNIT_TEST(test_remove_organization);
763 CPPUNIT_TEST(test_get_configuration_parameters);
764 CPPUNIT_TEST(test_get_configuration_parameter_values);
765 CPPUNIT_TEST(test_get_configuration_parameter_value);
766 CPPUNIT_TEST(test_set_configuration_parameter);
767 CPPUNIT_TEST(test_get_configuration_sets);
768 CPPUNIT_TEST(test_get_configuration_set);
769 CPPUNIT_TEST(test_set_configuration_set_values);
770 CPPUNIT_TEST(test_get_active_configuration_set);
771 CPPUNIT_TEST(test_add_configuration_set);
772 CPPUNIT_TEST(test_remove_configuration_set);
773 CPPUNIT_TEST(test_activate_configuration_set);
774 CPPUNIT_TEST_SUITE_END();
789 m_pORB = CORBA::ORB_init(argc, argv);
790 m_pPOA = PortableServer::POA::_narrow(
791 m_pORB->resolve_initial_references(
"RootPOA"));
792 m_pPOA->the_POAManager()->activate();
824 ::CORBA::Object_ptr ref = obj->_this();
825 if(::CORBA::is_nil(ref))
827 std::cout<<
"ref is nil.Abort test."<<std::endl;
830 ::SDOPackage::CORBA::ConfigurationProxy* ap
831 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
836 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"set_device_profile"));
837 const ::SDOPackage::Local::DeviceProfile porf;
838 ap->set_device_profile(porf);
839 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"set_device_profile"));
855 std::cout <<
"Manager Name==>"<< mgr.
name() << std::endl;
858 ::CORBA::Object_ptr ref = obj->_this();
859 if(::CORBA::is_nil(ref))
861 std::cout<<
"ref is nil.Abort test."<<std::endl;
864 ::SDOPackage::CORBA::ConfigurationProxy* ap
865 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
870 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"set_service_profile"));
871 ::SDOPackage::Local::ServiceProfile porf;
875 doil::New<ISDOServiceServantMock>,
876 doil::Delete<ISDOServiceServantMock>);
880 const ::SDOPackage::Local::ServiceProfile _porf = porf;
881 ap->set_service_profile(_porf);
882 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"set_service_profile"));
898 std::cout <<
"Manager Name==>"<< mgr.
name() << std::endl;
901 ::CORBA::Object_ptr ref = obj->_this();
902 if(::CORBA::is_nil(ref))
904 std::cout<<
"ref is nil.Abort test."<<std::endl;
907 ::SDOPackage::CORBA::ConfigurationProxy* ap
908 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
912 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"add_organization"));
916 doil::New<OrganizationServantMock>,
917 doil::Delete<OrganizationServantMock>);
920 ap->add_organization(&_org);
922 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"add_organization"));
936 ::CORBA::Object_ptr ref = obj->_this();
937 if(::CORBA::is_nil(ref))
939 std::cout<<
"ref is nil.Abort test."<<std::endl;
942 ::SDOPackage::CORBA::ConfigurationProxy* ap
943 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
948 const ::std::string str =
"test_remove_service_profile";
949 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"remove_service_profile"));
950 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(str));
951 ap->remove_service_profile(str);
952 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"remove_service_profile"));
953 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(str));
966 ::CORBA::Object_ptr ref = obj->_this();
967 if(::CORBA::is_nil(ref))
969 std::cout<<
"ref is nil.Abort test."<<std::endl;
972 ::SDOPackage::CORBA::ConfigurationProxy* ap
973 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
977 const ::std::string str =
"test_remove_organization";
979 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"remove_organization"));
980 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(str));
981 ap->remove_organization(str);
982 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"remove_organization"));
983 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(str));
995 std::cout<<
"test_get_configuration_parameters"<<std::endl;
997 ::CORBA::Object_ptr ref = obj->_this();
998 if(::CORBA::is_nil(ref))
1000 std::cout<<
"ref is nil.Abort test."<<std::endl;
1003 ::SDOPackage::CORBA::ConfigurationProxy* ap
1004 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1009 ::SDOPackage::Local::ParameterList pl;
1010 CPPUNIT_ASSERT_EQUAL(0,
1011 logger.
countLog(
"get_configuration_parameters"));
1012 pl = ap->get_configuration_parameters();
1013 CPPUNIT_ASSERT_EQUAL(1,
1014 logger.
countLog(
"get_configuration_parameters"));
1015 CPPUNIT_ASSERT(pl[0].name ==
1016 "test_get_configuration_parameters");
1020 CORBA::release(ref);
1030 ::CORBA::Object_ptr ref = obj->_this();
1031 if(::CORBA::is_nil(ref))
1033 std::cout<<
"ref is nil.Abort test."<<std::endl;
1036 ::SDOPackage::CORBA::ConfigurationProxy* ap
1037 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1043 CPPUNIT_ASSERT_EQUAL(0,
1044 logger.
countLog(
"get_configuration_parameter_values"));
1045 nvlist = ap->get_configuration_parameter_values();
1046 CPPUNIT_ASSERT_EQUAL(1,
1047 logger.
countLog(
"get_configuration_parameter_values"));
1050 CPPUNIT_ASSERT(nvlist[0].name ==
1051 "get_configuration_parameter_values_name");
1052 CPPUNIT_ASSERT(nvlist[0].value ==
"5");
1055 CORBA::release(ref);
1065 ::CORBA::Object_ptr ref = obj->_this();
1066 if(::CORBA::is_nil(ref))
1068 std::cout<<
"ref is nil.Abort test."<<std::endl;
1071 ::SDOPackage::CORBA::ConfigurationProxy* ap
1072 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1077 const ::std::string str =
"test_get_configuration_parameter_value";
1079 CPPUNIT_ASSERT_EQUAL(0,
1080 logger.
countLog(
"get_configuration_parameter_value"));
1081 ret = ap->get_configuration_parameter_value(str);
1082 CPPUNIT_ASSERT_EQUAL(1,
1083 logger.
countLog(
"get_configuration_parameter_value"));
1085 CPPUNIT_ASSERT(ret == str);
1087 CORBA::release(ref);
1098 ::CORBA::Object_ptr ref = obj->_this();
1099 if(::CORBA::is_nil(ref))
1101 std::cout<<
"ref is nil.Abort test."<<std::endl;
1104 ::SDOPackage::CORBA::ConfigurationProxy* ap
1105 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1110 const ::std::string str1 =
"configuration_parameter";
1111 const ::std::string str2 =
"5555";
1112 CPPUNIT_ASSERT_EQUAL(0,
1113 logger.
countLog(
"set_configuration_parameter"));
1114 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(str1));
1115 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(str2));
1116 ap->set_configuration_parameter(str1,str2);
1117 CPPUNIT_ASSERT_EQUAL(1,
1118 logger.
countLog(
"set_configuration_parameter"));
1119 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(str1));
1120 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(str2));
1124 CORBA::release(ref);
1134 ::CORBA::Object_ptr ref = obj->_this();
1135 if(::CORBA::is_nil(ref))
1137 std::cout<<
"ref is nil.Abort test."<<std::endl;
1140 ::SDOPackage::CORBA::ConfigurationProxy* ap
1141 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1145 ::SDOPackage::Local::ConfigurationSetList configlist;
1147 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"get_configuration_sets"));
1148 configlist = ap->get_configuration_sets();
1149 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"get_configuration_sets"));
1151 CPPUNIT_ASSERT(configlist[0].
id ==
1152 "test_get_configuration_sets_id");
1154 "test_get_configuration_sets_description");
1155 CPPUNIT_ASSERT(configlist[0].configuration_data[0].name ==
1156 "test_get_configuration_sets_nv_name");
1157 CPPUNIT_ASSERT(configlist[0].configuration_data[0].value ==
"5");
1161 CORBA::release(ref);
1171 ::CORBA::Object_ptr ref = obj->_this();
1172 if(::CORBA::is_nil(ref))
1174 std::cout<<
"ref is nil.Abort test."<<std::endl;
1177 ::SDOPackage::CORBA::ConfigurationProxy* ap
1178 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1183 const ::std::string str =
"get_configuration_set_config_id";
1184 ::SDOPackage::Local::ConfigurationSet confset;
1186 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"get_configuration_set"));
1187 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(str));
1188 confset = ap->get_configuration_set(str);
1189 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"get_configuration_set"));
1190 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(str));
1192 CPPUNIT_ASSERT(confset.id ==
1193 "test_get_configuration_set_id");
1194 CPPUNIT_ASSERT(confset.description ==
1195 "test_get_configuration_set_description");
1196 CPPUNIT_ASSERT(confset.configuration_data[0].name ==
1197 "test_get_configuration_set_nv_name");
1198 CPPUNIT_ASSERT(confset.configuration_data[0].value ==
"5");
1201 CORBA::release(ref);
1212 ::CORBA::Object_ptr ref = obj->_this();
1213 if(::CORBA::is_nil(ref))
1215 std::cout<<
"ref is nil.Abort test."<<std::endl;
1218 ::SDOPackage::CORBA::ConfigurationProxy* ap
1219 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1224 const ::std::string str =
"set_configuration_set_values_config_id";
1225 const ::std::string id_str =
"test_set_configuration_set_valuest_id";
1226 const ::std::string description_str =
1227 "test_set_configuration_set_values_description";
1228 const ::std::string name_str =
1229 "test_set_configuration_set_values_nv_name";
1230 const ::std::string value_str =
"5";
1232 ::SDOPackage::Local::NameValue
nv;
1234 nv.value = value_str;
1236 nvlist.push_back(nv);
1238 ::SDOPackage::Local::ConfigurationSet configuration_set;
1239 configuration_set.id = id_str;
1240 configuration_set.description = description_str;
1241 configuration_set.configuration_data = nvlist;
1243 CPPUNIT_ASSERT_EQUAL(0,
1244 logger.
countLog(
"set_configuration_set_values"));
1245 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(str));
1246 ap->set_configuration_set_values(str,configuration_set);
1247 CPPUNIT_ASSERT_EQUAL(1,
1248 logger.
countLog(
"set_configuration_set_values"));
1249 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(str));
1252 CORBA::release(ref);
1262 ::CORBA::Object_ptr ref = obj->_this();
1263 if(::CORBA::is_nil(ref))
1265 std::cout<<
"ref is nil.Abort test."<<std::endl;
1268 ::SDOPackage::CORBA::ConfigurationProxy* ap
1269 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1274 ::SDOPackage::Local::ConfigurationSet confset;
1275 CPPUNIT_ASSERT_EQUAL(0,
1276 logger.
countLog(
"get_active_configuration_set"));
1277 confset = ap->get_active_configuration_set();
1278 CPPUNIT_ASSERT_EQUAL(1,
1279 logger.
countLog(
"get_active_configuration_set"));
1281 CPPUNIT_ASSERT(confset.id ==
1282 "test_get_active_configuration_set_id");
1283 CPPUNIT_ASSERT(confset.description ==
1284 "test_get_active_configuration_set_description");
1285 CPPUNIT_ASSERT(confset.configuration_data[0].name ==
1286 "test_get_active_configuration_set_nv_name");
1287 CPPUNIT_ASSERT(confset.configuration_data[0].value ==
"5");
1290 CORBA::release(ref);
1300 ::CORBA::Object_ptr ref = obj->_this();
1301 if(::CORBA::is_nil(ref))
1303 std::cout<<
"ref is nil.Abort test."<<std::endl;
1306 ::SDOPackage::CORBA::ConfigurationProxy* ap
1307 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1312 const ::std::string id_str =
"test_add_configuration_set_id";
1313 const ::std::string description_str =
1314 "test_add_configuration_set_description";
1315 const ::std::string name_str =
"test_add_configuration_set_nv_name";
1316 const ::std::string value_str =
"5";
1318 ::SDOPackage::Local::NameValue
nv;
1320 nv.value = value_str;
1322 nvlist.push_back(nv);
1324 ::SDOPackage::Local::ConfigurationSet configuration_set;
1325 configuration_set.id = id_str;
1326 configuration_set.description = description_str;
1327 configuration_set.configuration_data = nvlist;
1329 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"add_configuration_set"));
1330 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(id_str));
1331 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(description_str));
1332 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(name_str));
1333 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(value_str));
1334 ap->add_configuration_set(configuration_set);
1335 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"add_configuration_set"));
1336 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(id_str));
1337 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(description_str));
1338 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(name_str));
1339 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(value_str));
1341 CORBA::release(ref);
1352 ::CORBA::Object_ptr ref = obj->_this();
1353 if(::CORBA::is_nil(ref))
1355 std::cout<<
"ref is nil.Abort test."<<std::endl;
1358 ::SDOPackage::CORBA::ConfigurationProxy* ap
1359 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1364 const ::std::string str =
"test_remove_configuration_set";
1365 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"remove_configuration_set"));
1366 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(str));
1367 ap->remove_configuration_set(str);
1368 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"remove_configuration_set"));
1369 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(str));
1372 CORBA::release(ref);
1382 ::CORBA::Object_ptr ref = obj->_this();
1383 if(::CORBA::is_nil(ref))
1385 std::cout<<
"ref is nil.Abort test."<<std::endl;
1389 ::SDOPackage::CORBA::ConfigurationProxy* ap
1390 = new ::SDOPackage::CORBA::ConfigurationProxy(ref);
1395 const ::std::string str =
"test_activate_configuration_set";
1396 CPPUNIT_ASSERT_EQUAL(0,
1397 logger.
countLog(
"activate_configuration_set"));
1398 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(str));
1399 ap->activate_configuration_set(str);
1400 CPPUNIT_ASSERT_EQUAL(1,
1401 logger.
countLog(
"activate_configuration_set"));
1402 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(str));
1405 CORBA::release(ref);
1420 int main(
int argc,
char* argv[])
1422 CppUnit::TextUi::TestRunner runner;
1423 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
1424 CppUnit::Outputter* outputter =
1425 new CppUnit::TextOutputter(&runner.result(), std::cout);
1426 runner.setOutputter(outputter);
1431 #endif // ConfigurationProxy_cpp ::CORBA::Boolean activate_configuration_set(const char *id)
virtual ::CORBA::Any * get_organization_property_value(const char *name)
virtual void tearDown()
Test finalization.
void test_set_configuration_set_values()
int main(int argc, char **argv)
virtual const char * name()
Getting ORB's name.
void test_set_device_profile()
void test_get_configuration_sets()
::CORBA::Boolean remove_organization(const char *organization_id)
virtual char * get_organization_id()
virtual bool set_members(const ::SDOPackage::Local::SDOList &sdos)
virtual ReturnCode_t registerFactory(const char *id, doil::ServantNewFunc new_func, doil::ServantDeleteFunc delete_func)
Register servant's factory.
::CORBA::Boolean remove_service_profile(const char *id)
bool appendStringValue(SDOPackage::NVList &nv, const char *name, const char *value)
Append the specified string to element of NVList.
::SDOPackage::ConfigurationSetList * get_configuration_sets()
std::vector< std::pair< std::string, std::string > > NVList
virtual ::SDOPackage::Local::ISDOSystemElement * get_owner()
static CORBAManager & instance()
getting instance
void test_remove_organization()
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
virtual bool set_dependency(::SDOPackage::Local::DependencyType dependency)
virtual ::std::string get_organization_id()
::SDOPackage::DependencyType m_dependency
virtual ::SDOPackage::SDOSystemElement_ptr get_owner()
virtual ::std::string get_organization_property_value(const ::std::string &name)
::SDOPackage::ParameterList * get_configuration_parameters()
::std::vector< std::string > m_log
void test_get_configuration_parameters()
virtual ::SDOPackage::SDOList * get_members()
virtual CORBA::Boolean set_dependency(::SDOPackage::DependencyType dependency)
void test_get_active_configuration_set()
void test_get_configuration_set()
int countLog(const std::string &msg)
::CORBA::Boolean add_configuration_set(const ::SDOPackage::ConfigurationSet &configuration_set)
::SDOPackage::Local::ISDOService * m_impl
void test_get_configuration_parameter_value()
ISDOServiceServantMock(doil::ImplBase *impl)
void test_remove_configuration_set()
OrganizationServantMock(doil::ImplBase *impl)
::SDOPackage::ConfigurationSet * get_configuration_set(const char *id)
::SDOPackage::Local::DependencyType m_dependency
NameValue and NVList utility functions.
virtual bool remove_organization_property(const ::std::string &name)
void test_add_organization()
::SDOPackage::NVList * get_configuration_parameter_values()
virtual bool set_owner(const ::SDOPackage::Local::ISDOSystemElement *sdo)
virtual CORBA::Boolean add_members(const ::SDOPackage::SDOList &sdo_list)
void log(const std::string &msg)
void setLogger(Logger *logger)
void test_add_configuration_set()
::CORBA::Boolean add_organization(::SDOPackage::Organization_ptr org)
void test_get_configuration_parameter_values()
::CORBA::Boolean set_configuration_parameter(const char *name, const CORBA::Any &value)
virtual ::CORBA::Boolean set_organization_property(const ::SDOPackage::OrganizationProperty &organization_property)
CPPUNIT_TEST_SUITE_REGISTRATION(ConfigurationProxy::ConfigurationProxyTests)
virtual bool set_organization_property(const ::SDOPackage::Local::OrganizationProperty &organization_property)
::CORBA::Boolean set_device_profile(const ::SDOPackage::DeviceProfile &dProfile)
virtual ::CORBA::Boolean set_organization_property_value(const char *name, const CORBA::Any &value)
virtual ::SDOPackage::OrganizationProperty * get_organization_property()
::SDOPackage::SDOList m_memberList
::SDOPackage::Parameter m_par
virtual void setUp()
Test initialization.
::SDOPackage::Local::IOrganization * m_impl
::SDOPackage::ConfigurationSet * get_active_configuration_set()
::SDOPackage::EnumerationType m_etype
void test_set_configuration_parameter()
virtual ~ISDOServiceServantMock()
virtual ~IOrganizationMock()
::OutPortBase::Logger logger
::CORBA::Any * get_configuration_parameter_value(const char *name)
::SDOPackage::StringList m_stlist
virtual CORBA::Boolean remove_member(const char *id)
void test_set_service_profile()
virtual ReturnCode_t deactivateObject(doil::ImplBase *impl)
Deactivate object.
virtual bool set_organization_property_value(const ::std::string &name, const ::std::string &value)
void test_activate_configuration_set()
ConfigurationProxyTests()
Constructor.
virtual ::CORBA::Boolean remove_organization_property(const char *name)
::CORBA::Boolean remove_configuration_set(const char *id)
virtual bool add_members(const ::SDOPackage::Local::SDOList &sdo_list)
::CORBA::Boolean set_configuration_set_values(const char *id, const ::SDOPackage::ConfigurationSet &configuration_set)
virtual ~OrganizationServantMock()
virtual ~ISDOServiceMock()
virtual ReturnCode_t activateObject(doil::ImplBase *impl)
Activate object.
::CORBA::Boolean set_service_profile(const ::SDOPackage::ServiceProfile &sProfile)
::SDOPackage::SDOSystemElement_var m_varOwner
~ConfigurationProxyTests()
Destructor.
virtual CORBA::Boolean set_members(const ::SDOPackage::SDOList &sdos)
PortableServer::POA_ptr m_pPOA
virtual ::SDOPackage::DependencyType get_dependency()
std::vector< std::string > m_log
virtual ::CORBA::Boolean set_owner(::SDOPackage::SDOSystemElement_ptr sdo)
virtual bool remove_member(const ::std::string &id)
void test_remove_service_profile()
virtual ::SDOPackage::Local::SDOList get_members()
virtual ::SDOPackage::Local::DependencyType get_dependency()
virtual ::SDOPackage::Local::OrganizationProperty get_organization_property()
virtual ~ConfigurationMock()