summaryrefslogtreecommitdiff
path: root/NodeStateMachineTest
diff options
context:
space:
mode:
Diffstat (limited to 'NodeStateMachineTest')
-rw-r--r--NodeStateMachineTest/CMakeLists.txt78
-rw-r--r--NodeStateMachineTest/Makefile.am62
-rw-r--r--NodeStateMachineTest/NodeStateMachine.c306
-rw-r--r--NodeStateMachineTest/NodeStateMachine.h134
-rw-r--r--NodeStateMachineTest/NodeStateTest.c3609
-rw-r--r--NodeStateMachineTest/NodeStateTest_GENIVI.cpp1199
-rw-r--r--NodeStateMachineTest/NodeStateTest_STRESS.cpp143
-rw-r--r--NodeStateMachineTest/NodeStateTest_TIMEOUT.cpp833
-rw-r--r--NodeStateMachineTest/NodeStateTest_WATCHDOG.cpp95
-rw-r--r--NodeStateMachineTest/org.genivi.NodeStateMachineTest.xml37
-rwxr-xr-xNodeStateMachineTest/test/run_test.sh68
11 files changed, 2416 insertions, 4148 deletions
diff --git a/NodeStateMachineTest/CMakeLists.txt b/NodeStateMachineTest/CMakeLists.txt
new file mode 100644
index 0000000..42699b9
--- /dev/null
+++ b/NodeStateMachineTest/CMakeLists.txt
@@ -0,0 +1,78 @@
+#######################################################################################################################
+#
+# Copyright (C) 2020 Mentor Graphics (Deutschland) GmbH
+#
+# Author: Vignesh_Rajendran@mentor.com
+#
+# CMake file of NodeStateMachineTest
+#
+# 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/.
+#
+#######################################################################################################################
+
+cmake_minimum_required(VERSION 3.7.2 FATAL_ERROR)
+
+enable_testing()
+
+set(SOURCE_STRESS NodeStateTest_STRESS.cpp)
+set(SOURCE_TIMEOUT NodeStateTest_TIMEOUT.cpp)
+set(SOURCE_GENIVI NodeStateTest_GENIVI.cpp)
+set(SOURCE_WATCHDOG NodeStateTest_WATCHDOG.cpp ${CMAKE_SOURCE_DIR}/NodeStateManager/Watchdog.cpp)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
+set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed")
+
+# copy test script to binary dir
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/test/run_test.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/run_test.sh
+ COPYONLY
+)
+
+# stress test
+add_executable(nsm_test_stress ${SOURCE_STRESS})
+target_link_libraries(nsm_test_stress PRIVATE
+ ${COMMONAPI_LIBS}
+ ${DLT_LIBRARIES}
+ ${GTEST_LIBRARY}
+ org.genivi.nodestatemanager.commonapi.someip.proxy
+ pthread)
+add_test(NAME nsm_test_stress COMMAND bash -c "${CMAKE_CURRENT_BINARY_DIR}/run_test.sh ${CMAKE_CURRENT_BINARY_DIR}/nsm_test_stress")
+set_tests_properties(nsm_test_stress PROPERTIES TIMEOUT 15)
+
+# timeout test
+add_executable(nsm_test_timeout ${SOURCE_TIMEOUT})
+
+target_link_libraries(nsm_test_timeout PRIVATE
+ ${COMMONAPI_LIBS}
+ ${DLT_LIBRARIES}
+ ${GTEST_LIBRARY}
+ org.genivi.nodestatemanager.commonapi.someip.proxy
+ pthread)
+
+add_test(NAME nsm_test_timeout COMMAND bash -c "${CMAKE_CURRENT_BINARY_DIR}/run_test.sh ${CMAKE_CURRENT_BINARY_DIR}/nsm_test_timeout")
+set_tests_properties(nsm_test_timeout PROPERTIES TIMEOUT 40)
+
+# genivi test
+add_executable(nsm_test_genivi ${SOURCE_GENIVI})
+
+target_link_libraries(nsm_test_genivi PRIVATE
+ ${COMMONAPI_LIBS}
+ ${DLT_LIBRARIES}
+ ${GTEST_LIBRARY}
+ org.genivi.nodestatemanager.commonapi.someip.proxy
+ pthread)
+add_test(NAME nsm_test_genivi COMMAND bash -c "${CMAKE_CURRENT_BINARY_DIR}/run_test.sh ${CMAKE_CURRENT_BINARY_DIR}/nsm_test_genivi")
+set_tests_properties(nsm_test_genivi PROPERTIES TIMEOUT 40)
+
+# watchdog test
+add_executable(nsm_test_watchdog ${SOURCE_WATCHDOG})
+
+target_link_libraries(nsm_test_watchdog PRIVATE
+ ${DLT_LIBRARIES}
+ ${GTEST_LIBRARY}
+ pthread)
+add_test(NAME nsm_test_watchdog COMMAND bash -c "${CMAKE_CURRENT_BINARY_DIR}/run_test.sh ${CMAKE_CURRENT_BINARY_DIR}//nsm_test_watchdog")
+set_tests_properties(nsm_test_watchdog PROPERTIES TIMEOUT 15) \ No newline at end of file
diff --git a/NodeStateMachineTest/Makefile.am b/NodeStateMachineTest/Makefile.am
deleted file mode 100644
index a7a57e3..0000000
--- a/NodeStateMachineTest/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-#######################################################################################################################
-#
-# Copyright (C) 2012 Continental Automotive Systems, Inc.
-#
-# Author: Jean-Pierre.Bogler@continental-corporation.com
-#
-# Makefile template for the NodeStateTest executable and NodeStateMachineTest library.
-#
-# Process this file with automake to produce a Makefile.in.
-#
-# 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/.
-#
-# Date Author Reason
-# 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
-#
-#######################################################################################################################
-
-bin_PROGRAMS = NodeStateTest
-
-NodeStateTest_SOURCES = NodeStateTest.c
-
-nodist_NodeStateTest_SOURCES = NodeStateMachineTestApi.c \
- $(top_srcdir)/NodeStateAccess/generated/NodeStateConsumer.c \
- $(top_srcdir)/NodeStateAccess/generated/NodeStateLifecycleConsumer.c \
- $(top_srcdir)/NodeStateAccess/generated/NodeStateLifecycleControl.c
-
-NodeStateTest_CFLAGS = -I$(top_srcdir)/NodeStateManager \
- -I$(top_srcdir)/NodeStateAccess \
- -I$(top_srcdir)/NodeStateAccess/generated \
- $(GIO_CFLAGS) \
- $(GIO_UNIX_CFLAGS) \
- $(GLIB_CFLAGS) \
- $(GOBJECT_CFLAGS)
-
-NodeStateTest_LDADD = $(GIO_LIBS) \
- $(GIO_UNIX_LIBS) \
- $(GLIB_LIBS) \
- $(GOBJECT_LIBS)
-
-lib_LTLIBRARIES = libNodeStateMachineTest.la
-
-libNodeStateMachineTest_la_CFLAGS = -I../NodeStateManager \
- $(GIO_CFLAGS) \
- $(GIO_UNIX_CFLAGS) \
- $(GLIB_CFLAGS) \
- $(GOBJECT_CFLAGS)
-
-libNodeStateMachineTest_la_SOURCES = NodeStateMachine.c
-
-nodist_libNodeStateMachineTest_la_SOURCES = NodeStateMachineTestApi.c
-
-libNodeStateMachineTest_la_LDFLAGS = -avoid-version
-
-BUILT_SOURCES = NodeStateMachineTestApi.h
-
-CLEANFILES = NodeStateMachineTestApi.c \
- NodeStateMachineTestApi.h
-
-NodeStateMachineTestApi.c NodeStateMachineTestApi.h: org.genivi.NodeStateMachineTest.xml
- gdbus-codegen --interface-prefix com.contiautomotive.NodeStateMachineTest. --c-namespace NodeState --generate-c-code NodeStateMachineTestApi --annotate "com.contiautomotive.NodeStateMachineTest.Test.SetNsmData()[Data]" org.gtk.GDBus.C.ForceGVariant true --annotate "com.contiautomotive.NodeStateMachineTest.Test.GetNsmData()[DataIn]" org.gtk.GDBus.C.ForceGVariant true --annotate "com.contiautomotive.NodeStateMachineTest.Test.GetNsmData()[DataOut]" org.gtk.GDBus.C.ForceGVariant true $<
diff --git a/NodeStateMachineTest/NodeStateMachine.c b/NodeStateMachineTest/NodeStateMachine.c
deleted file mode 100644
index c3cf803..0000000
--- a/NodeStateMachineTest/NodeStateMachine.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/**********************************************************************************************************************
-*
-* Copyright (C) 2012 Continental Automotive Systems, Inc.
-*
-* Author: Jean-Pierre.Bogler@continental-corporation.com
-*
-* Implementation of the NodeStateMachineTest.
-*
-* The NodeStateMachineTest compiles to a shared object that is loaded by the NodeStateManager.
-* This special test version of the NodeStateMachine implements additonal functionality.
-* Beside of the internal interfaces that are directly called by the NSM, who links with the lib,
-* the test NodeStateMachine offers an own dbus interface!
-*
-* A test frame can use this dbus interface to stimulate the NSMC to make calls to the NSM.
-* The return values that the NSMC receives are passed back to the test frame, where it can be
-* checked if they are valid.
-*
-* 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/.
-*
-* Date Author Reason
-* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
-*
-**********************************************************************************************************************/
-
-
-/**********************************************************************************************************************
-*
-* Header includes
-*
-**********************************************************************************************************************/
-
-#include <gio/gio.h> /* Access dbus using glib */
-
-#include "NodeStateMachine.h" /* Own header file */
-#include "NodeStateTypes.h" /* Know the types of the NSM */
-#include "NodeStateManager.h" /* Access inhternal NSM interfaces */
-
-#include "NodeStateMachineTestApi.h" /* Dbus interface offered by NSMC */
-
-
-/**********************************************************************************************************************
-*
-* Local defines, macros, constants and type definitions.
-*
-**********************************************************************************************************************/
-
-/* There are currently no local defines, macros or types */
-
-
-/**********************************************************************************************************************
-*
-* Local variables
-*
-**********************************************************************************************************************/
-
-static NodeStateTest *TSTMSC__pTestMachine = NULL;
-static GDBusConnection *TSTMSC__pConnection = NULL;
-
-
-/**********************************************************************************************************************
-*
-* Prototypes for file local functions (see implementation for description)
-*
-**********************************************************************************************************************/
-
-static gboolean NSM__boOnHandleSetNsmData(NodeStateTest *pTestMachine,
- GDBusMethodInvocation *pInvocation,
- const gint i32DataType,
- GVariant *pData,
- const guint u32DataLen,
- gpointer pUserData);
-
-static gboolean NSM__boOnHandleGetNsmData(NodeStateTest *pTestMachine,
- GDBusMethodInvocation *pInvocation,
- const gint i32DataType,
- GVariant *DataIn,
- const guint u32DataLen,
- gpointer pUserData);
-
-static gboolean NSM__boOnHandleGetNsmInterfaceVersion(NodeStateTest *pTestMachine,
- GDBusMethodInvocation *pInvocation,
- gpointer pUserData);
-
-/**********************************************************************************************************************
-*
-* Local (static) functions
-*
-**********************************************************************************************************************/
-
-/**********************************************************************************************************************
-*
-* The function is called when a test frame wants to set data to the NSM via the NSMC.
-*
-* @param pTestMachine: NodeStateMachineTest object.
-* @param pInvocation: Invocation for this call.
-* @param i32DataType: DataType (possible valid values see NsmDataType_e)
-* @param pData: GVariant of type "ay". Includes an array of byte containing the data to be set.
-* @param u32DataLen: Length of the data, which is directly passed to the NSM. Can contain invalid values,
-* because it is not usef for the serialization of the content of pData.
-* @param pUserData: Opzional user data (not used).
-*
-* @return TRUE: Dbus message was handled.
-*
-**********************************************************************************************************************/
-static gboolean NSM__boOnHandleSetNsmData(NodeStateTest *pTestMachine,
- GDBusMethodInvocation *pInvocation,
- const gint i32DataType,
- GVariant *pData,
- const guint u32DataLen,
- gpointer pUserData)
-{
- /* Function local variables */
- guint u32ArraySize = 0; /* Children of pData */
- guint8 *au8Data = NULL; /* Pointer to byte array */
- guint u32ArrayIdx = 0; /* Index to loop through data */
- GVariant *pArrayElement = NULL; /* Pointer to child of pData */
- NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet;
- NsmDataType_e enDateType = (NsmDataType_e) i32DataType;
-
- /* Create a new byte array based on the length of pData and fill it with the values */
- u32ArraySize = g_variant_n_children(pData);
- au8Data = g_new(guint8, u32ArraySize);
-
- for(u32ArrayIdx = 0; u32ArrayIdx < u32ArraySize; u32ArrayIdx++)
- {
- pArrayElement = g_variant_get_child_value(pData, u32ArrayIdx);
- au8Data[u32ArrayIdx] = g_variant_get_byte(pArrayElement);
- g_variant_unref(pArrayElement);
- }
-
- g_variant_unref(pData); /* release the variant. We read it */
-
- /* Call the NSM. Pass extracted data and length, originally passed by test frame */
- enRetVal = NsmSetData(enDateType, (unsigned char*) au8Data, (unsigned int) u32DataLen);
-
- /* Send NSMs return value to the test frame */
- node_state_test_complete_set_nsm_data(pTestMachine, pInvocation, (gint) enRetVal);
-
- return TRUE;
-}
-
-/**********************************************************************************************************************
-*
-* The function is called when a test frame wants to get data from the NSM via the NSMC.
-*
-* @param pTestMachine: NodeStateMachineTest object.
-* @param pInvocation: Invocation for this call.
-* @param i32DataType: DataType (possible valid values see NsmDataType_e)
-* @param pDataIn: Parameters passed by test frame fopr getting data (currently only used for sesion states)
-* @param u32DataLen: Length of the expected data, which is directly passed to the NSM. Can contain invalid values,
-* because it is not used for the serialization of pDataOut.
-* @param pUserData: Opzional user data (not used).
-*
-* @return TRUE: Dbus message was handled.
-*
-**********************************************************************************************************************/
-static gboolean NSM__boOnHandleGetNsmData(NodeStateTest *pTestMachine,
- GDBusMethodInvocation *pInvocation,
- const gint i32DataType,
- GVariant *DataIn,
- const guint u32DataLen,
- gpointer pUserData)
-{
- /* Function local variables */
- NsmSession_s pData; /* Contains data from pDataIn and is popassed to the NSM */
- int i32RetVal = 0; /* Return value of the NSM */
- guint u32ArrayIdx = 0; /* Index to loop through data */
- GVariant **pArrayElements = NULL; /* Helper to serailize data */
- GVariant *pRetArray = NULL; /* Outgoing data returned to NSM */
- GVariant *pDataInElement = NULL; /* Pointer to child of pDataIn */
-
- /*
- * The NSM has a read write interface for getting data. The largest data frame that can be
- * exchanged is a NsmSession_s. Therefore, pDataIn is translated into this kind of variable.
- */
- for(u32ArrayIdx = 0; u32ArrayIdx < g_variant_n_children(DataIn); u32ArrayIdx++)
- {
- pDataInElement = g_variant_get_child_value(DataIn, u32ArrayIdx);
- ((guchar*) &pData)[u32ArrayIdx] = g_variant_get_byte(pDataInElement);
- }
-
- g_variant_unref(DataIn); /* Release pDataIn. we read the data */
-
- /* Call the NSM */
- i32RetVal = NsmGetData((NsmDataType_e) i32DataType, (unsigned char*) &pData, u32DataLen);
-
- /* Serialize ougoing data retuurned by NSM, if there is a positive NSM return */
- if(i32RetVal > 0)
- {
- pArrayElements = g_new(GVariant*, i32RetVal);
-
- for(u32ArrayIdx = 0; u32ArrayIdx < (guint) i32RetVal; u32ArrayIdx++)
- {
- pArrayElements[u32ArrayIdx] = g_variant_new_byte( ((guchar*) &pData)[u32ArrayIdx] );
- }
-
- pRetArray = g_variant_new_array(G_VARIANT_TYPE_BYTE, pArrayElements, (gsize) i32RetVal);
- }
- else
- {
- pArrayElements = g_new(GVariant*, 1);
- pArrayElements[0] = g_variant_new_byte(0);
- pRetArray = g_variant_new_array(G_VARIANT_TYPE_BYTE, pArrayElements, 1);
- }
-
- /* Send NSM return to test frame */
- node_state_test_complete_get_nsm_data(pTestMachine, pInvocation, pRetArray, i32RetVal);
-
- g_variant_unref(pRetArray); /* Release the returned data, because we send it. */
-
- return TRUE;
-}
-
-/**********************************************************************************************************************
-*
-* The function is called when a test frame wants to get the interface version of the NSM via the NSMC.
-*
-* @param pTestMachine: NodeStateMachineTest object.
-* @param pInvocation: Invocation for this call.
-* @param pUserData: Opzional user data (not used).
-*
-* @return TRUE: Dbus message was handled.
-*
-**********************************************************************************************************************/
-static gboolean NSM__boOnHandleGetNsmInterfaceVersion(NodeStateTest *pTestMachine,
- GDBusMethodInvocation *pInvocation,
- gpointer pUserData)
-{
- node_state_test_complete_get_nsm_interface_version(pTestMachine, pInvocation, (guint) NsmGetInterfaceVersion());
-
- return TRUE;
-}
-
-
-/**********************************************************************************************************************
-*
-* Interfaces, exported functions. See header for detailed description.
-*
-**********************************************************************************************************************/
-
-unsigned char NsmcInit(void)
-{
- unsigned char u8RetVal = 0;
-
- TSTMSC__pTestMachine = node_state_test_skeleton_new();
- TSTMSC__pConnection = g_bus_get_sync(NSM_BUS_TYPE, NULL, NULL);
-
- if(g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(TSTMSC__pTestMachine),
- TSTMSC__pConnection,
- "/com/contiautomotive/NodeStateMachineTest",
- NULL) == TRUE)
- {
- u8RetVal = 1;
- (void) g_signal_connect(TSTMSC__pTestMachine, "handle-set-nsm-data", G_CALLBACK(NSM__boOnHandleSetNsmData), NULL);
- (void) g_signal_connect(TSTMSC__pTestMachine, "handle-get-nsm-data", G_CALLBACK(NSM__boOnHandleGetNsmData), NULL);
- (void) g_signal_connect(TSTMSC__pTestMachine, "handle-get-nsm-interface-version", G_CALLBACK(NSM__boOnHandleGetNsmInterfaceVersion), NULL);
- }
- else
- {
- u8RetVal = 0;
- }
-
- return u8RetVal;
-}
-
-
-unsigned char NsmcLucRequired(void)
-{
- return 1;
-}
-
-
-NsmErrorStatus_e NsmcSetData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen)
-{
- return NsmErrorStatus_Ok;
-}
-
-
-unsigned char NsmcRequestNodeRestart(NsmRestartReason_e enRestartReason, unsigned int u32RestartType)
-{
- printf("NSMC: NsmcRequestNodeRestart called. Restart reason: %d. RestartType: 0x%02X\n", enRestartReason, u32RestartType);
- return 1;
-}
-
-
-unsigned int NsmcGetInterfaceVersion(void)
-{
- return (unsigned int) NSMC_INTERFACE_VERSION;
-}
-
-
-NsmErrorStatus_e NsmcSetTestData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen)
-{
- if( (enData == NsmDataType_NodeState)
- && (u32DataLen == sizeof(NsmNodeState_e)
- && ((NsmNodeState_e) *pData) == NsmNodeState_Shutdown))
- {
- g_object_unref(TSTMSC__pConnection);
- g_object_unref(TSTMSC__pTestMachine);
- }
-
- return NsmErrorStatus_Ok;
-}
-
diff --git a/NodeStateMachineTest/NodeStateMachine.h b/NodeStateMachineTest/NodeStateMachine.h
deleted file mode 100644
index 7c9853b..0000000
--- a/NodeStateMachineTest/NodeStateMachine.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef NSM_NODESTATEMACHINE_H
-#define NSM_NODESTATEMACHINE_H
-
-/**********************************************************************************************************************
-*
-* Copyright (C) 2012 Continental Automotive Systems, Inc.
-*
-* Author: Jean-Pierre.Bogler@continental-corporation.com
-*
-* Header for the test NodeStateMachine.
-*
-* The header file defines the interfaces offered by the test NodeStateMachine.
-*
-* 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/.
-*
-* Date Author Reason
-* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
-*
-**********************************************************************************************************************/
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/**********************************************************************************************************************
-*
-* HEADER FILE INCLUDES
-*
-**********************************************************************************************************************/
-
-#include "NodeStateTypes.h"
-
-/**********************************************************************************************************************
-*
-* CONSTANTS
-*
-**********************************************************************************************************************/
-
-/**
- * Module version, use SswVersion to interpret the value.
- * The lower significant byte is equal 0 for released version only
- */
-
-#define NSMC_INTERFACE_VERSION 0x01000000U
-
-
-/**********************************************************************************************************************
-*
-* TYPE
-*
-**********************************************************************************************************************/
-
-/* There are no own types defined */
-
-
-/**********************************************************************************************************************
-*
-* GLOBAL VARIABLES
-*
-**********************************************************************************************************************/
-
-/* There are no exported global variables */
-
-
-/**********************************************************************************************************************
-*
-* FUNCTION PROTOTYPE
-*
-**********************************************************************************************************************/
-
-/** \brief Initialize the NodeStateMachine
-\retval true: The NodeStateMachine could be initialized and is running. false: An error occurred. NodeStateMachine not started.
-
-This function will be used to initialize the Node State Machine, it will be called by the Node State Manager.
-At the point where this function returns the machine is available to accept events via its interfaces from
-the NSM. It is envisaged that in this call the NSMC will create and transfer control of the NSMC to its own
-thread and will return in the original thread.*/
-unsigned char NsmcInit(void);
-
-
-/** \brief Check for Last User Context
-\retval true: Last User Context (LUC) is required. false: No LUC required.
-
-This will be used by the NSM to check whether in the current Lifecycle the Last User Context (LUC) should
-be started. This allows the product to define its own handling for specific Application modes. */
-unsigned char NsmcLucRequired(void);
-
-
-/** \brief Set data in the NodeStateMachine.
-\param[in] enData Type of the data to set (see ::NsmDataType_e).
-\param[in] pData Pointer to the memory location containing the data.
-\param[in] u32DataLen Length of the data that should be set (in byte).
-\retval see ::NsmErrorStatus_e
-
-This is a generic interface that can be used by the NSM to inform the NSMC about changes
-to data items (i.e. events that have occurred in the system) */
-NsmErrorStatus_e NsmcSetData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen);
-
-
-/** \brief Request a NodeRestart.
-\retval true: The request for the restart could be processed. false: Error processing the restart request.
-
-This will be used by the NSM to request a node restart when requested by one of its clients.*/
-unsigned char NsmcRequestNodeRestart(NsmRestartReason_e enRestartReason, unsigned int u32RestartType);
-
-
-/** \brief Get version of the interface
-\retval Version of the interface as defined in ::SswVersion_t
-
-This function asks the lifecycle to perform a restart of the main controller. */
-unsigned int NsmcGetInterfaceVersion(void);
-
-
-NsmErrorStatus_e NsmcSetTestData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen);
-
-
-/**********************************************************************************************************************
-*
-* MACROS
-*
-**********************************************************************************************************************/
-
-/* There are no macros defined */
-
-
-#ifdef __cplusplus
-}
-#endif
-/** \} */ /* End of SSW_NSMC_INTERFACE */
-/** \} */ /* End of SSW_NSMC_TEMPLATE */
-#endif /* NSM_NODESTATEMACHINE_H */
diff --git a/NodeStateMachineTest/NodeStateTest.c b/NodeStateMachineTest/NodeStateTest.c
deleted file mode 100644
index a719697..0000000
--- a/NodeStateMachineTest/NodeStateTest.c
+++ /dev/null
@@ -1,3609 +0,0 @@
-/**********************************************************************************************************************
-*
-* Copyright (C) 2012 Continental Automotive Systems, Inc.
-*
-* Author: Jean-Pierre.Bogler@continental-corporation.com
-*
-* Implementation of the NodeStateMachineTest.
-*
-* The file implements a test executable that communicates with the NodeStateManager and provides "LifecycleClients"
-* for shutdown tests. The intention is to keep the test code as simple as possible. Additional test cases should
-* only be defined by adding them to the table "NSMTST__astTestCase". If the NSM offers new functionality, it might
-* be necessary to extend the test frame by new functions.
-*
-* The test is controlled by a timer. In configurable time steps, the test cases are called one after the other.
-* The table NSMTST__astTestCase contains a function pointer to the test function, a union for possible parameters
-* and a union for the expected return value(s).
-*
-* The test functions return a boolean value and do not take parameters. The parameters to test the NSM and the
-* expected return values are read from the table "NSMTST__astTestCase".
-*
-* For every NSM interface the possible parameters are stored in a structure. The structure is added as a member
-* in the "tunParameter" union type definition. The same applies to the expected return values, where the structures
-* are declares as members in the tunReturnValues union.
-*
-* Wrapping the parameters and expected returns in structures should simplify further extensions and adaption to the
-* test frame and allow a consistent syntax. Every structure name for parameters and return values has the same naming
-* convenitons:
-*
-* NSMTST__tst<Interface><Function>Param or NSMTST__tst<Interface><Function>Return
-*
-* Where interface either is Db (D-Bus), Sm (StateMachine) or Test (int. functions, where no NSM interface is accessed).
-*
-* 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/.
-*
-* Date Author Reason
-* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
-* 18.04.2013 Jean-Pierre Bogler OvipRbt#1153: Implemented test cases 164 - 170.
-*
-**********************************************************************************************************************/
-
-
-/**********************************************************************************************************************
-*
-* Header includes
-*
-**********************************************************************************************************************/
-
-/* System header files */
-#include <gio/gio.h> /* Use glib to access dbus and communicate to NSM */
-
-/* Header files offered by NSM */
-#include "NodeStateTypes.h" /* Know type definitions of NSM */
-#include "NodeStateManager.h" /* Know internal interfaces of NSM */
-
-/* Generated header files to access NSM via D-Bus */
-#include "NodeStateConsumer.h" /* Consumer interface with publicly available functions */
-#include "NodeStateLifecycleControl.h" /* Control interface with safety relevant functions */
-#include "NodeStateLifecycleConsumer.h" /* Consumer interface to offer life cycle clients */
-#include "NodeStateMachineTestApi.h" /* Access D-Bus interface of test NSMC */
-
-
-/**********************************************************************************************************************
-*
-* Local defines, macros and type definitions.
-*
-**********************************************************************************************************************/
-
-/*
- * Interval between the test steps in ms.
- */
-#define NSMTST__TIMER_INTERVAL 100
-
-/*
- * Format for the trace output of the test frame.
- * An integer (the test case number) and three strings can be displayed:
- * The test description, the ErrorMessage and a "success"/"failed" string.
- *
- */
-#define NSMTST__TESTPRINT "%03d;%s;%s;%s\n"
-
-/*
- * The define sets up a string that is longer for all text fields used in the NSM.
- * The intend is to test the NSM for correct behavior by passing this string.
- */
-#define NSMTST__260CHAR_STRING "012345678901234567890123456789012345678901234567890123456789"\
- "012345678901234567890123456789012345678901234567890123456789"\
- "012345678901234567890123456789012345678901234567890123456789"\
- "012345678901234567890123456789012345678901234567890123456789"\
- "01234567890123456789"
-
-/* Defines the syntax of a test function call */
-typedef gboolean (*NSMTST__tpfTestFunction)(void);
-
-/* Configures dummy parameter for test cases that do not need additional parameters. */
-typedef struct
-{
- guint8 u8Dummy;
-} NSMTST__tstTestDummyParam;
-
-/*
- * Configures parameters for the helper function "NSMTST__boCreateLifecycleClient",
- * which is used to create life cycle clients that are needed for further tests.
- */
-typedef struct
-{
- gchar* sObjName; /* Object name of the LifecycleClient that should be created */
-} NSMTST__tstTestCreateLifecycleClientParam;
-
-/* Configures parameters for calling the (internal) NsmSetData interface of the NSM with invalid data types. */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
- NsmDataType_e enDataType; /* Data type passed to NSM */
-} NSMTST__tstSmSetInvalidDataParam;
-
-/* Configures parameters for getting a SessionState from the NSM by calling its (internal) NsmSetData interface. */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
- NsmSession_s sSession; /* Defines which session to get */
-} NSMTST__tstSmGetSessionStateParam;
-
-/* Configures parameters for setting an ApplicationMode using the (internal) NsmSetData interface. */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
- NsmApplicationMode_e enApplicationMode; /* ApplicationMode to be set */
-} NSMTST__tstSmSetApplicationModeParam;
-
-/* Configures parameters for setting a NodeState using the (internal) NsmSetData interface. */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
- NsmNodeState_e enNodeState; /* NodeState to be set */
-} NSMTST__tstSmSetNodeStateParam;
-
-/* Configure parameters for setting a SessionState using the (internal) NsmSetData interface. */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
- NsmSession_s stSession; /* Defines session and state that should be set */
-} NSMTST__tstSmSetSessionStateParam,
- NSMTST__tstSmRegisterSessionParam,
- NSMTST__tstSmUnRegisterSessionParam;
-
-/* Configure the parameters for setting a ShutdownReason using the (internal) NsmSetData interface. */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
- NsmShutdownReason_e enShutdownReason; /* ShutdownReason to be set */
-} NSMTST__tstSmSetShutdownReasonParam;
-
-/* Configure parameters for setting a BootMode using the (internal) NsmSetData interface. */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
- gint i32BootMode; /* BootMode to be set */
-} NSMTST__tstSmSetBootModeParam;
-
-/* Configure the parameters for getting different values of the NSM via the (internal) NsmGetData interface */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
-} NSMTST__tstSmGetRunningReasonParam,
- NSMTST__tstSmGetShutdownReasonParam,
- NSMTST__tstSmGetNodeStateParam,
- NSMTST__tstSmGetApplicationModeParam,
- NSMTST__tstSmGetBootModeParam,
- NSMTST__tstSmGetRestartReasonParam;
-
-/* Configures parameters for trying to get invalid data using the (internal) NsmSetData interface. */
-typedef struct
-{
- guint u32DataLen; /* Length of the data to be set in byte */
- NsmDataType_e enDataType; /* DataType, which is trying to be get */
-} NSMTST__tstSmGetInvalidDataParam;
-
-/* Configures parameters for calling the RegisterLifecycleClient D-Bus interface of the NSM.
- * Note that the bus address automatically is defined by the test frame.
- */
-typedef struct
-{
- gchar *sObjName; /* Object name */
- guint u32Mode; /* Registered shutdown mode(s) */
- guint u32Timeout; /* Timeout for shutdown */
-} NSMTST__tstDbRegisterShutdownClientParam;
-
-/* Configures parameters for calling the UnRegisterLifecycleClient D-Bus interface of the NSM. */
-typedef struct
-{
- gchar *sObjName; /* Object name */
- guint u32Mode; /* Shutdown mode(s) taht should be unregistered */
-} NSMTST__tstDbUnRegisterShutdownClientParam;
-
-/* Configures parameters for calling the RequestNodeRestart D-Bus interface of the NSM. */
-typedef struct
-{
- NsmRestartReason_e enRestartReason; /* RestartReason passed to NSM */
- guint u32RestartType; /* RestartType. E.g. NSM_NORMAL_SHUTDOWN */
-} NSMTST__tstDbRequestNodeRestartParam;
-
-/* Configures parameters for calling the SetAppHealthStatus D-Bus interface of the NSM. */
-typedef struct
-{
- gchar *sAppName; /* (Systemd) name of the application, which state changed */
- gboolean boAppRunning; /* New "RunningState" of the application */
-} NSMTST__tstDbSetAppHealthStatusParam;
-
-/* Configures parameters for calling the SetBootMode D-Bus interface of the NSM. */
-typedef struct
-{
- gint i32BootMode; /* BootMode to be set */
-} NSMTST__tstDbSetBootModeParam;
-
-/* Configures parameters for setting the NodeState using the D-Bus SetNodeState interface of the NSM. */
-typedef struct
-{
- NsmNodeState_e enNodeState; /* NodeState to be set */
-} NSMTST__tstDbSetNodeStateParam;
-
-/* Configures parameters for setting the ApplicationMode using the D-Bus SetApplicationMode interface of the NSM. */
-typedef struct
-{
- NsmApplicationMode_e enApplicationMode; /* ApplicationMode to be set */
-} NSMTST__tstDbSetApplicationModeParam;
-
-/*
- * Configures parameters for registering sessions and setting session states using the D-Bus
- * RegisterSession and SetSessionState interface of the NSM.
- */
-typedef struct
-{
- gchar *sSessionName; /* Name of the session */
- gchar *sSessionOwner; /* Owner of the session */
- NsmSeat_e enSeat; /* Seat of the session */
- NsmSessionState_e enState; /* State of the session */
-} NSMTST__tstDbRegisterSessionParam,
- NSMTST__tstDbSetSessionStateParam;
-
-/* Configures parameters for getting session states using the D-Bus GetSessionState interface of the NSM. */
-typedef struct
-{
- gchar *sSessionName; /* Name of the session */
- NsmSeat_e enSeat; /* Seat of the session */
-} NSMTST__tstDbGetSessionStateParam;
-
-/* Configures parameters for getting session states using the D-Bus GetSessionState interface of the NSM. */
-typedef struct
-{
- gchar *sSessionName; /* Name of the session */
- gchar *sSessionOwner; /* Owner of the session */
- NsmSeat_e enSeat; /* Seat of the session */
-} NSMTST__tstDbUnRegisterSessionParam;
-
-/*
- * Configures the parameters for calling the LifecyclRequestComplete D-Bus interface of the NSM to finalize
- * an asynchronous shut down. Furthermore, the same value is passed in ProcessLifecycleRequest to process an
- * initial request.
- */
-typedef struct
-{
- NsmErrorStatus_e enErrorStatus; /* Error status returned to NSM */
-} NSMTST__tstDbLifecycleRequestCompleteParam,
- NSMTST__tstTestProcessLifecycleRequestParam;
-
-/* The union includes all possible parameters needed by different NSM interfaces. */
-typedef union
-{
- /* Parameters for internal functions that control the test */
- NSMTST__tstTestDummyParam stTestDummy;
- NSMTST__tstTestCreateLifecycleClientParam stTestCreateLcClient;
-
- /* Parameters to control callback functions, which occur because of NSM signals */
- NSMTST__tstTestProcessLifecycleRequestParam stTestProcessLifecycleRequest;
-
- /* Parameters for D-Bus interfaces of the NSM */
- NSMTST__tstDbSetNodeStateParam stDbSetNodeState;
- NSMTST__tstDbSetApplicationModeParam stDbSetApplicationMode;
- NSMTST__tstDbSetBootModeParam stDbSetBootMode;
- NSMTST__tstDbGetSessionStateParam stDbGetSessionState;
- NSMTST__tstDbSetSessionStateParam stDbSetSessionState;
-
- NSMTST__tstDbRegisterSessionParam stDbRegisterSession;
- NSMTST__tstDbUnRegisterSessionParam stDbUnRegisterSession;
- NSMTST__tstDbSetAppHealthStatusParam stDbSetAppHealthStatus;
- NSMTST__tstDbRegisterShutdownClientParam stDbRegisterShutdownClient;
- NSMTST__tstDbUnRegisterShutdownClientParam stDbUnRegisterShutdownClient;
- NSMTST__tstDbRequestNodeRestartParam stDbRequestNodeRestart;
-
- NSMTST__tstDbLifecycleRequestCompleteParam stDbLifecycleRequestComplete;
-
- /* Parameters for D-Bus interfaces of the test NSMC */
- NSMTST__tstSmSetInvalidDataParam stSmSetInvalidData;
- NSMTST__tstSmSetApplicationModeParam stSmSetApplicationMode;
- NSMTST__tstSmSetNodeStateParam stSmSetNodeState;
- NSMTST__tstSmSetSessionStateParam stSmSetSessionState;
- NSMTST__tstSmRegisterSessionParam stSmRegisterSession;
- NSMTST__tstSmUnRegisterSessionParam stSmUnRegisterSession;
- NSMTST__tstSmSetShutdownReasonParam stSmSetShutdownReason;
- NSMTST__tstSmSetBootModeParam stSmSetBootMode;
-
- NSMTST__tstSmGetBootModeParam stSmGetBootMode;
- NSMTST__tstSmGetRestartReasonParam stSmGetRestartReason;
- NSMTST__tstSmGetRunningReasonParam stSmGetRunningReason;
- NSMTST__tstSmGetShutdownReasonParam stSmGetShutdownReason;
- NSMTST__tstSmGetNodeStateParam stSmGetNodeState;
- NSMTST__tstSmGetApplicationModeParam stSmGetApplicationMode;
- NSMTST__tstSmGetInvalidDataParam stSmGetInvalidData;
- NSMTST__tstSmGetSessionStateParam stSmGetSessionState;
-} NSMTST__tunParameters;
-
-
-/* Configures dummy return value for test cases where no return value is expected. */
-typedef struct
-{
- guint8 u8Dummy;
-} NSMTST__tstTestDummyReturn;
-
-/* Configures expected return values when calling the (internal) NsmGetData interface with invalid values. */
-typedef struct
-{
- gint i32WrittenBytes; /* Number of bytes returned by NSM */
-} NSMTST__tstSmGetInvalidDataReturn;
-
-/* Configure expected return values when getting the ApplicationMode via the internal NsmGetData interface. */
-typedef struct
-{
- gint i32WrittenBytes; /* Number of bytes returned by NSM */
- NsmApplicationMode_e enApplicationMode; /* ApplicationMode returned by NSM */
-} NSMTST__tstSmGetAppModeReturn;
-
-/* Configures expected return values when getting the NodeState via the internal NsmGetData interface. */
-typedef struct
-{
- gint i32WrittenBytes; /* Number of bytes returned by NSM */
- NsmNodeState_e enNodeState; /* NodeState returned by NSM */
-} NSMTST__tstSmGetNodeStateReturn;
-
-/* Configures expected return values when getting the RestartReason via the internal NsmGetData interface. */
-typedef struct
-{
- gint i32WrittenBytes; /* Number of bytes returned by NSM */
- NsmRestartReason_e enRestartReason; /* RestartReason returned by NSM */
-} NSMTST__tstSmGetRestartReasonReturn;
-
-/* Configures expected return values when getting a SessionState via the internal NsmGetData interface. */
-typedef struct
-{
- gint i32WrittenBytes; /* Number of bytes returned by NSM */
- NsmSessionState_e enSessionState; /* SessionState returned by NSM */
-} NSMTST__tstSmGetSessionStateReturn;
-
-/* Configures expected return values when getting a ShutdownReason via the internal NsmGetData interface. */
-typedef struct
-{
- gint i32WrittenBytes; /* Number of bytes returned by NSM */
- NsmShutdownReason_e enShutdownReason; /* ShutdownReason returned by NSM */
-} NSMTST__tstSmGetShutdownReasonReturn;
-
-/* Configures expected return values when getting a BootMode via the internal NsmGetData interface. */
-typedef struct
-{
- gint i32WrittenBytes; /* Number of bytes returned by NSM */
- gint i32BootMode; /* BootMode returned by NSM */
-} NSMTST__tstSmGetBootModeReturn;
-
-/* Configures expected return values when getting a RunningReason via the internal NsmGetData interface. */
-typedef struct
-{
- gint i32WrittenBytes; /* Number of bytes returned by NSM */
- NsmRunningReason_e enRunningReason; /* RunningReason returned by NSM */
-} NSMTST__tstSmGetRunningReasonReturn;
-
-/* Configures expected return values when getting a SessionState via the GetSessionState D-Bus interface of the NSM. */
-typedef struct
-{
- NsmErrorStatus_e enErrorStatus; /* ErrorStatus returned by NSM */
- NsmSessionState_e enSessionState; /* SessionState returned by NSM */
-} NSMTST__tstDbGetSessionStateReturn;
-
-/* Configures expected return values when calling the CheckLucRequired D-Bus interface of the NSM. */
-typedef struct
-{
- gboolean boLucRequired; /* LUC flag returned by NSM */
-} NSMTST__tstDbCheckLucRequired;
-
-/* Configures expected return values when calling the GetBootMode D-Bus interface of the NSM. */
-typedef struct
-{
- gint i32BootMode; /* BootMdoe returned by NSM */
-} NSMTST__tstDbGetBootModeReturn;
-
-/* Configures expected return values when calling the GetRunningReason D-Bus interface of the NSM. */
-typedef struct
-{
- NsmRunningReason_e enRunningReason; /* RunningReason returned by NSM */
-} NSMTST__tstDbGetRunningReasonReturn;
-
-/* Configures the expected return values when calling the GetShutdownReason D-Bus interface of the NSM. */
-typedef struct
-{
- NsmShutdownReason_e enShutdownReason; /* ShutdownReason returned by NSM */
-} NSMTST__tstDbGetShutdownReasonReturn;
-
-/* Configures expected return values when calling the GetRestartReason D-Bus interface of the NSM. */
-typedef struct
-{
- NsmRestartReason_e enRestartReason; /* RetsartReason returned by NSM */
-} NSMTST__tstDbGetRestartReasonReturn;
-
-/* Configures expected return values when calling the GetNodeState D-Bus interface of the NSM. */
-typedef struct
-{
- NsmErrorStatus_e enErrorStatus; /* ErrorStatus returned by NSM */
- NsmNodeState_e enNodeState; /* NodeState returned by NSM */
-} NSMTST__tstDbGetNodeStateReturn;
-
-/* Configures expected return values when calling the GetApplicationMode D-Bus interface of the NSM. */
-typedef struct
-{
- NsmErrorStatus_e enErrorStatus; /* ErrorStatus returned by NSM */
- NsmApplicationMode_e enApplicationMode; /* ApplicationMode returned by NSM */
-} NSMTST__tstDbGetApplicationModeReturn;
-
-/*
- * Configures expected return values when getting the interface version using the internal
- * NsmGetInterfaceVersion interface and the GetInterfaceVersion D-Bus interface of the NSM.
- */
-typedef struct
-{
- guint u32InterfaceVersion;
-} NSMTST__tstSmGetInterfaceVersionReturn,
- NSMTST__tstDbGetInterfaceVersionReturn;
-
-/* Configures expected return values when calling the GetAppHealthCount D-Bus interface of the NSM. */
-typedef struct
-{
- guint u32AppHealthCount; /* Number fo failed applications returned by NSM */
-} NSMTST__tstDbGetAppHealthCountReturn;
-
-/* Configures expected return value when calling different interface of the NSM. */
-typedef struct
-{
- NsmErrorStatus_e enErrorStatus; /* ErrorStatus returned by NSM */
-} NSMTST__tstDbSetBootModeReturn,
- NSMTST__tstDbSetNodeStateReturn,
- NSMTST__tstDbSetApplicationReturn,
- NSMTST__tstDbSetSessionStateReturn,
- NSMTST__tstDbSetAppHealthStatusReturn,
- NSMTST__tstDbRequestNodeRestartReturn,
- NSMTST__tstDbRegisterShutdownClientReturn,
- NSMTST__tstDbUnRegisterShutdownClientReturn,
- NSMTST__tstDbRegisterSessionReturn,
- NSMTST__tstDbUnRegisterSessionReturn,
- NSMTST__tstSmSetBootModeReturn,
- NSMTST__tstSmSetNodeStateReturn,
- NSMTST__tstSmSetApplicationModeReturn,
- NSMTST__tstSmSetInvalidDataReturn,
- NSMTST__tstSmSetShutdownModeReturn,
- NSMTST__tstSmSetSessionStateReturn,
- NSMTST__tstSmRegisterSessionReturn,
- NSMTST__tstSmUnRegisterSessionReturn,
- NSMTST__tstTestLifecycleRequestCompleteReturn;
-
-/* Configures the expected values for the reception of the SessionState signal send by the NSM. */
-typedef struct
-{
- gboolean boReceived; /* Flag if Session signal is expected */
- gchar *sName; /* Name of the session for which signal is expected */
- NsmSeat_e enSeat; /* Seat of the session for which signal is expected */
- NsmSessionState_e enState; /* Expected session state */
-} NSMTST__tstCheckSessionSignal;
-
-/* Configures the expected values for the reception of the NodeState signal send by the NSM. */
-typedef struct
-{
- gboolean boReceived; /* Flag if NodeState signal is expected */
- NsmNodeState_e enNodeState; /* NodeState that is expected */
-} NSMTST__tstCheckNodeStateSignal;
-
-/* Configures the expected values for the reception of the ApplicationMode signal send by the NSM. */
-typedef struct
-{
- gboolean boReceived; /* Flag if ApplicationMode signal is expected */
- NsmApplicationMode_e enApplicationMode; /* ApplicationMode that is expected */
-} NSMTST__tstCheckApplicationMode;
-
-/* Configures the expected value that the NSM has passed when issuing a LifecyclRequest. */
-typedef struct
-{
- guint u32RequestType; /* Expected RestartType (set by NSM) for life cycle client */
-} NSMTST__tstTestProcessLifecycleRequestReturn;
-
-/* The union includes all possible expected return values for the interfaces of the NSM. */
-typedef union
-{
- /* Expected return values for internal functions that control the test */
- NSMTST__tstTestDummyReturn stTestDummy;
- NSMTST__tstTestProcessLifecycleRequestReturn stTestProcessLifecycleRequest;
-
- /* Expected return values for D-Bus interfaces of the NSM */
- NSMTST__tstDbSetBootModeReturn stDbSetBootMode;
- NSMTST__tstDbSetNodeStateReturn stDbSetNodeState;
- NSMTST__tstDbSetApplicationReturn stDbSetApplicationMode;
- NSMTST__tstDbSetSessionStateReturn stDbSetSessionState;
-
- NSMTST__tstDbGetNodeStateReturn stDbGetNodeState;
- NSMTST__tstDbGetApplicationModeReturn stDbGetApplicationMode;
- NSMTST__tstDbGetBootModeReturn stDbGetBootMode;
- NSMTST__tstDbGetShutdownReasonReturn stDbGetShutdownReason;
- NSMTST__tstDbGetRunningReasonReturn stDbGetRunningReason;
- NSMTST__tstDbGetRestartReasonReturn stDbGetRestartReason;
- NSMTST__tstDbGetSessionStateReturn stDbGetSessionState;
-
- NSMTST__tstDbSetAppHealthStatusReturn stDbSetAppHealthStatus;
- NSMTST__tstDbGetAppHealthCountReturn stDbGetAppHealthCount;
- NSMTST__tstDbCheckLucRequired stDbCheckLucRequired;
- NSMTST__tstDbRegisterSessionReturn stDbRegisterSession;
- NSMTST__tstDbUnRegisterSessionReturn stDbUnRegisterSession;
- NSMTST__tstDbRegisterShutdownClientReturn stDbRegisterShutdownClient;
- NSMTST__tstDbUnRegisterShutdownClientReturn stDbUnRegisterShutdownClient;
- NSMTST__tstDbRequestNodeRestartReturn stDbRequestNodeRestart;
- NSMTST__tstDbGetInterfaceVersionReturn stDbGetInterfaceVersion;
- NSMTST__tstTestLifecycleRequestCompleteReturn stDbLifecycleRequestComplete;
-
- /* Expected return values for NSMC interfaces of the NSM */
- NSMTST__tstSmSetShutdownModeReturn stSmSetShutdownReason;
- NSMTST__tstSmSetBootModeReturn stSmSetBootMode;
- NSMTST__tstSmSetNodeStateReturn stSmSetNodeState;
- NSMTST__tstSmSetApplicationModeReturn stSmSetApplicationMode;
- NSMTST__tstSmSetInvalidDataReturn stSmSetInvalidData;
- NSMTST__tstSmSetSessionStateReturn stSmSetSessionState;
- NSMTST__tstSmRegisterSessionReturn stSmRegisterSession;
- NSMTST__tstSmUnRegisterSessionReturn stSmUnRegisterSession;
-
- NSMTST__tstSmGetAppModeReturn stSmGetApplicationMode;
- NSMTST__tstSmGetNodeStateReturn stSmGetNodeState;
- NSMTST__tstSmGetRestartReasonReturn stSmGetRestartReason;
- NSMTST__tstSmGetSessionStateReturn stSmGetSessionState;
- NSMTST__tstSmGetShutdownReasonReturn stSmGetShutdownReason;
- NSMTST__tstSmGetBootModeReturn stSmGetBootMode;
- NSMTST__tstSmGetRunningReasonReturn stSmGetRunningReason;
- NSMTST__tstSmGetInvalidDataReturn stSmGetInvalidData;
-
- NSMTST__tstSmGetInterfaceVersionReturn stSmGetInterfaceVersion;
-
- /* Expected signals send by NSM */
- NSMTST__tstCheckSessionSignal stCheckSessionSignal;
- NSMTST__tstCheckNodeStateSignal stCheckNodeStateSignal;
- NSMTST__tstCheckApplicationMode stCheckApplicationModeSignal;
-} NSMTST__tunReturnValues;
-
-/* Type definition for a test call. */
-typedef struct
-{
- NSMTST__tpfTestFunction pfTestCall; /* Function */
- NSMTST__tunParameters unParameter; /* Parameters */
- NSMTST__tunReturnValues unReturnValues; /* Expected return values */
-} NSMTST__tstTestCase;
-
-
-/**********************************************************************************************************************
-*
-* Prototypes for file local functions (see implementation for description)
-*
-**********************************************************************************************************************/
-
-/* Internal test functions. get connections, create and register objects */
-static gboolean NSMTST__boTestGetBusConnection (void);
-static gboolean NSMTST__boTestCreateConsumerProxy (void);
-static gboolean NSMTST__boTestCreateLifecycleControlProxy(void);
-static gboolean NSMTST__boTestCreateNodeStateMachineProxy(void);
-static gboolean NSMTST__boTestRegisterCallbacks (void);
-static gboolean NSMTST__boTestCreateLcClient (void);
-static gboolean NSMTST__boTestProcessLifecycleRequest (void);
-
-/* Functions to call D-Bus interfaces of the NSM */
-static gboolean NSMTST__boDbSetBootMode (void);
-static gboolean NSMTST__boDbSetApplicationMode (void);
-static gboolean NSMTST__boDbSetNodeState (void);
-static gboolean NSMTST__boDbSetSessionState (void);
-
-static gboolean NSMTST__boDbGetBootMode (void);
-static gboolean NSMTST__boDbGetApplicationMode (void);
-static gboolean NSMTST__boDbGetNodeState (void);
-static gboolean NSMTST__boDbGetSessionState (void);
-static gboolean NSMTST__boDbGetRestartReason (void);
-static gboolean NSMTST__boDbGetShutdownReason (void);
-static gboolean NSMTST__boDbGetRunningReason (void);
-
-static gboolean NSMTST__boDbCheckLucRequired (void);
-static gboolean NSMTST__boDbRegisterSession (void);
-static gboolean NSMTST__boDbUnRegisterSession (void);
-static gboolean NSMTST__boDbRegisterShutdownClient (void);
-static gboolean NSMTST__boDbUnRegisterShutdownClient (void);
-static gboolean NSMTST__boDbGetAppHealthCount (void);
-static gboolean NSMTST__boDbGetInterfaceVersion (void);
-static gboolean NSMTST__boDbRequestNodeRestart (void);
-static gboolean NSMTST__boDbSetAppHealthStatus (void);
-static gboolean NSMTST__boDbLifecycleRequestComplete (void);
-
-/* Functions to call (internal) NSMC interfaces of the NSM */
-static gboolean NSMTST__boSmSetApplicationMode (void);
-static gboolean NSMTST__boSmSetNodeState (void);
-static gboolean NSMTST__boSmSetSessionState (void);
-static gboolean NSMTST__boSmRegisterSession (void);
-static gboolean NSMTST__boSmUnRegisterSession (void);
-static gboolean NSMTST__boSmSetShutdownReason (void);
-static gboolean NSMTST__boSmSetBootMode (void);
-static gboolean NSMTST__boSmSetInvalidData (void);
-
-static gboolean NSMTST__boSmGetApplicationMode (void);
-static gboolean NSMTST__boSmGetNodeState (void);
-static gboolean NSMTST__boSmGetRestartReason (void);
-static gboolean NSMTST__boSmGetSessionState (void);
-static gboolean NSMTST__boSmGetShutdownReason (void);
-static gboolean NSMTST__boSmGetBootMode (void);
-static gboolean NSMTST__boSmGetRunningReason (void);
-static gboolean NSMTST__boSmGetInvalidData (void);
-
-static gboolean NSMTST__boSmGetInterfaceVersion (void);
-
-/* Functions to check for signals */
-static gboolean NSMTST__boCheckSessionSignal (void);
-static gboolean NSMTST__boCheckNodeStateSignal (void);
-static gboolean NSMTST__boCheckApplicationModeSignal (void);
-
-/* Internal HelperFunctions */
-static GVariant* NSMTST__pPrepareStateMachineData(guchar *pDataArray, const guint32 u32ArraySize);
-
-/* Internal callback functions to process signals */
-static gboolean NSMTST__boOnSessionSignal(NodeStateConsumer *pObject,
- const gchar *sSessionName,
- const gint i32SeatId,
- const gint i32SessionState,
- gpointer pUserData);
-
-static gboolean NSMTST__boOnApplicationModeSignal(NodeStateConsumer *pObject,
- const gint i32ApplicationMode,
- gpointer pUserData);
-
-static gboolean NSMTST__boOnNodeStateSignal(NodeStateConsumer *pObject,
- const gint i32NodeState,
- gpointer pUserData);
-
-static gboolean NSMTST__boOnLifecycleClientCb(NodeStateLifeCycleConsumer *pConsumer,
- GDBusMethodInvocation *pInvocation,
- const guint32 u32LifeCycleRequest,
- const guint32 u32RequestId,
- gpointer pUserData);
-
-/**********************************************************************************************************************
-*
-* Local variables and constants
-*
-**********************************************************************************************************************/
-
-/* Basic variables for test frame */
-static GMainLoop *NSMTST__pMainLoop = NULL;
-static GDBusConnection *NSMTST__pConnection = NULL;
-
-static guint16 NSMTST__u16TestIdx = 0;
-static NSMTST__tstTestCase *NSMTST__pstTestCase = NULL;
-static gchar *NSMTST__sErrorDescription = NULL;
-static gchar *NSMTST__sTestDescription = NULL;
-static const gchar *NSMTST__sBusName = NULL;
-
-/* Created proxy objects */
-static NodeStateConsumer *NSMTST__pNodeStateConsumer = NULL;
-static NodeStateLifecycleControl *NSMTST__pLifecycleControl = NULL;
-static NodeStateTest *NSMTST__pNodeStateMachine = NULL;
-
-/* Store values from signals and LifecycleRequests */
-static NSMTST__tstCheckSessionSignal NSMTST__stReceivedSessionSignal = {0};
-static NSMTST__tstCheckNodeStateSignal NSMTST__stReceivedNodeStateSignal = {0};
-static NSMTST__tstCheckApplicationMode NSMTST__stApplicationModeSignal = {0};
-
-static NodeStateLifeCycleConsumer *NSMTST__pLifecycleConsumer = NULL;
-static GDBusMethodInvocation *NSMTST__pLifecycleInvocation = NULL;
-static guint32 NSMTST__u32LifecycleRequest = 0;
-static guint32 NSMTST__u32LifecycleRequestId = 0;
-
-/* List to handle created LifecycleConsumers */
-static GSList *NSMTST__pLifecycleClients = NULL;
-
-/*
- * This table is the most important part of the test frame. All test cases are defined here.
- * The test frame will perform one test case after the other, triggered by a timer.
- *
- * To define a test frame, the test function, the NSM parameters and the expected return values have to be configured.
- */
-static NSMTST__tstTestCase NSMTST__astTestCases[] =
-{
- { &NSMTST__boTestGetBusConnection, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boTestCreateConsumerProxy, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boTestCreateLifecycleControlProxy, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boTestCreateNodeStateMachineProxy, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boTestRegisterCallbacks, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boDbSetBootMode, .unParameter.stDbSetBootMode = {0x00}, .unReturnValues.stDbSetBootMode = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbGetBootMode, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetBootMode = {0x00} },
- { &NSMTST__boDbSetBootMode, .unParameter.stDbSetBootMode = {0x01}, .unReturnValues.stDbSetBootMode = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbGetBootMode, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetBootMode = {0x01} },
- { &NSMTST__boDbSetBootMode, .unParameter.stDbSetBootMode = {0x01}, .unReturnValues.stDbSetBootMode = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbGetBootMode, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetBootMode = {0x01} },
- { &NSMTST__boSmSetBootMode, .unParameter.stSmSetBootMode = {sizeof(gint), 0x02}, .unReturnValues.stSmSetBootMode = {NsmErrorStatus_Ok } },
- { &NSMTST__boSmSetBootMode, .unParameter.stSmSetBootMode = {sizeof(gint) + 1, 0x03}, .unReturnValues.stSmSetBootMode = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetBootMode, .unParameter.stSmSetBootMode = {sizeof(gint) - 1, 0x04}, .unReturnValues.stSmSetBootMode = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmGetBootMode, .unParameter.stSmGetBootMode = {sizeof(gint)}, .unReturnValues.stSmGetBootMode = {sizeof(gint), 0x02} },
- { &NSMTST__boSmGetBootMode, .unParameter.stSmGetBootMode = {sizeof(gint) + 1}, .unReturnValues.stSmGetBootMode = {-1, 0x00} },
- { &NSMTST__boSmGetBootMode, .unParameter.stSmGetBootMode = {sizeof(gint) - 1}, .unReturnValues.stSmGetBootMode = {-1, 0x00} },
- { &NSMTST__boDbGetRunningReason, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetRunningReason = {NsmRunningReason_WakeupCan} },
- { &NSMTST__boSmGetRunningReason, .unParameter.stSmGetRunningReason = {sizeof(NsmRunningReason_e) }, .unReturnValues.stSmGetRunningReason = {sizeof(NsmRunningReason_e), NsmRunningReason_WakeupCan} },
- { &NSMTST__boSmGetRunningReason, .unParameter.stSmGetRunningReason = {sizeof(NsmRunningReason_e) + 1}, .unReturnValues.stSmGetRunningReason = {-1, NsmRunningReason_NotSet} },
- { &NSMTST__boSmGetRunningReason, .unParameter.stSmGetRunningReason = {sizeof(NsmRunningReason_e) - 1}, .unReturnValues.stSmGetRunningReason = {-1, NsmRunningReason_NotSet} },
- { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_NotSet}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), (NsmShutdownReason_e) 0xFFFFFFFF}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e) - 1, NsmShutdownReason_Normal}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e) + 1, NsmShutdownReason_Normal}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_Normal}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Ok} },
- { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_Normal}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbGetShutdownReason, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetShutdownReason = {NsmShutdownReason_Normal} },
- { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) }, .unReturnValues.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_Normal} },
- { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) - 1}, .unReturnValues.stSmGetShutdownReason = {-1, NsmShutdownReason_NotSet} },
- { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) + 1}, .unReturnValues.stSmGetShutdownReason = {-1, NsmShutdownReason_NotSet} },
- { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_SupplyBad}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbGetShutdownReason, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetShutdownReason = {NsmShutdownReason_SupplyBad} },
- { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) }, .unReturnValues.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_SupplyBad} },
- { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) - 1}, .unReturnValues.stSmGetShutdownReason = {-1, NsmShutdownReason_NotSet} },
- { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) + 1}, .unReturnValues.stSmGetShutdownReason = {-1, NsmShutdownReason_NotSet} },
- { &NSMTST__boDbGetRestartReason, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetRestartReason = {NsmRestartReason_NotSet} },
- { &NSMTST__boSmGetRestartReason, .unParameter.stSmGetRestartReason = {sizeof(NsmRestartReason_e)}, .unReturnValues.stSmGetRestartReason = {sizeof(NsmRestartReason_e), NsmRestartReason_NotSet} },
- { &NSMTST__boSmGetRestartReason, .unParameter.stSmGetRestartReason = {sizeof(NsmRestartReason_e) - 1}, .unReturnValues.stSmGetRestartReason = {-1, NsmRestartReason_NotSet} },
- { &NSMTST__boSmGetRestartReason, .unParameter.stSmGetRestartReason = {sizeof(NsmRestartReason_e) + 1}, .unReturnValues.stSmGetRestartReason = {-1, NsmRestartReason_NotSet} },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_NotSet }, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {(NsmNodeState_e) 0xFFFFFFFF}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_BaseRunning }, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_BaseRunning }, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_LucRunning }, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
- { &NSMTST__boCheckNodeStateSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckNodeStateSignal = {TRUE, NsmNodeState_LucRunning} },
- { &NSMTST__boDbGetNodeState, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetNodeState = {NsmErrorStatus_Ok, NsmNodeState_LucRunning} },
- { &NSMTST__boSmSetNodeState, .unParameter.stSmSetNodeState = {sizeof(NsmNodeState_e), NsmNodeState_FullyRunning}, .unReturnValues.stSmSetNodeState = {NsmErrorStatus_Ok} },
- { &NSMTST__boCheckNodeStateSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckNodeStateSignal = {TRUE, NsmNodeState_FullyRunning} },
- { &NSMTST__boSmSetNodeState, .unParameter.stSmSetNodeState = {3, NsmNodeState_FullyRunning}, .unReturnValues.stSmSetNodeState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetNodeState, .unParameter.stSmSetNodeState = {5, NsmNodeState_FullyRunning}, .unReturnValues.stSmSetNodeState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmGetNodeState, .unParameter.stSmGetNodeState = {sizeof(NsmNodeState_e) }, .unReturnValues.stSmGetNodeState = {sizeof(NsmNodeState_e), NsmNodeState_FullyRunning} },
- { &NSMTST__boSmGetNodeState, .unParameter.stSmGetNodeState = {sizeof(NsmNodeState_e) - 1}, .unReturnValues.stSmGetNodeState = {-1, NsmNodeState_NotSet} },
- { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {NsmApplicationMode_NotSet }, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {(NsmApplicationMode_e) 0xFFFFFFFF}, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {NsmApplicationMode_Parking }, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {NsmApplicationMode_Parking }, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {NsmApplicationMode_Factory }, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Ok} },
- { &NSMTST__boCheckApplicationModeSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckApplicationModeSignal = {TRUE, NsmApplicationMode_Factory} },
- { &NSMTST__boDbGetApplicationMode, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetApplicationMode = {NsmErrorStatus_Ok, NsmApplicationMode_Factory} },
- { &NSMTST__boSmSetApplicationMode, .unParameter.stSmSetApplicationMode = {sizeof(NsmApplicationMode_e), NsmApplicationMode_Transport}, .unReturnValues.stSmSetApplicationMode = {NsmErrorStatus_Ok} },
- { &NSMTST__boCheckApplicationModeSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckApplicationModeSignal = {TRUE, NsmApplicationMode_Transport} },
- { &NSMTST__boSmSetApplicationMode, .unParameter.stSmSetApplicationMode = {3, NsmApplicationMode_Transport}, .unReturnValues.stSmSetApplicationMode = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetApplicationMode, .unParameter.stSmSetApplicationMode = {5, NsmApplicationMode_Transport}, .unReturnValues.stSmSetApplicationMode = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmGetApplicationMode, .unParameter.stSmGetApplicationMode = {sizeof(NsmApplicationMode_e) + 1}, .unReturnValues.stSmGetApplicationMode = {-1, NsmApplicationMode_NotSet} },
- { &NSMTST__boSmGetApplicationMode, .unParameter.stSmGetApplicationMode = {sizeof(NsmApplicationMode_e) }, .unReturnValues.stSmGetApplicationMode = {sizeof(NsmApplicationMode_e), NsmApplicationMode_Transport} },
- { &NSMTST__boDbGetInterfaceVersion, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetInterfaceVersion = {NSM_INTERFACE_VERSION} },
- { &NSMTST__boSmGetInterfaceVersion, .unParameter.stTestDummy = {0x00}, .unReturnValues.stSmGetInterfaceVersion = {NSM_INTERFACE_VERSION} },
- { &NSMTST__boSmSetInvalidData, .unParameter.stSmSetInvalidData = {sizeof(NsmRunningReason_e), NsmDataType_RunningReason}, .unReturnValues.stSmSetInvalidData = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetInvalidData, .unParameter.stSmSetInvalidData = {sizeof(NsmRestartReason_e), NsmDataType_RestartReason}, .unReturnValues.stSmSetInvalidData = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmSetInvalidData, .unParameter.stSmSetInvalidData = {sizeof(NsmRestartReason_e), 0xFFFFFFFF }, .unReturnValues.stSmSetInvalidData = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmGetInvalidData, .unParameter.stSmGetInvalidData = {sizeof(NsmRestartReason_e), 0xFFFFFFFF }, .unReturnValues.stSmGetInvalidData = {-1} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateManager", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {NSMTST__260CHAR_STRING, "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", NSMTST__260CHAR_STRING, NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateTest", NsmSeat_NotSet, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateTest", (NsmSeat_e) 0xFFFFFFFF, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Unregistered}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {NSMTST__260CHAR_STRING, "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_Parameter } },
- { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"VoiceControl", NSMTST__260CHAR_STRING, NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_Parameter } },
- { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_WrongSession} },
- { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"Unknown", "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_WrongSession} },
- { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"VoiceControl", "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_Ok } },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {NSMTST__260CHAR_STRING, "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter } },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", NSMTST__260CHAR_STRING, NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter } },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_WrongSession} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateManager", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Unregistered}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateTest", NsmSeat_NotSet, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateTest", (NsmSeat_e) 0xFFFFFFFF, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active }, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, (NsmSessionState_e) 0x03}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok } },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest02", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Error } },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok } },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_WrongSession} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbGetSessionState, .unParameter.stDbGetSessionState = {NSMTST__260CHAR_STRING, NsmSeat_Driver}, .unReturnValues.stDbGetSessionState = {NsmErrorStatus_Parameter, NsmSessionState_Unregistered } },
- { &NSMTST__boDbGetSessionState, .unParameter.stDbGetSessionState = {"ProductSession", NsmSeat_Driver}, .unReturnValues.stDbGetSessionState = {NsmErrorStatus_Ok, NsmSessionState_Inactive } },
- { &NSMTST__boDbGetSessionState, .unParameter.stDbGetSessionState = {"UnknownSession", NsmSeat_Driver}, .unReturnValues.stDbGetSessionState = {NsmErrorStatus_WrongSession, NsmSessionState_Unregistered} },
- { &NSMTST__boSmGetSessionState, .unParameter.stSmGetSessionState = {sizeof(NsmSession_s), {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmGetSessionState = {sizeof(NsmSession_s), NsmSessionState_Inactive} },
- { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"ProductSession", "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_Ok} },
- { &NSMTST__boSmSetSessionState, .unParameter.stSmSetSessionState = {sizeof(NsmSession_s), {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmSetSessionState = {NsmErrorStatus_WrongSession} },
- { &NSMTST__boSmSetSessionState, .unParameter.stSmSetSessionState = {4, {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmSetSessionState = {NsmErrorStatus_Parameter } },
- { &NSMTST__boSmGetSessionState, .unParameter.stSmGetSessionState = {5, {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmGetSessionState = {-1, NsmSessionState_Unregistered} },
- { &NSMTST__boDbGetAppHealthCount, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetAppHealthCount = {0x00} },
- { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {NSMTST__260CHAR_STRING, TRUE }, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", TRUE }, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Error} },
- { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", FALSE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", TRUE }, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", FALSE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest1", FALSE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", TRUE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"HevacSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", FALSE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbCheckLucRequired, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbCheckLucRequired = {TRUE} },
- { &NSMTST__boDbRequestNodeRestart, .unParameter.stDbRequestNodeRestart = {NsmRestartReason_ApplicationFailure, NSM_SHUTDOWNTYPE_NORMAL}, .unReturnValues.stDbRequestNodeRestart = {NsmErrorStatus_Ok} },
- { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient01"}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient02"}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient03"}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient04"}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient05"}, .unReturnValues.stTestDummy = {0x00} },
- { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient01", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient01", NSM_SHUTDOWNTYPE_FAST, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient02", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient02", NSM_SHUTDOWNTYPE_FAST, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient03", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient04", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient05", NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_FAST, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient06", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbUnRegisterShutdownClient, .unParameter.stDbUnRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient01", NSM_SHUTDOWNTYPE_FAST}, .unReturnValues.stDbUnRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbUnRegisterShutdownClient, .unParameter.stDbUnRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient06", NSM_SHUTDOWNTYPE_NORMAL}, .unReturnValues.stDbUnRegisterShutdownClient = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbUnRegisterShutdownClient, .unParameter.stDbUnRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient07", NSM_SHUTDOWNTYPE_NORMAL}, .unReturnValues.stDbUnRegisterShutdownClient = {NsmErrorStatus_Parameter} },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_ShuttingDown}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok }, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok }, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Error }, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_ResponsePending}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
- { &NSMTST__boDbLifecycleRequestComplete, .unParameter.stDbLifecycleRequestComplete = {NsmErrorStatus_Ok }, .unReturnValues.stDbLifecycleRequestComplete = {NsmErrorStatus_Ok } },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_BaseRunning}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_FastShutdown}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_FAST} },
- { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_BaseRunning}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_FAST} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
- { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"PlatformSupplySession", "NodeStateTest", NsmSeat_Driver, (NsmSessionState_e) 0x02}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boDbGetSessionState, .unParameter.stDbGetSessionState = {"PlatformSupplySession", NsmSeat_Driver}, .unReturnValues.stDbGetSessionState = {NsmErrorStatus_Ok, (NsmSessionState_e) 0x02} },
- { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"PlatformSupplySession", "NodeStateTest", NsmSeat_Driver, (NsmSessionState_e) 0x03}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
- { &NSMTST__boCheckSessionSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckSessionSignal = {TRUE, "PlatformSupplySession", NsmSeat_Driver, (NsmSessionState_e) 0x03 } },
- { &NSMTST__boDbGetSessionState, .unParameter.stDbGetSessionState = {"PlatformSupplySession", NsmSeat_Driver}, .unReturnValues.stDbGetSessionState = {NsmErrorStatus_Ok, (NsmSessionState_e) 0x03} },
- { &NSMTST__boSmRegisterSession, .unParameter.stSmRegisterSession = {sizeof(NsmSession_s), {"StateMachine", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmRegisterSession = {NsmErrorStatus_Ok} },
- { &NSMTST__boCheckSessionSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckSessionSignal = {TRUE, "StateMachine", NsmSeat_Driver, NsmSessionState_Active } },
- { &NSMTST__boSmRegisterSession, .unParameter.stSmRegisterSession = {sizeof(NsmSession_s)-1, {"StateMachine", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmUnRegisterSession, .unParameter.stSmUnRegisterSession = {sizeof(NsmSession_s)-1, {"StateMachine", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmRegisterSession = {NsmErrorStatus_Parameter} },
- { &NSMTST__boSmUnRegisterSession, .unParameter.stSmUnRegisterSession = {sizeof(NsmSession_s), {"StateMachine", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Unregistered}}, .unReturnValues.stSmRegisterSession = {NsmErrorStatus_Ok} },
- { &NSMTST__boCheckSessionSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckSessionSignal = {TRUE, "StateMachine", NsmSeat_Driver, NsmSessionState_Unregistered } }
-};
-
-
-/**********************************************************************************************************************
-*
-* Local (static) functions
-*
-**********************************************************************************************************************/
-
-/**********************************************************************************************************************
-*
-* Helper function to prepare data for StateMachine. Data is read from the passed array and converted into a GVariant.
-*
-* @param pDataArray: Array which should be written to GVariant.
-* @param u32ArraySize: Number of bytes that the array at pDataArray contains.
-*
-* @return GVariant of type "ay" that includes the passed data.
-*
-**********************************************************************************************************************/
-static GVariant* NSMTST__pPrepareStateMachineData(guchar *pDataArray, const guint32 u32ArraySize)
-{
- /* Function local variables */
- guint32 u32ArrayIdx = 0; /* Index to loop through data */
- GVariant **aArrayElements = NULL; /* GVariant elements to build "ay" */
-
- aArrayElements = g_new(GVariant*, u32ArraySize); /* Create new variants */
-
- /* Store bytes in new variants */
- for(u32ArrayIdx = 0; u32ArrayIdx < u32ArraySize; u32ArrayIdx++)
- {
- aArrayElements[u32ArrayIdx] = g_variant_new_byte(pDataArray[u32ArrayIdx]);
- }
-
- /* Return a new varaint array */
- return g_variant_new_array(G_VARIANT_TYPE_BYTE, aArrayElements, u32ArraySize);
-}
-
-/**********************************************************************************************************************
-*
-* Helper function to retrieve StateMachine data from received GVariant.
-*
-* @param pVariantArray: Pointer to the variant that contaions the data.
-* @param pDataArray: Pointer where the bytes from pVariantArray should be stored.
-* The caller has to assert that there are as many bytes reserved as the variant has children.
-*
-**********************************************************************************************************************/
-static void NSMTST__vGetStateMachineData(GVariant *pVariantArray, guchar *pDataArray)
-{
- /* Function local variables */
- guint u32ArrayIdx = 0; /* Index to loop through data */
- GVariant *pArrayElement = NULL; /* Pointer to variant child */
-
- /* Loop through all children iof the source variant */
- for(u32ArrayIdx = 0; u32ArrayIdx < g_variant_n_children(pVariantArray); u32ArrayIdx++)
- {
- /* Get the variant child and get the byte value from it. */
- pArrayElement = g_variant_get_child_value(pVariantArray, u32ArrayIdx);
- pDataArray[u32ArrayIdx] = g_variant_get_byte(pArrayElement);
- }
-
- g_variant_unref(pVariantArray); /* Release the variant */
-}
-
-/**********************************************************************************************************************
-*
-* Test function to get the bus connection.
-*
-* @return TRUE: Test case successful. FALSE: Test case failed.
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boTestGetBusConnection(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL; /* DBus Error */
-
- NSMTST__sTestDescription = g_strdup_printf("Get connection to %s bus.",
- NSM_BUS_TYPE == G_BUS_TYPE_SYSTEM ? "system" : "session");
-
- NSMTST__pConnection = g_bus_get_sync(NSM_BUS_TYPE, NULL, &pError);
-
- if(pError == NULL)
- {
- NSMTST__sBusName = g_dbus_connection_get_unique_name(NSMTST__pConnection);
-
- if(NSMTST__sBusName != NULL)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to get bus name.");
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to get bus connection. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-/**********************************************************************************************************************
-*
-* Test function to create NodeStateConsumer proxy.
-*
-* @return TRUE: Test case successful. FALSE: Test case failed.
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boTestCreateConsumerProxy(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL; /* DBus Error */
-
- /* Write test description */
- NSMTST__sTestDescription = g_strdup("Create NodeStateConsumer proxy.");
-
- NSMTST__pNodeStateConsumer = node_state_consumer_proxy_new_sync(NSMTST__pConnection,
- G_DBUS_PROXY_FLAGS_NONE,
- NSM_BUS_NAME,
- NSM_CONSUMER_OBJECT,
- NULL,
- &pError);
-
- if(pError != NULL)
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create proxy object. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-/**********************************************************************************************************************
-*
-* Test function to create LifecycleControl proxy.
-*
-* @return TRUE: Test case successful. FALSE: Test case failed.
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boTestCreateLifecycleControlProxy(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL; /* DBus Error */
-
- /* Write test description */
- NSMTST__sTestDescription = g_strdup("Create LifecycleControl proxy.");
-
- NSMTST__pLifecycleControl = node_state_lifecycle_control_proxy_new_sync(NSMTST__pConnection,
- G_DBUS_PROXY_FLAGS_NONE,
- NSM_BUS_NAME,
- NSM_LIFECYCLE_OBJECT,
- NULL,
- &pError);
-
- if(pError != NULL)
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create proxy object. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-/**********************************************************************************************************************
-*
-* Test function to create NodeStateMachineTest proxy.
-*
-* @return TRUE: Test case successful. FALSE: Test case failed.
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boTestCreateNodeStateMachineProxy(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL; /* DBus Error */
-
- /* Write test description */
- NSMTST__sTestDescription = g_strdup("Create NodeStateMachine proxy.");
-
- NSMTST__pNodeStateMachine = node_state_test_proxy_new_sync(NSMTST__pConnection,
- G_DBUS_PROXY_FLAGS_NONE,
- NSM_BUS_NAME,
- "/com/contiautomotive/NodeStateMachineTest",
- NULL,
- &pError);
-
- if(pError != NULL)
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create proxy object. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-/**********************************************************************************************************************
-*
-* Test function to register callbacks.
-*
-* @return TRUE: Test case successful. FALSE: Test case failed.
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boTestRegisterCallbacks(void)
-{
- /* Provide test description */
- NSMTST__sTestDescription = g_strdup("Register callbacks for SessionState, NodeState and ApplicationMode signals.");
-
- /* Perform test calls */
- g_signal_connect(NSMTST__pNodeStateConsumer, "node-state", G_CALLBACK(NSMTST__boOnNodeStateSignal), NULL);
- g_signal_connect(NSMTST__pNodeStateConsumer, "node-application-mode", G_CALLBACK(NSMTST__boOnApplicationModeSignal), NULL);
- g_signal_connect(NSMTST__pNodeStateConsumer, "session-state-changed", G_CALLBACK(NSMTST__boOnSessionSignal), NULL);
-
- return TRUE;
-}
-
-/**********************************************************************************************************************
-*
-* Test function for trying to set invalid data via the (internal) NsmSetData of the NSM.
-*
-* @return TRUE: Test case successful. FALSE: Test case failed.
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boSmSetInvalidData(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set invalid data. Interface: StateMachine.");
-
- /* Perform test call */
- pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
- (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
- NSMTST__pstTestCase->unParameter.stSmSetInvalidData.enDataType,
- pDataIn,
- NSMTST__pstTestCase->unParameter.stSmSetInvalidData.u32DataLen,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmSetInvalidData.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmSetInvalidData.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmGetInvalidData(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- GVariant *pDataOut = NULL;
- gint i32ReceivedNsmReturn = -1;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Get invalid data. Interface: StateMachine.");
-
- /* Perform test call */
- pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
- (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
- NSMTST__pstTestCase->unParameter.stSmGetInvalidData.enDataType,
- pDataIn,
- NSMTST__pstTestCase->unParameter.stSmGetInvalidData.u32DataLen,
- &pDataOut,
- &i32ReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
- g_variant_unref(pDataOut);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(i32ReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmGetInvalidData.i32WrittenBytes)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- i32ReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmGetInvalidData.i32WrittenBytes);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbGetRestartReason(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- NsmRestartReason_e enReceivedRestartReason = NsmRestartReason_NotSet; /* Value returned by NSM */
- NsmRestartReason_e enExpectedRestartReason = NsmRestartReason_NotSet; /* Expected value */
-
- enExpectedRestartReason = NSMTST__pstTestCase->unReturnValues.stDbGetRestartReason.enRestartReason;
-
- /* Provide test description */
- NSMTST__sTestDescription = g_strdup_printf("Get RestartReason. Interface: D-Bus. Expected value: 0x%02X.",
- enExpectedRestartReason);
-
- enReceivedRestartReason = (NsmRestartReason_e) node_state_consumer_get_restart_reason(NSMTST__pNodeStateConsumer);
-
- if(enReceivedRestartReason != enExpectedRestartReason)
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedRestartReason, enExpectedRestartReason);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbGetShutdownReason(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- NsmShutdownReason_e enReceivedShutdownReason = NsmShutdownReason_NotSet; /* Value returned by NSM */
- NsmShutdownReason_e enExpectedShutdownReason = NsmShutdownReason_NotSet; /* Expected value */
-
- enExpectedShutdownReason = NSMTST__pstTestCase->unReturnValues.stDbGetShutdownReason.enShutdownReason;
-
- NSMTST__sTestDescription = g_strdup_printf("Get ShutdownReason. Interface: D-Bus. Expected value: 0x%02X.",
- enExpectedShutdownReason);
-
- enReceivedShutdownReason = (NsmShutdownReason_e) node_state_consumer_get_shutdown_reason(NSMTST__pNodeStateConsumer);
-
- if(enReceivedShutdownReason != enExpectedShutdownReason)
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedShutdownReason, enExpectedShutdownReason);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbGetRunningReason(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- NsmRunningReason_e enReceivedRunningReason = NsmShutdownReason_NotSet; /* Value returned by NSM */
-
- /* Provide test description */
- NSMTST__sTestDescription = g_strdup_printf("Get RunningReason. Interface: D-Bus. Expected value: 0x%02X.",
- NSMTST__pstTestCase->unReturnValues.stDbGetRunningReason.enRunningReason);
-
- enReceivedRunningReason = (NsmRunningReason_e) node_state_consumer_get_wake_up_reason(NSMTST__pNodeStateConsumer);
-
- if(enReceivedRunningReason != NSMTST__pstTestCase->unReturnValues.stDbGetRunningReason.enRunningReason)
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedRunningReason, NSMTST__pstTestCase->unReturnValues.stDbGetRunningReason.enRunningReason);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbGetBootMode(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- gint i32ReceivedBootMode = 0x00; /* Value returned by NSM */
- gint i32ExpectedBootMode = 0x00; /* Expected value */
-
- i32ExpectedBootMode = NSMTST__pstTestCase->unReturnValues.stDbGetBootMode.i32BootMode;
-
- /* Provide test description */
- NSMTST__sTestDescription = g_strdup_printf("Get BootMode. Interface: D-Bus. Expected value: 0x%02X.",
- i32ExpectedBootMode);
-
- i32ReceivedBootMode = (gint) node_state_consumer_get_boot_mode(NSMTST__pNodeStateConsumer);
-
- if(i32ReceivedBootMode != i32ExpectedBootMode)
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: 0x%02X. Expected: 0x%02X.",
- i32ReceivedBootMode, i32ExpectedBootMode);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmGetApplicationMode(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- GVariant *pDataOut = NULL;
- gint i32ReceivedNsmReturn = -1;
- gchar *sExpectedValue = NULL;
- guint u32ReceivedDataLen = 0x00;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetApplicationMode.u32DataLen;
-
- /* Values read from return config */
- const gint i32ExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmGetApplicationMode.i32WrittenBytes;
- const NsmApplicationMode_e enExpectedApplicationMode = NSMTST__pstTestCase->unReturnValues.stSmGetApplicationMode.enApplicationMode;
-
- /* Variables need to adapt test case */
- NsmApplicationMode_e enReceivedApplicationMode = NsmApplicationMode_NotSet; /* Value returned by NSM */
- const gchar *sNsmValue = "ApplicationMode";
- const NsmDataType_e enDataType = NsmDataType_AppMode;
- const guint u32RealDataLen = sizeof(NsmApplicationMode_e);
-
- /* Create test case description */
- sExpectedValue = (u32DataLen == u32RealDataLen)
- ? g_strdup_printf("0x%02X", enExpectedApplicationMode)
- : g_strdup_printf("%s", "-");
-
- NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
- sNsmValue, u32DataLen, sExpectedValue);
- g_free(sExpectedValue);
-
- /* Perform test call */
- pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
- (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- &pDataOut,
- &i32ReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(i32ReceivedNsmReturn == i32ExpectedNsmReturn)
- {
- /* The NSM returned with the expected value. Check if the value should be valid. */
- if(u32DataLen == u32RealDataLen)
- {
- /* We called the NSM with the correct DataLen. Check the received value. */
- u32ReceivedDataLen = g_variant_n_children(pDataOut);
- if(u32RealDataLen == u32ReceivedDataLen)
- {
- NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedApplicationMode);
- if(enReceivedApplicationMode == enExpectedApplicationMode)
- {
-
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
- sNsmValue, enReceivedApplicationMode, enExpectedApplicationMode);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
- u32ReceivedDataLen, u32RealDataLen);
- }
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- i32ReceivedNsmReturn, i32ExpectedNsmReturn);
- }
-
- g_variant_unref(pDataOut);
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmGetNodeState(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- GVariant *pDataOut = NULL;
- gint i32ReceivedNsmReturn = -1;
- gchar *sExpectedValue = NULL;
- guint u32ReceivedDataLen = 0x00;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetNodeState.u32DataLen;
-
- /* Values read from return config */
- const gint i32ExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmGetNodeState.i32WrittenBytes;
- const NsmNodeState_e enExpectedNodeState = NSMTST__pstTestCase->unReturnValues.stSmGetNodeState.enNodeState;
-
- /* Variables need to adapt test case */
- NsmNodeState_e enReceivedNodeState = NsmNodeState_NotSet; /* Value returned by NSM */
- const gchar *sNsmValue = "NodeState";
- const NsmDataType_e enDataType = NsmDataType_NodeState;
- const guint u32RealDataLen = sizeof(NsmNodeState_e);
-
- /* Create test case description */
- sExpectedValue = (u32DataLen == sizeof(NsmNodeState_e))
- ? g_strdup_printf("0x%02X", enExpectedNodeState)
- : g_strdup_printf("%s", "-");
-
- NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
- sNsmValue, u32DataLen, sExpectedValue);
- g_free(sExpectedValue);
-
- /* Perform test call */
- pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
- (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- &pDataOut,
- &i32ReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(i32ReceivedNsmReturn == i32ExpectedNsmReturn)
- {
- /* The NSM returned with the expected value. Check if the value should be valid. */
- if(u32DataLen == u32RealDataLen)
- {
- /* We called the NSM with the correct DataLen. Check the received value. */
- u32ReceivedDataLen = g_variant_n_children(pDataOut);
- if(u32RealDataLen == u32ReceivedDataLen)
- {
- NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedNodeState);
- if(enReceivedNodeState == enExpectedNodeState)
- {
-
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
- sNsmValue, enReceivedNodeState, enExpectedNodeState);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
- u32ReceivedDataLen, u32RealDataLen);
- }
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- i32ReceivedNsmReturn, i32ExpectedNsmReturn);
- }
-
- g_variant_unref(pDataOut);
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmGetRestartReason(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- GVariant *pDataOut = NULL;
- gint i32ReceivedNsmReturn = 0x00;
- gchar *sExpectedValue = NULL;
- guint u32ReceivedDataLen = 0x00;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetRestartReason.u32DataLen;
-
- /* Values read from return config */
- const NsmRestartReason_e enExpectedRestartReason = NSMTST__pstTestCase->unReturnValues.stSmGetRestartReason.enRestartReason;
-
- /* Variables need to adapt test case */
- NsmRestartReason_e enReceivedRestartReason = NsmRestartReason_NotSet; /* Value returned by NSM */
- const gchar *sNsmValue = "RestartReason";
- const NsmDataType_e enDataType = NsmDataType_RestartReason;
- const guint u32RealDataLen = sizeof(NsmRestartReason_e);
-
- /* Create test case description */
- sExpectedValue = (u32DataLen == u32RealDataLen)
- ? g_strdup_printf("0x%02X", enExpectedRestartReason)
- : g_strdup_printf("%s", "-");
-
- NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
- sNsmValue, u32DataLen, sExpectedValue);
- g_free(sExpectedValue);
-
- /* Perform test call */
- pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
- (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- &pDataOut,
- &i32ReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(i32ReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmGetRestartReason.i32WrittenBytes)
- {
- /* The NSM returned with the expected value. Check if the value should be valid. */
- if(u32DataLen == u32RealDataLen)
- {
- /* We called the NSM with the correct DataLen. Check the received value. */
- u32ReceivedDataLen = g_variant_n_children(pDataOut);
- if(u32RealDataLen == u32ReceivedDataLen)
- {
- NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedRestartReason);
- if(enReceivedRestartReason == enExpectedRestartReason)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
- sNsmValue, enReceivedRestartReason, enExpectedRestartReason);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
- u32ReceivedDataLen, u32RealDataLen);
- }
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- i32ReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmGetRestartReason.i32WrittenBytes);
- }
-
- g_variant_unref(pDataOut);
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmGetSessionState(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- GVariant *pDataOut = NULL;
- gint i32ReceivedNsmReturn = -1;
- gchar *sExpectedValue = NULL;
- guint u32ReceivedDataLen = 0x00;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetSessionState.u32DataLen;
-
- /* Values read from return config */
- const gint i32ExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmGetSessionState.i32WrittenBytes;
- const NsmSessionState_e enExpectedSessionState = NSMTST__pstTestCase->unReturnValues.stSmGetSessionState.enSessionState;
-
- /* Variables need to adapt test case */
- NsmSession_s stReceivedSession; /* Value returned by NSM */
- const gchar *sNsmValue = "SessionState";
- const NsmDataType_e enDataType = NsmDataType_SessionState;
- const guint u32RealDataLen = sizeof(NsmSession_s);
-
- /* Create test case description */
- sExpectedValue = (u32DataLen == u32RealDataLen)
- ? g_strdup_printf("0x%02X", NSMTST__pstTestCase->unParameter.stSmGetSessionState.sSession.enState)
- : g_strdup_printf("%s", "-");
-
- NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
- sNsmValue, u32DataLen, sExpectedValue);
- g_free(sExpectedValue);
-
- /* Perform test call */
- pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &(NSMTST__pstTestCase->unParameter.stSmGetSessionState.sSession), u32RealDataLen);
- (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- &pDataOut,
- &i32ReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(i32ExpectedNsmReturn == i32ReceivedNsmReturn)
- {
- /* The NSM returned with the expected value. Check if the value should be valid. */
- if(u32DataLen == u32RealDataLen)
- {
- /* We called the NSM with the correct DataLen. Check the received value. */
- u32ReceivedDataLen = g_variant_n_children(pDataOut);
- if(u32RealDataLen == u32ReceivedDataLen)
- {
- NSMTST__vGetStateMachineData(pDataOut, (guchar*) &stReceivedSession);
- if(enExpectedSessionState == stReceivedSession.enState)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
- sNsmValue, stReceivedSession.enState, enExpectedSessionState);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
- u32ReceivedDataLen, u32RealDataLen);
- }
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: %d. Expected: %d.",
- i32ReceivedNsmReturn, i32ExpectedNsmReturn);
- }
-
- g_variant_unref(pDataOut);
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-static gboolean NSMTST__boSmGetShutdownReason(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- GVariant *pDataOut = NULL;
- gint i32ReceivedNsmReturn = -1;
- gchar *sExpectedValue = NULL;
- guint u32ReceivedDataLen = 0x00;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetShutdownReason.u32DataLen;
-
- /* Values read from return config */
- const gint i32ExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmGetShutdownReason.i32WrittenBytes;
- const NsmShutdownReason_e enExpectedShutdownReason = NSMTST__pstTestCase->unReturnValues.stSmGetShutdownReason.enShutdownReason;
-
- /* Variables need to adapt test case */
- NsmShutdownReason_e enReceivedShutdownReason = NsmShutdownReason_NotSet; /* Value returned by NSM */
- const gchar *sNsmValue = "ShutdownReason";
- const NsmDataType_e enDataType = NsmDataType_ShutdownReason;
- const guint u32RealDataLen = sizeof(NsmShutdownReason_e);
-
- /* Create test case description */
- sExpectedValue = (u32DataLen == u32RealDataLen)
- ? g_strdup_printf("0x%02X", enExpectedShutdownReason)
- : g_strdup_printf("%s", "-");
-
- NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
- sNsmValue, u32DataLen, sExpectedValue);
- g_free(sExpectedValue);
-
- /* Perform test call */
- pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
- (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- &pDataOut,
- &i32ReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(i32ReceivedNsmReturn == i32ExpectedNsmReturn)
- {
- /* The NSM returned with the expected value. Check if the value should be valid. */
- if(u32DataLen == u32RealDataLen)
- {
- /* We called the NSM with the correct DataLen. Check the received value. */
- u32ReceivedDataLen = g_variant_n_children(pDataOut);
- if(u32RealDataLen == u32ReceivedDataLen)
- {
- NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedShutdownReason);
- if(enReceivedShutdownReason == enExpectedShutdownReason)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
- sNsmValue, enReceivedShutdownReason, enExpectedShutdownReason);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
- u32ReceivedDataLen, u32RealDataLen);
- }
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- i32ReceivedNsmReturn, i32ExpectedNsmReturn);
- }
-
- g_variant_unref(pDataOut);
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmGetBootMode(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn, *pDataOut = NULL;
- gint i32ReceivedNsmReturn = -1;
- gchar *sExpectedValue = NULL;
- guint u32ReceivedDataLen = 0x00;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetBootMode.u32DataLen;
-
- /* Values read from return config */
- const gint i32ExpectedBootMode = NSMTST__pstTestCase->unReturnValues.stSmGetBootMode.i32BootMode;
-
- /* Variables need to adapt test case */
- gint i32ReceivedBootMode = 0x00; /* Value returned by NSM */
- const gchar *sNsmValue = "BootMode";
- const NsmDataType_e enDataType = NsmDataType_BootMode;
- const guint u32RealDataLen = sizeof(gint);
-
- /* Create test case description */
- sExpectedValue = (u32DataLen == u32RealDataLen)
- ? g_strdup_printf("0x%02X", i32ExpectedBootMode)
- : g_strdup_printf("%s", "-");
-
- NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
- sNsmValue, u32DataLen, sExpectedValue);
- g_free(sExpectedValue);
-
- /* Perform test call */
- pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
- (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- &pDataOut,
- &i32ReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(i32ReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmGetBootMode.i32WrittenBytes)
- {
- /* The NSM returned with the expected value. Check if the value should be valid. */
- if(u32DataLen == u32RealDataLen)
- {
- /* We called the NSM with the correct DataLen. Check the received value. */
- u32ReceivedDataLen = g_variant_n_children(pDataOut);
- if(u32RealDataLen == u32ReceivedDataLen)
- {
- NSMTST__vGetStateMachineData(pDataOut, (guchar*) &i32ReceivedBootMode);
- if(i32ReceivedBootMode == i32ExpectedBootMode)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
- sNsmValue, i32ReceivedBootMode, i32ExpectedBootMode);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
- u32ReceivedDataLen, u32RealDataLen);
- }
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- i32ReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmGetBootMode.i32WrittenBytes);
- }
-
- g_variant_unref(pDataOut);
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmGetRunningReason(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- GVariant *pDataOut = NULL;
- gint i32ReceivedNsmReturn = -1;
- gchar *sExpectedValue = NULL;
- guint u32ReceivedDataLen = 0x00;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetRunningReason.u32DataLen;
-
- /* Values read from return config */
- const NsmRunningReason_e enExpectedRunningReason = NSMTST__pstTestCase->unReturnValues.stSmGetRunningReason.enRunningReason;
-
- /* Variables need to adapt test case */
- NsmRunningReason_e enReceivedRunningReason = NsmRunningReason_NotSet; /* Value returned by NSM */
- const gchar *sNsmValue = "RunningReason";
- const NsmDataType_e enDataType = NsmDataType_RunningReason;
- const guint u32RealDataLen = sizeof(NsmRunningReason_e);
-
- /* Create test case description */
- sExpectedValue = (u32DataLen == u32RealDataLen)
- ? g_strdup_printf("0x%02X", enExpectedRunningReason)
- : g_strdup_printf("%s", "-");
-
- NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
- sNsmValue, u32DataLen, sExpectedValue);
- g_free(sExpectedValue);
-
- /* Perform test call */
- pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
- (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- &pDataOut,
- &i32ReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(i32ReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmGetRunningReason.i32WrittenBytes)
- {
- /* The NSM returned with the expected value. Check if the value should be valid. */
- if(u32DataLen == u32RealDataLen)
- {
- /* We called the NSM with the correct DataLen. Check the received value. */
- u32ReceivedDataLen = g_variant_n_children(pDataOut);
- if(u32RealDataLen == u32ReceivedDataLen)
- {
- NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedRunningReason);
- if(enReceivedRunningReason == enExpectedRunningReason)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
- sNsmValue, enReceivedRunningReason, enExpectedRunningReason);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
- u32ReceivedDataLen, u32RealDataLen);
- }
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: %d. Expected: %d.",
- i32ReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmGetRunningReason.i32WrittenBytes);
- }
-
- g_variant_unref(pDataOut);
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-
-static gboolean NSMTST__boSmSetApplicationMode(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetApplicationMode.u32DataLen;
- const NsmApplicationMode_e enApplicationMode = NSMTST__pstTestCase->unParameter.stSmSetApplicationMode.enApplicationMode;
-
- /* Values read from return config */
- const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetApplicationMode.enErrorStatus;
-
- /* Variables need to adapt test case */
- const gchar *sNsmValue = "ApplicationMode";
- const NsmDataType_e enDataType = NsmDataType_AppMode;
- const guint u32RealDataLen = sizeof(NsmApplicationMode_e);
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
- sNsmValue, u32DataLen);
-
- /* Perform test call */
- pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &enApplicationMode, u32RealDataLen);
- (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == enExpectedNsmReturn)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, enExpectedNsmReturn);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmSetNodeState(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetNodeState.u32DataLen;
- const NsmNodeState_e enNodeState = NSMTST__pstTestCase->unParameter.stSmSetNodeState.enNodeState;
-
- /* Values read from return config */
- const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetNodeState.enErrorStatus;
-
- /* Variables need to adapt test case */
- const gchar *sNsmValue = "NodeState";
- const NsmDataType_e enDataType = NsmDataType_NodeState;
- const guint u32RealDataLen = sizeof(NsmNodeState_e);
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
- sNsmValue, u32DataLen);
-
- /* Perform test call */
- pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &enNodeState, u32RealDataLen);
- (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == enExpectedNsmReturn)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, enExpectedNsmReturn);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-static gboolean NSMTST__boSmSetSessionState(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetSessionState.u32DataLen;
- const NsmSession_s stSession = NSMTST__pstTestCase->unParameter.stSmSetSessionState.stSession;
-
- /* Values read from return config */
- const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetSessionState.enErrorStatus;
-
- /* Variables need to adapt test case */
- const gchar *sNsmValue = "SessionState";
- const NsmDataType_e enDataType = NsmDataType_SessionState;
- const guint u32RealDataLen = sizeof(NsmSession_s);
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
- sNsmValue, u32DataLen);
- /* Perform test call */
- pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &stSession, u32RealDataLen);
- (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == enExpectedNsmReturn)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, enExpectedNsmReturn);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-static gboolean NSMTST__boSmRegisterSession(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmRegisterSession.u32DataLen;
- const NsmSession_s stSession = NSMTST__pstTestCase->unParameter.stSmRegisterSession.stSession;
-
- /* Values read from return config */
- const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmRegisterSession.enErrorStatus;
-
- /* Variables need to adapt test case */
- const gchar *sNsmValue = "RegisterSession";
- const NsmDataType_e enDataType = NsmDataType_RegisterSession;
- const guint u32RealDataLen = sizeof(NsmSession_s);
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
- sNsmValue, u32DataLen);
- /* Perform test call */
- pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &stSession, u32RealDataLen);
- (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == enExpectedNsmReturn)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, enExpectedNsmReturn);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmUnRegisterSession(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmUnRegisterSession.u32DataLen;
- const NsmSession_s stSession = NSMTST__pstTestCase->unParameter.stSmUnRegisterSession.stSession;
-
- /* Values read from return config */
- const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmUnRegisterSession.enErrorStatus;
-
- /* Variables need to adapt test case */
- const gchar *sNsmValue = "UnRegisterSession";
- const NsmDataType_e enDataType = NsmDataType_UnRegisterSession;
- const guint u32RealDataLen = sizeof(NsmSession_s);
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
- sNsmValue, u32DataLen);
- /* Perform test call */
- pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &stSession, u32RealDataLen);
- (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == enExpectedNsmReturn)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, enExpectedNsmReturn);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-static gboolean NSMTST__boSmSetShutdownReason(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetShutdownReason.u32DataLen;
- const NsmShutdownReason_e enShutdownReason = NSMTST__pstTestCase->unParameter.stSmSetShutdownReason.enShutdownReason;
-
- /* Values read from return config */
- const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetShutdownReason.enErrorStatus;
-
- /* Variables need to adapt test case */
- const gchar *sNsmValue = "ShutdownReason";
- const NsmDataType_e enDataType = NsmDataType_ShutdownReason;
- const guint u32RealDataLen = sizeof(NsmShutdownReason_e);
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
- sNsmValue, u32DataLen);
-
- /* Perform test call */
- pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &enShutdownReason, u32RealDataLen);
- (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == enExpectedNsmReturn)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, enExpectedNsmReturn);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmSetBootMode(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- GVariant *pDataIn = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Values read from parameter config */
- const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetBootMode.u32DataLen;
- const gint i32BootMode = NSMTST__pstTestCase->unParameter.stSmSetBootMode.i32BootMode;
-
- /* Values read from return config */
- const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetBootMode.enErrorStatus;
-
- /* Variables need to adapt test case */
- const gchar *sNsmValue = "BootMode";
- const NsmDataType_e enDataType = NsmDataType_BootMode;
- const guint u32RealDataLen = sizeof(NsmDataType_BootMode);
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
- sNsmValue, u32DataLen);
-
- /* Perform test call */
- pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &i32BootMode, u32RealDataLen);
- (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
- enDataType,
- pDataIn,
- u32DataLen,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- g_variant_unref(pDataIn);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == enExpectedNsmReturn)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, enExpectedNsmReturn);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbSetApplicationMode(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Values read from config */
- const NsmApplicationMode_e enApplicationMode = NSMTST__pstTestCase->unParameter.stDbSetApplicationMode.enApplicationMode;
- const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stDbSetApplicationMode.enErrorStatus;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set ApplicationMode. Interface: D-Bus. Value: 0x%02X.", enApplicationMode);
-
- /* Perform test call */
- (void) node_state_lifecycle_control_call_set_application_mode_sync(NSMTST__pLifecycleControl,
- (gint) enApplicationMode,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == enExpectedNsmReturn)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, enExpectedNsmReturn);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbSetBootMode(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set BootMode. Interface: D-Bus. Value: 0x%02X.",
- NSMTST__pstTestCase->unParameter.stDbSetBootMode.i32BootMode);
-
- /* Perform test call */
- (void) node_state_lifecycle_control_call_set_boot_mode_sync(NSMTST__pLifecycleControl,
- (gint) NSMTST__pstTestCase->unParameter.stDbSetBootMode.i32BootMode,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbSetBootMode.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbSetBootMode.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-
-static gboolean NSMTST__boDbSetNodeState(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set NodeState. Interface: D-Bus. Value: 0x%02X.",
- NSMTST__pstTestCase->unParameter.stDbSetNodeState.enNodeState);
-
- /* Perform test call */
- (void) node_state_lifecycle_control_call_set_node_state_sync(NSMTST__pLifecycleControl,
- (gint) NSMTST__pstTestCase->unParameter.stDbSetNodeState.enNodeState,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbSetNodeState.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbSetNodeState.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-static gboolean NSMTST__boDbSetSessionState(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set SessionState. Interface: D-Bus. Value: (SessionName: %s. SessionOwner: %s. Seat: 0x%02X. State: 0x%02X.).",
- NSMTST__pstTestCase->unParameter.stDbSetSessionState.sSessionName,
- NSMTST__pstTestCase->unParameter.stDbSetSessionState.sSessionOwner,
- NSMTST__pstTestCase->unParameter.stDbSetSessionState.enSeat,
- NSMTST__pstTestCase->unParameter.stDbSetSessionState.enState);
-
- /* Perform test call */
- (void) node_state_consumer_call_set_session_state_sync(NSMTST__pNodeStateConsumer,
- (gchar*) NSMTST__pstTestCase->unParameter.stDbSetSessionState.sSessionName,
- (gchar*) NSMTST__pstTestCase->unParameter.stDbSetSessionState.sSessionOwner,
- (gint) NSMTST__pstTestCase->unParameter.stDbSetSessionState.enSeat,
- (gint) NSMTST__pstTestCase->unParameter.stDbSetSessionState.enState,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbSetSessionState.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbSetSessionState.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-
-/*********************************************** Get simple value via D-Bus ******************************************/
-
-static gboolean NSMTST__boDbGetApplicationMode(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
- NsmApplicationMode_e enReceivedApplicationMode = NsmApplicationMode_NotSet;
-
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Get ApplicationMode. Interface: D-Bus. Expected value: 0x%02X.",
- NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enApplicationMode);
-
- /* Perform test call */
- (void) node_state_consumer_call_get_application_mode_sync(NSMTST__pNodeStateConsumer,
- (gint*) &enReceivedApplicationMode,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enErrorStatus)
- {
- if(enReceivedApplicationMode == NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enApplicationMode)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected ApplicationMode. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedApplicationMode, NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enApplicationMode);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbGetNodeState(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
- NsmNodeState_e enReceivedNodeState = NsmApplicationMode_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Get NodeState. Interface: D-Bus. Expected value: 0x%02X.",
- NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enNodeState);
-
- /* Perform test call */
- (void) node_state_consumer_call_get_node_state_sync(NSMTST__pNodeStateConsumer,
- (gint*) &enReceivedNodeState,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enErrorStatus)
- {
- if(enReceivedNodeState == NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enNodeState)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NodeState. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNodeState, NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enNodeState);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enNodeState);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbGetSessionState(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
- NsmSessionState_e enReceivedSessionState = NsmSessionState_Unregistered;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Get SessionState. Interface: D-Bus.");
-
- /* Perform test call */
- (void) node_state_consumer_call_get_session_state_sync(NSMTST__pNodeStateConsumer,
- (gchar*) NSMTST__pstTestCase->unParameter.stDbGetSessionState.sSessionName,
- (gint) NSMTST__pstTestCase->unParameter.stDbGetSessionState.enSeat,
- (gint*) &enReceivedSessionState,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbGetSessionState.enErrorStatus)
- {
- if(enReceivedSessionState == NSMTST__pstTestCase->unReturnValues.stDbGetSessionState.enSessionState)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NodeState. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedSessionState, NSMTST__pstTestCase->unReturnValues.stDbGetSessionState.enSessionState);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbGetSessionState.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbGetAppHealthCount(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- guint u32ReceivedAppHealthCount = 0x00;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Get AppHealthCount. Interface: D-Bus.");
-
- /* Perform test call */
- (void) node_state_consumer_call_get_app_health_count_sync(NSMTST__pNodeStateConsumer,
- &u32ReceivedAppHealthCount,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(u32ReceivedAppHealthCount == NSMTST__pstTestCase->unReturnValues.stDbGetAppHealthCount.u32AppHealthCount)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected AppHealthCount. Received: %d. Expected: %d.",
- u32ReceivedAppHealthCount, NSMTST__pstTestCase->unReturnValues.stDbGetAppHealthCount.u32AppHealthCount);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbGetInterfaceVersion(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- guint u32ReceivedInterfaceVersion = 0x00;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Get InterfaceVersion. Interface: D-Bus.");
-
- /* Perform test call */
- (void) node_state_consumer_call_get_interface_version_sync(NSMTST__pNodeStateConsumer,
- &u32ReceivedInterfaceVersion,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(u32ReceivedInterfaceVersion == NSMTST__pstTestCase->unReturnValues.stDbGetInterfaceVersion.u32InterfaceVersion)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected InterfaceVersion. Received: %i. Expected: %i.",
- u32ReceivedInterfaceVersion,
- NSMTST__pstTestCase->unReturnValues.stDbGetInterfaceVersion.u32InterfaceVersion);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-/*********************************************** Call methods via D-Bus *********************************************/
-
-static gboolean NSMTST__boDbRegisterSession(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Register Session. Interface: D-Bus. Value: (SessionName: %s. SessionOwner: %s. Seat: 0x%02X. State: 0x%02X.).",
- NSMTST__pstTestCase->unParameter.stDbRegisterSession.sSessionName,
- NSMTST__pstTestCase->unParameter.stDbRegisterSession.sSessionOwner,
- NSMTST__pstTestCase->unParameter.stDbRegisterSession.enSeat,
- NSMTST__pstTestCase->unParameter.stDbRegisterSession.enState);
-
- /* Perform test call */
- (void) node_state_consumer_call_register_session_sync(NSMTST__pNodeStateConsumer,
- (gchar*) NSMTST__pstTestCase->unParameter.stDbRegisterSession.sSessionName,
- (gchar*) NSMTST__pstTestCase->unParameter.stDbRegisterSession.sSessionOwner,
- (gint) NSMTST__pstTestCase->unParameter.stDbRegisterSession.enSeat,
- (gint) NSMTST__pstTestCase->unParameter.stDbRegisterSession.enState,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbRegisterSession.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbRegisterSession.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbUnRegisterSession(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Unregister Session. Interface: D-Bus. Value: (SessionName: %s. SessionOwner: %s. Seat: 0x%02X.).",
- NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.sSessionName,
- NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.sSessionOwner,
- NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.enSeat);
-
- /* Perform test call */
- (void) node_state_consumer_call_un_register_session_sync(NSMTST__pNodeStateConsumer,
- (gchar*) NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.sSessionName,
- (gchar*) NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.sSessionOwner,
- (gint) NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.enSeat,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbUnRegisterSession.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbUnRegisterSession.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbRegisterShutdownClient(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Register shutdown client. Interface: D-Bus. Value: (BusName: %s. ObjName: %s. Mode: 0x%04X. Timeout: %d.).",
- NSMTST__sBusName,
- NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.sObjName,
- NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.u32Mode,
- NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.u32Timeout);
-
- /* Perform test call */
- (void) node_state_consumer_call_register_shutdown_client_sync(NSMTST__pNodeStateConsumer,
- NSMTST__sBusName,
- NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.sObjName,
- NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.u32Mode,
- NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.u32Timeout,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbRegisterShutdownClient.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbRegisterShutdownClient.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbUnRegisterShutdownClient(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Unregister shutdown client. Interface: D-Bus. Value: (BusName: %s. ObjName: %s. Mode: 0x%04X.).",
- NSMTST__sBusName,
- NSMTST__pstTestCase->unParameter.stDbUnRegisterShutdownClient.sObjName,
- NSMTST__pstTestCase->unParameter.stDbUnRegisterShutdownClient.u32Mode);
-
- /* Perform test call */
- (void) node_state_consumer_call_un_register_shutdown_client_sync(NSMTST__pNodeStateConsumer,
- NSMTST__sBusName,
- NSMTST__pstTestCase->unParameter.stDbUnRegisterShutdownClient.sObjName,
- NSMTST__pstTestCase->unParameter.stDbUnRegisterShutdownClient.u32Mode,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbUnRegisterShutdownClient.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbUnRegisterShutdownClient.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-
-static gboolean NSMTST__boDbRequestNodeRestart(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Request Node Restart. Interface: D-Bus. Value: (RestartReason: 0x%02X. RestartType: 0x%04X.).",
- NSMTST__pstTestCase->unParameter.stDbRequestNodeRestart.enRestartReason,
- NSMTST__pstTestCase->unParameter.stDbRequestNodeRestart.u32RestartType);
-
- /* Perform test call */
- (void) node_state_lifecycle_control_call_request_node_restart_sync(NSMTST__pLifecycleControl,
- NSMTST__pstTestCase->unParameter.stDbRequestNodeRestart.enRestartReason,
- NSMTST__pstTestCase->unParameter.stDbRequestNodeRestart.u32RestartType,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbRequestNodeRestart.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbRequestNodeRestart.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbSetAppHealthStatus(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Set AppHealthStatus. Interface: D-Bus. Value: (AppName: %s. AppRunning: %s.).",
- NSMTST__pstTestCase->unParameter.stDbSetAppHealthStatus.sAppName,
- (NSMTST__pstTestCase->unParameter.stDbSetAppHealthStatus.boAppRunning == TRUE) ? "true" : "false");
-
- /* Perform test call */
- (void) node_state_lifecycle_control_call_set_app_health_status_sync(NSMTST__pLifecycleControl,
- NSMTST__pstTestCase->unParameter.stDbSetAppHealthStatus.sAppName,
- NSMTST__pstTestCase->unParameter.stDbSetAppHealthStatus.boAppRunning,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbSetAppHealthStatus.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbSetAppHealthStatus.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boSmGetInterfaceVersion(void)
-{
- /* Function local variables */
- gboolean boRetVal = TRUE; /* Return value */
- GError *pError = NULL;
- guint u32ReceivedInterfaceVersion = 0;
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Get InterfaceVersion. Interface: StateMachine.");
-
- /* Perform test call */
- (void) node_state_test_call_get_nsm_interface_version_sync(NSMTST__pNodeStateMachine,
- &u32ReceivedInterfaceVersion,
- NULL,
- &pError);
-
- /* Evaluate result. Check if a D-Bus error occurred. */
- if(pError == NULL)
- {
- /* D-Bus communication successful. Check if NSM returned with the expected value. */
- if(u32ReceivedInterfaceVersion == NSMTST__pstTestCase->unReturnValues.stSmGetInterfaceVersion.u32InterfaceVersion)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected InterfaceVersion. Received: 0x%02X. Expected: 0x%02X.",
- u32ReceivedInterfaceVersion, NSMTST__pstTestCase->unReturnValues.stSmGetInterfaceVersion.u32InterfaceVersion);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
- pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boCheckSessionSignal(void)
-{
- /* Function local variables */
- gboolean boRetVal = FALSE; /* Return value */
-
- /* Create test case description */
- NSMTST__sTestDescription = g_strdup_printf("Check for Session signal.");
-
- /* Compare the received with the expected values */
- if( (NSMTST__pstTestCase->unReturnValues.stCheckSessionSignal.boReceived == NSMTST__stReceivedSessionSignal.boReceived )
- && (NSMTST__pstTestCase->unReturnValues.stCheckSessionSignal.enSeat == NSMTST__stReceivedSessionSignal.enSeat )
- && (NSMTST__pstTestCase->unReturnValues.stCheckSessionSignal.enState == NSMTST__stReceivedSessionSignal.enState )
- && (g_strcmp0(NSMTST__pstTestCase->unReturnValues.stCheckSessionSignal.sName, NSMTST__stReceivedSessionSignal.sName) == 0 ))
- {
- /* We found what we expected */
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Check for SessionState signal reception failed.");
- }
-
- NSMTST__stReceivedSessionSignal.boReceived = FALSE;
-
- if(NSMTST__stReceivedSessionSignal.sName != NULL)
- {
- g_free(NSMTST__stReceivedSessionSignal.sName);
- NSMTST__stReceivedSessionSignal.sName = NULL;
- }
-
- NSMTST__stReceivedSessionSignal.enSeat = NsmSeat_NotSet;
- NSMTST__stReceivedSessionSignal.enState = NsmSessionState_Unregistered;
-
- return boRetVal;
-}
-
-
-static gboolean NSMTST__boCheckNodeStateSignal(void)
-{
- /* Function local variables */
- gboolean boRetVal = FALSE; /* Return value */
-
- NSMTST__sTestDescription = g_strdup("Check for NodeState signal.");
-
- /* Compare the received with the expected values */
- if( (NSMTST__pstTestCase->unReturnValues.stCheckNodeStateSignal.boReceived == NSMTST__stReceivedNodeStateSignal.boReceived )
- && (NSMTST__pstTestCase->unReturnValues.stCheckNodeStateSignal.enNodeState == NSMTST__stReceivedNodeStateSignal.enNodeState))
- {
- /* We found what we expected */
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup("Check for NodeState reception failed.");
- }
-
- NSMTST__stReceivedNodeStateSignal.boReceived = FALSE;
- NSMTST__stReceivedNodeStateSignal.enNodeState = NsmNodeState_NotSet;
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boCheckApplicationModeSignal(void)
-{
- /* Function local variables */
- gboolean boRetVal = FALSE; /* Return value */
-
- NSMTST__sTestDescription = g_strdup("Check for Application mode signal.");
-
- /* Compare the received with the expected values */
- if( (NSMTST__pstTestCase->unReturnValues.stCheckApplicationModeSignal.boReceived == NSMTST__stApplicationModeSignal.boReceived )
- && (NSMTST__pstTestCase->unReturnValues.stCheckApplicationModeSignal.enApplicationMode == NSMTST__stApplicationModeSignal.enApplicationMode))
- {
- /* We found what we expected */
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Check for ApplicationMode signal reception failed.");
- }
-
- NSMTST__stApplicationModeSignal.boReceived = FALSE;
- NSMTST__stApplicationModeSignal.enApplicationMode = NsmApplicationMode_NotSet;
-
- return boRetVal;
-
-
-
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boTestCreateLcClient(void)
-{
- NodeStateLifeCycleConsumer *pLifeCycleConsumer = NULL;
- gboolean boRetVal = FALSE;
-
- NSMTST__sTestDescription = g_strdup_printf("Create LifecycleConsumer: %s.", NSMTST__pstTestCase->unParameter.stTestCreateLcClient.sObjName);
-
- pLifeCycleConsumer = node_state_life_cycle_consumer_skeleton_new();
- NSMTST__pLifecycleClients = g_slist_append(NSMTST__pLifecycleClients, (gpointer) pLifeCycleConsumer);
-
- g_signal_connect(pLifeCycleConsumer, "handle-lifecycle-request", G_CALLBACK(NSMTST__boOnLifecycleClientCb), NULL);
-
- if(g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(pLifeCycleConsumer),
- NSMTST__pConnection,
- NSMTST__pstTestCase->unParameter.stTestCreateLcClient.sObjName,
- NULL) == TRUE)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- }
-
- return boRetVal;
-}
-
-
-static gboolean NSMTST__boTestProcessLifecycleRequest(void)
-{
- gboolean boRetVal = FALSE;
-
- NSMTST__sTestDescription = g_strdup_printf("Processing Lifecycle request. Return 0x%02X to NSM.",
- NSMTST__pstTestCase->unParameter.stTestProcessLifecycleRequest.enErrorStatus);
-
- if( (NSMTST__pLifecycleConsumer != NULL)
- && (NSMTST__pLifecycleInvocation != NULL))
- {
- if(NSMTST__u32LifecycleRequest == NSMTST__pstTestCase->unReturnValues.stTestProcessLifecycleRequest.u32RequestType)
- {
- boRetVal = TRUE;
-
- node_state_life_cycle_consumer_complete_lifecycle_request(NSMTST__pLifecycleConsumer,
- NSMTST__pLifecycleInvocation,
- (gint) NSMTST__pstTestCase->unParameter.stTestProcessLifecycleRequest.enErrorStatus);
-
- if( (NSMTST__pstTestCase->unParameter.stTestProcessLifecycleRequest.enErrorStatus == NsmErrorStatus_Ok)
- || (NSMTST__pstTestCase->unParameter.stTestProcessLifecycleRequest.enErrorStatus == NsmErrorStatus_Error))
- {
- NSMTST__pLifecycleConsumer = NULL;
- NSMTST__pLifecycleInvocation = NULL;
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected shutdown type.");
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected shutdown request.");
- }
-
- return boRetVal;
-}
-
-static gboolean NSMTST__boDbLifecycleRequestComplete(void)
-{
- gboolean boRetVal = FALSE;
- GError *pError = NULL;
- NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
-
- NSMTST__sTestDescription = g_strdup("Sending Lifecycle request finished.");
-
- (void) node_state_consumer_call_lifecycle_request_complete_sync(NSMTST__pNodeStateConsumer,
- NSMTST__u32LifecycleRequestId,
- NSMTST__pstTestCase->unParameter.stDbLifecycleRequestComplete.enErrorStatus,
- (gint*) &enReceivedNsmReturn,
- NULL,
- &pError);
-
- if(pError == NULL)
- {
- if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbLifecycleRequestComplete.enErrorStatus)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return. Received: 0x%02X. Expected: 0x%02X.",
- enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbLifecycleRequestComplete.enErrorStatus);
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to access NSM via D-Bus. Error msg.: %s.", pError->message);
- g_error_free(pError);
- }
-
- return boRetVal;
-}
-
-
-
-static gboolean NSMTST__boDbCheckLucRequired(void)
-{
- gboolean boReceivedLucRequired = FALSE;
- GError *pError = NULL;
- gboolean boRetVal = FALSE;
-
- NSMTST__sTestDescription = g_strdup("Check LUC required.");
-
- (void) node_state_lifecycle_control_call_check_luc_required_sync(NSMTST__pLifecycleControl,
- &boReceivedLucRequired,
- NULL,
- &pError);
-
- if(pError == NULL)
- {
- if(boReceivedLucRequired == NSMTST__pstTestCase->unReturnValues.stDbCheckLucRequired.boLucRequired)
- {
- boRetVal = TRUE;
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: %s. Expected: %s.",
- boReceivedLucRequired == TRUE ? "true" : "false",
- NSMTST__pstTestCase->unReturnValues.stDbCheckLucRequired.boLucRequired == TRUE ? "true" : "false");
- }
- }
- else
- {
- boRetVal = FALSE;
- NSMTST__sErrorDescription = g_strdup_printf("Failed to access NSM via D-Bus. Error msg.: %s.", pError->message);
- }
-
- return boRetVal;
-}
-
-
-gboolean NSMTST__boOnApplicationModeSignal(NodeStateConsumer *pObject,
- const gint i32ApplicationMode,
- gpointer pUserData)
-{
- NSMTST__stApplicationModeSignal.boReceived = TRUE;
- NSMTST__stApplicationModeSignal.enApplicationMode = (NsmApplicationMode_e) i32ApplicationMode;
-
- return TRUE;
-}
-
-
-gboolean NSMTST__boOnNodeStateSignal(NodeStateConsumer *pObject,
- const gint i32NodeState,
- gpointer pUserData)
-{
- NSMTST__stReceivedNodeStateSignal.boReceived = TRUE;
- NSMTST__stReceivedNodeStateSignal.enNodeState = (NsmNodeState_e) i32NodeState;
-
- return TRUE;
-}
-
-
-/**********************************************************************************************************************
-*
-* Callback for the SessionState signal. Store the parameters
-*
-* @param pConsumer: Lifecycle consumer object
-* @param pInvocation: D-Bus invocation object
-* @param u32LifeCycleRequest: Request (shutdown type)
-* @param u32RequestId: Unique ID, which a client needs to pass to "LifecycleRequestComplete" in case of an
-* asynchronous shut down handling.
-* @param pUserData: Optional user data (not used).
-*
-* @return: TRUE: Indicate D-Bus that the method has been processed,
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boOnSessionSignal(NodeStateConsumer *pObject,
- const gchar *sSessionName,
- const gint i32SeatId,
- const gint i32SessionState,
- gpointer pUserData)
-{
- /* Store values passed by the NSM */
- NSMTST__stReceivedSessionSignal.boReceived = TRUE;
-
- if(NSMTST__stReceivedSessionSignal.sName != NULL)
- {
- g_free(NSMTST__stReceivedSessionSignal.sName);
- NSMTST__stReceivedSessionSignal.sName = NULL;
- }
-
- NSMTST__stReceivedSessionSignal.sName = g_strdup(sSessionName);
- NSMTST__stReceivedSessionSignal.enSeat = (NsmSeat_e) i32SeatId;
- NSMTST__stReceivedSessionSignal.enState = (NsmSessionState_e) i32SessionState;
-
- return TRUE;
-}
-
-
-/**********************************************************************************************************************
-*
-* Callback for the life cycle request call used for ALL life cycle clients. The "completion" function to return
-* values to the NSM is NOT called here. Instead the parameters of the callback are saved and during the test
-* "NSMTST__boProcessLifecycleRequest" can be used to return different values.
-*
-* @param pConsumer: Lifecycle consumer object
-* @param pInvocation: D-Bus invocation object
-* @param u32LifeCycleRequest: Request (shutdown type)
-* @param u32RequestId: Unique ID, which a client needs to pass to "LifecycleRequestComplete" in case of an
-* asynchronous shut down handling.
-* @param pUserData: Optional user data (not used).
-*
-* @return: TRUE: Indicate D-Bus that the method has been processed,
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boOnLifecycleClientCb(NodeStateLifeCycleConsumer *pConsumer,
- GDBusMethodInvocation *pInvocation,
- const guint32 u32LifeCycleRequest,
- const guint32 u32RequestId,
- gpointer pUserData)
-{
- /* Store values passed by the NSM */
- NSMTST__pLifecycleConsumer = pConsumer;
- NSMTST__pLifecycleInvocation = pInvocation;
- NSMTST__u32LifecycleRequest = u32LifeCycleRequest;
- NSMTST__u32LifecycleRequestId = u32RequestId;
-
- return TRUE;
-}
-
-
-/**********************************************************************************************************************
-*
-* Timer callback in which the test cases are performed.
-*
-* @param pUserData: Data passed to callback by user.
-*
-* @return: TRUE: Keep the cyclic timer callback alive.
-* FALSE: Remove the cyclic timer event from MainLoop.
-*
-**********************************************************************************************************************/
-static gboolean NSMTST__boTestCaseTimerCb(gpointer pUserData)
-{
- /* Function local variables */
- gboolean boTestSuccess = FALSE; /* Flag to recognize error in test case */
- gboolean boKeepTimerAlive = FALSE; /* Flag if timer should stay alive */
-
- /* Perform the test call. Store return value for further evaluation */
- NSMTST__pstTestCase = &NSMTST__astTestCases[NSMTST__u16TestIdx];
- boTestSuccess = NSMTST__pstTestCase->pfTestCall();
-
- /* Print the test result */
- g_print(NSMTST__TESTPRINT, NSMTST__u16TestIdx,
- NSMTST__sTestDescription == NULL ? "-" : NSMTST__sTestDescription,
- NSMTST__sErrorDescription == NULL ? "-" : NSMTST__sErrorDescription,
- boTestSuccess == TRUE ? "success" : "failed");
-
- /* Free description string allocated by the test */
- if(NSMTST__sTestDescription != NULL)
- {
- g_free(NSMTST__sTestDescription);
- NSMTST__sTestDescription = NULL;
- }
-
- /* Free error string allocated by the test */
- if(NSMTST__sErrorDescription != NULL)
- {
- g_free(NSMTST__sErrorDescription);
- NSMTST__sErrorDescription = NULL;
- }
-
- NSMTST__u16TestIdx++; /* prepare system for next test */
-
- /* The tests end if there was an error or there are no test cases left */
- if((NSMTST__u16TestIdx < sizeof(NSMTST__astTestCases)/sizeof(NSMTST__tstTestCase)))
- {
- boKeepTimerAlive = TRUE;
- }
- else
- {
- boKeepTimerAlive = FALSE;
- g_main_loop_quit(pUserData);
- }
-
- return boKeepTimerAlive;
-}
-
-
-/**********************************************************************************************************************
-*
-* Main function of the test client executable.
-*
-* @return: 0: All tests ended successful
-* -1: At least one test was not successful
-*
-**********************************************************************************************************************/
-int main(void)
-{
- int iRetVal = 0;
-
- /* Initialize types in order to use glib */
- g_type_init();
-
- NSMTST__pLifecycleConsumer = NULL;
- NSMTST__pLifecycleInvocation = NULL;
-
- /* Create main loop. Function can not fail. */
- NSMTST__pMainLoop = g_main_loop_new(NULL, FALSE);
-
- /* Add a timeout to the loop in which's callback the test cases are performed */
- g_timeout_add_full(G_PRIORITY_DEFAULT, NSMTST__TIMER_INTERVAL, &NSMTST__boTestCaseTimerCb, NSMTST__pMainLoop, NULL);
-
- /* Blocking call: Run the main loop, wait for callbacks */
- g_main_loop_run(NSMTST__pMainLoop);
-
- iRetVal = (NSMTST__u16TestIdx == sizeof(NSMTST__astTestCases)/sizeof(NSMTST__tstTestCase)) ? 0 : -1;
-
- if(NSMTST__pLifecycleControl != NULL) g_object_unref(NSMTST__pLifecycleControl);
- if(NSMTST__pNodeStateConsumer != NULL) g_object_unref(NSMTST__pNodeStateConsumer);
- if(NSMTST__pNodeStateMachine != NULL) g_object_unref(NSMTST__pNodeStateMachine);
-
- g_slist_free_full(NSMTST__pLifecycleClients, &g_object_unref);
-
- /* Free the main loop, when it was left */
- g_main_loop_unref(NSMTST__pMainLoop);
-
- return iRetVal;
-}
diff --git a/NodeStateMachineTest/NodeStateTest_GENIVI.cpp b/NodeStateMachineTest/NodeStateTest_GENIVI.cpp
new file mode 100644
index 0000000..b341dfd
--- /dev/null
+++ b/NodeStateMachineTest/NodeStateTest_GENIVI.cpp
@@ -0,0 +1,1199 @@
+/**********************************************************************************************************************
+ *
+ * Copyright (C) 2017 BMW AG
+ *
+ * Implements tests for NSM
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ **********************************************************************************************************************/
+
+#include <gtest/gtest.h>
+#include <iostream>
+#include <dlt.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1/org/genivi/nodestatemanager/ConsumerProxy.hpp>
+#include <v1/org/genivi/nodestatemanager/ConsumerProxyBase.hpp>
+#include <v1/org/genivi/nodestatemanager/LifecycleControlProxy.hpp>
+
+#include <v1/org/genivi/nodestatemachinetest/TestProxy.hpp>
+
+#include "../NodeStateManager/NodeStateTypes.h"
+#include "../NodeStateManager/NodeStateManager.h"
+
+namespace NodeStateMachineTest = v1::org::genivi::nodestatemachinetest;
+
+namespace GENIVI = v1::org::genivi;
+using namespace GENIVI::nodestatemanager;
+
+DLT_DECLARE_CONTEXT(gNSMTestContext);
+
+class NSMTest_GENIVI: public testing::Test
+{
+protected:
+ virtual void SetUp()
+ {
+ //Define application ID
+ CommonAPI::Runtime::setProperty("LogContext", "CAPI");
+
+ GENIVI::NodeStateManagerTypes::NsmErrorStatus_e eCode = GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_NotSet;
+ GENIVI::NodeStateManagerTypes::NsmApplicationMode_e appMode;
+
+ runtime = CommonAPI::Runtime::get();
+ proxyConsumer = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", "Consumer");
+ proxyConsumer_1 = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", "Consumer_1");
+ proxyConsumer_2 = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", "Consumer_2");
+ proxyConsumer_3 = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", "Consumer_3");
+ proxyConsumer_4 = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", "Consumer_4");
+ proxyConsumer_5 = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", "Consumer_5");
+ proxyLifecycleControl = runtime->buildProxy<LifecycleControlProxy>("local", "NSMLifecycleControl", "LifecycleControl");
+ proxyTest = runtime->buildProxy<NodeStateMachineTest::TestProxy>("local", "NSMTest", "Test");
+
+ ASSERT_FALSE(proxyConsumer == NULL);
+ ASSERT_FALSE(proxyConsumer_1 == NULL);
+ ASSERT_FALSE(proxyConsumer_2 == NULL);
+ ASSERT_FALSE(proxyConsumer_3 == NULL);
+ ASSERT_FALSE(proxyConsumer_4 == NULL);
+ ASSERT_FALSE(proxyConsumer_5 == NULL);
+ ASSERT_FALSE(proxyLifecycleControl == NULL);
+
+ ASSERT_FALSE(proxyTest == NULL);
+
+ ASSERT_TRUE(proxyConsumer->isAvailableBlocking());
+ ASSERT_TRUE(proxyConsumer_1->isAvailableBlocking());
+ ASSERT_TRUE(proxyConsumer_2->isAvailableBlocking());
+ ASSERT_TRUE(proxyConsumer_3->isAvailableBlocking());
+ ASSERT_TRUE(proxyConsumer_4->isAvailableBlocking());
+ ASSERT_TRUE(proxyConsumer_5->isAvailableBlocking());
+
+ ASSERT_TRUE(proxyLifecycleControl->isAvailableBlocking());
+ ASSERT_TRUE(proxyTest->isAvailableBlocking());
+
+
+ proxyConsumer->GetInterfaceVersion(callStatus, var_ui32);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+
+ proxyConsumer->GetApplicationMode(callStatus, appMode, eCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ }
+
+ virtual void TearDown()
+ {
+ // nothing to do
+ }
+
+ CommonAPI::CallStatus callStatus;
+ int32_t var_i32 = 0;
+ uint32_t var_ui32 = 0;
+ int nsm_test_errorCode = NsmErrorStatus_NotSet;
+ GENIVI::NodeStateManagerTypes::NsmErrorStatus_e errorCode = GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_NotSet;
+
+ std::mutex mMutex;
+ std::condition_variable mCondVar;
+ std::shared_ptr<CommonAPI::Runtime> runtime;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer_1;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer_2;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer_3;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer_4;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer_5;
+ std::shared_ptr<LifecycleControlProxyDefault> proxyLifecycleControl;
+ std::shared_ptr<NodeStateMachineTest::TestProxyDefault> proxyTest;
+
+public:
+
+};
+
+/*
+ * The define sets up a string that is longer for all text fields used in the NSM.
+ * The intend is to test the NSM for correct behavior by passing this string.
+ */
+#define NSMTST__260CHAR_STRING "012345678901234567890123456789012345678901234567890123456789"\
+ "012345678901234567890123456789012345678901234567890123456789"\
+ "012345678901234567890123456789012345678901234567890123456789"\
+ "012345678901234567890123456789012345678901234567890123456789"\
+ "01234567890123456789"
+
+/********************************************************************************************
+ * main()
+ ********************************************************************************************/
+
+int main(int argc, char **argv)
+{
+ int retVal = 1;
+ DLT_REGISTER_APP("NSMT", "Unit tests for NSM");
+ DLT_REGISTER_CONTEXT(gNSMTestContext, "GEN", "Context for Genivi TestLogging");
+
+ testing::InitGoogleTest(&argc, argv);
+ retVal = RUN_ALL_TESTS();
+
+ // unregister debug log and trace
+ DLT_UNREGISTER_CONTEXT(gNSMTestContext);
+ DLT_UNREGISTER_APP();
+ return retVal;
+}
+
+int registeredShutdownClientCb = 0;
+std::mutex mMutexRegisterdClientCb;
+std::condition_variable mCondVarRegisterdClientCb;
+
+void async_callback(const CommonAPI::CallStatus& callStatus, const ::v1::org::genivi::NodeStateManagerTypes::NsmErrorStatus_e& errorStatus)
+{
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorStatus, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ std::unique_lock<std::mutex> lock(mMutexRegisterdClientCb);
+ registeredShutdownClientCb++;
+ lock.unlock();
+ mCondVarRegisterdClientCb.notify_one();
+}
+
+/********************************************************************************************
+ * BootMode Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, BootMode)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_BootMode ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_BootMode");
+ RecordProperty("TestCaseDescription", "");
+
+ int bootMode = 0x0;
+ std::vector<uint8_t> dataIn;
+ std::vector<uint8_t> dataOut;
+
+ proxyLifecycleControl->SetBootMode(0, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->getBootModeAttribute().getValue(callStatus, bootMode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(bootMode == 0);
+
+ proxyLifecycleControl->SetBootMode(1, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->getBootModeAttribute().getValue(callStatus, bootMode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(bootMode == 1);
+
+ proxyLifecycleControl->SetBootMode(1, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->getBootModeAttribute().getValue(callStatus, bootMode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(bootMode == 1);
+
+ bootMode = 0x02;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &bootMode, ((uint8_t*) &bootMode) + sizeof(bootMode));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_BootMode, dataIn, sizeof(bootMode), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(nsm_test_errorCode, NsmErrorStatus_Ok);
+
+ bootMode = 0x03;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &bootMode, ((uint8_t*) &bootMode) + sizeof(bootMode));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_BootMode, dataIn, sizeof(bootMode) + 1, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ bootMode = 0x04;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &bootMode, ((uint8_t*) &bootMode) + sizeof(bootMode));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_BootMode, dataIn, sizeof(bootMode) - 1, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ dataOut.clear();
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_BootMode, dataIn, sizeof(bootMode), callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == sizeof(bootMode));
+ ASSERT_TRUE(*((int*)dataOut.data()) == 0x02);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_BootMode, dataIn, sizeof(bootMode) + 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_BootMode, dataIn, sizeof(bootMode) - 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_BootMode ==> end"));
+}
+
+/********************************************************************************************
+ * RunningReason Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, RunningReason)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_RunningReason ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_RunningReason");
+ RecordProperty("TestCaseDescription", "");
+
+
+ GENIVI::NodeStateManagerTypes::NsmRunningReason_e runningReason;
+ std::vector<uint8_t> dataIn;
+ std::vector<uint8_t> dataOut;
+
+ proxyConsumer->getWakeUpReasonAttribute().getValue(callStatus, runningReason);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(runningReason, GENIVI::NodeStateManagerTypes::NsmRunningReason_e::NsmRunningReason_WakeupCan);
+
+ dataOut.clear();
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RunningReason, dataIn, sizeof(NsmRunningReason_e), callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(nsm_test_errorCode, sizeof(NsmRunningReason_e));
+ ASSERT_TRUE(*((int*)dataOut.data()) == NsmRunningReason_WakeupCan);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RunningReason, dataIn, sizeof(NsmRunningReason_e) + 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RunningReason, dataIn, sizeof(NsmRunningReason_e) - 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_RunningReason ==> end"));
+
+}
+
+/********************************************************************************************
+ * ShutdownReason Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, ShutdownReason)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_ShutdownReason ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_ShutdownReason");
+ RecordProperty("TestCaseDescription", "");
+
+ NsmShutdownReason_e enShutdownReason = NsmShutdownReason_NotSet;
+ GENIVI::NodeStateManagerTypes::NsmShutdownReason_e shutdownReason;
+ std::vector<uint8_t> dataIn;
+ std::vector<uint8_t> dataOut;
+
+ enShutdownReason = NsmShutdownReason_NotSet;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &enShutdownReason, ((uint8_t*) &enShutdownReason) + sizeof(enShutdownReason));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ // Explicitly pass wrong value
+#pragma GCC diagnostic ignored "-Wconversion"
+ enShutdownReason = (NsmShutdownReason_e)0xFFFFFFFF;
+#pragma GCC diagnostic pop
+ dataIn.insert(dataIn.begin(), (uint8_t*) &enShutdownReason, ((uint8_t*) &enShutdownReason) + sizeof(enShutdownReason));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ enShutdownReason = NsmShutdownReason_Normal;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &enShutdownReason, ((uint8_t*) &enShutdownReason) + sizeof(enShutdownReason));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e) - 1, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ enShutdownReason = NsmShutdownReason_Normal;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &enShutdownReason, ((uint8_t*) &enShutdownReason) + sizeof(enShutdownReason));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e) + 1, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ enShutdownReason = NsmShutdownReason_Normal;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &enShutdownReason, ((uint8_t*) &enShutdownReason) + sizeof(enShutdownReason));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(nsm_test_errorCode, NsmErrorStatus_Ok);
+
+ enShutdownReason = NsmShutdownReason_Normal;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &enShutdownReason, ((uint8_t*) &enShutdownReason) + sizeof(enShutdownReason));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(nsm_test_errorCode, NsmErrorStatus_Ok);
+
+ proxyConsumer->getShutdownReasonAttribute().getValue(callStatus, shutdownReason);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(shutdownReason == GENIVI::NodeStateManagerTypes::NsmShutdownReason_e::NsmShutdownReason_Normal);
+
+ dataOut.clear();
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e), callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == sizeof(NsmShutdownReason_e));
+ ASSERT_TRUE( *((NsmShutdownReason_e*)dataOut.data()) == NsmShutdownReason_Normal);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e) - 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e) + 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ enShutdownReason = NsmShutdownReason_SupplyBad;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &enShutdownReason, ((uint8_t*) &enShutdownReason) + sizeof(enShutdownReason));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(nsm_test_errorCode, NsmErrorStatus_Ok);
+
+ proxyConsumer->getShutdownReasonAttribute().getValue(callStatus, shutdownReason);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(shutdownReason == GENIVI::NodeStateManagerTypes::NsmShutdownReason_e::NsmShutdownReason_SupplyBad);
+
+ dataOut.clear();
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e), callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == sizeof(NsmShutdownReason_e));
+ ASSERT_TRUE( *((NsmShutdownReason_e*)dataOut.data()) == NsmShutdownReason_SupplyBad);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e) - 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_ShutdownReason, dataIn, sizeof(NsmShutdownReason_e) + 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_ShutdownReason ==> end"));
+}
+
+/********************************************************************************************
+ * RestartReason Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, RestartReason)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_RestartReason ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_RestartReason");
+ RecordProperty("TestCaseDescription", "");
+
+ GENIVI::NodeStateManagerTypes::NsmRestartReason_e restartReason;
+ std::vector<uint8_t> dataIn;
+ std::vector<uint8_t> dataOut;
+ proxyConsumer->getRestartReasonAttribute().getValue(callStatus, restartReason);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(restartReason == GENIVI::NodeStateManagerTypes::NsmRestartReason_e::NsmRestartReason_NotSet);
+
+ dataOut.clear();
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RestartReason, dataIn, sizeof(NsmRestartReason_e), callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == sizeof(NsmRestartReason_e));
+ ASSERT_TRUE( *((NsmRestartReason_e*)dataOut.data()) == NsmRestartReason_NotSet);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RestartReason, dataIn, sizeof(NsmRestartReason_e) - 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RestartReason, dataIn, sizeof(NsmRestartReason_e) + 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_RestartReason ==> end"));
+}
+
+/********************************************************************************************
+ * NodeState Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, NodeState)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_NodeState ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_NodeState");
+ RecordProperty("TestCaseDescription", "");
+
+ GENIVI::NodeStateManagerTypes::NsmNodeState_e nsmNodeState;
+ int32_t nodeState = -1;
+ int32_t nodeStateToSet = -1;
+ std::vector<uint8_t> dataIn;
+ std::vector<uint8_t> dataOut;
+
+ proxyConsumer->getNodeStateEvent().subscribe([&](const int32_t& val) {
+ nodeState = val;
+ });
+
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_NotSet, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ nodeState = -1;
+
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_LucRunning, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while (nodeState == -1)
+ usleep(10);
+ ASSERT_TRUE(nodeState == NsmNodeState_LucRunning);
+
+ proxyConsumer->GetNodeState(callStatus, nsmNodeState, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ ASSERT_TRUE(nsmNodeState == GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_LucRunning);
+
+ nodeState = -1;
+ nodeStateToSet = NsmNodeState_FullyRunning;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &nodeStateToSet, ((uint8_t*) &nodeStateToSet) + sizeof(nodeStateToSet));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_NodeState, dataIn, sizeof(nodeStateToSet), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(nsm_test_errorCode, NsmErrorStatus_Ok);
+
+ while (nodeState == -1)
+ usleep(10);
+ ASSERT_TRUE(nodeState == NsmNodeState_FullyRunning);
+
+ nodeState = NsmNodeState_FullyRunning;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &nodeState, ((uint8_t*) &nodeState) + sizeof(nodeState));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_NodeState, dataIn, 3, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ nodeState = NsmNodeState_FullyRunning;
+ dataIn.insert(dataIn.begin(), (uint8_t*) &nodeState, ((uint8_t*) &nodeState) + sizeof(nodeState));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_NodeState, dataIn, 5, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ dataOut.clear();
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_NodeState, dataIn, sizeof(nodeState), callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == sizeof(nodeState));
+ ASSERT_TRUE(*((NsmNodeState_e* )dataOut.data()) == NsmNodeState_FullyRunning);
+
+ dataOut.clear();
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_NodeState, dataIn, sizeof(nodeState) - 1, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_NodeState ==> end"));
+}
+
+/********************************************************************************************
+ * InvalidData Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, InvalidData)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_InvalidData ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_InvalidData");
+ RecordProperty("TestCaseDescription", "");
+
+ std::vector<uint8_t> dataIn;
+ NsmRestartReason_e restartReason;
+
+ dataIn.insert(dataIn.begin(), (uint8_t*) &restartReason, ((uint8_t*) &restartReason) + sizeof(restartReason));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RestartReason, dataIn, sizeof(restartReason), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ dataIn.insert(dataIn.begin(), (uint8_t*) &restartReason, ((uint8_t*) &restartReason) + sizeof(restartReason));
+ // Explicitly pass wrong value
+#pragma GCC diagnostic ignored "-Wconversion"
+ proxyTest->SetNsmData(
+ GENIVI::NodeStateManagerTypes::NsmDataType_e((GENIVI::NodeStateManagerTypes::NsmDataType_e::Literal) 0xFFFFFFFF),
+ dataIn, sizeof(restartReason), callStatus, nsm_test_errorCode);
+#pragma GCC diagnostic pop
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::INVALID_VALUE);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ dataIn.insert(dataIn.begin(), (uint8_t*) &restartReason, ((uint8_t*) &restartReason) + sizeof(restartReason));
+ // Explicitly pass wrong value
+#pragma GCC diagnostic ignored "-Wconversion"
+ proxyTest->SetNsmData(
+ GENIVI::NodeStateManagerTypes::NsmDataType_e((GENIVI::NodeStateManagerTypes::NsmDataType_e::Literal) 0xFFFFFFFF),
+ dataIn, sizeof(restartReason), callStatus, nsm_test_errorCode);
+#pragma GCC diagnostic pop
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::INVALID_VALUE);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_InvalidData ==> end"));
+}
+
+/********************************************************************************************
+ * RegisterSession Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, RegisterSession)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_RegisterSession ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_RegisterSession");
+ RecordProperty("TestCaseDescription", "");
+
+ proxyConsumer->RegisterSession("VoiceControl", "NodeStateManager", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->RegisterSession(NSMTST__260CHAR_STRING, "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->RegisterSession("VoiceControl", NSMTST__260CHAR_STRING, GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->RegisterSession("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_NotSet, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ // Explicitly pass wrong value
+#pragma GCC diagnostic ignored "-Wconversion"
+ proxyConsumer->RegisterSession("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e((GENIVI::NodeStateManagerTypes::NsmSeat_e::Literal)0xFFFFFFFF), GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+#pragma GCC diagnostic pop
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::INVALID_VALUE);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->RegisterSession("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->RegisterSession("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->RegisterSession("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_RegisterSession ==> end"));
+}
+
+/********************************************************************************************
+ * UnRegisterSession Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, UnregisterSession)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_UnregisterSession ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_UnregisterSession");
+ RecordProperty("TestCaseDescription", "");
+
+ proxyConsumer->UnRegisterSession(NSMTST__260CHAR_STRING, "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->UnRegisterSession("VoiceControl", NSMTST__260CHAR_STRING, GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->UnRegisterSession("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongSession);
+
+ proxyConsumer->UnRegisterSession("Unknown", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongSession);
+
+ proxyConsumer->UnRegisterSession("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_UnregisterSession ==> end"));
+}
+
+/********************************************************************************************
+ * SessionState Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, SetSessionState)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_SetSessionState ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_SetSessionState");
+ RecordProperty("TestCaseDescription", "");
+
+ std::vector<uint8_t> dataIn;
+ std::vector<uint8_t> dataOut;
+ NsmSession_s session;
+
+ GENIVI::NodeStateManagerTypes::NsmSessionState_e sessionState;
+
+ proxyConsumer->SetSessionState(NSMTST__260CHAR_STRING, "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->SetSessionState("VoiceControl", NSMTST__260CHAR_STRING, GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->SetSessionState("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongSession);
+
+ proxyConsumer->SetSessionState("VoiceControl", "NodeStateManager", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->SetSessionState("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->SetSessionState("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_NotSet, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ // Explicitly pass wrong value
+#pragma GCC diagnostic ignored "-Wconversion"
+ proxyConsumer->SetSessionState("VoiceControl", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e((GENIVI::NodeStateManagerTypes::NsmSeat_e::Literal)0xFFFFFFFF), GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+#pragma GCC diagnostic pop
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::INVALID_VALUE);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->SetSessionState("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e((GENIVI::NodeStateManagerTypes::NsmSessionState_e::Literal)0x03), callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::INVALID_VALUE);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Inactive, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("DiagnosisSession", "NodeStateTest02", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Error);
+
+ proxyConsumer->SetSessionState("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Inactive, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Inactive, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyConsumer->SetSessionState("ProductSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongSession);
+
+ proxyConsumer->RegisterSession("ProductSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("ProductSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Inactive, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("ProductSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Inactive, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->GetSessionState(NSMTST__260CHAR_STRING, GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, sessionState, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+ ASSERT_TRUE(sessionState == GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered);
+
+ proxyConsumer->GetSessionState("ProductSession", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, sessionState, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ ASSERT_TRUE(sessionState == GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Inactive);
+
+ proxyConsumer->GetSessionState("UnknownSession", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, sessionState, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongSession);
+ ASSERT_TRUE(sessionState == GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered);
+
+ proxyConsumer->UnRegisterSession("ProductSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ strcpy(session.sName, "ProductSession");
+ strcpy(session.sOwner, "NodeStateTest");
+
+ session.enSeat = NsmSeat_Driver;
+ session.enState = NsmSessionState_Active;
+
+ dataOut.clear();
+ dataIn.insert(dataIn.begin(), (uint8_t*) &session, ((uint8_t*) &session) + sizeof(session));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_SessionState, dataIn, sizeof(session), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_WrongSession);
+
+ dataOut.clear();
+ dataIn.insert(dataIn.begin(), (uint8_t*) &session, ((uint8_t*) &session) + sizeof(session));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_SessionState, dataIn, 4, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ dataOut.clear();
+ dataOut.reserve(sizeof(session));
+ dataIn.clear();
+ dataIn.insert(dataIn.begin(), (uint8_t*) &session, ((uint8_t*) &session) + sizeof(session));
+ proxyTest->GetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_SessionState, dataIn, 5, callStatus, dataOut, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == -1);
+ memcpy(&session, dataOut.data(), sizeof(session));
+ ASSERT_TRUE(session.enState == (int)GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_SetSessionState ==> end"));
+}
+
+/********************************************************************************************
+ * AppHealth Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, GetAppHealth)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_GetAppHealth ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_SGetAppHealth");
+ RecordProperty("TestCaseDescription", "");
+
+ proxyConsumer->GetAppHealthCount(callStatus, var_ui32);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(var_ui32 == 0);
+
+ proxyLifecycleControl->SetAppHealthStatus(NSMTST__260CHAR_STRING, true, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ proxyLifecycleControl->SetAppHealthStatus("NodeStateTest", true, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Error);
+
+ proxyLifecycleControl->SetAppHealthStatus("NodeStateTest", false, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyLifecycleControl->SetAppHealthStatus("NodeStateTest", true, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->RegisterSession("ProductSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyLifecycleControl->SetAppHealthStatus("NodeStateTest", false, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyLifecycleControl->SetAppHealthStatus("NodeStateTest1", false, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyLifecycleControl->SetAppHealthStatus("NodeStateTest", true, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("DiagnosisSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->SetSessionState("HevacSession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyLifecycleControl->SetAppHealthStatus("NodeStateTest", false, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_GetAppHealth ==> end"));
+}
+
+/********************************************************************************************
+ * Luc Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, CheckLuc)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_CheckLuc ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_CheckLuc");
+ RecordProperty("TestCaseDescription", "");
+
+ int barrier1 = 0;
+ int barrier2 = 0;
+ int barrier3 = 0;
+ int barrier4 = 0;
+ int barrier5 = 0;
+
+ uint32_t expected_mode_1 = NSM_SHUTDOWNTYPE_NOT;
+ uint32_t expected_mode_2 = NSM_SHUTDOWNTYPE_NOT;
+ uint32_t expected_mode_3 = NSM_SHUTDOWNTYPE_NOT;
+ uint32_t expected_mode_4 = NSM_SHUTDOWNTYPE_NOT;
+ uint32_t expected_mode_5 = NSM_SHUTDOWNTYPE_NOT;
+
+
+ bool lucWanted;
+ proxyLifecycleControl->CheckLucRequired(callStatus, lucWanted);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(lucWanted);
+
+ registeredShutdownClientCb = 0;
+
+ proxyConsumer_1->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expected_mode_1);
+ barrier1 = 1;
+ }, [&](CommonAPI::CallStatus callStatus)
+ {
+ if(callStatus == CommonAPI::CallStatus::SUCCESS)
+ {
+ proxyConsumer_1->RegisterShutdownClientAsync(NSM_SHUTDOWNTYPE_NORMAL, 2000, async_callback);
+ proxyConsumer_1->RegisterShutdownClientAsync(NSM_SHUTDOWNTYPE_FAST, 2000, async_callback);
+ }
+ });
+
+ std::unique_lock<std::mutex> lock(mMutexRegisterdClientCb);
+ while (registeredShutdownClientCb < 2)
+ {
+ mCondVarRegisterdClientCb.wait(lock);
+ }
+ registeredShutdownClientCb = 0;
+ lock.unlock();
+
+ proxyConsumer_2->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expected_mode_2);
+ barrier2 = 1;
+ }, [&](CommonAPI::CallStatus callStatus)
+ {
+ if(callStatus == CommonAPI::CallStatus::SUCCESS)
+ {
+ proxyConsumer_2->RegisterShutdownClientAsync(NSM_SHUTDOWNTYPE_NORMAL, 2000, async_callback);
+ proxyConsumer_2->RegisterShutdownClientAsync(NSM_SHUTDOWNTYPE_FAST, 2000, async_callback);
+ }
+ });
+
+ lock.lock();
+ while (registeredShutdownClientCb < 2)
+ {
+ mCondVarRegisterdClientCb.wait(lock);
+ }
+ registeredShutdownClientCb = 0;
+ lock.unlock();
+
+ proxyConsumer_3->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expected_mode_3);
+ barrier3 = 1;
+ }, [&](CommonAPI::CallStatus callStatus)
+ {
+ if(callStatus == CommonAPI::CallStatus::SUCCESS)
+ {
+ proxyConsumer_3->RegisterShutdownClientAsync(NSM_SHUTDOWNTYPE_NORMAL, 2000, async_callback);
+ }
+ });
+
+ lock.lock();
+ while (registeredShutdownClientCb < 1)
+ {
+ mCondVarRegisterdClientCb.wait(lock);
+ }
+ registeredShutdownClientCb = 0;
+ lock.unlock();
+
+ proxyConsumer_4->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expected_mode_4);
+ barrier4 = 1;
+ }, [&](CommonAPI::CallStatus callStatus)
+ {
+ if(callStatus == CommonAPI::CallStatus::SUCCESS)
+ {
+ proxyConsumer_4->RegisterShutdownClientAsync(NSM_SHUTDOWNTYPE_NORMAL, 2000, async_callback);
+ }
+ });
+
+ lock.lock();
+ while (registeredShutdownClientCb < 1)
+ {
+ mCondVarRegisterdClientCb.wait(lock);
+ }
+ registeredShutdownClientCb = 0;
+ lock.unlock();
+
+ proxyConsumer_5->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expected_mode_5);
+ barrier5 = 1;
+ }, [&](CommonAPI::CallStatus callStatus)
+ {
+ if(callStatus == CommonAPI::CallStatus::SUCCESS)
+ {
+ proxyConsumer_5->RegisterShutdownClientAsync(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_FAST, 2000, async_callback);
+ }
+ });
+
+ lock.lock();
+ while (registeredShutdownClientCb < 1)
+ {
+ mCondVarRegisterdClientCb.wait(lock);
+ }
+ registeredShutdownClientCb = 0;
+ lock.unlock();
+
+ proxyConsumer_1->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_FAST, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Parameter);
+
+ expected_mode_1 = NSM_SHUTDOWNTYPE_NORMAL;
+ expected_mode_2 = NSM_SHUTDOWNTYPE_NORMAL;
+ expected_mode_3 = NSM_SHUTDOWNTYPE_NORMAL;
+ expected_mode_4 = NSM_SHUTDOWNTYPE_NORMAL;
+ expected_mode_5 = NSM_SHUTDOWNTYPE_NORMAL;
+
+ // Set NodeState to BaseRunning because NSM already is in Shutdown Mode -> it will not shutdown again
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // Set NodeState to ShuttingDown
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_ShuttingDown, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // Wait until LifecycleConsumer is notified
+ while(0 == barrier5) { usleep(10); } barrier5 = 0;
+ proxyConsumer_5->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(NsmErrorStatus_Ok, errorCode);
+
+ while(0 == barrier4) { usleep(10); } barrier4 = 0;
+ proxyConsumer_4->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(NsmErrorStatus_Ok, errorCode);
+
+ while(0 == barrier3) { usleep(10); } barrier3 = 0;
+ proxyConsumer_3->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Error, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier2) { usleep(10); } barrier2 = 0;
+ proxyConsumer_2->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier1) { usleep(10); } barrier1 = 0;
+ proxyConsumer_1->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ expected_mode_1 = NSM_SHUTDOWNTYPE_RUNUP;
+ expected_mode_2 = NSM_SHUTDOWNTYPE_RUNUP;
+ expected_mode_3 = NSM_SHUTDOWNTYPE_RUNUP;
+ expected_mode_4 = NSM_SHUTDOWNTYPE_RUNUP;
+ expected_mode_5 = NSM_SHUTDOWNTYPE_RUNUP;
+
+ // Set NodeState to BaseRunning
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier1) { usleep(10); } barrier1 = 0;
+ proxyConsumer_1->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier2) { usleep(10); } barrier2 = 0;
+ proxyConsumer_2->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier3) { usleep(10); } barrier3 = 0;
+ proxyConsumer_3->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier4) { usleep(10); } barrier4 = 0;
+ proxyConsumer_4->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier5) { usleep(10); } barrier5 = 0;
+ proxyConsumer_5->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ expected_mode_2 = NSM_SHUTDOWNTYPE_FAST;
+ expected_mode_5 = NSM_SHUTDOWNTYPE_FAST;
+
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_FastShutdown, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier5) { usleep(10); } barrier5 = 0;
+ proxyConsumer_5->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier2) { usleep(10); } barrier2 = 0;
+ proxyConsumer_2->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ expected_mode_2 = NSM_SHUTDOWNTYPE_RUNUP;
+ expected_mode_5 = NSM_SHUTDOWNTYPE_RUNUP;
+
+ // Set NodeState to BaseRunning
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier2) { usleep(10); } barrier2 = 0;
+ proxyConsumer_2->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while(0 == barrier5) { usleep(10); } barrier5 = 0;
+ proxyConsumer_5->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer_1->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_NORMAL , callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer_2->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_NORMAL , callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer_3->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_NORMAL , callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer_4->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_NORMAL , callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer_5->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_NORMAL , callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_CheckLuc ==> end"));
+}
+
+/********************************************************************************************
+ * SessionState Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_GENIVI, SessionState)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_SessionState ==> start"));
+
+ RecordProperty("TestCaseID", "GENIVI_SessionState");
+ RecordProperty("TestCaseDescription", "");
+
+ NsmSession_s session;
+ GENIVI::NodeStateManagerTypes::NsmSessionState_e sessionState;
+ GENIVI::NodeStateManagerTypes::NsmSeat_e seatID;
+ std::string sessionStateName;
+
+ std::vector<uint8_t> dataIn;
+ std::vector<uint8_t> dataOut;
+
+ proxyConsumer->SetSessionState("PlatformSupplySession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e((GENIVI::NodeStateManagerTypes::NsmSessionState_e::Literal) 0x02), callStatus, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer->GetSessionState("PlatformSupplySession", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, callStatus, sessionState, errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ ASSERT_TRUE(sessionState == GENIVI::NodeStateManagerTypes::NsmSessionState_e((GENIVI::NodeStateManagerTypes::NsmSessionState_e::Literal) 0x02));
+
+ sessionState = GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered;
+ proxyConsumer->getSessionStateChangedEvent().subscribe([&](std::string SessionStateName, GENIVI::NodeStateManagerTypes::NsmSeat_e SeatID, GENIVI::NodeStateManagerTypes::NsmSessionState_e SessionState)
+ {
+ sessionStateName.assign(SessionStateName);
+ seatID = SeatID;
+ sessionState = SessionState;
+ });
+
+ usleep(10000);
+
+ proxyConsumer->SetSessionState("PlatformSupplySession", "NodeStateTest", GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver, GENIVI::NodeStateManagerTypes::NsmSessionState_e((GENIVI::NodeStateManagerTypes::NsmSessionState_e::Literal) 0x03), callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::INVALID_VALUE);
+ ASSERT_EQ(errorCode, GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ strcpy(session.sName, "StateMachine");
+ strcpy(session.sOwner, "NodeStateTest");
+
+ session.enSeat = NsmSeat_Driver;
+ session.enState = NsmSessionState_Active;
+
+ sessionState = GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered;
+ proxyConsumer->getSessionStateChangedEvent().subscribe([&](std::string SessionStateName, GENIVI::NodeStateManagerTypes::NsmSeat_e SeatID, GENIVI::NodeStateManagerTypes::NsmSessionState_e SessionState)
+ {
+ sessionStateName.assign(SessionStateName);
+ seatID = SeatID;
+ sessionState = SessionState;
+ });
+
+ usleep(10000);
+
+ dataOut.clear();
+ dataIn.insert(dataIn.begin(), (uint8_t*) &session, ((uint8_t*) &session) + sizeof(session));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RegisterSession, dataIn, sizeof(session), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(nsm_test_errorCode, NsmErrorStatus_Ok);
+
+ while (sessionState == GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered)
+ usleep(10);
+
+ ASSERT_TRUE(0 == sessionStateName.compare("StateMachine"));
+ ASSERT_TRUE(seatID == GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver);
+ ASSERT_TRUE(sessionState == GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Active);
+
+ dataOut.clear();
+ dataIn.insert(dataIn.begin(), (uint8_t*) &session, ((uint8_t*) &session) + sizeof(session));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_RegisterSession, dataIn, sizeof(session) - 1, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ dataOut.clear();
+ dataIn.insert(dataIn.begin(), (uint8_t*) &session, ((uint8_t*) &session) + sizeof(session));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_UnRegisterSession, dataIn, sizeof(session) - 1, callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(nsm_test_errorCode == NsmErrorStatus_Parameter);
+
+ sessionState = GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Inactive;
+ proxyConsumer->getSessionStateChangedEvent().subscribe([&](std::string SessionStateName, GENIVI::NodeStateManagerTypes::NsmSeat_e SeatID, GENIVI::NodeStateManagerTypes::NsmSessionState_e SessionState)
+ {
+ sessionStateName.assign(SessionStateName);
+ seatID = SeatID;
+ sessionState = SessionState;
+ });
+
+ usleep(10000);
+
+ session.enState = NsmSessionState_Unregistered;
+ dataOut.clear();
+ dataIn.insert(dataIn.begin(), (uint8_t*) &session, ((uint8_t*) &session) + sizeof(session));
+ proxyTest->SetNsmData(GENIVI::NodeStateManagerTypes::NsmDataType_e::NsmDataType_UnRegisterSession, dataIn, sizeof(session), callStatus, nsm_test_errorCode);
+ ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(nsm_test_errorCode, NsmErrorStatus_Ok);
+
+ while (sessionState == GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Inactive)
+ usleep(10);
+
+ ASSERT_TRUE(0 == sessionStateName.compare("StateMachine"));
+ ASSERT_TRUE(seatID == GENIVI::NodeStateManagerTypes::NsmSeat_e::NsmSeat_Driver);
+ ASSERT_TRUE(sessionState == GENIVI::NodeStateManagerTypes::NsmSessionState_e::NsmSessionState_Unregistered);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_GENIVI_SessionState ==> end"));
+}
diff --git a/NodeStateMachineTest/NodeStateTest_STRESS.cpp b/NodeStateMachineTest/NodeStateTest_STRESS.cpp
new file mode 100644
index 0000000..f417115
--- /dev/null
+++ b/NodeStateMachineTest/NodeStateTest_STRESS.cpp
@@ -0,0 +1,143 @@
+/**********************************************************************************************************************
+ *
+ * Copyright (C) 2017 BMW AG
+ *
+ * Implements tests for NSM
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ **********************************************************************************************************************/
+
+#include <gtest/gtest.h>
+#include <iostream>
+#include <dlt.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1/org/genivi/nodestatemanager/ConsumerProxy.hpp>
+#include <v1/org/genivi/nodestatemanager/ConsumerProxyBase.hpp>
+#include <v1/org/genivi/nodestatemanager/LifecycleControlProxy.hpp>
+
+#include <v1/org/genivi/nodestatemachinetest/TestProxy.hpp>
+
+#include "../NodeStateManager/NodeStateTypes.h"
+#include "../NodeStateManager/NodeStateManager.h"
+
+namespace GENIVI = v1::org::genivi;
+using namespace GENIVI::nodestatemanager;
+
+#define NUM_CONSUMER 30
+
+DLT_DECLARE_CONTEXT(gNSMTestContext);
+
+class NSMTest_STRESS: public testing::Test
+{
+protected:
+ virtual void SetUp()
+ {
+ //Define application ID
+ CommonAPI::Runtime::setProperty("LogContext", "CAPI");
+
+ runtime = CommonAPI::Runtime::get();
+
+ proxyLifecycleControl = runtime->buildProxy<LifecycleControlProxy>("local", "NSMLifecycleControl", "LifecycleControl");
+ ASSERT_FALSE(proxyLifecycleControl == NULL);
+ ASSERT_TRUE(proxyLifecycleControl->isAvailableBlocking());
+
+ int i = 0;
+ for (i = 0; i < NUM_CONSUMER; i++)
+ {
+ char name[255];
+ sprintf(name, "Consumer_%i", i);
+ proxyConsumer[i] = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", name);
+ ASSERT_FALSE(proxyConsumer[i] == NULL);
+ ASSERT_TRUE(proxyConsumer[i]->isAvailableBlocking());
+ }
+ }
+
+ virtual void TearDown()
+ {
+ // nothing to do
+ }
+
+ CommonAPI::CallStatus callStatus;
+ int32_t var_i32 = 0;
+ uint32_t var_ui32 = 0;
+ GENIVI::NodeStateManagerTypes::NsmErrorStatus_e errorCode = GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_NotSet;
+
+ std::shared_ptr<CommonAPI::Runtime> runtime;
+ std::shared_ptr<LifecycleControlProxyDefault> proxyLifecycleControl;
+
+
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer[NUM_CONSUMER];
+
+public:
+
+};
+
+/********************************************************************************************
+ * main()
+ ********************************************************************************************/
+
+int main(int argc, char **argv)
+{
+ int retVal = 1;
+ DLT_REGISTER_APP("NSMT", "Unit tests for NSM");
+ DLT_REGISTER_CONTEXT(gNSMTestContext, "STR", "Context for Stress Tests");
+
+ testing::InitGoogleTest(&argc, argv);
+ retVal = RUN_ALL_TESTS();
+
+ // unregister debug log and trace
+ DLT_UNREGISTER_CONTEXT(gNSMTestContext);
+ DLT_UNREGISTER_APP();
+ return retVal;
+}
+
+/********************************************************************************************
+ * Stress Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_STRESS, StressTest)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_STRESS_StressTest ==> start"));
+
+ RecordProperty("TestCaseID", "STRESS_StressTest");
+ RecordProperty("TestCaseDescription", "");
+
+ int barrier = 0;
+ int i = 0;
+ for (i = 0; i < NUM_CONSUMER; i++)
+ {
+ proxyConsumer[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(NSM_SHUTDOWNTYPE_NORMAL, mode);
+ barrier = 1;
+ });
+ do
+ {
+ proxyConsumer[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, 2000, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ // Set NodeState to ShuttingDown
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_ShuttingDown, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ for (i = NUM_CONSUMER-1; i >=0 ; i--)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrier)
+ {
+ usleep(10);
+ }
+ barrier = 1;
+ proxyConsumer[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ }
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_STRESS_StressTest ==> end"));
+}
diff --git a/NodeStateMachineTest/NodeStateTest_TIMEOUT.cpp b/NodeStateMachineTest/NodeStateTest_TIMEOUT.cpp
new file mode 100644
index 0000000..60e5d75
--- /dev/null
+++ b/NodeStateMachineTest/NodeStateTest_TIMEOUT.cpp
@@ -0,0 +1,833 @@
+/**********************************************************************************************************************
+ *
+ * Copyright (C) 2017 BMW AG
+ *
+ * Implements tests for NSM
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ **********************************************************************************************************************/
+
+#include <gtest/gtest.h>
+#include <iostream>
+#include <dlt.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <v1/org/genivi/nodestatemanager/ConsumerProxy.hpp>
+#include <v1/org/genivi/nodestatemanager/ConsumerProxyBase.hpp>
+#include <v1/org/genivi/nodestatemanager/LifecycleControlProxy.hpp>
+
+#include <v1/org/genivi/nodestatemachinetest/TestProxy.hpp>
+
+#include "../NodeStateManager/NodeStateTypes.h"
+#include "../NodeStateManager/NodeStateManager.h"
+
+namespace NodeStateMachineTest = v1::org::genivi::nodestatemachinetest;
+
+namespace GENIVI = v1::org::genivi;
+using namespace GENIVI::nodestatemanager;
+
+#define NUM_CONSUMER_PARALLEL 8
+#define NUM_CONSUMER_SEQUENTIAL 8
+
+DLT_DECLARE_CONTEXT(gNSMTestContext);
+
+class NSMTest_TIMEOUT: public testing::Test
+{
+protected:
+ virtual void SetUp()
+ {
+ //Define application ID
+ CommonAPI::Runtime::setProperty("LogContext", "CAPI");
+
+ runtime = CommonAPI::Runtime::get();
+
+ proxyConsumer_1 = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", "Consumer_1");
+ ASSERT_FALSE(proxyConsumer_1 == NULL);
+ ASSERT_TRUE(proxyConsumer_1->isAvailableBlocking());
+
+ proxyConsumer_2 = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", "Consumer_2");
+ ASSERT_FALSE(proxyConsumer_2 == NULL);
+ ASSERT_TRUE(proxyConsumer_2->isAvailableBlocking());
+
+ int i = 0;
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ char name[255];
+ sprintf(name, "Consumer_parallel_%i", i);
+ proxyConsumerParallel[i] = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", name);
+ ASSERT_FALSE(proxyConsumerParallel[i] == NULL);
+ ASSERT_TRUE(proxyConsumerParallel[i]->isAvailableBlocking());
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ char name[255];
+ sprintf(name, "Consumer_sequential_%i", i);
+ proxyConsumerSequential[i] = runtime->buildProxy<ConsumerProxy>("local", "NSMConsumer", name);
+ ASSERT_FALSE(proxyConsumerSequential[i] == NULL);
+ ASSERT_TRUE(proxyConsumerSequential[i]->isAvailableBlocking());
+ }
+
+ proxyLifecycleControl = runtime->buildProxy<LifecycleControlProxy>("local", "NSMLifecycleControl", "LifecycleControl");
+ proxyTest = runtime->buildProxy<NodeStateMachineTest::TestProxy>("local", "NSMTest", "Test");
+
+ ASSERT_FALSE(proxyConsumer_1 == NULL);
+ ASSERT_FALSE(proxyConsumer_2 == NULL);
+ ASSERT_FALSE(proxyLifecycleControl == NULL);
+ ASSERT_FALSE(proxyTest == NULL);
+ ASSERT_TRUE(proxyConsumer_1->isAvailableBlocking());
+ ASSERT_TRUE(proxyConsumer_2->isAvailableBlocking());
+ ASSERT_TRUE(proxyLifecycleControl->isAvailableBlocking());
+ ASSERT_TRUE(proxyTest->isAvailableBlocking());
+ }
+
+ virtual void TearDown()
+ {
+ int i = 0;
+ proxyConsumer_1 = NULL;
+ proxyConsumer_2 = NULL;
+ proxyLifecycleControl = NULL;
+ proxyTest = NULL;
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i] = NULL;
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i] = NULL;
+ }
+ }
+
+ CommonAPI::CallStatus callStatus;
+ int32_t var_i32 = 0;
+ uint32_t var_ui32 = 0;
+ GENIVI::NodeStateManagerTypes::NsmErrorStatus_e errorCode = GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_NotSet;
+
+ std::shared_ptr<CommonAPI::Runtime> runtime;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer_1;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumer_2;
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumerParallel[NUM_CONSUMER_PARALLEL];
+ std::shared_ptr<ConsumerProxyDefault> proxyConsumerSequential[NUM_CONSUMER_SEQUENTIAL];
+
+ std::shared_ptr<LifecycleControlProxyDefault> proxyLifecycleControl;
+ std::shared_ptr<NodeStateMachineTest::TestProxyDefault> proxyTest;
+
+ uint32_t expectedModeSequential = NSM_SHUTDOWNTYPE_NORMAL;
+ uint32_t expectedModeParallel = NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL;
+
+ int barrierSequential = 0;
+ int barrierParallel = 0;
+
+public:
+
+};
+
+/********************************************************************************************
+ * main()
+ ********************************************************************************************/
+
+int main(int argc, char **argv)
+{
+ int retVal = 1;
+ DLT_REGISTER_APP("NSMT", "Unit tests for NSM");
+ DLT_REGISTER_CONTEXT(gNSMTestContext,"TO","Context for Timeout Tests");
+
+ testing::InitGoogleTest(&argc, argv);
+ retVal = RUN_ALL_TESTS();
+
+ // unregister debug log and trace
+ DLT_UNREGISTER_CONTEXT(gNSMTestContext);
+ DLT_UNREGISTER_APP();
+ return retVal;
+}
+
+/********************************************************************************************
+ * Timeout Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_TIMEOUT, TimeoutTest)
+{
+ RecordProperty("TestCaseID", "TIMEOUT_TimeoutTest");
+ RecordProperty("TestCaseDescription", "");
+
+ int barrier_1 = 0;
+ int barrier_2 = 0;
+
+ uint32_t expected_mode = NSM_SHUTDOWNTYPE_NOT;
+ // Initialize
+
+ proxyConsumer_1->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expected_mode);
+ barrier_1 = 1;
+ });
+ do
+ {
+ proxyConsumer_1->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, 5000, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer_2->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expected_mode);
+ barrier_2 = 1;
+ });
+ do
+ {
+ proxyConsumer_2->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, 750, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ expected_mode = NSM_SHUTDOWNTYPE_NORMAL;
+
+ // Set NodeState to ShuttingDown
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_ShuttingDown, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // delay so proxyConsumer_2 will timeout
+ sleep(1);
+
+ // NOTE: The error is printed in DLT. This log is currently checked in run_tests.sh
+
+ while(0 == barrier_2) { usleep(10); } barrier_2 = 0;
+
+ proxyConsumer_2->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ // consumer_2 should get an error because he is to late
+ ASSERT_EQ(NsmErrorStatus_WrongClient, errorCode);
+
+
+ expected_mode = NSM_SHUTDOWNTYPE_RUNUP;
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // Shutdown call
+ while(0 == barrier_1) { usleep(10); } barrier_1 = 0;
+ proxyConsumer_1->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(NsmErrorStatus_Ok, errorCode);
+
+ // Runup call
+ while(0 == barrier_1) { usleep(10); } barrier_1 = 0;
+ proxyConsumer_1->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_EQ(NsmErrorStatus_Ok, errorCode);
+
+ // NOTE: The error is printed in DLT. This log is currently checked in run_tests.sh
+
+ while(0 == barrier_2) { usleep(10); } barrier_2 = 0;
+
+ // delay so proxyConsumer_2 will timeout
+ sleep(1);
+
+ proxyConsumer_2->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ // consumer_2 should get an error because he is to late
+ ASSERT_EQ(NsmErrorStatus_WrongClient, errorCode);
+
+ proxyConsumer_1->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ proxyConsumer_2->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TimeoutTest ==> end"));
+}
+
+TEST_F(NSMTest_TIMEOUT, TimeoutTestParallel)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TimeoutTestParallel ==> start"));
+
+ RecordProperty("TestCaseID", "TIMEOUT_TimeoutTestParallel");
+ RecordProperty("TestCaseDescription", "");
+
+ int i = 0;
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeParallel);
+ __sync_fetch_and_add(&barrierParallel, 1);
+ });
+ do
+ {
+ proxyConsumerParallel[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL, 500, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeSequential);
+ barrierSequential = 1;
+ });
+ do
+ {
+ proxyConsumerSequential[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, 500, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_ShuttingDown, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // Wait until SelectiveEvent is received...
+ while (NUM_CONSUMER_PARALLEL > barrierParallel)
+ {
+ usleep(10);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL - 1; i++)
+ {
+ proxyConsumerParallel[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ usleep(750*1000);
+ proxyConsumerParallel[NUM_CONSUMER_PARALLEL - 1]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongClient);
+
+ /* Don't complete all so nsm can runup again */
+ for (i = NUM_CONSUMER_SEQUENTIAL - 1; i > 1; i--)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+ proxyConsumerSequential[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ usleep(750*1000);
+ proxyConsumerSequential[1]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongClient);
+
+ barrierParallel = 0;
+
+ // Set NodeState to BaseRunning
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+
+ expectedModeParallel = NSM_SHUTDOWNTYPE_RUNUP | NSM_SHUTDOWNTYPE_PARALLEL;
+ expectedModeSequential = NSM_SHUTDOWNTYPE_RUNUP;
+
+ proxyConsumerSequential[0]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL - 1; i++)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+ proxyConsumerSequential[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ usleep(750 * 1000);
+ proxyConsumerSequential[NUM_CONSUMER_SEQUENTIAL - 1]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongClient);
+
+ while (NUM_CONSUMER_PARALLEL > barrierParallel)
+ {
+ usleep(10);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL-1; i++)
+ {
+ proxyConsumerParallel[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ usleep(750*1000);
+ proxyConsumerParallel[NUM_CONSUMER_PARALLEL - 1]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongClient);
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i]->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TimeoutTestParallel ==> end"));
+}
+
+TEST_F(NSMTest_TIMEOUT, TestNoTimeout)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TestNoTimeout ==> start"));
+
+ RecordProperty("TestCaseID", "TIMEOUT_TestNoTimeout");
+ RecordProperty("TestCaseDescription", "");
+
+ int i = 0;
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeParallel);
+ __sync_fetch_and_add(&barrierParallel, 1);
+ });
+ do
+ {
+ proxyConsumerParallel[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL, 500, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeSequential);
+ barrierSequential = 1;
+ });
+ do
+ {
+ proxyConsumerSequential[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, 500, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ // Set NodeState to ShuttingDown
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_ShuttingDown, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // Wait until SelectiveEvent is received...
+ while (NUM_CONSUMER_PARALLEL > barrierParallel)
+ {
+ usleep(10);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = NUM_CONSUMER_SEQUENTIAL - 1; i >= 0; i--)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+
+ proxyConsumerSequential[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ sleep(1);
+
+ expectedModeParallel = NSM_SHUTDOWNTYPE_RUNUP | NSM_SHUTDOWNTYPE_PARALLEL;
+ expectedModeSequential = NSM_SHUTDOWNTYPE_RUNUP;
+
+ // Set NodeState to ShuttingDown
+ barrierSequential = 0;
+ barrierParallel = 0;
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+
+ proxyConsumerSequential[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ while (NUM_CONSUMER_PARALLEL > barrierParallel)
+ {
+ usleep(10);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i]->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TestNoTimeout ==> end"));
+}
+
+TEST_F(NSMTest_TIMEOUT, TimeoutTestCollective)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TimeoutTestCollective ==> start"));
+
+ RecordProperty("TestCaseID", "TIMEOUT_TimeoutTestCollective");
+ RecordProperty("TestCaseDescription", "");
+
+ int i = 0;
+ GENIVI::NodeStateManagerTypes::NsmNodeState_e nodeState;
+ expectedModeSequential = NSM_SHUTDOWNTYPE_FAST;
+ expectedModeParallel = NSM_SHUTDOWNTYPE_FAST | NSM_SHUTDOWNTYPE_PARALLEL;
+
+ proxyConsumer_1->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeSequential);
+ barrierSequential = 1;
+ });
+ do
+ {
+ proxyConsumer_1->RegisterShutdownClient(NSM_SHUTDOWNTYPE_FAST, 61000, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ /* This client shouldn't count to the collective timeout as it unregisters */
+ proxyConsumer_1->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_FAST, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeParallel);
+ __sync_fetch_and_add(&barrierParallel, 1);
+ });
+ do
+ {
+ proxyConsumerParallel[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_FAST | NSM_SHUTDOWNTYPE_PARALLEL, 61000, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeSequential);
+ barrierSequential = 1;
+ });
+ do
+ {
+ proxyConsumerSequential[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_FAST, 61000, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ // Set NodeState to ShuttingDown
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_FastShutdown, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // Wait until SelectiveEvent is received...
+ while (NUM_CONSUMER_PARALLEL > barrierParallel)
+ {
+ usleep(10);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL-1; i++)
+ {
+ proxyConsumerParallel[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ sleep(3);
+
+ /* This client should get an error as it is to late */
+ proxyConsumerParallel[NUM_CONSUMER_PARALLEL-1]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongClient);
+
+ for (i = NUM_CONSUMER_SEQUENTIAL - 1; i > 1; i--)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+
+ proxyConsumerSequential[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ /* Trigger collective timeout of 3 seconds on fast shutdown */
+ sleep(4);
+
+ /* NodeState should be NsmNodeState_Shutdown already */
+ proxyConsumerSequential[1]->GetNodeState(callStatus, nodeState, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ ASSERT_EQ(nodeState, GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_Shutdown);
+
+ /* This client should get an error as it is to late */
+ proxyConsumerSequential[1]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_WrongClient);
+
+ sleep(1);
+
+ /* barrierSequential should still be 1 because it has not been set to 0 by proxyConsumerSequential[0] */
+ ASSERT_EQ(1, barrierSequential);
+
+ expectedModeParallel = NSM_SHUTDOWNTYPE_RUNUP | NSM_SHUTDOWNTYPE_PARALLEL;
+ expectedModeSequential = NSM_SHUTDOWNTYPE_RUNUP;
+
+ // Set NodeState to ShuttingDown
+ barrierSequential = 0;
+ barrierParallel = 0;
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ /* start at 1 because proxyConsumerSequential[0] should have never been informed about shutdown */
+ for (i = 1; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+
+ proxyConsumerSequential[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ while (NUM_CONSUMER_PARALLEL > barrierParallel)
+ {
+ usleep(10);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i]->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TimeoutTestCollective ==> end"));
+}
+
+TEST_F(NSMTest_TIMEOUT, TimeoutTestEarlyTimeout)
+{
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TimeoutTestEarlyTimeout ==> start"));
+
+ RecordProperty("TestCaseID", "TIMEOUT_TimeoutTestEarlyTimeout");
+ RecordProperty("TestCaseDescription", "");
+
+ int i = 0;
+ GENIVI::NodeStateManagerTypes::NsmNodeState_e nodeState;
+ expectedModeSequential = NSM_SHUTDOWNTYPE_NORMAL;
+ expectedModeParallel = NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL;
+
+ int timeouts[] = { 500, 1000, 2500, 5000, 10000, 15000, 20000, 25000 };
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeParallel);
+ __sync_fetch_and_add(&barrierParallel, 1);
+ });
+ do
+ {
+ proxyConsumerParallel[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL, timeouts[i], callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i]->getShutdownEventsSelectiveEvent().subscribe([&](const uint32_t mode)
+ {
+ ASSERT_EQ(mode, expectedModeSequential);
+ barrierSequential = 1;
+ });
+ do
+ {
+ proxyConsumerSequential[i]->RegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, 1000, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ } while (errorCode != GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ clock_t begin = clock();
+
+ // Set NodeState to ShuttingDown
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_ShuttingDown, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // Wait until SelectiveEvent is received...
+ while (NUM_CONSUMER_PARALLEL > barrierParallel)
+ {
+ usleep(10);
+ }
+
+ // 500ms timeout
+ proxyConsumerParallel[0]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ sleep(2);
+ // 1000ms timeout -> client 1 should be to late
+
+ // 2500ms timeout
+ proxyConsumerParallel[2]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // 5000ms timeout
+ proxyConsumerParallel[3]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // 10000ms timeout
+ proxyConsumerParallel[4]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // 15000ms timeout
+ proxyConsumerParallel[5]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // 20000ms timeout
+ proxyConsumerParallel[6]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ // 25000ms timeout
+ proxyConsumerParallel[7]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ for (i = NUM_CONSUMER_SEQUENTIAL - 1; i >= 0; i--)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+
+ proxyConsumerSequential[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+ sleep(1);
+
+
+ /* NodeState should be NsmNodeState_Shutdown already */
+ proxyConsumerSequential[1]->GetNodeState(callStatus, nodeState, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ ASSERT_EQ(nodeState, GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_Shutdown);
+
+ clock_t end = clock();
+
+ /* The only client that registered with 1000ms timeout doesn't respond -> bigger timeouts should not count to shutdown time */
+ ASSERT_TRUE((double(end - begin) / CLOCKS_PER_SEC) < 5);
+
+ sleep(1);
+
+ expectedModeParallel = NSM_SHUTDOWNTYPE_RUNUP | NSM_SHUTDOWNTYPE_PARALLEL;
+ expectedModeSequential = NSM_SHUTDOWNTYPE_RUNUP;
+
+ // Set NodeState to BaseRunning
+ barrierSequential = 0;
+ barrierParallel = 0;
+ proxyLifecycleControl->SetNodeState(GENIVI::NodeStateManagerTypes::NsmNodeState_e::NsmNodeState_BaseRunning, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ // Wait until SelectiveEvent is received...
+ while (0 == barrierSequential) { usleep(10); }
+ barrierSequential = 0;
+
+ proxyConsumerSequential[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ while (NUM_CONSUMER_PARALLEL - 1 > barrierParallel) // Client 1 had a time out so he will not be informed this time
+ {
+ usleep(10);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ if(i == 1) continue; // Client 1 had a time out so he will not be informed this time
+ proxyConsumerParallel[i]->LifecycleRequestComplete(GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_PARALLEL; i++)
+ {
+ proxyConsumerParallel[i]->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_PARALLEL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ for (i = 0; i < NUM_CONSUMER_SEQUENTIAL; i++)
+ {
+ proxyConsumerSequential[i]->UnRegisterShutdownClient(NSM_SHUTDOWNTYPE_NORMAL, callStatus, errorCode);
+ ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
+ ASSERT_TRUE(errorCode == GENIVI::NodeStateManagerTypes::NsmErrorStatus_e::NsmErrorStatus_Ok);
+ }
+
+ DLT_LOG(gNSMTestContext, DLT_LOG_INFO, DLT_STRING("run_test_TIMEOUT_TimeoutTestEarlyTimeout ==> end"));
+}
+
diff --git a/NodeStateMachineTest/NodeStateTest_WATCHDOG.cpp b/NodeStateMachineTest/NodeStateTest_WATCHDOG.cpp
new file mode 100644
index 0000000..3cec079
--- /dev/null
+++ b/NodeStateMachineTest/NodeStateTest_WATCHDOG.cpp
@@ -0,0 +1,95 @@
+/**********************************************************************************************************************
+ *
+ * Copyright (C) 2017 BMW AG
+ *
+ * Implements tests for NSM
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ **********************************************************************************************************************/
+
+#include <gtest/gtest.h>
+#include <iostream>
+#include <dlt.h>
+
+#include "../NodeStateManager/Watchdog.hpp"
+
+DLT_DECLARE_CONTEXT(NsmContext);
+
+class NSMTest_WATCHDOG: public testing::Test
+{
+protected:
+ virtual void SetUp()
+ {
+
+ }
+
+ virtual void TearDown()
+ {
+
+ }
+
+public:
+
+};
+
+/********************************************************************************************
+ * main()
+ ********************************************************************************************/
+
+int main(int argc, char **argv)
+{
+ int retVal = 1;
+ DLT_REGISTER_APP("NSMT", "Unit tests for NSM");
+ DLT_REGISTER_CONTEXT(NsmContext,"WD","Context for Watchdog Tests");
+
+ testing::InitGoogleTest(&argc, argv);
+ retVal = RUN_ALL_TESTS();
+
+ // unregister debug log and trace
+ DLT_UNREGISTER_CONTEXT(NsmContext);
+ DLT_UNREGISTER_APP();
+ return retVal;
+}
+
+/********************************************************************************************
+ * Timeout Tests
+ ********************************************************************************************/
+
+TEST_F(NSMTest_WATCHDOG, WatchdogTimeout)
+{
+ RecordProperty("TestCaseID", "WatchdogTimeout");
+ RecordProperty("TestCaseDescription", "");
+
+ DLT_LOG(NsmContext, DLT_LOG_INFO, DLT_STRING("run_test_WatchdogTimeout ==> start"));
+
+ NSMTriggerWatchdog(NsmWatchdogState_Active);
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ NSMTriggerWatchdog(NsmWatchdogState_Active);
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ ASSERT_FALSE(NSMWatchdogIsHappy());
+ NSMTriggerWatchdog(NsmWatchdogState_Active);
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ NSMUnregisterWatchdog();
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ NSMTriggerWatchdog(NsmWatchdogState_Active);
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ NSMTriggerWatchdog(NsmWatchdogState_Active);
+ NSMTriggerWatchdog(NsmWatchdogState_Sleep);
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ NSMTriggerWatchdog(NsmWatchdogState_Active);
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ ASSERT_FALSE(NSMWatchdogIsHappy());
+
+ NSMTriggerWatchdog(NsmWatchdogState_Sleep);
+ NSMTriggerSpecificWatchdog(NsmWatchdogState_Active, 1);
+ ASSERT_TRUE(NSMWatchdogIsHappy());
+ ASSERT_FALSE(NSMWatchdogIsHappy());
+
+ DLT_LOG(NsmContext, DLT_LOG_INFO, DLT_STRING("run_test_WatchdogTimeout ==> end"));
+}
+
+
diff --git a/NodeStateMachineTest/org.genivi.NodeStateMachineTest.xml b/NodeStateMachineTest/org.genivi.NodeStateMachineTest.xml
deleted file mode 100644
index 9426f45..0000000
--- a/NodeStateMachineTest/org.genivi.NodeStateMachineTest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
-*
-* Copyright (C) 2012 Continental Automotive Systems, Inc.
-*
-* Author: Jean-Pierre.Bogler@continental-corporation.com
-*
-* XML model of the dbus interfaces for the test NodeStateMachine
-*
-* 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/.
-*
-* Date Author Reason
-* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
-*
--->
-
-<node>
- <interface name="com.contiautomotive.NodeStateMachineTest.Test">
- <method name="SetNsmData">
- <arg name="DataType" direction="in" type="i"/>
- <arg name="Data" direction="in" type="ay"/>
- <arg name="DataLen" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
- <method name="GetNsmData">
- <arg name="DataType" direction="in" type="i"/>
- <arg name="DataIn" direction="in" type="ay"/>
- <arg name="DataOut" direction="out" type="ay"/>
- <arg name="DataLen" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
- <method name="GetNsmInterfaceVersion">
- <arg name="Version" direction="out" type="u"/>
- </method>
- </interface>
-</node>
diff --git a/NodeStateMachineTest/test/run_test.sh b/NodeStateMachineTest/test/run_test.sh
new file mode 100755
index 0000000..e5158a1
--- /dev/null
+++ b/NodeStateMachineTest/test/run_test.sh
@@ -0,0 +1,68 @@
+#######################################################################################################################
+#
+# Copyright (C) 2020 Mentor Graphics (Deutschland) GmbH
+#
+# Author: Vignesh_Rajendran@mentor.com
+#
+# Script to run the NSM Tests
+#
+# 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/.
+#
+#######################################################################################################################
+
+#!/bin/bash
+
+BUILD_DIR=$(readlink -f $(dirname $0)/..)
+
+# Make sure test command is given as argument:
+if [ -z $1 ]
+then
+ echo "No test command given."
+ echo "It is recommended to run the tests using ctest."
+ exit 1
+fi
+
+# Set exit handler:
+function on_exit
+{
+ echo "Exiting test script"
+ if [ ! -z $NSM_PID ]
+ then
+ echo "Killing NSM"
+ kill -9 $NSM_PID
+ fi
+}
+trap on_exit EXIT
+
+# Kill running NSM instances:
+pkill -f NodeStateManager
+
+# Delete old temp files:
+rm -rf /tmp/vsomeip*
+rm -rf /tmp/nsm*
+
+# Launch NSM:
+echo "Starting NSM"
+export LD_LIBRARY_PATH=$BUILD_DIR/NodeStateAccess:$BUILD_DIR/NodeStateMachineStub:$LD_LIBRARY_PATH
+$BUILD_DIR/NodeStateManager/NodeStateManager > /tmp/nsm_out 2>&1 & NSM_PID=$!
+sleep 2
+
+# Check if NSM launched successfully:
+ps -p $NSM_PID >/dev/null
+if (( $? != 0 ))
+then
+ echo "ERROR: NSM didn't launch successfully. See /tmp/nsm_out"
+ exit 1
+fi
+
+export WATCHDOG_USEC=1000000
+
+GTEST_OUTPUT_PREFIX=xml:/tmp/
+export GTEST_OUTPUT=${GTEST_OUTPUT_PREFIX}nsm_test_result_${1}.xml
+
+# Launch test command given as argument:
+echo "Running test \"$1\""
+$1
+exit $?