Ejemplo n.º 1
0
void DbusCapabilitiesUtil::copyDbusDiscoveryQosToJoynr(const joynr::messaging::types::Types::DiscoveryQos& dbusDiscoveryQos, DiscoveryQos& joynrDiscoveryQos) {
    // copy arbitration strategy
    switch (dbusDiscoveryQos.arbitrationStrategy) {
    case joynr::messaging::types::Types::ArbitrationStrategy::FIXED_CHANNEL:
        joynrDiscoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
        break;
    case joynr::messaging::types::Types::ArbitrationStrategy::HIGHEST_PRIORITY:
        joynrDiscoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
        break;
    case joynr::messaging::types::Types::ArbitrationStrategy::KEYWORD:
        joynrDiscoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::KEYWORD);
        break;
    case joynr::messaging::types::Types::ArbitrationStrategy::LOCAL_ONLY:
        joynrDiscoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::LOCAL_ONLY);
        break;
    case joynr::messaging::types::Types::ArbitrationStrategy::NOT_SET:
        joynrDiscoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::NOT_SET);
        break;
    default:
        assert(false);
    }

    switch(dbusDiscoveryQos.discoveryScope) {
    case joynr::messaging::types::Types::DiscoveryScope::GLOBAL_ONLY:
        joynrDiscoveryQos.setDiscoveryScope(DiscoveryQos::DiscoveryScope::GLOBAL_ONLY);
        break;
    case joynr::messaging::types::Types::DiscoveryScope::LOCAL_ONLY:
        joynrDiscoveryQos.setDiscoveryScope(DiscoveryQos::DiscoveryScope::LOCAL_ONLY);
        break;
    case joynr::messaging::types::Types::DiscoveryScope::LOCAL_THEN_GLOBAL:
        joynrDiscoveryQos.setDiscoveryScope(DiscoveryQos::DiscoveryScope::LOCAL_THEN_GLOBAL);
        break;
    case joynr::messaging::types::Types::DiscoveryScope::LOCAL_AND_GLOBAL:
        joynrDiscoveryQos.setDiscoveryScope(DiscoveryQos::DiscoveryScope::LOCAL_AND_GLOBAL);
        break;
    default:
        assert(false);
    }

    joynrDiscoveryQos.setCacheMaxAge(dbusDiscoveryQos.cacheMaxAge);
    joynrDiscoveryQos.setDiscoveryTimeout(dbusDiscoveryQos.discoveryTimeout);
    joynrDiscoveryQos.setProviderMustSupportOnChange(dbusDiscoveryQos.providerMustSupportOnChange);
    joynrDiscoveryQos.setRetryInterval(dbusDiscoveryQos.retryInterval);

    // copy the custom parameters
    auto parameterMap = dbusDiscoveryQos.customParameters;
    for(auto it = parameterMap.begin(); it != parameterMap.end(); it++) {
        joynr::messaging::types::Types::CustomParameter parameter = it->second;
        // initialize the joynr parameter
        joynrDiscoveryQos.addCustomParameter(QString::fromStdString(parameter.name),
                        QString::fromStdString(parameter.value));
    }
}
Ejemplo n.º 2
0
TEST_F(End2EndRPCTest, call_void_operation)
{

    std::shared_ptr<MockTestProvider> mockProvider(new MockTestProvider(types::ProviderQos(
            std::vector<types::CustomParameter>(),
            1,
            1,
            types::ProviderScope::GLOBAL,
            false
    )));

    runtime->registerProvider<tests::testProvider>(domain, mockProvider);
    QThreadSleep::msleep(550);

    ProxyBuilder<tests::testProxy>* testProxyBuilder = runtime->createProxyBuilder<tests::testProxy>(domain);
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    discoveryQos.setDiscoveryTimeout(1000);

    qlonglong qosRoundTripTTL = 40000;
    tests::testProxy* testProxy = testProxyBuilder
            ->setMessagingQos(MessagingQos(qosRoundTripTTL))
            ->setCached(false)
            ->setDiscoveryQos(discoveryQos)
            ->build();
    RequestStatus status(testProxy->voidOperation());
//    EXPECT_EQ(expectedValue, gpsFuture->getValue());
    //TODO CA: shared pointer for proxy builder?
    delete testProxy;
    delete testProxyBuilder;
    // This is not yet implemented in CapabilitiesClient
    // runtime->unregisterProvider("Fake_ParticipantId_vehicle/gpsDummyProvider");
}
Ejemplo n.º 3
0
    SystemServicesRoutingTest() :
            settingsFilename("test-resources/SystemServicesRoutingTest.settings"),
            settings(new QSettings(settingsFilename, QSettings::IniFormat)),
            routingDomain(),
            routingProviderParticipantId(),
            runtime(NULL),
            mockMessageReceiver(new MockMessageReceiver()),
            mockMessageSender(new MockMessageSender()),
            discoveryQos(),
            routingProxyBuilder(NULL),
            routingProxy(NULL)
    {
        SystemServicesSettings systemSettings(*settings);
        systemSettings.printSettings();
        routingDomain = TypeUtil::toStd(systemSettings.getDomain());
        routingProviderParticipantId = systemSettings.getCcRoutingProviderParticipantId();
        
        discoveryQos.setCacheMaxAge(1000);
        discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
        discoveryQos.addCustomParameter("fixedParticipantId", TypeUtil::toStd(routingProviderParticipantId));
        discoveryQos.setDiscoveryTimeout(50);

        QString channelId("SystemServicesRoutingTest.ChannelId");
        EXPECT_CALL(*(dynamic_cast<MockMessageReceiver*>(mockMessageReceiver)), getReceiveChannelId())
                .WillRepeatedly(::testing::ReturnRefOfCopy(channelId));

        //runtime can only be created, after MockMessageReceiver has been told to return
        //a channelId for getReceiveChannelId.
        runtime = new JoynrClusterControllerRuntime(NULL, settings, mockMessageReceiver, mockMessageSender);
        // routing provider is normally registered in JoynrClusterControllerRuntime::create
        runtime->registerRoutingProvider();
    }
Ejemplo n.º 4
0
TEST_F(End2EndSSLTest, call_rpc_method_and_get_expected_result)
{

    // Create a provider
    std::shared_ptr<MockGpsProvider> mockProvider(new MockGpsProvider());
    runtime->registerProvider<vehicle::GpsProvider>(domain, mockProvider);
    std::this_thread::sleep_for(std::chrono::milliseconds(550));

    // Build a proxy
    ProxyBuilder<vehicle::GpsProxy>* gpsProxyBuilder = runtime->createProxyBuilder<vehicle::GpsProxy>(domain);
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    discoveryQos.setDiscoveryTimeout(1000);

    qlonglong qosRoundTripTTL = 40000;
    std::shared_ptr<vehicle::GpsProxy> gpsProxy(gpsProxyBuilder
            ->setMessagingQos(MessagingQos(qosRoundTripTTL))
            ->setCached(false)
            ->setDiscoveryQos(discoveryQos)
            ->build());

    // Call the provider and wait for a result
    std::shared_ptr<Future<int> >gpsFuture (gpsProxy->calculateAvailableSatellitesAsync());
    gpsFuture->wait();

    int expectedValue = 42; //as defined in MockGpsProvider
    int actualValue;
    gpsFuture->get(actualValue);
    EXPECT_EQ(expectedValue, actualValue);
    delete gpsProxyBuilder;
}
Ejemplo n.º 5
0
// leadsm to assert failure in GpsInProcessConnector line 185: not yet implemented in connector
TEST_F(End2EndRPCTest, call_rpc_method_and_get_expected_result)
{

    std::shared_ptr<MockGpsProvider> mockProvider(new MockGpsProvider());
    types::Localisation::GpsLocation gpsLocation1(1.1, 2.2, 3.3, types::Localisation::GpsFixEnum::MODE2D, 0.0, 0.0, 0.0, 0.0, 444, 444, 4);

    runtime->registerProvider<vehicle::GpsProvider>(domain, mockProvider);
    QThreadSleep::msleep(550);

    ProxyBuilder<vehicle::GpsProxy>* gpsProxyBuilder = runtime->createProxyBuilder<vehicle::GpsProxy>(domain);
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    discoveryQos.setDiscoveryTimeout(1000);

    qlonglong qosRoundTripTTL = 40000;
    QSharedPointer<vehicle::GpsProxy> gpsProxy(gpsProxyBuilder
            ->setMessagingQos(MessagingQos(qosRoundTripTTL))
            ->setCached(false)
            ->setDiscoveryQos(discoveryQos)
            ->build());
    std::shared_ptr<Future<int> >gpsFuture (gpsProxy->calculateAvailableSatellitesAsync());
    gpsFuture->waitForFinished();
    int expectedValue = 42; //as defined in MockGpsProvider
    int actualValue;
    gpsFuture->getValues(actualValue);
    EXPECT_EQ(expectedValue, actualValue);
    //TODO CA: shared pointer for proxy builder?
    delete gpsProxyBuilder;
    // This is not yet implemented in CapabilitiesClient
    // runtime->unregisterProvider("Fake_ParticipantId_vehicle/gpsDummyProvider");
}
Ejemplo n.º 6
0
    void SetUp() {
        // start libjoynr runtime
        runtime = new LibJoynrDbusRuntime(
                    new Settings(temporarylibjoynrSettingsFilename)
        );

        SystemServicesSettings systemSettings(settings);
        systemSettings.printSettings();
        std::string systemServicesDomain(systemSettings.getDomain());

        // setup routing proxy
        std::string routingProviderParticipantId(systemSettings.getCcRoutingProviderParticipantId());
        routingProxyBuilder = runtime
                ->createProxyBuilder<joynr::system::RoutingProxy>(systemServicesDomain);
        DiscoveryQos discoveryQos;
        discoveryQos.setCacheMaxAge(1000);
        discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
        discoveryQos.addCustomParameter("fixedParticipantId", routingProviderParticipantId);
        discoveryQos.setDiscoveryTimeout(50);
        routingProxy = routingProxyBuilder
                ->setMessagingQos(MessagingQos(5000))
                ->setCached(false)
                ->setDiscoveryQos(discoveryQos)
                ->build();
        EXPECT_TRUE(routingProxy != NULL);

        // setup discovery proxy
        std::string discoveryProviderParticipantId(systemSettings.getCcDiscoveryProviderParticipantId());
        discoveryProxyBuilder = runtime
                ->createProxyBuilder<joynr::system::DiscoveryProxy>(systemServicesDomain);
        discoveryQos = DiscoveryQos();
        discoveryQos.setCacheMaxAge(1000);
        discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
        discoveryQos.addCustomParameter("fixedParticipantId", discoveryProviderParticipantId);
        discoveryQos.setDiscoveryTimeout(50);
        discoveryProxy = discoveryProxyBuilder
                ->setMessagingQos(MessagingQos(5000))
                ->setCached(false)
                ->setDiscoveryQos(discoveryQos)
                ->build();
        EXPECT_TRUE(discoveryProxy != NULL);

        mockTestProvider = std::make_shared<MockTestProvider>(mockTestProviderQos);
    }
Ejemplo n.º 7
0
TEST_F(CapabilitiesClientTest, registerAndRetrieveCapability) {
    CapabilitiesClient* capabilitiesClient = new CapabilitiesClient(channelId);// ownership of this is not transferred
    ProxyBuilder<infrastructure::GlobalCapabilitiesDirectoryProxy>* capabilitiesProxyBuilder =
            runtime->createProxyBuilder<infrastructure::GlobalCapabilitiesDirectoryProxy>(
                TypeUtil::toStd(messagingSettings.getDiscoveryDirectoriesDomain())
            );
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY); //actually only one provider should be available
    QSharedPointer<infrastructure::GlobalCapabilitiesDirectoryProxy> cabilitiesProxy (
        capabilitiesProxyBuilder
            ->setMessagingQos(MessagingQos(10000)) //TODO magic values.
            ->setCached(true)
            ->setDiscoveryQos(discoveryQos)
            ->build()
        );
    capabilitiesClient->init(cabilitiesProxy);

    std::vector<types::CapabilityInformation> capabilitiesInformationList;
    std::string capDomain("testDomain");
    std::string capInterface("testInterface");
    types::ProviderQos capProviderQos;
    std::string capChannelId("testChannelId");
    std::string capParticipantId("testParticipantId");

    capabilitiesInformationList.push_back(types::CapabilityInformation(capDomain, capInterface, capProviderQos, capChannelId, capParticipantId));
    LOG_DEBUG(logger,"Registering capabilities");
    capabilitiesClient->add(capabilitiesInformationList);
    LOG_DEBUG(logger,"Registered capabilities");
    //sync methods are not yet implemented
//    std::vector<types::QtCapabilityInformation> capResultList = capabilitiesClient->lookup(capDomain, capInterface);
//    EXPECT_EQ(capResultList, capabilitiesInformationList);
    QSharedPointer<GlobalCapabilitiesMock> callback(new GlobalCapabilitiesMock());

    // use a semaphore to wait for capabilities to be received
    QSemaphore semaphore(0);
    EXPECT_CALL(*callback, capabilitiesReceived(A<const std::vector<types::CapabilityInformation>&>()))
           .WillRepeatedly(
                DoAll(
                    ReleaseSemaphore(&semaphore),
                    Return(RequestStatus(RequestStatusCode::OK))
                ));
    std::function<void(const std::vector<types::CapabilityInformation>&)> onSuccess =
            [&](const std::vector<types::CapabilityInformation>& capabilities) {
                callback->capabilitiesReceived(capabilities);
            };

    LOG_DEBUG(logger,"get capabilities");
    capabilitiesClient->lookup(capDomain, capInterface, onSuccess);
    semaphore.tryAcquire(1,10000);
    LOG_DEBUG(logger,"finished get capabilities");

    delete capabilitiesProxyBuilder;
}
Ejemplo n.º 8
0
    void testOneShotAttributeSubscription(const T& expectedValue,
                                          SubscribeTo subscribeTo,
                                          ChangeAttribute setAttribute,
                                          const std::string& attributeName) {
        MockSubscriptionListenerOneType<T>* mockListener =
                new MockSubscriptionListenerOneType<T>();

        // Use a semaphore to count and wait on calls to the mock listener
        ON_CALL(*mockListener, onReceive(Eq(expectedValue)))
                .WillByDefault(ReleaseSemaphore(&semaphore));

        std::shared_ptr<ISubscriptionListener<T>> subscriptionListener(
                        mockListener);

        std::shared_ptr<tests::DefaulttestProvider> testProvider(new tests::DefaulttestProvider());
        runtime1->registerProvider<tests::testProvider>(domainName, testProvider);

        //This wait is necessary, because registerProvider is async, and a lookup could occur
        // before the register has finished.
        std::this_thread::sleep_for(std::chrono::milliseconds(registerProviderWait));

        (*testProvider.*setAttribute)(expectedValue, [](){}, [](const joynr::exceptions::ProviderRuntimeException&) {});
        ProxyBuilder<tests::testProxy>* testProxyBuilder
                = runtime2->createProxyBuilder<tests::testProxy>(domainName);
        DiscoveryQos discoveryQos;
        discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
        discoveryQos.setDiscoveryTimeout(1000);
        discoveryQos.setRetryInterval(250);

        std::int64_t qosRoundTripTTL = 500;

        // Send a message and expect to get a result
        tests::testProxy* testProxy = testProxyBuilder
                ->setMessagingQos(MessagingQos(qosRoundTripTTL))
                ->setCached(false)
                ->setDiscoveryQos(discoveryQos)
                ->build();

        std::int64_t minInterval_ms = 50;
        OnChangeSubscriptionQos subscriptionQos(
                    500000,   // validity_ms
                    minInterval_ms);  // minInterval_ms

        subscribeTo(testProxy, subscriptionListener, subscriptionQos);
        waitForAttributeSubscriptionArrivedAtProvider(testProvider, attributeName);

        // Wait for a subscription message to arrive
        ASSERT_TRUE(semaphore.waitFor(std::chrono::seconds(3)));

        delete testProxyBuilder;
        delete testProxy;
    }
Ejemplo n.º 9
0
TEST_F(End2EndBroadcastTest, subscribeToBroadcastWithEnumOutput) {
    tests::testTypes::TestEnum::Enum expectedTestEnum = tests::testTypes::TestEnum::TWO;
    MockSubscriptionListenerOneType<tests::testTypes::TestEnum::Enum>* mockListener =
            new MockSubscriptionListenerOneType<tests::testTypes::TestEnum::Enum>();

    // Use a semaphore to count and wait on calls to the mock listener
    ON_CALL(*mockListener, onReceive(Eq(expectedTestEnum)))
            .WillByDefault(ReleaseSemaphore(&semaphore));

    std::shared_ptr<ISubscriptionListener<tests::testTypes::TestEnum::Enum>> subscriptionListener(
                    mockListener);

    std::shared_ptr<MyTestProvider> testProvider(new MyTestProvider());
    runtime1->registerProvider<tests::testProvider>(domainName, testProvider);

    //This wait is necessary, because registerProvider is async, and a lookup could occur
    // before the register has finished.
    QThreadSleep::msleep(registerProviderWait);

    ProxyBuilder<tests::testProxy>* testProxyBuilder
            = runtime2->createProxyBuilder<tests::testProxy>(domainName);
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    discoveryQos.setDiscoveryTimeout(1000);
    discoveryQos.setRetryInterval(250);

    qlonglong qosRoundTripTTL = 500;

    // Send a message and expect to get a result
    tests::testProxy* testProxy = testProxyBuilder
            ->setMessagingQos(MessagingQos(qosRoundTripTTL))
            ->setCached(false)
            ->setDiscoveryQos(discoveryQos)
            ->build();

    int64_t minInterval_ms = 50;
    OnChangeSubscriptionQos subscriptionQos(
                500000,   // validity_ms
                minInterval_ms);  // minInterval_ms

    testProxy->subscribeToBroadcastWithEnumOutputBroadcast(subscriptionListener, subscriptionQos);

    waitForBroadcastSubscriptionArrivedAtProvider(testProvider, "broadcastWithEnumOutput");

    testProvider->fireBroadcastWithEnumOutput(expectedTestEnum);

    // Wait for a subscription message to arrive
    ASSERT_TRUE(semaphore.tryAcquire(1, 3000));

    delete testProxyBuilder;
    delete testProxy;
}
Ejemplo n.º 10
0
// This test is disabled, because the feature is not yet implemented on the server.
TEST_F(CombinedEnd2EndTest, DISABLED_channelUrlProxyUnRegistersUrlsCorrectly) {
    ProxyBuilder<infrastructure::ChannelUrlDirectoryProxy>* channelUrlDirectoryProxyBuilder =
            runtime1->createProxyBuilder<infrastructure::ChannelUrlDirectoryProxy>(
                messagingSettings1.getDiscoveryDirectoriesDomain()
            );

    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    infrastructure::ChannelUrlDirectoryProxy* channelUrlDirectoryProxy
            = channelUrlDirectoryProxyBuilder
                ->setMessagingQos(MessagingQos(10000))
                ->setCached(true)
                ->setDiscoveryQos(discoveryQos)
                ->build();

    std::string channelId = "bogus_3";
    types::ChannelUrlInformation channelUrlInformation;
    std::vector<std::string> urls = { "bogusTestUrl_1", "bogusTestUrl_2" };
    channelUrlInformation.setUrls(urls);
    try {
        channelUrlDirectoryProxy->registerChannelUrls(channelId, channelUrlInformation);
    }  catch (exceptions::JoynrException& e) {
        ADD_FAILURE()<< "registerChannelUrls was not successful";
    }

    types::ChannelUrlInformation result;
    try {
        channelUrlDirectoryProxy->getUrlsForChannel(result, channelId);
    } catch (exceptions::JoynrException& e) {
        ADD_FAILURE()<< "getUrlsForChannel was not successful";
    }
    EXPECT_EQ(channelUrlInformation,result);

    try {
        channelUrlDirectoryProxy->unregisterChannelUrls(channelId);
    } catch (exceptions::JoynrException& e) {
        ADD_FAILURE()<< "unregisterChannelUrls was not successful";
    }

    types::ChannelUrlInformation result2;
    try {
        channelUrlDirectoryProxy->getUrlsForChannel(result2, channelId);
        ADD_FAILURE()<< "getUrlsForChannel was successful";
    } catch (exceptions::JoynrException& e) {
    }
    EXPECT_EQ(0,result2.getUrls().size());
}
Ejemplo n.º 11
0
TEST_F(CombinedEnd2EndTest, channelUrlProxyGetsNoUrlOnNonRegisteredChannel) {
    ProxyBuilder<infrastructure::ChannelUrlDirectoryProxy>* channelUrlDirectoryProxyBuilder =
            runtime1->createProxyBuilder<infrastructure::ChannelUrlDirectoryProxy>(
                messagingSettings1.getDiscoveryDirectoriesDomain()
            );

    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    infrastructure::ChannelUrlDirectoryProxy* channelUrlDirectoryProxy
            = channelUrlDirectoryProxyBuilder
                ->setMessagingQos(MessagingQos(1000))
                ->setCached(true)
                ->setDiscoveryQos(discoveryQos)
                ->build();

    types::ChannelUrlInformation result;
    std::string channelId("test");
    EXPECT_THROW(channelUrlDirectoryProxy->getUrlsForChannel(result, channelId), exceptions::JoynrTimeOutException);
}
Ejemplo n.º 12
0
TEST_F(CombinedEnd2EndTest, channelUrlProxyRegistersUrlsCorrectly) {
    ProxyBuilder<infrastructure::ChannelUrlDirectoryProxy>* channelUrlDirectoryProxyBuilder =
            runtime1->createProxyBuilder<infrastructure::ChannelUrlDirectoryProxy>(
                messagingSettings1.getDiscoveryDirectoriesDomain()
            );

    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    infrastructure::ChannelUrlDirectoryProxy* channelUrlDirectoryProxy
            = channelUrlDirectoryProxyBuilder
                ->setMessagingQos(MessagingQos(20000))
                ->setCached(true)
                ->setDiscoveryQos(discoveryQos)
                ->build();

    // There is a race condition where the actual channel url can be set AFTER the dummy data
    // used for testing. Pause for a short time so that the dummy data is always written
    // last
    std::this_thread::sleep_for(std::chrono::seconds(2));

    // Register new channel URLs
    std::string channelId = "bogus_1";
    types::ChannelUrlInformation channelUrlInformation;
    std::vector<std::string> urls = { "bogusTestUrl_1", "bogusTestUrl_2" };
    channelUrlInformation.setUrls(urls);
    try {
        channelUrlDirectoryProxy->registerChannelUrls(
                channelId,
                channelUrlInformation);
    } catch (exceptions::JoynrException& e) {
        ADD_FAILURE() << "Registering Url was not successful";
    }

    types::ChannelUrlInformation result;
    try {
        channelUrlDirectoryProxy->getUrlsForChannel(result, channelId);
    } catch (exceptions::JoynrException& e) {
        ADD_FAILURE()<< "Requesting Url was not successful";
    }
    EXPECT_EQ(channelUrlInformation,result) << "Returned Url did not match Expected Url";
}
Ejemplo n.º 13
0
// tests in process subscription
TEST_F(End2EndRPCTest, _call_subscribeTo_and_get_expected_result)
{
    std::shared_ptr<MockTestProvider> mockProvider(new MockTestProvider());
    types::Localisation::GpsLocation gpsLocation1(1.1, 2.2, 3.3, types::Localisation::GpsFixEnum::MODE2D, 0.0, 0.0, 0.0, 0.0, 444, 444, 4);
    runtime->registerProvider<tests::testProvider>(domain, mockProvider);

    QThreadSleep::msleep(550);

    ProxyBuilder<tests::testProxy>* testProxyBuilder =
            runtime->createProxyBuilder<tests::testProxy>(domain);
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    discoveryQos.setDiscoveryTimeout(1000);

    qlonglong qosRoundTripTTL = 40000;
    QSharedPointer<tests::testProxy> testProxy(testProxyBuilder
            ->setMessagingQos(MessagingQos(qosRoundTripTTL))
            ->setCached(false)
            ->setDiscoveryQos(discoveryQos)
            ->build());

    MockGpsSubscriptionListener* mockListener = new MockGpsSubscriptionListener();
    std::shared_ptr<ISubscriptionListener<types::Localisation::GpsLocation> > subscriptionListener(
                mockListener);

    EXPECT_CALL(*mockListener, onReceive(A<const types::Localisation::GpsLocation&>()))
            .Times(AtLeast(2));

    OnChangeWithKeepAliveSubscriptionQos subscriptionQos(
                800, // validity_ms
                100, // minInterval_ms
                200, // maxInterval_ms
                1000 // alertInterval_ms
    );
    testProxy->subscribeToLocation(subscriptionListener, subscriptionQos);
    QThreadSleep::msleep(1500);
    //TODO CA: shared pointer for proxy builder?
    delete testProxyBuilder;
    // This is not yet implemented in CapabilitiesClient
    // runtime->unregisterProvider("Fake_ParticipantId_vehicle/gpsDummyProvider");
}
Ejemplo n.º 14
0
    void init(const std::string& settings)
    {
        ccRuntime =
                JoynrClusterControllerRuntime::create(std::make_unique<joynr::Settings>(settings));

        types::ProviderQos providerQos;
        providerQos.setScope(joynr::types::ProviderScope::LOCAL);

        testProvider = std::make_shared<MockTestProvider>();
        providerParticipantId =
                ccRuntime->registerProvider<tests::testProvider>(domain, testProvider, providerQos);

        // Create a proxy
        auto testProxyBuilder = ccRuntime->createProxyBuilder<tests::testProxy>(domain);
        DiscoveryQos discoveryQos;
        discoveryQos.setDiscoveryScope(types::DiscoveryScope::LOCAL_ONLY);
        discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
        discoveryQos.setDiscoveryTimeoutMs(1000);

        testProxy = testProxyBuilder->setMessagingQos(MessagingQos(MESSAGINGQOS_TTL))
                            ->setDiscoveryQos(discoveryQos)
                            ->build();
    }
Ejemplo n.º 15
0
TEST_F(End2EndBroadcastTest, subscribeAndUnsubscribeFromBroadcast_OneOutput) {

    MockGpsSubscriptionListener* mockListener = new MockGpsSubscriptionListener();

    // Use a semaphore to count and wait on calls to the mock listener
    EXPECT_CALL(*mockListener, onReceive(Eq(gpsLocation2)))
            .WillOnce(ReleaseSemaphore(&semaphore));

    EXPECT_CALL(*mockListener, onReceive(Eq(gpsLocation3)))
            .Times(0);

    std::shared_ptr<ISubscriptionListener<types::Localisation::GpsLocation> > subscriptionListener(
                    mockListener);

    std::shared_ptr<MyTestProvider> testProvider(new MyTestProvider());
    runtime1->registerProvider<tests::testProvider>(domainName, testProvider);

    //This wait is necessary, because registerProvider is async, and a lookup could occur
    // before the register has finished.
    QThreadSleep::msleep(registerProviderWait);

    ProxyBuilder<tests::testProxy>* testProxyBuilder
            = runtime2->createProxyBuilder<tests::testProxy>(domainName);
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    discoveryQos.setDiscoveryTimeout(1000);
    discoveryQos.setRetryInterval(250);

    qlonglong qosRoundTripTTL = 500;

    // Send a message and expect to get a result
    QSharedPointer<tests::testProxy> testProxy(testProxyBuilder
                                               ->setMessagingQos(MessagingQos(qosRoundTripTTL))
                                               ->setCached(false)
                                               ->setDiscoveryQos(discoveryQos)
                                               ->build());

    int64_t minInterval_ms = 50;
    OnChangeSubscriptionQos subscriptionQos(
                500000,   // validity_ms
                minInterval_ms);  // minInterval_ms

    std::string subscriptionId = testProxy->subscribeToLocationUpdateBroadcast(subscriptionListener, subscriptionQos);

    // This wait is necessary, because subcriptions are async, and a broadcast could occur
    // before the subscription has started.
    QThreadSleep::msleep(subscribeToBroadcastWait);

    testProvider->fireLocationUpdate(gpsLocation2);

//     Wait for a subscription message to arrive
    ASSERT_TRUE(semaphore.tryAcquire(1, 3000));

    // Waiting between broadcast occurences for at least the minInterval is neccessary because
    // otherwise the publications could be omitted.
    QThreadSleep::msleep(minInterval_ms);


    testProxy->unsubscribeFromLocationUpdateBroadcast(subscriptionId);

    testProvider->fireLocationUpdate(gpsLocation3);
//     Wait for a subscription message to arrive
    ASSERT_FALSE(semaphore.tryAcquire(1, 2000));
}
Ejemplo n.º 16
0
TEST_F(End2EndBroadcastTest, subscribeToSelectiveBroadcast_FilterFail) {

    MockGpsSubscriptionListener* mockListener = new MockGpsSubscriptionListener();

    // Use a semaphore to count and wait on calls to the mock listener
    EXPECT_CALL(*mockListener, onReceive(A<const types::Localisation::GpsLocation&>())).
            WillRepeatedly(ReleaseSemaphore(&semaphore));

    std::shared_ptr<ISubscriptionListener<types::Localisation::GpsLocation> > subscriptionListener(
                    mockListener);

    ON_CALL(*filter, filter(_, Eq(filterParameters))).WillByDefault(Return(false));

    std::shared_ptr<MyTestProvider> testProvider(new MyTestProvider());
    testProvider->addBroadcastFilter(filter);
    runtime1->registerProvider<tests::testProvider>(domainName, testProvider);

    //This wait is necessary, because registerProvider is async, and a lookup could occur
    // before the register has finished.
    QThreadSleep::msleep(registerProviderWait);

    ProxyBuilder<tests::testProxy>* testProxyBuilder
            = runtime2->createProxyBuilder<tests::testProxy>(domainName);
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    discoveryQos.setDiscoveryTimeout(1000);
    discoveryQos.setRetryInterval(250);

    qlonglong qosRoundTripTTL = 500;

    // Send a message and expect to get a result
    QSharedPointer<tests::testProxy> testProxy(testProxyBuilder
                                               ->setMessagingQos(MessagingQos(qosRoundTripTTL))
                                               ->setCached(false)
                                               ->setDiscoveryQos(discoveryQos)
                                               ->build());

    int64_t minInterval_ms = 50;
    OnChangeSubscriptionQos subscriptionQos(
                500000,   // validity_ms
                minInterval_ms);  // minInterval_ms

    testProxy->subscribeToLocationUpdateSelectiveBroadcast(
                filterParameters,
                subscriptionListener,
                subscriptionQos);

    waitForBroadcastSubscriptionArrivedAtProvider(testProvider, "locationUpdateSelective");

    // Change the location 3 times

    testProvider->fireLocationUpdate(gpsLocation2);

    // Wait for a subscription message to arrive
    ASSERT_FALSE(semaphore.tryAcquire(1, 500));

    // Waiting between broadcast occurences for at least the minInterval is neccessary because
    // otherwise the publications could be omitted.
    QThreadSleep::msleep(minInterval_ms);

    testProvider->fireLocationUpdateSelective(gpsLocation3);

    // Wait for a subscription message to arrive
    ASSERT_FALSE(semaphore.tryAcquire(1, 500));

    // Waiting between broadcast occurences for at least the minInterval is neccessary because
    // otherwise the publications could be omitted.
    QThreadSleep::msleep(minInterval_ms);

    testProvider->fireLocationUpdateSelective(gpsLocation4);

    // Wait for a subscription message to arrive
    ASSERT_FALSE(semaphore.tryAcquire(1, 500));

    delete testProxyBuilder;
}
Ejemplo n.º 17
0
TEST_F(End2EndBroadcastTest, subscribeToBroadcastWithSameNameAsAttribute) {

    MockGpsSubscriptionListener* mockListenerAttribute = new MockGpsSubscriptionListener();
    MockGpsSubscriptionListener* mockListenerBroadcast = new MockGpsSubscriptionListener();

    // Use a semaphore to count and wait on calls to the mock listener

    // Expect initial attribute publication with default value
    EXPECT_CALL(*mockListenerAttribute, onReceive(Eq(gpsLocation))).
            WillRepeatedly(ReleaseSemaphore(&semaphore));

    EXPECT_CALL(*mockListenerAttribute, onReceive(Eq(gpsLocation2))).
            WillRepeatedly(ReleaseSemaphore(&semaphore));

    EXPECT_CALL(*mockListenerBroadcast, onReceive(Eq(gpsLocation3))).
            WillRepeatedly(ReleaseSemaphore(&semaphore));

    std::shared_ptr<ISubscriptionListener<types::Localisation::GpsLocation> > subscriptionListenerAttribute(
                    mockListenerAttribute);

    std::shared_ptr<ISubscriptionListener<types::Localisation::GpsLocation> > subscriptionListenerBroadcast(
                    mockListenerBroadcast);

    std::shared_ptr<MyTestProvider> testProvider(new MyTestProvider());
    runtime1->registerProvider<tests::testProvider>(domainName, testProvider);

    //This wait is necessary, because registerProvider is async, and a lookup could occur
    // before the register has finished.
    QThreadSleep::msleep(registerProviderWait);

    ProxyBuilder<tests::testProxy>* testProxyBuilder
            = runtime2->createProxyBuilder<tests::testProxy>(domainName);
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
    discoveryQos.setDiscoveryTimeout(1000);
    discoveryQos.setRetryInterval(250);

    qlonglong qosRoundTripTTL = 500;

    // Send a message and expect to get a result
    QSharedPointer<tests::testProxy> testProxy(testProxyBuilder
                                               ->setMessagingQos(MessagingQos(qosRoundTripTTL))
                                               ->setCached(false)
                                               ->setDiscoveryQos(discoveryQos)
                                               ->build());

    int64_t minInterval_ms = 50;
    OnChangeSubscriptionQos subscriptionQos(
                500000,   // validity_ms
                minInterval_ms);  // minInterval_ms

    testProxy->subscribeToLocation(
                subscriptionListenerAttribute,
                subscriptionQos);

    testProxy->subscribeToLocationBroadcast(
                subscriptionListenerBroadcast,
                subscriptionQos);

    waitForAttributeSubscriptionArrivedAtProvider(testProvider, "location");
    waitForBroadcastSubscriptionArrivedAtProvider(testProvider, "location");

    // Initial attribute publication
    ASSERT_TRUE(semaphore.tryAcquire(1, 500));

    QThreadSleep::msleep(minInterval_ms); //ensure to wait for the minInterval_ms before changing location

    // Change attribute
    testProvider->locationChanged(gpsLocation2);

    // Wait for a subscription message to arrive
    ASSERT_TRUE(semaphore.tryAcquire(1, 500));

    // Emit broadcast
    testProvider->fireLocation(gpsLocation3);

    // Wait for a subscription message to arrive
    ASSERT_TRUE(semaphore.tryAcquire(1, 500));

    delete testProxyBuilder;
}
Ejemplo n.º 18
0
    SystemServicesDiscoveryTest()
            : settingsFilename("test-resources/SystemServicesDiscoveryTest.settings"),
              settings(std::make_unique<Settings>(settingsFilename)),
              discoveryDomain(),
              discoveryProviderParticipantId(),
              runtime(),
              mockMessageReceiverHttp(std::make_shared<MockTransportMessageReceiver>()),
              mockMessageReceiverMqtt(std::make_shared<MockTransportMessageReceiver>()),
              mockMessageSenderMqtt(std::make_shared<MockTransportMessageSender>()),
              discoveryQos(),
              discoveryProxyBuilder(nullptr),
              discoveryProxy(nullptr),
              lastSeenDateMs(-1),
              expiryDateMs(-1),
              publicKeyId(""),
              globalMqttTopic("mqtt_SystemServicesDiscoveryTest.topic"),
              globalMqttBrokerUrl("mqtt_SystemServicesDiscoveryTest.brokerUrl"),
              mqttGlobalAddress(globalMqttBrokerUrl, globalMqttTopic)
    {
        SystemServicesSettings systemSettings(*settings);
        systemSettings.printSettings();
        discoveryDomain = systemSettings.getDomain();
        discoveryProviderParticipantId = systemSettings.getCcDiscoveryProviderParticipantId();

        discoveryQos.setCacheMaxAgeMs(1000);
        discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
        discoveryQos.addCustomParameter("fixedParticipantId", discoveryProviderParticipantId);
        discoveryQos.setDiscoveryTimeoutMs(50);

        std::string httpChannelId("http_SystemServicesDiscoveryTest.ChannelId");
        std::string httpEndPointUrl("http_SystemServicesRoutingTest.endPointUrl");

        using system::RoutingTypes::ChannelAddress;

        std::string serializedChannelAddress =
                joynr::serializer::serializeToJson(ChannelAddress(httpEndPointUrl, httpChannelId));
        std::string serializedMqttAddress =
                joynr::serializer::serializeToJson(mqttGlobalAddress);

        EXPECT_CALL(*(std::dynamic_pointer_cast<MockTransportMessageReceiver>(
                              mockMessageReceiverHttp).get()),
                    getSerializedGlobalClusterControllerAddress())
                .WillRepeatedly(Return(serializedChannelAddress));
        EXPECT_CALL(
                *(std::dynamic_pointer_cast<MockTransportMessageReceiver>(mockMessageReceiverMqtt)),
                getSerializedGlobalClusterControllerAddress())
                .WillRepeatedly(Return(serializedMqttAddress));
        EXPECT_CALL(
                *(std::dynamic_pointer_cast<MockTransportMessageReceiver>(mockMessageReceiverMqtt)),
                getGlobalClusterControllerAddress())
                .WillRepeatedly(ReturnRef(mqttGlobalAddress));

        // runtime can only be created, after MockCommunicationManager has been told to return
        // a channelId for getReceiveChannelId.
        runtime = std::make_shared<JoynrClusterControllerRuntime>(std::move(settings),
                                                                  nullptr,
                                                                  nullptr,
                                                                  mockMessageReceiverHttp,
                                                                  nullptr,
                                                                  mockMessageReceiverMqtt,
                                                                  mockMessageSenderMqtt);
        // discovery provider is normally registered in JoynrClusterControllerRuntime::create
        runtime->init();

        discoveryProxyBuilder =
                runtime->createProxyBuilder<joynr::system::DiscoveryProxy>(discoveryDomain);
    }
Ejemplo n.º 19
0
void LibJoynrRuntime::init(
        std::unique_ptr<IMiddlewareMessagingStubFactory> middlewareMessagingStubFactory,
        std::shared_ptr<const joynr::system::RoutingTypes::Address> libjoynrMessagingAddress,
        std::shared_ptr<const joynr::system::RoutingTypes::Address> ccMessagingAddress)
{
    // create messaging stub factory
    auto messagingStubFactory = std::make_unique<MessagingStubFactory>();
    messagingStubFactory->registerStubFactory(std::move(middlewareMessagingStubFactory));
    messagingStubFactory->registerStubFactory(std::make_unique<InProcessMessagingStubFactory>());

    // create message router
    messageRouter = std::make_shared<MessageRouter>(
            std::move(messagingStubFactory), libjoynrMessagingAddress);

    startLibJoynrMessagingSkeleton(*messageRouter);

    joynrMessageSender = new JoynrMessageSender(messageRouter);
    joynrDispatcher = new Dispatcher(joynrMessageSender);
    joynrMessageSender->registerDispatcher(joynrDispatcher);

    // create the inprocess skeleton for the dispatcher
    dispatcherMessagingSkeleton =
            std::make_shared<InProcessLibJoynrMessagingSkeleton>(joynrDispatcher);
    dispatcherAddress = std::make_shared<InProcessMessagingAddress>(dispatcherMessagingSkeleton);

    publicationManager = new PublicationManager();
    subscriptionManager = new SubscriptionManager();
    inProcessDispatcher = new InProcessDispatcher();

    inProcessPublicationSender = new InProcessPublicationSender(subscriptionManager);
    inProcessConnectorFactory = new InProcessConnectorFactory(
            subscriptionManager,
            publicationManager,
            inProcessPublicationSender,
            dynamic_cast<IRequestCallerDirectory*>(inProcessDispatcher));
    joynrMessagingConnectorFactory =
            new JoynrMessagingConnectorFactory(joynrMessageSender, subscriptionManager);

    auto connectorFactory = std::make_unique<ConnectorFactory>(
            inProcessConnectorFactory, joynrMessagingConnectorFactory);
    proxyFactory = new ProxyFactory(libjoynrMessagingAddress, std::move(connectorFactory), nullptr);

    // Set up the persistence file for storing provider participant ids
    std::string persistenceFilename = libjoynrSettings->getParticipantIdsPersistenceFilename();
    participantIdStorage = std::make_shared<ParticipantIdStorage>(persistenceFilename);

    // initialize the dispatchers
    std::vector<IDispatcher*> dispatcherList;
    dispatcherList.push_back(inProcessDispatcher);
    dispatcherList.push_back(joynrDispatcher);

    joynrDispatcher->registerPublicationManager(publicationManager);
    joynrDispatcher->registerSubscriptionManager(subscriptionManager);

    discoveryProxy = std::make_unique<LocalDiscoveryAggregator>(systemServicesSettings);
    requestCallerDirectory = dynamic_cast<IRequestCallerDirectory*>(inProcessDispatcher);

    std::string systemServicesDomain = systemServicesSettings.getDomain();
    std::string routingProviderParticipantId =
            systemServicesSettings.getCcRoutingProviderParticipantId();

    DiscoveryQos routingProviderDiscoveryQos;
    routingProviderDiscoveryQos.setCacheMaxAgeMs(1000);
    routingProviderDiscoveryQos.setArbitrationStrategy(
            DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
    routingProviderDiscoveryQos.addCustomParameter(
            "fixedParticipantId", routingProviderParticipantId);
    routingProviderDiscoveryQos.setDiscoveryTimeoutMs(50);

    auto routingProxyBuilder =
            createProxyBuilder<joynr::system::RoutingProxy>(systemServicesDomain);
    auto routingProxy = routingProxyBuilder->setMessagingQos(MessagingQos(10000))
                                ->setCached(false)
                                ->setDiscoveryQos(routingProviderDiscoveryQos)
                                ->build();
    messageRouter->setParentRouter(std::unique_ptr<system::RoutingProxy>(routingProxy),
                                   ccMessagingAddress,
                                   routingProviderParticipantId);
    delete routingProxyBuilder;

    // setup discovery
    std::string discoveryProviderParticipantId =
            systemServicesSettings.getCcDiscoveryProviderParticipantId();
    DiscoveryQos discoveryProviderDiscoveryQos;
    discoveryProviderDiscoveryQos.setCacheMaxAgeMs(1000);
    discoveryProviderDiscoveryQos.setArbitrationStrategy(
            DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
    discoveryProviderDiscoveryQos.addCustomParameter(
            "fixedParticipantId", discoveryProviderParticipantId);
    discoveryProviderDiscoveryQos.setDiscoveryTimeoutMs(1000);

    ProxyBuilder<joynr::system::DiscoveryProxy>* discoveryProxyBuilder =
            createProxyBuilder<joynr::system::DiscoveryProxy>(systemServicesDomain);
    joynr::system::IDiscoverySync* proxy =
            discoveryProxyBuilder->setMessagingQos(MessagingQos(10000))
                    ->setCached(false)
                    ->setDiscoveryQos(discoveryProviderDiscoveryQos)
                    ->build();
    discoveryProxy->setDiscoveryProxy(std::unique_ptr<joynr::system::IDiscoverySync>(proxy));
    capabilitiesRegistrar = std::make_unique<CapabilitiesRegistrar>(
            dispatcherList,
            *discoveryProxy,
            participantIdStorage,
            dispatcherAddress,
            messageRouter,
            messagingSettings.getDiscoveryEntryExpiryIntervalMs());
}
Ejemplo n.º 20
0
TEST_F(MessageNotificationTest, messageToDisconnectedProviderCausesBroadcast)
{

    // 1. register provider
    auto testProvider = std::make_shared<tests::DefaulttestProvider>();
    joynr::types::ProviderQos providerQos;
    providerQos.setScope(joynr::types::ProviderScope::LOCAL);
    std::string providerParticipantId =
            libjoynrProviderRuntime->registerProvider<tests::testProvider>(
                    testDomain, testProvider, providerQos);

    // 2. create proxy
    DiscoveryQos discoveryQos;
    discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::LAST_SEEN);
    discoveryQos.setDiscoveryScope(joynr::types::DiscoveryScope::LOCAL_ONLY);
    MessagingQos messagingQos;
    messagingQos.setTtl(5000);

    auto testProxyBuilder = libjoynrProxyRuntime->createProxyBuilder<tests::testProxy>(testDomain);

    auto testProxy =
            testProxyBuilder->setMessagingQos(messagingQos)->setDiscoveryQos(discoveryQos)->build();

    Settings settings(settingsPath);
    SystemServicesSettings systemSettings(settings);
    auto messageNotificationProxyBuilder =
            libjoynrProxyRuntime->createProxyBuilder<joynr::system::MessageNotificationProxy>(
                    systemSettings.getDomain());

    DiscoveryQos messagingNotificationDiscoveryQos;
    messagingNotificationDiscoveryQos.setArbitrationStrategy(
            DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
    messagingNotificationDiscoveryQos.addCustomParameter(
            "fixedParticipantId", systemSettings.getCcMessageNotificationProviderParticipantId());
    messagingNotificationDiscoveryQos.setDiscoveryScope(joynr::types::DiscoveryScope::LOCAL_ONLY);

    auto messageNotificationProxy = messageNotificationProxyBuilder->setMessagingQos(messagingQos)
                                            ->setDiscoveryQos(messagingNotificationDiscoveryQos)
                                            ->build();

    // 3. subscribe to message notification broadcast
    auto mockListener = std::make_shared<MockSubscriptionListener>();
    EXPECT_CALL(*mockListener, onSubscribed(_)).Times(1);
    EXPECT_CALL(*mockListener, onError(_)).Times(0);

    joynr::system::MessageNotificationMessageQueuedForDeliveryBroadcastFilterParameters
            filterParameters;
    filterParameters.setParticipantId(providerParticipantId);

    auto future = messageNotificationProxy->subscribeToMessageQueuedForDeliveryBroadcast(
            filterParameters, mockListener, std::make_shared<OnChangeSubscriptionQos>());
    std::string subscriptionId;
    future->get(subscriptionId);

    // 4. disconnect provider runtime
    libjoynrProviderRuntime->shutdown();
    libjoynrProviderRuntime.reset();

    // 5. execute call on proxy while provider is not connected to cluster-controller

    auto onSuccess = [](const std::int32_t&) { FAIL(); };

    auto onError = [](const joynr::exceptions::JoynrRuntimeException&) {};

    EXPECT_CALL(*mockListener, onReceive(Eq(providerParticipantId), _))
            .WillOnce(ReleaseSemaphore(&semaphore));

    testProxy->addNumbersAsync(1, 2, 3, onSuccess, onError);

    // 6. wait for a broadcast message to arrive
    ASSERT_TRUE(semaphore.waitFor(std::chrono::seconds(3)));
    messageNotificationProxy->unsubscribeFromMessageQueuedForDeliveryBroadcast(subscriptionId);
}