diff options
author | Herasym Oleh <oolleehh@gmail.com> | 2015-11-18 09:02:25 +0200 |
---|---|---|
committer | Herasym Oleh <oolleehh@gmail.com> | 2015-11-24 17:18:03 +0200 |
commit | 87777eea5c1a8e73158faa7a176081351f7183c2 (patch) | |
tree | 073944d47b21ff177e378459efb3a20c2d9e5809 /src/components/application_manager/test/CMakeLists.txt | |
parent | ccacde00bf555ec7298c2e6a4c1cca00ffe4fef3 (diff) | |
download | sdl_core-87777eea5c1a8e73158faa7a176081351f7183c2.tar.gz |
Implement_and_fixed_Unit_Tests_for_Application_Manager_in_GENIVI
Added missed test files to AM.
Deleted unused files.
Deleted application_state.cc application_state.h
Diffstat (limited to 'src/components/application_manager/test/CMakeLists.txt')
-rw-r--r-- | src/components/application_manager/test/CMakeLists.txt | 282 |
1 files changed, 129 insertions, 153 deletions
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt index d60b8531b9..338da41dba 100644 --- a/src/components/application_manager/test/CMakeLists.txt +++ b/src/components/application_manager/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015, Ford Motor Company +# Copyright (c) 2014, Ford Motor Company # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -31,24 +31,6 @@ # TODO{ALeshin}: APPLINK-10792. Do not write tests which use # application manager(AM) singleton while refactoring of AM is finished. -if (BUILD_TESTS) - include_directories( - ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/include - ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include - ${COMPONENTS_DIR}/application_manager/include/application_manager/policies - ) - - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/commands) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/commands/mobile) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/commands/hmi) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/event_engine) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/policies) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/policies/delegates) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/resumption) - file (GLOB_RECURSE AMINCLUDE_TO_BE_MOCKED ${AM_SOURCE_DIR}/include/application_manager/* @@ -64,147 +46,142 @@ if (BUILD_TESTS) ) ENDFOREACH(infileName) - ## Replace include for mocking singltone - get_property(the_include_dirs DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES) - set(class_to_mock ${CMAKE_SOURCE_DIR}/src/components/application_manager/include) - list(FIND the_include_dirs ${class_to_mock} find_idx) - if (find_idx GREATER -1) - LIST_REPLACE(the_include_dirs ${find_idx} ${AM_MOCK_DIR}/include) - endif() - set_property(DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES ${the_include_dirs}) - - include_directories( - ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/include - ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include - ${COMPONENTS_DIR}/application_manager/include/application_manager/policies - ${COMPONENTS_DIR}/application_manager/include/application_manager - ${COMPONENTS_DIR}/application_manager/include/application_manager/resumption - ${COMPONENTS_DIR}/application_manager/include/ - ${COMPONENTS_DIR}/utils/include/utils - ${COMPONENTS_DIR}/include/utils - ${COMPONENTS_DIR}/include/ - ${COMPONENTS_DIR}/policy/include/policy - ${COMPONENTS_DIR}/policy/test/include - ${COMPONENTS_DIR}/media_manager/include/ - ${SecurityManagerIncludeDir} - ${COMPONENTS_DIR}/security_manager/include - ${COMPONENTS_DIR}/security_manager/test/include - ) - - set(testSources - ${AM_TEST_DIR}/command_impl_test.cc +# Replace include for mocking singltone +get_property(the_include_dirs DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES) +set(class_to_mock ${CMAKE_SOURCE_DIR}/src/components/application_manager/include) +list(FIND the_include_dirs ${class_to_mock} find_idx) +if(find_idx GREATER -1) + LIST_REPLACE(the_include_dirs ${find_idx} ${AM_MOCK_DIR}/include) +endif() +set_property(DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES ${the_include_dirs}) + +include_directories( + ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/include + ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include + ${COMPONENTS_DIR}/application_manager/include/application_manager/ + ${COMPONENTS_DIR}/application_manager/include/application_manager/policies + ${COMPONENTS_DIR}/application_manager/include/application_manager/resumption + ${COMPONENTS_DIR}/application_manager/include/ + ${COMPONENTS_DIR}/utils/include/utils/ + ${COMPONENTS_DIR}/policy/test/include/ + ${COMPONENTS_DIR}/security_manager/test/include/ + ${COMPONENTS_DIR}/security_manager/include/ + ${COMPONENTS_DIR}/include/utils/ + ${COMPONENTS_DIR}/application_manager/test/resumption/include/ + ${COMPONENTS_DIR} +) + +set(testSources ${AM_TEST_DIR}/mobile_message_handler_test.cc + ${AM_TEST_DIR}/mobile_message_handler_v1_test.cc ${AM_TEST_DIR}/request_info_test.cc ${AM_TEST_DIR}/resumption_sql_queries_test.cc - ${AM_TEST_DIR}/hmi_capabilities_test.cc -# ${AM_TEST_DIR}/policy_handler_test.cc -# ${AM_TEST_DIR}/event_engine_test.cc -# ${AM_TEST_DIR}/policy_event_observer_test.cc -# ${AM_TEST_DIR}/application_impl_test.cc - ) - - set(mockedSources ${AM_MOCK_DIR}/src/application_manager_impl.cc) - - set(AM_SOURCES - - ${AM_SOURCE_DIR}/src/policies/policy_handler.cc - ${AM_SOURCE_DIR}/src/policies/policy_event_observer.cc - ${AM_SOURCE_DIR}/src/policies/delegates/app_permission_delegate.cc - ${AM_SOURCE_DIR}/src/policies/delegates/statistics_delegate.cc - - ${AM_SOURCE_DIR}/src/event_engine/event_dispatcher.cc - ${AM_SOURCE_DIR}/src/event_engine/event_observer.cc - ${AM_SOURCE_DIR}/src/event_engine/event.cc - - ${AM_SOURCE_DIR}/src/commands/command_impl.cc - ${AM_SOURCE_DIR}/src/commands/command_request_impl.cc - ${AM_SOURCE_DIR}/src/commands/command_response_impl.cc - ${AM_SOURCE_DIR}/src/commands/command_notification_impl.cc - ${AM_SOURCE_DIR}/src/commands/command_notification_from_mobile_impl.cc - ${AM_SOURCE_DIR}/src/commands/pending.cc - - ${AM_SOURCE_DIR}/src/resumption/resume_ctrl.cc - ${AM_SOURCE_DIR}/src/resumption/resumption_data_db.cc - ${AM_SOURCE_DIR}/src/resumption/resumption_data_json.cc - ${AM_SOURCE_DIR}/src/resumption/resumption_data.cc - ${AM_SOURCE_DIR}/src/resumption/resumption_sql_queries.cc - - ${AM_SOURCE_DIR}/src/usage_statistics.cc - ${AM_SOURCE_DIR}/src/request_info.cc - ${AM_SOURCE_DIR}/src/message.cc - ${AM_SOURCE_DIR}/src/application_impl.cc - ${AM_SOURCE_DIR}/src/state_controller.cc - ${AM_SOURCE_DIR}/src/mobile_command_factory.cc - ${AM_SOURCE_DIR}/test/mock_message_helper.cc - - ${AM_SOURCE_DIR}/src/hmi_command_factory.cc - ${AM_SOURCE_DIR}/src/hmi_state.cc - - ${AM_SOURCE_DIR}/src/hmi_capabilities.cc - ${AM_SOURCE_DIR}/src/application_data_impl.cc - ${AM_SOURCE_DIR}/src/request_controller.cc - ${AM_SOURCE_DIR}/src/state_context.cc - - ${AM_SOURCE_DIR}/src/commands/mobile/register_app_interface_request.cc - ${AM_SOURCE_DIR}/src/commands/mobile/unregister_app_interface_request.cc - - ${AM_SOURCE_DIR}/src/mobile_message_handler.cc - ${AM_SOURCE_DIR}/src/commands/mobile/put_file_request.cc - ${AM_SOURCE_DIR}/src/commands/command_request_impl.cc - ) - + ${AM_TEST_DIR}/event_engine_test.cc +) + +set(mockedSources + ${AM_MOCK_DIR}/src/application_manager_impl.cc +) + +set(AM_SOURCES + ${AM_SOURCE_DIR}/src/policies/policy_handler.cc + ${AM_SOURCE_DIR}/src/policies/policy_event_observer.cc + + ${AM_SOURCE_DIR}/src/commands/command_impl.cc + ${AM_SOURCE_DIR}/src/commands/command_request_impl.cc + ${AM_SOURCE_DIR}/src/commands/command_response_impl.cc + ${AM_SOURCE_DIR}/src/commands/command_notification_impl.cc + ${AM_SOURCE_DIR}/src/commands/command_notification_from_mobile_impl.cc + ${AM_SOURCE_DIR}/src/commands/pending.cc + + ${AM_SOURCE_DIR}/src/usage_statistics.cc + ${AM_SOURCE_DIR}/src/request_info.cc + ${AM_SOURCE_DIR}/src/message.cc + ${AM_SOURCE_DIR}/src/application_impl.cc + ${AM_SOURCE_DIR}/src/state_controller.cc + ${AM_SOURCE_DIR}/src/mobile_command_factory.cc + ${AM_SOURCE_DIR}/src/message_helper.cc + ${AM_SOURCE_DIR}/src/hmi_command_factory.cc + ${AM_SOURCE_DIR}/src/hmi_capabilities.cc + ${AM_SOURCE_DIR}/src/application_data_impl.cc + ${AM_SOURCE_DIR}/src/request_controller.cc + ${AM_SOURCE_DIR}/src/resumption/resume_ctrl.cc + ${AM_SOURCE_DIR}/src/mobile_message_handler.cc +) include_directories( - ${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct + ${AM_SOURCE_DIR}/policy/src/policy/policy_table/table_struct ) +set(testLibraries + Utils + dbms + jsoncpp + Policy + connectionHandler + HMI_API + MOBILE_API + v4_protocol_v1_2_no_extra + SmartObjects + formatters + gmock_main + UsageStatistics + dl + ProtocolLibrary + ConfigProfile + MediaManager + Resumption + ProtocolHandler + SecurityManager +) + +set(test_exec_libraries + HMI_API + MOBILE_API + v4_protocol_v1_2_no_extra + SmartObjects + formatters + ProtocolHandler + connectionHandler + HMIMessageHandler + Utils + jsoncpp + ConfigProfile + MediaManager + Resumption +) + +IF(${CMAKE_SYSTEM_NAME} MATCHES "QNX") + list(REMOVE_ITEM test_exec_libraries dl) +endif() - set(testLibraries - Utils - ApplicationManagerTest - jsoncpp - Policy - connectionHandler - HMI_API - MOBILE_API - v4_protocol_v1_2_no_extra - SmartObjects - formatters - gmock_main - UsageStatistics - dl - ProtocolLibrary - ConfigProfile - MediaManager - Resumption - ProtocolHandler - SecurityManager - ) - - if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") - list(REMOVE_ITEM test_exec_libraries dl) - endif() - - if (ENABLE_LOG) - list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) - list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) - list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) - list(APPEND LIBRARIES expat -L${EXPAT_LIBS_DIRECTORY}) - endif() - - file(COPY smartDeviceLink_test2.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY libPolicy.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +if(ENABLE_LOG) + list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) + list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) + list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) + list(APPEND LIBRARIES expat -L${EXPAT_LIBS_DIRECTORY}) +endif() - set(CMAKE_EXE_LINKER_FLAGS - "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR}") - add_library("ApplicationManagerTest" ${AM_SOURCES}) - create_test("application_manager_test" "${testSources}" "${testLibraries}" ) +add_library("ApplicationManagerTest" ${mockedSources} ${testSources}) + +target_link_libraries("ApplicationManagerTest" ${testLibraries} AMHMICommandsLibrary + AMMobileCommandsLibrary + AMEventEngine + AMPolicyLibrary) + +create_test("application_manager_test" "${testSources}" "${ApplicationManagerTest}") +target_link_libraries("application_manager_test" + ApplicationManagerTest ${test_exec_libraries} + ApplicationManager + ProtocolLibrary + connectionHandler + ConfigProfile + jsoncpp + MediaManager + ProtocolHandler + Resumption +) set(ResumptionData_SOURCES - ${AM_TEST_DIR}/resumption/resumption_data_test.cc - ${AM_TEST_DIR}/resumption/resumption_data_db_test.cc - ${AM_TEST_DIR}/resumption/resumption_data_json_test.cc - ${AM_TEST_DIR}/resumption/resume_ctrl_test.cc + #${AM_TEST_DIR}/resumption/resumption_data_test.cc ) file(COPY hmi_capabilities.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) @@ -212,5 +189,4 @@ if (BUILD_TESTS) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resumption) file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/resumption) -# create_test("resumption/data_resumption_test" "${ResumptionData_SOURCES}" "${testLibraries}") -endif() + create_test("resumption/data_resumption_test" "${ResumptionData_SOURCES}" "${testLibraries}") |