22 #ifndef InPortConnector_cpp 23 #define InPortConnector_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> 60 return ::RTC::DataPortStatus::PORT_OK;
64 return ::RTC::DataPortStatus::PORT_OK;
75 :
public CppUnit::TestFixture
79 CPPUNIT_TEST(test_case0);
81 CPPUNIT_TEST_SUITE_END();
94 CORBA::ORB_ptr m_pORB = CORBA::ORB_init(argc, argv);
95 PortableServer::POA_ptr m_pPOA = PortableServer::POA::_narrow(
96 m_pORB->resolve_initial_references(
"RootPOA"));
97 m_pPOA->the_POAManager()->activate();
128 RTC::ConnectorProfile cprof;
129 cprof.connector_id =
"id";
130 cprof.name = CORBA::string_dup(
"InPortConnectorTest");
153 CPPUNIT_ASSERT_EQUAL(std::string(cprof.connector_id), std::string(connector.
id()));
154 CPPUNIT_ASSERT_EQUAL(std::string(cprof.name), std::string(connector.
name()));
155 CPPUNIT_ASSERT_EQUAL(m_thebuffer, connector.
getBuffer());
163 CPPUNIT_ASSERT_EQUAL(info.
name, info2.name);
164 CPPUNIT_ASSERT_EQUAL(info.
id, info2.id);
176 int main(
int argc,
char* argv[])
189 std::string arg(argv[i]);
190 std::string next_arg;
191 if (i + 1 < argc) next_arg = argv[i + 1];
194 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
207 ofs.open(fname.c_str());
209 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
210 if ( arg ==
"--cerr" ) { target = 1;
break; }
211 if ( arg ==
"--xsl" )
213 if (next_arg ==
"") xsl =
"default.xsl";
216 if ( arg ==
"--namespace" )
220 std::cerr <<
"no namespace specified" << std::endl;
230 CppUnit::TextUi::TestRunner runner;
232 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
234 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
235 CppUnit::Outputter* outputter = 0;
236 std::ostream* stream = target ? &std::cerr : &std::cout;
240 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
243 std::cout <<
"XML_OUT" << std::endl;
244 outputter =
new CppUnit::XmlOutputter(&runner.result(),
246 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
249 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
252 runner.setOutputter(outputter);
257 #endif // InPortConnector_cpp SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
int main(int argc, char **argv)
virtual ~InPortConnectorMock()
InPortConnector base class.
~InPortConnectorTests()
Destructor.
virtual void deactivate()
Connector deactivation.
static GlobalFactory< AbstractClass, Identifier, Compare, Creator, Destructor > & instance()
Create instance.
virtual const ConnectorInfo & profile()
Getting ConnectorInfo.
Enum
DataPortStatus return codes.
virtual void setUp()
Test initialization.
void copyToProperties(coil::Properties &prop, const SDOPackage::NVList &nv)
Copy NVList to the Proeprties.
virtual CdrBufferBase * getBuffer()
Getting Buffer.
InPortConnector base class.
NameValue and NVList utility functions.
virtual ReturnCode read(cdrMemoryStream &data)
Destructor.
virtual const char * name()
Getting Connector name.
CORBA sequence utility template functions.
virtual void setEndian(const bool endian_type)
Setting an endian type.
std::string name
Connection name.
void test_case0()
profile(),id(),name(),getBuffer(),setEndian(),isLittleEndian() メソッドのテスト
virtual void tearDown()
Test finalization.
virtual const char * id()
Getting Connector ID.
prop
Organization::get_organization_property ();.
virtual bool isLittleEndian()
Whether this connector's endian is little.
Class represents a set of properties.
CPPUNIT_TEST_SUITE_REGISTRATION(InPortConnector::InPortConnectorTests)
InPortConnectorTests()
Constructor.
virtual void activate()
Connector activation.
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
virtual ReturnCode disconnect()
Disconnect connection.
coil::vstring refToVstring(const CorbaRefSequence &objlist)
BufferBase abstract class.
std::string id
ConnectionID.
InPortConnectorMock(RTC::ConnectorInfo &info, RTC::CdrBufferBase *buffer)