22 #ifndef OutPortConnector_cpp 23 #define OutPortConnector_cpp 25 #include <cppunit/ui/text/TestRunner.h> 26 #include <cppunit/TextOutputter.h> 27 #include <cppunit/extensions/TestFactoryRegistry.h> 28 #include <cppunit/extensions/HelperMacros.h> 29 #include <cppunit/TestAssert.h> 31 #include <coil/Properties.h> 33 #include <rtm/idl/BasicDataTypeSkel.h> 97 return ::RTC::DataPortStatus::PORT_OK;
111 return ::RTC::DataPortStatus::PORT_OK;
118 :
public CppUnit::TestFixture
122 CPPUNIT_TEST(test_case0);
124 CPPUNIT_TEST_SUITE_END();
141 m_pORB = CORBA::ORB_init(argc, argv);
142 m_pPOA = PortableServer::POA::_narrow(
143 m_pORB->resolve_initial_references(
"RootPOA"));
144 m_pPOA->the_POAManager()->activate();
185 RTC::ConnectorProfile cprof;
186 cprof.connector_id =
"id";
187 cprof.name = CORBA::string_dup(
"OutPortConnectorTest");
199 cprof.ports.length(2);
200 cprof.ports[0] = port_ref1;
201 cprof.ports[1] = port_ref2;
209 CPPUNIT_ASSERT_EQUAL(std::string(cprof.connector_id), std::string(connector.
id()));
210 CPPUNIT_ASSERT_EQUAL(std::string(cprof.name), std::string(connector.
name()));
217 CPPUNIT_ASSERT_EQUAL(info.
name,info2.name);
218 CPPUNIT_ASSERT_EQUAL(info.
id,info2.id);
219 CPPUNIT_ASSERT(info.
ports==info2.ports);
221 info2.properties.size());
222 CPPUNIT_ASSERT_EQUAL(info.
properties[
"dataport.interface_type"],
223 info2.properties[
"dataport.interface_type"]);
224 CPPUNIT_ASSERT_EQUAL(info.
properties[
"dataport.dataflow_type"],
225 info2.properties[
"dataport.dataflow_type"]);
226 CPPUNIT_ASSERT_EQUAL(info.
properties[
"dataport.subscription_type"],
227 info2.properties[
"dataport.subscription_type"]);
241 int main(
int argc,
char* argv[])
254 std::string arg(argv[i]);
255 std::string next_arg;
256 if (i + 1 < argc) next_arg = argv[i + 1];
259 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
272 ofs.open(fname.c_str());
274 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
275 if ( arg ==
"--cerr" ) { target = 1;
break; }
276 if ( arg ==
"--xsl" )
278 if (next_arg ==
"") xsl =
"default.xsl";
281 if ( arg ==
"--namespace" )
285 std::cerr <<
"no namespace specified" << std::endl;
295 CppUnit::TextUi::TestRunner runner;
297 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
299 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
300 CppUnit::Outputter* outputter = 0;
301 std::ostream* stream = target ? &std::cerr : &std::cout;
305 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
308 std::cout <<
"XML_OUT" << std::endl;
309 outputter =
new CppUnit::XmlOutputter(&runner.result(),
311 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
314 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
317 runner.setOutputter(outputter);
322 #endif // OutPortConnector_cpp SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
int main(int argc, char **argv)
OutPortConnector base class.
coil::Properties properties
Connection properties.
PortableServer::POA_ptr m_pPOA
~OutPortConnectorTests()
Destructor.
coil::vstring ports
Connection ports.
virtual void setEndian(const bool endian_type)
Setting an endian type.
bool read()
It is a virtual method that is called from RTObject_impl::readAll(). This method reads out data from ...
Enum
DataPortStatus return codes.
virtual bool isLittleEndian()
return it whether endian setting.
RTC::CdrBufferBase * getBuffer()
Getting Buffer.
void test_case0()
profile(), id(), name(), setEndian(), isLittleEndian() メソッドのテスト
CPPUNIT_TEST_SUITE_REGISTRATION(OutPortConnector::OutPortConnectorTests)
OutPortMock(const char *name, const char *value)
ReturnCode disconnect()
Disconnect connection.
void copyToProperties(coil::Properties &prop, const SDOPackage::NVList &nv)
Copy NVList to the Proeprties.
InPortMock(const char *name, const char *value)
void registerPort(PortBase &port)
Regsiter the Port.
NameValue and NVList utility functions.
void activate()
Connector activation.
OutPortConnectorTests()
Constructor.
CORBA sequence utility template functions.
std::string name
Connection name.
void deactivate()
Connector deactivation.
prop
Organization::get_organization_property ();.
virtual PortProfile * get_port_profile()
[CORBA interface] Get the PortProfile of the Port
RTC::Port implementation for InPort.
ReturnCode write(const cdrMemoryStream &data)
Destructor.
Class represents a set of properties.
int size(void) const
Get the number of Properties.
virtual ~OutPortConnectorMock()
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
virtual void setUp()
Test initialization.
void deletePort(PortBase &port)
Unregister the Port registration.
virtual void tearDown()
Test finalization.
coil::vstring refToVstring(const CorbaRefSequence &objlist)
BufferBase abstract class.
const char * id()
Getting Connector ID.
RTC::CdrBufferBase * m_buffer
std::string id
ConnectionID.
RTC's Port administration class.
const ConnectorInfo & profile()
Getting Profile.
OutPortConnectorMock(RTC::ConnectorInfo &info)
const char * name()
Getting Connector name.