~SystemServicesRoutingTest(){
     runtime->deleteChannel();
     runtime->stopMessaging();
     delete runtime;
     delete settings;
     QFile::remove(settingsFilename);
 }
 ~JoynrClusterControllerRuntimeTest(){
     if (runtime) {
         runtime->deleteChannel();
         runtime->stopMessaging();
         delete runtime;
     }
 }
Пример #3
0
    void TearDown() {
        bool deleteChannel = true;
        runtime1->stop(deleteChannel);
        runtime2->stop(deleteChannel);

        // Delete the persisted participant ids so that each test uses different participant ids
        std::remove(LibjoynrSettings::DEFAULT_PARTICIPANT_IDS_PERSISTENCE_FILENAME().c_str());
    }
void JoynrClusterControllerRuntimeTest::startMessagingDoesNotThrow() {
    EXPECT_CALL(*mockHttpMessageReceiver, startReceiveQueue())
            .Times(1);
    EXPECT_CALL(*mockHttpMessageReceiver, stopReceiveQueue())
            .Times(1);

    ASSERT_TRUE(runtime != nullptr);
    runtime->startMessaging();
    runtime->stopMessaging();
}
JoynrClusterControllerRuntime* JoynrClusterControllerRuntime::create(Settings* settings)
{
    // Only allow one QCoreApplication instance
    static int argc = 0;
    static char* argv[] = {nullptr};
    static QCoreApplication* coreApplication =
            (QCoreApplication::instance() == nullptr) ? new QCoreApplication(argc, argv) : nullptr;

    JoynrClusterControllerRuntime* runtime =
            new JoynrClusterControllerRuntime(coreApplication, settings);
    runtime->start();
    return runtime;
}
    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();
    }
Пример #7
0
    // Tears down the test fixture.
    void TearDown(){
        bool deleteChannel = true;
        runtime->stop(deleteChannel);

        // Remove participant id persistence file
        std::remove(LibjoynrSettings::DEFAULT_PARTICIPANT_IDS_PERSISTENCE_FILENAME().c_str());
        std::this_thread::sleep_for(std::chrono::milliseconds(550));
    }
Пример #8
0
    // Tears down the test fixture.
    void TearDown(){
        bool deleteChannel = true;
        runtime->stop(deleteChannel);

        // Remove participant id persistence file
        QFile::remove(LibjoynrSettings::DEFAULT_PARTICIPANT_IDS_PERSISTENCE_FILENAME());
        QThreadSleep::msleep(550);
    }
Пример #9
0
int main(int argc, char* argv[])
{
    // init a logger
    Logger logger("Runtime");

    // Check the usage
    std::string programName(argv[0]);
    if (argc == 1) {
        JOYNR_LOG_INFO(logger, "USAGE: No settings provided. Starting with default settings.");
        JOYNR_LOG_INFO(logger, "USAGE: {}  <file.settings>...", programName);
    }

    // Object that holds all the settings
    Settings settings;

    // Merge all the settings files into the settings object
    for (int i = 1; i < argc; i++) {

        std::string settingsFileName(argv[i]);

        // Read the settings file
        JOYNR_LOG_INFO(logger, "Loading settings file: {}", settingsFileName);
        Settings currentSettings(settingsFileName);

        // Check for errors
        if (!currentSettings.isLoaded()) {
            JOYNR_LOG_FATAL(logger, "Settings file \"{}\" doesn't exist.", settingsFileName);
            return 1;
        }

        // Merge
        Settings::merge(currentSettings, settings, true);
    }

    // create the cluster controller runtime
    JoynrClusterControllerRuntime* clusterControllerRuntime =
            JoynrClusterControllerRuntime::create(&settings);

    // run the cluster controller forever
    clusterControllerRuntime->runForever();
}
Пример #10
0
    LibJoynrRuntimeTest() :
            settingsFilename("test-resources/integrationtest.settings"),
            temporarylibjoynrSettingsFilename("test-resouces/LibJoynrRuntimeTest.libjoynr.settings"),
            settings(settingsFilename),
            mockMessageReceiver(new MockMessageReceiver()),
            mockMessageSender(new MockMessageSender()),
            ccRuntime(NULL),
            runtime(NULL),
            routingProxyBuilder(NULL),
            routingProxy(NULL),
            mockTestProviderQos(
                std::vector<joynr::types::CustomParameter>(), // custom provider parameters
                1,                                      // version
                1,                                      // priority
                joynr::types::ProviderScope::LOCAL,     // visibilitiy scope
                false                                   // supports on change subscriptions
            ),
            mockTestProvider(),
            discoveryProxyBuilder(NULL),
            discoveryProxy(NULL)
    {
        std::string channelId("LibJoynrRuntimeTest.ChannelId");

        //runtime can only be created, after MockMessageReceiver has been told to return
        //a channelId for getReceiveChannelId.
        EXPECT_CALL(*mockMessageReceiver, getReceiveChannelId())
                .WillRepeatedly(::testing::ReturnRefOfCopy(channelId));

        ccRuntime = new JoynrClusterControllerRuntime(
                    NULL,
                    new Settings(settingsFilename),
                    mockMessageReceiver,
                    mockMessageSender
        );
        // routing provider is normally registered in JoynrClusterControllerRuntime::create
        ccRuntime->registerRoutingProvider();
        // discovery provider is normally registered in JoynrClusterControllerRuntime::create
        ccRuntime->registerDiscoveryProvider();
    }
Пример #11
0
 void TearDown() {
     bool deleteChannel = true;
     runtime->stop(deleteChannel);
 }
Пример #12
0
 void SetUp() {
     runtime->start();
 }
Пример #13
0
 ~LibJoynrRuntimeTest() {
     ccRuntime->deleteChannel();
     ccRuntime->stopMessaging();
     delete ccRuntime;
 }
Пример #14
0
 void SetUp() {
     runtime1->start();
     runtime2->start();
 }