diff options
Diffstat (limited to 'src/test/commonapi/tests/managed')
24 files changed, 190 insertions, 62 deletions
diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp index 1b62005..4757c27 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp @@ -23,7 +23,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createBranchInterfaceDBusProxy( return std::make_shared<BranchInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerBranchInterfaceDBusProxy(void) { +INITIALIZER(registerBranchInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(BranchInterface::getInterfaceId(), &createBranchInterfaceDBusProxy); } diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp index 70f9b51..9411f53 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp @@ -25,7 +25,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubA return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerBranchInterfaceDBusStubAdapter(void) { +INITIALIZER(registerBranchInterfaceDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(), &createBranchInterfaceDBusStubAdapter); } @@ -38,6 +38,7 @@ BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal( } void BranchInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { @@ -57,17 +58,20 @@ const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionX return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< BranchInterfaceStub, CommonAPI::Version - > getBranchInterfaceInterfaceVersionStubDispatcher(&BranchInterfaceStub::getInterfaceVersion, "uu"); + > BranchInterfaceDBusStubAdapterInternal::getBranchInterfaceInterfaceVersionStubDispatcher(&BranchInterfaceStub::getInterfaceVersion, "uu"); + -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< BranchInterfaceStub, std::tuple<int32_t, std::string>, std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> - > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); + > BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); + + @@ -102,10 +106,10 @@ BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal( std::dynamic_pointer_cast<BranchInterfaceStub>(stub), false), stubDispatcherTable_({ - { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } + { { "testBranchMethod", "is" }, &commonapi::tests::managed::BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher } }) { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getBranchInterfaceInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::BranchInterfaceDBusStubAdapterInternal::getBranchInterfaceInterfaceVersionStubDispatcher }); } } // namespace managed diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h index bc9cfc8..730a0e5 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<BranchInterfaceStub> BranchInterfaceDBusStubAdapterHelper; -class BranchInterfaceDBusStubAdapterInternal: public BranchInterfaceStubAdapter, public BranchInterfaceDBusStubAdapterHelper { +class BranchInterfaceDBusStubAdapterInternal: public virtual BranchInterfaceStubAdapter, public BranchInterfaceDBusStubAdapterHelper { public: BranchInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -50,6 +50,22 @@ class BranchInterfaceDBusStubAdapterInternal: public BranchInterfaceStubAdapter, void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + BranchInterfaceStub, + CommonAPI::Version + > getBranchInterfaceInterfaceVersionStubDispatcher; + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + BranchInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> + > testBranchMethodStubDispatcher; + + + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h index 35ab437..c543d36 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h @@ -105,6 +105,12 @@ public: std::shared_ptr<BranchInterfaceProxyBase> delegate_; }; +#ifdef WIN32 + typedef BranchInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> BranchInterfaceProxyDefault; +#else + typedef BranchInterfaceProxy<> BranchInterfaceProxyDefault; +#endif + // // BranchInterfaceProxy Implementation diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStub.h b/src/test/commonapi/tests/managed/BranchInterfaceStub.h index 034316b..e94b775 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStub.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStub.h @@ -74,7 +74,7 @@ class BranchInterfaceStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class BranchInterfaceStub : public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent> { +class BranchInterfaceStub: public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent> { public: virtual ~BranchInterfaceStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -86,6 +86,8 @@ public: using CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef BranchInterfaceStubRemoteEvent RemoteEventType; + typedef BranchInterface StubInterface; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h index 7d992c9..bb1459b 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h @@ -44,8 +44,7 @@ public: protected: -private: - class RemoteEventHandler: public BranchInterfaceStubRemoteEvent { + class RemoteEventHandler: public virtual BranchInterfaceStubRemoteEvent { public: RemoteEventHandler(BranchInterfaceStubDefault* defaultStub); @@ -53,8 +52,8 @@ private: private: BranchInterfaceStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + BranchInterfaceStubDefault::RemoteEventHandler remoteEventHandler_; CommonAPI::Version interfaceVersion_; diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp index 0a6eb8a..4616c17 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp @@ -23,7 +23,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createLeafInterfaceDBusProxy( return std::make_shared<LeafInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerLeafInterfaceDBusProxy(void) { +INITIALIZER(registerLeafInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(LeafInterface::getInterfaceId(), &createLeafInterfaceDBusProxy); } diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp index 1a43690..5411efa 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp @@ -25,7 +25,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAda return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerLeafInterfaceDBusStubAdapter(void) { +INITIALIZER(registerLeafInterfaceDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(), &createLeafInterfaceDBusStubAdapter); } @@ -38,6 +38,7 @@ LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() { } void LeafInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { @@ -57,17 +58,20 @@ const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< LeafInterfaceStub, CommonAPI::Version - > getLeafInterfaceInterfaceVersionStubDispatcher(&LeafInterfaceStub::getInterfaceVersion, "uu"); + > LeafInterfaceDBusStubAdapterInternal::getLeafInterfaceInterfaceVersionStubDispatcher(&LeafInterfaceStub::getInterfaceVersion, "uu"); + -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< LeafInterfaceStub, std::tuple<int32_t, std::string>, std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> - > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); + > LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); + + @@ -102,10 +106,10 @@ LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal( std::dynamic_pointer_cast<LeafInterfaceStub>(stub), false), stubDispatcherTable_({ - { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } + { { "testLeafMethod", "is" }, &commonapi::tests::managed::LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher } }) { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getLeafInterfaceInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::LeafInterfaceDBusStubAdapterInternal::getLeafInterfaceInterfaceVersionStubDispatcher }); } } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h index 1dc3d81..4819095 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<LeafInterfaceStub> LeafInterfaceDBusStubAdapterHelper; -class LeafInterfaceDBusStubAdapterInternal: public LeafInterfaceStubAdapter, public LeafInterfaceDBusStubAdapterHelper { +class LeafInterfaceDBusStubAdapterInternal: public virtual LeafInterfaceStubAdapter, public LeafInterfaceDBusStubAdapterHelper { public: LeafInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -50,6 +50,22 @@ class LeafInterfaceDBusStubAdapterInternal: public LeafInterfaceStubAdapter, pub void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + LeafInterfaceStub, + CommonAPI::Version + > getLeafInterfaceInterfaceVersionStubDispatcher; + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + LeafInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> + > testLeafMethodStubDispatcher; + + + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h index f83f6e6..289e3c3 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h @@ -105,6 +105,12 @@ public: std::shared_ptr<LeafInterfaceProxyBase> delegate_; }; +#ifdef WIN32 + typedef LeafInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> LeafInterfaceProxyDefault; +#else + typedef LeafInterfaceProxy<> LeafInterfaceProxyDefault; +#endif + // // LeafInterfaceProxy Implementation diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStub.h b/src/test/commonapi/tests/managed/LeafInterfaceStub.h index 2224922..e93cdf0 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStub.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStub.h @@ -74,7 +74,7 @@ class LeafInterfaceStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class LeafInterfaceStub : public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent> { +class LeafInterfaceStub: public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent> { public: virtual ~LeafInterfaceStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -86,6 +86,8 @@ public: using CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef LeafInterfaceStubRemoteEvent RemoteEventType; + typedef LeafInterface StubInterface; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h index dfaadb2..c0bd5b1 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h @@ -44,8 +44,7 @@ public: protected: -private: - class RemoteEventHandler: public LeafInterfaceStubRemoteEvent { + class RemoteEventHandler: public virtual LeafInterfaceStubRemoteEvent { public: RemoteEventHandler(LeafInterfaceStubDefault* defaultStub); @@ -53,8 +52,8 @@ private: private: LeafInterfaceStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + LeafInterfaceStubDefault::RemoteEventHandler remoteEventHandler_; CommonAPI::Version interfaceVersion_; diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp index ddfe44c..1c4e8c8 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp @@ -23,7 +23,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createRootInterfaceDBusProxy( return std::make_shared<RootInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerRootInterfaceDBusProxy(void) { +INITIALIZER(registerRootInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(RootInterface::getInterfaceId(), &createRootInterfaceDBusProxy); } diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp index 5f56fe5..7fa1c1b 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp @@ -25,7 +25,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAda return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerRootInterfaceDBusStubAdapter(void) { +INITIALIZER(registerRootInterfaceDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(), &createRootInterfaceDBusStubAdapter); } @@ -38,13 +38,30 @@ RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() { } void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); + std::set<std::string>::iterator iter; + std::set<std::string>::iterator iterNext; + + iter = registeredLeafInterfaceInstances.begin(); + while (iter != registeredLeafInterfaceInstances.end()) { + iterNext = std::next(iter); + + if (deregisterManagedStubLeafInterface(*iter)) { + iter = iterNext; + } + else { + iter++; + } } - for(std::set<std::string>::iterator iter = registeredBranchInterfaceInstances.begin(); - iter != registeredBranchInterfaceInstances.end(); ++iter) { - deregisterManagedStubBranchInterface(*iter); + iter = registeredBranchInterfaceInstances.begin(); + while (iter != registeredBranchInterfaceInstances.end()) { + iterNext = std::next(iter); + + if (deregisterManagedStubBranchInterface(*iter)) { + iter = iterNext; + } + else { + iter++; + } } } @@ -65,17 +82,20 @@ const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< RootInterfaceStub, CommonAPI::Version - > getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu"); + > RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu"); + -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< RootInterfaceStub, std::tuple<int32_t, std::string>, std::tuple<RootInterface::testRootMethodError, int32_t, std::string> - > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); + > RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); + + @@ -218,10 +238,10 @@ RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal( std::dynamic_pointer_cast<RootInterfaceStub>(stub), true), stubDispatcherTable_({ - { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } + { { "testRootMethod", "is" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher } }) { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getRootInterfaceInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher }); } } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h index fadd1d3..929e6c5 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<RootInterfaceStub> RootInterfaceDBusStubAdapterHelper; -class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, public RootInterfaceDBusStubAdapterHelper { +class RootInterfaceDBusStubAdapterInternal: public virtual RootInterfaceStubAdapter, public RootInterfaceDBusStubAdapterHelper { public: RootInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -56,6 +56,22 @@ class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, pub void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + RootInterfaceStub, + CommonAPI::Version + > getRootInterfaceInterfaceVersionStubDispatcher; + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + RootInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<RootInterface::testRootMethodError, int32_t, std::string> + > testRootMethodStubDispatcher; + + + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxy.h b/src/test/commonapi/tests/managed/RootInterfaceProxy.h index 511090f..e128995 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/RootInterfaceProxy.h @@ -107,6 +107,12 @@ public: std::shared_ptr<RootInterfaceProxyBase> delegate_; }; +#ifdef WIN32 + typedef RootInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> RootInterfaceProxyDefault; +#else + typedef RootInterfaceProxy<> RootInterfaceProxyDefault; +#endif + // // RootInterfaceProxy Implementation diff --git a/src/test/commonapi/tests/managed/RootInterfaceStub.h b/src/test/commonapi/tests/managed/RootInterfaceStub.h index 2e1f878..de224f6 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStub.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStub.h @@ -82,7 +82,7 @@ class RootInterfaceStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class RootInterfaceStub : public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent> { +class RootInterfaceStub: public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent> { public: virtual ~RootInterfaceStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -100,6 +100,8 @@ public: using CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef RootInterfaceStubRemoteEvent RemoteEventType; + typedef RootInterface StubInterface; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h index 3bcb0f5..a68bde3 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h @@ -52,8 +52,7 @@ public: std::set<std::string>& getBranchInterfaceInstances(); protected: -private: - class RemoteEventHandler: public RootInterfaceStubRemoteEvent { + class RemoteEventHandler: public virtual RootInterfaceStubRemoteEvent { public: RemoteEventHandler(RootInterfaceStubDefault* defaultStub); @@ -61,8 +60,8 @@ private: private: RootInterfaceStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + RootInterfaceStubDefault::RemoteEventHandler remoteEventHandler_; uint32_t autoInstanceCounter_; diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp index dbb2bd1..25e0588 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp @@ -23,7 +23,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createSecondRootDBusProxy( return std::make_shared<SecondRootDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerSecondRootDBusProxy(void) { +INITIALIZER(registerSecondRootDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(SecondRoot::getInterfaceId(), &createSecondRootDBusProxy); } diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp index 2664ca2..20ccd2b 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp @@ -25,7 +25,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapte return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { +INITIALIZER(registerSecondRootDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), &createSecondRootDBusStubAdapter); } @@ -38,9 +38,19 @@ SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() { } void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); + std::set<std::string>::iterator iter; + std::set<std::string>::iterator iterNext; + + iter = registeredLeafInterfaceInstances.begin(); + while (iter != registeredLeafInterfaceInstances.end()) { + iterNext = std::next(iter); + + if (deregisterManagedStubLeafInterface(*iter)) { + iter = iterNext; + } + else { + iter++; + } } } @@ -55,10 +65,13 @@ const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlDat return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< SecondRootStub, CommonAPI::Version - > getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu"); + > SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu"); + + + @@ -151,7 +164,7 @@ SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal( stubDispatcherTable_({ }) { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getSecondRootInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher }); } } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h index 70ef6eb..4a2afde 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<SecondRootStub> SecondRootDBusStubAdapterHelper; -class SecondRootDBusStubAdapterInternal: public SecondRootStubAdapter, public SecondRootDBusStubAdapterHelper { +class SecondRootDBusStubAdapterInternal: public virtual SecondRootStubAdapter, public SecondRootDBusStubAdapterHelper { public: SecondRootDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -53,6 +53,17 @@ class SecondRootDBusStubAdapterInternal: public SecondRootStubAdapter, public Se void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + SecondRootStub, + CommonAPI::Version + > getSecondRootInterfaceVersionStubDispatcher; + + + + + + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/SecondRootProxy.h b/src/test/commonapi/tests/managed/SecondRootProxy.h index 4926155..0ce5699 100644 --- a/src/test/commonapi/tests/managed/SecondRootProxy.h +++ b/src/test/commonapi/tests/managed/SecondRootProxy.h @@ -85,6 +85,12 @@ public: std::shared_ptr<SecondRootProxyBase> delegate_; }; +#ifdef WIN32 + typedef SecondRootProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> SecondRootProxyDefault; +#else + typedef SecondRootProxy<> SecondRootProxyDefault; +#endif + // // SecondRootProxy Implementation diff --git a/src/test/commonapi/tests/managed/SecondRootStub.h b/src/test/commonapi/tests/managed/SecondRootStub.h index b155f04..3eeb974 100644 --- a/src/test/commonapi/tests/managed/SecondRootStub.h +++ b/src/test/commonapi/tests/managed/SecondRootStub.h @@ -77,7 +77,7 @@ class SecondRootStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class SecondRootStub : public virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent> { +class SecondRootStub: public virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent> { public: virtual ~SecondRootStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -90,6 +90,8 @@ public: using CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef SecondRootStubRemoteEvent RemoteEventType; + typedef SecondRoot StubInterface; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.h b/src/test/commonapi/tests/managed/SecondRootStubDefault.h index 22c095b..bf5025e 100644 --- a/src/test/commonapi/tests/managed/SecondRootStubDefault.h +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.h @@ -45,8 +45,7 @@ public: std::set<std::string>& getLeafInterfaceInstances(); protected: -private: - class RemoteEventHandler: public SecondRootStubRemoteEvent { + class RemoteEventHandler: public virtual SecondRootStubRemoteEvent { public: RemoteEventHandler(SecondRootStubDefault* defaultStub); @@ -54,8 +53,8 @@ private: private: SecondRootStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + SecondRootStubDefault::RemoteEventHandler remoteEventHandler_; uint32_t autoInstanceCounter_; |