17 #ifndef OrganizationProxy_cpp 18 #define OrganizationProxy_cpp 20 #include <cppunit/ui/text/TestRunner.h> 21 #include <cppunit/TextOutputter.h> 22 #include <cppunit/extensions/TestFactoryRegistry.h> 23 #include <cppunit/extensions/HelperMacros.h> 24 #include <cppunit/TestAssert.h> 27 #include <idl/SDOPackageSkel.h> 28 #include <OrganizationProxy.h> 29 #include <ISDOSystemElement.h> 31 #include <doil/corba/CORBAProxyBase.h> 47 void log(
const std::string& msg)
55 for (
int i = 0; i < (int)
m_log.size(); ++i)
57 if (
m_log[i] == msg) ++count;
72 :
public virtual ::POA_SDOPackage::SDOSystemElement,
77 : ::
doil::CORBA::CORBAServantBase(impl)
88 ::SDOPackage::Local::ISDOSystemElement*
m_impl;
96 :
public virtual ::SDOPackage::Local::ISDOSystemElement
103 const char*
id() {
return "ISDOSystemElementMock";}
104 const char*
name() {
return "ISDOSystemElementMock";}
118 ::SDOPackage::Local::OrganizationList list;
131 :
public virtual ::POA_SDOPackage::Organization
151 return "get_organization_id";
204 virtual CORBA::Boolean
set_owner(SDOPackage::SDOSystemElement_ptr sdo)
206 if (m_logger != NULL)
208 m_logger->log(
"set_owner");
224 virtual CORBA::Boolean
set_members(
const SDOPackage::SDOList& sdos)
232 virtual CORBA::Boolean
add_members(
const SDOPackage::SDOList& sdo_list)
250 return SDOPackage::NO_DEPENDENCY;
266 :
public CppUnit::TestFixture
269 CPPUNIT_TEST(test_set_owner);
271 CPPUNIT_TEST_SUITE_END();
286 m_pORB = CORBA::ORB_init(argc, argv);
287 m_pPOA = PortableServer::POA::_narrow(
288 m_pORB->resolve_initial_references(
"RootPOA"));
289 m_pPOA->the_POAManager()->activate();
321 std::cout <<
"Manager Name==>"<< mgr.
name() << std::endl;
324 ::CORBA::Object_ptr ref = obj->_this();
325 if(::CORBA::is_nil(ref))
327 std::cout<<
"ref is nil.Abort test."<<std::endl;
330 ::SDOPackage::CORBA::OrganizationProxy* ap
331 = new ::SDOPackage::CORBA::OrganizationProxy(ref);
340 doil::New<SDOSystemElementServantMock>,
341 doil::Delete<SDOSystemElementServantMock>);
343 CPPUNIT_ASSERT_EQUAL(0, logger.
countLog(
"set_owner"));
344 ret = ap->set_owner(sdo);
345 CPPUNIT_ASSERT_EQUAL(1, logger.
countLog(
"set_owner"));
346 CPPUNIT_ASSERT_EQUAL(
false, ret);
366 int main(
int argc,
char* argv[])
368 CppUnit::TextUi::TestRunner runner;
369 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
370 CppUnit::Outputter* outputter =
371 new CppUnit::TextOutputter(&runner.result(), std::cout);
372 runner.setOutputter(outputter);
377 #endif // OrganizationProxy_cpp OrganizationProxyTests()
Constructor.
virtual ~OrganizationRtmMock()
int main(int argc, char **argv)
virtual const char * name()
Getting ORB's name.
PortableServer::POA_ptr m_pPOA
virtual CORBA::Any * get_organization_property_value(const char *name)
CPPUNIT_TEST_SUITE_REGISTRATION(OrganizationProxy::OrganizationProxyTests)
virtual ReturnCode_t registerFactory(const char *id, doil::ServantNewFunc new_func, doil::ServantDeleteFunc delete_func)
Register servant's factory.
virtual CORBA::Boolean set_owner(SDOPackage::SDOSystemElement_ptr sdo)
static CORBAManager & instance()
getting instance
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
virtual CORBA::Boolean set_organization_property(const SDOPackage::OrganizationProperty &organization_property)
~OrganizationProxyTests()
Destructor.
::SDOPackage::Local::ISDOSystemElement * m_impl
std::vector< std::string > m_log
virtual CORBA::Boolean set_dependency(SDOPackage::DependencyType dependency)
virtual CORBA::Boolean remove_organization_property(const char *name)
int countLog(const std::string &msg)
virtual CORBA::Boolean set_organization_property_value(const char *name, const CORBA::Any &value)
std::vector< std::string > m_log
virtual SDOPackage::DependencyType get_dependency()
virtual SDOPackage::SDOSystemElement_ptr get_owner()
virtual void setUp()
Test initialization.
virtual char * get_organization_id()
virtual CORBA::Boolean remove_member(const char *id)
virtual ::SDOPackage::Local::OrganizationList get_owned_organizations()
virtual void tearDown()
Test finalization.
void log(const std::string &msg)
SDOSystemElementServantMock(doil::ImplBase *impl)
virtual ~SDOSystemElementServantMock()
virtual CORBA::Boolean add_members(const SDOPackage::SDOList &sdo_list)
::OutPortBase::Logger logger
virtual ::SDOPackage::OrganizationList * get_owned_organizations()
virtual CORBA::Boolean set_members(const SDOPackage::SDOList &sdos)
virtual ~ISDOSystemElementMock()
virtual ReturnCode_t activateObject(doil::ImplBase *impl)
Activate object.
void setLogger(Logger *logger)
virtual SDOPackage::SDOList * get_members()
virtual SDOPackage::OrganizationProperty * get_organization_property()