summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Huerner <ingo.huerner@xse.de>2015-02-03 13:44:15 +0100
committerIngo Huerner <ingo.huerner@xse.de>2015-02-03 13:44:15 +0100
commite940be028e4dd8210a0c46c6942e70d6525913c8 (patch)
tree7d6339a83a591cb8122cfa0a8406a3f6eaed9097
parentd6a46c9081969523256423f69c81e6d398238817 (diff)
downloadpersistence-client-library-e940be028e4dd8210a0c46c6942e70d6525913c8.tar.gz
Added test case; removed setting of dlt log level
-rw-r--r--src/persistence_client_library.c1
-rw-r--r--test/persistence_client_library_test.c111
2 files changed, 102 insertions, 10 deletions
diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c
index 7c3f178..af20fb7 100644
--- a/src/persistence_client_library.c
+++ b/src/persistence_client_library.c
@@ -126,7 +126,6 @@ int pclInitLibrary(const char* appName, int shutdownMode)
if(gPclInitCounter == 0)
{
DLT_REGISTER_CONTEXT(gPclDLTContext,"PCL","Context for persistence client library logging");
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEBUG, DLT_TRACE_STATUS_OFF);
DLT_LOG(gPclDLTContext, DLT_LOG_DEBUG, DLT_STRING("pclInitLibrary => INIT PCL - "), DLT_STRING(appName),
DLT_STRING("- init counter: "), DLT_INT(gPclInitCounter) );
diff --git a/test/persistence_client_library_test.c b/test/persistence_client_library_test.c
index 24238b8..35375ac 100644
--- a/test/persistence_client_library_test.c
+++ b/test/persistence_client_library_test.c
@@ -31,22 +31,17 @@
//#include "persCheck.h"
#include <check.h>
-
#include "../include/persistence_client_library_file.h"
#include "../include/persistence_client_library_key.h"
#include "../include/persistence_client_library.h"
#include "../include/persistence_client_library_error_def.h"
-
-
#define BUF_SIZE 64
#define NUM_OF_FILES 3
#define READ_SIZE 1024
#define MaxAppNameLen 256
-
#define SOURCE_PATH "/Data/mnt-c/lt-persistence_client_library_test/"
-
static const char* gPathSegemnts[] = {"user/", "1/", "seat/", "1/", "media", NULL };
/// application id
@@ -61,7 +56,6 @@ char* gRecovChecksum = "608a3b5d"; // generated with http://www.tools4noobs.com/
// function prototype
void run_concurrency_test();
-
void data_setup(void)
{
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
@@ -332,12 +326,11 @@ START_TEST(test_SetData)
#if 1
time_t t = time(0);
-
locTime = localtime(&t);
// write data
snprintf(sysTimeBuffer, 128, "\"%s %d.%d.%d - %d:%.2d:%.2d Uhr\"", dayOfWeek[locTime->tm_wday], locTime->tm_mday, locTime->tm_mon+1, (locTime->tm_year+1900),
- locTime->tm_hour, locTime->tm_min, locTime->tm_sec);
+ locTime->tm_hour, locTime->tm_min, locTime->tm_sec);
/**
* Logical DB ID: PCL_LDBID_LOCAL with user 1 and seat 2
@@ -1614,6 +1607,101 @@ START_TEST(test_SharedAccess)
END_TEST
+
+START_TEST(test_VO722)
+{
+ int ret = 0;
+ unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+
+ unsigned char buffer[256] = {0};
+ char* writeBuffer[] = {"VO722 - TestString One",
+ "VO722 - TestString Two -",
+ "VO722 - TestString Three -",};
+
+ char* writeBuffer2[] = {"2 - VO722 - Test - String One",
+ "2 - VO722 - Test - String Two -",
+ "2 - VO722 - Test - String Three -", };
+ (void)pclInitLibrary(gTheAppId, shutdownReg); // use the app id, the resource is registered for
+
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 1, 2, (unsigned char*)writeBuffer[0], strlen(writeBuffer[0]));
+ fail_unless(ret == (int)strlen(writeBuffer[0]), "Wrong write size");
+
+ memset(buffer, 0, 256);
+ ret = pclKeyReadData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 1, 2, (unsigned char*)buffer, 256);
+ //printf("****** 1.1. read AEVOO722 => buffer: \"%s\"\n", buffer);
+ fail_unless(ret == (int)strlen(writeBuffer[0]), "Failed to read shared data ");
+ fail_unless(strncmp((char*)buffer, writeBuffer[0], strlen((char*)writeBuffer[0])) == 0, "Buffer not correctly read - 1.1");
+
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 1, 2, (unsigned char*)writeBuffer[1], strlen(writeBuffer[1]));
+ fail_unless(ret == (int)strlen(writeBuffer[1]), "Wrong write size");
+
+ memset(buffer, 0, 256);
+ ret = pclKeyReadData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 1, 2, (unsigned char*)buffer, 256);
+ //printf("****** 1.2. read AEVOO722 => buffer: \"%s\"\n", buffer);
+ fail_unless(ret == (int)strlen(writeBuffer[1]), "Failed to read shared data ");
+ fail_unless(strncmp((char*)buffer, writeBuffer[1], strlen((char*)writeBuffer[1])) == 0, "Buffer not correctly read - 1.2");
+
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 1, 2, (unsigned char*)writeBuffer[2], strlen(writeBuffer[2]));
+ fail_unless(ret == (int)strlen(writeBuffer[2]), "Wrong write size");
+
+ pclDeinitLibrary();
+ sleep(1);
+
+
+ (void)pclInitLibrary(gTheAppId, shutdownReg); // use the app id, the resource is registered for
+
+ memset(buffer, 0, 256);
+ ret = pclKeyReadData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 1, 2, (unsigned char*)buffer, 256);
+ //printf("****** 1.3. read AEVOO722 => buffer: \"%s\"\n\n", buffer);
+ fail_unless(ret == (int)strlen(writeBuffer[2]), "Failed to read shared data ");
+ fail_unless(strncmp((char*)buffer, writeBuffer[2], strlen((char*)writeBuffer[2])) == 0, "Buffer not correctly read - 1.3");
+
+ pclDeinitLibrary();
+
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+
+ (void)pclInitLibrary(gTheAppId, shutdownReg); // use the app id, the resource is registered for
+
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 0, 0, (unsigned char*)writeBuffer2[0], strlen(writeBuffer2[0]));
+ fail_unless(ret == (int)strlen(writeBuffer2[0]), "Wrong write size");
+
+ memset(buffer, 0, 256);
+ ret = pclKeyReadData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 0, 0, (unsigned char*)buffer, 256);
+ //printf("****** 2.1. read AEVOO722 => buffer: \"%s\"\n", buffer);
+ fail_unless(ret == (int)strlen(writeBuffer2[0]), "Failed to read shared data ");
+ fail_unless(strncmp((char*)buffer, writeBuffer2[0], strlen((char*)writeBuffer2[0])) == 0, "Buffer not correctly read - 2.1");
+
+
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 0, 0, (unsigned char*)writeBuffer2[1], strlen(writeBuffer2[1]));
+ fail_unless(ret == (int)strlen(writeBuffer2[1]), "Wrong write size");
+
+ memset(buffer, 0, 256);
+ ret = pclKeyReadData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 0, 0, (unsigned char*)buffer, 256);
+ //printf("****** 2.2. read AEVOO722 => buffer: \"%s\"\n", buffer);
+ fail_unless(ret == (int)strlen(writeBuffer2[1]), "Failed to read shared data ");
+ fail_unless(strncmp((char*)buffer, writeBuffer2[1], strlen((char*)writeBuffer2[1])) == 0, "Buffer not correctly read - 2.2");
+
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 0, 0, (unsigned char*)writeBuffer2[2], strlen(writeBuffer2[2]));
+ fail_unless(ret == (int)strlen(writeBuffer2[2]), "Wrong write size");
+
+ pclDeinitLibrary();
+
+
+ (void)pclInitLibrary(gTheAppId, shutdownReg); // use the app id, the resource is registered for
+
+ memset(buffer, 0, 256);
+ ret = pclKeyReadData(PCL_LDBID_LOCAL, "ContactListViewSortOrder", 0, 0, (unsigned char*)buffer, 256);
+ //printf("****** 2.3. read AEVOO722 => buffer: \"%s\"\n\n", buffer);
+ fail_unless(ret == (int)strlen(writeBuffer2[2]), "Failed to read shared data ");
+ fail_unless(strncmp((char*)buffer, writeBuffer2[2], strlen((char*)writeBuffer2[2])) == 0, "Buffer not correctly read - 2.3");
+
+ pclDeinitLibrary();
+}
+END_TEST
+
+
+
static Suite * persistencyClientLib_suite()
{
const char* testSuiteName = "Persistency_client_library";
@@ -1722,6 +1810,10 @@ static Suite * persistencyClientLib_suite()
tcase_add_test(tc_SharedAccess, test_SharedAccess);
tcase_set_timeout(tc_SharedAccess, 2);
+ TCase * tc_VO722 = tcase_create("VO722");
+ tcase_add_test(tc_VO722, test_VO722);
+ tcase_set_timeout(tc_VO722, 5);
+
suite_add_tcase(s, tc_persSetData);
tcase_add_checked_fixture(tc_persSetData, data_setup, data_teardown);
@@ -1785,9 +1877,10 @@ static Suite * persistencyClientLib_suite()
suite_add_tcase(s, tc_DataFileConfDefault);
tcase_add_checked_fixture(tc_DataFileConfDefault, data_setup, data_teardown);
-
suite_add_tcase(s, tc_SharedAccess);
+ suite_add_tcase(s, tc_VO722);
+
#if USE_APPCHECK
suite_add_tcase(s, tc_ValidApplication);
#endif