End2EndSubscriptionTest() :
        runtime1(nullptr),
        runtime2(nullptr),
        settings1("test-resources/SystemIntegrationTest1.settings"),
        settings2("test-resources/SystemIntegrationTest2.settings"),
        messagingSettings1(settings1),
        messagingSettings2(settings2),
        baseUuid(Util::createUuid()),
        uuid( "_" + baseUuid.substr(1, baseUuid.length()-2)),
        domainName("cppEnd2EndSubscriptionTest_Domain" + uuid),
        semaphore(0),
        registerProviderWait(1000),
        subscribeToAttributeWait(2000)

    {
        messagingSettings1.setMessagingPropertiesPersistenceFilename(
                    messagingPropertiesPersistenceFileName1);
        messagingSettings2.setMessagingPropertiesPersistenceFilename(
                    messagingPropertiesPersistenceFileName2);

        Settings* settings_1 = new Settings("test-resources/SystemIntegrationTest1.settings");
        Settings integration1Settings{"test-resources/libjoynrSystemIntegration1.settings"};
        Settings::merge(integration1Settings, *settings_1, false);

        runtime1 = new JoynrClusterControllerRuntime(nullptr, settings_1);

        Settings* settings_2 = new Settings("test-resources/SystemIntegrationTest2.settings");
        Settings integration2Settings{"test-resources/libjoynrSystemIntegration2.settings"};
        Settings::merge(integration2Settings, *settings_2, false);

        runtime2 = new JoynrClusterControllerRuntime(nullptr, settings_2);
    }
 CapabilitiesClientTest() :
     logger(joynr_logging::Logging::getInstance()->getLogger("TEST", "CapabilitiesClientTest")),
     runtime(NULL),
     settings(settingsFilename, QSettings::IniFormat),
     messagingSettings(settings)
 {
     messagingSettings.setMessagingPropertiesPersistenceFilename(messagingPropertiesPersistenceFileName);
     MessagingPropertiesPersistence storage(messagingSettings.getMessagingPropertiesPersistenceFilename());
     channelId = storage.getChannelId().toStdString();
     QSettings* settings = SettingsMerger::mergeSettings(settingsFilename);
     SettingsMerger::mergeSettings(libJoynrSettingsFilename, settings);
     runtime = new JoynrClusterControllerRuntime(NULL, settings);
 }
    CapabilitiesClientTest() :
        runtime(nullptr),
        settings(settingsFilename),
        messagingSettings(settings)
    {
        messagingSettings.setMessagingPropertiesPersistenceFilename(messagingPropertiesPersistenceFileName);
        MessagingPropertiesPersistence storage(messagingSettings.getMessagingPropertiesPersistenceFilename());
        channelId = storage.getChannelId();
        Settings* settings = new Settings(settingsFilename);
        Settings libjoynrSettings{libJoynrSettingsFilename};
        Settings::merge(libjoynrSettings, *settings, false);

        runtime = new JoynrClusterControllerRuntime(nullptr, settings);
    }
void ChannelUrlSelector::init(
        QSharedPointer<ILocalChannelUrlDirectory> channelUrlDirectory,
        const MessagingSettings &settings) {

    this->channelUrlDirectory = channelUrlDirectory;
    channelUrlDirectoryUrl = settings.getChannelUrlDirectoryUrl();
}
Beispiel #5
0
MqttReceiver::MqttReceiver(const MessagingSettings& settings)
        : channelCreatedSemaphore(new joynr::Semaphore(0)),
          isChannelCreated(false),
          channelIdForMqttTopic(),
          globalClusterControllerAddress(),
          receiverId(),
          settings(settings),
          mosquittoSubscriber(settings.getBrokerUrl(),
                              globalClusterControllerAddress,
                              channelCreatedSemaphore),
          mqttSettings()
{
    MessagingPropertiesPersistence persist(settings.getMessagingPropertiesPersistenceFilename());

    channelIdForMqttTopic = persist.getChannelId();
    std::string brokerUri =
            "tcp://" + settings.getBrokerUrl().getBrokerChannelsBaseUrl().getHost() + ":" +
            std::to_string(settings.getBrokerUrl().getBrokerChannelsBaseUrl().getPort());
    system::RoutingTypes::MqttAddress receiveMqttAddress(brokerUri, channelIdForMqttTopic);
    globalClusterControllerAddress = JsonSerializer::serialize(receiveMqttAddress);
    receiverId = persist.getReceiverId();

    mosquittoSubscriber.registerChannelId(channelIdForMqttTopic);
}
Beispiel #6
0
    MessagingTest() :
        settingsFileName("MessagingTest.settings"),
        settings(settingsFileName),
        messagingSettings(settings),
        senderId("senderParticipantId"),
        senderChannelId("senderChannelId"),
        receiverId("receiverParticipantId"),
        receiverChannelId("receiverChannelId"),
        request(),
        requestId("requestId"),
        qos(),
        inProcessMessagingSkeleton(new MockInProcessMessagingSkeleton()),
        semaphore(0),
        messageFactory(),
        mockMessageReceiver(new MockMessageReceiver()),
        mockMessageSender(new MockMessageSender()),
        messagingStubFactory(new MessagingStubFactory()),
        messageRouter(new MessageRouter(messagingStubFactory, nullptr))
    {
        // provision global capabilities directory
        std::shared_ptr<joynr::system::RoutingTypes::Address> addressCapabilitiesDirectory(
            new system::RoutingTypes::ChannelAddress(
                        messagingSettings.getCapabilitiesDirectoryChannelId())
        );
        messageRouter->addProvisionedNextHop(messagingSettings.getCapabilitiesDirectoryParticipantId(), addressCapabilitiesDirectory);
        // provision channel url directory
        std::shared_ptr<joynr::system::RoutingTypes::Address> addressChannelUrlDirectory(
            new system::RoutingTypes::ChannelAddress(
                        messagingSettings.getChannelUrlDirectoryChannelId())
        );
        messageRouter->addProvisionedNextHop(messagingSettings.getChannelUrlDirectoryParticipantId(), addressChannelUrlDirectory);
        messagingStubFactory->registerStubFactory(new JoynrMessagingStubFactory(mockMessageSender, senderChannelId));
        messagingStubFactory->registerStubFactory(new InProcessMessagingStubFactory());

        qos.setTtl(10000);
    }
    End2EndBroadcastTest() :
        qRegisterMetaTypeQos(),
//        qRegisterMetaTypeCi(),
        runtime1(NULL),
        runtime2(NULL),
        settings1("test-resources/SystemIntegrationTest1.settings", QSettings::IniFormat),
        settings2("test-resources/SystemIntegrationTest2.settings", QSettings::IniFormat),
        messagingSettings1(settings1),
        messagingSettings2(settings2),
        baseUuid(TypeUtil::toStd(QUuid::createUuid().toString())),
        uuid( "_" + baseUuid.substr(1, baseUuid.length()-2)),
        domainName("cppEnd2EndBroadcastTest_Domain" + uuid),
        semaphore(0),
        altSemaphore(0),
        filter(new MockLocationUpdatedSelectiveFilter),
        registerProviderWait(1000),
        subscribeToAttributeWait(2000),
        subscribeToBroadcastWait(2000),
        gpsLocation(types::Localisation::GpsLocation()),
        gpsLocation2(types::Localisation::GpsLocation(
                         9.0,
                         51.0,
                         508.0,
                         types::Localisation::GpsFixEnum::MODE2D,
                         0.0,
                         0.0,
                         0.0,
                         0.0,
                         444,
                         444,
                         2)),
        gpsLocation3(types::Localisation::GpsLocation(
                         9.0,
                         51.0,
                         508.0,
                         types::Localisation::GpsFixEnum::MODE2D,
                         0.0,
                         0.0,
                         0.0,
                         0.0,
                         444,
                         444,
                         3)),
        gpsLocation4(types::Localisation::GpsLocation(
                         9.0,
                         51.0,
                         508.0,
                         types::Localisation::GpsFixEnum::MODE2D,
                         0.0,
                         0.0,
                         0.0,
                         0.0,
                         444,
                         444,
                         4))

    {
        messagingSettings1.setMessagingPropertiesPersistenceFilename(
                    messagingPropertiesPersistenceFileName1);
        messagingSettings2.setMessagingPropertiesPersistenceFilename(
                    messagingPropertiesPersistenceFileName2);

        QSettings* settings_1 = SettingsMerger::mergeSettings(
                    QString("test-resources/SystemIntegrationTest1.settings"));
        SettingsMerger::mergeSettings(
                    QString("test-resources/libjoynrSystemIntegration1.settings"),
                    settings_1);
        runtime1 = new JoynrClusterControllerRuntime(NULL, settings_1);
        QSettings* settings_2 = SettingsMerger::mergeSettings(
                    QString("test-resources/SystemIntegrationTest2.settings"));
        SettingsMerger::mergeSettings(
                    QString("test-resources/libjoynrSystemIntegration2.settings"),
                    settings_2);
        runtime2 = new JoynrClusterControllerRuntime(NULL, settings_2);

        filterParameters.setCountry("Germany");
        filterParameters.setStartTime("4.00 pm");
    }