diff options
author | Cosmin Cernat <cosmin.cernat@continental-corporation.com> | 2017-01-27 17:25:38 +0200 |
---|---|---|
committer | Cosmin Cernat <cosmin.cernat@continental-corporation.com> | 2017-01-27 16:27:59 +0100 |
commit | cca0130f31951b0959eabcd3569d28bb33760167 (patch) | |
tree | 6d025a0f0209e86353e1c3d56b48ba873c4492da | |
parent | 272398a4ad1aa434b0edb5ba42efd7bceccc3963 (diff) | |
download | persistence-administrator-cca0130f31951b0959eabcd3569d28bb33760167.tar.gz |
PAS-3 - Remove irrelevant functionality from pers_admin_test_framework
Change-Id: I0430d7fc06dbfa9bdbbe47782069db24c0a96672
Signed-off-by: Cosmin Cernat <cosmin.cernat@continental-corporation.com>
-rw-r--r-- | test/pers_svc_test/Makefile.am | 13 | ||||
-rw-r--r-- | test/pers_svc_test/dbus_specifications/OIPModuleTestPASCodeGeneration.txt | 1 | ||||
-rw-r--r-- | test/pers_svc_test/dbus_specifications/OIPModuleTestPASCodeGeneration.xml | 25 | ||||
-rw-r--r-- | test/pers_svc_test/dbus_specifications/OIPModuleTestPASDBusCall.txt | 3 | ||||
-rw-r--r-- | test/pers_svc_test/inc/test_PAS.h | 6 | ||||
-rwxr-xr-x | test/pers_svc_test/src/test_PAS.c | 3 | ||||
-rw-r--r-- | test/pers_svc_test/src/test_PAS_dbus.c | 233 |
7 files changed, 2 insertions, 282 deletions
diff --git a/test/pers_svc_test/Makefile.am b/test/pers_svc_test/Makefile.am index 4a95fb6..bc16bd4 100644 --- a/test/pers_svc_test/Makefile.am +++ b/test/pers_svc_test/Makefile.am @@ -23,7 +23,7 @@ bin_PROGRAMS = pers_admin_test_framework # pers_admin_test_framework_CFLAGS = \ - -I $(top_srcdir)/Administrator/inc/private -I $(top_srcdir)/Administrator/inc/public -I inc -I generated \ + -I $(top_srcdir)/Administrator/inc/private -I $(top_srcdir)/Administrator/inc/public -I inc \ $(DLT_CFLAGS) \ $(GIO_CFLAGS) \ $(GIO_UNIX_CFLAGS) \ @@ -49,7 +49,6 @@ pers_admin_test_framework_LDADD = \ pers_admin_test_framework_SOURCES = \ $(top_srcdir)/Administrator/src/ssw_pers_admin_files_helper.c \ - generated/PasModuleTestGen.c \ src/test_PAS.c \ src/test_pas_check_data_after_backup_application.c \ src/test_pas_check_data_after_backup_create_all.c \ @@ -57,7 +56,6 @@ pers_admin_test_framework_SOURCES = \ src/test_pas_check_data_after_backup_user2_seat_all.c \ src/test_pas_check_data_after_delete_user2_data.c \ src/test_pas_check_data_after_reset.c \ - src/test_PAS_dbus.c \ src/test_pas_import_all.c \ src/test_pas_import_app.c \ src/test_pas_import_source_content.c \ @@ -77,12 +75,3 @@ pers_admin_test_framework_SOURCES = \ src/test_pas_restore_default_User1.c \ src/test_pas_restore_default_User2App1.c \ src/test_pas_restore_default_User2Seat1.c - -generated/PasModuleTestGen.c: dbus_specifications/OIPModuleTestPASCodeGeneration.xml - mkdir -p generated - gdbus-codegen --interface-prefix="org.genivi.persistence." --c-namespace="OipPersistence" --generate-c-code="generated/PasModuleTestGen" dbus_specifications/OIPModuleTestPASCodeGeneration.xml - - -# Delete all generated files on 'make clean' -CLEANFILES = generated/PasModuleTestGen.c \ - generated/PasModuleTestGen.h diff --git a/test/pers_svc_test/dbus_specifications/OIPModuleTestPASCodeGeneration.txt b/test/pers_svc_test/dbus_specifications/OIPModuleTestPASCodeGeneration.txt deleted file mode 100644 index 2e77971..0000000 --- a/test/pers_svc_test/dbus_specifications/OIPModuleTestPASCodeGeneration.txt +++ /dev/null @@ -1 +0,0 @@ -gdbus-codegen --interface-prefix="org.genivi.persistence." --c-namespace="OipPersistence" --generate-c-code="PasModuleTestGen" OIPModuleTestPASCodeGeneration.xml
\ No newline at end of file diff --git a/test/pers_svc_test/dbus_specifications/OIPModuleTestPASCodeGeneration.xml b/test/pers_svc_test/dbus_specifications/OIPModuleTestPASCodeGeneration.xml deleted file mode 100644 index 12d7f10..0000000 --- a/test/pers_svc_test/dbus_specifications/OIPModuleTestPASCodeGeneration.xml +++ /dev/null @@ -1,25 +0,0 @@ -<!-- -* -* Copyright (C) 2012-2013 Continental Automotive GmbH. -* -* Author: guy.sagnes@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 -* 2012.11.27 uidu0250 CSP_WZ#1280: Initial version -* ---> -<node> - <interface name="org.genivi.persistence.admintestframework"> - <method name="ExecuteTestCases"> - <arg name="noOfTestCases" type="i" direction="out"/> - <arg name="noOfTestCasesSuccessful" type="i" direction="out"/> - <arg name="noOfTestCasesFailed" type="i" direction="out"/> - </method> - </interface> -</node> diff --git a/test/pers_svc_test/dbus_specifications/OIPModuleTestPASDBusCall.txt b/test/pers_svc_test/dbus_specifications/OIPModuleTestPASDBusCall.txt deleted file mode 100644 index c607a15..0000000 --- a/test/pers_svc_test/dbus_specifications/OIPModuleTestPASDBusCall.txt +++ /dev/null @@ -1,3 +0,0 @@ -dbus-send --system --dest=org.genivi.persistence.admintestframework --print-reply \ ---type=method_call /org/genivi/persistence/admintestframework \ -org.genivi.persistence.admintestframework.ExecuteTestCases
\ No newline at end of file diff --git a/test/pers_svc_test/inc/test_PAS.h b/test/pers_svc_test/inc/test_PAS.h index 8b50cca..6e0d469 100644 --- a/test/pers_svc_test/inc/test_PAS.h +++ b/test/pers_svc_test/inc/test_PAS.h @@ -11,7 +11,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Date Author Reason -* 2013.04.15 uidu0250 CSP_WZ#3424: Add IF extension for "restore to default" +* 2013.04.15 uidu0250 CSP_WZ#3424: Add IF extension for "restore to default" * 2012.11.29 uidv2833 CSP_WZ#1280: Adapted implementation for the new test framework * 2012.11.28 uidl9757 CSP_WZ#1280: Initial version * @@ -32,10 +32,6 @@ extern "C" /* needed because of change in PCL (should be removed later) */ #define TST_DEFAULT_CONTEXT {0xFF, 0xFF, 0xFF} -#define PERSISTENCE_ADMIN_TF_BUS_TYPE 1 //G_BUS_TYPE_SYSTEM (see gioenums.h) -#define PERSISTENCE_ADMIN_TF_BUS_NAME "org.genivi.persistence.admintestframework" -#define PERSISTENCE_ADMIN_TF_OBJ_PATH "/org/genivi/persistence/admintestframework" -#define PERSISTENCE_ADMIN_TF_IFACE "org.genivi.persistence.admintestframework" #define MAX_PATH_SIZE ( 256 ) #define MAX_APPLICATION_NAME_SIZE ( 64 ) diff --git a/test/pers_svc_test/src/test_PAS.c b/test/pers_svc_test/src/test_PAS.c index f385164..37e7997 100755 --- a/test/pers_svc_test/src/test_PAS.c +++ b/test/pers_svc_test/src/test_PAS.c @@ -41,7 +41,6 @@ #include "persComRct.h" #include "ssw_pers_admin_files_helper.h" -#include "ssw_pers_admin_dbus.h" #include "persistence_admin_service.h" @@ -1954,8 +1953,6 @@ int main(void) //sprintf(g_msg, "\n\n++++++++++ Test PAS - FINISH ++++++++++++++++\n\n") ; DLT_LOG(testPersAdminDLTCtx, DLT_LOG_INFO, DLT_STRING(LT_HDR), DLT_STRING("++++++++++ Test PAS - FINISH ++++++++++++++++")); - /* Init and run the main DBus loop */ - persadmin_RunDBusMainLoop(); return 1 ; } diff --git a/test/pers_svc_test/src/test_PAS_dbus.c b/test/pers_svc_test/src/test_PAS_dbus.c deleted file mode 100644 index 550ca76..0000000 --- a/test/pers_svc_test/src/test_PAS_dbus.c +++ /dev/null @@ -1,233 +0,0 @@ -/********************************************************************************************************************* -* -* Copyright (C) 2012 Continental Automotive Systems, Inc. -* -* Author: Petrica.Manoila@continental-corporation.com -* -* Implementation of backup process -* -* 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 -* 2012.11.27 uidu0250 CSP_WZ#1280: Initial version -* -**********************************************************************************************************************/ - -#include "stdio.h" -#include <stdlib.h> -#include <string.h> -#include <gio/gio.h> -#include <pthread.h> - -#include "test_PAS.h" -#include "PasModuleTestGen.h" - - - -/********************************************************************************************************************** -* -* Global variables. Initialization of global contexts. -* -**********************************************************************************************************************/ -static GMainLoop *g_pMainLoop = NULL; -static GDBusConnection *g_pBusConnection = NULL; -static OipPersistenceAdmintestframeworkSkeleton *g_pTFSkeleton = NULL; -static volatile bool_t g_bDBusConnInit = false; - -static pthread_mutex_t testOpMtx; // run test cases - operation mutex - - - -/********************************************************************************************************************** -* -* Prototypes for local functions (see implementation for description) -* -**********************************************************************************************************************/ - -static void OnBusAcquired_cb(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData); -static void OnNameAcquired_cb(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData); -static void OnNameLost_cb(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData); - -/* ExecuteTestCases */ -static gboolean OnHandleExecuteTestCases ( OipPersistenceAdmintestframework *object, - GDBusMethodInvocation *invocation); - - - -/********************************************************************************************************************** -* -* The function is called when a connection to the D-Bus could be established. -* According to the documentation the objects should be exported here. -* -* @param pConnection: Connection, which was acquired -* @param sName: Bus name -* @param pUserData: Optionally user data -* -* @return void -* -**********************************************************************************************************************/ -static void OnBusAcquired_cb(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData) -{ - GError *pError = NULL; - - /* Store the connection. */ - g_pBusConnection = pConnection; - - /* Create real object to offer on the DBus */ - g_pTFSkeleton = (OipPersistenceAdmintestframeworkSkeleton*) oip_persistence_admintestframework_skeleton_new(); - - g_signal_connect(g_pTFSkeleton, "handle-execute-test-cases", G_CALLBACK(OnHandleExecuteTestCases), pUserData); - - /* Attach interfaces to the objects and export them */ - if(TRUE == g_dbus_interface_skeleton_export( G_DBUS_INTERFACE_SKELETON(g_pTFSkeleton), - g_pBusConnection, - PERSISTENCE_ADMIN_TF_OBJ_PATH, - &pError)) - { - printf("Successfully connected to D-Bus and exported object.\n"); - } - else - { - /* Error: the PersistenceAdminService TF interface could not be exported. */ - printf("Failed to export PersistenceAdminService TF object.\n"); - g_main_loop_quit(g_pMainLoop); - } - fflush(stdout); -} - - - -/********************************************************************************************************************** -* -* The function is called when the "bus name" could be acquired on the D-Bus. -* -* @param pConnection: Connection over which the bus name was acquired -* @param sName: Acquired bus name -* @param pUserData: Optionally user data -* -* @return void -* -**********************************************************************************************************************/ -static void OnNameAcquired_cb(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData) -{ - printf("Successfully obtained D-Bus name: %s\n", sName); - - /* DBus connection initialized */ - g_bDBusConnInit = true; - - fflush(stdout); -} - - - -/********************************************************************************************************************** -* -* The function is called if either no connection to D-Bus could be established or -* the bus name could not be acquired. -* -* @param pConnection: Connection. If it is NULL, no D-Bus connection could be established. -* Otherwise the bus name was lost. -* @param sName: Bus name -* @param pUserData: Optionally user data -* -* @return void -* -**********************************************************************************************************************/ -static void OnNameLost_cb(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData) -{ - if(pConnection == NULL) - { - /* Error: the connection could not be established. */ - printf("Failed to establish D-Bus connection."); - } - else - { - /* Error: connection established, but name not obtained. This might be a second instance of the application */ - printf("Failed to obtain bus name %s\n", sName); - } - fflush(stdout); - - /* In both cases leave the main loop. */ - g_main_loop_quit(g_pMainLoop); -} - - - -/********************************************************************************************************************** -* -* Handler for ExecuteTestCases. -* Signature based on generated code. -* -**********************************************************************************************************************/ -static gboolean OnHandleExecuteTestCases ( OipPersistenceAdmintestframework *object, - GDBusMethodInvocation *invocation) -{ - sint_t noOfTestCases = 0; - sint_t noOfTestCasesSuccessful = 0; - sint_t noOfTestCasesFailed = 0; - - // Acquire op mutex - pthread_mutex_lock (&testOpMtx); - - ExecuteTestCases( &noOfTestCases, - &noOfTestCasesSuccessful, - &noOfTestCasesFailed ); - - // Release list mutex - pthread_mutex_unlock (&testOpMtx); - - oip_persistence_admintestframework_complete_execute_test_cases( object, - invocation, - noOfTestCases, - noOfTestCasesSuccessful, - noOfTestCasesFailed); - - return(TRUE); -} - - -/********************************************************************************************************************** -* -* Initialize DBus registration mechanism -* -**********************************************************************************************************************/ -void persadmin_RunDBusMainLoop() -{ - uint u32ConnectionId = 0; - - /* Initialize glib */ - g_type_init(); - - /* Init synchronization objects */ - pthread_mutex_init (&testOpMtx, NULL); - - /* Create the main loop */ - g_pMainLoop = g_main_loop_new(NULL, FALSE); - - - /* Connect to the D-Bus. Obtain a bus name to offer PAS objects */ - u32ConnectionId = g_bus_own_name( PERSISTENCE_ADMIN_TF_BUS_TYPE - , PERSISTENCE_ADMIN_TF_BUS_NAME - , G_BUS_NAME_OWNER_FLAGS_NONE - , &OnBusAcquired_cb - , &OnNameAcquired_cb - , &OnNameLost_cb - , NULL - , NULL); - - /* The main loop is only canceled if the Node is completely shut down or the D-Bus connection fails */ - g_main_loop_run(g_pMainLoop); - - /* If the main loop returned, clean up. Release bus name and main loop */ - g_bus_unown_name(u32ConnectionId); - g_main_loop_unref(g_pMainLoop); - - - /* Release the (created) skeleton object */ - if(NULL != g_pTFSkeleton) - { - g_object_unref(g_pTFSkeleton); - } -} |