18 #ifndef InPortBase_cpp 19 #define InPortBase_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> 28 #include <rtm/idl/DataPortSkel.h> 61 "ON_BUFFER_WRITE_TIMEOUT",
62 "ON_BUFFER_OVERWRITE",
67 "ON_RECEIVER_TIMEOUT",
75 "ON_BUFFER_READ_TIMEOUT",
100 const RTC::TimedLong&
data)
102 std::cout <<
"------------------------------" << std::endl;
103 std::cout <<
"Data Listener: " <<
m_name << std::endl;
104 std::cout <<
"Profile::name: " << info.
name << std::endl;
105 std::cout <<
"------------------------------" << std::endl;
126 std::cout <<
"------------------------------" << std::endl;
127 std::cout <<
"Connector Listener: " <<
m_name << std::endl;
128 std::cout <<
"Profile::name: " << info.
name << std::endl;
129 std::cout <<
"------------------------------" << std::endl;
142 void log(
const std::string& msg)
144 m_log.push_back(msg);
150 for (
int i = 0; i < (int) m_log.size(); ++i)
152 if (m_log[i] == msg) ++count;
170 template <
class DataType>
179 logger.
log(
"RingBufferMock::Constructor");
180 m_read_return_value = BUFFER_OK;
193 m_read_return_value = value;
216 return ::RTC::BufferStatus::BUFFER_OK;
224 return ::RTC::BufferStatus::BUFFER_OK;
230 virtual DataType*
wptr(
long int n = 0)
240 return ::RTC::BufferStatus::BUFFER_OK;
248 return ::RTC::BufferStatus::BUFFER_OK;
255 long int sec = -1,
long int nsec = -1)
257 return ::RTC::BufferStatus::BUFFER_OK;
279 virtual DataType*
rptr(
long int n = 0)
289 return ::RTC::BufferStatus::BUFFER_OK;
297 return ::RTC::BufferStatus::BUFFER_OK;
303 virtual DataType&
get()
312 long int sec = -1,
long int nsec = -1)
314 if (m_logger != NULL)
316 m_logger->log(
"RingBufferMock::read");
319 return m_read_return_value;
354 template <
class DataType>
365 public virtual POA_OpenRTM::InPortCdr,
366 public virtual PortableServer::RefCountServantBase
374 setInterfaceType(
"corba_cdr");
377 m_objref = this->_this();
384 orb->object_to_string(m_objref.in())));
392 PortableServer::ObjectId_var oid;
393 oid = _default_POA()->servant_to_id(
this);
394 _default_POA()->deactivate_object(oid);
402 if (m_logger != NULL)
404 m_logger->log(
"InPortCorbaCdrProviderMock::setBuffer");
411 ::OpenRTM::PortStatus
put(const ::OpenRTM::CdrData&
data)
412 throw (CORBA::SystemException)
414 return ::OpenRTM::PORT_OK;
422 if (m_logger != NULL)
424 m_logger->log(
"InPortCorbaCdrProviderMock::init");
523 if (m_logger != NULL)
525 m_logger->log(
"OutPortCorbaCdrConsumerMock::setBuffer");
532 ::OpenRTM::PortStatus
put(const ::OpenRTM::CdrData&
data)
533 throw (CORBA::SystemException)
535 return ::OpenRTM::PORT_OK;
543 if (m_logger != NULL)
545 m_logger->log(
"OutPortCorbaCdrConsumerMock::init");
626 rtclog.setLevel(
"PARANOID");
649 return m_providerTypes;
657 return m_consumerTypes;
681 m_singlebuffer =
true;
689 m_singlebuffer =
false;
762 template <
class DataType>
778 :
public CppUnit::TestFixture
782 CPPUNIT_TEST(test_constructor);
783 CPPUNIT_TEST(test_init);
784 CPPUNIT_TEST(test_init2);
785 CPPUNIT_TEST(test_init3);
786 CPPUNIT_TEST(test_initProviders);
787 CPPUNIT_TEST(test_initProviders2);
788 CPPUNIT_TEST(test_initConsumers);
789 CPPUNIT_TEST(test_initConsumers2);
790 CPPUNIT_TEST(test_activateInterfaces_deactivateInterfaces);
791 CPPUNIT_TEST(test_publishInterfaces);
792 CPPUNIT_TEST(test_publishInterfaces2);
793 CPPUNIT_TEST(test_publishInterfaces3);
794 CPPUNIT_TEST(test_publishInterfaces4);
795 CPPUNIT_TEST(test_publishInterfaces5);
796 CPPUNIT_TEST(test_subscribeInterfaces);
797 CPPUNIT_TEST(test_subscribeInterfaces2);
798 CPPUNIT_TEST(test_subscribeInterfaces3);
799 CPPUNIT_TEST(test_subscribeInterfaces4);
800 CPPUNIT_TEST(test_subscribeInterfaces5);
801 CPPUNIT_TEST(test_createConnector);
802 CPPUNIT_TEST(test_createConnector2);
803 CPPUNIT_TEST(test_ConnectorListener);
805 CPPUNIT_TEST_SUITE_END();
823 m_pORB = CORBA::ORB_init(argc, argv);
824 m_pPOA = PortableServer::POA::_narrow(
825 m_pORB->resolve_initial_references(
"RootPOA"));
826 m_pPOA->the_POAManager()->activate();
848 addFactory(
"corba_cdr",
861 addFactory(
"corba_cdr",
874 addFactory(
"ring_buffer",
875 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
876 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
899 CPPUNIT_ASSERT_EQUAL(std::string(
"DataInPort"), prop[
"port.port_type"] );
900 CPPUNIT_ASSERT_EQUAL(std::string(toTypename<RTC::TimedFloat>()),
901 prop[
"dataport.data_type"] );
902 CPPUNIT_ASSERT_EQUAL(std::string(
"Any"),
903 prop[
"dataport.subscription_type"]);
929 addFactory(
"corba_cdr",
942 addFactory(
"corba_cdr",
956 addFactory(
"ring_buffer",
957 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
958 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
969 CPPUNIT_ASSERT_EQUAL(std::string(
""),
970 prop[
"dataport.dataflow_type"]);
971 CPPUNIT_ASSERT_EQUAL(std::string(
""),
972 prop[
"dataport.interface_type"]);
975 CPPUNIT_ASSERT_EQUAL((
size_t)0, pstr.size());
977 CPPUNIT_ASSERT_EQUAL((
size_t)0, cstr.size());
979 CPPUNIT_ASSERT_EQUAL(0,
987 CPPUNIT_ASSERT_EQUAL(1,
994 CPPUNIT_ASSERT_EQUAL(std::string(
"push,pull"),
995 prop[
"dataport.dataflow_type"]);
996 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
997 prop[
"dataport.interface_type"]);
1001 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1004 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1029 addFactory(
"corba_cdr",
1042 addFactory(
"corba_cdr",
1055 addFactory(
"ring_buffer",
1056 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1057 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1066 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1067 prop[
"dataport.dataflow_type"]);
1068 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1069 prop[
"dataport.interface_type"]);
1072 CPPUNIT_ASSERT_EQUAL((
size_t)0, pstr.size());
1074 CPPUNIT_ASSERT_EQUAL((
size_t)0, cstr.size());
1076 CPPUNIT_ASSERT_EQUAL(0,
1084 CPPUNIT_ASSERT_EQUAL(0,
1091 CPPUNIT_ASSERT_EQUAL(std::string(
"push,pull"),
1092 prop[
"dataport.dataflow_type"]);
1093 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1094 prop[
"dataport.interface_type"]);
1098 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1101 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1126 addFactory(
"corba_cdr",
1139 addFactory(
"corba_cdr",
1159 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1160 prop[
"dataport.dataflow_type"]);
1161 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1162 prop[
"dataport.interface_type"]);
1165 CPPUNIT_ASSERT_EQUAL((
size_t)0, pstr.size());
1167 CPPUNIT_ASSERT_EQUAL((
size_t)0, cstr.size());
1169 CPPUNIT_ASSERT_EQUAL(0,
1177 CPPUNIT_ASSERT_EQUAL(0,
1184 CPPUNIT_ASSERT_EQUAL(std::string(
"push,pull"),
1185 prop[
"dataport.dataflow_type"]);
1186 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1187 prop[
"dataport.interface_type"]);
1191 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1194 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1213 addFactory(
"corba_cdr",
1232 addFactory(
"corba_cdr",
1240 addFactory(
"ring_buffer",
1241 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1242 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1252 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1253 prop[
"dataport.dataflow_type"]);
1254 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1255 prop[
"dataport.interface_type"]);
1258 CPPUNIT_ASSERT_EQUAL((
size_t)0, pstr.size());
1266 CPPUNIT_ASSERT_EQUAL(std::string(
"push"),
1267 prop[
"dataport.dataflow_type"]);
1268 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1269 prop[
"dataport.interface_type"]);
1273 CPPUNIT_ASSERT((
size_t)0!= pstr.size());
1274 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1299 addFactory(
"corba_cdr",
1312 addFactory(
"ring_buffer",
1313 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1314 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1324 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1325 prop[
"dataport.dataflow_type"]);
1326 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1327 prop[
"dataport.interface_type"]);
1330 CPPUNIT_ASSERT_EQUAL((
size_t)0, pstr.size());
1338 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1339 prop[
"dataport.dataflow_type"]);
1340 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1341 prop[
"dataport.interface_type"]);
1345 CPPUNIT_ASSERT((
size_t)0== pstr.size());
1362 addFactory(
"corba_cdr",
1375 addFactory(
"corba_cdr",
1388 addFactory(
"ring_buffer",
1389 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1390 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1399 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1400 prop[
"dataport.dataflow_type"]);
1401 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1402 prop[
"dataport.interface_type"]);
1405 CPPUNIT_ASSERT_EQUAL((
size_t)0, cstr.size());
1413 CPPUNIT_ASSERT_EQUAL(std::string(
"pull"),
1414 prop[
"dataport.dataflow_type"]);
1415 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1416 prop[
"dataport.interface_type"]);
1420 CPPUNIT_ASSERT((
size_t)0!= cstr.size());
1421 CPPUNIT_ASSERT_EQUAL(std::string(
"corba_cdr"),
1440 addFactory(
"corba_cdr",
1459 addFactory(
"ring_buffer",
1460 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1461 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1470 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1471 prop[
"dataport.dataflow_type"]);
1472 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1473 prop[
"dataport.interface_type"]);
1476 CPPUNIT_ASSERT_EQUAL((
size_t)0, cstr.size());
1484 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1485 prop[
"dataport.dataflow_type"]);
1486 CPPUNIT_ASSERT_EQUAL(std::string(
""),
1487 prop[
"dataport.interface_type"]);
1491 CPPUNIT_ASSERT((
size_t)0== cstr.size());
1509 addFactory(
"corba_cdr",
1522 addFactory(
"corba_cdr",
1536 addFactory(
"ring_buffer",
1537 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1538 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1546 RTC::ConnectorProfile prof;
1547 prof.connector_id =
"id0";
1548 prof.name = CORBA::string_dup(
"InPortBaseTest0");
1549 prof.ports.length(1);
1561 prof.connector_id =
"id1";
1562 prof.name = CORBA::string_dup(
"InPortBaseTest1");
1567 CPPUNIT_ASSERT(cilist.size() == 2);
1568 CPPUNIT_ASSERT_EQUAL(std::string(
"id0"), std::string(cilist[0].
id));
1569 CPPUNIT_ASSERT_EQUAL(std::string(
"InPortBaseTest0"), std::string(cilist[0].name));
1570 CPPUNIT_ASSERT_EQUAL((
size_t)1, cilist[0].ports.size());
1571 CPPUNIT_ASSERT_EQUAL(std::string(
"id1"), std::string(cilist[1].
id));
1572 CPPUNIT_ASSERT_EQUAL(std::string(
"InPortBaseTest1"), std::string(cilist[1].name));
1573 CPPUNIT_ASSERT_EQUAL((
size_t)1, cilist[1].ports.size());
1577 CPPUNIT_ASSERT(ids.size() == 2);
1578 CPPUNIT_ASSERT_EQUAL(std::string(
"id0"), std::string(ids[0]));
1579 CPPUNIT_ASSERT_EQUAL(std::string(
"id1"), std::string(ids[1]));
1583 CPPUNIT_ASSERT_EQUAL(std::string(
"InPortBaseTest0"), std::string(names[0]));
1584 CPPUNIT_ASSERT_EQUAL(std::string(
"InPortBaseTest1"), std::string(names[1]));
1588 CPPUNIT_ASSERT(ic == 0);
1590 CPPUNIT_ASSERT(ic != 0);
1592 CPPUNIT_ASSERT(ic != 0);
1596 CPPUNIT_ASSERT(ic == 0);
1598 CPPUNIT_ASSERT(ic != 0);
1600 CPPUNIT_ASSERT(ic != 0);
1605 CPPUNIT_ASSERT( !bret );
1607 CPPUNIT_ASSERT( bret );
1609 CPPUNIT_ASSERT( bret );
1613 CPPUNIT_ASSERT( !bret );
1615 CPPUNIT_ASSERT( bret );
1617 CPPUNIT_ASSERT( bret );
1642 addFactory(
"corba_cdr",
1655 addFactory(
"corba_cdr",
1669 addFactory(
"ring_buffer",
1670 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1671 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1679 RTC::ConnectorProfile prof;
1680 prof.connector_id =
"id0";
1681 prof.name = CORBA::string_dup(
"InPortBaseTest0");
1682 prof.ports.length(1);
1699 prof.connector_id =
"id1";
1700 prof.name = CORBA::string_dup(
"InPortBaseTest1");
1726 addFactory(
"corba_cdr",
1739 addFactory(
"corba_cdr",
1753 addFactory(
"ring_buffer",
1754 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1755 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1763 RTC::ConnectorProfile prof;
1764 prof.connector_id =
"id0";
1765 prof.name = CORBA::string_dup(
"InPortBaseTest0");
1766 prof.ports.length(1);
1783 prof.connector_id =
"id1";
1784 prof.name = CORBA::string_dup(
"InPortBaseTest1");
1808 addFactory(
"corba_cdr",
1821 addFactory(
"corba_cdr",
1835 addFactory(
"ring_buffer",
1836 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1837 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1845 RTC::ConnectorProfile prof;
1846 prof.connector_id =
"id0";
1847 prof.name = CORBA::string_dup(
"InPortBaseTest0");
1848 prof.ports.length(1);
1865 prof.connector_id =
"id1";
1866 prof.name = CORBA::string_dup(
"InPortBaseTest1");
1896 addFactory(
"corba_cdr",
1910 addFactory(
"ring_buffer",
1911 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
1912 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
1920 RTC::ConnectorProfile prof;
1921 prof.connector_id =
"id0";
1922 prof.name = CORBA::string_dup(
"InPortBaseTest0");
1923 prof.ports.length(1);
1959 addFactory(
"corba_cdr",
1972 addFactory(
"corba_cdr",
1991 RTC::ConnectorProfile prof;
1992 prof.connector_id =
"id0";
1993 prof.name = CORBA::string_dup(
"InPortBaseTest0");
1994 prof.ports.length(1);
2027 addFactory(
"corba_cdr",
2040 addFactory(
"corba_cdr",
2054 addFactory(
"ring_buffer",
2055 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
2056 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
2064 RTC::ConnectorProfile prof;
2065 prof.connector_id =
"id0";
2066 prof.name = CORBA::string_dup(
"InPortBaseTest0");
2067 prof.ports.length(1);
2084 prof.connector_id =
"id1";
2085 prof.name = CORBA::string_dup(
"InPortBaseTest1");
2110 addFactory(
"corba_cdr",
2123 addFactory(
"corba_cdr",
2137 addFactory(
"ring_buffer",
2138 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
2139 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
2147 RTC::ConnectorProfile prof;
2148 prof.connector_id =
"id0";
2149 prof.name = CORBA::string_dup(
"InPortBaseTest0");
2150 prof.ports.length(1);
2187 addFactory(
"corba_cdr",
2200 addFactory(
"corba_cdr",
2214 addFactory(
"ring_buffer",
2215 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
2216 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
2224 RTC::ConnectorProfile prof;
2225 prof.connector_id =
"id0";
2226 prof.name = CORBA::string_dup(
"InPortBaseTest0");
2227 prof.ports.length(1);
2264 addFactory(
"corba_cdr",
2284 addFactory(
"ring_buffer",
2285 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
2286 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
2294 RTC::ConnectorProfile prof;
2295 prof.connector_id =
"id0";
2296 prof.name = CORBA::string_dup(
"InPortBaseTest0");
2297 prof.ports.length(1);
2333 addFactory(
"corba_cdr",
2346 addFactory(
"corba_cdr",
2364 RTC::ConnectorProfile prof;
2365 prof.connector_id =
"id0";
2366 prof.name = CORBA::string_dup(
"InPortBaseTest0");
2367 prof.ports.length(1);
2397 RTC::ConnectorProfile prof;
2403 CPPUNIT_ASSERT(0!= connector);
2419 RTC::ConnectorProfile prof;
2422 prop.setProperty(
"InPortBaseTests",
"bad_alloc");
2426 CPPUNIT_ASSERT(0 != connector);
2441 outport.
init(dummy);
2450 addFactory(
"corba_cdr",
2463 addFactory(
"corba_cdr",
2477 addFactory(
"ring_buffer",
2478 coil::Creator<RTC::CdrBufferBase, CdrRingBufferMock>,
2479 coil::Destructor<RTC::CdrBufferBase, CdrRingBufferMock>);
2486 RTC::ConnectorProfile prof;
2487 prof.connector_id =
"id0";
2488 prof.name = CORBA::string_dup(
"connectTest0");
2489 prof.ports.length(2);
2503 for (
int i(0); i<
cdl_len; ++i)
2509 for (
int i(0); i<
cl_len; ++i)
2515 for (
int i(0); i<
cdl_len; ++i)
2518 m_datalisteners[i],
true);
2522 for (
int i(0); i<
cl_len; ++i)
2525 m_connlisteners[i],
true);
2529 CPPUNIT_ASSERT_EQUAL(10, cdl_count);
2530 CPPUNIT_ASSERT_EQUAL(7, cl_count);
2542 CPPUNIT_ASSERT( bret );
2554 for (
int i(0); i<
cdl_len; ++i)
2557 m_datalisteners[i]);
2561 for (
int i(0); i<
cl_len; ++i)
2564 m_connlisteners[i]);
2568 CPPUNIT_ASSERT_EQUAL(0, cdl_count);
2569 CPPUNIT_ASSERT_EQUAL(0, cl_count);
2583 int main(
int argc,
char* argv[])
2596 std::string arg(argv[i]);
2597 std::string next_arg;
2598 if (i + 1 < argc) next_arg = argv[i + 1];
2601 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
2614 ofs.open(fname.c_str());
2616 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
2617 if ( arg ==
"--cerr" ) { target = 1;
break; }
2618 if ( arg ==
"--xsl" )
2620 if (next_arg ==
"") xsl =
"default.xsl";
2621 else xsl = next_arg;
2623 if ( arg ==
"--namespace" )
2627 std::cerr <<
"no namespace specified" << std::endl;
2637 CppUnit::TextUi::TestRunner runner;
2639 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
2641 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
2642 CppUnit::Outputter* outputter = 0;
2643 std::ostream* stream = target ? &std::cerr : &std::cout;
2647 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
2650 std::cout <<
"XML_OUT" << std::endl;
2651 outputter =
new CppUnit::XmlOutputter(&runner.result(),
2653 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
2656 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
2659 runner.setOutputter(outputter);
2664 #endif // OutPortBase_cpp
SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
void test_subscribeInterfaces2(void)
subscribeInterfaces()メソッドのテスト dataport.dataflow_typeがpullでsubscribeInterfaceをコール
void set_read_return_value(::RTC::BufferStatus::Enum value)
ConnectorListeners class.
void test_initConsumers()
initConsumers()メソッドのテスト
#define RTC_ERROR(fmt)
Error log output macro.
int main(int argc, char **argv)
virtual ReturnCode_t subscribeInterfaces(const ConnectorProfile &connector_profile)
Subscribe to the interface.
coil::Properties & properties()
Get properties.
void setLogger(Logger *logger)
void setBuffer(RTC::BufferBase< cdrMemoryStream > *buffer)
Setting outside buffer's pointer.
InPortConnector base class.
void test_subscribeInterfaces5(void)
subscribeInterfaces()メソッドのテスト
ConnListener(const char *name)
RTC::CdrBufferBase * getThebuffer()
virtual ReturnCode_t connect(ConnectorProfile &connector_profile)
[CORBA interface] Connect the Port
void setLogger(Logger *logger)
virtual void setUp()
Test initialization.
::OpenRTM::PortStatus put(const ::OpenRTM::CdrData &data)
AbstractClass * Creator()
Creator template.
void test_init3()
init()メソッドのテスト
std::vector< std::pair< std::string, std::string > > NVList
void log(const std::string &msg)
void log(const std::string &msg)
BUFFERSTATUS_ENUM RingBufferMock(long int length=8)
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
::OpenRTM::PortStatus put(const ::OpenRTM::CdrData &data)
PortableServer::POA_ptr m_pPOA
virtual void init(const coil::Properties &prop)
Set the buffer.
void test_publishInterfaces(void)
publishInterfaces()メソッドのテスト
void test_init2()
init()メソッドのテスト
virtual ~InPortCorbaCdrProviderMock(void)
CORBA::ORB_ptr getORB()
Get the pointer to ORB.
std::vector< ConnectorInfo > ConnectorInfoList
RingBufferMock< cdrMemoryStream > CdrRingBufferMock
void test_init()
init()メソッドのテスト
void setListener(RTC::ConnectorInfo &info, RTC::ConnectorListeners *listeners)
Set the listener.
bool isLittleEndian()
return it whether endian setting.
InPortBaseMock(const char *name, const char *data_type)
static GlobalFactory< AbstractClass, Identifier, Compare, Creator, Destructor > & instance()
Create instance.
static Manager & instance()
Get instance of the manager.
virtual void deactivateInterfaces()
Deactivate all Port interfaces.
static const char * str_cl[]
bool read()
It is a virtual method that is called from RTObject_impl::readAll(). This method reads out data from ...
coil::vstring get_m_consumerTypes()
Enum
DataPortStatus return codes.
OutPortCorbaCdrConsumer class.
virtual void activateInterfaces()
Activate all Port interfaces.
void init(coil::Properties &prop)
virtual size_t readable() const
Write data into the buffer.
void unsubscribeInterface(const SDOPackage::NVList &properties)
Unsubscribe the data receive notification.
InPortCorbaCdrProvider class.
void setLogger(Logger *logger)
virtual ReturnCode advanceRptr(long int n=1)
Forward n reading pointers.
virtual ReturnCode length(size_t n)
Set the buffer length.
std::vector< std::string > vstring
ConnectorDataListenerType
The types of ConnectorDataListener.
InPortConnector * createConnector(ConnectorProfile &cprof, coil::Properties &prop, InPortProvider *provider)
InPortPushConnector creation.
OutPortMock(const char *name, DataType &value)
virtual ~RingBufferMock(void)
bool subscribeInterface(const SDOPackage::NVList &properties)
void test_createConnector(void)
createConnector()メソッドのテスト
#define BUFFERSTATUS_ENUM
Importing RTC::BufferStatus macro.
InPortConnector * getConnectorByName(const char *name)
Getting Connector by name.
void setConnector(RTC::InPortConnector *connector)
set Connector
InPortCorbaCdrProvider class.
coil::vstring getProviderTypes()
coil::Properties get_m_properties()
void test_publishInterfaces2(void)
publishInterfaces()メソッドのテスト dataport.dataflow_typeがpullでpublisherInterfaceをコール
ConnectorDataListenerT class.
void removeConnectorDataListener(ConnectorDataListenerType listener_type, ConnectorDataListener *listener)
Removing BufferDataListener type listener.
void registerPort(PortBase &port)
Regsiter the Port.
InPortConnector base class.
virtual RTC::ReturnCode_t publishInterfaces_public(RTC::ConnectorProfile &connector_profile)
virtual ReturnCode write(const DataType &value, long int sec=-1, long int nsec=-1)
Write data into the buffer.
virtual ~InPortBaseMock()
RTC::InPortProvider * createProvider_public(RTC::ConnectorProfile &cprof, coil::Properties &prop)
virtual void tearDown()
Test finalization.
InPortBaseTests()
Constructor.
void init(coil::Properties &prop)
Initializing configuration.
bool getConnectorProfileById(const char *id, ConnectorInfo &prof)
Getting ConnectorProfile by name.
void test_publishInterfaces5(void)
publishInterfaces()メソッドのテスト
ConnectorInfoList getConnectorProfiles()
ConnectorProfile list.
void test_subscribeInterfaces(void)
subscribeInterfaces()メソッドのテスト
Push type connector class.
virtual bool empty(void) const
Check on whether the buffer is empty.
coil::vstring getConnectorIds()
ConnectorId list.
std::string name
Connection name.
virtual ~OutPortCorbaCdrConsumerMock(void)
void init(coil::Properties &prop)
Initializing properties.
bool getConnectorProfileByName(const char *name, ConnectorInfo &prof)
Getting ConnectorProfile by name.
void addConnectorListener(ConnectorListenerType callback_type, ConnectorListener *listener, bool autoclean=true)
Adding ConnectorListener type listener.
OutPortCorbaCdrConsumer class.
void test_initConsumers2()
initConsumers()メソッドのテスト
~InPortBaseTests()
Destructor.
virtual DataType * rptr(long int n=0)
Get the reading pointer.
RTC::ConnectorListeners m_listeners
::RTC::BufferStatus::Enum ReturnCode
prop
Organization::get_organization_property ();.
virtual PortProfile * get_port_profile()
[CORBA interface] Get the PortProfile of the Port
InPortCorbaCdrProviderMock(void)
RTC::Port implementation for InPort.
coil::Properties toProperties(const SDOPackage::NVList &nv)
Transform NVList to the properties.
void test_subscribeInterfaces4(void)
subscribeInterfaces()メソッドのテスト
void test_activateInterfaces_deactivateInterfaces(void)
activateInterfaces(),deactivateInterfaces()メソッドのテスト
void Destructor(AbstractClass *&obj)
Destructor template.
ConnectorListenerType
The types of ConnectorListener.
Class represents a set of properties.
virtual size_t length(void) const
Get the buffer length.
void removeConnectorListener(ConnectorListenerType callback_type, ConnectorListener *listener)
Removing BufferDataListener type listener.
std::vector< std::string > m_log
virtual ReturnCode put(const DataType &value)
Write data into the buffer.
OutPortCorbaCdrConsumerMock(void)
void test_publishInterfaces3(void)
publishInterfaces()メソッドのテスト
void setBuffer(RTC::BufferBase< cdrMemoryStream > *buffer)
Setting outside buffer's pointer.
void setListener(RTC::ConnectorInfo &info, RTC::ConnectorListeners *listeners)
Set the listener.
virtual size_t writable() const
Get a writable number.
virtual bool full(void) const
Check on whether the buffer is full.
virtual ReturnCode reset()
Reset the buffer status.
virtual bool write(DataType &value)
Write data.
void initConsumers_public()
::OutPortBase::Logger logger
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
OutPortConsumer abstract class.
std::vector< DataType > m_buffer
std::vector< ConnectorBase * > ConnectorList
::OpenRTM::InPortCdr_var m_objref
void test_subscribeInterfaces3(void)
subscribeInterfaces()メソッドのテスト
virtual void operator()(const RTC::ConnectorInfo &info, const RTC::TimedLong &data)
Virtual Callback method.
coil::vstring getConnectorNames()
Connector name list.
void deletePort(PortBase &port)
Unregister the Port registration.
InPortConnector * getConnectorById(const char *id)
Getting ConnectorProfile by ID.
void test_initProviders2()
initProviders()メソッドのテスト The provider is not registered in Factory.
virtual RTC::ReturnCode_t subscribeInterfaces_public(RTC::ConnectorProfile &connector_profile)
void init(coil::Properties &prop)
Initializing properties.
virtual ReturnCode_t disconnect_all()
[CORBA interface] Disconnect the All Ports
RTC::InPortConsumer::ReturnCode put(const cdrMemoryStream &data)
void test_createConnector2(void)
createConnector()メソッドのテスト
void test_publishInterfaces4(void)
publishInterfaces(),deactivateInterfaces()メソッドのテスト
void publishInterfaceProfile(SDOPackage::NVList &properties)
ConnectorList get_m_connectors()
BufferBase abstract class.
void test_initProviders()
initProviders()メソッドのテスト
DataListener(const char *name)
void unsubscribeInterface(const SDOPackage::NVList &properties)
virtual ReturnCode advanceWptr(long int n=1)
Forward n writing pointers.
void init(coil::Properties &prop)
Initializing configuration.
void addConnectorDataListener(ConnectorDataListenerType listener_type, ConnectorDataListener *listener, bool autoclean=true)
Adding BufferDataListener type listener.
static const char * str_cdl[]
void test_constructor()
コンスラクタのテスト
void initProviders_public()
RTC's Port administration class.
void publishInterfaceProfile(SDOPackage::NVList &properties)
Publish InterfaceProfile information.
int countLog(const std::string &msg)
CPPUNIT_TEST_SUITE_REGISTRATION(InPortBase::InPortBaseTests)
RTC::InPortConnector * createConnector_public(RTC::ConnectorProfile &cprof, coil::Properties &prop, RTC::InPortProvider *provider)
InPortProvider * createProvider(ConnectorProfile &cprof, coil::Properties &prop)
InPort provider creation.
virtual DataType * wptr(long int n=0)
Get the writing pointer.
const PortProfile & getPortProfile() const
Get the PortProfile of the Port.
::RTC::BufferStatus::Enum m_read_return_value
virtual void operator()(const RTC::ConnectorInfo &info)
Virtual Callback method.
bool subscribeInterface(const SDOPackage::NVList &properties)
Subscribe the data receive notification.
void test_ConnectorListener(void)
addConnectorDataListener(), removeConnectorDataListener(), addConnectorListener(), removeConnectorListener(), isLittleEndian(), connect() メソッドのテスト
virtual ReturnCode read(DataType &value, long int sec=-1, long int nsec=-1)
Read data from the buffer.
virtual ReturnCode_t publishInterfaces(ConnectorProfile &connector_profile)
Publish interface information.
RTC::OutPortConsumer::ReturnCode put(const cdrMemoryStream &data)