diff options
Diffstat (limited to 'org.genivi.commonapi.core.verification/src')
27 files changed, 1898 insertions, 979 deletions
diff --git a/org.genivi.commonapi.core.verification/src/CMAttributeSubscription.cpp b/org.genivi.commonapi.core.verification/src/CMAttributeSubscription.cpp index d7e9c9d..4a0c01c 100644 --- a/org.genivi.commonapi.core.verification/src/CMAttributeSubscription.cpp +++ b/org.genivi.commonapi.core.verification/src/CMAttributeSubscription.cpp @@ -18,14 +18,18 @@ #include "CommonAPI/CommonAPI.hpp" #include "v1_0/commonapi/communication/TestInterfaceProxy.hpp" #include "v1_0/commonapi/communication/TestInterfaceStubDefault.hpp" +#include "v1_0/commonapi/communication/DaemonStubDefault.hpp" +#include "stub/CMAttributesStub.h" -const std::string serviceId = "service-sample"; +const std::string daemonId = "service-sample"; const std::string clientId = "client-sample"; +const std::string serviceId = "test-service"; const std::string domain = "local"; const std::string testAddress = "commonapi.communication.TestInterface"; +const std::string daemonAddress = "commonapi.communication.Daemon"; -const unsigned int wt = 500000; +const unsigned int wt = 100000; typedef std::shared_ptr<v1_0::commonapi::communication::TestInterfaceProxy<>> ProxyPtr; @@ -33,6 +37,8 @@ std::mutex mut; std::deque<uint32_t> data_queue; std::condition_variable data_cond; +using namespace v1_0::commonapi::communication; + class SubscriptionHandler { public: @@ -65,7 +71,17 @@ public: /* for test purposes, magic value 99 unsubscribes the attribute. */ if (val == 99) { - cancelSubscribe(); + + // We can't call cancleSubscribe() within the async handler + // because it lead to a dead lock with the SomeIP-binding. + // Therefore we unsubscribe within the main thread of the test case! + // + // The reason for the dead lock is because within the async handler + // the connection thread is holding the Connection::sendReceiveMutex_ + // which will locked again when calling Connection::removeEventHandler + // which is implicitly called when unsubscribing! + + // cancelSubscribe(); } } @@ -93,6 +109,10 @@ public: return testAttribute_; } + void resetSubcriptedTestAttribute() { + testAttribute_ = 0; + } + std::deque<uint8_t> myQueue_; private: @@ -138,6 +158,67 @@ private: uint8_t notOkAttribute_; }; +class ThreeCallbackHandler { +public: + ThreeCallbackHandler() : + callbackCounter_1_(0), + callbackCounter_2_(0), + callbackCounter_3_(0), + callbackValue_1_(0), + callbackValue_2_(0), + callbackValue_3_(0) { + + } + + void callback_1(const uint8_t& val) { + callbackCounter_1_++; + callbackValue_1_ = val; + } + + void callback_2(const uint8_t& val) { + callbackCounter_2_++; + callbackValue_2_ = val; + } + + void callback_3(const uint8_t& val) { + callbackCounter_3_++; + callbackValue_3_ = val; + } + + uint8_t getCallbackCounter_1() { + return callbackCounter_1_; + } + + uint8_t getCallbackCounter_2() { + return callbackCounter_2_; + } + + uint8_t getCallbackCounter_3() { + return callbackCounter_3_; + } + + uint8_t getCallbackValue_1() { + return callbackValue_1_; + } + + uint8_t getCallbackValue_2() { + return callbackValue_2_; + } + + uint8_t getCallbackValue_3() { + return callbackValue_3_; + } + +private: + uint8_t callbackCounter_1_; + uint8_t callbackCounter_2_; + uint8_t callbackCounter_3_; + + uint8_t callbackValue_1_; + uint8_t callbackValue_2_; + uint8_t callbackValue_3_; +}; + void testSubscription(ProxyPtr pp) { SubscriptionHandler subscriptionHandler(pp); @@ -169,19 +250,29 @@ protected: runtime_ = CommonAPI::Runtime::get(); ASSERT_TRUE((bool)runtime_); - testProxy_ = runtime_->buildProxy<v1_0::commonapi::communication::TestInterfaceProxy>(domain, testAddress, clientId); + testProxy_ = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress, clientId); ASSERT_TRUE((bool)testProxy_); - testStub_ = std::make_shared<v1_0::commonapi::communication::TestInterfaceStubDefault>(); + testStub_ = std::make_shared<TestInterfaceStubDefault>(); + + deregisterService_ = false; } void TearDown() { + // secure, that service is deregistered by finishing the test + if (deregisterService_) { + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + } } std::shared_ptr<CommonAPI::Runtime> runtime_; - std::shared_ptr<v1_0::commonapi::communication::TestInterfaceProxy<>> testProxy_; - std::shared_ptr<v1_0::commonapi::communication::TestInterfaceStubDefault> testStub_; + std::shared_ptr<TestInterfaceProxy<>> testProxy_; + std::shared_ptr<TestInterfaceStubDefault> testStub_; + + bool deregisterService_; }; class Environment: public ::testing::Environment { @@ -191,12 +282,17 @@ public: } virtual void SetUp() { + stubDaemon_ = std::make_shared<DaemonStubDefault>(); + CommonAPI::Runtime::get()->registerService(domain, daemonAddress, stubDaemon_, daemonId); } virtual void TearDown() { + CommonAPI::Runtime::get()->unregisterService(domain, DaemonStubDefault::StubInterface::getInterface(), + daemonAddress); } private: + std::shared_ptr<DaemonStubDefault> stubDaemon_; }; /** @@ -210,35 +306,58 @@ private: */ TEST_F(CMAttributeSubscription, SubscriptionStandard) { + deregisterService_ = true; + + uint8_t defaultValue = 33; + + // initialize test stub with default value + testStub_->setTestAttributeAttribute(defaultValue); + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); ASSERT_TRUE(serviceRegistered); - for(unsigned int i = 0; !testProxy_->isAvailable() && i < 100; ++i) { - usleep(10000); - } + testProxy_->isAvailableBlocking(); ASSERT_TRUE(testProxy_->isAvailable()); SubscriptionHandler subscriptionHandler(testProxy_); - std::function<void (const uint8_t&)> myCallback = std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1); - //CommonAPI::Event<uint8_t>::Subscription subscribedListener = - testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback); + std::function<void (const uint8_t&)> myCallback = + std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1); + + CommonAPI::Event<uint8_t>::Subscription subscribedListener = + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback); const uint8_t testNumber = 10; for (uint8_t i=1; i<testNumber+1; i++) { - testStub_->setTestAttributeAttribute(i); + usleep(100000); + testStub_->setTestAttributeAttribute(i); } usleep(wt); - ASSERT_EQ(subscriptionHandler.myQueue_.size(), testNumber); + ASSERT_EQ(subscriptionHandler.myQueue_.size(), testNumber + 1); // + 1 due to the reason, that by subscribtion the current value is returned - uint8_t t = 1; + uint8_t t = 0; for(std::deque<uint8_t>::iterator it = subscriptionHandler.myQueue_.begin(); it != subscriptionHandler.myQueue_.end(); ++it) { - EXPECT_EQ(*it, t); - t++; + if (t == 0) { + EXPECT_EQ(*it, defaultValue); + t++; + } else { + EXPECT_EQ(*it, t); + t++; + } } - runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + + testProxy_->getTestAttributeAttribute().getChangedEvent().unsubscribe(subscribedListener); + + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + + usleep(wt); + + deregisterService_ = !isUnregistered; } + /** * @test Subscription test with subscription on available-event. * - Subscribe for available-event. @@ -252,7 +371,8 @@ TEST_F(CMAttributeSubscription, SubscriptionOnAvailable) { SubscriptionHandler subscriptionHandler(testProxy_); - std::function<void (CommonAPI::AvailabilityStatus)> callbackAvailabilityStatus = std::bind(&SubscriptionHandler::receiveServiceAvailable, &subscriptionHandler, std::placeholders::_1); + std::function<void (CommonAPI::AvailabilityStatus)> callbackAvailabilityStatus = + std::bind(&SubscriptionHandler::receiveServiceAvailable, &subscriptionHandler, std::placeholders::_1); testProxy_->getProxyStatusEvent().subscribe(callbackAvailabilityStatus); testStub_->setTestAttributeAttribute(1); @@ -262,11 +382,14 @@ TEST_F(CMAttributeSubscription, SubscriptionOnAvailable) { bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); ASSERT_TRUE(serviceRegistered); usleep(wt); + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); testStub_->setTestAttributeAttribute(2); usleep(wt); ASSERT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 2); - bool serviceUnregistered = runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + bool serviceUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); ASSERT_TRUE(serviceUnregistered); usleep(wt); ASSERT_EQ(subscriptionHandler.getAvailabilityStatus(), CommonAPI::AvailabilityStatus::NOT_AVAILABLE); @@ -307,7 +430,8 @@ TEST_F(CMAttributeSubscription, SubscriptionMultithreading) { usleep(wt); - bool serviceUnregistered = runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + bool serviceUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); ASSERT_TRUE(serviceUnregistered); uint32_t data = 0; @@ -354,15 +478,14 @@ TEST_F(CMAttributeSubscription, SubscriptionUnsubscribeFromCallback) { bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); ASSERT_TRUE(serviceRegistered); - for(unsigned int i = 0; !testProxy_->isAvailable() && i < 100; ++i) { - usleep(10000); - } + testProxy_->isAvailableBlocking(); ASSERT_TRUE(testProxy_->isAvailable()); SubscriptionHandler subscriptionHandler(testProxy_); - std::function<void (const uint8_t&)> myCallback = std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1); - subscriptionHandler.startSubscribe(); + std::function<void (const uint8_t&)> myCallback = std::bind(&SubscriptionHandler::myCallback, + &subscriptionHandler, std::placeholders::_1); + subscriptionHandler.startSubscribe(); testStub_->setTestAttributeAttribute(42); usleep(wt); @@ -372,11 +495,16 @@ TEST_F(CMAttributeSubscription, SubscriptionUnsubscribeFromCallback) { usleep(wt); EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 99); + subscriptionHandler.cancelSubscribe(); + usleep(wt); + testStub_->setTestAttributeAttribute(250); usleep(wt); EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 99); - runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); } /** @@ -395,8 +523,10 @@ TEST_F(CMAttributeSubscription, SubscribeAndUnsubscribeTwoCallbacksCoexistent) { CommonAPI::Event<uint8_t>::Subscription subscribedListenerCallOk; CommonAPI::Event<uint8_t>::Subscription subscribedListenerCallNotOk; - std::function<void (uint8_t)> callbackOk = std::bind(&SubscribeUnsubscribeHandler::okCallback, &subUnsubHandler, std::placeholders::_1); - std::function<void (uint8_t)> callbackNotOk = std::bind(&SubscribeUnsubscribeHandler::notOkCallback, &subUnsubHandler, std::placeholders::_1); + std::function<void (uint8_t)> callbackOk = + std::bind(&SubscribeUnsubscribeHandler::okCallback, &subUnsubHandler, std::placeholders::_1); + std::function<void (uint8_t)> callbackNotOk = + std::bind(&SubscribeUnsubscribeHandler::notOkCallback, &subUnsubHandler, std::placeholders::_1); subscribedListenerCallOk = testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(callbackOk); subscribedListenerCallNotOk = testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(callbackNotOk); @@ -408,7 +538,10 @@ TEST_F(CMAttributeSubscription, SubscribeAndUnsubscribeTwoCallbacksCoexistent) { bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); ASSERT_TRUE(serviceRegistered); - usleep(wt); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); + testStub_->setTestAttributeAttribute(2); usleep(wt); EXPECT_EQ(subUnsubHandler.getSubscribedOkAttribute(), 2); @@ -422,7 +555,7 @@ TEST_F(CMAttributeSubscription, SubscribeAndUnsubscribeTwoCallbacksCoexistent) { EXPECT_EQ(subUnsubHandler.getSubscribedOkAttribute(), 2); EXPECT_EQ(subUnsubHandler.getSubscribedNotOkAttribute(), 2); - bool serviceUnregistered = runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + bool serviceUnregistered = runtime_->unregisterService(domain, TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); ASSERT_TRUE(serviceUnregistered); usleep(wt); } @@ -442,12 +575,16 @@ TEST_F(CMAttributeSubscription, SubscribeAndUnsubscribeImmediatelyUnsubscribing) CommonAPI::Event<uint8_t>::Subscription subscribedListenerCallOk; CommonAPI::Event<uint8_t>::Subscription subscribedListenerCallNotOk; - std::function<void (uint8_t)> callbackOk = std::bind(&SubscribeUnsubscribeHandler::okCallback, &subUnsubHandler, std::placeholders::_1); - std::function<void (uint8_t)> callbackNotOk = std::bind(&SubscribeUnsubscribeHandler::notOkCallback, &subUnsubHandler, std::placeholders::_1); + std::function<void (uint8_t)> callbackOk = + std::bind(&SubscribeUnsubscribeHandler::okCallback, &subUnsubHandler, std::placeholders::_1); + std::function<void (uint8_t)> callbackNotOk = + std::bind(&SubscribeUnsubscribeHandler::notOkCallback, &subUnsubHandler, std::placeholders::_1); bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); ASSERT_TRUE(serviceRegistered); - usleep(wt); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); // subscribe ok callback subscribedListenerCallOk = testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(callbackOk); @@ -470,7 +607,7 @@ TEST_F(CMAttributeSubscription, SubscribeAndUnsubscribeImmediatelyUnsubscribing) testProxy_->getTestAttributeAttribute().getChangedEvent().unsubscribe(subscribedListenerCallNotOk); testProxy_->getTestAttributeAttribute().getChangedEvent().unsubscribe(subscribedListenerCallOk); - bool serviceUnregistered = runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + bool serviceUnregistered = runtime_->unregisterService(domain, TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); ASSERT_TRUE(serviceUnregistered); usleep(wt); } @@ -495,12 +632,16 @@ TEST_F(CMAttributeSubscription, SubscribeAndUnsubscribeSequentially) { CommonAPI::Event<uint8_t>::Subscription subscribedListenerCallOk; CommonAPI::Event<uint8_t>::Subscription subscribedListenerCallNotOk; - std::function<void (uint8_t)> callbackOk = std::bind(&SubscribeUnsubscribeHandler::okCallback, &subUnsubHandler, std::placeholders::_1); - std::function<void (uint8_t)> callbackNotOk = std::bind(&SubscribeUnsubscribeHandler::notOkCallback, &subUnsubHandler, std::placeholders::_1); + std::function<void (uint8_t)> callbackOk = + std::bind(&SubscribeUnsubscribeHandler::okCallback, &subUnsubHandler, std::placeholders::_1); + std::function<void (uint8_t)> callbackNotOk = + std::bind(&SubscribeUnsubscribeHandler::notOkCallback, &subUnsubHandler, std::placeholders::_1); bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); ASSERT_TRUE(serviceRegistered); - usleep(wt); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); // subscribe ok and notOk callback subscribedListenerCallOk = testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(callbackOk); @@ -527,11 +668,451 @@ TEST_F(CMAttributeSubscription, SubscribeAndUnsubscribeSequentially) { EXPECT_EQ(subUnsubHandler.getSubscribedOkAttribute(), 12); EXPECT_EQ(subUnsubHandler.getSubscribedNotOkAttribute(), 14); - bool serviceUnregistered = runtime_->unregisterService(domain, v1_0::commonapi::communication::TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + bool serviceUnregistered = runtime_->unregisterService(domain, TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); ASSERT_TRUE(serviceUnregistered); usleep(wt); } + +/** + * @test Test of behaviour in case unsubscribe is called two times + * - set default value + * - register service + * - subscribe for the attribute + * - current value must be communicated to the proxy + * - value of attribute is changed + * - changed value must be communicated to the proxy + * - proxy unsubscribes for the attribute + * - value of attribute is changed + * - changed value must not be communicated to the proxy + * - proxy unsubscribes again for the attribute + * - value of attribute is changed + * - changed value must not be communicated to the proxy + * - unregister service + */ +TEST_F(CMAttributeSubscription, SubscribeAndUnsubscribeUnsubscribe) { + + testStub_->setTestAttributeAttribute(42); + + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); + + SubscriptionHandler subscriptionHandler(testProxy_); + std::function<void (const uint8_t&)> myCallback = + std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1); + + CommonAPI::Event<uint8_t>::Subscription subscribedListener = + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback); + + usleep(wt); + + // check for initial value + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 42); + + testStub_->setTestAttributeAttribute(12); + usleep(wt); + + // check for changed value + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 12); + + testProxy_->getTestAttributeAttribute().getChangedEvent().unsubscribe(subscribedListener); + + testStub_->setTestAttributeAttribute(24); + usleep(wt); + + // value must not be changed + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 12); + + testProxy_->getTestAttributeAttribute().getChangedEvent().unsubscribe(subscribedListener); + + testStub_->setTestAttributeAttribute(26); + usleep(wt); + + // value must not be changed + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 12); + + bool serviceUnregistered = runtime_->unregisterService(domain, TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(serviceUnregistered); + usleep(wt); +} + +/** + * @test Test of subscribing in case that service is not available + * - set default value + * - subscribe for the attribute + * - no value is communicated to the proxy + * - register service + * - current value must be communicated to the proxy + * - value of attribute is changed + * - changed value must be communicated to the proxy + * - unregister service + */ +TEST_F(CMAttributeSubscription, SubscribeServiceNotAvailable) { + + deregisterService_ = true; + + uint8_t defaultValue = 33; + + // initialize test stub with default value + testStub_->setTestAttributeAttribute(defaultValue); + + // subscribe for attribute change by the proxy + SubscriptionHandler subscriptionHandler(testProxy_); + std::function<void (const uint8_t&)> myCallback = + std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1); + + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback); + + usleep(wt); + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 0); + + // register service + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); + + usleep(wt); + + // check received attribute value + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), defaultValue); + + int8_t newValue = 123; + + testStub_->setTestAttributeAttribute(newValue); + usleep(wt); + + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), newValue); + + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + + deregisterService_ = !isUnregistered; +} + +/** + * @test Test of unregister a service in case a proxy is subscribed for an attribute of this service. + * During the unregistered time of the service the value of the attribute is changed. + * - register service + * - proxy subscribes for an attribute of the service + * - value of attribute is set + * - changed value must be communicated to the proxy + * - unregister service + * - value of attribute is changed + * - changed value must not be communicated to the proxy + * - register service + * - current attribute value must be communicated to the proxy + * - value of attribute is changed + * - changed value must be communicated to the proxy + * - unregister service + */ +TEST_F(CMAttributeSubscription, SubscribeUnregisterSetValueRegisterService) { + deregisterService_ = true; + + uint8_t firstValue = 35; + uint8_t secondValue = 43; + uint8_t thirdValue = 198; + + // register service + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); + + // subscribe for attribute change by the proxy + SubscriptionHandler subscriptionHandler(testProxy_); + std::function<void (const uint8_t&)> myCallback = + std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1); + + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback); + + // initialize test stub with default value + testStub_->setTestAttributeAttribute(firstValue); + usleep(wt); + + // check received attribute value + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), firstValue); + + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + deregisterService_ = !isUnregistered; + + testStub_->setTestAttributeAttribute(secondValue); + usleep(wt); + + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), firstValue); + + // register service + serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + usleep(wt); + + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), secondValue); + + testStub_->setTestAttributeAttribute(thirdValue); + usleep(wt); + + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), thirdValue); + + isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + + deregisterService_ = !isUnregistered; +} + +/** + * @test Test of unregister a service in case a proxy is subscribed for an attribute of this service. + * During the unregistered time of the service the value of the attribute is not changed. + * - register service + * - proxy subscribes for an attribute of the service + * - value of attribute is set + * - changed value must be communicated to the proxy + * - unregister service + * - register service + * - current attribute value must be communicated to the proxy + * - value of attribute is changed + * - changed value must be communicated to the proxy + * - unregister service + */ +TEST_F(CMAttributeSubscription, SubscribeUnregisterNoValueSetRegisterService) { + + deregisterService_ = true; + + uint8_t firstValue = 35; + uint8_t secondValue = 43; + + // register service + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); + + // subscribe for attribute change by the proxy + SubscriptionHandler subscriptionHandler(testProxy_); + std::function<void (const uint8_t&)> myCallback = + std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1); + + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback); + + // initialize test stub with default value + testStub_->setTestAttributeAttribute(firstValue); + usleep(wt); + + // check received attribute value + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), firstValue); + + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + + subscriptionHandler.resetSubcriptedTestAttribute(); + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), 0); + + // register service + serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + usleep(wt); + + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), firstValue); + + testStub_->setTestAttributeAttribute(secondValue); + usleep(wt); + + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), secondValue); + + isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + + deregisterService_ = !isUnregistered; +} + +/** + * @test Test of subscribing a second proxy a little bit later + * - proxy subscribes for an attribute of the service + * - register service + * - initial value must be communicated to the proxy + * - create a second proxy + * - second proxy subscribes for the same attribute of the service + * - current attribute value must be communicated to the proxy + * - value of attribute is changed + * - changed value must be communicated to both proxies + * - unregister service + */ +TEST_F(CMAttributeSubscription, SubscribeSecondProxyLater) { + + deregisterService_ = true; + + uint8_t defaultValue = 33; + + // initialize test stub with default value + testStub_->setTestAttributeAttribute(defaultValue); + + // subscribe for attribute change by the proxy + SubscriptionHandler subscriptionHandler(testProxy_); + std::function<void (const uint8_t&)> myCallback = + std::bind(&SubscriptionHandler::myCallback, &subscriptionHandler, std::placeholders::_1); + + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback); + + // register service + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); + + usleep(wt); + + // check received attribute value + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), defaultValue); + + // create second proxy + std::shared_ptr<TestInterfaceProxy<>> secondTestProxy = + runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress, clientId); + ASSERT_TRUE((bool)secondTestProxy); + + SubscriptionHandler secondSubscriptionHandler(secondTestProxy); + std::function<void (const uint8_t&)> secondMyCallback = + std::bind(&SubscriptionHandler::myCallback, &secondSubscriptionHandler, std::placeholders::_1); + + secondTestProxy->getTestAttributeAttribute().getChangedEvent().subscribe(secondMyCallback); + + usleep(wt); + + EXPECT_EQ(secondSubscriptionHandler.getSubscriptedTestAttribute(), defaultValue); + + int8_t newValue = 123; + + testStub_->setTestAttributeAttribute(newValue); + usleep(wt); + + EXPECT_EQ(subscriptionHandler.getSubscriptedTestAttribute(), newValue); + EXPECT_EQ(secondSubscriptionHandler.getSubscriptedTestAttribute(), newValue); + + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + + deregisterService_ = !isUnregistered; +} + +/** + * @test Test of subscribing three callbacks before registering the service + * - proxy subscribes three callbacks for an attribute of the service + * - register service + * - initial value must be communicated to every callback + */ +TEST_F(CMAttributeSubscription, SubscribeThreeCallbacksServiceNotAvailable) { + + deregisterService_ = true; + + ThreeCallbackHandler threeCallbackHandler; + + uint8_t defaultValue = 33; + + // initialize test stub with default value + testStub_->setTestAttributeAttribute(defaultValue); + + std::function<void (const uint8_t&)> myCallback1 = + std::bind(&ThreeCallbackHandler::callback_1, &threeCallbackHandler, std::placeholders::_1); + std::function<void (const uint8_t&)> myCallback2 = + std::bind(&ThreeCallbackHandler::callback_2, &threeCallbackHandler, std::placeholders::_1); + std::function<void (const uint8_t&)> myCallback3 = + std::bind(&ThreeCallbackHandler::callback_3, &threeCallbackHandler, std::placeholders::_1); + + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback1); + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback2); + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback3); + + usleep(wt); + + // register service + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); + + usleep(100000); + + EXPECT_EQ(1, threeCallbackHandler.getCallbackCounter_1()); + EXPECT_EQ(1, threeCallbackHandler.getCallbackCounter_2()); + EXPECT_EQ(1, threeCallbackHandler.getCallbackCounter_3()); + + EXPECT_EQ(defaultValue, threeCallbackHandler.getCallbackValue_1()); + EXPECT_EQ(defaultValue, threeCallbackHandler.getCallbackValue_2()); + EXPECT_EQ(defaultValue, threeCallbackHandler.getCallbackValue_3()); + + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + + deregisterService_ = !isUnregistered; +} + +/** + * @test Test of subscribing three callbacks after registering the service + * - register service + * - proxy subscribes three callbacks for an attribute of the service + * - initial value must be communicated to every callback + */ +TEST_F(CMAttributeSubscription, SubscribeThreeCallbacksServiceAvailable) { + deregisterService_ = true; + + uint8_t defaultValue = 35; + + ThreeCallbackHandler threeCallbackHandler; + + testStub_->setTestAttributeAttribute(defaultValue); + usleep(wt); + + // register service + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + testProxy_->isAvailableBlocking(); + ASSERT_TRUE(testProxy_->isAvailable()); + + std::function<void (const uint8_t&)> myCallback1 = + std::bind(&ThreeCallbackHandler::callback_1, &threeCallbackHandler, std::placeholders::_1); + std::function<void (const uint8_t&)> myCallback2 = + std::bind(&ThreeCallbackHandler::callback_2, &threeCallbackHandler, std::placeholders::_1); + std::function<void (const uint8_t&)> myCallback3 = + std::bind(&ThreeCallbackHandler::callback_3, &threeCallbackHandler, std::placeholders::_1); + + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback1); + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback2); + testProxy_->getTestAttributeAttribute().getChangedEvent().subscribe(myCallback3); + + usleep(100000); + + EXPECT_EQ(1, threeCallbackHandler.getCallbackCounter_1()); + EXPECT_EQ(1, threeCallbackHandler.getCallbackCounter_2()); + EXPECT_EQ(1, threeCallbackHandler.getCallbackCounter_3()); + + EXPECT_EQ(defaultValue, threeCallbackHandler.getCallbackValue_1()); + EXPECT_EQ(defaultValue, threeCallbackHandler.getCallbackValue_2()); + EXPECT_EQ(defaultValue, threeCallbackHandler.getCallbackValue_3()); + + bool isUnregistered = runtime_->unregisterService(domain, + TestInterfaceStubDefault::StubInterface::getInterface(), testAddress); + ASSERT_TRUE(isUnregistered); + + deregisterService_ = !isUnregistered; +} + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ::testing::AddGlobalTestEnvironment(new Environment()); diff --git a/org.genivi.commonapi.core.verification/src/CMAttributes.cpp b/org.genivi.commonapi.core.verification/src/CMAttributes.cpp index b577770..9556ae4 100644 --- a/org.genivi.commonapi.core.verification/src/CMAttributes.cpp +++ b/org.genivi.commonapi.core.verification/src/CMAttributes.cpp @@ -61,9 +61,9 @@ protected: bool proxyAvailable = false; std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() { + std::lock_guard<std::mutex> lock(availabilityMutex); testProxy_ = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress, clientId); testProxy_->isAvailableBlocking(); - std::lock_guard<std::mutex> lock(availabilityMutex); ASSERT_TRUE((bool)testProxy_); proxyAvailable = true; cv.notify_one(); diff --git a/org.genivi.commonapi.core.verification/src/DTAdvanced.cpp b/org.genivi.commonapi.core.verification/src/DTAdvanced.cpp index 52b6451..acd47d9 100644 --- a/org.genivi.commonapi.core.verification/src/DTAdvanced.cpp +++ b/org.genivi.commonapi.core.verification/src/DTAdvanced.cpp @@ -48,9 +48,9 @@ protected: bool proxyAvailable = false; std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() { + std::lock_guard<std::mutex> lock(availabilityMutex); testProxy_ = runtime_->buildProxy<v1_0::commonapi::datatypes::advanced::TestInterfaceProxy>(domain, testAddress, connectionIdClient); testProxy_->isAvailableBlocking(); - std::lock_guard<std::mutex> lock(availabilityMutex); ASSERT_TRUE((bool)testProxy_); proxyAvailable = true; cv.notify_one(); diff --git a/org.genivi.commonapi.core.verification/src/DTCombined.cpp b/org.genivi.commonapi.core.verification/src/DTCombined.cpp index 08eead6..8780c01 100644 --- a/org.genivi.commonapi.core.verification/src/DTCombined.cpp +++ b/org.genivi.commonapi.core.verification/src/DTCombined.cpp @@ -26,21 +26,6 @@ const std::string connectionIdClient = "client-sample"; using namespace v1_0::commonapi::datatypes::combined; -class DTCombinedStub : public TestInterfaceStubDefault { - -public: - DTCombinedStub() {}; - virtual ~DTCombinedStub() {}; - - void fTest(const std::shared_ptr<CommonAPI::ClientId> clientId, - TestInterface::tStructL3 tStructL3In, - TestInterface::tStructL3& tStructL3Out) { - - tStructL3Out = tStructL3In; - } - -}; - class Environment: public ::testing::Environment { public: virtual ~Environment() { @@ -66,9 +51,9 @@ protected: bool proxyAvailable = false; std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() { + std::lock_guard<std::mutex> lock(availabilityMutex); testProxy_ = runtime_->buildProxy<v1_0::commonapi::datatypes::combined::TestInterfaceProxy>(domain, testAddress, connectionIdClient); testProxy_->isAvailableBlocking(); - std::lock_guard<std::mutex> lock(availabilityMutex); ASSERT_TRUE((bool)testProxy_); proxyAvailable = true; cv.notify_one(); @@ -118,7 +103,7 @@ TEST_F(DTCombined, SendAndReceive) { TestInterface::tUnion unionTV0 = true; TestInterface::tUnion unionTV1 = (uint8_t)42; TestInterface::tUnion unionTV2 = std::string("Hello World"); - TestInterface::tUnion unionTV3 = TestInterface::tEnum::VALUE1; + TestInterface::tUnion unionTV3 = static_cast<TestInterface::tEnum>(TestInterface::tEnum::VALUE1); TestInterface::tMap mapTV0 = {{1, "Hello"}, {2, "World"}}; TestInterface::tMap mapTV1 = {{123, "ABC"}, {456, "DEF"}}; diff --git a/org.genivi.commonapi.core.verification/src/DTDerived.cpp b/org.genivi.commonapi.core.verification/src/DTDerived.cpp index bbb1785..e63159d 100644 --- a/org.genivi.commonapi.core.verification/src/DTDerived.cpp +++ b/org.genivi.commonapi.core.verification/src/DTDerived.cpp @@ -48,9 +48,9 @@ protected: bool proxyAvailable = false; std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() { + std::lock_guard<std::mutex> lock(availabilityMutex); testProxy_ = runtime_->buildProxy<v1_0::commonapi::datatypes::derived::TestInterfaceProxy>(domain, testAddress, connectionId_client); testProxy_->isAvailableBlocking(); - std::lock_guard<std::mutex> lock(availabilityMutex); ASSERT_TRUE((bool)testProxy_); proxyAvailable = true; cv.notify_one(); diff --git a/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp b/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp index 3091b3f..b60f851 100644 --- a/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp +++ b/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp @@ -49,9 +49,9 @@ protected: bool proxyAvailable = false; std::thread t1([this, &proxyAvailable, &cv, &availabilityMutex]() { + std::lock_guard<std::mutex> lock(availabilityMutex); testProxy_ = runtime_->buildProxy<v1_0::commonapi::datatypes::primitive::TestInterfaceProxy>(domain, testAddress, connectionIdClient); testProxy_->isAvailableBlocking(); - std::lock_guard<std::mutex> lock(availabilityMutex); ASSERT_TRUE((bool)testProxy_); proxyAvailable = true; cv.notify_one(); diff --git a/org.genivi.commonapi.core.verification/src/PFComplex.cpp b/org.genivi.commonapi.core.verification/src/PFComplex.cpp index 2730ce1..1393213 100644 --- a/org.genivi.commonapi.core.verification/src/PFComplex.cpp +++ b/org.genivi.commonapi.core.verification/src/PFComplex.cpp @@ -1,7 +1,5 @@ /* Copyright (C) 2014 BMW Group - * Copyright (C) 2015 Mentor Graphics * Author: Juergen Gehring (juergen.gehring@bmw.de) - * Author: Felix Scherzinger (felix_scherzinger@mentor.com) * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp b/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp index ca71952..bc0c6a7 100644 --- a/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp +++ b/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp @@ -1,7 +1,5 @@ /* Copyright (C) 2014 BMW Group - * Copyright (C) 2015 Mentor Graphics * Author: Juergen Gehring (juergen.gehring@bmw.de) - * Author: Felix Scherzinger (felix_scherzinger@mentor.com) * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -114,7 +112,7 @@ protected: * - Using double payload every cycle, starting with 1 end with maxPrimitiveArraySize * - Doing primitiveLoopSize loops to build the mean time */ -TEST_F(PFPrimitive, DISABLED_Ping_Pong_Primitive_Synchronous) { +TEST_F(PFPrimitive, Ping_Pong_Primitive_Synchronous) { CommonAPI::CallStatus callStatus; watch_.reset(); diff --git a/org.genivi.commonapi.core.verification/src/StabilityMP.cpp b/org.genivi.commonapi.core.verification/src/StabilityMP.cpp deleted file mode 100644 index cd19625..0000000 --- a/org.genivi.commonapi.core.verification/src/StabilityMP.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/* stability tests, control program. */ -/* this program takes care of setting up a test and then making sure things happen in proper sequence. */ - -#include <functional> -#include <fstream> -#include <algorithm> -#include <gtest/gtest.h> -#include <CommonAPI/CommonAPI.hpp> -#include "v1_0/commonapi/stability/mp/TestInterfaceProxy.hpp" -#include "v1_0/commonapi/stability/mp/ControlInterfaceProxy.hpp" -#include "stub/StabControlStub.h" -#include "stub/StabilityMPStub.h" - -#ifdef WIN32 -#include <Windows.h> -#else -#include <unistd.h> -#include <sys/wait.h> -#endif - -using namespace v1_0::commonapi::stability::mp; - -const std::string serviceId = "service-sample"; -const std::string clientId = "client-sample"; - -const std::string domain = "local"; -const std::string testAddress = "commonapi.stability.mp.TestInterface"; -const std::string controlAddress = "commonapi.stability.mp.ControlInterface"; -const std::string COMMONAPI_CONFIG_SUFFIX = ".conf"; - -// test magnitude constants - the bigger the numbers, the more stressful the test -const int N_SERVERS = 100; -const int N_THREADS = 100; - -const int MAX_WAIT = 10000; - -const int N_TEST_PROXY_PROCESSES = 3; -const int N_CHILDREN = 2 + 2 * N_TEST_PROXY_PROCESSES; // needs to be large enough to cover for all created processes - -#ifdef WIN32 -HANDLE childpids[N_CHILDREN]; -#else -pid_t childpids[N_CHILDREN]; -#endif - -bool idChild; -bool controlServiceRegistered = false; -std::shared_ptr<CommonAPI::Runtime> runtime_; -std::shared_ptr<CommonAPI::Factory> stubFactory_; -std::shared_ptr<StabControlStub> controlServiceStub_; -class Environment: public :: testing::Environment { -public: - virtual ~Environment() { - } - - virtual void SetUp() { - } - - virtual void TearDown() { - } - -}; - -// server states: -const int WAITING_FOR_CHILDREN = 0; -// commands from child to parent: -const uint32_t QUERY_NEW_ID = 0; -const uint32_t GET_COMMAND = 1; -const uint32_t CMD_DONE = 2; -const uint32_t PROXIES_CONNECTED_OK = 3; -const uint32_t PROXIES_CONNECTED_FAIL = 4; - -// child states: -const int CHILD_SETUP = 1; -const int CHILD_IDLE = 2; -const int CHILD_RESERVED_IDLE = 3; -const int CHILD_PROCESSING_CMD = 4; -const int CONNECTION_STATUS_OK = 5; -const int CONNECTION_STATUS_FAIL = 6; -const int DEAD = 7; - -// commands from parent to child -const uint8_t KEEP_IDLE = 1; -const uint8_t PROXY_CREATE = 2; -const uint8_t WAIT_UNTIL_CONNECTED = 3; -const uint8_t WAIT_UNTIL_DISCONNECTED = 4; -const uint8_t KILL_YOURSELF = 5; -const uint8_t SERVER_CREATE = 6; - -class ControledChild { -public: - uint8_t id; - int state = CHILD_SETUP; - uint8_t next_cmd; -}; - -std::vector<ControledChild *> children; -bool allChildrenRegistered = false; - -bool isFree(ControledChild * pChild) -{ - return (pChild->state == CHILD_IDLE); -} -ControledChild * findFreeChild(void) -{ - std::vector<ControledChild *>::iterator i = std::find_if(children.begin(), children.end(), isFree); - if (i == children.end()) - return 0; - (*i)->state = CHILD_RESERVED_IDLE; - return *i; -} -ControledChild * findChild(uint8_t id) -{ - - std::vector<ControledChild *>::iterator i = children.begin(); - while (i != children.end()) { - if ((*i)->id == id) - return *i; - i++; - } - return 0; -} - -class ProxyThread { -public: - std::shared_ptr<TestInterfaceProxy<>> proxy_[N_SERVERS]; - void createProxies(void) { - // create a proxy for each of the servers - for (unsigned int proxycount = 0; proxycount < N_SERVERS; proxycount++) { - proxy_[proxycount] = runtime_->buildProxy<TestInterfaceProxy>(domain, testAddress + std::to_string(proxycount), clientId); - success_ = success_ && (bool)proxy_[proxycount]; - } - } - void pollForAvailability(void) { - success_ = false; - for (int wait = 0; wait < 100; wait++) { - bool allAvailable = true; - for (unsigned int proxycount = 0; proxycount < N_SERVERS; proxycount++) { - if (!proxy_[proxycount]->isAvailable()) { - allAvailable = false; - break; - } - } - if (allAvailable) { - success_ = true; - break; - } - usleep(20000); - } - } - void pollForUnavailability(void) { - success_ = false; - for (int wait = 0; wait < 100; wait++) { - bool allUnAvailable = true; - for (unsigned int proxycount = 0; proxycount < N_SERVERS; proxycount++) { - if (proxy_[proxycount]->isAvailable()) { - allUnAvailable = false; - break; - } - } - if (allUnAvailable) { - success_ = true; - break; - } - usleep(10000); - } - } - void setThread(std::thread *thread) { - thread_ = thread; - } - std::thread * getThread(void) { - return thread_; - } - bool getSuccess(void) { - return success_; - } - std::thread *thread_ = 0; - bool success_ = true; -}; - -class ChildProcess { -public: - bool setup() - { - runtime_ = CommonAPI::Runtime::get(); - testProxy_ = runtime_->buildProxy<ControlInterfaceProxy>(domain, controlAddress, clientId); - while(!testProxy_->isAvailable()) - usleep(10000); - // send register message through command interface - uint8_t cmd; - uint32_t data1, data2; - bool status = sendMessage(0, QUERY_NEW_ID, cmd, data1, data2); - if (!status) - // problems with communication. - return false; - id = cmd; - state = CHILD_IDLE; - return true; - } - - bool sendMessage(const uint8_t &id, - const uint32_t &data, - uint8_t &command, - uint32_t &data1, - uint32_t &data2 - ) - { - CommonAPI::CallStatus callStatus; - testProxy_->controlMethod(id, data, callStatus, command, data1, data2); - if (callStatus == CommonAPI::CallStatus::SUCCESS) - return true; - // on error, exit - the control service has most likely just died. - exit(1); - return false; - } - - void processCommands() - { - ProxyThread * proxyrunners[N_THREADS]; - while (true) { - switch(state) - { - case CHILD_IDLE: - // send polling message - uint8_t cmd; - uint32_t data1, data2; - bool status = sendMessage(id, GET_COMMAND, cmd, data1, data2); - if (cmd == KEEP_IDLE) { - usleep(10000); - break; - } - if (cmd == PROXY_CREATE) { - // create threads with proxies to test services. - for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) { - proxyrunners[threadcount] = new ProxyThread(); - std::thread * thread = new std::thread(std::bind(&ProxyThread::createProxies, proxyrunners[threadcount])); - proxyrunners[threadcount]->setThread(thread); - } - - // wait until all threads have completed creating the proxies. - for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) { - proxyrunners[threadcount]->getThread()->join(); - delete proxyrunners[threadcount]->getThread(); - proxyrunners[threadcount]->setThread(0); - } - - // once done with all, send CMD_DONE message. - sendMessage(id, CMD_DONE, cmd, data1, data2); - // then start polling again. - state = CHILD_IDLE; - } - else if (cmd == SERVER_CREATE) { - // create services for a number of addresses - std::shared_ptr<StabilityMPStub> testMultiRegisterStub_; - testMultiRegisterStub_ = std::make_shared<StabilityMPStub>(); - for (unsigned int regcount = 0; regcount < N_SERVERS; regcount++) { - bool serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId); - } - - sendMessage(id, CMD_DONE, cmd, data1, data2); - state = CHILD_IDLE; - } - else if (cmd == WAIT_UNTIL_CONNECTED) { - // create threads to test the proxy availability - for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) { - std::thread * thread = new std::thread(std::bind(&ProxyThread::pollForAvailability, proxyrunners[threadcount])); - proxyrunners[threadcount]->setThread(thread); - } - // wait until all threads have completed - for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) { - proxyrunners[threadcount]->getThread()->join(); - delete proxyrunners[threadcount]->getThread(); - proxyrunners[threadcount]->setThread(0); - } - // check for succession status - bool success = true; - for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) { - success = success & proxyrunners[threadcount]->getSuccess(); - } - - // send message with the succession status - if (success) - sendMessage(id, PROXIES_CONNECTED_OK, cmd, data1, data2); - else - sendMessage(id, PROXIES_CONNECTED_FAIL, cmd, data1, data2); - - // then start polling again. - state = CHILD_IDLE; - - } - else if (cmd == WAIT_UNTIL_DISCONNECTED) { - // create threads to test the proxy unavailability - for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) { - std::thread * thread = new std::thread(std::bind(&ProxyThread::pollForUnavailability, proxyrunners[threadcount])); - proxyrunners[threadcount]->setThread(thread); - } - // wait until all threads have completed - for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) { - proxyrunners[threadcount]->getThread()->join(); - delete proxyrunners[threadcount]->getThread(); - proxyrunners[threadcount]->setThread(0); - } - // check for succession status - bool success = true; - for (unsigned int threadcount = 0; threadcount < N_THREADS; threadcount++) { - success = success & proxyrunners[threadcount]->getSuccess(); - } - - // send message with the succession status - if (success) - sendMessage(id, PROXIES_CONNECTED_OK, cmd, data1, data2); - else - sendMessage(id, PROXIES_CONNECTED_FAIL, cmd, data1, data2); - - // then start polling again. - state = CHILD_IDLE; - - } - else if (cmd == KILL_YOURSELF) { - exit(0); - } - - } - } - return; - } - - - std::shared_ptr<ControlInterfaceProxy<>> testProxy_; - - uint8_t id = 0; - int state = CHILD_SETUP; -}; - -int state = WAITING_FOR_CHILDREN; -static int8_t next_id = 1; - -void listener(uint8_t id,uint32_t data, uint8_t& command, uint32_t& min, uint32_t &max) { - command = 0; - min = 0; - max = 0; - switch(data) { - case QUERY_NEW_ID: - { - // create a child data structure - ControledChild * child = new ControledChild(); - - // add this to the structure - child->id = next_id; - // increment id - next_id++; - child->state = CHILD_IDLE; - // prepare to return id to child - command = child->id; - children.push_back(child); - child->next_cmd = KEEP_IDLE; - } - if (children.size() == N_CHILDREN) - allChildrenRegistered = true; - break; - - case GET_COMMAND: - { - // find the child with this id - ControledChild * child = findChild(id); - ASSERT_TRUE((bool)child); - uint8_t cmd = child->next_cmd; - if (cmd != KEEP_IDLE) { - child->next_cmd = KEEP_IDLE; - child->state = CHILD_PROCESSING_CMD; - } - command = cmd; - } - break; - - case CMD_DONE: - { - // find the child with this id - ControledChild * child = findChild(id); - ASSERT_TRUE((bool)child); - child->state = CHILD_RESERVED_IDLE; - } - break; - - case PROXIES_CONNECTED_OK: - { - // find the child with this id - ControledChild * child = findChild(id); - ASSERT_TRUE((bool)child); - child->state = CONNECTION_STATUS_OK; - } - break; - - case PROXIES_CONNECTED_FAIL: - { - // find the child with this id - ControledChild * child = findChild(id); - ASSERT_TRUE((bool)child); - child->state = CONNECTION_STATUS_FAIL; - } - break; - } -} - - -/* this class is instantiated only for the control process. */ -class Stability: public ::testing::Test { -protected: - void SetUp() { - - } - - void TearDown() { - - } -}; - -TEST_F(Stability, BasicFunctionality) { - ASSERT_TRUE(allChildrenRegistered); -} - - -TEST_F(Stability, ProxyCreation_ProxyFirst) { - /* - DO for N child processes - get free child entry (proxy process) - setup 'proxy c' command - wait until child proc is in 'CMD DONE' - END - get free child entry (server) - setup 'server c' command - wait until server is in 'CMD DONE' - DO for N proxy processes - setup 'query status' c - wait until child proc is in 'CMD DONE' - assert child proc status is okay - END - setup 'kill' command to server - wait until server is in 'CMD SENT' - DO for N proxy processes - setup 'query status' cmd - wait until child proc is in 'CMD DONE' - assert child proc status is okay - setup 'kill' to child - wait until child proc is in CMD SENT - END - */ - ControledChild * proxyprocs[N_TEST_PROXY_PROCESSES]; - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = findFreeChild(); - ASSERT_TRUE((bool)child); - proxyprocs[i] = child; - child->state = CHILD_PROCESSING_CMD; - child->next_cmd = PROXY_CREATE; - } - // wait until children are ready for more commands - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - for (int wait = 0; wait < MAX_WAIT; wait++) { - if (child->state == CHILD_RESERVED_IDLE) { - break; - } - usleep(100000); - } - ASSERT_TRUE(child->state == CHILD_RESERVED_IDLE); - } - // setup server test proc - ControledChild * srvChild = findFreeChild(); - ASSERT_TRUE((bool)srvChild); - srvChild->state = CHILD_PROCESSING_CMD; - srvChild->next_cmd = SERVER_CREATE; - for (int wait = 0; wait < MAX_WAIT; wait++) { - if (srvChild->state == CHILD_RESERVED_IDLE) { - break; - } - usleep(100000); - } - ASSERT_TRUE(srvChild->state == CHILD_RESERVED_IDLE); - // send proxy status query messages - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - child->state = CHILD_PROCESSING_CMD; - child->next_cmd = WAIT_UNTIL_CONNECTED; - } - // wait until children return connection status - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - for (int wait = 0; wait < MAX_WAIT; wait++) { - if (child->state == CONNECTION_STATUS_OK) { - break; - } - if (child->state == CONNECTION_STATUS_FAIL) { - break; - } - usleep(100000); - } - ASSERT_TRUE(child->state == CONNECTION_STATUS_OK); - } - // kill server - srvChild->next_cmd = KILL_YOURSELF; - srvChild->state = DEAD; - // send proxy status query messages - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - child->next_cmd = WAIT_UNTIL_DISCONNECTED; - } - // wait until children return connection status - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - for (int wait = 0; wait < MAX_WAIT; wait++) { - if (child->state == CONNECTION_STATUS_OK) { - break; - } - if (child->state == CONNECTION_STATUS_FAIL) { - break; - } - usleep(100000); - } - ASSERT_TRUE(child->state == CONNECTION_STATUS_OK); - } - // kill children - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - child->next_cmd = KILL_YOURSELF; - child->state = DEAD; - } - - usleep(1 * 1000 * 1000); -} - -TEST_F(Stability, ProxyCreation_ServerFirst) { - - ControledChild * proxyprocs[N_TEST_PROXY_PROCESSES]; - - // setup server test proc - ControledChild * srvChild = findFreeChild(); - ASSERT_TRUE((bool)srvChild); - srvChild->state = CHILD_PROCESSING_CMD; - srvChild->next_cmd = SERVER_CREATE; - for (int wait = 0; wait < MAX_WAIT; wait++) { - if (srvChild->state == CHILD_RESERVED_IDLE) { - break; - } - usleep(100000); - } - ASSERT_TRUE(srvChild->state == CHILD_RESERVED_IDLE); - - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = findFreeChild(); - ASSERT_TRUE((bool)child); - proxyprocs[i] = child; - child->state = CHILD_PROCESSING_CMD; - child->next_cmd = PROXY_CREATE; - } - // wait until children are ready for more commands - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - for (int wait = 0; wait < MAX_WAIT; wait++) { - if (child->state == CHILD_RESERVED_IDLE) { - break; - } - usleep(100000); - } - ASSERT_TRUE(child->state == CHILD_RESERVED_IDLE); - } - - // send proxy status query messages - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - child->state = CHILD_PROCESSING_CMD; - child->next_cmd = WAIT_UNTIL_CONNECTED; - } - // wait until children return connection status - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - for (int wait = 0; wait < MAX_WAIT; wait++) { - if (child->state == CONNECTION_STATUS_OK) { - break; - } - if (child->state == CONNECTION_STATUS_FAIL) { - break; - } - usleep(100000); - } - ASSERT_TRUE(child->state == CONNECTION_STATUS_OK); - } - // kill server - srvChild->next_cmd = KILL_YOURSELF; - srvChild->state = DEAD; - // send proxy status query messages - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - child->next_cmd = WAIT_UNTIL_DISCONNECTED; - } - // wait until children return connection status - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - for (int wait = 0; wait < MAX_WAIT; wait++) { - if (child->state == CONNECTION_STATUS_OK) { - break; - } - if (child->state == CONNECTION_STATUS_FAIL) { - break; - } - usleep(100000); - } - ASSERT_TRUE(child->state == CONNECTION_STATUS_OK); - } - // kill children - for (int i = 0; i < N_TEST_PROXY_PROCESSES; i++) { - ControledChild * child = proxyprocs[i]; - child->next_cmd = KILL_YOURSELF; - child->state = DEAD; - } - - usleep(1 * 1000 * 1000); -} - -int main(int argc, char ** argv) -{ - /* create the necessary child processes */ - /* forking is best done before the google test environment is set up */ - bool isChild = false; - for (int i = 0; i < N_CHILDREN; i++) { -#ifdef WIN32 - // TODO!!! - HANDLE child = 0; -#else - pid_t child = fork(); -#endif - if (child == 0) { - isChild = true; - break; - } - childpids[i] = child; - } - - /* if we are not a child, set up test environment */ - if (!isChild) { - // do this just once - runtime_ = CommonAPI::Runtime::get(); - // register control service - StabControlStub::registerListener(&listener); - controlServiceStub_ = std::make_shared<StabControlStub>(); - controlServiceRegistered = runtime_->registerService(domain, controlAddress, controlServiceStub_, serviceId); - std::cout << "Control service registered at " << controlAddress << std::endl; - - // wait until children have been registered - while (!allChildrenRegistered) { - usleep(10000); - } - ::testing::InitGoogleTest(&argc, argv); - ::testing::AddGlobalTestEnvironment(new Environment()); - return RUN_ALL_TESTS(); - } - /* otherwise, start acting as a child process */ - ChildProcess child; - child.setup(); - child.processCommands(); - - /* TBD */ - - return 0; -} - - diff --git a/org.genivi.commonapi.core.verification/src/StabilitySP.cpp b/org.genivi.commonapi.core.verification/src/StabilitySP.cpp index 3a1b42e..d98d5b6 100644 --- a/org.genivi.commonapi.core.verification/src/StabilitySP.cpp +++ b/org.genivi.commonapi.core.verification/src/StabilitySP.cpp @@ -1,5 +1,4 @@ /* Copyright (C) 2015 BMW Group - * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com) * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -105,6 +104,7 @@ public: std::shared_ptr<TestInterfaceProxy<>> proxy_[MAXSERVERCOUNT]; // callback for asynchronous attribute functions. void recvValue(const CommonAPI::CallStatus& callStatus, TestInterface::tArray arrayResultValue) { + std::lock_guard<std::mutex> lock(recvValue_mutex_); EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); asyncCounter++; @@ -114,13 +114,27 @@ public: for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) { arrayTestValue.push_back((unsigned char)(messageindex & 0xFF)); } + arrayTestValue.shrink_to_fit(); EXPECT_EQ(arrayTestValue, arrayResultValue); - - } + ASSERT_EQ(arrayTestValue.size(), arrayResultValue.size()) << "Vectors arrayTestValue and arrayResultValue are of unequal length"; + if(arrayTestValue.size() == arrayResultValue.size()) { + for (std::uint32_t i = 0; i < arrayTestValue.size(); ++i) { + EXPECT_EQ(arrayTestValue[i], arrayResultValue[i]) << "Vectors arrayTestValue and arrayResultValue differ at index " << i; + } + } + } // callback for attribute subscriptions. void recvSubscribedValue(TestInterface::tArray arrayResultValue) { + std::lock_guard<std::mutex> lock(recvSubscribedValue_mutex_); + + // The following may happen because of the initial response + if (arrayResultValue.size() == 0) + return; + asyncCounter++; +// std::cout << "asyncCounter<" << this << ">: " << asyncCounter << std::endl; + TestInterface::tArray arrayTestValue; // check the contents of the attribute. @@ -130,7 +144,15 @@ public: arrayTestValue.push_back((unsigned char)(messageindex & 0xFF)); } + arrayTestValue.shrink_to_fit(); + EXPECT_EQ(arrayTestValue, arrayResultValue); + ASSERT_EQ(arrayTestValue.size(), arrayResultValue.size()) << "Vectors arrayTestValue and arrayResultValue are of unequal length"; + if(arrayTestValue.size() == arrayResultValue.size()) { + for (std::uint32_t i = 0; i < arrayTestValue.size(); ++i) { + EXPECT_EQ(arrayTestValue[i], arrayResultValue[i]) << "Vectors arrayTestValue and arrayResultValue differ at index " << i; + } + } } // helper function for creating proxies. @@ -146,6 +168,10 @@ public: for (unsigned int wait = 0; !proxy_[proxycount]->isAvailable() && wait < 100; ++wait) { usleep(10000); } + + if (!proxy_[proxycount]->isAvailable()) + std::cout << testAddress + std::to_string(proxycount) << std::endl; + ASSERT_TRUE(proxy_[proxycount]->isAvailable()); } } @@ -185,7 +211,7 @@ public: if (previousCount != asyncCounter) { break; } - usleep(10 * 1000); + usleep(10000); } if (previousCount == asyncCounter) { break; @@ -196,7 +222,6 @@ public: } void runSetSubscribedAttributes(unsigned int id) { - unsigned char message1 = id; unsigned char message2 = message1 + MAXTHREADCOUNT; unsigned char message = message1; @@ -295,6 +320,7 @@ public: bool exerciseSetSubscribedAttribute(std::shared_ptr<TestInterfaceProxy<>> proxy, unsigned char message_number) { TestInterface::tArray arrayTestValue; TestInterface::tArray arrayResultValue; + arrayTestValue.push_back(message_number); for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) { arrayTestValue.push_back((unsigned char)(messageindex & 0xFF)); @@ -328,7 +354,7 @@ public: std::bind(&ProxyThread::recvValue, this, std::placeholders::_1, std::placeholders::_2); CommonAPI::CallStatus callStatus; - CommonAPI::CallInfo* callInfo = new CommonAPI::CallInfo(30 * 1000); + CommonAPI::CallInfo* callInfo = new CommonAPI::CallInfo(50 * 1000); proxy->getTestAttributeAttribute().getValueAsync(myCallback, callInfo); return true; @@ -342,7 +368,7 @@ public: arrayTestValue.push_back((unsigned char)(messageindex & 0xFF)); } - CommonAPI::CallInfo* callInfo = new CommonAPI::CallInfo(45 * 1000); + CommonAPI::CallInfo* callInfo = new CommonAPI::CallInfo(100 * 1000); proxy->getTestAttributeAttribute().setValueAsync(arrayTestValue, myCallback, callInfo); return true; @@ -350,6 +376,8 @@ public: std::thread *thread_ = 0; bool success_ = true; + std::mutex recvValue_mutex_; + std::mutex recvSubscribedValue_mutex_; }; /** * @test Create a number of services and proxies and send messages through them. @@ -370,17 +398,20 @@ TEST_F(StabilitySP, MultipleMethodCalls) { serviceRegistered_ = runtime_->registerService(domain, testAddress + std::to_string( regcount ), testMultiRegisterStub_, serviceId); ASSERT_TRUE(serviceRegistered_); } + ProxyThread * proxyrunners[MAXTHREADCOUNT]; for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) { proxyrunners[threadcount] = new ProxyThread(); std::thread * thread = new std::thread(std::bind(&ProxyThread::runMethodCalls, proxyrunners[threadcount])); proxyrunners[threadcount]->setThread(thread); } + for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) { proxyrunners[threadcount]->getThread()->join(); delete proxyrunners[threadcount]->getThread(); proxyrunners[threadcount]->setThread(0); } + for (unsigned int regcount = 0; regcount < MAXSERVERCOUNT; regcount++) { serviceRegistered_ = runtime_->unregisterService(domain, StabilitySPStub::StubInterface::getInterface(), testAddress + std::to_string( regcount )); ASSERT_TRUE(serviceRegistered_); @@ -576,9 +607,9 @@ TEST_F(StabilitySP, MultipleAttributeSubscriptions) { ASSERT_TRUE(serviceRegistered_); } TestInterface::tArray arrayTestValue; - + arrayTestValue.push_back(0); for (unsigned int messageindex = 0; messageindex < MESSAGESIZE; messageindex++) { - arrayTestValue.push_back((unsigned char)(messageindex & 0xFF)); + arrayTestValue.push_back((unsigned char)(messageindex & 0xFF)); } testMultiRegisterStub_->setTestValues(arrayTestValue); @@ -594,10 +625,16 @@ TEST_F(StabilitySP, MultipleAttributeSubscriptions) { proxyrunners[threadcount]->setThread(0); } + arrayTestValue.clear(); + testMultiRegisterStub_->setTestValues(arrayTestValue); // sleep here a while to let the subscriptions sink in usleep(100000); for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) { + proxyrunners[threadcount]->asyncCounter = 0; + } + + for (unsigned int threadcount = 0; threadcount < MAXTHREADCOUNT; threadcount++) { std::thread * thread = new std::thread(std::bind(&ProxyThread::runSetSubscribedAttributes, proxyrunners[threadcount], threadcount)); proxyrunners[threadcount]->setThread(thread); } @@ -617,5 +654,3 @@ int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(new Environment()); return RUN_ALL_TESTS(); } - - diff --git a/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp b/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp index db221c5..8e9c167 100644 --- a/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp +++ b/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp @@ -143,9 +143,15 @@ protected: mainLoopThread1_ = std::thread([&]() { threadCtx1_.mainLoop_->run(); }); mainLoopThread2_ = std::thread([&]() { threadCtx2_.mainLoop_->run(); }); - usleep(200000); + for (unsigned int i = 0; !threadCtx1_.proxy_->isAvailable() && i < 100; ++i) { + usleep(10000); + } - ASSERT_TRUE(threadCtx1_.proxy_->isAvailable()); + for (unsigned int i = 0; !threadCtx2_.proxy_->isAvailable() && i < 100; ++i) { + usleep(10000); + } + + ASSERT_TRUE(threadCtx1_.proxy_->isAvailable()); ASSERT_TRUE(threadCtx2_.proxy_->isAvailable()); if (threadCtx1_.mainLoop_->isRunning()) { @@ -165,17 +171,14 @@ protected: threadCtx1_.runtime_->unregisterService(domain, PingPongTestStub::StubInterface::getInterface(), instance6); threadCtx1_.runtime_->unregisterService(domain, PingPongTestStub::StubInterface::getInterface(), instance7); threadCtx2_.runtime_->unregisterService(domain, PingPongTestStub::StubInterface::getInterface(), instance8); - usleep(2000); - threadCtx1_.mainLoop_->stop(); - threadCtx2_.mainLoop_->stop(); if (threadCtx1_.mainLoop_->isRunning()) { std::future<bool> threadCtx1MainStopped = threadCtx1_.mainLoop_->stop(); - threadCtx1MainStopped.get(); + //threadCtx1MainStopped.get(); } if (threadCtx2_.mainLoop_->isRunning()) { std::future<bool> threadCtx2MainStopped = threadCtx2_.mainLoop_->stop(); - threadCtx2MainStopped.get(); + //threadCtx2MainStopped.get(); } if(mainLoopThread1_.joinable()) { @@ -184,6 +187,8 @@ protected: if(mainLoopThread2_.joinable()) { mainLoopThread2_.join(); } + + usleep(20000); } MainLoopThreadContext threadCtx1_, threadCtx2_; @@ -231,9 +236,6 @@ TEST_F(THMainLoopIndependence, ProxyReceivesAnswerOnlyIfStubMainLoopRuns) { * - now each proxy should have received the answer to his own request */ TEST_F(THMainLoopIndependence, ProxyReceivesJustHisOwnAnswers) { - - usleep(1000000); - std::shared_ptr<PingPongTestStub> stubThirdParty = std::make_shared<PingPongTestStub>(); auto runtime = CommonAPI::Runtime::get(); ASSERT_TRUE(runtime->registerService(domain, instance6, stubThirdParty, thirdPartyServiceId)); diff --git a/org.genivi.commonapi.core.verification/src/THMainLoopTwoThreads.cpp b/org.genivi.commonapi.core.verification/src/THMainLoopTwoThreads.cpp new file mode 100644 index 0000000..e7158bd --- /dev/null +++ b/org.genivi.commonapi.core.verification/src/THMainLoopTwoThreads.cpp @@ -0,0 +1,134 @@ +/* Copyright (C) 2014 - 2015 BMW Group + * Author: Andrei Yagoubov + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** +* @file Threading +*/ + +#include <gtest/gtest.h> +#include "CommonAPI/CommonAPI.hpp" +#include "utils/VerificationMainLoopWithQueue.h" +#include "v1_0/commonapi/threading/TestInterfaceProxy.hpp" +#include "v1_0/commonapi/threading/TestInterfaceStubDefault.hpp" + +const std::string domain = "local"; +const std::string instance = "my.test.commonapi.address"; + +class PingPongTestStub : public v1_0::commonapi::threading::TestInterfaceStubDefault { + virtual void testMethod(const std::shared_ptr<CommonAPI::ClientId> _client, + uint8_t _x, + testMethodReply_t _reply) { + + _reply(_x); + } +}; + +class THMainLoopTwoThreads: public ::testing::Test { +protected: + void SetUp() { + runtime_ = CommonAPI::Runtime::get(); + ASSERT_TRUE((bool)runtime_); + + context_ = std::make_shared<CommonAPI::MainLoopContext>("client-sample"); + ASSERT_TRUE((bool)context_); + + eventQueue_ = std::make_shared<CommonAPI::VerificationMainLoopEventQueue>(); + mainLoop_ = new CommonAPI::VerificationMainLoop(context_, eventQueue_); + + stub_ = std::make_shared<PingPongTestStub>(); + + bool stubRegistered = runtime_->registerService(domain, instance, stub_, "service-sample"); + ASSERT_TRUE((bool)stubRegistered); + + proxy_ = runtime_->buildProxy<v1_0::commonapi::threading::TestInterfaceProxy>(domain, instance, context_); + ASSERT_TRUE((bool)proxy_); + + eventQueueThread_ = new std::thread([&]() { eventQueue_->run(); }); + mainLoopThread_ = new std::thread([&]() { mainLoop_->run(); }); + } + + void TearDown() { + runtime_->unregisterService(domain, stub_->getStubAdapter()->getInterface(), instance); + mainLoop_->stop(); + //mainLoopThread_->join(); + + usleep(1000000); + } + + std::shared_ptr<CommonAPI::Runtime> runtime_; + std::shared_ptr<CommonAPI::MainLoopContext> context_; + std::shared_ptr<CommonAPI::VerificationMainLoopEventQueue> eventQueue_; + + std::shared_ptr<PingPongTestStub> stub_; + std::shared_ptr<v1_0::commonapi::threading::TestInterfaceProxy<>> proxy_; + + CommonAPI::VerificationMainLoop* mainLoop_; + + std::thread* eventQueueThread_; + std::thread* mainLoopThread_; +}; + +/** +* @test Proxy Receives Available when MainLoop Dispatched sourced out to other thread. +*/ +TEST_F(THMainLoopTwoThreads, ProxyGetsAvailableStatus) { + std::condition_variable available; + std::mutex m; + bool isAvailable(false); + + proxy_->getProxyStatusEvent().subscribe([&](const CommonAPI::AvailabilityStatus& val) { + if (val == CommonAPI::AvailabilityStatus::AVAILABLE) { + isAvailable = true; + available.notify_one(); + } + }); + + if (!isAvailable) { + std::unique_lock<std::mutex> uniqueLock(m); + available.wait_for(uniqueLock, std::chrono::seconds(10)); + } + + ASSERT_TRUE(proxy_->isAvailable()); +} + +/** +* @test Proxy gets function response when MainLoop Dispatched sourced out to other thread. +*/ +TEST_F(THMainLoopTwoThreads, ProxyGetsFunctionResponse) { + std::condition_variable available; + std::mutex m; + bool isAvailable(false); + + proxy_->getProxyStatusEvent().subscribe([&](const CommonAPI::AvailabilityStatus& val) { + if (val == CommonAPI::AvailabilityStatus::AVAILABLE) { + isAvailable = true; + available.notify_one(); + } + }); + + if (!isAvailable) { + std::unique_lock<std::mutex> uniqueLock(m); + available.wait_for(uniqueLock, std::chrono::seconds(10)); + } + + ASSERT_TRUE(proxy_->isAvailable()); + + CommonAPI::CallStatus callStatus; + + uint8_t x, y; + x = 1; + y = 0; + + proxy_->testMethod(x, callStatus, y); + + ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, callStatus); + ASSERT_EQ(1, y); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/org.genivi.commonapi.core.verification/src/conf/commonapi4dbus.ini.in b/org.genivi.commonapi.core.verification/src/conf/commonapi4dbus.ini.in index fb35209..f03d53f 100644 --- a/org.genivi.commonapi.core.verification/src/conf/commonapi4dbus.ini.in +++ b/org.genivi.commonapi.core.verification/src/conf/commonapi4dbus.ini.in @@ -21,7 +21,149 @@ local:commonapi.threading.TestInterface:my.test.commonapi.address.seven=@GLUECOD local:commonapi.threading.TestInterface:my.test.commonapi.address.eight=@GLUECODE_SO_DBUS@ local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface0=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface1=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface2=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface3=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface4=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface5=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface6=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface7=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface8=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface9=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface10=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface11=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface12=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface13=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface14=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface15=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface16=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface17=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface18=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface19=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface20=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface21=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface22=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface23=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface24=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface25=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface26=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface27=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface28=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface29=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface30=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface31=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface32=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface33=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface34=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface35=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface36=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface37=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface38=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface39=@GLUECODE_SO_DBUS@ + local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface0=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface1=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface2=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface3=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface4=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface5=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface6=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface7=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface8=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface9=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface10=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface11=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface12=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface13=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface14=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface15=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface16=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface17=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface18=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface19=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface20=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface21=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface22=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface23=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface24=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface25=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface26=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface27=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface28=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface29=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface30=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface31=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface32=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface33=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface34=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface35=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface36=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface37=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface38=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface39=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface40=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface41=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface42=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface43=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface44=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface45=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface46=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface47=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface48=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface49=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface50=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface51=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface52=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface53=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface54=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface55=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface56=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface57=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface58=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface59=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface60=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface61=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface62=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface63=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface64=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface65=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface66=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface67=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface68=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface69=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface70=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface71=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface72=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface73=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface74=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface75=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface76=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface77=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface78=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface79=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface80=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface81=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface82=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface83=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface84=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface85=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface86=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface87=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface88=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface89=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface90=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface91=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface92=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface93=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface94=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface95=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface96=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface97=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface98=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface99=@GLUECODE_SO_DBUS@ + local:commonapi.stability.mp.ControlInterface:commonapi.stability.mp.ControlInterface=@GLUECODE_SO_DBUS@ [stub] @@ -34,11 +176,155 @@ local:commonapi.datatypes.combined.TestInterface:commonapi.datatypes.combined.Te local:commonapi.performance.primitive.TestInterface:commonapi.performance.primitive.TestInterface=@GLUECODE_SO_DBUS@ local:commonapi.performance.complex.TestInterface:commonapi.performance.complex.TestInterface=@GLUECODE_SO_DBUS@ +local:commonapi.communication.Daemon:commonapi.communication.Daemon=@GLUECODE_SO_DBUS@ + local:commonapi.threading.TestInterface:my.test.commonapi.address=@GLUECODE_SO_DBUS@ local:commonapi.threading.TestInterface:my.test.commonapi.address.six=@GLUECODE_SO_DBUS@ local:commonapi.threading.TestInterface:my.test.commonapi.address.seven=@GLUECODE_SO_DBUS@ local:commonapi.threading.TestInterface:my.test.commonapi.address.eight=@GLUECODE_SO_DBUS@ local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface0=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface1=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface2=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface3=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface4=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface5=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface6=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface7=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface8=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface9=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface10=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface11=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface12=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface13=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface14=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface15=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface16=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface17=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface18=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface19=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface20=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface21=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface22=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface23=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface24=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface25=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface26=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface27=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface28=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface29=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface30=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface31=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface32=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface33=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface34=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface35=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface36=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface37=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface38=@GLUECODE_SO_DBUS@ +local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface39=@GLUECODE_SO_DBUS@ + local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface0=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface1=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface2=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface3=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface4=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface5=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface6=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface7=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface8=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface9=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface10=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface11=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface12=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface13=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface14=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface15=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface16=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface17=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface18=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface19=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface20=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface21=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface22=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface23=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface24=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface25=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface26=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface27=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface28=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface29=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface30=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface31=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface32=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface33=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface34=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface35=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface36=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface37=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface38=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface39=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface40=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface41=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface42=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface43=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface44=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface45=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface46=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface47=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface48=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface49=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface50=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface51=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface52=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface53=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface54=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface55=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface56=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface57=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface58=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface59=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface60=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface61=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface62=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface63=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface64=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface65=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface66=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface67=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface68=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface69=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface70=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface71=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface72=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface73=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface74=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface75=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface76=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface77=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface78=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface79=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface80=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface81=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface82=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface83=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface84=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface85=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface86=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface87=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface88=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface89=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface90=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface91=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface92=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface93=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface94=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface95=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface96=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface97=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface98=@GLUECODE_SO_DBUS@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface99=@GLUECODE_SO_DBUS@ + local:commonapi.stability.mp.ControlInterface:commonapi.stability.mp.ControlInterface=@GLUECODE_SO_DBUS@ diff --git a/org.genivi.commonapi.core.verification/src/conf/commonapi4someip.ini.in b/org.genivi.commonapi.core.verification/src/conf/commonapi4someip.ini.in index 7bc55f8..554e1f8 100644 --- a/org.genivi.commonapi.core.verification/src/conf/commonapi4someip.ini.in +++ b/org.genivi.commonapi.core.verification/src/conf/commonapi4someip.ini.in @@ -57,12 +57,115 @@ local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface3 local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface37=@GLUECODE_SO_SOMEIP@ local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface38=@GLUECODE_SO_SOMEIP@ local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface39=@GLUECODE_SO_SOMEIP@ + local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface0=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface1=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface2=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface3=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface4=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface5=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface6=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface7=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface8=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface9=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface10=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface11=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface12=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface13=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface14=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface15=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface16=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface17=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface18=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface19=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface20=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface21=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface22=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface23=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface24=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface25=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface26=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface27=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface28=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface29=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface30=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface31=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface32=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface33=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface34=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface35=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface36=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface37=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface38=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface39=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface40=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface41=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface42=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface43=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface44=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface45=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface46=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface47=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface48=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface49=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface50=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface51=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface52=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface53=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface54=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface55=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface56=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface57=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface58=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface59=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface60=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface61=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface62=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface63=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface64=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface65=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface66=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface67=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface68=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface69=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface70=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface71=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface72=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface73=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface74=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface75=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface76=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface77=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface78=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface79=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface80=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface81=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface82=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface83=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface84=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface85=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface86=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface87=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface88=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface89=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface90=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface91=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface92=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface93=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface94=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface95=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface96=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface97=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface98=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface99=@GLUECODE_SO_SOMEIP@ + local:commonapi.stability.mp.ControlInterface:commonapi.stability.mp.ControlInterface=@GLUECODE_SO_SOMEIP@ [stub] local:commonapi.runtime.TestInterface:commonapi.runtime.TestInterface=@GLUECODE_SO_SOMEIP@ local:commonapi.communication.TestInterface:commonapi.communication.TestInterface=@GLUECODE_SO_SOMEIP@ +local:commonapi.communication.Daemon:commonapi.communication.Daemon=@GLUECODE_SO_SOMEIP@ local:commonapi.datatypes.primitive.TestInterface:commonapi.datatypes.primitive.TestInterface=@GLUECODE_SO_SOMEIP@ local:commonapi.datatypes.advanced.TestInterface:commonapi.datatypes.advanced.TestInterface=@GLUECODE_SO_SOMEIP@ local:commonapi.datatypes.derived.TestInterface:commonapi.datatypes.derived.TestInterface=@GLUECODE_SO_SOMEIP@ @@ -118,4 +221,105 @@ local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface3 local:commonapi.stability.sp.TestInterface:commonapi.stability.sp.TestInterface39=@GLUECODE_SO_SOMEIP@ local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface0=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface1=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface2=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface3=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface4=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface5=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface6=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface7=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface8=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface9=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface10=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface11=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface12=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface13=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface14=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface15=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface16=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface17=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface18=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface19=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface20=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface21=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface22=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface23=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface24=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface25=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface26=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface27=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface28=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface29=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface30=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface31=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface32=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface33=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface34=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface35=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface36=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface37=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface38=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface39=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface40=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface41=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface42=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface43=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface44=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface45=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface46=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface47=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface48=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface49=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface50=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface51=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface52=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface53=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface54=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface55=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface56=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface57=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface58=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface59=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface60=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface61=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface62=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface63=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface64=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface65=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface66=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface67=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface68=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface69=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface70=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface71=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface72=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface73=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface74=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface75=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface76=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface77=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface78=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface79=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface80=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface81=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface82=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface83=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface84=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface85=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface86=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface87=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface88=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface89=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface90=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface91=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface92=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface93=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface94=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface95=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface96=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface97=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface98=@GLUECODE_SO_SOMEIP@ +local:commonapi.stability.mp.TestInterface:commonapi.stability.mp.TestInterface99=@GLUECODE_SO_SOMEIP@ + local:commonapi.stability.mp.ControlInterface:commonapi.stability.mp.ControlInterface=@GLUECODE_SO_SOMEIP@ diff --git a/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.cpp b/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.cpp index 9a4e64d..fa70170 100644 --- a/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.cpp +++ b/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.cpp @@ -1,5 +1,4 @@ -/* Copyright (C) 2015 Mentor Graphics - * Author: Felix Scherzinger (felix_scherzinger@mentor.com) +/* Copyright (C) 2015 BMW Group * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.h b/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.h index e261911..626b975 100644 --- a/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.h +++ b/org.genivi.commonapi.core.verification/src/stub/PFComplexStub.h @@ -1,5 +1,4 @@ -/* Copyright (C) 2015 Mentor Graphics - * Author: Felix Scherzinger (felix_scherzinger@mentor.com) +/* Copyright (C) 2015 BMW Group * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.cpp b/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.cpp index 107d04b..1769ed5 100644 --- a/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.cpp +++ b/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.cpp @@ -1,5 +1,4 @@ -/* Copyright (C) 2015 Mentor Graphics - * Author: Felix Scherzinger (felix_scherzinger@mentor.com) +/* Copyright (C) 2015 BMW Group * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.h b/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.h index f6595f6..aa934d4 100644 --- a/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.h +++ b/org.genivi.commonapi.core.verification/src/stub/PFPrimitiveStub.h @@ -1,5 +1,4 @@ -/* Copyright (C) 2015 Mentor Graphics - * Author: Felix Scherzinger (felix_scherzinger@mentor.com) +/* Copyright (C) 2015 BMW Group * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/org.genivi.commonapi.core.verification/src/stub/StabControlStub.cpp b/org.genivi.commonapi.core.verification/src/stub/StabControlStub.cpp deleted file mode 100644 index b512e70..0000000 --- a/org.genivi.commonapi.core.verification/src/stub/StabControlStub.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2015 BMW Group - * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include <iostream> -#include "StabControlStub.h" - -#ifndef WIN32 -#include <unistd.h> -#endif - -namespace v1_0 { -namespace commonapi { -namespace stability { -namespace mp { - -using namespace v1_0::commonapi::stability::mp; - -StabControlStub::StabControlStub() { -} - -StabControlStub::~StabControlStub() { -} - -CommandListener StabControlStub::listener_ = 0; - - -void StabControlStub::controlMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, - uint8_t id, - uint32_t data, - controlMethodReply_t _reply) -{ - // client sends commands and responses through this interface. - // call the listener with the data. - uint8_t command; - uint32_t min; - uint32_t max; - - if (StabControlStub::listener_) { - StabControlStub::listener_(id, data, command, min, max); - } - _reply(command, min, max); - -} - -void StabControlStub::registerListener(CommandListener listener ) { - StabControlStub::listener_ = listener; -} - -} /* namespace v1_0 */ -} /* namespace mp */ -} /* namespace stability */ -} /* namespace commonapi */ - - - diff --git a/org.genivi.commonapi.core.verification/src/stub/StabControlStub.h b/org.genivi.commonapi.core.verification/src/stub/StabControlStub.h deleted file mode 100644 index 7b844a4..0000000 --- a/org.genivi.commonapi.core.verification/src/stub/StabControlStub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 2014 BMW Group - * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef STABCONTROLSTUB_H_ -#define STABCONTROLSTUB_H_ - -#include "v1_0/commonapi/stability/mp/ControlInterfaceStubDefault.hpp" -#include "v1_0/commonapi/stability/mp/ControlInterface.hpp" - -namespace v1_0 { -namespace commonapi { -namespace stability { -namespace mp { - -using namespace v1_0::commonapi::stability::mp; - -typedef std::function<void (uint8_t id, uint32_t data, uint8_t& command, uint32_t& data1, uint32_t &data2)> CommandListener; - -class StabControlStub : public ControlInterfaceStubDefault { - -public: - StabControlStub(); - virtual ~StabControlStub(); - - virtual void controlMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, - uint8_t id, - uint32_t data, - controlMethodReply_t _reply); - - static void registerListener(CommandListener listener); - - static CommandListener listener_; - -}; - -} /* namespace v1_0 */ -} /* namespace mp */ -} /* namespace stability */ -} /* namespace commonapi */ -#endif /* STABCONTROLSTUB_H_ */ - - diff --git a/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.cpp b/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.cpp deleted file mode 100644 index 1468e8e..0000000 --- a/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2015 BMW Group - * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "StabilityMPStub.h" - -#ifndef WIN32 -#include <unistd.h> -#endif - -namespace v1_0 { -namespace commonapi { -namespace stability { -namespace mp { - -using namespace v1_0::commonapi::stability::mp; - -StabilityMPStub::StabilityMPStub() { -} - -StabilityMPStub::~StabilityMPStub() { -} - -void StabilityMPStub::testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, - TestInterface::tArray tArrayIn, - testMethodReply_t _reply) { - - TestInterface::tArray tArrayOut; - tArrayOut = tArrayIn; - - fireTestBroadcastEvent( - tArrayOut - ); - _reply(tArrayOut); -} - -void StabilityMPStub::setTestValues(TestInterface::tArray x) { - setTestAttributeAttribute(x); -} - -} /* namespace v1_0 */ -} /* namespace mp */ -} /* namespace stability */ -} /* namespace commonapi */ - - diff --git a/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.h b/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.h deleted file mode 100644 index 328f047..0000000 --- a/org.genivi.commonapi.core.verification/src/stub/StabilityMPStub.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 2015 BMW Group - * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef STABILITYMPSTUB_H_ -#define STABILITYMPSTUB_H_ - -#include "v1_0/commonapi/stability/mp/TestInterfaceStubDefault.hpp" -#include "v1_0/commonapi/stability/mp/TestInterface.hpp" - -namespace v1_0 { -namespace commonapi { -namespace stability { -namespace mp { - -class StabilityMPStub : public TestInterfaceStubDefault { - -public: - StabilityMPStub(); - virtual ~StabilityMPStub(); - - virtual void testMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, - TestInterface::tArray tArrayIn, - testMethodReply_t _reply); - virtual void setTestValues(TestInterface::tArray x); -}; - -} /* namespace v1_0 */ -} /* namespace mp */ -} /* namespace stability */ -} /* namespace commonapi */ -#endif /* STABILITYMPSTUB_H_ */ - diff --git a/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.cpp b/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.cpp index 472d39a..373636e 100644 --- a/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.cpp +++ b/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.cpp @@ -1,5 +1,4 @@ /* Copyright (C) 2015 BMW Group - * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com) * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.h b/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.h index 86b8c3c..d9a4071 100644 --- a/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.h +++ b/org.genivi.commonapi.core.verification/src/stub/StabilitySPStub.h @@ -1,5 +1,4 @@ /* Copyright (C) 2015 BMW Group - * Author: JP Ikaheimonen (jp_ikaheimonen@mentor.com) * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/org.genivi.commonapi.core.verification/src/utils/StopWatch.cpp b/org.genivi.commonapi.core.verification/src/utils/StopWatch.cpp index cd2eef3..49fd14f 100644 --- a/org.genivi.commonapi.core.verification/src/utils/StopWatch.cpp +++ b/org.genivi.commonapi.core.verification/src/utils/StopWatch.cpp @@ -9,6 +9,9 @@ #include <cassert> #include <ctime> +#ifdef WIN32 + #include <chrono> +#endif #define USEC_PER_SEC 1000000ULL #define NSEC_PER_USEC 1000ULL @@ -28,10 +31,14 @@ StopWatch::usec_t StopWatch::getTotalElapsedSeconds() const { } StopWatch::usec_t StopWatch::now() { +#ifdef WIN32 + return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); +#else struct timespec ts; assert(!clock_gettime(CLOCK_MONOTONIC, &ts)); return (usec_t) ts.tv_sec * USEC_PER_SEC + (usec_t) ts.tv_nsec / NSEC_PER_USEC; +#endif } diff --git a/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h b/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h index 52f7024..beac7a6 100644 --- a/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h +++ b/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoop.h @@ -45,18 +45,18 @@ class VerificationMainLoop { explicit VerificationMainLoop(std::shared_ptr<MainLoopContext> context) : context_(context), currentMinimalTimeoutInterval_(TIMEOUT_INFINITE), running_(false), breakLoop_(false), dispatchWatchesTooLong(false) { #ifdef WIN32 - WSAEVENT wsaEvent = WSACreateEvent(); + wsaEvents_.push_back(WSACreateEvent()); - if (wsaEvent != WSA_INVALID_EVENT) { - wakeFd_.fd = PtrToInt(wsaEvent); + if (wsaEvents_[0] == WSA_INVALID_EVENT) { + printf("Invalid Event Created!"); } #else - wakeFd_.fd = eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK); + wakeFd_.fd = eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK); + wakeFd_.events = POLLIN; + assert(wakeFd_.fd != -1); + registerFileDescriptor(wakeFd_); #endif - wakeFd_.events = POLLIN; - assert(wakeFd_.fd != -1); - registerFileDescriptor(wakeFd_); dispatchSourceListenerSubscription_ = context_->subscribeForDispatchSources( std::bind(&CommonAPI::VerificationMainLoop::registerDispatchSource, this, std::placeholders::_1, std::placeholders::_2), @@ -74,15 +74,16 @@ class VerificationMainLoop { } ~VerificationMainLoop() { - deregisterFileDescriptor(wakeFd_); - +#ifndef WIN32 + deregisterFileDescriptor(wakeFd_); +#endif context_->unsubscribeForDispatchSources(dispatchSourceListenerSubscription_); context_->unsubscribeForWatches(watchListenerSubscription_); context_->unsubscribeForTimeouts(timeoutSourceListenerSubscription_); context_->unsubscribeForWakeupEvents(wakeupListenerSubscription_); #ifdef WIN32 - WSACloseEvent(IntToPtr(wakeFd_.fd)); + WSACloseEvent(wsaEvents_[0]); #else close(wakeFd_.fd); #endif @@ -199,17 +200,34 @@ class VerificationMainLoop { } void poll() { - for (auto fileDescriptor = managedFileDescriptors_.begin() + 1; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) { - (*fileDescriptor).revents = 0; - } +#ifdef WIN32 + int managedFileDescriptorOffset = 0; +#else + int managedFileDescriptorOffset = 1; +#endif + + for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) { + (*fileDescriptor).revents = 0; + } #if WIN32 - INT currentMinimalTimeoutIntervalWin32_ = 1; - size_t numReadyFileDescriptors = ::WSAPoll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutIntervalWin32_); + size_t numReadyFileDescriptors = 0; - if (numReadyFileDescriptors == SOCKET_ERROR) { - int iError = WSAGetLastError(); - //printf("WSAPoll failed with error: %ld\n", iError); + int errorCode = WSAWaitForMultipleEvents(wsaEvents_.size(), wsaEvents_.data(), FALSE, currentMinimalTimeoutInterval_, FALSE); + + if (errorCode == WSA_WAIT_IO_COMPLETION) { + printf("WSAWaitForMultipleEvents failed with error: WSA_WAIT_IO_COMPLETION"); + } + else if (errorCode == WSA_WAIT_FAILED) { + printf("WSAWaitForMultipleEvents failed with error: %ld\n", WSAGetLastError()); + } + else { + for (uint32_t i = 0; i < managedFileDescriptors_.size(); i++) { + if (WaitForSingleObjectEx(wsaEvents_[i + 1], 0, true) != WAIT_TIMEOUT) { + numReadyFileDescriptors++; + managedFileDescriptors_[i].revents = POLLIN; + } + } } #else size_t numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutInterval_); @@ -233,14 +251,23 @@ class VerificationMainLoop { } } - if (wakeFd_.revents) { - acknowledgeWakeup(); - } +#ifdef WIN32 + acknowledgeWakeup(); +#else + if (managedFileDescriptors_[0].revents) { + acknowledgeWakeup(); + } +#endif } bool check() { - //The first file descriptor always is the loop's wakeup-descriptor. All others need to be linked to a watch. - for (auto fileDescriptor = managedFileDescriptors_.begin() + 1; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) { + //The first file descriptor always is the loop's wakeup-descriptor (but not for windows anymore). All others need to be linked to a watch. +#ifdef WIN32 + int managedFileDescriptorOffset = 0; +#else + int managedFileDescriptorOffset = 1; +#endif + for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) { for (auto registeredWatchIterator = registeredWatches_.begin(); registeredWatchIterator != registeredWatches_.end(); registeredWatchIterator++) { @@ -276,11 +303,14 @@ class VerificationMainLoop { void wakeup() { #ifdef WIN32 - HANDLE h = IntToPtr(wakeFd_.fd); - SetEvent(h); + if (!WSASetEvent(wsaEvents_[0])) + { + printf("SetEvent failed (%d)\n", GetLastError()); + return; + } #else int64_t wake = 1; - ::write(wakeFd_.fd, &wake, sizeof(int64_t)); + ::write(managedFileDescriptors_[0].fd, &wake, sizeof(int64_t)); #endif } @@ -350,6 +380,24 @@ class VerificationMainLoop { } } +#ifdef WIN32 + void registerEvent( + const HANDLE& wsaEvent) { + wsaEvents_.push_back(wsaEvent); + } + + void unregisterEvent( + const HANDLE& wsaEvent) { + for (auto it = wsaEvents_.begin(); + it != wsaEvents_.end(); it++) { + if ((*it) == wsaEvent) { + wsaEvents_.erase(it); + break; + } + } + } +#endif + void registerDispatchSource(DispatchSource* dispatchSource, const DispatchPriority dispatchPriority) { registeredDispatchSources_.insert( {dispatchPriority, dispatchSource} ); } @@ -369,16 +417,26 @@ class VerificationMainLoop { void registerWatch(Watch* watch, const DispatchPriority dispatchPriority) { registerFileDescriptor(watch->getAssociatedFileDescriptor()); + +#ifdef WIN32 + registerEvent(watch->getAssociatedEvent()); +#endif + registeredWatches_.insert( { dispatchPriority, {watch->getAssociatedFileDescriptor().fd, watch} } ); } void deregisterWatch(Watch* watch) { +#ifdef WIN32 + unregisterEvent(watch->getAssociatedEvent()); +#endif + for(auto watchIterator = registeredWatches_.begin(); watchIterator != registeredWatches_.end(); watchIterator++) { if(watchIterator->second.second == watch) { registeredWatches_.erase(watchIterator); + break; } } } @@ -401,11 +459,16 @@ class VerificationMainLoop { void acknowledgeWakeup() { #ifdef WIN32 - HANDLE h = IntToPtr(wakeFd_.fd); - ResetEvent(h); + for (unsigned int i = 0; i < wsaEvents_.size(); i++) { + if (!WSAResetEvent(wsaEvents_[i])) + { + printf("ResetEvent failed (%d)\n", GetLastError()); + return; + } + } #else int64_t buffer; - while (::read(wakeFd_.fd, &buffer, sizeof(int64_t)) == sizeof(buffer)); + while (::read(managedFileDescriptors_[0].fd, &buffer, sizeof(int64_t)) == sizeof(buffer)); #endif } @@ -430,7 +493,11 @@ class VerificationMainLoop { bool breakLoop_; bool running_; - pollfd wakeFd_; +#ifdef WIN32 + std::vector<HANDLE> wsaEvents_; +#else + pollfd wakeFd_; +#endif std::promise<bool>* stopPromise; }; diff --git a/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoopWithQueue.h b/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoopWithQueue.h new file mode 100644 index 0000000..5bf3af4 --- /dev/null +++ b/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoopWithQueue.h @@ -0,0 +1,480 @@ +// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef DEMO_MAIN_LOOP_H_ +#define DEMO_MAIN_LOOP_H_ + +#include <CommonAPI/CommonAPI.hpp> + +#include <vector> +#include <set> +#include <map> +#include <memory> +#include <condition_variable> +#ifdef WIN32 +#include <WinSock2.h> +#else +#include <poll.h> +#include <sys/eventfd.h> +#include <unistd.h> +#endif + +#include <cassert> + +namespace CommonAPI { + +typedef pollfd DemoMainLoopPollFd; + +class VerificationMainLoopEventQueue { +public: + void run(const int64_t& timeoutInterval = TIMEOUT_INFINITE) { + running_ = true; + while (running_) { + std::unique_lock<std::mutex> queueUniqueLock(queueLock_); + queueCondition_.wait(queueUniqueLock); + + for (unsigned int i = 0; i < queue_.size(); i++) { + queue_.at(i)(); + } + + queueUniqueLock.unlock(); + queueCondition_.notify_one(); + } + } + + void stop() { + running_ = false; + } + + void pushToQueue(std::function<void()> func) { + std::lock_guard<std::mutex> queueUniqueLock(queueLock_); + queue_.push_back(func); + queueCondition_.notify_one(); + } + +private: + bool running_; + std::vector<std::function<void()>> queue_; + std::condition_variable queueCondition_; + std::mutex queueLock_; +}; + +class VerificationMainLoop { + public: + VerificationMainLoop() = delete; + VerificationMainLoop(const VerificationMainLoop&) = delete; + VerificationMainLoop& operator=(const VerificationMainLoop&) = delete; + VerificationMainLoop(VerificationMainLoop&&) = delete; + VerificationMainLoop& operator=(VerificationMainLoop&&) = delete; + + explicit VerificationMainLoop(std::shared_ptr<MainLoopContext> context, std::shared_ptr<VerificationMainLoopEventQueue> eventQueue) : + context_(context), + eventQueue_(eventQueue), + currentMinimalTimeoutInterval_(TIMEOUT_INFINITE), + breakLoop_(false), + running_(false), + m_bNeedWakeup(false) + { +#ifdef WIN32 + wsaEvents_.push_back(WSACreateEvent()); + + if (wsaEvents_[0] == WSA_INVALID_EVENT) { + printf("Invalid Event Created!"); + } +#else + wakeFd_.fd = eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK); + wakeFd_.events = POLLIN; + assert(wakeFd_.fd != -1); + registerFileDescriptor(wakeFd_); +#endif + + dispatchSourceListenerSubscription_ = context_->subscribeForDispatchSources( + std::bind(&VerificationMainLoop::registerDispatchSource, this, std::placeholders::_1, std::placeholders::_2), + std::bind(&VerificationMainLoop::deregisterDispatchSource, this, std::placeholders::_1)); + watchListenerSubscription_ = context_->subscribeForWatches( + std::bind(&VerificationMainLoop::registerWatch, this, std::placeholders::_1, std::placeholders::_2), + std::bind(&VerificationMainLoop::deregisterWatch, this, std::placeholders::_1)); + timeoutSourceListenerSubscription_ = context_->subscribeForTimeouts( + std::bind(&VerificationMainLoop::registerTimeout, this, std::placeholders::_1, std::placeholders::_2), + std::bind(&VerificationMainLoop::deregisterTimeout, this, std::placeholders::_1)); + wakeupListenerSubscription_ = context_->subscribeForWakeupEvents( + std::bind(&VerificationMainLoop::wakeup, this)); + } + + ~VerificationMainLoop() { +#ifndef WIN32 + deregisterFileDescriptor(wakeFd_); +#endif + context_->unsubscribeForDispatchSources(dispatchSourceListenerSubscription_); + context_->unsubscribeForWatches(watchListenerSubscription_); + context_->unsubscribeForTimeouts(timeoutSourceListenerSubscription_); + context_->unsubscribeForWakeupEvents(wakeupListenerSubscription_); + +#ifdef WIN32 + WSACloseEvent(wsaEvents_[0]); +#else + close(wakeFd_.fd); +#endif + } + + /** + * \brief Runs the mainloop indefinitely until stop() is called. + * + * Runs the mainloop indefinitely until stop() is called. The given timeout (milliseconds) + * will be overridden if a timeout-event is present that defines an earlier ready time. + */ + void run(const int64_t& timeoutInterval = TIMEOUT_INFINITE) { + running_ = true; + while(running_) { + doSingleIteration(timeoutInterval); + } + } + + void stop() { + running_ = false; + wakeup(); + } + + /** + * \brief Executes a single cycle of the mainloop. + * + * Subsequently calls prepare(), poll(), check() and, if necessary, dispatch(). + * The given timeout (milliseconds) represents the maximum time + * this iteration will remain in the poll state. All other steps + * are handled in a non-blocking way. Note however that a source + * might claim to have infinite amounts of data to dispatch. + * This demo-implementation of a Mainloop will dispatch a source + * until it no longer claims to have data to dispatch. + * Dispatch will not be called if no sources, watches and timeouts + * claim to be ready during the check()-phase. + * + * @param timeout The maximum poll-timeout for this iteration. + */ + void doSingleIteration(const int64_t& timeout = TIMEOUT_INFINITE) { + prepare(timeout); + poll(); + if(check()) { + dispatch(); + //dispatchCondition_.notify_one(); + } + } + + /* + * The given timeout is a maximum timeout in ms, measured from the current time in the future + * (a value of 0 means "no timeout"). It will be overridden if a timeout-event is present + * that defines an earlier ready time. + */ + void prepare(const int64_t& timeout = TIMEOUT_INFINITE) { + currentMinimalTimeoutInterval_ = timeout; + + for (auto dispatchSourceIterator = registeredDispatchSources_.begin(); + dispatchSourceIterator != registeredDispatchSources_.end(); + dispatchSourceIterator++) { + + int64_t dispatchTimeout = TIMEOUT_INFINITE; + if(dispatchSourceIterator->second->prepare(dispatchTimeout)) { + sourcesToDispatch_.insert(*dispatchSourceIterator); + } else if (dispatchTimeout < currentMinimalTimeoutInterval_) { + currentMinimalTimeoutInterval_ = dispatchTimeout; + } + } + + int64_t currentContextTime = getCurrentTimeInMs(); + + for (auto timeoutPriorityRange = registeredTimeouts_.begin(); + timeoutPriorityRange != registeredTimeouts_.end(); + timeoutPriorityRange++) { + + int64_t intervalToReady = timeoutPriorityRange->second->getReadyTime() - currentContextTime; + + if (intervalToReady <= 0) { + timeoutsToDispatch_.insert(*timeoutPriorityRange); + currentMinimalTimeoutInterval_ = TIMEOUT_NONE; + } else if (intervalToReady < currentMinimalTimeoutInterval_) { + currentMinimalTimeoutInterval_ = intervalToReady; + } + } + } + + void poll() { +#ifdef WIN32 + int managedFileDescriptorOffset = 0; +#else + int managedFileDescriptorOffset = 1; +#endif + + for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) { + (*fileDescriptor).revents = 0; + } + +#ifdef WIN32 + size_t numReadyFileDescriptors = 0; + + int errorCode = WSAWaitForMultipleEvents(wsaEvents_.size(), wsaEvents_.data(), FALSE, currentMinimalTimeoutInterval_, FALSE); + + if (errorCode == WSA_WAIT_IO_COMPLETION) { + printf("WSAWaitForMultipleEvents failed with error: WSA_WAIT_IO_COMPLETION"); + } + else if (errorCode == WSA_WAIT_FAILED) { + printf("WSAWaitForMultipleEvents failed with error: %ld\n", WSAGetLastError()); + } + else { + for (uint32_t i = 0; i < managedFileDescriptors_.size(); i++) { + if (WaitForSingleObjectEx(wsaEvents_[i + 1], 0, true) != WAIT_TIMEOUT) { + numReadyFileDescriptors++; + managedFileDescriptors_[i].revents = POLLIN; + } + } + } +#else + size_t numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutInterval_); +#endif + // If no FileDescriptors are ready, poll returned because of a timeout that has expired. + // The only case in which this is not the reason is when the timeout handed in "prepare" + // expired before any other timeouts. + if (!numReadyFileDescriptors) { + int64_t currentContextTime = getCurrentTimeInMs(); + + for (auto timeoutPriorityRange = registeredTimeouts_.begin(); + timeoutPriorityRange != registeredTimeouts_.end(); + timeoutPriorityRange++) { + + int64_t intervalToReady = timeoutPriorityRange->second->getReadyTime() - currentContextTime; + + if (intervalToReady <= 0) { + timeoutsToDispatch_.insert(*timeoutPriorityRange); + } + } + } + +#ifdef WIN32 + acknowledgeWakeup(); +#else + if (wakeFd_.revents) { + acknowledgeWakeup(); + } +#endif + } + + bool check() { +//The first file descriptor always is the loop's wakeup-descriptor (but not for windows anymore). All others need to be linked to a watch. +#ifdef WIN32 + int managedFileDescriptorOffset = 0; +#else + int managedFileDescriptorOffset = 1; +#endif + for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) { + for (auto registeredWatchIterator = registeredWatches_.begin(); + registeredWatchIterator != registeredWatches_.end(); + registeredWatchIterator++) { + const auto& correspondingWatchPriority = registeredWatchIterator->first; + const auto& correspondingWatchPair = registeredWatchIterator->second; + + if (std::get<0>(correspondingWatchPair) == fileDescriptor->fd && fileDescriptor->revents) { + watchesToDispatch_.insert({ correspondingWatchPriority, { std::get<1>(correspondingWatchPair) } }); + } + } + } + + for(auto dispatchSourceIterator = registeredDispatchSources_.begin(); dispatchSourceIterator != registeredDispatchSources_.end(); ++dispatchSourceIterator) { + if((std::get<1>(*dispatchSourceIterator))->check()) { + sourcesToDispatch_.insert( {std::get<0>(*dispatchSourceIterator), std::get<1>(*dispatchSourceIterator)}); + } + } + + return !timeoutsToDispatch_.empty() || !watchesToDispatch_.empty() || !sourcesToDispatch_.empty(); + } + + void dispatch() { + eventQueue_->pushToQueue(std::bind(&VerificationMainLoop::doExternalIteration, this)); + } + + void doExternalIteration() + { + for (auto timeoutIterator = timeoutsToDispatch_.begin(); + timeoutIterator != timeoutsToDispatch_.end(); + timeoutIterator++) { + std::get<1>(*timeoutIterator)->dispatch(); + } + + for (auto watchIterator = watchesToDispatch_.begin(); + watchIterator != watchesToDispatch_.end(); + watchIterator++) { + Watch* watch = watchIterator->second; + const unsigned int flags = POLLIN | POLLOUT | POLLERR; + watch->dispatch(flags); + } + + breakLoop_ = false; + for (auto dispatchSourceIterator = sourcesToDispatch_.begin(); + dispatchSourceIterator != sourcesToDispatch_.end() && !breakLoop_; + dispatchSourceIterator++) { + + while(std::get<1>(*dispatchSourceIterator)->dispatch()); + } + + sourcesToDispatch_.clear(); + timeoutsToDispatch_.clear(); + watchesToDispatch_.clear(); + } + + void wakeup() { +#ifdef WIN32 + if (!WSASetEvent(wsaEvents_[0])) + { + printf("SetEvent failed (%d)\n", GetLastError()); + return; + } +#else + int64_t wake = 1; + ::write(wakeFd_.fd, &wake, sizeof(int64_t)); +#endif + } + + private: + void registerFileDescriptor(const DemoMainLoopPollFd& fileDescriptor) { + managedFileDescriptors_.push_back(fileDescriptor); + } + + void deregisterFileDescriptor(const DemoMainLoopPollFd& fileDescriptor) { + for (auto it = managedFileDescriptors_.begin(); it != managedFileDescriptors_.end(); it++) { + if ((*it).fd == fileDescriptor.fd) { + managedFileDescriptors_.erase(it); + break; + } + } + } + +#ifdef WIN32 + void registerEvent( + const HANDLE& wsaEvent) { + wsaEvents_.push_back(wsaEvent); + } + + void unregisterEvent( + const HANDLE& wsaEvent) { + for (auto it = wsaEvents_.begin(); + it != wsaEvents_.end(); it++) { + if ((*it) == wsaEvent) { + wsaEvents_.erase(it); + break; + } + } + } +#endif + + void registerDispatchSource(DispatchSource* dispatchSource, const DispatchPriority dispatchPriority) { + registeredDispatchSources_.insert( {dispatchPriority, dispatchSource} ); + } + + void deregisterDispatchSource(DispatchSource* dispatchSource) { + for(auto dispatchSourceIterator = registeredDispatchSources_.begin(); + dispatchSourceIterator != registeredDispatchSources_.end(); + dispatchSourceIterator++) { + + if(dispatchSourceIterator->second == dispatchSource) { + registeredDispatchSources_.erase(dispatchSourceIterator); + break; + } + } + breakLoop_ = true; + } + + void registerWatch(Watch* watch, const DispatchPriority dispatchPriority) { + DemoMainLoopPollFd fdToRegister = watch->getAssociatedFileDescriptor(); + registerFileDescriptor(fdToRegister); + +#ifdef WIN32 + registerEvent(watch->getAssociatedEvent()); +#endif + + registeredWatches_.insert( {dispatchPriority, {watch->getAssociatedFileDescriptor().fd, watch}}); + } + + void deregisterWatch(Watch* watch) { + deregisterFileDescriptor(watch->getAssociatedFileDescriptor()); + +#ifdef WIN32 + unregisterEvent(watch->getAssociatedEvent()); +#endif + + for(auto watchIterator = registeredWatches_.begin(); + watchIterator != registeredWatches_.end(); + watchIterator++) { + + if(watchIterator->second.second == watch) { + registeredWatches_.erase(watchIterator); + break; + } + } + } + + void registerTimeout(Timeout* timeout, const DispatchPriority dispatchPriority) { + registeredTimeouts_.insert( {dispatchPriority, timeout} ); + } + + void deregisterTimeout(Timeout* timeout) { + for(auto timeoutIterator = registeredTimeouts_.begin(); + timeoutIterator != registeredTimeouts_.end(); + timeoutIterator++) { + + if(timeoutIterator->second == timeout) { + registeredTimeouts_.erase(timeoutIterator); + break; + } + } + } + + void acknowledgeWakeup() { +#ifdef WIN32 + for (unsigned int i = 0; i < wsaEvents_.size(); i++) { + if (!WSAResetEvent(wsaEvents_[i])) + { + printf("ResetEvent failed (%d)\n", GetLastError()); + return; + } + } +#else + int64_t buffer; + while (::read(wakeFd_.fd, &buffer, sizeof(int64_t)) == sizeof(buffer)) + ; +#endif + } + + bool m_bNeedWakeup; + std::shared_ptr<MainLoopContext> context_; + + std::vector<DemoMainLoopPollFd> managedFileDescriptors_; + + std::multimap<DispatchPriority, DispatchSource*> registeredDispatchSources_; + std::multimap<DispatchPriority, std::pair<int, Watch*>> registeredWatches_; + std::multimap<DispatchPriority, Timeout*> registeredTimeouts_; + + std::set<std::pair<DispatchPriority, DispatchSource*>> sourcesToDispatch_; + std::set<std::pair<DispatchPriority, Watch*>> watchesToDispatch_; + std::set<std::pair<DispatchPriority, Timeout*>> timeoutsToDispatch_; + + DispatchSourceListenerSubscription dispatchSourceListenerSubscription_; + WatchListenerSubscription watchListenerSubscription_; + TimeoutSourceListenerSubscription timeoutSourceListenerSubscription_; + WakeupListenerSubscription wakeupListenerSubscription_; + + int64_t currentMinimalTimeoutInterval_; + bool breakLoop_; + bool running_; + +#ifdef WIN32 + std::vector<HANDLE> wsaEvents_; +#else + DemoMainLoopPollFd wakeFd_; +#endif + + std::shared_ptr<VerificationMainLoopEventQueue> eventQueue_; +}; + + +} // namespace CommonAPI + +#endif /* DEMO_MAIN_LOOP_H_ */ |