17 #ifndef ConfigurationServant_cpp 18 #define ConfigurationServant_cpp 20 #include <cppunit/ui/text/TestRunner.h> 21 #include <cppunit/extensions/HelperMacros.h> 22 #include <cppunit/TestAssert.h> 24 #include <ConfigurationServant.h> 26 #include <coil/Properties.h> 31 #include <IConfiguration.h> 42 :
public CppUnit::TestFixture
67 ::SDOPackage::CORBA::ConfigurationServant *
CServant;
79 doil::New<SDOPackage::CORBA::ConfigurationServant>,
80 doil::Delete<SDOPackage::CORBA::ConfigurationServant>);
83 CServant =
dynamic_cast<SDOPackage::CORBA::ConfigurationServant*
>(
Servant);
120 CPPUNIT_ASSERT(CServant);
122 std::string str(
"set_device_profile");
123 ::SDOPackage::DeviceProfile dp;
124 ::CORBA::Boolean result;
125 result = CServant->set_device_profile(dp);
126 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
127 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
137 CPPUNIT_ASSERT(CServant);
139 std::string str(
"set_service_profile");
140 ::SDOPackage::ServiceProfile sp;
141 ::CORBA::Boolean result;
142 result = CServant->set_service_profile(sp);
143 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
144 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
154 CPPUNIT_ASSERT(CServant);
156 std::string str(
"add_organization");
157 ::SDOPackage::Organization_ptr
org;
158 ::CORBA::Boolean result;
159 result = CServant->add_organization(org);
160 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
161 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
172 CPPUNIT_ASSERT(CServant);
174 std::string str(
"remove_service_profile");
175 std::string
id(
"Hoge");
176 ::CORBA::Boolean result;
177 result = CServant->remove_service_profile(
id.c_str());
178 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
179 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
180 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not argument", Log.
pop(),
id);
191 CPPUNIT_ASSERT(CServant);
193 std::string str(
"remove_organization");
194 std::string
id(
"Hoge");
195 ::CORBA::Boolean result;
196 result = CServant->remove_organization(
id.c_str());
197 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
198 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
199 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not argument", Log.
pop(),
id);
209 CPPUNIT_ASSERT(CServant);
211 std::string str(
"get_configuration_parameters");
212 ::SDOPackage::ParameterList* result;
213 result = CServant->get_configuration_parameters();
214 CPPUNIT_ASSERT_MESSAGE(
"non-exist", result);
215 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
225 CPPUNIT_ASSERT(CServant);
227 std::string str(
"get_configuration_parameter_values");
229 result = CServant->get_configuration_parameter_values();
230 CPPUNIT_ASSERT_MESSAGE(
"non-exist", result);
231 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
241 CPPUNIT_ASSERT(CServant);
243 std::string str(
"get_configuration_parameter_value");
244 std::string name(
"Hoge");
245 ::CORBA::Any* result;
246 result = CServant->get_configuration_parameter_value(name.c_str());
247 CPPUNIT_ASSERT_MESSAGE(
"non-exist", result);
248 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
249 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not argument", Log.
pop(), name);
260 CPPUNIT_ASSERT(CServant);
262 std::string str(
"set_configuration_parameter");
263 std::string name(
"hoge");
265 ::CORBA::Boolean result;
266 result = CServant->set_configuration_parameter(name.c_str(), value);
267 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
268 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
269 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not argument", Log.
pop(), name);
280 CPPUNIT_ASSERT(CServant);
282 std::string str(
"get_configuration_sets");
283 ::SDOPackage::ConfigurationSetList* result;
284 result = CServant->get_configuration_sets();
285 CPPUNIT_ASSERT_MESSAGE(
"non-exist", result);
286 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
297 CPPUNIT_ASSERT(CServant);
299 std::string str(
"get_configuration_set");
300 std::string config_id(
"hoge");
301 ::SDOPackage::ConfigurationSet* result;
302 result = CServant->get_configuration_set(config_id.c_str());
303 CPPUNIT_ASSERT_MESSAGE(
"non-exist", result);
304 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
305 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not argument", Log.
pop(), config_id);
316 CPPUNIT_ASSERT(CServant);
318 std::string str(
"set_configuration_set_values");
319 std::string config_id(
"hoge");
320 ::SDOPackage::ConfigurationSet
set;
321 ::CORBA::Boolean result;
322 result = CServant->set_configuration_set_values(config_id.c_str(),
set);
323 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
324 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
325 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not argument", Log.
pop(), config_id);
335 CPPUNIT_ASSERT(CServant);
337 std::string str(
"get_active_configuration_set");
338 ::SDOPackage::ConfigurationSet* result;
339 result = CServant->get_active_configuration_set();
340 CPPUNIT_ASSERT_MESSAGE(
"non-exist", result);
341 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
352 CPPUNIT_ASSERT(CServant);
354 std::string str(
"add_configuration_set");
355 ::SDOPackage::ConfigurationSet
set;
356 ::CORBA::Boolean result;
357 result = CServant->add_configuration_set(
set);
358 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
359 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
370 CPPUNIT_ASSERT(CServant);
372 std::string str(
"remove_configuration_set");
373 std::string config_id(
"hoge");
374 ::CORBA::Boolean result;
375 result = CServant->remove_configuration_set(config_id.c_str());
376 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
377 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
378 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not argument", Log.
pop(), config_id);
389 CPPUNIT_ASSERT(CServant);
391 std::string str(
"activate_configuration_set");
392 std::string str2(
"hoge");
393 ::CORBA::Boolean result;
394 result = CServant->activate_configuration_set(str2.c_str());
395 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not true",
true, result);
396 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not method name", Log.
pop(), str);
397 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"not argument", Log.
pop(), str2);
408 int main(
int argc,
char* argv[])
410 CppUnit::TextUi::TestRunner runner;
411 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
412 CppUnit::Outputter* outputter =
413 new CppUnit::TextOutputter(&runner.result(), std::cout);
414 runner.setOutputter(outputter);
419 #endif // ConfigurationServant_cpp int main(int argc, char **argv)
void test_call_get_configuration_parameter_values()
以下の要件を確認する
void test_call_set_device_profile()
以下の要件を確認する
virtual ServantBase * toServant(doil::ImplBase *lobj)
Getting servant object by impl object.
virtual ReturnCode_t registerFactory(const char *id, doil::ServantNewFunc new_func, doil::ServantDeleteFunc delete_func)
Register servant's factory.
void test_call_set_service_profile()
以下の要件を確認する
std::vector< std::pair< std::string, std::string > > NVList
void test_call_get_configuration_parameters()
以下の要件を確認する
static CORBAManager & instance()
getting instance
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
void test_call_get_configuration_set()
以下の要件を確認する
::SDOPackage::CORBA::ConfigurationServant * CServant
::doil::ServantBase * Servant
virtual void tearDown()
Test finalization.
CPPUNIT_TEST_SUITE(ConfigurationServantTests)
void test_call_get_active_configuration_set()
以下の要件を確認する
doil implementation base class
void test_call_set_configuration_parameter()
以下の要件を確認する
void test_call_remove_organization()
以下の要件を確認する
::UnitTest::Servant::Logger Log
CPPUNIT_TEST(test_call_set_device_profile)
::UnitTest::Servant::ConfigurationImpl * Impl
void test_call_remove_service_profile()
以下の要件を確認する
virtual void setUp()
Test initialization.
void test_call_set_configuration_set_values()
以下の要件を確認する
ConfigurationServantTests()
Constructor.
void test_call_remove_configuration_set()
以下の要件を確認する
void test_call_activate_configuration_set()
以下の要件を確認する
Configuration implementation class for ConfigurationServant' unittest.
void test_call_add_organization()
以下の要件を確認する
void test_call_add_configuration_set()
以下の要件を確認する
~ConfigurationServantTests()
Destructor.
CPPUNIT_TEST_SUITE_REGISTRATION(ConfigurationServant::ConfigurationServantTests)
virtual ReturnCode_t activateObject(doil::ImplBase *impl)
Activate object.
void test_call_get_configuration_parameter_value()
以下の要件を確認する
void test_call_get_configuration_sets()
以下の要件を確認する