18 #ifndef InPortCorbaCdrProvider_cpp 19 #define InPortCorbaCdrProvider_cpp 21 #include <cppunit/ui/text/TestRunner.h> 22 #include <cppunit/TextOutputter.h> 23 #include <cppunit/extensions/TestFactoryRegistry.h> 24 #include <cppunit/extensions/HelperMacros.h> 25 #include <cppunit/TestAssert.h> 27 #include <rtm/idl/BasicDataTypeSkel.h> 55 const RTC::TimedLong&
data)
57 std::cout <<
"------------------------------" << std::endl;
58 std::cout <<
"Data Listener: " <<
m_name << std::endl;
59 std::cout <<
"Profile::name: " << info.
name << std::endl;
60 std::cout <<
"------------------------------" << std::endl;
78 std::cout <<
"------------------------------" << std::endl;
79 std::cout <<
"Connector Listener: " <<
m_name << std::endl;
80 std::cout <<
"Profile::name: " << info.
name << std::endl;
81 std::cout <<
"------------------------------" << std::endl;
118 :
public CppUnit::TestFixture
122 CPPUNIT_TEST(test_case0);
123 CPPUNIT_TEST_SUITE_END();
140 m_pORB = CORBA::ORB_init(argc, argv);
141 m_pPOA = PortableServer::POA::_narrow(
142 m_pORB->resolve_initial_references(
"RootPOA"));
143 m_pPOA->the_POAManager()->activate();
222 CPPUNIT_ASSERT(0<=index);
226 CPPUNIT_ASSERT(0<=index);
231 ::OpenRTM::PortStatus
ret;
232 ::OpenRTM::CdrData
data;
233 int testdata[10] = { 0,1,2,3,4,5,6,7,8,9 };
238 td.data = testdata[0];
240 len = (CORBA::ULong)cdr.bufSize();
242 cdr.get_octet_array(&(data[0]), len);
243 ret = provider.
put(data);
246 CPPUNIT_ASSERT_EQUAL(::OpenRTM::PORT_ERROR,ret);
255 std::cout <<
"ERROR: Connector creation failed." << std::endl;
259 ret = provider.
put(data);
260 CPPUNIT_ASSERT_EQUAL(::OpenRTM::PORT_OK,ret);
262 for(
int i(1); i<7; ++i )
264 OpenRTM::PortStatus
ret;
268 td.data = testdata[i];
270 len = (CORBA::ULong)cdr.bufSize();
272 cdr.get_octet_array(&(data[0]), len);
273 ret = provider.
put(data);
274 CPPUNIT_ASSERT_EQUAL(::OpenRTM::PORT_OK,ret);
277 cdrMemoryStream cdr2;
278 td.data = testdata[7];
280 len = (CORBA::ULong)cdr2.bufSize();
282 cdr2.get_octet_array(&(data[0]), len);
283 ret = provider.
put(data);
284 CPPUNIT_ASSERT_EQUAL(::OpenRTM::PORT_OK,ret);
299 int main(
int argc,
char* argv[])
312 std::string arg(argv[i]);
313 std::string next_arg;
314 if (i + 1 < argc) next_arg = argv[i + 1];
317 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
330 ofs.open(fname.c_str());
332 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
333 if ( arg ==
"--cerr" ) { target = 1;
break; }
334 if ( arg ==
"--xsl" )
336 if (next_arg ==
"") xsl =
"default.xsl";
339 if ( arg ==
"--namespace" )
343 std::cerr <<
"no namespace specified" << std::endl;
353 CppUnit::TextUi::TestRunner runner;
355 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
357 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
358 CppUnit::Outputter* outputter = 0;
359 std::ostream* stream = target ? &std::cerr : &std::cout;
363 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
366 std::cout <<
"XML_OUT" << std::endl;
367 outputter =
new CppUnit::XmlOutputter(&runner.result(),
369 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
372 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
375 runner.setOutputter(outputter);
380 #endif // InPortCorbaCdrProvider_cpp
InPortPushConnector class.
ConnectorListeners class.
RTC::ConnectorListeners m_listeners
int main(int argc, char **argv)
InPortConnector base class.
RTC::InPortConnector * connector
InPortCorbaCdrProviderMock(void)
virtual void operator()(const RTC::ConnectorInfo &info)
Virtual Callback method.
InPortCorbaCdrProviderTests()
Constructor.
void addListener(ConnectorDataListener *listener, bool autoclean)
Add the listener.
std::vector< std::pair< std::string, std::string > > NVList
ConnectorListenerHolder connector_[CONNECTOR_LISTENER_NUM]
ConnectorListenerType listener array The ConnectorListenerType listener is stored.
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
void addListener(ConnectorListener *listener, bool autoclean)
Add the listener.
static GlobalFactory< AbstractClass, Identifier, Compare, Creator, Destructor > & instance()
Create instance.
InPortCorbaCdrProvider class.
CPPUNIT_TEST_SUITE_REGISTRATION(InPortCorbaCdrProvider::InPortCorbaCdrProviderTests)
std::vector< std::string > vstring
virtual void setListener(ConnectorInfo &info, ConnectorListeners *listeners)
Set the listener.
const CORBA::Long find_index(const SDOPackage::NVList &nv, const char *name)
Return the index of element specified by name from NVList.
ConnectorDataListenerHolder connectorData_[CONNECTOR_DATA_LISTENER_NUM]
ConnectorDataListenerType listener array The ConnectorDataListenerType listener is stored...
InPortCorbaCdrProvider class.
virtual void setConnector(InPortConnector *connector)
set Connector
DataListener(const char *name)
ConnectorDataListenerT class.
CORBA sequence utility template functions.
Push type connector class.
std::string name
Connection name.
virtual void setUp()
Test initialization.
PortableServer::POA_ptr m_pPOA
SDOPackage::NVList get_m_properties()
prop
Organization::get_organization_property ();.
virtual void operator()(const RTC::ConnectorInfo &info, const RTC::TimedLong &data)
Virtual Callback method.
~InPortCorbaCdrProviderTests()
Destructor.
Class represents a set of properties.
virtual void setBuffer(BufferBase< cdrMemoryStream > *buffer)
Setting outside buffer's pointer.
ConnListener(const char *name)
virtual void init(coil::Properties &prop)
Initializing configuration.
virtual ~InPortCorbaCdrProviderMock()
virtual void tearDown()
Test finalization.
BufferBase abstract class.
virtual ::OpenRTM::PortStatus put(const ::OpenRTM::CdrData &data)
[CORBA interface] Write data into the buffer
RTC's Port administration class.