31 #ifndef InPortProvider_cpp 32 #define InPortProvider_cpp 34 #include <cppunit/ui/text/TestRunner.h> 35 #include <cppunit/TextOutputter.h> 36 #include <cppunit/extensions/TestFactoryRegistry.h> 37 #include <cppunit/extensions/HelperMacros.h> 38 #include <cppunit/TestAssert.h> 53 const std::string& interfaceType,
54 const std::string& dataFlowType,
55 const std::string& subscriptionType)
85 :
public CppUnit::TestFixture
88 CPPUNIT_TEST(test_publishInterfaceProfile);
89 CPPUNIT_TEST(test_publishInterface_with_interfaceType_matched);
90 CPPUNIT_TEST(test_publishInterface_with_interfaceType_unmatched);
91 CPPUNIT_TEST_SUITE_END();
101 for (
int i = 0; i <
g_argc; i++) {
102 argv[i] = (
char *)g_argv[i].c_str();
105 CORBA::ORB_var orb = CORBA::ORB_init(g_argc, argv);
138 std::auto_ptr<InPortProviderMock>
provider(
142 provider->setDummydataInProperties();
145 provider->publishInterfaceProfile(prop);
148 CPPUNIT_ASSERT_EQUAL(std::string(
"INTERFACE_TYPE"),
152 CPPUNIT_ASSERT_EQUAL(std::string(
"VALUE1"),
NVUtil::toString(prop,
"KEY1"));
153 CPPUNIT_ASSERT_EQUAL(std::string(
"VALUE2"),
NVUtil::toString(prop,
"KEY2"));
163 std::auto_ptr<InPortProviderMock>
provider(
167 provider->setDummydataInProperties();
171 CPPUNIT_ASSERT_EQUAL(
true, provider->publishInterface(props));
174 CPPUNIT_ASSERT_EQUAL(std::string(
"VALUE1"),
NVUtil::toString(props,
"KEY1"));
175 CPPUNIT_ASSERT_EQUAL(std::string(
"VALUE2"),
NVUtil::toString(props,
"KEY2"));
185 std::auto_ptr<InPortProviderMock>
provider(
189 provider->setDummydataInProperties();
193 CPPUNIT_ASSERT_EQUAL(
false, provider->publishInterface(props));
209 int main(
int argc,
char* argv[])
222 std::string arg(argv[i]);
223 std::string next_arg;
224 if (i + 1 < argc) next_arg = argv[i + 1];
227 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
240 ofs.open(fname.c_str());
242 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
243 if ( arg ==
"--cerr" ) { target = 1;
break; }
244 if ( arg ==
"--xsl" )
246 if (next_arg ==
"") xsl =
"default.xsl";
249 if ( arg ==
"--namespace" )
253 std::cerr <<
"no namespace specified" << std::endl;
263 CppUnit::TextUi::TestRunner runner;
265 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
267 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
268 CppUnit::Outputter* outputter = 0;
269 std::ostream* stream = target ? &std::cerr : &std::cout;
273 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
276 std::cout <<
"XML_OUT" << std::endl;
277 outputter =
new CppUnit::XmlOutputter(&runner.result(),
279 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
282 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
285 runner.setOutputter(outputter);
290 #endif // InPortProvider_cpp void setDummydataInProperties(void)
ConnectorListeners class.
void setBuffer(RTC::BufferBase< cdrMemoryStream > *buffer)
Setting outside buffer's pointer.
int main(int argc, char **argv)
void test_publishInterface_with_interfaceType_matched()
publishInterface()
InPortConnector base class.
virtual void tearDown()
Test finalization.
CPPUNIT_TEST_SUITE_REGISTRATION(InPortProvider::InPortProviderTests)
SDOPackage::NVList m_properties
Properties to hold port profile.
bool appendStringValue(SDOPackage::NVList &nv, const char *name, const char *value)
Append the specified string to element of NVList.
std::vector< std::pair< std::string, std::string > > NVList
InPortProviderMock(const std::string &interfaceType, const std::string &dataFlowType, const std::string &subscriptionType)
virtual void setUp()
Test initialization.
void test_publishInterface_with_interfaceType_unmatched()
publishInterface()
std::string toString(const SDOPackage::NVList &nv, const char *name)
Get NVList of specifid name as string.
void setDataFlowType(const char *dataflow_type)
Set the dataflow type.
void setListener(RTC::ConnectorInfo &info, RTC::ConnectorListeners *listeners)
Set the listener.
prop
Organization::get_organization_property ();.
void setInterfaceType(const char *interface_type)
Set the interface type.
Class represents a set of properties.
void init(coil::Properties &prop)
Initializing configuration.
void test_publishInterfaceProfile()
publishInterfaceProfile()
std::vector< std::string > g_argv
void setConnector(RTC::InPortConnector *connector)
set Connector
BufferBase abstract class.
void setSubscriptionType(const char *subs_type)
Set the subscription type.
InPortProviderTests()
Constructor.
~InPortProviderTests()
Destructor.