17 #ifndef PeriodicECSharedComposite_cpp 18 #define PeriodicECSharedComposite_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> 26 #include <rtm/idl/RTCSkel.h> 27 #include <rtm/idl/OpenRTMSkel.h> 44 :
public CppUnit::TestFixture
48 CPPUNIT_TEST(test_PeriodicECOrganization);
49 CPPUNIT_TEST(test_PeriodicECSharedComposite);
51 CPPUNIT_TEST_SUITE_END();
66 m_pORB = CORBA::ORB_init(argc, argv);
67 m_pPOA = PortableServer::POA::_narrow(
68 m_pORB->resolve_initial_references(
"RootPOA"));
69 m_pPOA->the_POAManager()->activate();
100 SDOPackage::SDO_var sdo;
101 SDOPackage::SDOList slist;
110 sdo = SDOPackage::SDO::_duplicate(rto->
getObjRef());
114 CPPUNIT_ASSERT(bret);
117 catch (InvalidParameter ip) {
121 catch (NotAvailable na) {
125 catch (InternalError ie) {
133 CPPUNIT_ASSERT(sflg == 0);
139 CPPUNIT_ASSERT(bret);
142 catch (InvalidParameter ip) {
146 catch (NotAvailable na) {
150 catch (InternalError ie) {
158 CPPUNIT_ASSERT(sflg == 0);
170 catch (InvalidParameter ip) {
174 catch (NotAvailable na) {
178 catch (InternalError ie) {
186 CPPUNIT_ASSERT(sflg == 1);
191 sdo = SDOPackage::SDO::_duplicate(rto->
getObjRef());
195 CPPUNIT_ASSERT(bret);
198 catch (InvalidParameter ip) {
202 catch (NotAvailable na) {
206 catch (InternalError ie) {
214 CPPUNIT_ASSERT(sflg == 0);
222 catch (InvalidParameter ip) {
226 catch (NotAvailable na) {
230 catch (InternalError ie) {
238 CPPUNIT_ASSERT(sflg == 0);
240 m_pPOA->deactivate_object(*m_pPOA->servant_to_id(peco));
242 m_pPOA->deactivate_object(*m_pPOA->servant_to_id(rto));
282 m_pPOA->deactivate_object(*m_pPOA->servant_to_id(pec));
296 int main(
int argc,
char* argv[])
309 std::string arg(argv[i]);
310 std::string next_arg;
311 if (i + 1 < argc) next_arg = argv[i + 1];
314 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
327 ofs.open(fname.c_str());
329 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
330 if ( arg ==
"--cerr" ) { target = 1;
break; }
331 if ( arg ==
"--xsl" )
333 if (next_arg ==
"") xsl =
"default.xsl";
336 if ( arg ==
"--namespace" )
340 std::cerr <<
"no namespace specified" << std::endl;
350 CppUnit::TextUi::TestRunner runner;
352 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
354 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
355 CppUnit::Outputter* outputter = 0;
356 std::ostream* stream = target ? &std::cerr : &std::cout;
360 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
363 std::cout <<
"XML_OUT" << std::endl;
364 outputter =
new CppUnit::XmlOutputter(&runner.result(),
366 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
369 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
372 runner.setOutputter(outputter);
377 #endif // PeriodicECSharedComposite_cpp virtual ReturnCode_t onActivated(RTC::UniqueId exec_handle)
Callback function to activate.
virtual ReturnCode_t onReset(RTC::UniqueId exec_handle)
Callback function to reset.
int main(int argc, char **argv)
void removeAllMembers(void)
Remove a member of Organization.
void test_PeriodicECOrganization()
add_members(), set_members(), remove_member(), removeAllMembers(), updateDelegatedPorts() メソッドのテスト ...
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
virtual void setUp()
Test initialization.
SDO Organization implementation class.
static Manager & instance()
Get instance of the manager.
virtual ReturnCode_t onFinalize(void)
[ComponentAction CORBA interface] Finalize RTC
RTComponent manager class.
PeriodicECSharedComposite class.
Periodic Execution Context Shared Composite Component class.
ExecutionContextHandle_t UniqueId
virtual ~PeriodicECSharedCompositeTests()
Destructor.
PortableServer::POA_ptr m_pPOA
virtual ::CORBA::Boolean remove_member(const char *id)
[CORBA interface] Remove a member of Organization
RTObject_ptr getObjRef() const
[local interface] Get the object reference
PeriodicECSharedCompositeTests()
Constructor.
PeriodicECOrganization class.
virtual ::CORBA::Boolean set_members(const SDOList &sdos)
[CORBA interface] Set Organization member
virtual ReturnCode_t onDeactivated(RTC::UniqueId exec_handle)
Callback function to deactivate.
PeriodicExecutionContext class.
CPPUNIT_TEST_SUITE_REGISTRATION(PeriodicECSharedComposite::PeriodicECSharedCompositeTests)
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
void setInstanceName(const char *instance_name)
[local interface] Set instance name
void test_PeriodicECSharedComposite()
onInitialize(), onActivated(), onDeactivated(), onReset(), onFinalize() メソッドのテスト
virtual void tearDown()
Test finalization.
virtual ReturnCode_t onInitialize(void)
Initialization.
virtual ::CORBA::Boolean add_members(const SDOList &sdo_list)
[CORBA interface] Add Organization member
void updateDelegatedPorts(void)
Update/Remove a member of Organization.
int usleep(useconds_t usec)
Stop a processing at specified micro second time.