new version for handling msvc variadic template bug by using default
authorStefan Laner <laner@itestra.de>
Fri, 20 Dec 2013 16:57:17 +0000 (17:57 +0100)
committerStefan Laner <laner@itestra.de>
Wed, 15 Jan 2014 16:56:11 +0000 (17:56 +0100)
attribute extension

Change-Id: I636e0aab4050f516224d5d4120047c37638a0844

src/CommonAPI/DBus/DBusConnection.cpp
src/test/DBusFactoryTest.cpp
src/test/DBusMultipleConnectionTest.cpp
src/test/commonapi/tests/TestInterfaceProxy.h

index fc35997..748b38e 100644 (file)
@@ -30,8 +30,6 @@ DBusObjectPathVTable DBusConnection::libdbusObjectPathVTable_ = {
 };
 
 void DBusConnection::dispatch(std::shared_ptr<DBusConnection>* selfReference) {
-//void DBusConnection::dispatch() {
-    //auto selfReference = this->shared_from_this();
     while (!stopDispatching_ && readWriteDispatch(10) && !selfReference->unique()) {
         if(pauseDispatching_) {
             dispatchSuspendLock_.lock();
index dba8365..8963e97 100755 (executable)
@@ -93,7 +93,8 @@ TEST_F(DBusProxyFactoryTest, CreatesDefaultTestProxy) {
     auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>("local:commonapi.tests.TestInterface:commonapi.tests.TestInterface");
     ASSERT_TRUE((bool)defaultTestProxy);
 }
-#ifndef WIN32
+
+
 TEST_F(DBusProxyFactoryTest, CreatesDefaultExtendedTestProxy) {
     std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime_->createFactory();
     ASSERT_TRUE((bool)proxyFactory);
@@ -116,7 +117,6 @@ TEST_F(DBusProxyFactoryTest, CreatesIndividuallyExtendedTestProxy) {
     auto attributeExtension = specificAttributeExtendedTestProxy->getTestDerivedArrayAttributeAttributeExtension();
     ASSERT_TRUE(attributeExtension.testExtensionMethod());
 }
-#endif // !WIN32
 
 TEST_F(DBusProxyFactoryTest, HandlesRegistrationOfStubAdapters) {
     std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime_->createFactory();
index 71623a6..ca99536 100755 (executable)
@@ -27,7 +27,7 @@
 const std::string serviceAddress = "local:commonapi.tests.TestInterface:commonapi.tests.TestInterface";
 
 class DBusMultipleConnectionTest: public ::testing::Test {
- protected:
+protected:
     virtual void SetUp() {
         proxyFactory = CommonAPI::Runtime::load()->createFactory();
         stubFactory = CommonAPI::Runtime::load()->createFactory();
@@ -37,7 +37,7 @@ class DBusMultipleConnectionTest: public ::testing::Test {
         stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
         bool serviceNameAcquired = stubFactory->registerService(stub, serviceAddress);
 
-        for(unsigned int i = 0; !serviceNameAcquired && i < 100; i++) {
+        for (unsigned int i = 0; !serviceNameAcquired && i < 100; i++) {
             usleep(10000);
             serviceNameAcquired = stubFactory->registerService(stub, serviceAddress);
         }
@@ -46,24 +46,22 @@ class DBusMultipleConnectionTest: public ::testing::Test {
         proxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(serviceAddress);
         ASSERT_TRUE((bool)proxy);
 
-        for(unsigned int i = 0; !proxy->isAvailable() && i < 100; ++i) {
+        for (unsigned int i = 0; !proxy->isAvailable() && i < 100; ++i) {
             usleep(10000);
         }
     }
 
     virtual void TearDown() {
-       stubFactory->unregisterService(serviceAddress);
-       usleep(30000);
+        stubFactory->unregisterService(serviceAddress);
+        usleep(30000);
     }
 
     std::shared_ptr<CommonAPI::Factory> proxyFactory;
     std::shared_ptr<CommonAPI::Factory> stubFactory;
     std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub;
-    std::shared_ptr<commonapi::tests::TestInterfaceProxy<> > proxy;
-
+    std::shared_ptr<commonapi::tests::TestInterfaceProxyDefault> proxy;
 };
 
-
 TEST_F(DBusMultipleConnectionTest, RemoteMethodCall) {
     uint32_t v1 = 5;
     std::string v2 = "Hai :)";
@@ -141,4 +139,4 @@ int main(int argc, char** argv) {
     ::testing::InitGoogleTest(&argc, argv);
     return RUN_ALL_TESTS();
 }
-#endif
\ No newline at end of file
+#endif
index be86bf4..8960c37 100755 (executable)
@@ -181,6 +181,12 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter
     std::shared_ptr<TestInterfaceProxyBase> delegate_;
 };
 
+#ifdef WIN32
+    typedef TestInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> TestInterfaceProxyDefault;
+#else
+    typedef TestInterfaceProxy<> TestInterfaceProxyDefault;
+#endif
+
 namespace TestInterfaceExtensions {
     template <template <typename > class _ExtensionType>
     class TestPredefinedTypeAttributeAttributeExtension {
@@ -253,9 +259,7 @@ namespace TestInterfaceExtensions {
 template <typename ... _AttributeExtensions>
 TestInterfaceProxy<_AttributeExtensions...>::TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
         delegate_(std::dynamic_pointer_cast<TestInterfaceProxyBase>(delegate))
-#ifndef WIN32
         , _AttributeExtensions(*(std::dynamic_pointer_cast<TestInterfaceProxyBase>(delegate)))...
-#endif
 { }
 
 template <typename ... _AttributeExtensions>