summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDirk Huss <dirk_huss@mentor.com>2015-11-25 15:11:49 +0100
committerDirk Huss <dirk_huss@mentor.com>2015-11-25 15:11:49 +0100
commit78be04b467566633318a277ccd2d968c1c4e46bf (patch)
tree444ef60cfdca2cc80d584f26911fb08b93a034b9 /test
parent40d4759f262a86bcebaf3a91d9d813f4d6a3ae10 (diff)
downloadvSomeIP-78be04b467566633318a277ccd2d968c1c4e46bf.tar.gz
vSomeIP 2.0.02.0.0
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1250
-rw-r--r--test/application_tests/application_test.cpp174
-rw-r--r--test/application_tests/application_test.json45
-rw-r--r--test/application_tests/application_test_no_dispatch_threads.json37
-rwxr-xr-xtest/application_tests/application_test_starter.sh31
-rw-r--r--test/big_payload_tests/big_payload_test_client.cpp185
-rw-r--r--test/big_payload_tests/big_payload_test_client.hpp49
-rwxr-xr-xtest/big_payload_tests/big_payload_test_client_local_start.sh (renamed from test/magic_cookies_test_service_start.sh)7
-rwxr-xr-xtest/big_payload_tests/big_payload_test_client_start.sh10
-rwxr-xr-xtest/big_payload_tests/big_payload_test_external_starter.sh48
-rw-r--r--test/big_payload_tests/big_payload_test_globals.hpp17
-rw-r--r--test/big_payload_tests/big_payload_test_local.json54
-rwxr-xr-xtest/big_payload_tests/big_payload_test_local_starter.sh38
-rw-r--r--test/big_payload_tests/big_payload_test_service.cpp163
-rw-r--r--test/big_payload_tests/big_payload_test_service.hpp43
-rwxr-xr-xtest/big_payload_tests/big_payload_test_service_external_start.sh10
-rwxr-xr-xtest/big_payload_tests/big_payload_test_service_local_start.sh10
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_client.json.in43
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_service.json.in54
-rw-r--r--test/client_id_tests/client_id_test_globals.hpp32
-rwxr-xr-xtest/client_id_tests/client_id_test_master_starter.sh64
-rw-r--r--test/client_id_tests/client_id_test_service.cpp248
-rwxr-xr-xtest/client_id_tests/client_id_test_slave_starter.sh50
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in56
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in56
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in56
-rw-r--r--test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in56
-rw-r--r--test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in70
-rw-r--r--test/configuration-test.cpp214
-rw-r--r--test/configuration_tests/configuration-test-deprecated.json131
-rw-r--r--test/configuration_tests/configuration-test.cpp346
-rw-r--r--test/configuration_tests/configuration-test.json103
-rw-r--r--test/header_factory_tests/header_factory_test_client.cpp45
-rw-r--r--test/header_factory_tests/header_factory_test_client.hpp2
-rw-r--r--test/header_factory_tests/header_factory_test_client.json121
-rwxr-xr-xtest/header_factory_tests/header_factory_test_client_start.sh2
-rwxr-xr-xtest/header_factory_tests/header_factory_test_send_receive_starter.sh4
-rw-r--r--test/header_factory_tests/header_factory_test_service.cpp27
-rw-r--r--test/header_factory_tests/header_factory_test_service.hpp2
-rw-r--r--test/header_factory_tests/header_factory_test_service.json189
-rwxr-xr-xtest/header_factory_tests/header_factory_test_service_start.sh2
-rw-r--r--test/magic-cookies-test-client.cpp179
-rw-r--r--test/magic_cookies_tests/conf/magic_cookies_test_client.json.in85
-rw-r--r--test/magic_cookies_tests/conf/magic_cookies_test_service.json.in88
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_client.cpp192
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_client_start.sh (renamed from test/magic_cookies_test_client_start.sh)6
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_service.cpp155
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_service_start.sh9
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_starter.sh (renamed from test/magic_cookies_test_starter.sh)16
-rw-r--r--test/payload_tests/conf/external_local_payload_test_client_external.json.in (renamed from test/payload_tests/external_local_payload_test_client_external.json)36
-rw-r--r--test/payload_tests/conf/external_local_payload_test_client_local.json.in (renamed from test/payload_tests/external_local_payload_test_client_local.json)31
-rw-r--r--test/payload_tests/conf/external_local_payload_test_service.json.in46
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_external_start.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_external_starter.sh4
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_and_external_starter.sh6
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_start.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_starter.sh4
-rw-r--r--test/payload_tests/external_local_payload_test_service.json67
-rwxr-xr-xtest/payload_tests/external_local_payload_test_service_client_external_start.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_service_start.sh2
-rw-r--r--test/payload_tests/local_payload_test_client.json15
-rwxr-xr-xtest/payload_tests/local_payload_test_client_start.sh2
-rw-r--r--test/payload_tests/local_payload_test_service.json31
-rwxr-xr-xtest/payload_tests/local_payload_test_service_start.sh2
-rwxr-xr-xtest/payload_tests/local_payload_test_starter.sh4
-rw-r--r--test/payload_tests/payload_test_client.cpp63
-rw-r--r--test/payload_tests/payload_test_client.hpp2
-rw-r--r--test/payload_tests/payload_test_service.cpp33
-rw-r--r--test/payload_tests/payload_test_service.hpp2
-rw-r--r--test/payload_tests/stopwatch.cpp18
-rw-r--r--test/payload_tests/stopwatch.hpp4
-rw-r--r--test/readme.txt99
-rw-r--r--test/routing_tests/conf/external_local_routing_test_client_external.json.in (renamed from test/routing_tests/external_local_routing_test_client_external.json)18
-rw-r--r--test/routing_tests/conf/external_local_routing_test_service.json.in41
-rwxr-xr-xtest/routing_tests/external_local_routing_test_client_external_start.sh2
-rw-r--r--test/routing_tests/external_local_routing_test_service.cpp19
-rw-r--r--test/routing_tests/external_local_routing_test_service.hpp4
-rw-r--r--test/routing_tests/external_local_routing_test_service.json62
-rwxr-xr-xtest/routing_tests/external_local_routing_test_service_start.sh2
-rwxr-xr-xtest/routing_tests/external_local_routing_test_starter.sh4
-rw-r--r--test/routing_tests/local_routing_test_client.cpp50
-rw-r--r--test/routing_tests/local_routing_test_client.hpp4
-rw-r--r--test/routing_tests/local_routing_test_client.json10
-rwxr-xr-xtest/routing_tests/local_routing_test_client_start.sh2
-rw-r--r--test/routing_tests/local_routing_test_service.cpp30
-rw-r--r--test/routing_tests/local_routing_test_service.hpp8
-rw-r--r--test/routing_tests/local_routing_test_service.json31
-rwxr-xr-xtest/routing_tests/local_routing_test_service_start.sh2
-rwxr-xr-xtest/routing_tests/local_routing_test_starter.sh4
-rw-r--r--test/someip_test_globals.hpp2
93 files changed, 4462 insertions, 1394 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c944610..43254a5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,523 +14,955 @@ include_directories(
set(TEST_LINK_LIBRARIES gtest)
# Function to copy files into the build directory (or anywhere else)
+# On unixoid systems this function will create symlinks instead
# SOURCE_PATH: Path to the file which should be copied
# DESTINATION_PATH: destination file
# TARGET_TO_DEPEND: The copying of the file will be added as
# a dependency to this target
function(copy_to_builddir SOURCE_PATH DESTINATION_PATH TARGET_TO_DEPEND)
- ADD_CUSTOM_COMMAND(
- OUTPUT "${DESTINATION_PATH}"
- COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${DESTINATION_PATH}"
- DEPENDS "${SOURCE_PATH}"
- COMMENT "Copying \"${SOURCE_PATH}\" into build directory"
- )
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows" OR NOT ${TEST_SYMLINK_CONFIG_FILES})
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${DESTINATION_PATH}"
+ COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${DESTINATION_PATH}"
+ DEPENDS "${SOURCE_PATH}"
+ COMMENT "Copying \"${SOURCE_PATH}\" into build directory"
+ )
+ else()
+ if(${TEST_SYMLINK_CONFIG_FILES_RELATIVE})
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${DESTINATION_PATH}"
+ # Create a relative link
+ COMMAND ln -s -r "${SOURCE_PATH}" "${DESTINATION_PATH}"
+ DEPENDS "${SOURCE_PATH}"
+ COMMENT "Symlinking \"${SOURCE_PATH}\" into build directory"
+ )
+ else()
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${DESTINATION_PATH}"
+ # Create an absolute link
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "${SOURCE_PATH}" "${DESTINATION_PATH}"
+ DEPENDS "${SOURCE_PATH}"
+ COMMENT "Symlinking \"${SOURCE_PATH}\" into build directory"
+ )
+ endif()
+ endif()
# Add a random number to the end of the string to avoid problems with
# duplicate filenames
set(FILENAME "")
get_filename_component(FILENAME ${SOURCE_PATH} NAME )
string(RANDOM LENGTH 4 ALPHABET 0123456789 RANDOMNUMBER)
- ADD_CUSTOM_TARGET(copy_${FILENAME}_${RANDOMNUMBER}
- DEPENDS "${DESTINATION_PATH}"
- )
- ADD_DEPENDENCIES(${TARGET_TO_DEPEND} copy_${FILENAME}_${RANDOMNUMBER})
+ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ ADD_CUSTOM_TARGET(copy_${FILENAME}_${RANDOMNUMBER}
+ DEPENDS "${DESTINATION_PATH}"
+ )
+ ADD_DEPENDENCIES(${TARGET_TO_DEPEND} copy_${FILENAME}_${RANDOMNUMBER})
+ else()
+ ADD_CUSTOM_TARGET(symlink_${FILENAME}_${RANDOMNUMBER}
+ DEPENDS "${DESTINATION_PATH}"
+ )
+ ADD_DEPENDENCIES(${TARGET_TO_DEPEND} symlink_${FILENAME}_${RANDOMNUMBER})
+ endif()
endfunction()
##############################################################################
# configuration-test
##############################################################################
+if(NOT ${TESTS_BAT})
+ set(TEST_CONFIGURATION configuration-test)
+
+ add_executable(${TEST_CONFIGURATION} configuration_tests/configuration-test.cpp)
+ target_link_libraries(${TEST_CONFIGURATION}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ )
+
+ # The following will make sure that ${TEST_CONFIGURATION_CONFIG_FILE} is copied
+ # from the config folder into the test folder in the builddirectory
+ # This makes it possible to call the configuration test within the build directory
+ set(TEST_CONFIGURATION_CONFIG_FILE configuration-test.json)
+ set(TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE configuration-test-deprecated.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/configuration_tests/${TEST_CONFIGURATION_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CONFIGURATION_CONFIG_FILE}
+ ${TEST_CONFIGURATION}
+ )
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/configuration_tests/${TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE}
+ ${TEST_CONFIGURATION}
+ )
+endif()
+##############################################################################
+# application test
+##############################################################################
+if(NOT ${TESTS_BAT})
+ set(TEST_APPLICATION application_test)
+
+ add_executable(${TEST_APPLICATION} application_tests/${TEST_APPLICATION}.cpp)
+ target_link_libraries(${TEST_APPLICATION}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-set(TEST_CONFIGURATION configuration-test)
-
-add_executable(${TEST_CONFIGURATION} configuration-test.cpp)
-target_link_libraries(${TEST_CONFIGURATION}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
-)
+ set(TEST_APPLICATION_CONFIGURATION_FILE ${TEST_APPLICATION}.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_CONFIGURATION_FILE}
+ ${TEST_APPLICATION}
+ )
-# The following will make sure that ${TEST_CONFIGURATION_CONFIG_FILE} is copied
-# from the config folder into the test folder in the builddirectory
-# This makes it possible to call the configuration test within the build directory
-set(TEST_CONFIGURATION_CONFIG_FILE vsomeip-test.json)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/config/${TEST_CONFIGURATION_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CONFIGURATION_CONFIG_FILE}
- ${TEST_CONFIGURATION}
-)
+ set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE ${TEST_APPLICATION}_no_dispatch_threads.json)
+ 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_STARTER ${TEST_APPLICATION}_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER}
+ ${TEST_APPLICATION}
+ )
+endif()
##############################################################################
# magic-cookies-test-client
##############################################################################
-set(TEST_MAGIC_COOKIES_NAME magic_cookies_test)
-
-set(TEST_MAGIC_COOKIES_CLIENT magic-cookies-test-client)
-add_executable(${TEST_MAGIC_COOKIES_CLIENT} magic-cookies-test-client.cpp)
-target_link_libraries(${TEST_MAGIC_COOKIES_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
-)
-add_dependencies(${TEST_MAGIC_COOKIES_CLIENT} response-sample)
-
-# Copy config file for client into $BUILDDIR/test
-set(TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE vsomeip-magic-cookies-client.json)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/config/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}
- ${TEST_MAGIC_COOKIES_CLIENT}
-)
+if(NOT ${TESTS_BAT})
+ set(TEST_MAGIC_COOKIES_NAME magic_cookies_test)
+
+ set(TEST_MAGIC_COOKIES_CLIENT ${TEST_MAGIC_COOKIES_NAME}_client)
+ add_executable(${TEST_MAGIC_COOKIES_CLIENT} magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT}.cpp)
+ target_link_libraries(${TEST_MAGIC_COOKIES_CLIENT}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+ )
-# Copy bashscript to start client into $BUILDDIR/test
-set(TEST_MAGIC_COOKIES_CLIENT_UNDERSCORE magic_cookies_test_client)
-set(TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT ${TEST_MAGIC_COOKIES_CLIENT_UNDERSCORE}_start.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT}
- ${TEST_MAGIC_COOKIES_CLIENT}
-)
+ set(TEST_MAGIC_COOKIES_SERVICE ${TEST_MAGIC_COOKIES_NAME}_service)
+ add_executable(${TEST_MAGIC_COOKIES_SERVICE} magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE}.cpp)
+ target_link_libraries(${TEST_MAGIC_COOKIES_SERVICE}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+ )
-set(TEST_MAGIC_COOKIES_SERVICE magic_cookies_test_service)
+ # Copy config file for client into $BUILDDIR/test
+ set(TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE ${TEST_MAGIC_COOKIES_CLIENT}.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/conf/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}
+ ${TEST_MAGIC_COOKIES_CLIENT}
+ )
-# Copy config file for service into $BUILDDIR/test
-set(TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE vsomeip-magic-cookies-service.json)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/config/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}
- ${TEST_MAGIC_COOKIES_CLIENT}
-)
+ # Copy bashscript to start client into $BUILDDIR/test
+ set(TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT ${TEST_MAGIC_COOKIES_CLIENT}_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT}
+ ${TEST_MAGIC_COOKIES_CLIENT}
+ )
-# Copy bashscript to start service into $BUILDDIR/test
-set(TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT ${TEST_MAGIC_COOKIES_SERVICE}_start.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT}
- ${TEST_MAGIC_COOKIES_CLIENT}
-)
+ set(TEST_MAGIC_COOKIES_SERVICE magic_cookies_test_service)
+ # Copy config file for service into $BUILDDIR/test
+ set(TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE ${TEST_MAGIC_COOKIES_SERVICE}.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/conf/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}
+ ${TEST_MAGIC_COOKIES_SERVICE}
+ )
-# Copy bashscript to start client and server $BUILDDIR/test
-set(TEST_MAGIC_COOKIES_STARTER ${TEST_MAGIC_COOKIES_NAME}_starter.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/${TEST_MAGIC_COOKIES_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER}
- ${TEST_MAGIC_COOKIES_CLIENT}
-)
+ # Copy bashscript to start service into $BUILDDIR/test
+ set(TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT ${TEST_MAGIC_COOKIES_SERVICE}_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT}
+ ${TEST_MAGIC_COOKIES_CLIENT}
+ )
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_MAGIC_COOKIES_STARTER ${TEST_MAGIC_COOKIES_NAME}_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER}
+ ${TEST_MAGIC_COOKIES_CLIENT}
+ )
+endif()
##############################################################################
# someip-header-factory-test
##############################################################################
-set(TEST_HEADER_FACTORY_NAME header_factory_test)
-
-set(TEST_HEADER_FACTORY header_factory_test)
-add_executable(${TEST_HEADER_FACTORY} header_factory_tests/header_factory_test.cpp)
-target_link_libraries(${TEST_HEADER_FACTORY}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
- ${TEST_LINK_LIBRARIES}
-)
-
-##############################################################################
-# Now comes the second part of the header factory test which consists of ouf
-# a client and a service both with settings file and bash scripts to start them
-set(TEST_HEADER_FACTORY_CLIENT header_factory_test_client)
-add_executable(${TEST_HEADER_FACTORY_CLIENT} header_factory_tests/${TEST_HEADER_FACTORY_CLIENT}.cpp)
-target_link_libraries(${TEST_HEADER_FACTORY_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
- ${TEST_LINK_LIBRARIES}
-)
+if(NOT ${TESTS_BAT})
+ set(TEST_HEADER_FACTORY_NAME header_factory_test)
+
+ set(TEST_HEADER_FACTORY header_factory_test)
+ add_executable(${TEST_HEADER_FACTORY} header_factory_tests/header_factory_test.cpp)
+ target_link_libraries(${TEST_HEADER_FACTORY}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${TEST_LINK_LIBRARIES}
+ )
-# Copy config file for client into $BUILDDIR/test
-set(TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE ${TEST_HEADER_FACTORY_CLIENT}.json)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE}
- ${TEST_HEADER_FACTORY_CLIENT}
-)
+ ##############################################################################
+ # Now comes the second part of the header factory test which consists of ouf
+ # a client and a service both with settings file and bash scripts to start them
+ set(TEST_HEADER_FACTORY_CLIENT header_factory_test_client)
+ add_executable(${TEST_HEADER_FACTORY_CLIENT} header_factory_tests/${TEST_HEADER_FACTORY_CLIENT}.cpp)
+ target_link_libraries(${TEST_HEADER_FACTORY_CLIENT}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${TEST_LINK_LIBRARIES}
+ )
-# Copy bashscript to start client into $BUILDDIR/test
-set(TEST_HEADER_FACTORY_CLIENT_START_SCRIPT ${TEST_HEADER_FACTORY_CLIENT}_start.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT}
- ${TEST_HEADER_FACTORY_CLIENT}
-)
+ # Copy config file for client into $BUILDDIR/test
+ set(TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE ${TEST_HEADER_FACTORY_CLIENT}.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE}
+ ${TEST_HEADER_FACTORY_CLIENT}
+ )
-set(TEST_HEADER_FACTORY_SERVICE header_factory_test_service)
-add_executable(${TEST_HEADER_FACTORY_SERVICE} header_factory_tests/${TEST_HEADER_FACTORY_SERVICE}.cpp)
-target_link_libraries(${TEST_HEADER_FACTORY_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
- ${TEST_LINK_LIBRARIES}
-)
+ # Copy bashscript to start client into $BUILDDIR/test
+ set(TEST_HEADER_FACTORY_CLIENT_START_SCRIPT ${TEST_HEADER_FACTORY_CLIENT}_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT}
+ ${TEST_HEADER_FACTORY_CLIENT}
+ )
-# Copy config file for service into $BUILDDIR/test
-set(TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE ${TEST_HEADER_FACTORY_SERVICE}.json)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE}
- ${TEST_HEADER_FACTORY_SERVICE}
-)
+ set(TEST_HEADER_FACTORY_SERVICE header_factory_test_service)
+ add_executable(${TEST_HEADER_FACTORY_SERVICE} header_factory_tests/${TEST_HEADER_FACTORY_SERVICE}.cpp)
+ target_link_libraries(${TEST_HEADER_FACTORY_SERVICE}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${TEST_LINK_LIBRARIES}
+ )
-# Copy bashscript to start service into $BUILDDIR/test
-set(TEST_HEADER_FACTORY_SERVICE_START_SCRIPT ${TEST_HEADER_FACTORY_SERVICE}_start.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT}
- ${TEST_HEADER_FACTORY_SERVICE}
-)
+ # Copy config file for service into $BUILDDIR/test
+ set(TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE ${TEST_HEADER_FACTORY_SERVICE}.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE}
+ ${TEST_HEADER_FACTORY_SERVICE}
+ )
-# Copy bashscript to start client and server $BUILDDIR/test
-set(TEST_HEADER_FACTORY_STARTER header_factory_test_send_receive_starter.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_STARTER}
- ${TEST_HEADER_FACTORY_CLIENT}
-)
+ # Copy bashscript to start service into $BUILDDIR/test
+ set(TEST_HEADER_FACTORY_SERVICE_START_SCRIPT ${TEST_HEADER_FACTORY_SERVICE}_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT}
+ ${TEST_HEADER_FACTORY_SERVICE}
+ )
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_HEADER_FACTORY_STARTER header_factory_test_send_receive_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_STARTER}
+ ${TEST_HEADER_FACTORY_CLIENT}
+ )
+endif()
##############################################################################
# routing-test
##############################################################################
-set(TEST_LOCAL_ROUTING_NAME local_routing_test)
-set(TEST_LOCAL_ROUTING_SERVICE local_routing_test_service)
+if(NOT ${TESTS_BAT})
+ set(TEST_LOCAL_ROUTING_NAME local_routing_test)
-add_executable(${TEST_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_LOCAL_ROUTING_SERVICE}.cpp)
-target_link_libraries(${TEST_LOCAL_ROUTING_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
-)
+ set(TEST_LOCAL_ROUTING_SERVICE local_routing_test_service)
+ add_executable(${TEST_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_LOCAL_ROUTING_SERVICE}.cpp)
+ target_link_libraries(${TEST_LOCAL_ROUTING_SERVICE}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-# Copy config file for service into $BUILDDIR/test
-set(TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_LOCAL_ROUTING_SERVICE}.json)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${TEST_LOCAL_ROUTING_SERVICE}
-)
+ # Copy config file for service into $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_LOCAL_ROUTING_SERVICE}.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
+ ${TEST_LOCAL_ROUTING_SERVICE}
+ )
-# Copy bashscript to start service into $BUILDDIR/test
-set(TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_LOCAL_ROUTING_SERVICE}_start.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${TEST_LOCAL_ROUTING_SERVICE}
-)
+ # Copy bashscript to start service into $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_LOCAL_ROUTING_SERVICE}_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
+ ${TEST_LOCAL_ROUTING_SERVICE}
+ )
-set(TEST_LOCAL_ROUTING_CLIENT local_routing_test_client)
+ set(TEST_LOCAL_ROUTING_CLIENT local_routing_test_client)
+ add_executable(${TEST_LOCAL_ROUTING_CLIENT} routing_tests/${TEST_LOCAL_ROUTING_CLIENT}.cpp)
+ target_link_libraries(${TEST_LOCAL_ROUTING_CLIENT}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-add_executable(${TEST_LOCAL_ROUTING_CLIENT} routing_tests/${TEST_LOCAL_ROUTING_CLIENT}.cpp)
-target_link_libraries(${TEST_LOCAL_ROUTING_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
-)
+ # Copy config file for client into $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_LOCAL_ROUTING_CLIENT}.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
+ ${TEST_LOCAL_ROUTING_CLIENT}
+ )
-# Copy config file for client into $BUILDDIR/test
-set(TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_LOCAL_ROUTING_CLIENT}.json)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${TEST_LOCAL_ROUTING_CLIENT}
-)
+ # Copy bashscript to start client into $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_LOCAL_ROUTING_CLIENT}_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
+ ${TEST_LOCAL_ROUTING_CLIENT}
+ )
-# Copy bashscript to start client into $BUILDDIR/test
-set(TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_LOCAL_ROUTING_CLIENT}_start.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${TEST_LOCAL_ROUTING_CLIENT}
-)
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh)
+ 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}
+ )
-# Copy bashscript to start client and server $BUILDDIR/test
-set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh)
-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}
-)
+ ##############################################################################
+ set(TEST_EXTERNAL_LOCAL_ROUTING_NAME external_local_routing_test)
+ set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE external_local_routing_test_service)
+ add_executable(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.cpp)
+ target_link_libraries(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-##############################################################################
+ # Copy config file for service into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
+ ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
+ )
-set(TEST_EXTERNAL_LOCAL_ROUTING_NAME external_local_routing_test)
+ # Copy bashscript to start service into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT}
+ ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
+ )
-set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE external_local_routing_test_service)
-add_executable(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.cpp)
-target_link_libraries(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
-)
+ # Copy bashscript to start external client into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT external_local_routing_test_client_external)
+ set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT}
+ ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
+ )
-# Copy config file for service into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.json)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
-)
+ # Copy config file for client into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
+ ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
+ )
-# Copy bashscript to start service into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}_start.sh)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
-)
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_ROUTING_STARTER external_local_routing_test_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
+ ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
+ )
+else()
+ set(TEST_LOCAL_ROUTING_NAME local_routing_test)
+
+ set(TEST_LOCAL_ROUTING_SERVICE local_routing_test_service)
+ add_executable(${TEST_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_LOCAL_ROUTING_SERVICE}.cpp)
+ target_link_libraries(${TEST_LOCAL_ROUTING_SERVICE}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-# Copy bashscript to start external client into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT external_local_routing_test_client_external)
-set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}_start.sh)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
-)
+ # Copy config file for service into $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_LOCAL_ROUTING_SERVICE}.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
+ ${TEST_LOCAL_ROUTING_SERVICE}
+ )
-# Copy config file for client into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}.json)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
-)
+ # Copy bashscript to start service into $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_LOCAL_ROUTING_SERVICE}_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
+ ${TEST_LOCAL_ROUTING_SERVICE}
+ )
-# Copy bashscript to start client and server $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_ROUTING_STARTER external_local_routing_test_starter.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
-)
+ set(TEST_LOCAL_ROUTING_CLIENT local_routing_test_client)
+ add_executable(${TEST_LOCAL_ROUTING_CLIENT} routing_tests/${TEST_LOCAL_ROUTING_CLIENT}.cpp)
+ target_link_libraries(${TEST_LOCAL_ROUTING_CLIENT}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ # Copy config file for client into $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_LOCAL_ROUTING_CLIENT}.json)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
+ ${TEST_LOCAL_ROUTING_CLIENT}
+ )
+
+ # Copy bashscript to start client into $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_LOCAL_ROUTING_CLIENT}_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
+ ${TEST_LOCAL_ROUTING_CLIENT}
+ )
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh)
+ 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}
+ )
+endif()
##############################################################################
# payload-test
##############################################################################
-set(TEST_LOCAL_PAYLOAD_NAME local_payload_test)
+if(NOT ${TESTS_BAT})
+ set(TEST_LOCAL_PAYLOAD_NAME local_payload_test)
-set(TEST_PAYLOAD_SERVICE payload_test_service)
-add_executable(${TEST_PAYLOAD_SERVICE} payload_tests/${TEST_PAYLOAD_SERVICE}.cpp)
-target_link_libraries(${TEST_PAYLOAD_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
-)
+ set(TEST_PAYLOAD_SERVICE payload_test_service)
+ add_executable(${TEST_PAYLOAD_SERVICE} payload_tests/${TEST_PAYLOAD_SERVICE}.cpp)
+ target_link_libraries(${TEST_PAYLOAD_SERVICE}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-# Copy config file for service into $BUILDDIR/test
-set(TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE local_${TEST_PAYLOAD_SERVICE}.json)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- ${TEST_PAYLOAD_SERVICE}
-)
+ # Copy config file for service into $BUILDDIR/test
+ set(TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE local_${TEST_PAYLOAD_SERVICE}.json)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
+ ${TEST_PAYLOAD_SERVICE}
+ )
-# Copy bashscript to start service into $BUILDDIR/test
-set(TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT local_${TEST_PAYLOAD_SERVICE}_start.sh)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
- ${TEST_PAYLOAD_SERVICE}
-)
+ # Copy bashscript to start service into $BUILDDIR/test
+ set(TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT local_${TEST_PAYLOAD_SERVICE}_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
+ ${TEST_PAYLOAD_SERVICE}
+ )
-set(TEST_PAYLOAD_CLIENT payload_test_client)
+ set(TEST_PAYLOAD_CLIENT payload_test_client)
+ add_executable(${TEST_PAYLOAD_CLIENT}
+ payload_tests/${TEST_PAYLOAD_CLIENT}.cpp
+ payload_tests/stopwatch.cpp
+ )
+ target_link_libraries(${TEST_PAYLOAD_CLIENT}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-add_executable(${TEST_PAYLOAD_CLIENT}
- payload_tests/${TEST_PAYLOAD_CLIENT}.cpp
- payload_tests/stopwatch.cpp
-)
-target_link_libraries(${TEST_PAYLOAD_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
-)
+ # Copy config file for client into $BUILDDIR/test
+ set(TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE local_${TEST_PAYLOAD_CLIENT}.json)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
+ ${TEST_PAYLOAD_CLIENT}
+ )
-# Copy config file for client into $BUILDDIR/test
-set(TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE local_${TEST_PAYLOAD_CLIENT}.json)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- ${TEST_PAYLOAD_CLIENT}
-)
+ # Copy bashscript to start client into $BUILDDIR/test
+ set(TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT local_${TEST_PAYLOAD_CLIENT}_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT}
+ ${TEST_PAYLOAD_CLIENT}
+ )
-# Copy bashscript to start client into $BUILDDIR/test
-set(TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT local_${TEST_PAYLOAD_CLIENT}_start.sh)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT}
- ${TEST_PAYLOAD_CLIENT}
-)
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_LOCAL_PAYLOAD_STARTER local_payload_test_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_STARTER}
+ ${TEST_PAYLOAD_CLIENT}
+ )
-# Copy bashscript to start client and server $BUILDDIR/test
-set(TEST_LOCAL_PAYLOAD_STARTER local_payload_test_starter.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_STARTER}
- ${TEST_PAYLOAD_CLIENT}
-)
+ ##############################################################################
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_NAME external_local_payload_test)
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE external_local_payload_test_service)
+
+ # Copy config file for service into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
+ ${TEST_PAYLOAD_SERVICE}
+ )
-##############################################################################
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_NAME external_local_payload_test)
+ # Copy bashscript to start service into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
+ ${TEST_PAYLOAD_SERVICE}
+ )
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE external_local_payload_test_service)
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL external_local_payload_test_client_local)
+
+ # Copy config file for client into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
+ ${TEST_PAYLOAD_CLIENT}
+ )
-# Copy config file for service into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}.json)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- ${TEST_PAYLOAD_SERVICE}
-)
+ # Copy bashscript to start client into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT}
+ ${TEST_PAYLOAD_CLIENT}
+ )
-# Copy bashscript to start service into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}_start.sh)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
- ${TEST_PAYLOAD_SERVICE}
-)
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME external_local_payload_test_client_local)
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
+ ${TEST_PAYLOAD_CLIENT}
+ )
+ ##############################################################################
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME external_local_payload_test_client_external)
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL external_local_payload_test_client_external)
+
+ # Copy config file for client into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}
+ ${TEST_PAYLOAD_CLIENT}
+ )
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL external_local_payload_test_client_local)
+ # Copy bashscript to start client into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT}
+ ${TEST_PAYLOAD_CLIENT}
+ )
-# Copy config file for client into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}.json)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- ${TEST_PAYLOAD_CLIENT}
-)
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL external_local_payload_test_service_client_external)
-# Copy bashscript to start client into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}_start.sh)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT}
- ${TEST_PAYLOAD_CLIENT}
-)
+ # Copy bashscript to start service into $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL}_start.sh)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT}
+ ${TEST_PAYLOAD_SERVICE}
+ )
-# Copy bashscript to start client and server $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME external_local_payload_test_client_local)
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
+ ${TEST_PAYLOAD_CLIENT}
+ )
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}_starter.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
- ${TEST_PAYLOAD_CLIENT}
-)
+ ##############################################################################
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME external_local_payload_test_client_local_and_external)
+ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
+ ${TEST_PAYLOAD_CLIENT}
+ )
+endif()
##############################################################################
+# big_payload_test
+##############################################################################
+if(NOT ${TESTS_BAT})
+ set(TEST_BIG_PAYLOAD_NAME big_payload_test)
+
+ set(TEST_BIG_PAYLOAD_SERVICE big_payload_test_service)
+ add_executable(${TEST_BIG_PAYLOAD_SERVICE} big_payload_tests/${TEST_BIG_PAYLOAD_SERVICE}.cpp)
+ target_link_libraries(${TEST_BIG_PAYLOAD_SERVICE}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME external_local_payload_test_client_external)
+ set(TEST_BIG_PAYLOAD_CLIENT big_payload_test_client)
+ add_executable(${TEST_BIG_PAYLOAD_CLIENT} big_payload_tests/${TEST_BIG_PAYLOAD_CLIENT}.cpp)
+ target_link_libraries(${TEST_BIG_PAYLOAD_CLIENT}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL external_local_payload_test_client_external)
+ # Copy config file for client and service into $BUILDDIR/test
+ set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local.json)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE}
+ ${TEST_BIG_PAYLOAD_SERVICE}
+ )
-# Copy config file for client into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}.json)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}
- ${TEST_PAYLOAD_CLIENT}
-)
+ # Copy config file for client and service into $BUILDDIR/test
+ set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_client.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}
+ ${TEST_BIG_PAYLOAD_CLIENT}
+ )
-# Copy bashscript to start client into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}_start.sh)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT}
- ${TEST_PAYLOAD_CLIENT}
-)
+ # Copy config file for client and service into $BUILDDIR/test
+ set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_service.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}
+ ${TEST_BIG_PAYLOAD_SERVICE}
+ )
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL external_local_payload_test_service_client_external)
+ # Copy bashscript to start client local to $BUILDDIR/test
+ set(TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_client_local_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT}
+ ${TEST_BIG_PAYLOAD_CLIENT}
+ )
-# Copy bashscript to start service into $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL}_start.sh)
-copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT}
- ${TEST_PAYLOAD_SERVICE}
-)
+ # Copy bashscript to start service local to $BUILDDIR/test
+ set(TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_service_local_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT}
+ ${TEST_BIG_PAYLOAD_SERVICE}
+ )
-# Copy bashscript to start client and server $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}_starter.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
- ${TEST_PAYLOAD_CLIENT}
-)
+ # Copy bashscript to start client and server $BUILDDIR/test
+ set(TEST_LOCAL_BIG_PAYLOAD_NAME big_payload_test_local)
+ set(TEST_LOCAL_BIG_PAYLOAD_STARTER ${TEST_LOCAL_BIG_PAYLOAD_NAME}_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER}
+ ${TEST_BIG_PAYLOAD_SERVICE}
+ )
+
+ # Copy bashscript to start client for external test into $BUILDDIR/test
+ set(TEST_EXTERNAL_BIG_PAYLOAD_NAME big_payload_test_external)
+ set(TEST_EXTERNAL_BIG_PAYLOAD_STARTER ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER}
+ ${TEST_BIG_PAYLOAD_SERVICE}
+ )
+
+ # Copy bashscript to start server for external into $BUILDDIR/test
+ set(TEST_EXTERNAL_BIG_PAYLOAD_NAME big_payload_test_external)
+ set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_service_external_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT}
+ ${TEST_BIG_PAYLOAD_SERVICE}
+ )
+ # Copy bashscript to start client for external test into $BUILDDIR/test
+ set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_client_start.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT}
+ ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT}
+ ${TEST_BIG_PAYLOAD_CLIENT}
+ )
+endif()
+
+##############################################################################
+# client id tests
##############################################################################
+if(NOT ${TESTS_BAT})
+ set(TEST_CLIENT_ID_NAME client_id_test)
+ set(TEST_CLIENT_ID_SERVICE ${TEST_CLIENT_ID_NAME}_service)
+ add_executable(${TEST_CLIENT_ID_SERVICE} client_id_tests/${TEST_CLIENT_ID_NAME}_service.cpp)
+ target_link_libraries(${TEST_CLIENT_ID_SERVICE}
+ vsomeip
+ ${Boost_LIBRARIES}
+ ${DL_LIBRARY}
+ ${TEST_LINK_LIBRARIES}
+ )
+
+ # Copy config files for test into $BUILDDIR/test
+ set(TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
+ ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports_master.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
-# Copy bashscript to start client and server $BUILDDIR/test
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME external_local_payload_test_client_local_and_external)
+ set(TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE
+ ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports_slave.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
-set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}_starter.sh)
-copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
- ${TEST_PAYLOAD_CLIENT}
-)
+ set(TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE
+ ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports_master.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
+
+ set(TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE
+ ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports_slave.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
+
+ set(TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE
+ ${TEST_CLIENT_ID_NAME}_same_client_ids_same_ports_master.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
+
+ set(TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE
+ ${TEST_CLIENT_ID_NAME}_same_client_ids_same_ports_slave.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
+
+ set(TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
+ ${TEST_CLIENT_ID_NAME}_same_client_ids_diff_ports_master.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
+
+ set(TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE
+ ${TEST_CLIENT_ID_NAME}_same_client_ids_diff_ports_slave.json)
+ configure_file(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
+ @ONLY)
+ copy_to_builddir(
+ ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
+
+ # copy starter scripts into builddir
+ set(TEST_CLIENT_ID_MASTER_STARTER ${TEST_CLIENT_ID_NAME}_master_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_MASTER_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
+ set(TEST_CLIENT_ID_SLAVE_STARTER ${TEST_CLIENT_ID_NAME}_slave_starter.sh)
+ copy_to_builddir(${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SLAVE_STARTER}
+ ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SLAVE_STARTER}
+ ${TEST_CLIENT_ID_SERVICE}
+ )
+endif()
##############################################################################
# Add for every test a dependency to gtest
##############################################################################
-add_dependencies(${TEST_CONFIGURATION} gtest)
-add_dependencies(${TEST_MAGIC_COOKIES_CLIENT} gtest)
-add_dependencies(${TEST_HEADER_FACTORY} gtest)
-add_dependencies(${TEST_HEADER_FACTORY_CLIENT} gtest)
-add_dependencies(${TEST_HEADER_FACTORY_SERVICE} gtest)
-add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest)
-add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest)
-add_dependencies(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} gtest)
-add_dependencies(${TEST_PAYLOAD_SERVICE} gtest)
-add_dependencies(${TEST_PAYLOAD_CLIENT} gtest)
+if(NOT ${TESTS_BAT})
+ add_dependencies(${TEST_CONFIGURATION} gtest)
+ add_dependencies(${TEST_APPLICATION} gtest)
+ add_dependencies(${TEST_MAGIC_COOKIES_CLIENT} gtest)
+ add_dependencies(${TEST_MAGIC_COOKIES_SERVICE} gtest)
+ add_dependencies(${TEST_HEADER_FACTORY} gtest)
+ add_dependencies(${TEST_HEADER_FACTORY_CLIENT} gtest)
+ add_dependencies(${TEST_HEADER_FACTORY_SERVICE} gtest)
+ add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest)
+ add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest)
+ add_dependencies(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} gtest)
+ add_dependencies(${TEST_PAYLOAD_SERVICE} gtest)
+ add_dependencies(${TEST_PAYLOAD_CLIENT} gtest)
+ add_dependencies(${TEST_BIG_PAYLOAD_SERVICE} gtest)
+ add_dependencies(${TEST_BIG_PAYLOAD_CLIENT} gtest)
+ add_dependencies(${TEST_CLIENT_ID_SERVICE} gtest)
+else()
+ add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest)
+ add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest)
+endif()
##############################################################################
# Add tests to the target build_tests
##############################################################################
-add_dependencies(build_tests ${TEST_CONFIGURATION})
-add_dependencies(build_tests ${TEST_MAGIC_COOKIES_CLIENT})
-add_dependencies(build_tests ${TEST_HEADER_FACTORY})
-add_dependencies(build_tests ${TEST_HEADER_FACTORY_CLIENT})
-add_dependencies(build_tests ${TEST_HEADER_FACTORY_SERVICE})
-add_dependencies(build_tests ${TEST_LOCAL_ROUTING_SERVICE})
-add_dependencies(build_tests ${TEST_LOCAL_ROUTING_CLIENT})
-add_dependencies(build_tests ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE})
-add_dependencies(build_tests ${TEST_PAYLOAD_SERVICE})
-add_dependencies(build_tests ${TEST_PAYLOAD_CLIENT})
+if(NOT ${TESTS_BAT})
+ add_dependencies(build_tests ${TEST_CONFIGURATION})
+ add_dependencies(build_tests ${TEST_APPLICATION})
+ add_dependencies(build_tests ${TEST_MAGIC_COOKIES_CLIENT})
+ add_dependencies(build_tests ${TEST_MAGIC_COOKIES_SERVICE})
+ add_dependencies(build_tests ${TEST_HEADER_FACTORY})
+ add_dependencies(build_tests ${TEST_HEADER_FACTORY_CLIENT})
+ add_dependencies(build_tests ${TEST_HEADER_FACTORY_SERVICE})
+ add_dependencies(build_tests ${TEST_LOCAL_ROUTING_SERVICE})
+ add_dependencies(build_tests ${TEST_LOCAL_ROUTING_CLIENT})
+ add_dependencies(build_tests ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE})
+ add_dependencies(build_tests ${TEST_PAYLOAD_SERVICE})
+ add_dependencies(build_tests ${TEST_PAYLOAD_CLIENT})
+ add_dependencies(build_tests ${TEST_BIG_PAYLOAD_SERVICE})
+ add_dependencies(build_tests ${TEST_BIG_PAYLOAD_CLIENT})
+ add_dependencies(build_tests ${TEST_CLIENT_ID_SERVICE})
+else()
+ add_dependencies(build_tests ${TEST_LOCAL_ROUTING_SERVICE})
+ add_dependencies(build_tests ${TEST_LOCAL_ROUTING_CLIENT})
+endif()
+
+
##############################################################################
# Add tests
##############################################################################
-add_test(NAME ${TEST_CONFIGURATION}
- COMMAND ${TEST_CONFIGURATION} --someip ${TEST_CONFIGURATION_CONFIG_FILE}
-)
+if(NOT ${TESTS_BAT})
+ add_test(NAME ${TEST_CONFIGURATION}
+ COMMAND ${TEST_CONFIGURATION} --someip ${TEST_CONFIGURATION_CONFIG_FILE}
+ )
+ add_test(NAME ${TEST_CONFIGURATION}_deprecated_config_file
+ COMMAND ${TEST_CONFIGURATION} --someip ${TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE}
+ )
-add_test(NAME ${TEST_MAGIC_COOKIES_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER}
-)
-set_tests_properties(${TEST_MAGIC_COOKIES_NAME} PROPERTIES TIMEOUT 60)
+ # application test
+ add_test(NAME ${TEST_APPLICATION}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER}
+ )
+ set_tests_properties(${TEST_APPLICATION} PROPERTIES TIMEOUT 20)
-# Header/Factory tets
-add_test(NAME ${TEST_HEADER_FACTORY_NAME} COMMAND ${TEST_HEADER_FACTORY})
-add_test(NAME ${TEST_HEADER_FACTORY_NAME}_send_receive
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_STARTER}
-)
+ # magic cookies test
+ add_test(NAME ${TEST_MAGIC_COOKIES_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER}
+ )
+ set_tests_properties(${TEST_MAGIC_COOKIES_NAME} PROPERTIES TIMEOUT 60)
-# Routing tests
-add_test(NAME ${TEST_LOCAL_ROUTING_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
-)
-add_test(NAME ${TEST_EXTERNAL_LOCAL_ROUTING_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
-)
-set_tests_properties(${TEST_EXTERNAL_LOCAL_ROUTING_NAME} PROPERTIES TIMEOUT 60)
+ # Header/Factory tets
+ add_test(NAME ${TEST_HEADER_FACTORY_NAME} COMMAND ${TEST_HEADER_FACTORY})
+ add_test(NAME ${TEST_HEADER_FACTORY_NAME}_send_receive
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_STARTER}
+ )
-# Payload tests
-add_test(NAME ${TEST_LOCAL_PAYLOAD_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_STARTER}
-)
-add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
-)
-add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
-)
-set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 240)
-add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
-)
-set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 240)
+ # Routing tests
+ add_test(NAME ${TEST_LOCAL_ROUTING_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
+ )
+
+ add_test(NAME ${TEST_EXTERNAL_LOCAL_ROUTING_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
+ )
+ set_tests_properties(${TEST_EXTERNAL_LOCAL_ROUTING_NAME} PROPERTIES TIMEOUT 60)
+
+ # Payload tests
+ add_test(NAME ${TEST_LOCAL_PAYLOAD_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_STARTER}
+ )
+ add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
+ )
+ add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
+ )
+ set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 240)
+ add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
+ )
+ set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 240)
+
+ # big payload tests
+ add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER}
+ )
+ set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 60)
+ add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER}
+ )
+ set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 60)
+
+ # client id tests
+ add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
+ set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports PROPERTIES TIMEOUT 60)
+ add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
+ set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports PROPERTIES TIMEOUT 60)
+else()
+ # Routing tests
+ add_test(NAME ${TEST_LOCAL_ROUTING_NAME}
+ COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
+ )
+endif()
diff --git a/test/application_tests/application_test.cpp b/test/application_tests/application_test.cpp
new file mode 100644
index 0000000..d52e0a1
--- /dev/null
+++ b/test/application_tests/application_test.cpp
@@ -0,0 +1,174 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <thread>
+#include <mutex>
+#include <condition_variable>
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include "someip_test_globals.hpp"
+
+using namespace vsomeip;
+
+class someip_application_test: public ::testing::Test {
+
+protected:
+ void SetUp() {
+ app_ = runtime::get()->create_application("application_test");
+ app_->init();
+ }
+
+ std::shared_ptr<application> app_;
+};
+
+/**
+ * @test Start and stop application
+ */
+TEST_F(someip_application_test, start_stop_application)
+{
+ std::thread t([&](){
+ app_->start();
+ });
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ app_->stop();
+ t.join();
+}
+
+/**
+ * @test Start and stop application multiple times
+ */
+TEST_F(someip_application_test, start_stop_application_multiple)
+{
+ for (int i = 0; i < 10; ++i) {
+ std::thread t([&]() {
+ app_->start();
+ });
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ app_->stop();
+ t.join();
+ }
+}
+
+/**
+ * @test Try to start an already running application again
+ */
+TEST_F(someip_application_test, restart_without_stopping)
+{
+ std::thread t([&]() {
+ app_->start();
+
+ });
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ VSOMEIP_WARNING << "An error message should appear now";
+ // should print error
+ app_->start();
+ app_->stop();
+ t.join();
+}
+
+/**
+ * @test Try to stop a running application twice
+ */
+TEST_F(someip_application_test, stop_application_twice)
+{
+ std::thread t([&]() {
+ app_->start();
+
+ });
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+
+ app_->stop();
+ t.join();
+ app_->stop();
+}
+
+class someip_application_shutdown_test: public ::testing::Test {
+
+protected:
+ void SetUp() {
+ is_registered_ = false;
+
+ app_ = runtime::get()->create_application("application_test");
+ app_->init();
+
+ app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID,
+ vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN,
+ std::bind(&someip_application_shutdown_test::on_message_shutdown, this,
+ std::placeholders::_1));
+
+ app_->register_state_handler(
+ std::bind(&someip_application_shutdown_test::on_state, this,
+ std::placeholders::_1));
+ shutdown_thread_ = std::thread(&someip_application_shutdown_test::send_shutdown_message, this);
+
+ app_->start();
+ }
+
+ void TearDown() {
+ shutdown_thread_.join();
+ app_->stop();
+ }
+
+ void on_state(vsomeip::state_type_e _state) {
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
+ {
+ app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ is_registered_ = true;
+ cv_.notify_one();
+ }
+ }
+
+ void on_message_shutdown(const std::shared_ptr<message>& _request)
+ {
+ (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_->stop();
+ }
+
+ void send_shutdown_message() {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while(!is_registered_) {
+ cv_.wait(its_lock);
+ }
+ std::shared_ptr<message> r = runtime::get()->create_request();
+ r->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
+ r->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+ r->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
+ app_->send(r);
+ }
+
+ bool is_registered_;
+ std::shared_ptr<application> app_;
+ std::condition_variable cv_;
+ std::mutex mutex_;
+ std::thread shutdown_thread_;
+};
+
+/**
+ * @test Stop the application through a method invoked from a dispatcher thread
+ */
+TEST_F(someip_application_shutdown_test, stop_application_from_dispatcher_thread) {
+
+}
+
+#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.json b/test/application_tests/application_test.json
new file mode 100644
index 0000000..a50eb35
--- /dev/null
+++ b/test/application_tests/application_test.json
@@ -0,0 +1,45 @@
+{
+ "unicast":"127.0.0.1",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/someip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"application_test",
+ "id":"0x7788",
+ "num_dispatchers":"5"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1234",
+ "instance":"0x5678",
+ "reliable":"30503"
+ }
+ ],
+ "routing":"application_test",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "100",
+ "repetitions_base_delay" : "200",
+ "repetitions_max" : "3",
+ "ttl" : "3",
+ "cyclic_offer_delay" : "2000",
+ "request_response_delay" : "1500"
+ }
+}
diff --git a/test/application_tests/application_test_no_dispatch_threads.json b/test/application_tests/application_test_no_dispatch_threads.json
new file mode 100644
index 0000000..d2f9569
--- /dev/null
+++ b/test/application_tests/application_test_no_dispatch_threads.json
@@ -0,0 +1,37 @@
+{
+ "unicast":"127.0.0.1",
+ "logging":
+ {
+ "level":"warning",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/someip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"application_test",
+ "id":"0x7788"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1234",
+ "instance":"0x5678",
+ "reliable":"30503"
+ }
+ ],
+ "routing":"application_test",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/application_tests/application_test_starter.sh b/test/application_tests/application_test_starter.sh
new file mode 100755
index 0000000..2968393
--- /dev/null
+++ b/test/application_tests/application_test_starter.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+FAIL=0
+
+export VSOMEIP_CONFIGURATION=application_test_no_dispatch_threads.json
+./application_test
+
+if [ $? -ne 0 ]
+then
+ ((FAIL+=1))
+fi
+
+export VSOMEIP_CONFIGURATION=application_test.json
+./application_test
+
+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/big_payload_tests/big_payload_test_client.cpp b/test/big_payload_tests/big_payload_test_client.cpp
new file mode 100644
index 0000000..4f96c1c
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_client.cpp
@@ -0,0 +1,185 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include "big_payload_test_client.hpp"
+#include "big_payload_test_globals.hpp"
+
+big_payload_test_client::big_payload_test_client(bool _use_tcp) :
+ app_(vsomeip::runtime::get()->create_application()),
+ request_(vsomeip::runtime::get()->create_request(_use_tcp)),
+ running_(true),
+ blocked_(false),
+ is_available_(false),
+ number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND),
+ number_of_sent_messages_(0),
+ number_of_acknowledged_messages_(0),
+ sender_(std::bind(&big_payload_test_client::run, this))
+{
+}
+
+void big_payload_test_client::init()
+{
+ app_->init();
+
+ app_->register_state_handler(
+ std::bind(&big_payload_test_client::on_state, this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(vsomeip::ANY_SERVICE,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD,
+ std::bind(&big_payload_test_client::on_message, this,
+ std::placeholders::_1));
+
+ app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID,
+ std::bind(&big_payload_test_client::on_availability, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3));
+}
+
+void big_payload_test_client::start()
+{
+ VSOMEIP_INFO << "Starting...";
+ app_->start();
+}
+
+void big_payload_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_->stop();
+}
+
+void big_payload_test_client::join_sender_thread(){
+ sender_.join();
+
+ ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
+}
+
+void big_payload_test_client::on_state(vsomeip::state_type_e _state)
+{
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
+ {
+ app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID, false);
+ }
+}
+
+void big_payload_test_client::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.");
+
+ if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service
+ && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance)
+ {
+ if(is_available_ && !_is_available)
+ {
+ is_available_ = false;
+ }
+ else if(_is_available && !is_available_)
+ {
+ is_available_ = true;
+ send();
+ }
+ }
+}
+
+void big_payload_test_client::on_message(const std::shared_ptr<vsomeip::message>& _response)
+{
+ VSOMEIP_INFO << "Received a response from Service [" << std::setw(4)
+ << std::setfill('0') << std::hex << _response->get_service() << "."
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _response->get_instance() << "] to Client/Session ["
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _response->get_client() << "/" << std::setw(4)
+ << std::setfill('0') << std::hex << _response->get_session()
+ << "] size: " << std::dec << _response->get_payload()->get_length();
+
+ ASSERT_EQ(_response->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE);
+
+ bool check(true);
+ vsomeip::length_t len = _response->get_payload()->get_length();
+ vsomeip::byte_t* datap = _response->get_payload()->get_data();
+ for(unsigned int i = 0; i < len; ++i) {
+ check = check && datap[i] == big_payload_test::DATA_SERVICE_TO_CLIENT;
+ }
+ if(!check) {
+ GTEST_FATAL_FAILURE_("wrong data transmitted");
+ }
+ number_of_acknowledged_messages_++;
+ send();
+}
+
+void big_payload_test_client::send()
+{
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ = true;
+ condition_.notify_one();
+}
+
+void big_payload_test_client::run()
+{
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (!blocked_)
+ {
+ condition_.wait(its_lock);
+ }
+ blocked_ = false;
+ request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
+ request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+ request_->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
+
+ std::shared_ptr< vsomeip::payload > its_payload = vsomeip::runtime::get()->create_payload();
+ std::vector< vsomeip::byte_t > its_payload_data;
+ for (unsigned int i = 0; i < big_payload_test::BIG_PAYLOAD_SIZE; ++i) {
+ its_payload_data.push_back(big_payload_test::DATA_CLIENT_TO_SERVICE);
+ }
+ its_payload->set_data(its_payload_data);
+ request_->set_payload(its_payload);
+
+ for (unsigned int i = 0; i < number_of_messages_to_send_; i++)
+ {
+ app_->send(request_, true);
+ VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0')
+ << std::hex << request_->get_client() << "/" << std::setw(4)
+ << std::setfill('0') << std::hex << request_->get_session()
+ << "] sent a request to Service [" << std::setw(4)
+ << std::setfill('0') << std::hex << request_->get_service()
+ << "." << std::setw(4) << std::setfill('0') << std::hex
+ << request_->get_instance() << "]";
+ number_of_sent_messages_++;
+ while(!blocked_) {
+ condition_.wait(its_lock);
+ }
+ blocked_ = false;
+ }
+ ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
+ stop();
+}
+
+TEST(someip_big_payload_test, send_ten_messages_to_service)
+{
+ bool use_tcp = true;
+ big_payload_test_client test_client_(use_tcp);
+ test_client_.init();
+ test_client_.start();
+ test_client_.join_sender_thread();
+}
+
+#ifndef WIN32
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/big_payload_tests/big_payload_test_client.hpp b/test/big_payload_tests/big_payload_test_client.hpp
new file mode 100644
index 0000000..f1ee7c2
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_client.hpp
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef BIGPAYLOADTESTCLIENT_HPP_
+#define BIGPAYLOADTESTCLIENT_HPP_
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include <thread>
+#include <mutex>
+#include <condition_variable>
+#include <functional>
+
+#include "../someip_test_globals.hpp"
+
+class big_payload_test_client
+{
+public:
+ big_payload_test_client(bool _use_tcp);
+ void init();
+ void start();
+ void stop();
+ void join_sender_thread();
+ void on_state(vsomeip::state_type_e _state);
+ void on_availability(vsomeip::service_t _service,
+ vsomeip::instance_t _instance, bool _is_available);
+ void on_message(const std::shared_ptr<vsomeip::message> &_response);
+ void send();
+ void run();
+
+private:
+ std::shared_ptr<vsomeip::application> app_;
+ std::shared_ptr<vsomeip::message> request_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ bool running_;
+ bool blocked_;
+ bool is_available_;
+ std::uint32_t number_of_messages_to_send_;
+ std::uint32_t number_of_sent_messages_;
+ std::uint32_t number_of_acknowledged_messages_;
+ std::thread sender_;
+};
+
+#endif /* BIGPAYLOADTESTCLIENT_HPP_ */
diff --git a/test/magic_cookies_test_service_start.sh b/test/big_payload_tests/big_payload_test_client_local_start.sh
index 0d946ab..f834d78 100755
--- a/test/magic_cookies_test_service_start.sh
+++ b/test/big_payload_tests/big_payload_test_client_local_start.sh
@@ -4,6 +4,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/.
-export VSOMEIP_APPLICATION_NAME=service-sample
-export VSOMEIP_CONFIGURATION_FILE=vsomeip-magic-cookies-service.json
-.././response-sample --tcp --static-routing
+# Start the client
+export VSOMEIP_APPLICATION_NAME=big_payload_test_client
+export VSOMEIP_CONFIGURATION=big_payload_test_local.json
+./big_payload_test_client
diff --git a/test/big_payload_tests/big_payload_test_client_start.sh b/test/big_payload_tests/big_payload_test_client_start.sh
new file mode 100755
index 0000000..025b5bc
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_client_start.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Start the client
+export VSOMEIP_APPLICATION_NAME=big_payload_test_client
+export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client.json
+./big_payload_test_client
diff --git a/test/big_payload_tests/big_payload_test_external_starter.sh b/test/big_payload_tests/big_payload_test_external_starter.sh
new file mode 100755
index 0000000..6550adc
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_external_starter.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# 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 successfully.
+
+FAIL=0
+
+# Start the client
+export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client.json
+export VSOMEIP_APPLICATION_NAME=big_payload_test_client
+./big_payload_test_client &
+
+cat <<End-of-message
+*******************************************************************************
+*******************************************************************************
+** Please now run:
+** big_payload_test_service_external_start.sh
+** from an external host to successfully complete this test.
+**
+** You probably will need to adapt the 'unicast' settings in
+** big_payload_test_tcp_service.json and
+** big_payload_test_tcp_client.json to your personal setup.
+*******************************************************************************
+*******************************************************************************
+End-of-message
+
+# Wait until client and service are finished
+for job in $(jobs -p)
+do
+ # Fail gets incremented if either client or service exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+done
+
+# Check if client and server both exited successfully
+if [ $FAIL -eq 0 ]
+then
+ exit 0
+else
+ exit 1
+fi
diff --git a/test/big_payload_tests/big_payload_test_globals.hpp b/test/big_payload_tests/big_payload_test_globals.hpp
new file mode 100644
index 0000000..851545a
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_globals.hpp
@@ -0,0 +1,17 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef BIG_PAYLOAD_TEST_GLOBALS_HPP_
+#define BIG_PAYLOAD_TEST_GLOBALS_HPP_
+
+#include <cstdint>
+
+namespace big_payload_test {
+ constexpr std::uint32_t BIG_PAYLOAD_SIZE = 1024*600;
+ constexpr vsomeip::byte_t DATA_SERVICE_TO_CLIENT = 0xAA;
+ constexpr vsomeip::byte_t DATA_CLIENT_TO_SERVICE = 0xFF;
+}
+
+#endif /* BIG_PAYLOAD_TEST_GLOBALS_HPP_ */
diff --git a/test/big_payload_tests/big_payload_test_local.json b/test/big_payload_tests/big_payload_test_local.json
new file mode 100644
index 0000000..aa7b3ea
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_local.json
@@ -0,0 +1,54 @@
+{
+ "unicast":"127.0.0.1",
+ "logging":
+ {
+ "level":"debug",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"big_payload_test_service",
+ "id":"0x1277"
+ },
+ {
+ "name":"big_payload_test_client",
+ "id":"0x1344"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1234",
+ "instance":"0x5678"
+ }
+ ],
+ "payload-sizes":
+ [
+ {
+ "unicast":"127.0.0.1",
+ "ports":
+ [
+ {
+ "port":"30509",
+ "max-payload-size":"614400"
+ }
+ ]
+ }
+ ],
+ "routing":"big_payload_test_service",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.244.224.245",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
+
diff --git a/test/big_payload_tests/big_payload_test_local_starter.sh b/test/big_payload_tests/big_payload_test_local_starter.sh
new file mode 100755
index 0000000..d32b6a0
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_local_starter.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# 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 successfully.
+
+FAIL=0
+
+# Start the service
+export VSOMEIP_APPLICATION_NAME=big_payload_test_service
+export VSOMEIP_CONFIGURATION=big_payload_test_local.json
+./big_payload_test_service &
+
+# Start the client
+export VSOMEIP_APPLICATION_NAME=big_payload_test_client
+./big_payload_test_client &
+
+# Wait until client and service are finished
+for job in $(jobs -p)
+do
+ # Fail gets incremented if either client or service exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+done
+
+# Check if client and server both exited successfully
+if [ $FAIL -eq 0 ]
+then
+ exit 0
+else
+ exit 1
+fi
diff --git a/test/big_payload_tests/big_payload_test_service.cpp b/test/big_payload_tests/big_payload_test_service.cpp
new file mode 100644
index 0000000..fecaf19
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_service.cpp
@@ -0,0 +1,163 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include "big_payload_test_service.hpp"
+
+#include "big_payload_test_globals.hpp"
+
+big_payload_test_service::big_payload_test_service() :
+ app_(vsomeip::runtime::get()->create_application()),
+ is_registered_(false),
+ blocked_(false),
+ number_of_received_messages_(0),
+ offer_thread_(std::bind(&big_payload_test_service::run, this))
+{
+}
+
+void big_payload_test_service::init()
+{
+ std::lock_guard<std::mutex> its_lock(mutex_);
+
+ app_->init();
+ 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,
+ std::placeholders::_1));
+
+ app_->register_state_handler(
+ std::bind(&big_payload_test_service::on_state, this,
+ std::placeholders::_1));
+}
+
+void big_payload_test_service::start()
+{
+ VSOMEIP_INFO << "Starting...";
+ app_->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_->stop();
+}
+
+void big_payload_test_service::join_offer_thread()
+{
+ offer_thread_.join();
+}
+
+void big_payload_test_service::offer()
+{
+ app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+}
+
+void big_payload_test_service::stop_offer()
+{
+ app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+}
+
+void big_payload_test_service::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)
+ {
+ if(!is_registered_)
+ {
+ is_registered_ = true;
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ = true;
+ // "start" the run method thread
+ condition_.notify_one();
+ }
+ }
+ else
+ {
+ is_registered_ = false;
+ }
+}
+
+void big_payload_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request)
+{
+ VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4)
+ << std::setfill('0') << std::hex << _request->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _request->get_session() << "] size: " << std::dec
+ << _request->get_payload()->get_length();
+
+ ASSERT_EQ(_request->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE);
+ bool check(true);
+ vsomeip::length_t len = _request->get_payload()->get_length();
+ vsomeip::byte_t* datap = _request->get_payload()->get_data();
+ for(unsigned int i = 0; i < len; ++i) {
+ check = check && datap[i] == big_payload_test::DATA_CLIENT_TO_SERVICE;
+ }
+ if(!check) {
+ GTEST_FATAL_FAILURE_("wrong data transmitted");
+ }
+
+ number_of_received_messages_++;
+
+ // send response
+ std::shared_ptr<vsomeip::message> its_response =
+ vsomeip::runtime::get()->create_response(_request);
+
+ std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()
+ ->create_payload();
+ std::vector<vsomeip::byte_t> its_payload_data;
+ for (unsigned int i = 0; i < big_payload_test::BIG_PAYLOAD_SIZE; ++i) {
+ its_payload_data.push_back(big_payload_test::DATA_SERVICE_TO_CLIENT);
+ }
+ its_payload->set_data(its_payload_data);
+ its_response->set_payload(its_payload);
+
+ app_->send(its_response, true);
+
+ if(number_of_received_messages_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND) {
+ ASSERT_EQ(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND, number_of_received_messages_);
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ = true;
+ condition_.notify_one();
+ }
+}
+
+void big_payload_test_service::run()
+{
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (!blocked_) {
+ condition_.wait(its_lock);
+ }
+
+ offer();
+
+ // wait for shutdown
+ blocked_ = false;
+ while (!blocked_) {
+ condition_.wait(its_lock);
+ }
+ std::this_thread::sleep_for(std::chrono::seconds(3));
+ app_->stop();
+}
+
+TEST(someip_big_payload_test, receive_ten_messages_and_send_reply)
+{
+ big_payload_test_service test_service;
+ test_service.init();
+ test_service.start();
+ test_service.join_offer_thread();
+}
+
+#ifndef WIN32
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/big_payload_tests/big_payload_test_service.hpp b/test/big_payload_tests/big_payload_test_service.hpp
new file mode 100644
index 0000000..9888f41
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_service.hpp
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef BIGPAYLOADTESTSERVICE_HPP_
+#define BIGPAYLOADTESTSERVICE_HPP_
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include <thread>
+#include <mutex>
+#include <condition_variable>
+#include <functional>
+
+#include "../someip_test_globals.hpp"
+
+class big_payload_test_service
+{
+public:
+ big_payload_test_service();
+ void init();
+ void start();
+ void stop();
+ void offer();
+ void stop_offer();
+ void join_offer_thread();
+ void on_state(vsomeip::state_type_e _state);
+ void on_message(const std::shared_ptr<vsomeip::message> &_request);
+ void run();
+
+private:
+ std::shared_ptr<vsomeip::application> app_;
+ bool is_registered_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ bool blocked_;
+ std::uint32_t number_of_received_messages_;
+ std::thread offer_thread_;
+};
+
+#endif /* BIGPAYLOADTESTSERVICE_HPP_ */
diff --git a/test/big_payload_tests/big_payload_test_service_external_start.sh b/test/big_payload_tests/big_payload_test_service_external_start.sh
new file mode 100755
index 0000000..361f106
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_service_external_start.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Start the service
+export VSOMEIP_APPLICATION_NAME=big_payload_test_service
+export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service.json
+./big_payload_test_service
diff --git a/test/big_payload_tests/big_payload_test_service_local_start.sh b/test/big_payload_tests/big_payload_test_service_local_start.sh
new file mode 100755
index 0000000..3aadd55
--- /dev/null
+++ b/test/big_payload_tests/big_payload_test_service_local_start.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Start the service
+export VSOMEIP_APPLICATION_NAME=big_payload_test_service
+export VSOMEIP_CONFIGURATION=big_payload_test_local.json
+./big_payload_test_service
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in
new file mode 100644
index 0000000..0f23a10
--- /dev/null
+++ b/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in
@@ -0,0 +1,43 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "netmask":"255.255.255.0",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"true",
+ "path":"/var/log/vsomeip.log"
+ },
+ "dlt":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"big_payload_test_client",
+ "id":"0x1343"
+ }
+ ],
+ "payload-sizes":
+ [
+ {
+ "unicast":"@TEST_IP_SLAVE@",
+ "ports":
+ [
+ {
+ "port":"30509",
+ "max-payload-size":"614400"
+ }
+ ]
+ }
+ ],
+ "routing":"big_payload_test_client",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.244.224.245",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_service.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service.json.in
new file mode 100644
index 0000000..a932d82
--- /dev/null
+++ b/test/big_payload_tests/conf/big_payload_test_tcp_service.json.in
@@ -0,0 +1,54 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"debug",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"big_payload_test_service",
+ "id":"0x1277"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1234",
+ "instance":"0x5678",
+ "reliable":
+ {
+ "port":"30509",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "payload-sizes":
+ [
+ {
+ "unicast":"@TEST_IP_SLAVE@",
+ "ports":
+ [
+ {
+ "port":"30509",
+ "max-payload-size":"614400"
+ }
+ ]
+ }
+ ],
+ "routing":"big_payload_test_service",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.244.224.245",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/client_id_tests/client_id_test_globals.hpp b/test/client_id_tests/client_id_test_globals.hpp
new file mode 100644
index 0000000..30ee575
--- /dev/null
+++ b/test/client_id_tests/client_id_test_globals.hpp
@@ -0,0 +1,32 @@
+// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_
+#define CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_
+
+namespace client_id_test {
+
+struct service_info {
+ vsomeip::service_t service_id;
+ vsomeip::instance_t instance_id;
+ vsomeip::method_t method_id;
+};
+
+static constexpr std::array<service_info, 6> service_infos = {{
+ // placeholder to be consistent w/ client ids, service ids, app names
+ { 0xFFFF, 0xFFFF, 0xFFFF },
+ // node 1
+ { 0x1000, 0x1, 0x1111 },
+ { 0x2000, 0x1, 0x2222 },
+ // node 2
+ { 0x3000, 0x1, 0x3333 },
+ { 0x4000, 0x1, 0x4444 },
+ { 0x5000, 0x1, 0x5555 }
+}};
+
+static constexpr int messages_to_send = 10;
+}
+
+#endif /* CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_ */
diff --git a/test/client_id_tests/client_id_test_master_starter.sh b/test/client_id_tests/client_id_test_master_starter.sh
new file mode 100755
index 0000000..f8550c5
--- /dev/null
+++ b/test/client_id_tests/client_id_test_master_starter.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Purpose: This script is needed to start the services 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 the services
+# and checks that both exit successfully.
+
+if [ $# -lt 1 ]
+then
+ echo "Please pass a json file to this script."
+ echo "For example: $0 client_id_test_diff_client_ids_diff_ports_master.json"
+ exit 1
+fi
+
+MASTER_JSON_FILE=$1
+CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave}
+
+FAIL=0
+
+# Start the services
+export VSOMEIP_APPLICATION_NAME=client_id_test_service_one
+export VSOMEIP_CONFIGURATION=$1
+./client_id_test_service 1 &
+
+export VSOMEIP_APPLICATION_NAME=client_id_test_service_two
+export VSOMEIP_CONFIGURATION=$1
+./client_id_test_service 2 &
+
+
+
+cat <<End-of-message
+*******************************************************************************
+*******************************************************************************
+** Please now run:
+** client_id_test_slave_starter.sh $CLIENT_JSON_FILE
+** from an external host to successfully complete this test.
+**
+** You probably will need to adapt the 'unicast' settings in
+** client_id_test_diff_client_ids_diff_ports_master.json and
+** client_id_test_diff_client_ids_diff_ports_slave.json to your personal setup.
+*******************************************************************************
+*******************************************************************************
+End-of-message
+
+# Wait until client and service are finished
+for job in $(jobs -p)
+do
+ # Fail gets incremented if either client or service exit
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+done
+
+# Check if both exited successfully
+if [ $FAIL -eq 0 ]
+then
+ exit 0
+else
+ exit 1
+fi
diff --git a/test/client_id_tests/client_id_test_service.cpp b/test/client_id_tests/client_id_test_service.cpp
new file mode 100644
index 0000000..57c6353
--- /dev/null
+++ b/test/client_id_tests/client_id_test_service.cpp
@@ -0,0 +1,248 @@
+// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#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 "client_id_test_globals.hpp"
+
+
+class client_id_test_service {
+public:
+ client_id_test_service(struct client_id_test::service_info _service_info) :
+ service_info_(_service_info),
+ app_(vsomeip::runtime::get()->create_application()),
+ blocked_(false),
+ 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();
+ app_->register_state_handler(
+ std::bind(&client_id_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(&client_id_test_service::on_request, this,
+ std::placeholders::_1));
+ app_->register_message_handler(vsomeip::ANY_SERVICE,
+ service_info_.instance_id, vsomeip::ANY_METHOD,
+ std::bind(&client_id_test_service::on_response, this,
+ std::placeholders::_1));
+
+ for(const auto& i : client_id_test::service_infos) {
+ if ((i.service_id == service_info_.service_id
+ && i.instance_id == service_info_.instance_id)
+ || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
+ continue;
+ }
+ app_->register_availability_handler(i.service_id, i.instance_id,
+ std::bind(&client_id_test_service::on_availability, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3));
+
+ other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
+ other_services_received_response_[std::make_pair(i.service_id, i.method_id)] = 0;
+ }
+
+ app_->start();
+ }
+
+ ~client_id_test_service() {
+ offer_thread_.join();
+ stop_thread_.join();
+ }
+
+ void offer() {
+ app_->offer_service(service_info_.service_id, service_info_.instance_id);
+ }
+
+ void stop_offer() {
+ app_->stop_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_);
+ blocked_ = true;
+ condition_.notify_one();
+ }
+ }
+
+ void on_availability(vsomeip::service_t _service,
+ vsomeip::instance_t _instance, bool _is_available) {
+ if(_is_available) {
+ VSOMEIP_INFO << "Service ["
+ << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
+ << "] is "
+ << (_is_available ? "available." : "NOT available.");
+
+ auto its_service = other_services_available_.find(std::make_pair(_service, _instance));
+ if(its_service != other_services_available_.end()) {
+ its_service->second = true;
+ }
+
+ if(std::all_of(other_services_available_.cbegin(),
+ other_services_available_.cend(),
+ [](const std::map<std::pair<vsomeip::service_t,
+ vsomeip::instance_t>, bool>::value_type& v) {
+ return v.second;})) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ = true;
+ condition_.notify_one();
+ }
+ }
+ }
+
+ 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)
+ << std::setfill('0') << std::hex << _message->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _message->get_session() << "]";
+ std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get()
+ ->create_response(_message);
+ app_->send(its_response);
+ }
+ }
+
+ 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)
+ << std::setfill('0') << std::hex << _message->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _message->get_session() << "] from Service/Method ["
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
+ << std::hex << _message->get_method() <<"]";
+ other_services_received_response_[std::make_pair(_message->get_service(),
+ _message->get_method())]++;
+
+ if(std::all_of(other_services_received_response_.cbegin(),
+ other_services_received_response_.cend(),
+ [](const std::map<std::pair<vsomeip::service_t,
+ vsomeip::method_t>, std::uint32_t>::value_type& v)
+ { return v.second == client_id_test::messages_to_send;})) {
+ std::lock_guard<std::mutex> its_lock(stop_mutex_);
+ stopped_ = true;
+ stop_condition_.notify_one();
+ }
+ }
+ }
+
+ void run() {
+ VSOMEIP_DEBUG << "Running";
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (!blocked_) {
+ condition_.wait(its_lock);
+ }
+ blocked_ = false;
+
+ VSOMEIP_DEBUG << "Offering";
+ offer();
+
+
+ while (!blocked_) {
+ condition_.wait(its_lock);
+ }
+ blocked_ = false;
+
+ VSOMEIP_DEBUG << "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) {
+ if ((i.service_id == service_info_.service_id
+ && i.instance_id == service_info_.instance_id)
+ || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
+ continue;
+ }
+ std::shared_ptr<vsomeip::message> msg = vsomeip::runtime::get()->create_request();
+ msg->set_service(i.service_id);
+ 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 <<"]";
+ }
+ }
+
+ while (!blocked_) {
+ condition_.wait(its_lock);
+ }
+ blocked_ = false;
+ }
+
+ void wait_for_stop() {
+ std::unique_lock<std::mutex> its_lock(stop_mutex_);
+ while (!stopped_) {
+ stop_condition_.wait(its_lock);
+ }
+ VSOMEIP_INFO << "Received responses from all other services, going down";
+
+ // let offer thread exit
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ = true;
+ condition_.notify_one();
+ }
+
+ std::this_thread::sleep_for(std::chrono::seconds(3));
+ app_->stop();
+ }
+
+private:
+ client_id_test::service_info service_info_;
+ std::shared_ptr<vsomeip::application> app_;
+ std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
+ std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_response_;
+
+ bool blocked_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ std::thread offer_thread_;
+
+ bool stopped_;
+ std::mutex stop_mutex_;
+ std::condition_variable stop_condition_;
+ std::thread stop_thread_;
+};
+
+static int service_number;
+
+TEST(someip_client_id_test, send_ten_messages_to_service)
+{
+ client_id_test_service its_sample(
+ client_id_test::service_infos[service_number]);
+}
+
+#ifndef WIN32
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ if(argc < 2) {
+ std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl;
+ std::cerr << "Valid service numbers are in the range of [0,4]" << std::endl;
+ return 1;
+ }
+ service_number = std::stoi(std::string(argv[1]), nullptr);
+ return RUN_ALL_TESTS();
+}
+#endif
diff --git a/test/client_id_tests/client_id_test_slave_starter.sh b/test/client_id_tests/client_id_test_slave_starter.sh
new file mode 100755
index 0000000..94ff78b
--- /dev/null
+++ b/test/client_id_tests/client_id_test_slave_starter.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Purpose: This script is needed to start the services with
+# one command. This is necessary as ctest - which is used to run the
+# tests - isn't able to start multiple binaries for one testcase. Therefore
+# the testcase simply executes this script. This script then runs the services
+# and checks that all exit successfully.
+
+FAIL=0
+
+if [ $# -lt 1 ]
+then
+ echo "Please pass a json file to this script."
+ echo "For example: $0 client_id_test_diff_client_ids_diff_ports_slave.json"
+ exit 1
+fi
+
+# Start the services
+export VSOMEIP_APPLICATION_NAME=client_id_test_service_three
+export VSOMEIP_CONFIGURATION=$1
+./client_id_test_service 3 &
+
+export VSOMEIP_APPLICATION_NAME=client_id_test_service_four
+export VSOMEIP_CONFIGURATION=$1
+./client_id_test_service 4 &
+
+export VSOMEIP_APPLICATION_NAME=client_id_test_service_five
+export VSOMEIP_CONFIGURATION=$1
+./client_id_test_service 5 &
+
+
+# Wait until all applications are finished
+for job in $(jobs -p)
+do
+ # Fail gets incremented if one of the binaries exits
+ # with a non-zero exit code
+ wait $job || ((FAIL+=1))
+done
+
+# Check if both exited successfully
+if [ $FAIL -eq 0 ]
+then
+ exit 0
+else
+ exit 1
+fi
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in
new file mode 100644
index 0000000..fe2248d
--- /dev/null
+++ b/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in
@@ -0,0 +1,56 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"client_id_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"client_id_test_service_two",
+ "id":"0x2222"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unreliable":"30001",
+ "reliable":
+ {
+ "port":"40001",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0001",
+ "unreliable":"30002",
+ "reliable":
+ {
+ "port":"40002",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"client_id_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in
new file mode 100644
index 0000000..62aee87
--- /dev/null
+++ b/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in
@@ -0,0 +1,70 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"client_id_test_service_three",
+ "id":"0x3333"
+ },
+ {
+ "name":"client_id_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"client_id_test_service_five",
+ "id":"0x5555"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x3000",
+ "instance":"0x0001",
+ "unreliable":"30003",
+ "reliable":
+ {
+ "port":"40003",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0001",
+ "unreliable":"30004",
+ "reliable":
+ {
+ "port":"40004",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x5000",
+ "instance":"0x0001",
+ "unreliable":"30005",
+ "reliable":
+ {
+ "port":"40005",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"client_id_test_service_three",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in
new file mode 100644
index 0000000..b0c833b
--- /dev/null
+++ b/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in
@@ -0,0 +1,56 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"client_id_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"client_id_test_service_two",
+ "id":"0x2222"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"client_id_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in
new file mode 100644
index 0000000..a9084fc
--- /dev/null
+++ b/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in
@@ -0,0 +1,70 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"client_id_test_service_three",
+ "id":"0x3333"
+ },
+ {
+ "name":"client_id_test_service_four",
+ "id":"0x4444"
+ },
+ {
+ "name":"client_id_test_service_five",
+ "id":"0x5555"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x3000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x5000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"client_id_test_service_three",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in
new file mode 100644
index 0000000..fe2248d
--- /dev/null
+++ b/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in
@@ -0,0 +1,56 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"client_id_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"client_id_test_service_two",
+ "id":"0x2222"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unreliable":"30001",
+ "reliable":
+ {
+ "port":"40001",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0001",
+ "unreliable":"30002",
+ "reliable":
+ {
+ "port":"40002",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"client_id_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in
new file mode 100644
index 0000000..dc8f5ae
--- /dev/null
+++ b/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in
@@ -0,0 +1,70 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"client_id_test_service_three",
+ "id":"0x1111"
+ },
+ {
+ "name":"client_id_test_service_four",
+ "id":"0x2222"
+ },
+ {
+ "name":"client_id_test_service_five",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x3000",
+ "instance":"0x0001",
+ "unreliable":"30003",
+ "reliable":
+ {
+ "port":"40003",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0001",
+ "unreliable":"30004",
+ "reliable":
+ {
+ "port":"40004",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x5000",
+ "instance":"0x0001",
+ "unreliable":"30005",
+ "reliable":
+ {
+ "port":"40005",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"client_id_test_service_three",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in
new file mode 100644
index 0000000..b0c833b
--- /dev/null
+++ b/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in
@@ -0,0 +1,56 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"client_id_test_service_one",
+ "id":"0x1111"
+ },
+ {
+ "name":"client_id_test_service_two",
+ "id":"0x2222"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x2000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"client_id_test_service_one",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in
new file mode 100644
index 0000000..0b6e1e2
--- /dev/null
+++ b/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in
@@ -0,0 +1,70 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"client_id_test_service_three",
+ "id":"0x1111"
+ },
+ {
+ "name":"client_id_test_service_four",
+ "id":"0x2222"
+ },
+ {
+ "name":"client_id_test_service_five",
+ "id":"0x3333"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x3000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x4000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ },
+ {
+ "service":"0x5000",
+ "instance":"0x0001",
+ "unreliable":"30000",
+ "reliable":
+ {
+ "port":"40000",
+ "enable-magic-cookies":"false"
+ }
+ }
+ ],
+ "routing":"client_id_test_service_three",
+ "service-discovery":
+ {
+ "enable":"true",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+} \ No newline at end of file
diff --git a/test/configuration-test.cpp b/test/configuration-test.cpp
deleted file mode 100644
index cc91ab0..0000000
--- a/test/configuration-test.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#include <iostream>
-
-#include <vsomeip/configuration.hpp>
-#include <vsomeip/constants.hpp>
-#include <vsomeip/logger.hpp>
-
-#define DESIRED_ADDRESS "10.0.2.15"
-#define DESIRED_HAS_CONSOLE true
-#define DESIRED_HAS_FILE true
-#define DESIRED_HAS_DLT false
-#define DESIRED_LOGLEVEL "debug"
-#define DESIRED_LOGFILE "/home/someip/another-file.log"
-#define DESIRED_HOST "my_application"
-#define DESIRED_PROTOCOL "tcp"
-#define DESIRED_PORT 30666
-
-#define DESIRED_RELIABLE_1234_0022 30506
-#define DESIRED_UNRELIABLE_1234_0022 31000
-
-#define DESIRED_RELIABLE_1234_0023 30503
-#define DESIRED_UNRELIABLE_1234_0023 vsomeip::ILLEGAL_PORT
-
-#define DESIRED_RELIABLE_2277_0022 30505
-#define DESIRED_UNRELIABLE_2277_0022 31001
-
-#define DESIRED_RELIABLE_2266_0022 30505
-#define DESIRED_UNRELIABLE_2266_0022 30507
-
-#define DESIRED_RELIABLE_4466_0321 30506
-#define DESIRED_UNRELIABLE_4466_0321 30444
-
-#define DESIRED_ADDRESS_1234_0022 "local"
-#define DESIRED_MIN_INITIAL_DELAY_1234_0022 10
-#define DESIRED_MAX_INITIAL_DELAY_1234_0022 100
-#define DESIRED_REPETITION_BASE_DELAY_1234_0022 200
-#define DESIRED_REPETITION_MAX_1234_0022 7
-#define DESIRED_CYCLIC_OFFER_DELAY_1234_0022 2000
-#define DESIRED_CYCLIC_REQUEST_DELAY_1234_0022 2001
-
-#define DESIRED_ADDRESS_2277_0022 "local"
-#define DESIRED_MIN_INITIAL_DELAY_2277_0022 100
-#define DESIRED_MAX_INITIAL_DELAY_2277_0022 200
-#define DESIRED_REPETITION_BASE_DELAY_2277_0022 300
-#define DESIRED_REPETITION_MAX_2277_0022 5
-#define DESIRED_CYCLIC_OFFER_DELAY_2277_0022 2500
-#define DESIRED_CYCLIC_REQUEST_DELAY_2277_0022 2221
-
-#define DESIRED_ADDRESS_4466_0321 "10.0.2.23"
-
-template<class T>
-void check(const T &_is, const T &_desired, const std::string &_test) {
- if (_is == _desired) {
- VSOMEIP_INFO << "Test \"" << _test << "\" succeeded.";
- } else {
- VSOMEIP_ERROR << "Test \"" << _test << "\" failed! (" << _is << " != " << _desired << ")";
- }
-}
-
-int main(int argc, char **argv) {
- std::string its_path;
-
- int i = 0;
- while (i < argc-1) {
- if (std::string("--someip") == argv[i]) {
- its_path = argv[i+1];
- break;
- }
-
- i++;
- }
-
- if (its_path == "") {
- std::cerr << "Usage: " << argv[0] << " --someip <path>" << std::endl;
- return -1;
- }
-
- vsomeip::configuration *its_configuration = vsomeip::configuration::get(its_path);
-
- // 1. Did we get a configuration object?
- if (0 == its_configuration) {
- VSOMEIP_ERROR << "No configuration object. Either memory overflow or loading error detected!";
- return -1;
- }
-
- // 2. Check host address
- boost::asio::ip::address its_address = its_configuration->get_unicast();
- check<std::string>(its_address.to_string(), DESIRED_ADDRESS, "HOST 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, DESIRED_HAS_CONSOLE, "HAS CONSOLE");
- check<bool>(has_file, DESIRED_HAS_FILE, "HAS FILE");
- check<bool>(has_dlt, DESIRED_HAS_DLT, "HAS DLT");
- check<std::string>(logfile, DESIRED_LOGFILE, "LOGFILE");
- check<std::string>(boost::log::trivial::to_string(loglevel), DESIRED_LOGLEVEL, "LOGLEVEL");
-
- // 4. Services
- uint16_t its_reliable = its_configuration->get_reliable_port(0x1234, 0x0022);
- uint16_t its_unreliable = its_configuration->get_unreliable_port(0x1234, 0x0022);
-
- check<uint16_t>(its_reliable, DESIRED_RELIABLE_1234_0022, "RELIABLE_TEST_1234_0022");
- check<uint16_t>(its_unreliable, DESIRED_UNRELIABLE_1234_0022, "UNRELIABLE_TEST_1234_0022");
-
- its_reliable = its_configuration->get_reliable_port(0x1234, 0x0023);
- its_unreliable = its_configuration->get_unreliable_port(0x1234, 0x0023);
-
- check<uint16_t>(its_reliable, DESIRED_RELIABLE_1234_0023, "RELIABLE_TEST_1234_0023");
- check<uint16_t>(its_unreliable, DESIRED_UNRELIABLE_1234_0023, "UNRELIABLE_TEST_1234_0023");
-
- its_reliable = its_configuration->get_reliable_port(0x2277, 0x0022);
- its_unreliable = its_configuration->get_unreliable_port(0x2277, 0x0022);
-
- check<uint16_t>(its_reliable, DESIRED_RELIABLE_2277_0022, "RELIABLE_TEST_2277_0022");
- check<uint16_t>(its_unreliable, DESIRED_UNRELIABLE_2277_0022, "UNRELIABLE_TEST_2277_0022");
-
- its_reliable = its_configuration->get_reliable_port(0x4466, 0x0321);
- its_unreliable = its_configuration->get_unreliable_port(0x4466, 0x0321);
-
- check<uint16_t>(its_reliable, DESIRED_RELIABLE_4466_0321, "RELIABLE_TEST_4466_0321");
- check<uint16_t>(its_unreliable, DESIRED_UNRELIABLE_4466_0321, "UNRELIABLE_TEST_4466_0321");
-
- its_reliable = its_configuration->get_reliable_port(0x2277, 0x0022);
- its_unreliable = its_configuration->get_unreliable_port(0x2277, 0x0022);
-
- check<uint16_t>(its_reliable, DESIRED_RELIABLE_2277_0022, "RELIABLE_TEST_2277_0022");
- check<uint16_t>(its_unreliable, DESIRED_UNRELIABLE_2277_0022, "UNRELIABLE_TEST_2277_0022");
-
- std::string its_address_s = its_configuration->get_unicast(0x1234, 0x0022);
- std::string its_group_name = its_configuration->get_group(0x1234, 0x0022);
- uint32_t its_min_initial_delay = its_configuration->get_min_initial_delay(its_group_name);
- uint32_t its_max_initial_delay = its_configuration->get_max_initial_delay(its_group_name);
- uint32_t its_repetition_base_delay = its_configuration->get_repetition_base_delay(its_group_name);
- uint8_t its_repetition_max = its_configuration->get_repetition_max(its_group_name);
- uint32_t its_cyclic_offer_delay = its_configuration->get_cyclic_offer_delay(its_group_name);
- uint32_t its_cyclic_request_delay = its_configuration->get_cyclic_request_delay(its_group_name);
-
- check<std::string>(its_address_s, DESIRED_ADDRESS_1234_0022, "ADDRESS_TEST_1234_0022");
- check<uint32_t>(its_min_initial_delay, DESIRED_MIN_INITIAL_DELAY_1234_0022, "MIN_INITIAL_DELAY_TEST_1234_0022");
- check<uint32_t>(its_max_initial_delay, DESIRED_MAX_INITIAL_DELAY_1234_0022, "MAX_INITIAL_DELAY_TEST_1234_0022");
- check<uint32_t>(its_repetition_base_delay, DESIRED_REPETITION_BASE_DELAY_1234_0022, "REPETITION_BASE_DELAY_TEST_1234_0022");
- check<uint8_t>(its_repetition_max, DESIRED_REPETITION_MAX_1234_0022, "REPETITION_MAX_TEST_1234_0022");
- check<uint32_t>(its_cyclic_offer_delay, DESIRED_CYCLIC_OFFER_DELAY_1234_0022, "CYCLIC_OFFER_DELAY_TEST_1234_0022");
- check<uint32_t>(its_cyclic_request_delay, DESIRED_CYCLIC_REQUEST_DELAY_1234_0022, "CYCLIC_REQUEST_DELAY_TEST_1234_0022");
-
- its_group_name = its_configuration->get_group(0x1234, 0x0023);
- its_min_initial_delay = its_configuration->get_min_initial_delay(its_group_name);
- its_max_initial_delay = its_configuration->get_max_initial_delay(its_group_name);
- its_repetition_base_delay = its_configuration->get_repetition_base_delay(its_group_name);
- its_repetition_max = its_configuration->get_repetition_max(its_group_name);
- its_cyclic_offer_delay = its_configuration->get_cyclic_offer_delay(its_group_name);
- its_cyclic_request_delay = its_configuration->get_cyclic_request_delay(its_group_name);
-
- check<uint32_t>(its_min_initial_delay, DESIRED_MIN_INITIAL_DELAY_1234_0022, "MIN_INITIAL_DELAY_TEST_1234_0023");
- check<uint32_t>(its_max_initial_delay, DESIRED_MAX_INITIAL_DELAY_1234_0022, "MAX_INITIAL_DELAY_TEST_1234_0023");
- check<uint32_t>(its_repetition_base_delay, DESIRED_REPETITION_BASE_DELAY_1234_0022, "REPETITION_BASE_DELAY_TEST_1234_0023");
- check<uint8_t>(its_repetition_max, DESIRED_REPETITION_MAX_1234_0022, "REPETITION_MAX_TEST_1234_0023");
- check<uint32_t>(its_cyclic_offer_delay, DESIRED_CYCLIC_OFFER_DELAY_1234_0022, "CYCLIC_OFFER_DELAY_TEST_1234_0023");
- check<uint32_t>(its_cyclic_request_delay, DESIRED_CYCLIC_REQUEST_DELAY_1234_0022, "CYCLIC_REQUEST_DELAY_TEST_1234_0023");
-
- its_group_name = its_configuration->get_group(0x2277, 0x0022);
- its_min_initial_delay = its_configuration->get_min_initial_delay(its_group_name);
- its_max_initial_delay = its_configuration->get_max_initial_delay(its_group_name);
- its_repetition_base_delay = its_configuration->get_repetition_base_delay(its_group_name);
- its_repetition_max = its_configuration->get_repetition_max(its_group_name);
- its_cyclic_offer_delay = its_configuration->get_cyclic_offer_delay(its_group_name);
- its_cyclic_request_delay = its_configuration->get_cyclic_request_delay(its_group_name);
-
- check<uint32_t>(its_min_initial_delay, DESIRED_MIN_INITIAL_DELAY_2277_0022, "MIN_INITIAL_DELAY_TEST_2277_0022");
- check<uint32_t>(its_max_initial_delay, DESIRED_MAX_INITIAL_DELAY_2277_0022, "MAX_INITIAL_DELAY_TEST_2277_0022");
- check<uint32_t>(its_repetition_base_delay, DESIRED_REPETITION_BASE_DELAY_2277_0022, "REPETITION_BASE_DELAY_TEST_2277_0022");
- check<uint8_t>(its_repetition_max, DESIRED_REPETITION_MAX_2277_0022, "REPETITION_MAX_TEST_2277_0022");
- check<uint32_t>(its_cyclic_offer_delay, DESIRED_CYCLIC_OFFER_DELAY_2277_0022, "CYCLIC_OFFER_DELAY_TEST_2277_0022");
- check<uint32_t>(its_cyclic_request_delay, DESIRED_CYCLIC_REQUEST_DELAY_2277_0022, "CYCLIC_REQUEST_DELAY_TEST_2277_0022");
-
- its_group_name = its_configuration->get_group(0x2266, 0x0022);
- its_min_initial_delay = its_configuration->get_min_initial_delay(its_group_name);
- its_max_initial_delay = its_configuration->get_max_initial_delay(its_group_name);
- its_repetition_base_delay = its_configuration->get_repetition_base_delay(its_group_name);
- its_repetition_max = its_configuration->get_repetition_max(its_group_name);
- its_cyclic_offer_delay = its_configuration->get_cyclic_offer_delay(its_group_name);
- its_cyclic_request_delay = its_configuration->get_cyclic_request_delay(its_group_name);
-
- check<uint32_t>(its_min_initial_delay, DESIRED_MIN_INITIAL_DELAY_2277_0022, "MIN_INITIAL_DELAY_TEST_2266_0022");
- check<uint32_t>(its_max_initial_delay, DESIRED_MAX_INITIAL_DELAY_2277_0022, "MAX_INITIAL_DELAY_TEST_2266_0022");
- check<uint32_t>(its_repetition_base_delay, DESIRED_REPETITION_BASE_DELAY_2277_0022, "REPETITION_BASE_DELAY_TEST_2266_0022");
- check<uint8_t>(its_repetition_max, DESIRED_REPETITION_MAX_2277_0022, "REPETITION_MAX_TEST_2266_0022");
- check<uint32_t>(its_cyclic_offer_delay, DESIRED_CYCLIC_OFFER_DELAY_2277_0022, "CYCLIC_OFFER_DELAY_TEST_2266_0022");
- check<uint32_t>(its_cyclic_request_delay, DESIRED_CYCLIC_REQUEST_DELAY_2277_0022, "CYCLIC_REQUEST_DELAY_TEST_2266_0022");
-
- its_address_s = its_configuration->get_unicast(0x4466, 0x0321);
- check<std::string>(its_address_s, DESIRED_ADDRESS_4466_0321, "ADDRESS_TEST_4466_0321");
-
- // 5. Service discovery
- std::string protocol = its_configuration->get_service_discovery_protocol();
- uint16_t port = its_configuration->get_service_discovery_port();
-
- check<std::string>(protocol, DESIRED_PROTOCOL, "SERVICE DISCOVERY PROTOCOL");
- check<uint16_t>(port, DESIRED_PORT, "SERVICE DISCOVERY PORT");
-
- return 0;
-}
-
-
-
diff --git a/test/configuration_tests/configuration-test-deprecated.json b/test/configuration_tests/configuration-test-deprecated.json
new file mode 100644
index 0000000..8d6a8d2
--- /dev/null
+++ b/test/configuration_tests/configuration-test-deprecated.json
@@ -0,0 +1,131 @@
+{
+ "unicast" : "10.0.2.15",
+ "logging" :
+ {
+ "level" : "debug",
+ "console" : "true",
+ "file" : { "enable" : "true", "path" : "/home/someip/another-file.log" },
+ "dlt" : "false"
+ },
+ "applications" :
+ [
+ {
+ "name" : "my_application",
+ "id" : "0x7788"
+ },
+ {
+ "name" : "other_application",
+ "id" : "0x9933"
+ }
+ ],
+ "servicegroups" :
+ [
+ {
+ "name" : "default",
+ "unicast" : "local",
+ "delays" :
+ {
+ "initial" : { "minimum" : "10", "maximum" : "100" },
+ "repetition-base" : "200",
+ "repetition-max" : "7",
+ "cyclic-offer" : "2132",
+ "cyclic-request" : "2001"
+ },
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x0022",
+ "reliable" : { "port" : "30506", "magic_cookies" : "false" },
+ "unreliable" : "31000",
+ "events" :
+ [
+ {
+ "event" : "0x0778",
+ "is_field" : "false"
+ },
+ {
+ "event" : "0x779",
+ "is_field" : "true"
+ },
+ {
+ "event" : "0x77A",
+ "is_field" : "false"
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x4567",
+ "multicast" : "225.226.227.228",
+ "events" : [ "0x778", "0x779" ]
+ },
+ {
+ "eventgroup" : "0x4569",
+ "multicast" : "225.227.227.228",
+ "events" : [ "0x779", "0x77A" ]
+ },
+ {
+ "eventgroup" : "0x4569",
+ "multicast" : "225.222.227.228",
+ "events" : [ "0x778", "0x77A" ]
+ }
+ ]
+ },
+ {
+ "service" : "0x1234",
+ "instance" : "0x0023",
+ "reliable" : "30503"
+ }
+ ]
+ },
+ {
+ "name" : "extra",
+ "unicast" : "local",
+ "delays" :
+ {
+ "initial" : { "minimum" : "100", "maximum" : "200" },
+ "repetition-base" : "300",
+ "repetition-max" : "5",
+ "cyclic-offer" : "2500",
+ "cyclic-request" : "2221"
+ },
+ "services" :
+ [
+ {
+ "service" : "0x2277",
+ "instance" : "0x0022",
+ "reliable" : { "port" : "30505" },
+ "unreliable" : "31001"
+ },
+ {
+ "service" : "0x2266",
+ "instance" : "0x0022",
+ "reliable" : "30505",
+ "unreliable" : "30507"
+ }
+ ]
+ },
+ {
+ "name" : "remote",
+ "unicast" : "10.0.2.23",
+ "services" :
+ [
+ {
+ "service" : "0x4466",
+ "instance" : "0x0321",
+ "reliable" : "30506",
+ "unreliable" : "30444"
+ }
+ ]
+ }
+ ],
+ "routing" : "my_application",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "protocol" : "udp",
+ "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
new file mode 100644
index 0000000..b4538d0
--- /dev/null
+++ b/test/configuration_tests/configuration-test.cpp
@@ -0,0 +1,346 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <iostream>
+
+#include <vsomeip/constants.hpp>
+
+#include "../implementation/configuration/include/configuration.hpp"
+#include "../implementation/logging/include/logger.hpp"
+
+#define CONFIGURATION_FILE "configuration-test.json"
+#define DEPRECATED_CONFIGURATION_FILE "configuration-test-deprecated.json"
+
+#define EXPECTED_UNICAST_ADDRESS "10.0.2.15"
+
+#define EXPECTED_HAS_CONSOLE true
+#define EXPECTED_HAS_FILE true
+#define EXPECTED_HAS_DLT false
+#define EXPECTED_LOGLEVEL "debug"
+#define EXPECTED_LOGFILE "/home/someip/another-file.log"
+
+#define EXPECTED_ROUTING_MANAGER_HOST "my_application"
+
+// Services
+#define EXPECTED_UNICAST_ADDRESS_1234_0022 EXPECTED_UNICAST_ADDRESS
+#define EXPECTED_RELIABLE_PORT_1234_0022 30506
+#define EXPECTED_UNRELIABLE_PORT_1234_0022 31000
+
+#define EXPECTED_UNICAST_ADDRESS_1234_0023 EXPECTED_UNICAST_ADDRESS
+#define EXPECTED_RELIABLE_PORT_1234_0023 30503
+#define EXPECTED_UNRELIABLE_PORT_1234_0023 vsomeip::ILLEGAL_PORT
+
+#define EXPECTED_UNICAST_ADDRESS_2277_0022 EXPECTED_UNICAST_ADDRESS
+#define EXPECTED_RELIABLE_PORT_2277_0022 30505
+#define EXPECTED_UNRELIABLE_PORT_2277_0022 31001
+
+#define EXPECTED_UNICAST_ADDRESS_2266_0022 EXPECTED_UNICAST_ADDRESS
+#define EXPECTED_RELIABLE_PORT_2266_0022 30505
+#define EXPECTED_UNRELIABLE_PORT_2266_0022 30507
+
+#define EXPECTED_UNICAST_ADDRESS_4466_0321 "10.0.2.23"
+#define EXPECTED_RELIABLE_PORT_4466_0321 30506
+#define EXPECTED_UNRELIABLE_PORT_4466_0321 30444
+
+// Service Discovery
+#define EXPECTED_SD_ENABLED true
+#define EXPECTED_SD_PROTOCOL "udp"
+#define EXPECTED_SD_MULTICAST "224.212.244.223"
+#define EXPECTED_SD_PORT 30666
+
+#define EXPECTED_INITIAL_DELAY_MIN 1234
+#define EXPECTED_INITIAL_DELAY_MAX 2345
+#define EXPECTED_REPETITIONS_BASE_DELAY 4242
+#define EXPECTED_REPETITIONS_MAX 4
+#define EXPECTED_TTL 13
+#define EXPECTED_CYCLIC_OFFER_DELAY 2132
+#define EXPECTED_REQUEST_RESPONSE_DELAY 1111
+
+#define EXPECTED_DEPRECATED_INITIAL_DELAY_MIN 10
+#define EXPECTED_DEPRECATED_INITIAL_DELAY_MAX 100
+#define EXPECTED_DEPRECATED_REPETITIONS_BASE_DELAY 200
+#define EXPECTED_DEPRECATED_REPETITIONS_MAX 7
+#define EXPECTED_DEPRECATED_TTL 5
+#define EXPECTED_DEPRECATED_REQUEST_RESPONSE_DELAY 2001
+
+template<class T>
+void check(const T &_is, const T &_expected, const std::string &_test) {
+ if (_is == _expected) {
+ VSOMEIP_INFO << "Test \"" << _test << "\" succeeded.";
+ } else {
+ VSOMEIP_ERROR << "Test \"" << _test << "\" failed! ("
+ << _is << " != " << _expected << ")";
+ }
+}
+
+void check_file(const std::string &_config_file,
+ const std::string &_expected_unicast_address,
+ bool _expected_has_console,
+ bool _expected_has_file,
+ bool _expected_has_dlt,
+ const std::string &_expected_logfile,
+ const std::string &_expected_loglevel,
+ const std::string &_expected_unicast_address_1234_0022,
+ uint16_t _expected_reliable_port_1234_0022,
+ uint16_t _expected_unreliable_port_1234_0022,
+ const std::string &_expected_unicast_address_1234_0023,
+ uint16_t _expected_reliable_port_1234_0023,
+ uint16_t _expected_unreliable_port_1234_0023,
+ const std::string &_expected_unicast_address_2277_0022,
+ uint16_t _expected_reliable_port_2277_0022,
+ uint16_t _expected_unreliable_port_2277_0022,
+ const std::string &_expected_unicast_address_2266_0022,
+ uint16_t _expected_reliable_port_2266_0022,
+ uint16_t _expected_unreliable_port_2266_0022,
+ const std::string &_expected_unicast_address_4466_0321,
+ uint16_t _expected_reliable_port_4466_0321,
+ uint16_t _expected_unreliable_port_4466_0321,
+ bool _expected_enabled,
+ const std::string &_expected_protocol,
+ const std::string &_expected_multicast,
+ uint16_t _expected_port,
+ int32_t _expected_initial_delay_min,
+ int32_t _expected_initial_delay_max,
+ int32_t _expected_repetitions_base_delay,
+ uint8_t _expected_repetitions_max,
+ vsomeip::ttl_t _expected_ttl,
+ 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");
+}
+
+
+
+int main() {
+ // Check current configuration file format
+ std::cout << "/////////////////////////////////" << std::endl
+ << "// CHECKING CONFIGURATION FILE //" << std::endl
+ << "/////////////////////////////////" << std::endl;
+ check_file(CONFIGURATION_FILE,
+ EXPECTED_UNICAST_ADDRESS,
+ EXPECTED_HAS_CONSOLE,
+ EXPECTED_HAS_FILE,
+ EXPECTED_HAS_DLT,
+ EXPECTED_LOGFILE,
+ EXPECTED_LOGLEVEL,
+ EXPECTED_UNICAST_ADDRESS_1234_0022,
+ EXPECTED_RELIABLE_PORT_1234_0022,
+ EXPECTED_UNRELIABLE_PORT_1234_0022,
+ EXPECTED_UNICAST_ADDRESS_1234_0023,
+ EXPECTED_RELIABLE_PORT_1234_0023,
+ EXPECTED_UNRELIABLE_PORT_1234_0023,
+ EXPECTED_UNICAST_ADDRESS_2277_0022,
+ EXPECTED_RELIABLE_PORT_2277_0022,
+ EXPECTED_UNRELIABLE_PORT_2277_0022,
+ EXPECTED_UNICAST_ADDRESS_2266_0022,
+ EXPECTED_RELIABLE_PORT_2266_0022,
+ EXPECTED_UNRELIABLE_PORT_2266_0022,
+ EXPECTED_UNICAST_ADDRESS_4466_0321,
+ EXPECTED_RELIABLE_PORT_4466_0321,
+ EXPECTED_UNRELIABLE_PORT_4466_0321,
+ EXPECTED_SD_ENABLED,
+ EXPECTED_SD_PROTOCOL,
+ EXPECTED_SD_MULTICAST,
+ EXPECTED_SD_PORT,
+ EXPECTED_INITIAL_DELAY_MIN,
+ EXPECTED_INITIAL_DELAY_MAX,
+ EXPECTED_REPETITIONS_BASE_DELAY,
+ EXPECTED_REPETITIONS_MAX,
+ EXPECTED_TTL,
+ EXPECTED_CYCLIC_OFFER_DELAY,
+ EXPECTED_REQUEST_RESPONSE_DELAY);
+
+ // Check deprecated configuration file format
+ std::cout << "////////////////////////////////////////////" << std::endl
+ << "// CHECKING DEPRECATED CONFIGURATION FILE //" << std::endl
+ << "////////////////////////////////////////////" << std::endl;
+ check_file(DEPRECATED_CONFIGURATION_FILE,
+ EXPECTED_UNICAST_ADDRESS,
+ EXPECTED_HAS_CONSOLE,
+ EXPECTED_HAS_FILE,
+ EXPECTED_HAS_DLT,
+ EXPECTED_LOGFILE,
+ EXPECTED_LOGLEVEL,
+ EXPECTED_UNICAST_ADDRESS_1234_0022,
+ EXPECTED_RELIABLE_PORT_1234_0022,
+ EXPECTED_UNRELIABLE_PORT_1234_0022,
+ EXPECTED_UNICAST_ADDRESS_1234_0023,
+ EXPECTED_RELIABLE_PORT_1234_0023,
+ EXPECTED_UNRELIABLE_PORT_1234_0023,
+ EXPECTED_UNICAST_ADDRESS_2277_0022,
+ EXPECTED_RELIABLE_PORT_2277_0022,
+ EXPECTED_UNRELIABLE_PORT_2277_0022,
+ EXPECTED_UNICAST_ADDRESS_2266_0022,
+ EXPECTED_RELIABLE_PORT_2266_0022,
+ EXPECTED_UNRELIABLE_PORT_2266_0022,
+ EXPECTED_UNICAST_ADDRESS_4466_0321,
+ EXPECTED_RELIABLE_PORT_4466_0321,
+ EXPECTED_UNRELIABLE_PORT_4466_0321,
+ EXPECTED_SD_ENABLED,
+ EXPECTED_SD_PROTOCOL,
+ EXPECTED_SD_MULTICAST,
+ EXPECTED_SD_PORT,
+ EXPECTED_DEPRECATED_INITIAL_DELAY_MIN,
+ EXPECTED_DEPRECATED_INITIAL_DELAY_MAX,
+ EXPECTED_DEPRECATED_REPETITIONS_BASE_DELAY,
+ EXPECTED_DEPRECATED_REPETITIONS_MAX,
+ EXPECTED_DEPRECATED_TTL,
+ EXPECTED_CYCLIC_OFFER_DELAY,
+ EXPECTED_DEPRECATED_REQUEST_RESPONSE_DELAY);
+
+ return 0;
+}
+
+
+
diff --git a/test/configuration_tests/configuration-test.json b/test/configuration_tests/configuration-test.json
new file mode 100644
index 0000000..499dbc9
--- /dev/null
+++ b/test/configuration_tests/configuration-test.json
@@ -0,0 +1,103 @@
+{
+ "unicast" : "10.0.2.15",
+ "logging" :
+ {
+ "level" : "debug",
+ "console" : "true",
+ "file" : { "enable" : "true", "path" : "/home/someip/another-file.log" },
+ "dlt" : "false"
+ },
+ "applications" :
+ [
+ {
+ "name" : "my_application",
+ "id" : "0x7788"
+ },
+ {
+ "name" : "other_application",
+ "id" : "0x9933"
+ }
+ ],
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x0022",
+ "unicast" : "local",
+ "reliable" : { "port" : "30506", "magic_cookies" : "false" },
+ "unreliable" : "31000",
+ "events" :
+ [
+ {
+ "event" : "0x0778",
+ "is_field" : "false"
+ },
+ {
+ "event" : "0x779",
+ "is_field" : "true"
+ },
+ {
+ "event" : "0x77A",
+ "is_field" : "false"
+ }
+ ],
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x4567",
+ "multicast" : "225.226.227.228",
+ "events" : [ "0x778", "0x779" ]
+ },
+ {
+ "eventgroup" : "0x4569",
+ "multicast" : "225.227.227.228",
+ "events" : [ "0x779", "0x77A" ]
+ },
+ {
+ "eventgroup" : "0x4569",
+ "multicast" : "225.222.227.228",
+ "events" : [ "0x778", "0x77A" ]
+ }
+ ]
+ },
+ {
+ "service" : "0x1234",
+ "instance" : "0x0023",
+ "reliable" : "30503"
+ },
+ {
+ "service" : "0x2277",
+ "instance" : "0x0022",
+ "reliable" : { "port" : "30505" },
+ "unreliable" : "31001"
+ },
+ {
+ "service" : "0x2266",
+ "instance" : "0x0022",
+ "reliable" : "30505",
+ "unreliable" : "30507"
+ },
+ {
+ "service" : "0x4466",
+ "instance" : "0x0321",
+ "unicast" : "10.0.2.23",
+ "reliable" : "30506",
+ "unreliable" : "30444"
+ }
+ ],
+ "routing" : "my_application",
+ "service-discovery" :
+ {
+ "enable" : "true",
+ "protocol" : "udp",
+ "multicast" : "224.212.244.223",
+ "port" : "30666",
+ "initial_delay_min" : "1234",
+ "initial_delay_max" : "2345",
+ "repetitions_base_delay" : "4242",
+ "repetitions_max" : "4",
+ "ttl" : "13",
+ "cyclic_offer_delay" : "2132",
+ "request_response_delay" : "1111"
+ }
+} \ No newline at end of file
diff --git a/test/header_factory_tests/header_factory_test_client.cpp b/test/header_factory_tests/header_factory_test_client.cpp
index 4cce67e..3f9eb4f 100644
--- a/test/header_factory_tests/header_factory_test_client.cpp
+++ b/test/header_factory_tests/header_factory_test_client.cpp
@@ -22,24 +22,20 @@ void header_factory_test_client::init()
{
app_->init();
- app_->register_event_handler(
- std::bind(&header_factory_test_client::on_event, this,
+ app_->register_state_handler(
+ std::bind(&header_factory_test_client::on_state, this,
std::placeholders::_1));
- app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- std::bind(&header_factory_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
app_->register_message_handler(vsomeip::ANY_SERVICE,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD,
std::bind(&header_factory_test_client::on_message, this,
std::placeholders::_1));
- request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
- request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- request_->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
+ app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID,
+ std::bind(&header_factory_test_client::on_availability, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3));
}
void header_factory_test_client::start()
@@ -53,7 +49,7 @@ 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_event_handler();
+ app_->unregister_state_handler();
app_->unregister_message_handler(vsomeip::ANY_SERVICE,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD);
@@ -66,9 +62,9 @@ void header_factory_test_client::join_sender_thread(){
ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
}
-void header_factory_test_client::on_event(vsomeip::event_type_e _event)
+void header_factory_test_client::on_state(vsomeip::state_type_e _state)
{
- if(_event == vsomeip::event_type_e::ET_REGISTERED)
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
{
app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, false);
@@ -112,6 +108,11 @@ void header_factory_test_client::on_message(const std::shared_ptr<vsomeip::messa
ASSERT_EQ(_response->get_client(), vsomeip_test::TEST_CLIENT_CLIENT_ID);
ASSERT_EQ(_response->get_session(),
static_cast<vsomeip::session_t>(number_of_acknowledged_messages_));
+ if(number_of_acknowledged_messages_ == number_of_messages_to_send_) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ = true;
+ condition_.notify_one();
+ }
}
void header_factory_test_client::send()
@@ -128,8 +129,12 @@ void header_factory_test_client::run()
{
condition_.wait(its_lock);
}
+ blocked_ = false;
+ request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
+ request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+ request_->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
- for (int i = 0; i < number_of_messages_to_send_; i++)
+ for (uint32_t i = 0; i < number_of_messages_to_send_; i++)
{
app_->send(request_, true);
VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0')
@@ -141,14 +146,10 @@ void header_factory_test_client::run()
<< request_->get_instance() << "]";
number_of_sent_messages_++;
}
- blocked_ = false;
- // wait until all send messages has been acknowledged, but a maximum of 5 sec.
- int cnt = 0;
- while (number_of_acknowledged_messages_ != number_of_messages_to_send_
- && cnt < 5)
+ // wait until all messages have been acknowledged
+ while (!blocked_)
{
- std::this_thread::sleep_for(std::chrono::seconds(1));
- cnt++;
+ condition_.wait(its_lock);
}
stop();
}
diff --git a/test/header_factory_tests/header_factory_test_client.hpp b/test/header_factory_tests/header_factory_test_client.hpp
index 51803a1..a68627e 100644
--- a/test/header_factory_tests/header_factory_test_client.hpp
+++ b/test/header_factory_tests/header_factory_test_client.hpp
@@ -25,7 +25,7 @@ public:
void start();
void stop();
void join_sender_thread();
- void on_event(vsomeip::event_type_e _event);
+ void on_state(vsomeip::state_type_e _state);
void on_availability(vsomeip::service_t _service,
vsomeip::instance_t _instance, bool _is_available);
void on_message(const std::shared_ptr<vsomeip::message> &_response);
diff --git a/test/header_factory_tests/header_factory_test_client.json b/test/header_factory_tests/header_factory_test_client.json
index d0523b3..71bc75b 100644
--- a/test/header_factory_tests/header_factory_test_client.json
+++ b/test/header_factory_tests/header_factory_test_client.json
@@ -21,78 +21,77 @@
"id" : "0x1343"
}
],
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "unreliable" : "30509",
+ "events" :
+ [
+ {
+ "event" : "0x0777",
+ "is_field" : "true"
+ },
- "servicegroups" :
- [
- {
- "name" : "remote",
- "unicast" : "127.0.0.1",
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "events" :
- [
- {
- "event" : "0x0777",
- "is_field" : "true"
- },
-
- {
- "event" : "0x0778",
- "is_field" : "false"
- },
+ {
+ "event" : "0x0778",
+ "is_field" : "false"
+ },
- {
- "event" : "0x0779",
- "is_field" : "true"
- }
- ],
+ {
+ "event" : "0x0779",
+ "is_field" : "true"
+ }
+ ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" :
- [
- "0x777",
- "0x778"
- ]
- },
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x4455",
+ "events" :
+ [
+ "0x777",
+ "0x778"
+ ]
+ },
- {
- "eventgroup" : "0x4465",
- "events" :
- [
- "0x778",
- "0x779"
- ],
+ {
+ "eventgroup" : "0x4465",
+ "events" :
+ [
+ "0x778",
+ "0x779"
+ ],
- "is_multicast" : "true"
- },
+ "is_multicast" : "true"
+ },
- {
- "eventgroup" : "0x4555",
- "events" :
- [
- "0x777",
- "0x779"
- ]
- }
- ]
- }
- ]
+ {
+ "eventgroup" : "0x4555",
+ "events" :
+ [
+ "0x777",
+ "0x779"
+ ]
+ }
+ ]
}
],
"routing" : "header_factory_test_service",
"service-discovery" :
{
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "protocol" : "udp"
+ "enable" : "false",
+ "multicast" : "224.0.0.1",
+ "port" : "30491",
+ "protocol" : "udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "100",
+ "repetitions_base_delay" : "200",
+ "repetitions_max" : "3",
+ "ttl" : "3",
+ "cyclic_offer_delay" : "2000",
+ "request_response_delay" : "1500"
}
} \ No newline at end of file
diff --git a/test/header_factory_tests/header_factory_test_client_start.sh b/test/header_factory_tests/header_factory_test_client_start.sh
index d8696cb..b500060 100755
--- a/test/header_factory_tests/header_factory_test_client_start.sh
+++ b/test/header_factory_tests/header_factory_test_client_start.sh
@@ -4,5 +4,5 @@
# 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/.
export VSOMEIP_APPLICATION_NAME=header_factory_test_client
-export VSOMEIP_CONFIGURATION_FILE=header_factory_test_client.json
+export VSOMEIP_CONFIGURATION=header_factory_test_client.json
./header_factory_test_client
diff --git a/test/header_factory_tests/header_factory_test_send_receive_starter.sh b/test/header_factory_tests/header_factory_test_send_receive_starter.sh
index 094dfd4..74f8504 100755
--- a/test/header_factory_tests/header_factory_test_send_receive_starter.sh
+++ b/test/header_factory_tests/header_factory_test_send_receive_starter.sh
@@ -12,13 +12,13 @@
# Start the service
export VSOMEIP_APPLICATION_NAME=header_factory_test_service
-export VSOMEIP_CONFIGURATION_FILE=header_factory_test_service.json
+export VSOMEIP_CONFIGURATION=header_factory_test_service.json
./header_factory_test_service &
sleep 1;
# Start the client
export VSOMEIP_APPLICATION_NAME=header_factory_test_client
-export VSOMEIP_CONFIGURATION_FILE=header_factory_test_client.json
+export VSOMEIP_CONFIGURATION=header_factory_test_client.json
./header_factory_test_client &
# Wait until client and service are finished
diff --git a/test/header_factory_tests/header_factory_test_service.cpp b/test/header_factory_tests/header_factory_test_service.cpp
index cbdc5a6..9879b48 100644
--- a/test/header_factory_tests/header_factory_test_service.cpp
+++ b/test/header_factory_tests/header_factory_test_service.cpp
@@ -10,9 +10,9 @@
header_factory_test_service::header_factory_test_service(bool _use_static_routing) :
app_(vsomeip::runtime::get()->create_application()),
is_registered_(false),
- blocked_(false),
use_static_routing_(_use_static_routing),
offer_thread_(std::bind(&header_factory_test_service::run, this)),
+ blocked_(false),
number_of_received_messages_(0)
{
}
@@ -27,8 +27,8 @@ void header_factory_test_service::init()
std::bind(&header_factory_test_service::on_message, this,
std::placeholders::_1));
- app_->register_event_handler(
- std::bind(&header_factory_test_service::on_event, this,
+ app_->register_state_handler(
+ std::bind(&header_factory_test_service::on_state, this,
std::placeholders::_1));
VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF");
@@ -45,8 +45,10 @@ 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_event_handler();
+ app_->unregister_state_handler();
app_->stop();
+ std::thread t([](){ usleep(1000000 * 5);});
+ t.join();
}
void header_factory_test_service::join_offer_thread()
@@ -66,13 +68,13 @@ void header_factory_test_service::stop_offer()
vsomeip_test::TEST_SERVICE_INSTANCE_ID);
}
-void header_factory_test_service::on_event(vsomeip::event_type_e _event)
+void header_factory_test_service::on_state(vsomeip::state_type_e _state)
{
VSOMEIP_INFO << "Application " << app_->get_name() << " is "
- << (_event == vsomeip::event_type_e::ET_REGISTERED ? "registered." :
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ? "registered." :
"deregistered.");
- if(_event == vsomeip::event_type_e::ET_REGISTERED)
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
{
if(!is_registered_)
{
@@ -122,7 +124,9 @@ void header_factory_test_service::on_message(const std::shared_ptr<vsomeip::mess
if(number_of_received_messages_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND)
{
- app_->stop();
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ =true;
+ condition_.notify_one();
}
ASSERT_LT(number_of_received_messages_,
vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1);
@@ -134,10 +138,17 @@ void header_factory_test_service::run()
while (!blocked_)
condition_.wait(its_lock);
+ blocked_ = false;
if(use_static_routing_)
{
offer();
}
+ while (!blocked_)
+ condition_.wait(its_lock);
+
+ std::thread t([](){ usleep(1000000 * 5);});
+ t.join();
+ app_->stop();
}
TEST(someip_header_factory_test, reveice_message_ten_times_test)
diff --git a/test/header_factory_tests/header_factory_test_service.hpp b/test/header_factory_tests/header_factory_test_service.hpp
index 0c2df1c..99f5b09 100644
--- a/test/header_factory_tests/header_factory_test_service.hpp
+++ b/test/header_factory_tests/header_factory_test_service.hpp
@@ -26,7 +26,7 @@ public:
void offer();
void stop_offer();
void join_offer_thread();
- void on_event(vsomeip::event_type_e _event);
+ void on_state(vsomeip::state_type_e _state);
void on_message(const std::shared_ptr<vsomeip::message> &_request);
void run();
diff --git a/test/header_factory_tests/header_factory_test_service.json b/test/header_factory_tests/header_factory_test_service.json
index cb403cb..a99d0a2 100644
--- a/test/header_factory_tests/header_factory_test_service.json
+++ b/test/header_factory_tests/header_factory_test_service.json
@@ -1,118 +1,105 @@
{
- "unicast" : "127.0.0.1",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
+ "unicast" : "127.0.0.1",
+ "logging" :
+ {
+ "level" : "debug",
+ "console" : "true",
+ "file" :
+ {
+ "enable" : "false",
+ "path" : "/tmp/vsomeip.log"
+ },
+ "dlt" : "false"
+ },
- "dlt" : "false"
- },
+ "applications" :
+ [
+ {
+ "name" : "header_factory_test_service",
+ "id" : "0x1277"
+ }
+ ],
- "applications" :
- [
- {
- "name" : "header_factory_test_service",
- "id" : "0x1277"
- }
- ],
-
- "servicegroups" :
- [
- {
- "name" : "default",
- "delays" :
- {
- "initial" :
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "unreliable" : "30509",
+ "multicast" :
{
- "minimum" : "10",
- "maximum" : "100"
+ "address" : "224.225.226.233",
+ "port" : "32344"
},
- "repetition-base" : "200",
- "repetition-max" : "3",
- "cyclic-offer" : "2000",
- "cyclic-request" : "2001"
- },
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "multicast" :
- {
- "address" : "224.225.226.233",
- "port" : "32344"
- },
+ "events" :
+ [
+ {
+ "event" : "0x0777",
+ "is_field" : "true",
+ "update-cycle" : 2000
+ },
- "events" :
- [
- {
- "event" : "0x0777",
- "is_field" : "true",
- "update-cycle" : 2000
- },
+ {
+ "event" : "0x0778",
+ "is_field" : "true",
+ "update-cycle" : 0
+ },
- {
- "event" : "0x0778",
- "is_field" : "true",
- "update-cycle" : 0
- },
+ {
+ "event" : "0x0779",
+ "is_field" : "true"
+ }
+ ],
- {
- "event" : "0x0779",
- "is_field" : "true"
- }
- ],
-
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" :
- [
+ "eventgroups" :
+ [
+ {
+ "eventgroup" : "0x4455",
+ "events" :
+ [
"0x777",
"0x778"
- ]
- },
+ ]
+ },
- {
- "eventgroup" : "0x4465",
- "events" :
- [
- "0x778",
- "0x779"
- ],
+ {
+ "eventgroup" : "0x4465",
+ "events" :
+ [
+ "0x778",
+ "0x779"
+ ],
- "is_multicast" : "true"
- },
+ "is_multicast" : "true"
+ },
- {
- "eventgroup" : "0x4555",
- "events" :
- [
+ {
+ "eventgroup" : "0x4555",
+ "events" :
+ [
"0x777",
- "0x779"
- ]
- }
- ]
- }
- ]
- }
- ],
+ "0x779"
+ ]
+ }
+ ]
+ }
+ ],
+
+ "routing" : "header_factory_test_service",
- "routing" : "header_factory_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
+ "service-discovery" :
+ {
+ "enable" : "false",
+ "multicast" : "224.0.0.1",
+ "port" : "30490",
+ "protocol" : "udp",
+ "initial_delay_min" : "10",
+ "initial_delay_max" : "100",
+ "repetitions_base_delay" : "200",
+ "repetitions_max" : "3",
+ "ttl" : "3",
+ "cyclic_offer_delay" : "2000",
+ "request_response_delay" : "1500"
+ }
} \ No newline at end of file
diff --git a/test/header_factory_tests/header_factory_test_service_start.sh b/test/header_factory_tests/header_factory_test_service_start.sh
index e0e4c2d..437ecdd 100755
--- a/test/header_factory_tests/header_factory_test_service_start.sh
+++ b/test/header_factory_tests/header_factory_test_service_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=header_factory_test_service
-export VSOMEIP_CONFIGURATION_FILE=header_factory_test_service.json
+export VSOMEIP_CONFIGURATION=header_factory_test_service.json
./header_factory_test_service
diff --git a/test/magic-cookies-test-client.cpp b/test/magic-cookies-test-client.cpp
deleted file mode 100644
index a2f7681..0000000
--- a/test/magic-cookies-test-client.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#include <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <memory>
-#include <thread>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../examples/sample-ids.hpp"
-#include "../implementation/runtime/include/application_impl.hpp"
-#include "../implementation/routing/include/routing_manager.hpp"
-
-class client_sample {
-public:
- client_sample()
- : app_(new vsomeip::application_impl("")),
- runner_(std::bind(&client_sample::run, this)),
- is_available_(false),
- is_blocked_(false) {
- }
-
- void init() {
- VSOMEIP_INFO << "Initializing...";
- app_->init();
-
- app_->register_event_handler(
- std::bind(
- &client_sample::on_event,
- this,
- std::placeholders::_1));
-
- app_->register_availability_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID,
- std::bind(&client_sample::on_availability,
- this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
-
- app_->register_message_handler(
- vsomeip::ANY_SERVICE, SAMPLE_INSTANCE_ID, vsomeip::ANY_METHOD,
- std::bind(&client_sample::on_message,
- this,
- std::placeholders::_1));
- }
-
- void start() {
- VSOMEIP_INFO << "Starting...";
- app_->start();
- }
-
- void stop() {
- VSOMEIP_INFO << "Stopping...";
- app_->stop();
- }
-
- void on_event(vsomeip::event_type_e _event) {
- if (_event == vsomeip::event_type_e::ET_REGISTERED) {
- VSOMEIP_INFO << "Client registration done.";
- app_->request_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, false,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR,
- vsomeip::ANY_TTL);
- }
- }
-
- 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.");
-
- if (SAMPLE_SERVICE_ID == _service && SAMPLE_INSTANCE_ID == _instance) {
- static bool is_available = false;
- if (is_available && !_is_available) is_available = false;
- else if (_is_available && !is_available) {
- is_available = true;
- std::lock_guard< std::mutex > its_lock(mutex_);
- is_blocked_ = true;
- condition_.notify_one();
- }
- }
- }
-
- void on_message(const std::shared_ptr< vsomeip::message > &_response) {
- VSOMEIP_INFO << "Received a response from Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _response->get_service()
- << "."
- << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance()
- << "] to Client/Session ["
- << std::setw(4) << std::setfill('0') << std::hex << _response->get_client()
- << "/"
- << std::setw(4) << std::setfill('0') << std::hex << _response->get_session()
- << "]";
- }
-
- void join() {
- runner_.join();
- }
-
- void run() {
- std::unique_lock< std::mutex > its_lock(mutex_);
- while (!is_blocked_) condition_.wait(its_lock);
- VSOMEIP_INFO << "Running...";
-
- vsomeip::routing_manager *its_routing = app_->get_routing_manager();
-
- vsomeip::byte_t its_good_payload_data[] = {
- 0x12, 0x34, 0x84, 0x21,
- 0x00, 0x00, 0x00, 0x11,
- 0x13, 0x43, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01
- };
-
- vsomeip::byte_t its_bad_payload_data[] = {
- 0x12, 0x34, 0x84, 0x21,
- 0x00, 0x00, 0x01, 0x23,
- 0x13, 0x43, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01
- };
-
- // Test sequence
- its_good_payload_data[11] = 0x01;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_bad_payload_data[11] = 0x02;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_good_payload_data[11] = 0x03;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_bad_payload_data[11] = 0x04;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_bad_payload_data[11] = 0x05;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_good_payload_data[11] = 0x06;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_good_payload_data[11] = 0x07;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_bad_payload_data[11] = 0x08;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_bad_payload_data[11] = 0x09;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_bad_payload_data[11] = 0x0A;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_good_payload_data[11] = 0x0B;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_good_payload_data[11] = 0x0C;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_good_payload_data[11] = 0x0D;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_bad_payload_data[11] = 0x0E;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), SAMPLE_INSTANCE_ID, true, true);
- its_good_payload_data[11] = 0x0F;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), SAMPLE_INSTANCE_ID, true, true);
-
- std::this_thread::sleep_for(std::chrono::milliseconds(2000));
- stop();
- }
-
-private:
- std::shared_ptr< vsomeip::application_impl > app_;
- std::thread runner_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool is_available_;
- bool is_blocked_;
-};
-
-
-int main(int argc, char **argv) {
- client_sample its_client;
- its_client.init();
- its_client.start();
- its_client.join();
- return 0;
-}
-
-
diff --git a/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in b/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in
new file mode 100644
index 0000000..c95370b
--- /dev/null
+++ b/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in
@@ -0,0 +1,85 @@
+{
+ "unicast":"@TEST_IP_MASTER@",
+ "netmask":"255.255.255.0",
+ "logging":
+ {
+ "level":"info",
+ "console":"true",
+ "file":
+ {
+ "enable":"true",
+ "path":"/var/log/vsomeip.log"
+ },
+ "dlt":"true"
+ },
+ "applications":
+ [
+ {
+ "name":"magic_cookies_test_client",
+ "id":"0x1343"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1234",
+ "instance":"0x5678",
+ "unicast":"@TEST_IP_SLAVE@",
+ "reliable":
+ {
+ "port":"30509",
+ "enable-magic-cookies":"true"
+ },
+ "events":
+ [
+ {
+ "event":"0x0777",
+ "is_field":"true"
+ },
+ {
+ "event":"0x0778",
+ "is_field":"false"
+ },
+ {
+ "event":"0x0779",
+ "is_field":"true"
+ }
+ ],
+ "eventgroups":
+ [
+ {
+ "eventgroup":"0x4455",
+ "events":
+ [
+ "0x777",
+ "0x778"
+ ]
+ },
+ {
+ "eventgroup":"0x4465",
+ "events":
+ [
+ "0x778",
+ "0x779"
+ ]
+ },
+ {
+ "eventgroup":"0x4555",
+ "events":
+ [
+ "0x777",
+ "0x779"
+ ]
+ }
+ ]
+ }
+ ],
+ "routing":"magic_cookies_test_client",
+ "service-discovery":
+ {
+ "enable":"false",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in b/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in
new file mode 100644
index 0000000..629c99e
--- /dev/null
+++ b/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in
@@ -0,0 +1,88 @@
+{
+ "unicast":"@TEST_IP_SLAVE@",
+ "logging":
+ {
+ "level":"debug",
+ "console":"true",
+ "file":
+ {
+ "enable":"false",
+ "path":"/tmp/vsomeip.log"
+ },
+ "dlt":"false"
+ },
+ "applications":
+ [
+ {
+ "name":"magic_cookies_test_service",
+ "id":"0x1277"
+ }
+ ],
+ "services":
+ [
+ {
+ "service":"0x1234",
+ "instance":"0x5678",
+ "reliable":
+ {
+ "port":"30509",
+ "enable-magic-cookies":"true"
+ },
+ "events":
+ [
+ {
+ "event":"0x0777",
+ "is_field":"false",
+ "is_reliable":"true",
+ "update-cycle":"2000"
+ },
+ {
+ "event":"0x0778",
+ "is_field":"true",
+ "is_reliable":"true",
+ "update-cycle":"0"
+ },
+ {
+ "event":"0x0779",
+ "is_field":"false",
+ "is_reliable":"true"
+ }
+ ],
+ "eventgroups":
+ [
+ {
+ "eventgroup":"0x4455",
+ "events":
+ [
+ "0x777",
+ "0x778"
+ ]
+ },
+ {
+ "eventgroup":"0x4465",
+ "events":
+ [
+ "0x778",
+ "0x779"
+ ]
+ },
+ {
+ "eventgroup":"0x4555",
+ "events":
+ [
+ "0x777",
+ "0x779"
+ ]
+ }
+ ]
+ }
+ ],
+ "routing":"magic_cookies_test_service",
+ "service-discovery":
+ {
+ "enable":"false",
+ "multicast":"224.0.0.1",
+ "port":"30490",
+ "protocol":"udp"
+ }
+}
diff --git a/test/magic_cookies_tests/magic_cookies_test_client.cpp b/test/magic_cookies_tests/magic_cookies_test_client.cpp
new file mode 100644
index 0000000..e2f1396
--- /dev/null
+++ b/test/magic_cookies_tests/magic_cookies_test_client.cpp
@@ -0,0 +1,192 @@
+// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <chrono>
+#include <condition_variable>
+#include <iomanip>
+#include <memory>
+#include <thread>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include "../someip_test_globals.hpp"
+#include "../implementation/runtime/include/application_impl.hpp"
+#include "../implementation/routing/include/routing_manager.hpp"
+
+class magic_cookies_test_client {
+public:
+ magic_cookies_test_client()
+ : app_(new vsomeip::application_impl("")),
+ is_available_(false),
+ is_blocked_(false),
+ runner_(std::bind(&magic_cookies_test_client::run, this)) {
+ }
+
+ void init() {
+ VSOMEIP_INFO << "Initializing...";
+ app_->init();
+
+ app_->register_state_handler(
+ std::bind(
+ &magic_cookies_test_client::on_state,
+ this,
+ std::placeholders::_1));
+
+ app_->register_message_handler(
+ vsomeip::ANY_SERVICE, vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD,
+ std::bind(&magic_cookies_test_client::on_message,
+ this,
+ std::placeholders::_1));
+
+ app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID,
+ std::bind(&magic_cookies_test_client::on_availability,
+ this,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+ }
+
+ void start() {
+ VSOMEIP_INFO << "Starting...";
+ app_->start();
+ }
+
+ void stop() {
+ VSOMEIP_INFO << "Stopping...";
+ app_->stop();
+ }
+
+ void on_state(vsomeip::state_type_e _state) {
+ if (_state == vsomeip::state_type_e::ST_REGISTERED) {
+ VSOMEIP_INFO << "Client registration done.";
+ app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID,
+ vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR,
+ false);
+ }
+ }
+
+ 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.");
+
+ if (vsomeip_test::TEST_SERVICE_SERVICE_ID == _service && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) {
+ static bool is_available = false;
+ if (is_available && !_is_available) is_available = false;
+ else if (_is_available && !is_available) {
+ is_available = true;
+ std::lock_guard< std::mutex > its_lock(mutex_);
+ is_blocked_ = true;
+ condition_.notify_one();
+ }
+ }
+ }
+
+ void on_message(const std::shared_ptr< vsomeip::message > &_response) {
+ if (_response->get_return_code() == vsomeip::return_code_e::E_OK) {
+ VSOMEIP_INFO << "Received a response from Service ["
+ << std::setw(4) << std::setfill('0') << std::hex << _response->get_service()
+ << "."
+ << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance()
+ << "] to Client/Session ["
+ << std::setw(4) << std::setfill('0') << std::hex << _response->get_client()
+ << "/"
+ << std::setw(4) << std::setfill('0') << std::hex << _response->get_session()
+ << "]";
+ } else if (_response->get_return_code() == vsomeip::return_code_e::E_MALFORMED_MESSAGE) {
+ VSOMEIP_INFO << "Received an error message from Service ["
+ << std::setw(4) << std::setfill('0') << std::hex << _response->get_service()
+ << "."
+ << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance()
+ << "] to Client/Session ["
+ << std::setw(4) << std::setfill('0') << std::hex << _response->get_client()
+ << "/"
+ << std::setw(4) << std::setfill('0') << std::hex << _response->get_session()
+ << "]";
+ }
+ }
+
+ void join() {
+ runner_.join();
+ }
+
+ void run() {
+ std::unique_lock< std::mutex > its_lock(mutex_);
+ while (!is_blocked_) condition_.wait(its_lock);
+ VSOMEIP_INFO << "Running...";
+
+ vsomeip::routing_manager *its_routing = app_->get_routing_manager();
+
+ vsomeip::byte_t its_good_payload_data[] = {
+ 0x12, 0x34, 0x84, 0x21,
+ 0x00, 0x00, 0x00, 0x11,
+ 0x13, 0x43, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00,
+ 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01
+ };
+
+ vsomeip::byte_t its_bad_payload_data[] = {
+ 0x12, 0x34, 0x84, 0x21,
+ 0x00, 0x00, 0x01, 0x23,
+ 0x13, 0x43, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00,
+ 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01
+ };
+
+ // Test sequence
+ its_good_payload_data[11] = 0x01;
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_bad_payload_data[11] = 0x02;
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_good_payload_data[11] = 0x03;
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_bad_payload_data[11] = 0x04;
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_bad_payload_data[11] = 0x05;
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_good_payload_data[11] = 0x06;
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_good_payload_data[11] = 0x07;
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_bad_payload_data[11] = 0x08;
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_bad_payload_data[11] = 0x09;
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_bad_payload_data[11] = 0x0A;
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_good_payload_data[11] = 0x0B;
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_good_payload_data[11] = 0x0C;
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_good_payload_data[11] = 0x0D;
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_bad_payload_data[11] = 0x0E;
+ its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ its_good_payload_data[11] = 0x0F;
+ its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+
+ std::this_thread::sleep_for(std::chrono::milliseconds(2000));
+ stop();
+ }
+
+private:
+ std::shared_ptr< vsomeip::application_impl > app_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ bool is_available_;
+ bool is_blocked_;
+ std::thread runner_;
+};
+
+
+int main() {
+ magic_cookies_test_client its_client;
+ its_client.init();
+ its_client.start();
+ its_client.join();
+ return 0;
+}
+
+
diff --git a/test/magic_cookies_test_client_start.sh b/test/magic_cookies_tests/magic_cookies_test_client_start.sh
index 45ee754..ba4f662 100755
--- a/test/magic_cookies_test_client_start.sh
+++ b/test/magic_cookies_tests/magic_cookies_test_client_start.sh
@@ -4,6 +4,6 @@
# 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/.
-export VSOMEIP_APPLICATION_NAME=client-sample
-export VSOMEIP_CONFIGURATION_FILE=vsomeip-magic-cookies-client.json
-./magic-cookies-test-client
+export VSOMEIP_APPLICATION_NAME=magic_cookies_test_client
+export VSOMEIP_CONFIGURATION=magic_cookies_test_client.json
+./magic_cookies_test_client
diff --git a/test/magic_cookies_tests/magic_cookies_test_service.cpp b/test/magic_cookies_tests/magic_cookies_test_service.cpp
new file mode 100644
index 0000000..35e1d77
--- /dev/null
+++ b/test/magic_cookies_tests/magic_cookies_test_service.cpp
@@ -0,0 +1,155 @@
+// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <chrono>
+#include <condition_variable>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <thread>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include "../someip_test_globals.hpp"
+
+class magic_cookies_test_service {
+public:
+ magic_cookies_test_service(bool _use_static_routing) :
+ app_(vsomeip::runtime::get()->create_application()),
+ is_registered_(false),
+ use_static_routing_(_use_static_routing),
+ blocked_(false),
+ offer_thread_(std::bind(&magic_cookies_test_service::run, this)) {
+ }
+
+ ~magic_cookies_test_service() {
+ offer_thread_.join();
+ }
+ void init() {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+
+ app_->init();
+ app_->register_message_handler(
+ vsomeip_test::TEST_SERVICE_SERVICE_ID,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID,
+ vsomeip_test::TEST_SERVICE_METHOD_ID,
+ std::bind(&magic_cookies_test_service::on_message, this,
+ std::placeholders::_1));
+
+ app_->register_state_handler(
+ std::bind(&magic_cookies_test_service::on_state, this,
+ std::placeholders::_1));
+
+ VSOMEIP_INFO<< "Static routing " << (use_static_routing_ ? "ON" : "OFF");
+ }
+
+ void start() {
+ app_->start();
+ }
+
+ void offer() {
+ app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+ }
+
+ void stop_offer() {
+ app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_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) {
+ if (!is_registered_) {
+ is_registered_ = true;
+ blocked_ = true;
+ condition_.notify_one();
+ }
+ } else {
+ is_registered_ = false;
+ }
+ }
+
+ void on_message(const std::shared_ptr<vsomeip::message> &_request) {
+ VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4)
+ << std::setfill('0') << std::hex << _request->get_client() << "/"
+ << std::setw(4) << std::setfill('0') << std::hex
+ << _request->get_session() << "]";
+
+ std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get()
+ ->create_response(_request);
+
+ std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()
+ ->create_payload();
+ std::vector<vsomeip::byte_t> its_payload_data;
+ for (std::size_t i = 0; i < 120; ++i)
+ its_payload_data.push_back(i % 256);
+ its_payload->set_data(its_payload_data);
+ its_response->set_payload(its_payload);
+
+ app_->send(its_response, true);
+ if(_request->get_session() == 0x0F) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ = true;
+ condition_.notify_one();
+ }
+ }
+
+ void run() {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (!blocked_)
+ condition_.wait(its_lock);
+
+ bool is_offer(true);
+ blocked_ = false;
+
+ if (use_static_routing_) {
+ offer();
+ while (!blocked_) {
+ condition_.wait(its_lock);
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(5));
+ app_->stop();
+ } else {
+ while (true) {
+ if (is_offer)
+ offer();
+ else
+ stop_offer();
+ std::this_thread::sleep_for(std::chrono::milliseconds(10000));
+ is_offer = !is_offer;
+ }
+ }
+ }
+
+private:
+ std::shared_ptr<vsomeip::application> app_;
+ bool is_registered_;
+ bool use_static_routing_;
+
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ bool blocked_;
+ std::thread offer_thread_;
+};
+
+int main(int argc, char **argv) {
+ bool use_static_routing(false);
+
+ std::string static_routing_enable("--static-routing");
+
+ for (int i = 1; i < argc; i++) {
+ if (static_routing_enable == argv[i]) {
+ use_static_routing = true;
+ }
+ }
+
+ magic_cookies_test_service its_sample(use_static_routing);
+ its_sample.init();
+ its_sample.start();
+
+ return 0;
+}
diff --git a/test/magic_cookies_tests/magic_cookies_test_service_start.sh b/test/magic_cookies_tests/magic_cookies_test_service_start.sh
new file mode 100755
index 0000000..4261ed5
--- /dev/null
+++ b/test/magic_cookies_tests/magic_cookies_test_service_start.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+export VSOMEIP_APPLICATION_NAME=magic_cookies_test_service
+export VSOMEIP_CONFIGURATION=magic_cookies_test_service.json
+./magic_cookies_test_service --tcp --static-routing
diff --git a/test/magic_cookies_test_starter.sh b/test/magic_cookies_tests/magic_cookies_test_starter.sh
index c7ec3f7..ac97d61 100755
--- a/test/magic_cookies_test_starter.sh
+++ b/test/magic_cookies_tests/magic_cookies_test_starter.sh
@@ -8,7 +8,7 @@
# 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.
+# and service and checks that both exit successfully.
FAIL=0
@@ -58,19 +58,19 @@ cat <<End-of-message
** from an external host to successfully complete this test.
**
** You probably will need to adapt the 'unicast' settings in
-** vsomeip-magic-cookies-client.json and
-** vsomeip-magic-cookies-service.json to your personal setup.
+** magic_cookies_client.json and
+** magic_cookies_service.json to your personal setup.
**
-** As soon as the service is started please press any key to continue this test
+** As soon as the service is started please press <RETURN> to continue the test
*******************************************************************************
*******************************************************************************
End-of-message
read
# Start the client for magic-cookies test
-export VSOMEIP_APPLICATION_NAME=client-sample
-export VSOMEIP_CONFIGURATION_FILE=vsomeip-magic-cookies-client.json
-./magic-cookies-test-client &
+export VSOMEIP_APPLICATION_NAME=magic_cookies_test_client
+export VSOMEIP_CONFIGURATION=magic_cookies_test_client.json
+./magic_cookies_test_client &
CLIENT_PID=$!
# Wait until client is finished
@@ -81,7 +81,7 @@ do
wait $job || ((FAIL+=1))
done
-# Check if server exited sucessfully
+# Check if server exited successfully
if [ $FAIL -eq 0 ]
then
exit 0
diff --git a/test/payload_tests/external_local_payload_test_client_external.json b/test/payload_tests/conf/external_local_payload_test_client_external.json.in
index 0f76ec0..d027a6f 100644
--- a/test/payload_tests/external_local_payload_test_client_external.json
+++ b/test/payload_tests/conf/external_local_payload_test_client_external.json.in
@@ -1,5 +1,5 @@
{
- "unicast" : "172.16.100.131",
+ "unicast" : "@TEST_IP_SLAVE@",
"netmask" : "255.255.255.0",
"logging" :
{
@@ -22,25 +22,19 @@
}
],
- "servicegroups" :
- [
- {
- "name" : "remote",
- "unicast" : "134.86.56.183",
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "reliable" :
- {
- "port" : "30510",
- "enable-magic-cookies" : "false"
- }
- }
- ]
- }
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "unicast" : "@TEST_IP_MASTER@",
+ "unreliable" : "30509",
+ "reliable" :
+ {
+ "port" : "30510",
+ "enable-magic-cookies" : "false"
+ }
+ }
],
"routing" : "external_local_payload_test_client_external",
@@ -51,4 +45,4 @@
"port" : "30491",
"protocol" : "udp"
}
-} \ No newline at end of file
+}
diff --git a/test/payload_tests/external_local_payload_test_client_local.json b/test/payload_tests/conf/external_local_payload_test_client_local.json.in
index 78ae45a..40f40ca 100644
--- a/test/payload_tests/external_local_payload_test_client_local.json
+++ b/test/payload_tests/conf/external_local_payload_test_client_local.json.in
@@ -1,5 +1,5 @@
{
- "unicast" : "134.86.56.183",
+ "unicast" : "@TEST_IP_MASTER@",
"netmask" : "255.255.255.0",
"logging" :
{
@@ -22,24 +22,19 @@
}
],
- "servicegroups" :
+
+ "services" :
[
{
- "name" : "remote",
- "unicast" : "134.86.56.183",
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "reliable" :
- {
- "port" : "30510",
- "enable-magic-cookies" : "false"
- }
- }
- ]
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "unicast" : "@TEST_IP_MASTER@",
+ "unreliable" : "30509",
+ "reliable" :
+ {
+ "port" : "30510",
+ "enable-magic-cookies" : "false"
+ }
}
],
@@ -51,4 +46,4 @@
"port" : "30491",
"protocol" : "udp"
}
-} \ No newline at end of file
+}
diff --git a/test/payload_tests/conf/external_local_payload_test_service.json.in b/test/payload_tests/conf/external_local_payload_test_service.json.in
new file mode 100644
index 0000000..dc7680c
--- /dev/null
+++ b/test/payload_tests/conf/external_local_payload_test_service.json.in
@@ -0,0 +1,46 @@
+{
+ "unicast" : "@TEST_IP_MASTER@",
+ "logging" :
+ {
+ "level" : "debug",
+ "console" : "true",
+ "file" :
+ {
+ "enable" : "false",
+ "path" : "/tmp/vsomeip.log"
+ },
+
+ "dlt" : "false"
+ },
+
+ "applications" :
+ [
+ {
+ "name" : "external_local_payload_test_service",
+ "id" : "0x1277"
+ }
+ ],
+
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "unreliable" : "30509",
+ "reliable" :
+ {
+ "port" : "30510",
+ "enable-magic-cookies" : "false"
+ }
+ }
+ ],
+
+ "routing" : "external_local_payload_test_service",
+ "service-discovery" :
+ {
+ "enable" : "false",
+ "multicast" : "224.0.0.1",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
+}
diff --git a/test/payload_tests/external_local_payload_test_client_external_start.sh b/test/payload_tests/external_local_payload_test_client_external_start.sh
index 87d403a..2ca6816 100755
--- a/test/payload_tests/external_local_payload_test_client_external_start.sh
+++ b/test/payload_tests/external_local_payload_test_client_external_start.sh
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_external
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_client_external.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_client_external.json
./payload_test_client --udp --max-payload-size UDP
# We sleep to let the service restart with --tcp option so we can test
# communication via TCP.
diff --git a/test/payload_tests/external_local_payload_test_client_external_starter.sh b/test/payload_tests/external_local_payload_test_client_external_starter.sh
index f5c6ca5..225adba 100755
--- a/test/payload_tests/external_local_payload_test_client_external_starter.sh
+++ b/test/payload_tests/external_local_payload_test_client_external_starter.sh
@@ -50,7 +50,7 @@ check_tcp_udp_sockets_are_closed ()
# Start the service for payload test with UDP
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
./payload_test_service --udp &
SERIVCE_PID=$!
@@ -87,7 +87,7 @@ done
# Start the service for payload test with tcp
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
./payload_test_service --tcp &
SERIVCE_PID=$!
diff --git a/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh b/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh
index 038ada5..ba0bf15 100755
--- a/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh
+++ b/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh
@@ -50,7 +50,7 @@ check_tcp_udp_sockets_are_closed ()
# Start the service
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
./payload_test_service &
SERIVCE_PID=$!
sleep 1;
@@ -60,7 +60,7 @@ check_tcp_udp_sockets_are_open $SERIVCE_PID 2
# Start the client which sends messages over local UDS
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_client_local.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json
./payload_test_client --dont-shutdown-service &
CLIENT_PID=$!
sleep 1
@@ -104,7 +104,7 @@ done
# Start the service for payload test with tcp
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
./payload_test_service --tcp &
SERIVCE_PID=$!
diff --git a/test/payload_tests/external_local_payload_test_client_local_start.sh b/test/payload_tests/external_local_payload_test_client_local_start.sh
index fbf2633..87b9296 100755
--- a/test/payload_tests/external_local_payload_test_client_local_start.sh
+++ b/test/payload_tests/external_local_payload_test_client_local_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_client_local.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json
./payload_test_client
diff --git a/test/payload_tests/external_local_payload_test_client_local_starter.sh b/test/payload_tests/external_local_payload_test_client_local_starter.sh
index 1c0ecbe..6fda55a 100755
--- a/test/payload_tests/external_local_payload_test_client_local_starter.sh
+++ b/test/payload_tests/external_local_payload_test_client_local_starter.sh
@@ -50,7 +50,7 @@ check_tcp_udp_sockets_are_closed ()
# Start the service
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
./payload_test_service &
SERIVCE_PID=$!
sleep 1;
@@ -60,7 +60,7 @@ check_tcp_udp_sockets_are_open $SERIVCE_PID 2
# Start the client
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_client_local.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json
./payload_test_client &
CLIENT_PID=$!
diff --git a/test/payload_tests/external_local_payload_test_service.json b/test/payload_tests/external_local_payload_test_service.json
deleted file mode 100644
index 517b897..0000000
--- a/test/payload_tests/external_local_payload_test_service.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
- "unicast" : "134.86.56.183",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "external_local_payload_test_service",
- "id" : "0x1277"
- }
- ],
-
- "servicegroups" :
- [
- {
- "name" : "default",
- "unicast" : "local",
- "delays" :
- {
- "initial" :
- {
- "minimum" : "10",
- "maximum" : "100"
- },
-
- "repetition-base" : "200",
- "repetition-max" : "3",
- "cyclic-offer" : "2000",
- "cyclic-request" : "2001"
- },
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "reliable" :
- {
- "port" : "30510",
- "enable-magic-cookies" : "false"
- }
- }
- ]
- }
- ],
-
- "routing" : "external_local_payload_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-} \ No newline at end of file
diff --git a/test/payload_tests/external_local_payload_test_service_client_external_start.sh b/test/payload_tests/external_local_payload_test_service_client_external_start.sh
index 4230216..a41fd9d 100755
--- a/test/payload_tests/external_local_payload_test_service_client_external_start.sh
+++ b/test/payload_tests/external_local_payload_test_service_client_external_start.sh
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
./payload_test_service --udp
# After payload was measured with UDP the client will restart and measure
# throughput with TCP
diff --git a/test/payload_tests/external_local_payload_test_service_start.sh b/test/payload_tests/external_local_payload_test_service_start.sh
index e1dc27d..45fbcc2 100755
--- a/test/payload_tests/external_local_payload_test_service_start.sh
+++ b/test/payload_tests/external_local_payload_test_service_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
./payload_test_service
diff --git a/test/payload_tests/local_payload_test_client.json b/test/payload_tests/local_payload_test_client.json
index 8ac8e79..24fa1fa 100644
--- a/test/payload_tests/local_payload_test_client.json
+++ b/test/payload_tests/local_payload_test_client.json
@@ -21,17 +21,8 @@
"id" : "0x1343"
}
],
-
- "servicegroups" :
- [
- {
- "name" : "remote",
- "unicast" : "127.0.0.1",
- "services" :
- [
-
- ]
- }
+ "services" :
+ [
],
"routing" : "local_payload_test_service",
@@ -42,4 +33,4 @@
"port" : "30491",
"protocol" : "udp"
}
-} \ No newline at end of file
+}
diff --git a/test/payload_tests/local_payload_test_client_start.sh b/test/payload_tests/local_payload_test_client_start.sh
index 38c6e2a..ac157bc 100755
--- a/test/payload_tests/local_payload_test_client_start.sh
+++ b/test/payload_tests/local_payload_test_client_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=local_payload_test_client
-export VSOMEIP_CONFIGURATION_FILE=local_payload_test_client.json
+export VSOMEIP_CONFIGURATION=local_payload_test_client.json
./payload_test_client
diff --git a/test/payload_tests/local_payload_test_service.json b/test/payload_tests/local_payload_test_service.json
index 776881c..b5c83a6 100644
--- a/test/payload_tests/local_payload_test_service.json
+++ b/test/payload_tests/local_payload_test_service.json
@@ -1,5 +1,5 @@
{
- "unicast" : "134.86.56.183",
+ "unicast" : "127.0.0.1",
"logging" :
{
"level" : "debug",
@@ -21,32 +21,11 @@
}
],
- "servicegroups" :
+ "services" :
[
{
- "name" : "default",
- "unicast" : "local",
- "delays" :
- {
- "initial" :
- {
- "minimum" : "10",
- "maximum" : "100"
- },
-
- "repetition-base" : "200",
- "repetition-max" : "3",
- "cyclic-offer" : "2000",
- "cyclic-request" : "2001"
- },
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
+ "service" : "0x1234",
+ "instance" : "0x5678"
}
],
@@ -58,4 +37,4 @@
"port" : "30490",
"protocol" : "udp"
}
-} \ No newline at end of file
+}
diff --git a/test/payload_tests/local_payload_test_service_start.sh b/test/payload_tests/local_payload_test_service_start.sh
index a514e3a..8173a94 100755
--- a/test/payload_tests/local_payload_test_service_start.sh
+++ b/test/payload_tests/local_payload_test_service_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=local_payload_test_service.json
./payload_test_service
diff --git a/test/payload_tests/local_payload_test_starter.sh b/test/payload_tests/local_payload_test_starter.sh
index 930da96..a2bc3d4 100755
--- a/test/payload_tests/local_payload_test_starter.sh
+++ b/test/payload_tests/local_payload_test_starter.sh
@@ -35,7 +35,7 @@ check_tcp_udp_sockets_are_closed ()
# Start the service
export VSOMEIP_APPLICATION_NAME=local_payload_test_service
-export VSOMEIP_CONFIGURATION_FILE=local_payload_test_service.json
+export VSOMEIP_CONFIGURATION=local_payload_test_service.json
./payload_test_service &
SERIVCE_PID=$!
sleep 1;
@@ -44,7 +44,7 @@ check_tcp_udp_sockets_are_closed $SERIVCE_PID
# Start the client
export VSOMEIP_APPLICATION_NAME=local_payload_test_client
-export VSOMEIP_CONFIGURATION_FILE=local_payload_test_client.json
+export VSOMEIP_CONFIGURATION=local_payload_test_client.json
./payload_test_client &
CLIENT_PID=$!
diff --git a/test/payload_tests/payload_test_client.cpp b/test/payload_tests/payload_test_client.cpp
index 6151452..41bd577 100644
--- a/test/payload_tests/payload_test_client.cpp
+++ b/test/payload_tests/payload_test_client.cpp
@@ -8,7 +8,7 @@
enum class payloadsize
: std::uint8_t
{
- UDS, TCP, UDP
+ UDS, TCP, UDP, USER_SPECIFIED
};
// this variables are changed via cmdline parameters
@@ -17,7 +17,8 @@ static bool call_service_sync = true;
static std::uint32_t sliding_window_size = vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS;
static payloadsize max_payload_size = payloadsize::UDS;
static bool shutdown_service_at_end = true;
-
+static std::uint32_t user_defined_max_payload;
+static std::uint32_t number_of_messages_to_send = 0;
payload_test_client::payload_test_client(
bool _use_tcp,
@@ -30,7 +31,7 @@ payload_test_client::payload_test_client(
sender_(std::bind(&payload_test_client::run, this)),
blocked_(false),
is_available_(false),
- number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS),
+ number_of_messages_to_send_(number_of_messages_to_send ? number_of_messages_to_send : vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS),
number_of_sent_messages_(0),
number_of_sent_messages_total_(0),
number_of_acknowledged_messages_(0),
@@ -43,24 +44,20 @@ void payload_test_client::init()
{
app_->init();
- app_->register_event_handler(
- std::bind(&payload_test_client::on_event, this,
+ app_->register_state_handler(
+ std::bind(&payload_test_client::on_state, this,
std::placeholders::_1));
- app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- std::bind(&payload_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
app_->register_message_handler(vsomeip::ANY_SERVICE,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD,
std::bind(&payload_test_client::on_message, this,
std::placeholders::_1));
- request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
- request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- request_->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
+ app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID,
+ std::bind(&payload_test_client::on_availability, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3));
}
void payload_test_client::start()
@@ -79,11 +76,9 @@ void payload_test_client::stop()
}
app_->unregister_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- app_->unregister_event_handler();
+ app_->unregister_state_handler();
app_->unregister_message_handler(vsomeip::ANY_SERVICE,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD);
-
- app_->stop();
}
void payload_test_client::shutdown_service()
@@ -99,9 +94,9 @@ void payload_test_client::join_sender_thread()
sender_.join();
}
-void payload_test_client::on_event(vsomeip::event_type_e _event)
+void payload_test_client::on_state(vsomeip::state_type_e _state)
{
- if(_event == vsomeip::event_type_e::ET_REGISTERED)
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
{
app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, false);
@@ -150,16 +145,16 @@ void payload_test_client::on_message(const std::shared_ptr<vsomeip::message>& _r
else
{
// We notify the sender thread only if all sent messages have been acknowledged
- if(number_of_acknowledged_messages_ % sliding_window_size == 0)
+ if(number_of_acknowledged_messages_ == number_of_messages_to_send_)
{
std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
+ number_of_acknowledged_messages_ = 0;
all_msg_acknowledged_ = true;
all_msg_acknowledged_cv_.notify_one();
}
- if(number_of_acknowledged_messages_ == number_of_messages_to_send_)
+ else if(number_of_acknowledged_messages_ % sliding_window_size == 0)
{
std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
- number_of_acknowledged_messages_ = 0;
all_msg_acknowledged_ = true;
all_msg_acknowledged_cv_.notify_one();
}
@@ -181,6 +176,10 @@ void payload_test_client::run()
condition_.wait(its_lock);
}
+ request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
+ request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+ request_->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
+
// lock the mutex
std::unique_lock<std::mutex> lk(all_msg_acknowledged_mutex_);
@@ -218,6 +217,11 @@ void payload_test_client::run()
blocked_ = false;
stop();
+ std::thread t1([](){ usleep(1000000 * 5);});
+ t1.join();
+ app_->stop();
+ std::thread t([](){ usleep(1000000 * 5);});
+ t.join();
}
@@ -235,6 +239,9 @@ std::uint32_t payload_test_client::get_max_allowed_payload()
case payloadsize::UDP:
payload = VSOMEIP_MAX_UDP_MESSAGE_SIZE;
break;
+ case payloadsize::USER_SPECIFIED:
+ payload = user_defined_max_payload;
+ break;
default:
payload = VSOMEIP_MAX_LOCAL_MESSAGE_SIZE;
break;
@@ -317,6 +324,7 @@ int main(int argc, char** argv)
std::string sliding_window_size_param("--sliding-window-size");
std::string max_payload_size_param("--max-payload-size");
std::string shutdown_service_disable_param("--dont-shutdown-service");
+ std::string numbers_of_messages("--number-of-messages");
std::string help("--help");
int i = 1;
@@ -359,6 +367,16 @@ int main(int argc, char** argv)
{
max_payload_size = payloadsize::UDP;
}
+ else {
+ max_payload_size = payloadsize::USER_SPECIFIED;
+ std::stringstream converter(argv[i]);
+ converter >> user_defined_max_payload;
+ }
+ }
+ else if (numbers_of_messages == argv[i]) {
+ i++;
+ std::stringstream converter(argv[i]);
+ converter >> number_of_messages_to_send;
}
else if(shutdown_service_disable_param == argv[i])
{
@@ -380,6 +398,7 @@ int main(int argc, char** argv)
"TCP (=" << VSOMEIP_MAX_TCP_MESSAGE_SIZE << "byte)}, default: UDS\n"
<< "--dont-shutdown-service: Don't shutdown the service upon "
"finishing of the payload test\n"
+ << "--number-of-messages: Number of messages to send per payload size iteration\n"
<< "--help: print this help";
}
i++;
diff --git a/test/payload_tests/payload_test_client.hpp b/test/payload_tests/payload_test_client.hpp
index 9511560..ca1b58c 100644
--- a/test/payload_tests/payload_test_client.hpp
+++ b/test/payload_tests/payload_test_client.hpp
@@ -27,7 +27,7 @@ public:
void start();
void stop();
void join_sender_thread();
- void on_event(vsomeip::event_type_e _event);
+ void on_state(vsomeip::state_type_e _state);
void on_availability(vsomeip::service_t _service,
vsomeip::instance_t _instance, bool _is_available);
void on_message(const std::shared_ptr<vsomeip::message> &_response);
diff --git a/test/payload_tests/payload_test_service.cpp b/test/payload_tests/payload_test_service.cpp
index b8ae72f..2a92064 100644
--- a/test/payload_tests/payload_test_service.cpp
+++ b/test/payload_tests/payload_test_service.cpp
@@ -7,6 +7,7 @@
// this variables are changed via cmdline parameters
static bool use_tcp = false;
+static bool check_payload = true;
payload_test_service::payload_test_service(bool _use_tcp) :
app_(vsomeip::runtime::get()->create_application()),
@@ -34,8 +35,8 @@ void payload_test_service::init()
std::bind(&payload_test_service::on_message_shutdown, this,
std::placeholders::_1));
- app_->register_event_handler(
- std::bind(&payload_test_service::on_event, this,
+ app_->register_state_handler(
+ std::bind(&payload_test_service::on_state, this,
std::placeholders::_1));
}
@@ -52,7 +53,7 @@ void payload_test_service::stop()
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_event_handler();
+ app_->unregister_state_handler();
app_->stop();
}
@@ -71,13 +72,13 @@ void payload_test_service::stop_offer()
app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
}
-void payload_test_service::on_event(vsomeip::event_type_e _event)
+void payload_test_service::on_state(vsomeip::state_type_e _state)
{
VSOMEIP_INFO << "Application " << app_->get_name() << " is "
- << (_event == vsomeip::event_type_e::ET_REGISTERED ? "registered." :
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ? "registered." :
"deregistered.");
- if(_event == vsomeip::event_type_e::ET_REGISTERED)
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
{
if(!is_registered_)
{
@@ -117,11 +118,13 @@ void payload_test_service::on_message(const std::shared_ptr<vsomeip::message>& _
// make sure the message was sent from the service
ASSERT_EQ(_request->get_client(), vsomeip_test::TEST_CLIENT_CLIENT_ID);
- std::shared_ptr<vsomeip::payload> pl = _request->get_payload();
- vsomeip::byte_t* pl_ptr = pl->get_data();
- for (int i = 0; i < pl->get_length(); i++)
- {
- ASSERT_EQ(*(pl_ptr+i), vsomeip_test::PAYLOAD_TEST_DATA);
+ if (check_payload) {
+ std::shared_ptr<vsomeip::payload> pl = _request->get_payload();
+ vsomeip::byte_t* pl_ptr = pl->get_data();
+ for (vsomeip::length_t i = 0; i < pl->get_length(); i++)
+ {
+ ASSERT_EQ(*(pl_ptr+i), vsomeip_test::PAYLOAD_TEST_DATA);
+ }
}
// send response
@@ -134,6 +137,7 @@ void payload_test_service::on_message(const std::shared_ptr<vsomeip::message>& _
void payload_test_service::on_message_shutdown(
const std::shared_ptr<vsomeip::message>& _request)
{
+ (void)_request;
VSOMEIP_INFO << "Shutdown method was called, going down now.";
stop();
}
@@ -159,6 +163,7 @@ TEST(someip_payload_test, send_response_for_every_request)
int main(int argc, char** argv)
{
std::string help("--help");
+ std::string check("--do-not-check-payload");
int i = 1;
while (i < argc)
@@ -166,7 +171,11 @@ int main(int argc, char** argv)
if(help == argv[i])
{
VSOMEIP_INFO << "Parameters:\n"
- << "--help: print this help";
+ << "--help: print this help\n"
+ << "--do-not-check-payload: Don't verify payload data "
+ << "-> Use this flag for performance measurements!";
+ } else if (check == argv[i]) {
+ check_payload = false;
}
i++;
}
diff --git a/test/payload_tests/payload_test_service.hpp b/test/payload_tests/payload_test_service.hpp
index 4255fc3..b272e66 100644
--- a/test/payload_tests/payload_test_service.hpp
+++ b/test/payload_tests/payload_test_service.hpp
@@ -26,7 +26,7 @@ public:
void offer();
void stop_offer();
void join_offer_thread();
- void on_event(vsomeip::event_type_e _event);
+ void on_state(vsomeip::state_type_e _state);
void on_message(const std::shared_ptr<vsomeip::message> &_request);
void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request);
void run();
diff --git a/test/payload_tests/stopwatch.cpp b/test/payload_tests/stopwatch.cpp
index 13701a3..4911f1c 100644
--- a/test/payload_tests/stopwatch.cpp
+++ b/test/payload_tests/stopwatch.cpp
@@ -14,23 +14,25 @@
stop_watch::usec_t stop_watch::get_total_elapsed_microseconds() const {
- usec_t elapsed = total_elapsed_;
+ usec_t elapsed = total_elapsed_;
- if (started_)
- elapsed += get_elapsed();
+ if (started_)
+ elapsed += get_elapsed();
- return elapsed;
+ return elapsed;
}
stop_watch::usec_t stop_watch::get_total_elapsed_seconds() const {
- return get_total_elapsed_microseconds() / USEC_PER_SEC;
+ return get_total_elapsed_microseconds() / USEC_PER_SEC;
}
stop_watch::usec_t stop_watch::now() {
- struct timespec ts;
+ struct timespec ts;
- assert(!clock_gettime(CLOCK_MONOTONIC_RAW, &ts));
+ const int ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
+ assert(!ret);
+ static_cast<void>(ret); // prevent warning in release build
- return (usec_t) ts.tv_sec * USEC_PER_SEC + (usec_t) ts.tv_nsec / NSEC_PER_USEC;
+ return (usec_t) ts.tv_sec * USEC_PER_SEC + (usec_t) ts.tv_nsec / NSEC_PER_USEC;
}
diff --git a/test/payload_tests/stopwatch.hpp b/test/payload_tests/stopwatch.hpp
index fa6bbe8..0cdc078 100644
--- a/test/payload_tests/stopwatch.hpp
+++ b/test/payload_tests/stopwatch.hpp
@@ -16,8 +16,8 @@ public:
stop_watch() :
started_(false),
- total_elapsed_(0),
- start_time_point_(0)
+ start_time_point_(0),
+ total_elapsed_(0)
{
}
diff --git a/test/readme.txt b/test/readme.txt
index 3aa1da0..ab643e5 100644
--- a/test/readme.txt
+++ b/test/readme.txt
@@ -52,6 +52,20 @@ The expected output is:
2015-02-10 08:47:31.517106 [info] Test "SERVICE DISCOVERY PORT" succeeded.
+Application test
+----------------
+
+This test tests starting and stopping a vsomeip application in various ways.
+
+Automatic start from build directory:
+
+ctest -V -R application_test
+
+Manual start from sub folder test of build directory:
+
+./application_test_starter.sh
+
+
Magic Cookies Test
------------------
To run the magic cookies test you need two devices on the same network. The network addresses within
@@ -59,13 +73,18 @@ the configuration files need to be adapted to match the devices addresses.
To start the magic-cookies-test from the build-directory do:
-HOST1:
-env VSOMEIP_CONFIGURATION_FILE=../config/vsomeip-magic-cookies-client.json \
-VSOMEIP_APPLICATION_NAME=client-sample ./magic-cookies-test-client
+Automatic start from build directory:
+
+ctest -V -R magic_cookies_test
+
+Manual start from sub folder test of build directory:
+
+# On external host run
+./magic_cookies_test_service_start.sh
+
+# On local host run
+./magic_cookies_test_client_start.sh
-HOST2:
-env VSOMEIP_CONFIGURATION_FILE=../config/vsomeip-magic-cookies-service.json \
-VSOMEIP_APPLICATION_NAME=service-sample ./response-sample --tcp --static-routing
The expected result is an output like this on service side:
@@ -247,10 +266,76 @@ cd test
./external_local_payload_test_service_client_external_start.sh &
# Start the local client
VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local \
-VSOMEIP_CONFIGURATION_FILE=external_local_payload_test_client_local.json \
+VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json \
./payload_test_client --dont-shutdown-service
# Start the external client after the local client is finished from an
# external host
./external_local_payload_test_client_external_start.sh
All tests should be marked as "passed".
+
+
+Big payload tests
+-----------------
+
+This test tests the possibility to increase the maximum allowed payload size for
+local and TCP messages via configuration file.
+
+The test will send a messages with 600k payload from a client to a service.
+The service will reply with a response containing 600k payload as well.
+This is repeated 10 times.
+There is a version for local and for TCP communication available.
+
+Automatic start from the build directory:
+
+ctest -V -R big_payload_test_local
+
+Manual start from sub folder test of build directory:
+
+./big_payload_test_service_local_start.sh &
+./big_payload_test_client_local_start.sh
+
+
+Automatic start of the TCP version from the build directory:
+
+ctest -V -R big_payload_test_external
+
+Manual start from sub folder test of build directory:
+
+./big_payload_test_client_start.sh
+
+# On external host run
+./big_payload_test_service_external_start.sh
+
+
+Client ID tests
+---------------
+
+This tests tests communication over two nodes with multiple services on both
+nodes.
+
+The test setup is as followed:
+* There are five services with one method each.
+* Two of the services run on node 1.
+* Three of the services run on node 2.
+* Each of the services sends ten requests to the other services and waits
+ until it received a response for every request.
+* If all responses have been received, the service shutdown.
+
+Automatic start from the build directory:
+
+ctest -V -R client_id_test_diff_client_ids_diff_ports
+
+Manual start from sub folder test of build directory:
+
+./client_id_test_master_starter.sh client_id_test_diff_client_ids_diff_ports_master.json
+
+Second version where all services on one node use the same port:
+
+Automatic start from the build directory:
+
+ctest -V -R client_id_test_diff_client_ids_same_ports
+
+Manual start from sub folder test of build directory:
+
+./client_id_test_master_starter.sh client_id_test_diff_client_ids_same_ports_master.json
diff --git a/test/routing_tests/external_local_routing_test_client_external.json b/test/routing_tests/conf/external_local_routing_test_client_external.json.in
index fb33ae8..3633538 100644
--- a/test/routing_tests/external_local_routing_test_client_external.json
+++ b/test/routing_tests/conf/external_local_routing_test_client_external.json.in
@@ -1,5 +1,5 @@
{
- "unicast" : "172.16.100.131",
+ "unicast" : "@TEST_IP_SLAVE@",
"netmask" : "255.255.255.0",
"logging" :
{
@@ -22,19 +22,13 @@
}
],
- "servicegroups" :
+ "services" :
[
{
- "name" : "remote",
- "unicast" : "134.86.56.183",
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509"
- }
- ]
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "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
new file mode 100644
index 0000000..0ef1f77
--- /dev/null
+++ b/test/routing_tests/conf/external_local_routing_test_service.json.in
@@ -0,0 +1,41 @@
+{
+ "unicast" : "@TEST_IP_MASTER@",
+ "logging" :
+ {
+ "level" : "debug",
+ "console" : "true",
+ "file" :
+ {
+ "enable" : "false",
+ "path" : "/tmp/vsomeip.log"
+ },
+
+ "dlt" : "false"
+ },
+
+ "applications" :
+ [
+ {
+ "name" : "external_local_routing_test_service",
+ "id" : "0x1277"
+ }
+ ],
+
+ "services" :
+ [
+ {
+ "service" : "0x1234",
+ "instance" : "0x5678",
+ "unreliable" : "30509"
+ }
+ ],
+
+ "routing" : "external_local_routing_test_service",
+ "service-discovery" :
+ {
+ "enable" : "false",
+ "multicast" : "224.0.0.1",
+ "port" : "30490",
+ "protocol" : "udp"
+ }
+}
diff --git a/test/routing_tests/external_local_routing_test_client_external_start.sh b/test/routing_tests/external_local_routing_test_client_external_start.sh
index 44b5187..a40dece 100755
--- a/test/routing_tests/external_local_routing_test_client_external_start.sh
+++ b/test/routing_tests/external_local_routing_test_client_external_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=external_local_routing_test_client_external
-export VSOMEIP_CONFIGURATION_FILE=external_local_routing_test_client_external.json
+export VSOMEIP_CONFIGURATION=external_local_routing_test_client_external.json
./local_routing_test_client
diff --git a/test/routing_tests/external_local_routing_test_service.cpp b/test/routing_tests/external_local_routing_test_service.cpp
index 2553898..72899fd 100644
--- a/test/routing_tests/external_local_routing_test_service.cpp
+++ b/test/routing_tests/external_local_routing_test_service.cpp
@@ -9,11 +9,11 @@
external_local_routing_test_service::external_local_routing_test_service(bool _use_static_routing) :
app_(vsomeip::runtime::get()->create_application()),
is_registered_(false),
- blocked_(false),
use_static_routing_(_use_static_routing),
- offer_thread_(std::bind(&external_local_routing_test_service::run, this)),
+ blocked_(false),
number_received_messages_local_(0),
- number_received_messages_external_(0)
+ number_received_messages_external_(0),
+ offer_thread_(std::bind(&external_local_routing_test_service::run, this))
{
}
@@ -32,8 +32,8 @@ void external_local_routing_test_service::init()
std::bind(&external_local_routing_test_service::on_message, this,
std::placeholders::_1));
- app_->register_event_handler(
- std::bind(&external_local_routing_test_service::on_event, this,
+ app_->register_state_handler(
+ std::bind(&external_local_routing_test_service::on_state, this,
std::placeholders::_1));
VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF");
@@ -50,7 +50,7 @@ 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_event_handler();
+ app_->unregister_state_handler();
app_->stop();
}
@@ -69,16 +69,17 @@ void external_local_routing_test_service::stop_offer()
app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
}
-void external_local_routing_test_service::on_event(vsomeip::event_type_e _event)
+void external_local_routing_test_service::on_state(vsomeip::state_type_e _state)
{
VSOMEIP_INFO << "Application " << app_->get_name() << " is "
- << (_event == vsomeip::event_type_e::ET_REGISTERED ? "registered." :
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ? "registered." :
"deregistered.");
- if(_event == vsomeip::event_type_e::ET_REGISTERED)
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
{
if(!is_registered_)
{
+ std::lock_guard<std::mutex> its_lock(mutex_);
is_registered_ = true;
blocked_ = true;
// "start" the run method thread
diff --git a/test/routing_tests/external_local_routing_test_service.hpp b/test/routing_tests/external_local_routing_test_service.hpp
index d5b767e..82f6220 100644
--- a/test/routing_tests/external_local_routing_test_service.hpp
+++ b/test/routing_tests/external_local_routing_test_service.hpp
@@ -27,7 +27,7 @@ public:
void offer();
void stop_offer();
void join_offer_thread();
- void on_event(vsomeip::event_type_e _event);
+ void on_state(vsomeip::state_type_e _state);
void on_message(const std::shared_ptr<vsomeip::message> &_request);
void run();
@@ -36,12 +36,12 @@ private:
bool is_registered_;
bool use_static_routing_;
- std::thread offer_thread_;
std::mutex mutex_;
std::condition_variable condition_;
bool blocked_;
std::uint32_t number_received_messages_local_;
std::uint32_t number_received_messages_external_;
+ std::thread offer_thread_;
};
#endif /* EXTERNALLOCALROUTINGTESTSERVICE_HPP_ */
diff --git a/test/routing_tests/external_local_routing_test_service.json b/test/routing_tests/external_local_routing_test_service.json
deleted file mode 100644
index d48a33a..0000000
--- a/test/routing_tests/external_local_routing_test_service.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "unicast" : "134.86.56.183",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "external_local_routing_test_service",
- "id" : "0x1277"
- }
- ],
-
- "servicegroups" :
- [
- {
- "name" : "default",
- "unicast" : "local",
- "delays" :
- {
- "initial" :
- {
- "minimum" : "10",
- "maximum" : "100"
- },
-
- "repetition-base" : "200",
- "repetition-max" : "3",
- "cyclic-offer" : "2000",
- "cyclic-request" : "2001"
- },
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509"
- }
- ]
- }
- ],
-
- "routing" : "external_local_routing_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-} \ No newline at end of file
diff --git a/test/routing_tests/external_local_routing_test_service_start.sh b/test/routing_tests/external_local_routing_test_service_start.sh
index b28b6cf..e6ac677 100755
--- a/test/routing_tests/external_local_routing_test_service_start.sh
+++ b/test/routing_tests/external_local_routing_test_service_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=external_local_routing_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_routing_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_routing_test_service.json
./external_local_routing_test_service
diff --git a/test/routing_tests/external_local_routing_test_starter.sh b/test/routing_tests/external_local_routing_test_starter.sh
index dc0a2c3..abee34d 100755
--- a/test/routing_tests/external_local_routing_test_starter.sh
+++ b/test/routing_tests/external_local_routing_test_starter.sh
@@ -49,7 +49,7 @@ check_tcp_udp_sockets_are_closed ()
# Start the service
export VSOMEIP_APPLICATION_NAME=external_local_routing_test_service
-export VSOMEIP_CONFIGURATION_FILE=external_local_routing_test_service.json
+export VSOMEIP_CONFIGURATION=external_local_routing_test_service.json
./external_local_routing_test_service &
SERIVCE_PID=$!
sleep 1;
@@ -59,7 +59,7 @@ check_tcp_udp_sockets_are_open $SERIVCE_PID
# Start the client (we reuse the one from the local_routing_test to check
# the local routing functionality).
export VSOMEIP_APPLICATION_NAME=local_routing_test_client
-export VSOMEIP_CONFIGURATION_FILE=local_routing_test_client.json
+export VSOMEIP_CONFIGURATION=local_routing_test_client.json
./local_routing_test_client &
CLIENT_PID=$!
diff --git a/test/routing_tests/local_routing_test_client.cpp b/test/routing_tests/local_routing_test_client.cpp
index a9a11f5..0659e48 100644
--- a/test/routing_tests/local_routing_test_client.cpp
+++ b/test/routing_tests/local_routing_test_client.cpp
@@ -8,13 +8,13 @@
local_routing_test_client::local_routing_test_client(bool _use_tcp) :
app_(vsomeip::runtime::get()->create_application()),
request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- sender_(std::bind(&local_routing_test_client::run, this)),
running_(true),
blocked_(false),
is_available_(false),
number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND),
number_of_sent_messages_(0),
- number_of_acknowledged_messages_(0)
+ number_of_acknowledged_messages_(0),
+ sender_(std::bind(&local_routing_test_client::run, this))
{
}
@@ -22,24 +22,20 @@ void local_routing_test_client::init()
{
app_->init();
- app_->register_event_handler(
- std::bind(&local_routing_test_client::on_event, this,
+ app_->register_state_handler(
+ std::bind(&local_routing_test_client::on_state, this,
std::placeholders::_1));
- app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- std::bind(&local_routing_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
app_->register_message_handler(vsomeip::ANY_SERVICE,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD,
std::bind(&local_routing_test_client::on_message, this,
std::placeholders::_1));
- request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
- request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- request_->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
+ app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
+ vsomeip_test::TEST_SERVICE_INSTANCE_ID,
+ std::bind(&local_routing_test_client::on_availability, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3));
}
void local_routing_test_client::start()
@@ -53,7 +49,7 @@ 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_event_handler();
+ app_->unregister_state_handler();
app_->unregister_message_handler(vsomeip::ANY_SERVICE,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD);
@@ -66,9 +62,9 @@ void local_routing_test_client::join_sender_thread(){
ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
}
-void local_routing_test_client::on_event(vsomeip::event_type_e _event)
+void local_routing_test_client::on_state(vsomeip::state_type_e _state)
{
- if(_event == vsomeip::event_type_e::ET_REGISTERED)
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
{
app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
vsomeip_test::TEST_SERVICE_INSTANCE_ID, false);
@@ -107,6 +103,11 @@ void local_routing_test_client::on_message(const std::shared_ptr<vsomeip::messag
<< _response->get_client() << "/" << std::setw(4)
<< std::setfill('0') << std::hex << _response->get_session() << "]";
number_of_acknowledged_messages_++;
+ if(number_of_acknowledged_messages_ == number_of_messages_to_send_) {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ = true;
+ condition_.notify_one();
+ }
}
void local_routing_test_client::send()
@@ -123,8 +124,12 @@ void local_routing_test_client::run()
{
condition_.wait(its_lock);
}
+ blocked_ = false;
+ request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
+ request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
+ request_->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID);
- for (int i = 0; i < number_of_messages_to_send_; i++)
+ for (uint32_t i = 0; i < number_of_messages_to_send_; i++)
{
app_->send(request_, true);
VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0')
@@ -137,18 +142,15 @@ void local_routing_test_client::run()
number_of_sent_messages_++;
}
blocked_ = false;
- // wait until all send messages have been acknowledged, but a maximum of 5 sec.
- int cnt = 0;
- while (number_of_acknowledged_messages_ != number_of_messages_to_send_
- && cnt < 5)
+ // wait until all messages have been acknowledged
+ while (!blocked_)
{
- std::this_thread::sleep_for(std::chrono::seconds(1));
- cnt++;
+ condition_.wait(its_lock);
}
stop();
}
-TEST(someip_header_factory_test, send_ten_messages_over_local_uds_socket)
+TEST(someip_local_routing_test, send_ten_messages_to_service_and_receive_reply)
{
bool use_tcp = false;
local_routing_test_client test_client_(use_tcp);
diff --git a/test/routing_tests/local_routing_test_client.hpp b/test/routing_tests/local_routing_test_client.hpp
index 1eedc8a..311b6eb 100644
--- a/test/routing_tests/local_routing_test_client.hpp
+++ b/test/routing_tests/local_routing_test_client.hpp
@@ -25,7 +25,7 @@ public:
void start();
void stop();
void join_sender_thread();
- void on_event(vsomeip::event_type_e _event);
+ void on_state(vsomeip::state_type_e _state);
void on_availability(vsomeip::service_t _service,
vsomeip::instance_t _instance, bool _is_available);
void on_message(const std::shared_ptr<vsomeip::message> &_response);
@@ -37,13 +37,13 @@ private:
std::shared_ptr<vsomeip::message> request_;
std::mutex mutex_;
std::condition_variable condition_;
- std::thread sender_;
bool running_;
bool blocked_;
bool is_available_;
std::uint32_t number_of_messages_to_send_;
std::uint32_t number_of_sent_messages_;
std::uint32_t number_of_acknowledged_messages_;
+ std::thread sender_;
};
#endif /* LOCALROUTINGTESTCLIENT_HPP_ */
diff --git a/test/routing_tests/local_routing_test_client.json b/test/routing_tests/local_routing_test_client.json
index fa8d46a..a5991c2 100644
--- a/test/routing_tests/local_routing_test_client.json
+++ b/test/routing_tests/local_routing_test_client.json
@@ -22,16 +22,8 @@
}
],
- "servicegroups" :
+ "services" :
[
- {
- "name" : "remote",
- "unicast" : "127.0.0.1",
- "services" :
- [
-
- ]
- }
],
"routing" : "local_routing_test_service",
diff --git a/test/routing_tests/local_routing_test_client_start.sh b/test/routing_tests/local_routing_test_client_start.sh
index ebe1bf9..1c9cad9 100755
--- a/test/routing_tests/local_routing_test_client_start.sh
+++ b/test/routing_tests/local_routing_test_client_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=local_routing_test_client
-export VSOMEIP_CONFIGURATION_FILE=local_routing_test_client.json
+export VSOMEIP_CONFIGURATION=local_routing_test_client.json
./local_routing_test_client
diff --git a/test/routing_tests/local_routing_test_service.cpp b/test/routing_tests/local_routing_test_service.cpp
index 36dbe72..7e04f01 100644
--- a/test/routing_tests/local_routing_test_service.cpp
+++ b/test/routing_tests/local_routing_test_service.cpp
@@ -8,10 +8,10 @@
local_routing_test_service::local_routing_test_service(bool _use_static_routing) :
app_(vsomeip::runtime::get()->create_application()),
is_registered_(false),
- blocked_(false),
use_static_routing_(_use_static_routing),
- offer_thread_(std::bind(&local_routing_test_service::run, this)),
- number_of_received_messages_(0)
+ blocked_(false),
+ number_of_received_messages_(0),
+ offer_thread_(std::bind(&local_routing_test_service::run, this))
{
}
@@ -25,8 +25,8 @@ void local_routing_test_service::init()
std::bind(&local_routing_test_service::on_message, this,
std::placeholders::_1));
- app_->register_event_handler(
- std::bind(&local_routing_test_service::on_event, this,
+ app_->register_state_handler(
+ std::bind(&local_routing_test_service::on_state, this,
std::placeholders::_1));
VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF");
@@ -43,7 +43,7 @@ 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_event_handler();
+ app_->unregister_state_handler();
app_->stop();
}
@@ -62,17 +62,18 @@ void local_routing_test_service::stop_offer()
app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
}
-void local_routing_test_service::on_event(vsomeip::event_type_e _event)
+void local_routing_test_service::on_state(vsomeip::state_type_e _state)
{
VSOMEIP_INFO << "Application " << app_->get_name() << " is "
- << (_event == vsomeip::event_type_e::ET_REGISTERED ? "registered." :
+ << (_state == vsomeip::state_type_e::ST_REGISTERED ? "registered." :
"deregistered.");
- if(_event == vsomeip::event_type_e::ET_REGISTERED)
+ if(_state == vsomeip::state_type_e::ST_REGISTERED)
{
if(!is_registered_)
{
is_registered_ = true;
+ std::lock_guard<std::mutex> its_lock(mutex_);
blocked_ = true;
// "start" the run method thread
condition_.notify_one();
@@ -118,7 +119,9 @@ void local_routing_test_service::on_message(const std::shared_ptr<vsomeip::messa
if(number_of_received_messages_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND)
{
- app_->stop();
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ blocked_ =true;
+ condition_.notify_one();
}
ASSERT_LT(number_of_received_messages_,
vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1);
@@ -130,10 +133,17 @@ void local_routing_test_service::run()
while (!blocked_)
condition_.wait(its_lock);
+ blocked_ = false;
if(use_static_routing_)
{
offer();
}
+ while (!blocked_)
+ condition_.wait(its_lock);
+
+ std::thread t2([](){ usleep(1000000 * 5);});
+ t2.join();
+ app_->stop();
}
TEST(someip_local_routing_test, receive_ten_messages_over_local_uds_socket)
diff --git a/test/routing_tests/local_routing_test_service.hpp b/test/routing_tests/local_routing_test_service.hpp
index 8ee00b4..8cd4fb9 100644
--- a/test/routing_tests/local_routing_test_service.hpp
+++ b/test/routing_tests/local_routing_test_service.hpp
@@ -26,7 +26,7 @@ public:
void offer();
void stop_offer();
void join_offer_thread();
- void on_event(vsomeip::event_type_e _event);
+ void on_state(vsomeip::state_type_e _state);
void on_message(const std::shared_ptr<vsomeip::message> &_request);
void run();
@@ -35,11 +35,11 @@ private:
bool is_registered_;
bool use_static_routing_;
- std::thread offer_thread_;
- std::mutex mutex_;
- std::condition_variable condition_;
bool blocked_;
std::uint32_t number_of_received_messages_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+ std::thread offer_thread_;
};
#endif /* LOCALROUTINGTESTSERVICE_HPP_ */
diff --git a/test/routing_tests/local_routing_test_service.json b/test/routing_tests/local_routing_test_service.json
index 6726f0e..528074f 100644
--- a/test/routing_tests/local_routing_test_service.json
+++ b/test/routing_tests/local_routing_test_service.json
@@ -1,5 +1,5 @@
{
- "unicast" : "134.86.56.183",
+ "unicast" : "127.0.0.1",
"logging" :
{
"level" : "debug",
@@ -21,32 +21,11 @@
}
],
- "servicegroups" :
+ "services" :
[
{
- "name" : "default",
- "unicast" : "local",
- "delays" :
- {
- "initial" :
- {
- "minimum" : "10",
- "maximum" : "100"
- },
-
- "repetition-base" : "200",
- "repetition-max" : "3",
- "cyclic-offer" : "2000",
- "cyclic-request" : "2001"
- },
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
+ "service" : "0x1234",
+ "instance" : "0x5678"
}
],
@@ -58,4 +37,4 @@
"port" : "30490",
"protocol" : "udp"
}
-} \ No newline at end of file
+}
diff --git a/test/routing_tests/local_routing_test_service_start.sh b/test/routing_tests/local_routing_test_service_start.sh
index fef108e..acafd51 100755
--- a/test/routing_tests/local_routing_test_service_start.sh
+++ b/test/routing_tests/local_routing_test_service_start.sh
@@ -5,5 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export VSOMEIP_APPLICATION_NAME=local_routing_test_service
-export VSOMEIP_CONFIGURATION_FILE=local_routing_test_service.json
+export VSOMEIP_CONFIGURATION=local_routing_test_service.json
./local_routing_test_service
diff --git a/test/routing_tests/local_routing_test_starter.sh b/test/routing_tests/local_routing_test_starter.sh
index 6c803b9..97bd67d 100755
--- a/test/routing_tests/local_routing_test_starter.sh
+++ b/test/routing_tests/local_routing_test_starter.sh
@@ -35,7 +35,7 @@ check_tcp_udp_sockets_are_closed ()
# Start the service
export VSOMEIP_APPLICATION_NAME=local_routing_test_service
-export VSOMEIP_CONFIGURATION_FILE=local_routing_test_service.json
+export VSOMEIP_CONFIGURATION=local_routing_test_service.json
./local_routing_test_service &
SERIVCE_PID=$!
sleep 1;
@@ -44,7 +44,7 @@ check_tcp_udp_sockets_are_closed $SERIVCE_PID
# Start the client
export VSOMEIP_APPLICATION_NAME=local_routing_test_client
-export VSOMEIP_CONFIGURATION_FILE=local_routing_test_client.json
+export VSOMEIP_CONFIGURATION=local_routing_test_client.json
./local_routing_test_client &
CLIENT_PID=$!
diff --git a/test/someip_test_globals.hpp b/test/someip_test_globals.hpp
index 99cbe3f..d95e7de 100644
--- a/test/someip_test_globals.hpp
+++ b/test/someip_test_globals.hpp
@@ -8,6 +8,8 @@
#include <vsomeip/vsomeip.hpp>
+#include "../implementation/logging/include/logger.hpp"
+
namespace vsomeip_test
{