summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt76
-rw-r--r--test/application_tests/application_test.cpp15
-rw-r--r--test/application_tests/application_test_client.cpp193
-rw-r--r--test/application_tests/application_test_daemon.cpp34
-rw-r--r--test/application_tests/application_test_globals.hpp25
-rw-r--r--test/application_tests/application_test_service.cpp115
-rw-r--r--test/application_tests/application_test_single_process.cpp47
-rw-r--r--test/application_tests/application_test_single_process.json14
-rwxr-xr-xtest/application_tests/application_test_single_process_starter.sh23
-rw-r--r--test/application_tests/conf/application_test.json.in (renamed from test/application_tests/application_test.json)2
-rw-r--r--test/application_tests/conf/application_test_daemon.json.in (renamed from test/application_tests/application_test_daemon.json)2
-rw-r--r--test/application_tests/conf/application_test_no_dispatch_threads.json.in (renamed from test/application_tests/application_test_no_dispatch_threads.json)2
-rw-r--r--test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in (renamed from test/application_tests/application_test_no_dispatch_threads_daemon.json)2
-rw-r--r--test/big_payload_tests/big_payload_test_client.cpp7
-rw-r--r--test/big_payload_tests/big_payload_test_service.cpp9
-rw-r--r--test/client_id_tests/client_id_test_service.cpp41
-rw-r--r--test/configuration_tests/configuration-test-deprecated.json16
-rw-r--r--test/configuration_tests/configuration-test.cpp302
-rw-r--r--test/cpu_load_tests/cpu_load_test_client.cpp11
-rw-r--r--test/cpu_load_tests/cpu_load_test_service.cpp11
-rw-r--r--test/header_factory_tests/header_factory_test_client.cpp12
-rw-r--r--test/header_factory_tests/header_factory_test_service.cpp9
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in10
-rw-r--r--test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in10
-rw-r--r--test/initial_event_tests/initial_event_test_availability_checker.cpp6
-rw-r--r--test/initial_event_tests/initial_event_test_client.cpp55
-rwxr-xr-xtest/initial_event_tests/initial_event_test_master_starter.sh70
-rw-r--r--test/initial_event_tests/initial_event_test_service.cpp5
-rwxr-xr-xtest/initial_event_tests/initial_event_test_slave_starter.sh35
-rw-r--r--test/initial_event_tests/initial_event_test_stop_service.cpp7
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_client.cpp6
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_service.cpp6
-rw-r--r--test/offer_tests/offer_test_client.cpp7
-rw-r--r--test/offer_tests/offer_test_globals.hpp6
-rw-r--r--test/offer_tests/offer_test_service.cpp6
-rw-r--r--test/offer_tests/offer_test_service_external.cpp26
-rw-r--r--test/payload_tests/payload_test_client.cpp11
-rw-r--r--test/payload_tests/payload_test_client.hpp1
-rw-r--r--test/payload_tests/payload_test_service.cpp11
-rw-r--r--test/routing_tests/conf/external_local_routing_test_client_external.json.in5
-rw-r--r--test/routing_tests/conf/external_local_routing_test_service.json.in1
-rwxr-xr-xtest/routing_tests/conf/local_routing_test_starter.sh.bat.in (renamed from test/routing_tests/local_routing_test_starter.sh)2
-rwxr-xr-xtest/routing_tests/conf/local_routing_test_starter.sh.in79
-rw-r--r--test/routing_tests/external_local_routing_test_service.cpp9
-rw-r--r--test/routing_tests/local_routing_test_client.cpp12
-rw-r--r--test/routing_tests/local_routing_test_client.json3
-rw-r--r--test/routing_tests/local_routing_test_service.cpp9
-rw-r--r--test/routing_tests/local_routing_test_service.json1
-rw-r--r--test/someip_test_globals.hpp4
-rw-r--r--test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in8
-rw-r--r--test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in8
-rw-r--r--test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp6
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in8
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in8
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_service.cpp6
77 files changed, 1250 insertions, 361 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 358154c..e84e1a4 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -73,6 +73,7 @@ if(NOT ${TESTS_BAT})
add_executable(${TEST_CONFIGURATION} configuration_tests/configuration-test.cpp)
target_link_libraries(${TEST_CONFIGURATION}
vsomeip
+ vsomeip-cfg
${Boost_LIBRARIES}
${DL_LIBRARY}
)
@@ -105,25 +106,56 @@ if(NOT ${TESTS_BAT})
${TEST_LINK_LIBRARIES}
)
+ set(TEST_APPLICATION_SINGLE_PROCESS_NAME ${TEST_APPLICATION}_single_process)
+ add_executable(${TEST_APPLICATION_SINGLE_PROCESS_NAME} application_tests/${TEST_APPLICATION_SINGLE_PROCESS_NAME}.cpp)
+ target_link_libraries(${TEST_APPLICATION_SINGLE_PROCESS_NAME}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ set(TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE ${TEST_APPLICATION}_single_process.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE}
+ ${TEST_APPLICATION}_single_process
+ )
+
set(TEST_APPLICATION_CONFIGURATION_FILE ${TEST_APPLICATION}.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE}
+ @ONLY)
copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE}
${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_CONFIGURATION_FILE}
${TEST_APPLICATION}
)
set(TEST_APPLICATION_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_daemon.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}.in
+ ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}
+ @ONLY)
copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}
${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}
${TEST_APPLICATION}
)
set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE ${TEST_APPLICATION}_no_dispatch_threads.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}
+ @ONLY)
copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}
${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}
${TEST_APPLICATION}
)
set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_no_dispatch_threads_daemon.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}.in
+ ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}
+ @ONLY)
copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}
${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}
${TEST_APPLICATION}
@@ -134,6 +166,12 @@ if(NOT ${TESTS_BAT})
${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER}
${TEST_APPLICATION}
)
+
+ set(TEST_APPLICATION_SINGLE_PROCESS_STARTER ${TEST_APPLICATION}_single_process_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_SINGLE_PROCESS_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_STARTER}
+ ${TEST_APPLICATION}_single_process
+ )
endif()
##############################################################################
# magic-cookies-test-client
@@ -332,6 +370,10 @@ if(NOT ${TESTS_BAT})
# Copy bashscript to start client and server $BUILDDIR/test
set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_LOCAL_ROUTING_STARTER}.in
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER}
+ @ONLY)
copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER}
${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
${TEST_LOCAL_ROUTING_CLIENT}
@@ -445,6 +487,10 @@ else()
# Copy bashscript to start client and server $BUILDDIR/test
set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_LOCAL_ROUTING_STARTER}.bat.in
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER}
+ @ONLY)
copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER}
${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
${TEST_LOCAL_ROUTING_CLIENT}
@@ -1509,6 +1555,7 @@ endif()
if(NOT ${TESTS_BAT})
add_dependencies(${TEST_CONFIGURATION} gtest)
add_dependencies(${TEST_APPLICATION} gtest)
+ add_dependencies(${TEST_APPLICATION_SINGLE_PROCESS_NAME} gtest)
add_dependencies(${TEST_MAGIC_COOKIES_CLIENT} gtest)
add_dependencies(${TEST_MAGIC_COOKIES_SERVICE} gtest)
add_dependencies(${TEST_HEADER_FACTORY} gtest)
@@ -1546,6 +1593,7 @@ endif()
if(NOT ${TESTS_BAT})
add_dependencies(build_tests ${TEST_CONFIGURATION})
add_dependencies(build_tests ${TEST_APPLICATION})
+ add_dependencies(build_tests ${TEST_APPLICATION_SINGLE_PROCESS_NAME})
add_dependencies(build_tests ${TEST_MAGIC_COOKIES_CLIENT})
add_dependencies(build_tests ${TEST_MAGIC_COOKIES_SERVICE})
add_dependencies(build_tests ${TEST_HEADER_FACTORY})
@@ -1595,6 +1643,10 @@ if(NOT ${TESTS_BAT})
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER}
)
set_tests_properties(${TEST_APPLICATION} PROPERTIES TIMEOUT 40)
+ add_test(NAME ${TEST_APPLICATION_SINGLE_PROCESS_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_STARTER}
+ )
+ set_tests_properties(${TEST_APPLICATION_SINGLE_PROCESS_NAME} PROPERTIES TIMEOUT 60)
# magic cookies test
add_test(NAME ${TEST_MAGIC_COOKIES_NAME}
@@ -1745,10 +1797,10 @@ if(NOT ${TESTS_BAT})
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 60)
-# TODO
-# add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp
-# COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
-# set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60)
+
+ add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
+ set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_udp
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
@@ -1765,10 +1817,10 @@ if(NOT ${TESTS_BAT})
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 60)
-# TODO
-# add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp
-# COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
-# set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60)
+
+ add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
+ set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_udp
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
@@ -1777,10 +1829,10 @@ if(NOT ${TESTS_BAT})
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 60)
-# TODO
-# add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp
-# COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE})
-# set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60)
+
+ add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE})
+ set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60)
add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_udp
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID)
diff --git a/test/application_tests/application_test.cpp b/test/application_tests/application_test.cpp
index c73a90f..6832c1f 100644
--- a/test/application_tests/application_test.cpp
+++ b/test/application_tests/application_test.cpp
@@ -24,7 +24,10 @@ public:
protected:
void SetUp() {
app_ = runtime::get()->create_application("application_test");
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&someip_application_test::on_state, this,
@@ -127,7 +130,10 @@ protected:
is_available_ = false;
app_ = runtime::get()->create_application("application_test");
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID,
@@ -179,10 +185,7 @@ protected:
{
(void)_request;
VSOMEIP_INFO << "Shutdown method was called, going down now.";
- app_->unregister_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
- app_->unregister_state_handler();
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/application_tests/application_test_client.cpp b/test/application_tests/application_test_client.cpp
new file mode 100644
index 0000000..a227799
--- /dev/null
+++ b/test/application_tests/application_test_client.cpp
@@ -0,0 +1,193 @@
+// Copyright (C) 2014-2016 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/.
+
+#include <chrono>
+#include <condition_variable>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <thread>
+#include <map>
+#include <algorithm>
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+#include "../../implementation/logging/include/logger.hpp"
+
+#include "application_test_globals.hpp"
+
+class application_test_client {
+public:
+ application_test_client(struct application_test::service_info _service_info) :
+ service_info_(_service_info),
+ app_(vsomeip::runtime::get()->create_application("client")),
+ service_available_(false),
+ wait_until_registered_(true),
+ wait_until_service_available_(true),
+ send_thread_(std::bind(&application_test_client::send, this)),
+ wait_for_stop_(true),
+ stop_thread_(std::bind(&application_test_client::wait_for_stop, this)),
+ received_responses_(0),
+ sent_requests_(0),
+ stop_called_(false) {
+ app_->init();
+ app_->register_state_handler(
+ std::bind(&application_test_client::on_state, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(vsomeip::ANY_SERVICE,
+ vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
+ std::bind(&application_test_client::on_message, this,
+ std::placeholders::_1));
+
+ // register availability for all other services and request their event.
+ app_->register_availability_handler(service_info_.service_id,
+ service_info_.instance_id,
+ std::bind(&application_test_client::on_availability, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3));
+ app_->request_service(service_info_.service_id,
+ service_info_.instance_id);
+ application_thread_ = std::thread([&](){
+ app_->start();
+ });
+ }
+
+ ~application_test_client() {
+ send_thread_.join();
+ stop_thread_.join();
+ application_thread_.join();
+ }
+
+ void on_state(vsomeip::state_type_e _state) {
+ VSOMEIP_INFO << "Application " << app_->get_name() << " is "
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ?
+ "registered." : "deregistered.");
+
+ if (_state == vsomeip::state_type_e::ST_REGISTERED) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_registered_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_availability(vsomeip::service_t _service,
+ vsomeip::instance_t _instance, bool _is_available) {
+ VSOMEIP_INFO << "Service [" << std::setw(4)
+ << std::setfill('0') << std::hex << _service << "." << _instance
+ << "] is " << (_is_available ? "available":"not available") << ".";
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ if(_is_available) {
+ wait_until_service_available_ = false;
+ condition_.notify_one();
+ } else {
+ wait_until_service_available_ = true;
+ condition_.notify_one();
+ }
+ }
+
+ void on_message(const std::shared_ptr<vsomeip::message> &_message) {
+ ++received_responses_;
+ EXPECT_EQ(service_info_.service_id, _message->get_service());
+ EXPECT_EQ(service_info_.method_id, _message->get_method());
+ EXPECT_EQ(service_info_.instance_id, _message->get_instance());
+ VSOMEIP_INFO << "Received a response with Client/Session [" << std::setw(4)
+ << std::setfill('0') << std::hex << _message->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _message->get_session() << "]";
+ }
+
+ void send() {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (wait_until_registered_ && !stop_called_) {
+ condition_.wait_for(its_lock, std::chrono::milliseconds(100));
+ }
+
+ while (wait_until_service_available_ && !stop_called_) {
+ condition_.wait_for(its_lock, std::chrono::milliseconds(100));
+ }
+ its_lock.unlock();
+ its_lock.release();
+
+ for (;;) {
+ bool send(false);
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ send = !wait_until_service_available_;
+ }
+ if (send && !stop_called_) {
+ std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request();
+ its_req->set_service(service_info_.service_id);
+ its_req->set_instance(service_info_.instance_id);
+ its_req->set_method(service_info_.method_id);
+ app_->send(its_req);
+ ++sent_requests_;
+ VSOMEIP_INFO << "Sent a request to the service!";
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ } else {
+ std::this_thread::sleep_for(std::chrono::milliseconds(50));
+ }
+ if(stop_called_) {
+ break;
+ }
+ }
+ }
+
+ void wait_for_stop() {
+ std::unique_lock<std::mutex> its_lock(stop_mutex_);
+ while (wait_for_stop_) {
+ stop_condition_.wait(its_lock);
+ }
+ VSOMEIP_INFO << "going down";
+ app_->clear_all_handler();
+ app_->stop();
+ }
+
+ void stop(bool check) {
+ stop_called_ = true;
+ std::lock_guard<std::mutex> its_lock(stop_mutex_);
+ wait_for_stop_ = false;
+ VSOMEIP_INFO << "going down. Sent " << sent_requests_
+ << " requests and received " << received_responses_
+ << " responses. Delta: " << sent_requests_ - received_responses_;
+ std::uint32_t counter(0);
+ if (check) {
+ if (sent_requests_ == 0 || received_responses_ == 0) {
+ EXPECT_EQ(0, 1);
+ }
+ while(sent_requests_ < received_responses_) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ if(++counter > 50) {
+ break;
+ }
+ }
+ EXPECT_EQ(sent_requests_, received_responses_);
+ }
+ stop_condition_.notify_one();
+ }
+
+private:
+ struct application_test::service_info service_info_;
+ std::shared_ptr<vsomeip::application> app_;
+ bool service_available_;
+
+ bool wait_until_registered_;
+ bool wait_until_service_available_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ std::thread send_thread_;
+
+ bool wait_for_stop_;
+ std::mutex stop_mutex_;
+ std::condition_variable stop_condition_;
+ std::thread stop_thread_;
+
+ std::uint32_t received_responses_;
+ std::uint32_t sent_requests_;
+
+ std::thread application_thread_;
+ bool stop_called_;
+};
diff --git a/test/application_tests/application_test_daemon.cpp b/test/application_tests/application_test_daemon.cpp
new file mode 100644
index 0000000..6e2c7cb
--- /dev/null
+++ b/test/application_tests/application_test_daemon.cpp
@@ -0,0 +1,34 @@
+// Copyright (C) 2014-2016 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/.
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+#include "../../implementation/logging/include/logger.hpp"
+
+class application_test_daemon {
+public:
+ application_test_daemon() :
+ app_(vsomeip::runtime::get()->create_application("daemon")) {
+ app_->init();
+ application_thread_ = std::thread([&](){
+ app_->start();
+ });
+ VSOMEIP_INFO << "Daemon starting";
+ }
+
+ ~application_test_daemon() {
+ application_thread_.join();
+ }
+
+ void stop() {
+ VSOMEIP_INFO << "Daemon stopping";
+ app_->stop();
+ }
+
+private:
+ std::shared_ptr<vsomeip::application> app_;
+ std::thread application_thread_;
+};
diff --git a/test/application_tests/application_test_globals.hpp b/test/application_tests/application_test_globals.hpp
new file mode 100644
index 0000000..ea82255
--- /dev/null
+++ b/test/application_tests/application_test_globals.hpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2014-2016 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 APPLICATION_TEST_GLOBALS_HPP_
+#define APPLICATION_TEST_GLOBALS_HPP_
+
+namespace application_test {
+
+struct service_info {
+ vsomeip::service_t service_id;
+ vsomeip::instance_t instance_id;
+ vsomeip::method_t method_id;
+ vsomeip::event_t event_id;
+ vsomeip::eventgroup_t eventgroup_id;
+ vsomeip::method_t shutdown_method_id;
+};
+
+struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404 };
+
+static constexpr int number_of_messages_to_send = 150;
+}
+
+#endif /* APPLICATION_TEST_GLOBALS_HPP_ */
diff --git a/test/application_tests/application_test_service.cpp b/test/application_tests/application_test_service.cpp
new file mode 100644
index 0000000..a1c654e
--- /dev/null
+++ b/test/application_tests/application_test_service.cpp
@@ -0,0 +1,115 @@
+// Copyright (C) 2014-2016 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/.
+
+#include <chrono>
+#include <condition_variable>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <thread>
+#include <map>
+#include <algorithm>
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+#include "../../implementation/logging/include/logger.hpp"
+
+#include "application_test_globals.hpp"
+
+class application_test_service {
+public:
+ application_test_service(struct application_test::service_info _service_info) :
+ service_info_(_service_info),
+ // service with number 1 uses "vsomeipd" as application name
+ // this way the same json file can be reused for all local tests
+ // including the ones with vsomeipd
+ app_(vsomeip::runtime::get()->create_application("service")),
+ counter_(0),
+ wait_until_registered_(true),
+ offer_thread_(std::bind(&application_test_service::run, this)),
+ stop_called_(false) {
+ app_->init();
+ app_->register_state_handler(
+ std::bind(&application_test_service::on_state, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.method_id,
+ std::bind(&application_test_service::on_request, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(service_info_.service_id,
+ service_info_.instance_id, service_info_.shutdown_method_id,
+ std::bind(&application_test_service::on_shutdown_method_called, this,
+ std::placeholders::_1));
+ application_thread_ = std::thread([&](){
+ app_->start();
+ });
+ }
+
+ ~application_test_service() {
+ offer_thread_.join();
+ application_thread_.join();
+ }
+
+
+ void offer() {
+ app_->offer_service(service_info_.service_id, service_info_.instance_id);
+ }
+
+ void on_state(vsomeip::state_type_e _state) {
+ VSOMEIP_INFO << "Application " << app_->get_name() << " is "
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ?
+ "registered." : "deregistered.");
+
+ if (_state == vsomeip::state_type_e::ST_REGISTERED) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ wait_until_registered_ = false;
+ condition_.notify_one();
+ }
+ }
+
+ void on_request(const std::shared_ptr<vsomeip::message> &_message) {
+ app_->send(vsomeip::runtime::get()->create_response(_message));
+ VSOMEIP_INFO << "Received a request with Client/Session [" << std::setw(4)
+ << std::setfill('0') << std::hex << _message->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _message->get_session() << "]";
+ }
+
+ void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
+ (void)_message;
+ stop_called_ = true;
+ app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
+ app_->clear_all_handler();
+ app_->stop();
+ }
+
+ void run() {
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Running";
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (wait_until_registered_ && !stop_called_) {
+ condition_.wait_for(its_lock, std::chrono::milliseconds(100));
+ }
+
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Offering";
+ offer();
+ }
+
+private:
+ struct application_test::service_info service_info_;
+ std::shared_ptr<vsomeip::application> app_;
+ std::uint32_t counter_;
+
+ bool wait_until_registered_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ std::thread offer_thread_;
+ std::thread application_thread_;
+ bool stop_called_;
+};
diff --git a/test/application_tests/application_test_single_process.cpp b/test/application_tests/application_test_single_process.cpp
new file mode 100644
index 0000000..eee636c
--- /dev/null
+++ b/test/application_tests/application_test_single_process.cpp
@@ -0,0 +1,47 @@
+// Copyright (C) 2014-2016 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/.
+
+#include <gtest/gtest.h>
+#include "application_test_service.cpp"
+#include "application_test_client.cpp"
+#include "application_test_daemon.cpp"
+
+TEST(someip_application_test_single_process, notify_increasing_counter)
+{
+ // start application acting as daemon (rm_stub)
+ application_test_daemon its_daemon;
+
+ // start receiver service (rm_proxy)
+ application_test_service its_receiver(application_test::service);
+
+ // stop the daemon (rm_stub goes away)
+ its_daemon.stop();
+
+ // restart client which tries to communicate with service multiple times
+ // thus it will always be the new routing manager
+ for (int var = 0; var < 10; ++var) {
+ // every time the client is restarted it becomes the rm_stub again
+ application_test_client its_client(application_test::service);
+ if(var != 9) {
+ its_client.stop(false);
+ } else {
+ // for the last iteration we sleep to make sure the communication
+ // between the client and the service can be established
+ std::this_thread::sleep_for(std::chrono::milliseconds(2000));
+ its_client.stop(true);
+ }
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ its_receiver.on_shutdown_method_called(vsomeip::runtime::get()->create_message());
+}
+
+
+#ifndef WIN32
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/application_tests/application_test_single_process.json b/test/application_tests/application_test_single_process.json
new file mode 100644
index 0000000..b604d9a
--- /dev/null
+++ b/test/application_tests/application_test_single_process.json
@@ -0,0 +1,14 @@
+{
+ "unicast":"127.0.0.1",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/someip.log"
+ },
+ "dlt":"false"
+ }
+}
diff --git a/test/application_tests/application_test_single_process_starter.sh b/test/application_tests/application_test_single_process_starter.sh
new file mode 100755
index 0000000..0ac3330
--- /dev/null
+++ b/test/application_tests/application_test_single_process_starter.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Copyright (C) 2015-2016 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/.
+
+FAIL=0
+
+export VSOMEIP_CONFIGURATION=application_test_single_process.json
+./application_test_single_process
+
+if [ $? -ne 0 ]
+then
+ ((FAIL+=1))
+fi
+
+# Check if both exited successfully
+if [ $FAIL -eq 0 ]
+then
+ exit 0
+else
+ exit 1
+fi
diff --git a/test/application_tests/application_test.json b/test/application_tests/conf/application_test.json.in
index 66abf3a..ed5a7fc 100644
--- a/test/application_tests/application_test.json
+++ b/test/application_tests/conf/application_test.json.in
@@ -1,5 +1,5 @@
{
- "unicast":"127.0.0.1",
+ "unicast":"@TEST_IP_MASTER@",
"logging":
{
"level":"warning",
diff --git a/test/application_tests/application_test_daemon.json b/test/application_tests/conf/application_test_daemon.json.in
index 6b4a946..c84adf5 100644
--- a/test/application_tests/application_test_daemon.json
+++ b/test/application_tests/conf/application_test_daemon.json.in
@@ -1,5 +1,5 @@
{
- "unicast":"127.0.0.1",
+ "unicast":"@TEST_IP_MASTER@",
"logging":
{
"level":"warning",
diff --git a/test/application_tests/application_test_no_dispatch_threads.json b/test/application_tests/conf/application_test_no_dispatch_threads.json.in
index d2f9569..20d0ebd 100644
--- a/test/application_tests/application_test_no_dispatch_threads.json
+++ b/test/application_tests/conf/application_test_no_dispatch_threads.json.in
@@ -1,5 +1,5 @@
{
- "unicast":"127.0.0.1",
+ "unicast":"@TEST_IP_MASTER@",
"logging":
{
"level":"warning",
diff --git a/test/application_tests/application_test_no_dispatch_threads_daemon.json b/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in
index e33190b..8dec80e 100644
--- a/test/application_tests/application_test_no_dispatch_threads_daemon.json
+++ b/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in
@@ -1,5 +1,5 @@
{
- "unicast":"127.0.0.1",
+ "unicast":"@TEST_IP_MASTER@",
"logging":
{
"level":"warning",
diff --git a/test/big_payload_tests/big_payload_test_client.cpp b/test/big_payload_tests/big_payload_test_client.cpp
index 15e0a14..a18dd0c 100644
--- a/test/big_payload_tests/big_payload_test_client.cpp
+++ b/test/big_payload_tests/big_payload_test_client.cpp
@@ -21,7 +21,10 @@ big_payload_test_client::big_payload_test_client(bool _use_tcp) :
void big_payload_test_client::init()
{
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&big_payload_test_client::on_state, this,
@@ -53,7 +56,7 @@ void big_payload_test_client::stop()
app_->unregister_state_handler();
app_->unregister_message_handler(vsomeip::ANY_SERVICE,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD);
-
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/big_payload_tests/big_payload_test_service.cpp b/test/big_payload_tests/big_payload_test_service.cpp
index fc8690e..37f3d7f 100644
--- a/test/big_payload_tests/big_payload_test_service.cpp
+++ b/test/big_payload_tests/big_payload_test_service.cpp
@@ -20,7 +20,10 @@ void big_payload_test_service::init()
{
std::lock_guard<std::mutex> its_lock(mutex_);
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID,
std::bind(&big_payload_test_service::on_message, this,
@@ -40,9 +43,7 @@ void big_payload_test_service::start()
void big_payload_test_service::stop()
{
VSOMEIP_INFO << "Stopping...";
- app_->unregister_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID);
- app_->unregister_state_handler();
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/client_id_tests/client_id_test_service.cpp b/test/client_id_tests/client_id_test_service.cpp
index 36bfeb8..6572d74 100644
--- a/test/client_id_tests/client_id_test_service.cpp
+++ b/test/client_id_tests/client_id_test_service.cpp
@@ -29,7 +29,10 @@ public:
offer_thread_(std::bind(&client_id_test_service::run, this)),
stopped_(false),
stop_thread_(std::bind(&client_id_test_service::wait_for_stop, this)) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&client_id_test_service::on_state, this,
std::placeholders::_1));
@@ -88,7 +91,9 @@ public:
void on_availability(vsomeip::service_t _service,
vsomeip::instance_t _instance, bool _is_available) {
if(_is_available) {
- VSOMEIP_INFO << "Service ["
+ VSOMEIP_INFO
+ << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Service ["
<< std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
<< "] is "
<< (_is_available ? "available." : "NOT available.");
@@ -112,7 +117,10 @@ public:
void on_request(const std::shared_ptr<vsomeip::message> &_message) {
if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) {
- VSOMEIP_DEBUG << "Received a request with Client/Session [" << std::setw(4)
+ VSOMEIP_DEBUG
+ << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id
+ << "] Received a request with Client/Session [" << std::setw(4)
<< std::setfill('0') << std::hex << _message->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex
<< _message->get_session() << "]";
@@ -124,7 +132,10 @@ public:
void on_response(const std::shared_ptr<vsomeip::message> &_message) {
if(_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- VSOMEIP_DEBUG << "Received a response with Client/Session [" << std::setw(4)
+ VSOMEIP_DEBUG
+ << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id
+ << "] Received a response with Client/Session [" << std::setw(4)
<< std::setfill('0') << std::hex << _message->get_client() << "/"
<< std::setw(4) << std::setfill('0') << std::hex
<< _message->get_session() << "] from Service/Method ["
@@ -147,14 +158,14 @@ public:
}
void run() {
- VSOMEIP_DEBUG << "Running";
std::unique_lock<std::mutex> its_lock(mutex_);
while (!blocked_) {
condition_.wait(its_lock);
}
blocked_ = false;
- VSOMEIP_DEBUG << "Offering";
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Offering";
offer();
@@ -163,7 +174,8 @@ public:
}
blocked_ = false;
- VSOMEIP_DEBUG << "Sending";
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Sending";
// send a message to all other services
for (int var = 0; var < client_id_test::messages_to_send; ++var) {
for(const client_id_test::service_info& i: client_id_test::service_infos) {
@@ -177,10 +189,12 @@ public:
msg->set_instance(i.instance_id);
msg->set_method(i.method_id);
app_->send(msg);
- VSOMEIP_DEBUG << "Sending a request to Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << i.service_id << "/" << std::setw(4) << std::setfill('0')
- << std::hex << i.instance_id <<"]";
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0')
+ << std::hex << service_info_.service_id
+ << "] Sending a request to Service/Method ["
+ << std::setw(4) << std::setfill('0') << std::hex
+ << i.service_id << "/" << std::setw(4) << std::setfill('0')
+ << std::hex << i.instance_id <<"]";
}
}
@@ -195,7 +209,9 @@ public:
while (!stopped_) {
stop_condition_.wait(its_lock);
}
- VSOMEIP_INFO << "Received responses from all other services, going down";
+ VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id
+ << "] Received responses from all other services, going down";
// let offer thread exit
{
@@ -205,6 +221,7 @@ public:
}
std::this_thread::sleep_for(std::chrono::seconds(3));
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/configuration_tests/configuration-test-deprecated.json b/test/configuration_tests/configuration-test-deprecated.json
index 8d6a8d2..09a2e7e 100644
--- a/test/configuration_tests/configuration-test-deprecated.json
+++ b/test/configuration_tests/configuration-test-deprecated.json
@@ -29,7 +29,8 @@
"repetition-base" : "200",
"repetition-max" : "7",
"cyclic-offer" : "2132",
- "cyclic-request" : "2001"
+ "cyclic-request" : "2001",
+ "ttl" : "5"
},
"services" :
[
@@ -84,11 +85,12 @@
"unicast" : "local",
"delays" :
{
- "initial" : { "minimum" : "100", "maximum" : "200" },
- "repetition-base" : "300",
- "repetition-max" : "5",
- "cyclic-offer" : "2500",
- "cyclic-request" : "2221"
+ "initial" : { "minimum" : "10", "maximum" : "100" },
+ "repetition-base" : "200",
+ "repetition-max" : "7",
+ "cyclic-offer" : "2132",
+ "cyclic-request" : "2001",
+ "ttl" : "5"
},
"services" :
[
@@ -128,4 +130,4 @@
"multicast" : "224.212.244.223",
"port" : "30666"
}
-} \ No newline at end of file
+}
diff --git a/test/configuration_tests/configuration-test.cpp b/test/configuration_tests/configuration-test.cpp
index 01a0e3e..37ebfeb 100644
--- a/test/configuration_tests/configuration-test.cpp
+++ b/test/configuration_tests/configuration-test.cpp
@@ -3,6 +3,7 @@
// 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 <cstdlib>
#include <iostream>
#include <vsomeip/constants.hpp>
@@ -109,155 +110,158 @@ void check_file(const std::string &_config_file,
vsomeip::ttl_t _expected_cyclic_offer_delay,
vsomeip::ttl_t _expected_request_response_delay) {
- // Reset configuration
- vsomeip::configuration::reset();
-
- // Load test configuration
- std::set<std::string> its_configuration_files;
- its_configuration_files.insert(_config_file);
- std::shared_ptr<vsomeip::configuration> its_configuration
- = vsomeip::configuration::get(its_configuration_files);
-
- // 1. Did we get a configuration object?
- if (0 == its_configuration) {
- VSOMEIP_ERROR << "No configuration object. "
- "Either memory overflow or loading error detected!";
- return;
- }
-
- // 2. Check host address
- boost::asio::ip::address its_host_unicast_address
- = its_configuration->get_unicast_address();
- check<std::string>(its_host_unicast_address.to_string(),
- _expected_unicast_address, "UNICAST ADDRESS");
-
- // 3. Check logging
- bool has_console = its_configuration->has_console_log();
- bool has_file = its_configuration->has_file_log();
- bool has_dlt = its_configuration->has_dlt_log();
- std::string logfile = its_configuration->get_logfile();
- boost::log::trivial::severity_level loglevel
- = its_configuration->get_loglevel();
-
- check<bool>(has_console, _expected_has_console, "HAS CONSOLE");
- check<bool>(has_file, _expected_has_file, "HAS FILE");
- check<bool>(has_dlt, _expected_has_dlt, "HAS DLT");
- check<std::string>(logfile, _expected_logfile, "LOGFILE");
- check<std::string>(boost::log::trivial::to_string(loglevel),
- _expected_loglevel, "LOGLEVEL");
-
- // 4. Services
- std::string its_unicast_address
- = its_configuration->get_unicast_address(0x1234, 0x0022);
- uint16_t its_reliable_port
- = its_configuration->get_reliable_port(0x1234, 0x0022);
- uint16_t its_unreliable_port
- = its_configuration->get_unreliable_port(0x1234, 0x0022);
-
- check<std::string>(its_unicast_address,
- _expected_unicast_address_1234_0022,
- "UNICAST_ADDRESS_1234_0022");
- check<uint16_t>(its_reliable_port,
- _expected_reliable_port_1234_0022,
- "RELIABLE_PORT_1234_0022");
- check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_1234_0022,
- "UNRELIABLE_PORT_1234_0022");
-
- its_unicast_address
- = its_configuration->get_unicast_address(0x1234, 0x0023);
- its_reliable_port
- = its_configuration->get_reliable_port(0x1234, 0x0023);
- its_unreliable_port
- = its_configuration->get_unreliable_port(0x1234, 0x0023);
-
- check<std::string>(its_unicast_address,
- _expected_unicast_address_1234_0023,
- "UNICAST_ADDRESS_1234_0023");
- check<uint16_t>(its_reliable_port,
- _expected_reliable_port_1234_0023,
- "RELIABLE_PORT_1234_0023");
- check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_1234_0023,
- "UNRELIABLE_PORT_1234_0023");
-
- its_unicast_address
- = its_configuration->get_unicast_address(0x2277, 0x0022);
- its_reliable_port
- = its_configuration->get_reliable_port(0x2277, 0x0022);
- its_unreliable_port
- = its_configuration->get_unreliable_port(0x2277, 0x0022);
-
- check<std::string>(its_unicast_address,
- _expected_unicast_address_2277_0022,
- "UNICAST_ADDRESS_2277_0022");
- check<uint16_t>(its_reliable_port,
- _expected_reliable_port_2277_0022,
- "RELIABLE_PORT_2277_0022");
- check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_2277_0022,
- "UNRELIABLE_PORT_2277_0022");
-
- its_unicast_address
- = its_configuration->get_unicast_address(0x2266, 0x0022);
- its_reliable_port
- = its_configuration->get_reliable_port(0x2266, 0x0022);
- its_unreliable_port
- = its_configuration->get_unreliable_port(0x2266, 0x0022);
-
- check<std::string>(its_unicast_address,
- _expected_unicast_address_2266_0022,
- "UNICAST_ADDRESS_2266_0022");
- check<uint16_t>(its_reliable_port,
- _expected_reliable_port_2266_0022,
- "RELIABLE_PORT_2266_0022");
- check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_2266_0022,
- "UNRELIABLE_PORT_2266_0022");
-
- its_unicast_address
- = its_configuration->get_unicast_address(0x4466, 0x0321);
- its_reliable_port
- = its_configuration->get_reliable_port(0x4466, 0x0321);
- its_unreliable_port
- = its_configuration->get_unreliable_port(0x4466, 0x0321);
-
- check<std::string>(its_unicast_address,
- _expected_unicast_address_4466_0321,
- "UNICAST_ADDRESS_4466_0321");
- check<uint16_t>(its_reliable_port,
- _expected_reliable_port_4466_0321,
- "RELIABLE_PORT_4466_0321");
- check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_4466_0321,
- "UNRELIABLE_PORT_4466_0321");
-
- // 5. Service discovery
- bool enabled = its_configuration->is_sd_enabled();
- std::string protocol = its_configuration->get_sd_protocol();
- uint16_t port = its_configuration->get_sd_port();
- std::string multicast = its_configuration->get_sd_multicast();
-
- int32_t initial_delay_min = its_configuration->get_sd_initial_delay_min();
- int32_t initial_delay_max = its_configuration->get_sd_initial_delay_max();
- int32_t repetitions_base_delay = its_configuration->get_sd_repetitions_base_delay();
- uint8_t repetitions_max = its_configuration->get_sd_repetitions_max();
- vsomeip::ttl_t ttl = its_configuration->get_sd_ttl();
- int32_t cyclic_offer_delay = its_configuration->get_sd_cyclic_offer_delay();
- int32_t request_response_delay = its_configuration->get_sd_request_response_delay();
-
- check<bool>(enabled, _expected_enabled, "SD ENABLED");
- check<std::string>(protocol, _expected_protocol, "SD PROTOCOL");
- check<std::string>(multicast, _expected_multicast, "SD MULTICAST");
- check<uint16_t>(port, _expected_port, "SD PORT");
-
- check<int32_t>(initial_delay_min, _expected_initial_delay_min, "SD INITIAL DELAY MIN");
- check<int32_t>(initial_delay_max, _expected_initial_delay_max, "SD INITIAL DELAY MAX");
- check<int32_t>(repetitions_base_delay, _expected_repetitions_base_delay, "SD REPETITION BASE DELAY");
- check<uint8_t>(repetitions_max,_expected_repetitions_max, "SD REPETITION MAX");
- check<vsomeip::ttl_t>(ttl, _expected_ttl, "SD TTL");
- check<int32_t>(cyclic_offer_delay, _expected_cyclic_offer_delay, "SD CYCLIC OFFER DELAY");
- check<int32_t>(request_response_delay, _expected_request_response_delay, "SD RESPONSE REQUEST DELAY");
+ // 0. Create configuration object
+ std::shared_ptr<vsomeip::configuration> its_configuration
+ = vsomeip::configuration::get();
+
+ // 1. Did we get a configuration object?
+ if (0 == its_configuration) {
+ VSOMEIP_ERROR << "No configuration object. "
+ "Either memory overflow or loading error detected!";
+ return;
+ }
+
+ // 2. Set environment variable to config file and load it
+#ifndef WIN32
+ setenv("VSOMEIP_CONFIGURATION", _config_file.c_str(), 1);
+#else
+ _putenv_s("VSOMEIP_CONFIGURATION", _config_file.c_str()
+#endif
+ its_configuration->load(EXPECTED_ROUTING_MANAGER_HOST);
+
+ // 3. Check host address
+ boost::asio::ip::address its_host_unicast_address
+ = its_configuration->get_unicast_address();
+ check<std::string>(its_host_unicast_address.to_string(),
+ _expected_unicast_address, "UNICAST ADDRESS");
+
+ // 4. Check logging
+ bool has_console = its_configuration->has_console_log();
+ bool has_file = its_configuration->has_file_log();
+ bool has_dlt = its_configuration->has_dlt_log();
+ std::string logfile = its_configuration->get_logfile();
+ boost::log::trivial::severity_level loglevel
+ = its_configuration->get_loglevel();
+
+ check<bool>(has_console, _expected_has_console, "HAS CONSOLE");
+ check<bool>(has_file, _expected_has_file, "HAS FILE");
+ check<bool>(has_dlt, _expected_has_dlt, "HAS DLT");
+ check<std::string>(logfile, _expected_logfile, "LOGFILE");
+ check<std::string>(boost::log::trivial::to_string(loglevel),
+ _expected_loglevel, "LOGLEVEL");
+
+ // 5. Services
+ std::string its_unicast_address
+ = its_configuration->get_unicast_address(0x1234, 0x0022);
+ uint16_t its_reliable_port
+ = its_configuration->get_reliable_port(0x1234, 0x0022);
+ uint16_t its_unreliable_port
+ = its_configuration->get_unreliable_port(0x1234, 0x0022);
+
+ check<std::string>(its_unicast_address,
+ _expected_unicast_address_1234_0022,
+ "UNICAST_ADDRESS_1234_0022");
+ check<uint16_t>(its_reliable_port,
+ _expected_reliable_port_1234_0022,
+ "RELIABLE_PORT_1234_0022");
+ check<uint16_t>(its_unreliable_port,
+ _expected_unreliable_port_1234_0022,
+ "UNRELIABLE_PORT_1234_0022");
+
+ its_unicast_address
+ = its_configuration->get_unicast_address(0x1234, 0x0023);
+ its_reliable_port
+ = its_configuration->get_reliable_port(0x1234, 0x0023);
+ its_unreliable_port
+ = its_configuration->get_unreliable_port(0x1234, 0x0023);
+
+ check<std::string>(its_unicast_address,
+ _expected_unicast_address_1234_0023,
+ "UNICAST_ADDRESS_1234_0023");
+ check<uint16_t>(its_reliable_port,
+ _expected_reliable_port_1234_0023,
+ "RELIABLE_PORT_1234_0023");
+ check<uint16_t>(its_unreliable_port,
+ _expected_unreliable_port_1234_0023,
+ "UNRELIABLE_PORT_1234_0023");
+
+ its_unicast_address
+ = its_configuration->get_unicast_address(0x2277, 0x0022);
+ its_reliable_port
+ = its_configuration->get_reliable_port(0x2277, 0x0022);
+ its_unreliable_port
+ = its_configuration->get_unreliable_port(0x2277, 0x0022);
+
+ check<std::string>(its_unicast_address,
+ _expected_unicast_address_2277_0022,
+ "UNICAST_ADDRESS_2277_0022");
+ check<uint16_t>(its_reliable_port,
+ _expected_reliable_port_2277_0022,
+ "RELIABLE_PORT_2277_0022");
+ check<uint16_t>(its_unreliable_port,
+ _expected_unreliable_port_2277_0022,
+ "UNRELIABLE_PORT_2277_0022");
+
+ its_unicast_address
+ = its_configuration->get_unicast_address(0x2266, 0x0022);
+ its_reliable_port
+ = its_configuration->get_reliable_port(0x2266, 0x0022);
+ its_unreliable_port
+ = its_configuration->get_unreliable_port(0x2266, 0x0022);
+
+ check<std::string>(its_unicast_address,
+ _expected_unicast_address_2266_0022,
+ "UNICAST_ADDRESS_2266_0022");
+ check<uint16_t>(its_reliable_port,
+ _expected_reliable_port_2266_0022,
+ "RELIABLE_PORT_2266_0022");
+ check<uint16_t>(its_unreliable_port,
+ _expected_unreliable_port_2266_0022,
+ "UNRELIABLE_PORT_2266_0022");
+
+ its_unicast_address
+ = its_configuration->get_unicast_address(0x4466, 0x0321);
+ its_reliable_port
+ = its_configuration->get_reliable_port(0x4466, 0x0321);
+ its_unreliable_port
+ = its_configuration->get_unreliable_port(0x4466, 0x0321);
+
+ check<std::string>(its_unicast_address,
+ _expected_unicast_address_4466_0321,
+ "UNICAST_ADDRESS_4466_0321");
+ check<uint16_t>(its_reliable_port,
+ _expected_reliable_port_4466_0321,
+ "RELIABLE_PORT_4466_0321");
+ check<uint16_t>(its_unreliable_port,
+ _expected_unreliable_port_4466_0321,
+ "UNRELIABLE_PORT_4466_0321");
+
+ // 6. Service discovery
+ bool enabled = its_configuration->is_sd_enabled();
+ std::string protocol = its_configuration->get_sd_protocol();
+ uint16_t port = its_configuration->get_sd_port();
+ std::string multicast = its_configuration->get_sd_multicast();
+
+ int32_t initial_delay_min = its_configuration->get_sd_initial_delay_min();
+ int32_t initial_delay_max = its_configuration->get_sd_initial_delay_max();
+ int32_t repetitions_base_delay = its_configuration->get_sd_repetitions_base_delay();
+ uint8_t repetitions_max = its_configuration->get_sd_repetitions_max();
+ vsomeip::ttl_t ttl = its_configuration->get_sd_ttl();
+ int32_t cyclic_offer_delay = its_configuration->get_sd_cyclic_offer_delay();
+ int32_t request_response_delay = its_configuration->get_sd_request_response_delay();
+
+ check<bool>(enabled, _expected_enabled, "SD ENABLED");
+ check<std::string>(protocol, _expected_protocol, "SD PROTOCOL");
+ check<std::string>(multicast, _expected_multicast, "SD MULTICAST");
+ check<uint16_t>(port, _expected_port, "SD PORT");
+
+ check<int32_t>(initial_delay_min, _expected_initial_delay_min, "SD INITIAL DELAY MIN");
+ check<int32_t>(initial_delay_max, _expected_initial_delay_max, "SD INITIAL DELAY MAX");
+ check<int32_t>(repetitions_base_delay, _expected_repetitions_base_delay, "SD REPETITION BASE DELAY");
+ check<uint8_t>(repetitions_max,_expected_repetitions_max, "SD REPETITION MAX");
+ check<vsomeip::ttl_t>(ttl, _expected_ttl, "SD TTL");
+ check<int32_t>(cyclic_offer_delay, _expected_cyclic_offer_delay, "SD CYCLIC OFFER DELAY");
+ check<int32_t>(request_response_delay, _expected_request_response_delay, "SD RESPONSE REQUEST DELAY");
}
diff --git a/test/cpu_load_tests/cpu_load_test_client.cpp b/test/cpu_load_tests/cpu_load_test_client.cpp
index 6546013..dd732e3 100644
--- a/test/cpu_load_tests/cpu_load_test_client.cpp
+++ b/test/cpu_load_tests/cpu_load_test_client.cpp
@@ -52,7 +52,10 @@ public:
payload_size_(_payload_size),
wait_for_all_msg_acknowledged_(true),
sender_(std::bind(&cpu_load_test_client::run, this)) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&cpu_load_test_client::on_state, this,
@@ -84,11 +87,7 @@ private:
{
shutdown_service();
}
- app_->unregister_availability_handler(cpu_load_test::service_id,
- cpu_load_test::instance_id);
- app_->unregister_state_handler();
- app_->unregister_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD);
+ app_->clear_all_handler();
}
void on_state(vsomeip::state_type_e _state) {
diff --git a/test/cpu_load_tests/cpu_load_test_service.cpp b/test/cpu_load_tests/cpu_load_test_service.cpp
index 6eb0c81..67b4ef9 100644
--- a/test/cpu_load_tests/cpu_load_test_service.cpp
+++ b/test/cpu_load_tests/cpu_load_test_service.cpp
@@ -40,7 +40,10 @@ public:
{
std::lock_guard<std::mutex> its_lock(mutex_);
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_message_handler(cpu_load_test::service_id,
cpu_load_test::instance_id, cpu_load_test::method_id,
std::bind(&cpu_load_test_service::on_message, this,
@@ -73,11 +76,7 @@ public:
{
VSOMEIP_INFO << "Stopping...";
app_->stop_offer_service(cpu_load_test::service_id, cpu_load_test::instance_id);
- app_->unregister_message_handler(cpu_load_test::service_id,
- cpu_load_test::instance_id, cpu_load_test::method_id);
- app_->unregister_message_handler(cpu_load_test::service_id,
- cpu_load_test::instance_id, cpu_load_test::method_id_shutdown);
- app_->unregister_state_handler();
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/header_factory_tests/header_factory_test_client.cpp b/test/header_factory_tests/header_factory_test_client.cpp
index b6f3858..2e08cbc 100644
--- a/test/header_factory_tests/header_factory_test_client.cpp
+++ b/test/header_factory_tests/header_factory_test_client.cpp
@@ -20,7 +20,10 @@ header_factory_test_client::header_factory_test_client(bool _use_tcp) :
void header_factory_test_client::init()
{
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&header_factory_test_client::on_state, this,
@@ -47,12 +50,7 @@ void header_factory_test_client::start()
void header_factory_test_client::stop()
{
VSOMEIP_INFO << "Stopping...";
- app_->unregister_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- app_->unregister_state_handler();
- app_->unregister_message_handler(vsomeip::ANY_SERVICE,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD);
-
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/header_factory_tests/header_factory_test_service.cpp b/test/header_factory_tests/header_factory_test_service.cpp
index 0367d40..0ff516f 100644
--- a/test/header_factory_tests/header_factory_test_service.cpp
+++ b/test/header_factory_tests/header_factory_test_service.cpp
@@ -21,7 +21,10 @@ void header_factory_test_service::init()
{
std::lock_guard<std::mutex> its_lock(mutex_);
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID,
std::bind(&header_factory_test_service::on_message, this,
@@ -43,9 +46,7 @@ void header_factory_test_service::start()
void header_factory_test_service::stop()
{
VSOMEIP_INFO << "Stopping...";
- app_->unregister_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID);
- app_->unregister_state_handler();
+ app_->clear_all_handler();
app_->stop();
std::thread t([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));});
t.join();
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in
index 845cfe4..d7b5c7b 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in
@@ -2,7 +2,7 @@
"unicast":"@TEST_IP_MASTER@",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -70,6 +70,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in
index 4348be8..6445025 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in
@@ -2,7 +2,7 @@
"unicast":"@TEST_IP_MASTER@",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -70,6 +70,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
index 5760288..c5dddc3 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
@@ -3,7 +3,7 @@
"diagnosis" : "0x63",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -71,6 +71,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in
index e60c7b8..3e7e286 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in
@@ -3,7 +3,7 @@
"diagnosis" : "0x63",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -71,6 +71,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in
index 3a7c837..f168fae 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in
@@ -2,7 +2,7 @@
"unicast":"@TEST_IP_MASTER@",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -70,6 +70,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in
index e296a42..30206a2 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in
@@ -3,7 +3,7 @@
"diagnosis" : "0x63",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -71,6 +71,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in
index 17476ab..785e651 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in
@@ -2,7 +2,7 @@
"unicast":"@TEST_IP_MASTER@",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -70,6 +70,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in
index 2f8d7d9..cfbdac4 100644
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in
@@ -3,7 +3,7 @@
"diagnosis" : "0x63",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -71,6 +71,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in
index 845cfe4..d7b5c7b 100644
--- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in
@@ -2,7 +2,7 @@
"unicast":"@TEST_IP_MASTER@",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -70,6 +70,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in
index df799e2..facc51a 100644
--- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in
@@ -3,7 +3,7 @@
"diagnosis" : "0x63",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -71,6 +71,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in
index 17476ab..785e651 100644
--- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in
@@ -2,7 +2,7 @@
"unicast":"@TEST_IP_MASTER@",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -70,6 +70,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in
index c8113c3..97b5d9f 100644
--- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in
+++ b/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in
@@ -3,7 +3,7 @@
"diagnosis" : "0x63",
"logging":
{
- "level":"info",
+ "level":"warning",
"console":"true",
"file":
{
@@ -71,6 +71,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/initial_event_tests/initial_event_test_availability_checker.cpp b/test/initial_event_tests/initial_event_test_availability_checker.cpp
index 772df22..34c20c1 100644
--- a/test/initial_event_tests/initial_event_test_availability_checker.cpp
+++ b/test/initial_event_tests/initial_event_test_availability_checker.cpp
@@ -31,7 +31,10 @@ public:
wait_until_other_services_available_(true),
wait_for_stop_(true),
stop_thread_(std::bind(&initial_event_test_availability_checker::wait_for_stop, this)) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&initial_event_test_availability_checker::on_state, this,
std::placeholders::_1));
@@ -103,6 +106,7 @@ public:
}
VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
<< client_number_ << "] all services are available. Going down";
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/initial_event_tests/initial_event_test_client.cpp b/test/initial_event_tests/initial_event_test_client.cpp
index 5ee194e..d525632 100644
--- a/test/initial_event_tests/initial_event_test_client.cpp
+++ b/test/initial_event_tests/initial_event_test_client.cpp
@@ -33,7 +33,10 @@ public:
wait_until_other_services_available_(true),
wait_for_stop_(true),
stop_thread_(std::bind(&initial_event_test_client::wait_for_stop, this)) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&initial_event_test_client::on_state, this,
std::placeholders::_1));
@@ -164,7 +167,20 @@ public:
[&](const std::map<std::pair<vsomeip::service_t,
vsomeip::method_t>, std::uint32_t>::value_type& v)
{
- return v.second == initial_event_test::notifications_to_send;
+ if (v.second == initial_event_test::notifications_to_send) {
+ return true;
+ } else if (v.second >= initial_event_test::notifications_to_send){
+ VSOMEIP_WARNING
+ << " Received multiple initial events from service/instance: "
+ << std::setw(4) << std::setfill('0') << std::hex << v.first.first
+ << "."
+ << std::setw(4) << std::setfill('0') << std::hex << v.first.second
+ << " number of received events: " << v.second
+ << ". This is caused by StopSubscribe/Subscribe messages.";
+ return true;
+ } else {
+ return false;
+ }
}
);
}
@@ -173,7 +189,16 @@ public:
std::uint32_t received_twice(0);
std::uint32_t received_normal(0);
for(const auto &v : other_services_received_notification_) {
- if (v.second == initial_event_test::notifications_to_send * 2) {
+ if (v.second > initial_event_test::notifications_to_send * 2) {
+ VSOMEIP_WARNING
+ << " Received multiple initial events from service/instance: "
+ << std::setw(4) << std::setfill('0') << std::hex << v.first.first
+ << "."
+ << std::setw(4) << std::setfill('0') << std::hex << v.first.second
+ << " number of received events: " << v.second
+ << ". This is caused by StopSubscribe/Subscribe messages.";
+ received_twice++;
+ } else if (v.second == initial_event_test::notifications_to_send * 2) {
received_twice++;
} else if(v.second == initial_event_test::notifications_to_send) {
received_normal++;
@@ -181,7 +206,7 @@ public:
}
if( received_twice == (service_infos_.size() - 1) / 2
- && received_normal == (service_infos_.size() - 1) / 2 - 1) {
+ && received_normal == (service_infos_.size() - 1) / 2) {
// routing manager stub receives the notification
// - twice from external nodes
// - and normal from all internal nodes
@@ -196,14 +221,22 @@ public:
}
void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
+ {
+ std::unique_lock<std::mutex> its_lock(stop_mutex_);
+ while (wait_for_stop_) {
+ stop_condition_.wait(its_lock);
+ }
+ VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << client_number_
+ << "] Received notifications from all services, going down";
}
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_
- << "] Received notifications from all services, going down";
-
+ for (const auto& i : service_infos_) {
+ if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) {
+ continue;
+ }
+ app_->unsubscribe(i.service_id, i.instance_id, i.eventgroup_id);
+ }
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/initial_event_tests/initial_event_test_master_starter.sh b/test/initial_event_tests/initial_event_test_master_starter.sh
index 903104a..3273817 100755
--- a/test/initial_event_tests/initial_event_test_master_starter.sh
+++ b/test/initial_event_tests/initial_event_test_master_starter.sh
@@ -45,6 +45,22 @@ then
exit 1
fi
+print_starter_message () {
+cat <<End-of-message
+*******************************************************************************
+*******************************************************************************
+** Please now run:
+** initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $PASSED_SAME_SERVICE_ID_FLAG
+** from an external host to successfully complete this test.
+**
+** You probably will need to adapt the 'unicast' settings in
+** initial_event_test_diff_client_ids_diff_ports_master.json and
+** initial_event_test_diff_client_ids_diff_ports_slave.json to your personal setup.
+*******************************************************************************
+*******************************************************************************
+End-of-message
+}
+
# replace master with slave to be able display the correct json file to be used
# with the slave script
MASTER_JSON_FILE=$PASSED_JSON_FILE
@@ -73,11 +89,21 @@ unset VSOMEIP_APPLICATION_NAME
CLIENT_PIDS=()
# Start some clients
-for client_number in $(seq 9000 9009)
-do
- ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
- CLIENT_PIDS+=($!)
-done
+if [[ $PASSED_SUBSCRIPTION_TYPE == "TCP_AND_UDP" ]]
+then
+ ./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
+ FIRST_PID=$!
+ sleep 1
+ print_starter_message
+ wait $FIRST_PID || FAIL=$(($FAIL+1))
+else
+ for client_number in $(seq 9000 9009)
+ do
+ ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
+ CLIENT_PIDS+=($!)
+ done
+fi
+
# Start availability checker in order to wait until the services on the remote
# were started as well
@@ -86,19 +112,10 @@ PID_AVAILABILITY_CHECKER=$!
sleep 1
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $PASSED_SAME_SERVICE_ID_FLAG
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** initial_event_test_diff_client_ids_diff_ports_master.json and
-** initial_event_test_diff_client_ids_diff_ports_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
+if [ $PASSED_SUBSCRIPTION_TYPE != "TCP_AND_UDP" ]
+then
+ print_starter_message
+fi
# wait unti the services on the remote node were started as well
wait $PID_AVAILABILITY_CHECKER
@@ -107,11 +124,18 @@ wait $PID_AVAILABILITY_CHECKER
# the cached event from the routing manager daemon
sleep 2
-for client_number in $(seq 9010 9020)
-do
- ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
- CLIENT_PIDS+=($!)
-done
+if [[ $PASSED_SUBSCRIPTION_TYPE == "TCP_AND_UDP" ]]
+then
+ ./initial_event_test_client 9010 $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
+ FIRST_PID=$!
+ wait $FIRST_PID || FAIL=$(($FAIL+1))
+else
+ for client_number in $(seq 9010 9020)
+ do
+ ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
+ CLIENT_PIDS+=($!)
+ done
+fi
# Wait until all clients are finished
diff --git a/test/initial_event_tests/initial_event_test_service.cpp b/test/initial_event_tests/initial_event_test_service.cpp
index 26a8e06..f02a493 100644
--- a/test/initial_event_tests/initial_event_test_service.cpp
+++ b/test/initial_event_tests/initial_event_test_service.cpp
@@ -27,7 +27,10 @@ public:
app_(vsomeip::runtime::get()->create_application()),
wait_until_registered_(true),
offer_thread_(std::bind(&initial_event_test_service::run, this)) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&initial_event_test_service::on_state, this,
std::placeholders::_1));
diff --git a/test/initial_event_tests/initial_event_test_slave_starter.sh b/test/initial_event_tests/initial_event_test_slave_starter.sh
index 9bd2d78..2b9eec8 100755
--- a/test/initial_event_tests/initial_event_test_slave_starter.sh
+++ b/test/initial_event_tests/initial_event_test_slave_starter.sh
@@ -69,11 +69,18 @@ unset VSOMEIP_APPLICATION_NAME
CLIENT_PIDS=()
# Start some clients
-for client_number in $(seq 9000 9009)
-do
- ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
- CLIENT_PIDS+=($!)
-done
+if [[ $PASSED_SUBSCRIPTION_TYPE == "TCP_AND_UDP" ]]
+then
+ ./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
+ FIRST_PID=$!
+ wait $FIRST_PID || FAIL=$(($FAIL+1))
+else
+ for client_number in $(seq 9000 9009)
+ do
+ ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
+ CLIENT_PIDS+=($!)
+ done
+fi
# Start availability checker in order to wait until the services on the remote
# were started as well
@@ -87,12 +94,18 @@ wait $PID_AVAILABILITY_CHECKER
# the cached event from the routing manager daemon
sleep 2
-for client_number in $(seq 9010 9020)
-do
- ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
- CLIENT_PIDS+=($!)
-done
-
+if [[ $PASSED_SUBSCRIPTION_TYPE == "TCP_AND_UDP" ]]
+then
+ ./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
+ FIRST_PID=$!
+ wait $FIRST_PID || FAIL=$(($FAIL+1))
+else
+ for client_number in $(seq 9010 9020)
+ do
+ ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE $PASSED_SAME_SERVICE_ID_FLAG &
+ CLIENT_PIDS+=($!)
+ done
+fi
# Wait until all clients are finished
for job in ${CLIENT_PIDS[*]}
diff --git a/test/initial_event_tests/initial_event_test_stop_service.cpp b/test/initial_event_tests/initial_event_test_stop_service.cpp
index c8e519e..cd8a34a 100644
--- a/test/initial_event_tests/initial_event_test_stop_service.cpp
+++ b/test/initial_event_tests/initial_event_test_stop_service.cpp
@@ -33,7 +33,10 @@ public:
wait_for_stop_(true),
stop_thread_(std::bind(&initial_event_test_stop_service::wait_for_stop, this)),
called_other_node_(false) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&initial_event_test_stop_service::on_state, this,
std::placeholders::_1));
@@ -204,7 +207,7 @@ public:
wait_until_shutdown_method_called_ = false;
condition_.notify_one();
}
-
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/magic_cookies_tests/magic_cookies_test_client.cpp b/test/magic_cookies_tests/magic_cookies_test_client.cpp
index fb335f9..35eba2e 100644
--- a/test/magic_cookies_tests/magic_cookies_test_client.cpp
+++ b/test/magic_cookies_tests/magic_cookies_test_client.cpp
@@ -26,7 +26,10 @@ public:
void init() {
VSOMEIP_INFO << "Initializing...";
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ exit(EXIT_FAILURE);
+ }
app_->register_state_handler(
std::bind(
@@ -53,6 +56,7 @@ public:
void stop() {
VSOMEIP_INFO << "Stopping...";
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/magic_cookies_tests/magic_cookies_test_service.cpp b/test/magic_cookies_tests/magic_cookies_test_service.cpp
index daa0fce..1a186b0 100644
--- a/test/magic_cookies_tests/magic_cookies_test_service.cpp
+++ b/test/magic_cookies_tests/magic_cookies_test_service.cpp
@@ -30,7 +30,10 @@ public:
void init() {
std::lock_guard<std::mutex> its_lock(mutex_);
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ exit(EXIT_FAILURE);
+ }
app_->register_message_handler(
vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID,
@@ -112,6 +115,7 @@ public:
condition_.wait(its_lock);
}
std::this_thread::sleep_for(std::chrono::milliseconds(5));
+ app_->clear_all_handler();
app_->stop();
} else {
while (true) {
diff --git a/test/offer_tests/offer_test_client.cpp b/test/offer_tests/offer_test_client.cpp
index bb1cb84..d338f13 100644
--- a/test/offer_tests/offer_test_client.cpp
+++ b/test/offer_tests/offer_test_client.cpp
@@ -40,7 +40,10 @@ public:
last_received_counter_(0),
last_received_response_(std::chrono::steady_clock::now()),
number_received_responses_(0) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&offer_test_client::on_state, this,
std::placeholders::_1));
@@ -215,7 +218,7 @@ public:
stop_condition_.wait(its_lock);
}
VSOMEIP_INFO << "going down";
-
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/offer_tests/offer_test_globals.hpp b/test/offer_tests/offer_test_globals.hpp
index 7163741..cc15c15 100644
--- a/test/offer_tests/offer_test_globals.hpp
+++ b/test/offer_tests/offer_test_globals.hpp
@@ -3,8 +3,8 @@
// 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 SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_
-#define SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_
+#ifndef OFFER_TEST_GLOBALS_HPP_
+#define OFFER_TEST_GLOBALS_HPP_
namespace offer_test {
@@ -22,4 +22,4 @@ struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404 };
static constexpr int number_of_messages_to_send = 150;
}
-#endif /* SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ */
+#endif /* OFFER_TEST_GLOBALS_HPP_ */
diff --git a/test/offer_tests/offer_test_service.cpp b/test/offer_tests/offer_test_service.cpp
index a734ed3..2396d1a 100644
--- a/test/offer_tests/offer_test_service.cpp
+++ b/test/offer_tests/offer_test_service.cpp
@@ -35,7 +35,10 @@ public:
wait_until_registered_(true),
offer_thread_(std::bind(&offer_test_service::run, this)),
shutdown_method_called_(false) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&offer_test_service::on_state, this,
std::placeholders::_1));
@@ -94,6 +97,7 @@ public:
// this is will trigger a warning
app_->stop_offer_service(service_info_.service_id, service_info_.instance_id, 44, 4711);
app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/offer_tests/offer_test_service_external.cpp b/test/offer_tests/offer_test_service_external.cpp
index d14103f..c031587 100644
--- a/test/offer_tests/offer_test_service_external.cpp
+++ b/test/offer_tests/offer_test_service_external.cpp
@@ -34,7 +34,10 @@ public:
wait_until_registered_(true),
wait_until_service_available_(true),
offer_thread_(std::bind(&offer_test_service::run, this)) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&offer_test_service::on_state, this,
std::placeholders::_1));
@@ -91,17 +94,19 @@ public:
void run() {
VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
<< service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
+ {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (wait_until_registered_) {
+ condition_.wait(its_lock);
+ }
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
+ VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
+ << service_info_.service_id << "] Offering";
+ offer();
- while(wait_until_service_available_) {
- condition_.wait(its_lock);
+ while(wait_until_service_available_) {
+ condition_.wait(its_lock);
+ }
}
std::this_thread::sleep_for(std::chrono::seconds(1));
@@ -114,6 +119,7 @@ public:
msg->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
app_->send(msg);
std::this_thread::sleep_for(std::chrono::seconds(2));
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/payload_tests/payload_test_client.cpp b/test/payload_tests/payload_test_client.cpp
index 60529fe..27759b7 100644
--- a/test/payload_tests/payload_test_client.cpp
+++ b/test/payload_tests/payload_test_client.cpp
@@ -42,7 +42,10 @@ payload_test_client::payload_test_client(
void payload_test_client::init()
{
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&payload_test_client::on_state, this,
@@ -74,11 +77,7 @@ void payload_test_client::stop()
{
shutdown_service();
}
- app_->unregister_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- app_->unregister_state_handler();
- app_->unregister_message_handler(vsomeip::ANY_SERVICE,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD);
+ app_->clear_all_handler();
}
void payload_test_client::shutdown_service()
diff --git a/test/payload_tests/payload_test_client.hpp b/test/payload_tests/payload_test_client.hpp
index 7f9f9e5..8af352e 100644
--- a/test/payload_tests/payload_test_client.hpp
+++ b/test/payload_tests/payload_test_client.hpp
@@ -10,6 +10,7 @@
#include <vsomeip/vsomeip.hpp>
+#include <cmath>
#include <thread>
#include <mutex>
#include <condition_variable>
diff --git a/test/payload_tests/payload_test_service.cpp b/test/payload_tests/payload_test_service.cpp
index 6773743..74191da 100644
--- a/test/payload_tests/payload_test_service.cpp
+++ b/test/payload_tests/payload_test_service.cpp
@@ -23,7 +23,10 @@ void payload_test_service::init()
{
std::lock_guard<std::mutex> its_lock(mutex_);
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID,
std::bind(&payload_test_service::on_message, this,
@@ -49,11 +52,7 @@ void payload_test_service::start()
void payload_test_service::stop()
{
VSOMEIP_INFO << "Stopping...";
- app_->unregister_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID);
- app_->unregister_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
- app_->unregister_state_handler();
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/routing_tests/conf/external_local_routing_test_client_external.json.in b/test/routing_tests/conf/external_local_routing_test_client_external.json.in
index 3633538..958f196 100644
--- a/test/routing_tests/conf/external_local_routing_test_client_external.json.in
+++ b/test/routing_tests/conf/external_local_routing_test_client_external.json.in
@@ -1,6 +1,7 @@
{
"unicast" : "@TEST_IP_SLAVE@",
"netmask" : "255.255.255.0",
+ "diagnosis" : "0x16",
"logging" :
{
"level" : "debug",
@@ -18,7 +19,7 @@
[
{
"name" : "external_local_routing_test_client_external",
- "id" : "0x1344"
+ "id" : "0x1644"
}
],
@@ -27,7 +28,7 @@
{
"service" : "0x1234",
"instance" : "0x5678",
- "unicast" : "@TEST_IP_MASTER@",
+ "unicast" : "@TEST_IP_MASTER@",
"unreliable" : "30509"
}
],
diff --git a/test/routing_tests/conf/external_local_routing_test_service.json.in b/test/routing_tests/conf/external_local_routing_test_service.json.in
index 0ef1f77..a4deb82 100644
--- a/test/routing_tests/conf/external_local_routing_test_service.json.in
+++ b/test/routing_tests/conf/external_local_routing_test_service.json.in
@@ -1,5 +1,6 @@
{
"unicast" : "@TEST_IP_MASTER@",
+ "diagnosis":"0x12",
"logging" :
{
"level" : "debug",
diff --git a/test/routing_tests/local_routing_test_starter.sh b/test/routing_tests/conf/local_routing_test_starter.sh.bat.in
index fd82594..ab96d8e 100755
--- a/test/routing_tests/local_routing_test_starter.sh
+++ b/test/routing_tests/conf/local_routing_test_starter.sh.bat.in
@@ -59,7 +59,7 @@ do
wait $job || ((FAIL+=1))
done
-# Check if client and server both exited sucessfully and the service didnt't
+# Check if client and server both exited successfully and the service didnt't
# have any open
if [ $FAIL -eq 0 ]
then
diff --git a/test/routing_tests/conf/local_routing_test_starter.sh.in b/test/routing_tests/conf/local_routing_test_starter.sh.in
new file mode 100755
index 0000000..6f81609
--- /dev/null
+++ b/test/routing_tests/conf/local_routing_test_starter.sh.in
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Copyright (C) 2015-2016 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/.
+
+# Purpose: This script is needed to start the client and service with
+# one command. This is necessary as ctest - which is used to run the
+# tests - isn't able to start two binaries for one testcase. Therefore
+# the testcase simply executes this script. This script then runs client
+# and service and checks that both exit sucessfully.
+
+FAIL=0
+
+# Parameter 1: the pid to check
+check_tcp_udp_sockets_are_closed ()
+{
+ # Check that the service does not listen on any TCP/UDP socket
+ # or has any active connection via a TCP/UDP socket
+ # awk is used to avoid the case when a inode number is the same as a PID. The awk
+ # program filters the netstat output down to the protocol (1st field) and
+ # the PID/Program name (last field) fields.
+ SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
+ if [ $SERVICE_SOCKETS_LISTENING -ne 0 ]
+ then
+ ((FAIL+=1))
+ fi
+
+ SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
+ if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ]
+ then
+ ((FAIL+=1))
+ fi
+}
+
+export VSOMEIP_CONFIGURATION=local_routing_test_service.json
+# start daemon
+../daemon/./vsomeipd &
+PID_VSOMEIPD=$!
+
+WAIT_PIDS=()
+# Start the service
+export VSOMEIP_APPLICATION_NAME=local_routing_test_service
+./local_routing_test_service &
+SERIVCE_PID=$!
+WAIT_PIDS+=($!)
+sleep 1;
+
+check_tcp_udp_sockets_are_closed $SERIVCE_PID
+
+# Start the client
+export VSOMEIP_APPLICATION_NAME=local_routing_test_client
+export VSOMEIP_CONFIGURATION=local_routing_test_client.json
+./local_routing_test_client &
+CLIENT_PID=$!
+WAIT_PIDS+=($!)
+
+check_tcp_udp_sockets_are_closed $SERIVCE_PID
+check_tcp_udp_sockets_are_closed $CLIENT_PID
+
+# Wait until client and service are finished
+for job in ${WAIT_PIDS[*]}
+do
+ # Fail gets incremented if either client or service exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+done
+
+kill $PID_VSOMEIPD
+sleep 1
+
+# Check if client and server both exited successfully and the service didnt't
+# have any open
+if [ $FAIL -eq 0 ]
+then
+ exit 0
+else
+ exit 1
+fi
diff --git a/test/routing_tests/external_local_routing_test_service.cpp b/test/routing_tests/external_local_routing_test_service.cpp
index e8d8891..d92f958 100644
--- a/test/routing_tests/external_local_routing_test_service.cpp
+++ b/test/routing_tests/external_local_routing_test_service.cpp
@@ -20,7 +20,10 @@ void external_local_routing_test_service::init()
{
std::lock_guard<std::mutex> its_lock(mutex_);
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID,
std::bind(&external_local_routing_test_service::on_message, this,
@@ -47,9 +50,7 @@ void external_local_routing_test_service::start()
void external_local_routing_test_service::stop()
{
VSOMEIP_INFO << "Stopping...";
- app_->unregister_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID);
- app_->unregister_state_handler();
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/routing_tests/local_routing_test_client.cpp b/test/routing_tests/local_routing_test_client.cpp
index a97c63c..f280eb2 100644
--- a/test/routing_tests/local_routing_test_client.cpp
+++ b/test/routing_tests/local_routing_test_client.cpp
@@ -20,7 +20,10 @@ local_routing_test_client::local_routing_test_client(bool _use_tcp) :
void local_routing_test_client::init()
{
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&local_routing_test_client::on_state, this,
@@ -47,12 +50,7 @@ void local_routing_test_client::start()
void local_routing_test_client::stop()
{
VSOMEIP_INFO << "Stopping...";
- app_->unregister_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- app_->unregister_state_handler();
- app_->unregister_message_handler(vsomeip::ANY_SERVICE,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD);
-
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/routing_tests/local_routing_test_client.json b/test/routing_tests/local_routing_test_client.json
index 4509768..2b4bdaa 100644
--- a/test/routing_tests/local_routing_test_client.json
+++ b/test/routing_tests/local_routing_test_client.json
@@ -1,6 +1,7 @@
{
"unicast" : "127.0.0.1",
"netmask" : "255.255.255.0",
+ "diagnosis":"0x12",
"logging" :
{
"level" : "debug",
@@ -18,7 +19,7 @@
[
{
"name" : "local_routing_test_client",
- "id" : "0x1343"
+ "id" : "0x1255"
}
],
diff --git a/test/routing_tests/local_routing_test_service.cpp b/test/routing_tests/local_routing_test_service.cpp
index 1f879dc..3a61ddf 100644
--- a/test/routing_tests/local_routing_test_service.cpp
+++ b/test/routing_tests/local_routing_test_service.cpp
@@ -19,7 +19,10 @@ void local_routing_test_service::init()
{
std::lock_guard<std::mutex> its_lock(mutex_);
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID,
std::bind(&local_routing_test_service::on_message, this,
@@ -41,9 +44,7 @@ void local_routing_test_service::start()
void local_routing_test_service::stop()
{
VSOMEIP_INFO << "Stopping...";
- app_->unregister_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID);
- app_->unregister_state_handler();
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/routing_tests/local_routing_test_service.json b/test/routing_tests/local_routing_test_service.json
index edd9be6..f5da8c6 100644
--- a/test/routing_tests/local_routing_test_service.json
+++ b/test/routing_tests/local_routing_test_service.json
@@ -1,5 +1,6 @@
{
"unicast" : "127.0.0.1",
+ "diagnosis":"0x12",
"logging" :
{
"level" : "debug",
diff --git a/test/someip_test_globals.hpp b/test/someip_test_globals.hpp
index fcde342..cb127e5 100644
--- a/test/someip_test_globals.hpp
+++ b/test/someip_test_globals.hpp
@@ -21,10 +21,10 @@ constexpr vsomeip::method_t TEST_SERVICE_METHOD_ID_SHUTDOWN = 0x7777;
constexpr vsomeip::client_t TEST_SERVICE_CLIENT_ID = 0x1277;
// Client local
-constexpr vsomeip::client_t TEST_CLIENT_CLIENT_ID = 0x1343;
+constexpr vsomeip::client_t TEST_CLIENT_CLIENT_ID = 0x1255;
// Client external
-constexpr vsomeip::client_t TEST_CLIENT_EXTERNAL_CLIENT_ID = 0x1344;
+constexpr vsomeip::client_t TEST_CLIENT_EXTERNAL_CLIENT_ID = 0x1644;
constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND = 10;
diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in
index 27cc8c4..7acf45b 100644
--- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in
+++ b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in
@@ -65,7 +65,13 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
},
"supports_selective_broadcasts" :
{
diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in
index 1541410..7db7eed 100644
--- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in
+++ b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in
@@ -65,7 +65,13 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
},
"supports_selective_broadcasts" :
{
diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
index 9641690..fd3c047 100644
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
+++ b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
@@ -36,7 +36,10 @@ public:
stop_thread_(std::bind(&subscribe_notify_one_test_service::wait_for_stop, this)),
wait_for_notify_(true),
notify_thread_(std::bind(&subscribe_notify_one_test_service::notify_one, this)) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&subscribe_notify_one_test_service::on_state, this,
std::placeholders::_1));
@@ -362,6 +365,7 @@ public:
}
std::this_thread::sleep_for(std::chrono::seconds(6));
+ app_->clear_all_handler();
app_->stop();
}
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in
index 9c64a13..332f55f 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in
@@ -49,6 +49,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in
index 2d62dbe..ca25c33 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in
@@ -49,6 +49,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in
index a363388..87d1934 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in
index 38dadb8..a3cdab7 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
index 6abc1e3..1ee1123 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in
index 7307fb2..43f0453 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in
index 8d8cfb0..fb7073f 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in
index b429266..27f9f34 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in
index 09788c9..a60ee3d 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in
index 9c4d63c..9854b75 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in
index a363388..87d1934 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in
index bc38eaf..3786f74 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in
index 09788c9..a60ee3d 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in
index caed298..cbe671e 100644
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in
+++ b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in
@@ -65,6 +65,12 @@
"enable":"true",
"multicast":"224.0.0.1",
"port":"30490",
- "protocol":"udp"
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "10",
+ "repetitions_base_delay" : "30",
+ "repetitions_max" : "3",
+ "cyclic_offer_delay" : "1000",
+ "ttl" : "3"
}
} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp b/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
index a07f00c..9dd3bbb 100644
--- a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
+++ b/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
@@ -37,7 +37,10 @@ public:
stop_thread_(std::bind(&subscribe_notify_test_service::wait_for_stop, this)),
wait_for_notify_(true),
notify_thread_(std::bind(&subscribe_notify_test_service::notify, this)) {
- app_->init();
+ if (!app_->init()) {
+ VSOMEIP_ERROR << "Couldn't initialize application";
+ EXPECT_TRUE(false);
+ }
app_->register_state_handler(
std::bind(&subscribe_notify_test_service::on_state, this,
std::placeholders::_1));
@@ -356,6 +359,7 @@ public:
}
std::this_thread::sleep_for(std::chrono::seconds(1));
+ app_->clear_all_handler();
app_->stop();
}