# create tag version information
m4_define([pers_client_library_tag_version_major], [0])
-m4_define([pers_client_library_tag_version_minor], [6])
+m4_define([pers_client_library_tag_version_minor], [7])
m4_define([pers_client_library_tag_version_micro], [0])
m4_define([pers_client_library_tag_version], [pers_client_library_tag_version_major().pers_client_library_tag_version_minor().pers_client_library_tag_version_micro()])
# create library version information
m4_define([pers_client_library_version_current], [6])
-m4_define([pers_client_library_version_revision], [1])
+m4_define([pers_client_library_version_revision], [2])
m4_define([pers_client_library_version_age], [0])
m4_define([pers_client_library_version], [pers_client_library_version_current():pers_client_library_version_revision():pers_client_library_version_age()])
extern "C" {
#endif
-#define PERSIST_CLIENT_LIBRARY_DATA_ORGANIZATION_INTERFACE_VERSION (0x01040000U)
+#define PERSIST_CLIENT_LIBRARY_DATA_ORGANIZATION_INTERFACE_VERSION (0x02000000U)
#include "../include/persistence_client_library_error_def.h"
#include "../include/persistence_client_library_key.h"
/// resource configuration table name
extern const char* gResTableCfg;
-/// shared cached default database
-extern const char* gSharedCachedDefault;
+/// configurable default database name
+extern const char* gConfigDefault;
+
+/// default database name
+extern const char* gDefault;
+
+
/// shared cached database
-extern const char* gSharedCached;
-/// shared write through default database
-extern const char* gSharedWtDefault;
-/// shared write through database
-extern const char* gSharedWt;
-
-/// local cached default database
-extern const char* gLocalCachedDefault;
-/// local cached default database
-extern const char* gLocalCached;
-/// local write through default database
-extern const char* gLocalWtDefault;
-/// local write through default database
-extern const char* gLocalWt;
+extern const char* gCached;
+
+/// write through database name
+extern const char* gWt;
/// directory structure node name defintion
/// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
extern const char* gSharedPublicWtPath;
+/// path prefix for local cached database: /Data/mnt_c/<appId>/<database_name>
+extern const char* gLocalCachePathKey;
+/// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
+extern const char* gLocalWtPathKey;
+/// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
+extern const char* gSharedCachePathKey;
+/// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
+extern const char* gSharedWtPathKey;
+/// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
+extern const char* gSharedPublicCachePathKey;
+/// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
+extern const char* gSharedPublicWtPathKey;
+
/// path prefix for local cached files: /Data/mnt_c/<appId>/<user>/>userno>/<seat>/>seatno>/<resource>
extern const char* gLocalCacheFilePath;
char* gpConfigFileMap = 0;
-char* gpTokenArray[TOKENARRAYSIZE];
+char* gpTokenArray[TOKENARRAYSIZE] = {0};
int gTokenCounter = 0;
unsigned int gConfigFileSize = 0;
#include <stdio.h>
#include <stdlib.h>
+// rrsource configuration database name
const char* gResTableCfg = "/resource-table-cfg.itz";
+/// configurable default database name
+const char* gConfigDefault = "/configurable-default-data.itz";
-/// shared cached default database
-const char* gSharedCachedDefault = "/cached-default.itz";
-/// shared cached database
-const char* gSharedCached = "/cached.itz";
-/// shared write through default database
-const char* gSharedWtDefault = "/wt-default.itz";
-/// shared write through database
-const char* gSharedWt = "/wt.itz";
-
-
-/// local cached default database
-const char* gLocalCachedDefault = "cached-default.itz";
-/// local cached default database
-const char* gLocalCached = "/cached.itz";
-/// local write through default database
-const char* gLocalWtDefault = "wt-default.itz";
-/// local write through default database
-const char* gLocalWt = "/wt.itz";
+/// default database name
+const char* gDefault = "/default-data.itz";
+/// write through database name
+const char* gWt = "/wt.itz";
+/// cached database name
+const char* gCached = "/cached.itz";
/// directory structure node name defintion
const char* gSeat = "/seat/";
-/// path prefix for local cached database: /Data/mnt_c/<appId>/<database_name>
-const char* gLocalCachePath = "/Data/mnt-c/%s%s";
+/// path prefix for local cached database: /Data/mnt_c/<appId>/ (<database_name>
+const char* gLocalCachePath = "/Data/mnt-c/%s";
/// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
-const char* gLocalWtPath = "/Data/mnt-wt/%s%s";
+const char* gLocalWtPath = "/Data/mnt-wt/%s";
/// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
-const char* gSharedCachePath = "/Data/mnt-c/%s/Shared_Group_%x%s";
+const char* gSharedCachePath = "/Data/mnt-c/%s/Shared_Group_%x";
/// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
-const char* gSharedWtPath = "/Data/mnt-wt/%s/Shared_Group_%x%s";
-
+const char* gSharedWtPath = "/Data/mnt-wt/%s/Shared_Group_%x";
/// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
-const char* gSharedPublicCachePath = "/Data/mnt-c/%s/Shared_Public%s";
-
+const char* gSharedPublicCachePath = "/Data/mnt-c/%s/Shared_Public";
/// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
-const char* gSharedPublicWtPath = "/Data/mnt-wt/%s/Shared_Public%s";
+const char* gSharedPublicWtPath = "/Data/mnt-wt/%s/Shared_Public";
+/// path prefix for local cached database: /Data/mnt_c/<appId>/ (<database_name>
+const char* gLocalCachePathKey = "/Data/mnt-c/%s%s";
+/// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
+const char* gLocalWtPathKey = "/Data/mnt-wt/%s%s";
+/// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
+const char* gSharedCachePathKey = "/Data/mnt-c/%s/Shared_Group_%x%s";
+/// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
+const char* gSharedWtPathKey = "/Data/mnt-wt/%s/Shared_Group_%x%s";
+/// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
+const char* gSharedPublicCachePathKey = "/Data/mnt-c/%s/Shared_Public%s";
+/// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
+const char* gSharedPublicWtPathKey = "/Data/mnt-wt/%s/Shared_Public%s";
/// path prefix for local cached files: /Data/mnt_c/<appId>/<user>/<seat>/<resource>
const char* gLocalCacheFilePath = "/Data/mnt-c/%s/user/%d/seat/%d/%s";
/// definition of a key-value pair stored in the database
typedef struct _KeyValuePair_s
{
- char m_key[DbKeySize]; /// the key
+ char m_key[DbKeySize]; /// the key
char m_data[DbValueSize]; /// the data
unsigned int m_data_size; /// the size of the data
}
int pers_send_Notification_Signal(const char* key, PersistenceDbContext_s* context, unsigned int reason);
+
+
+
+
+int pers_db_open_default(itzam_btree* btree, PersistenceInfo_s* info, const char* dbPath, int configDefault)
+{
+ itzam_state state = ITZAM_FAILED;
+ char path[DbPathMaxLen] = {0};
+
+ if(1 == configDefault)
+ {
+ snprintf(path, DbPathMaxLen, "%s%s", dbPath, gConfigDefault);
+ }
+ else if(0 == configDefault)
+ {
+ snprintf(path, DbPathMaxLen, "%s%s", dbPath, gDefault);
+ }
+ else
+ {
+ return -1; // invalid
+ }
+
+ state = itzam_btree_open(btree, path, itzam_comparator_string, error_handler, 0/*recover*/, 0/*read_only*/);
+ if (state != ITZAM_OKAY)
+ {
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_db_open_default ==> itzam_btree_open => Itzam problem"), DLT_STRING(STATE_MESSAGES[state]));
+ }
+
+ return 1;
+}
+
+
itzam_btree* pers_db_open(PersistenceInfo_s* info, const char* dbPath)
{
int arrayIdx = 0;
if(gBtreeCreated[arrayIdx][info->configKey.policy] == 0)
{
itzam_state state = ITZAM_FAILED;
- state = itzam_btree_open(&gBtree[arrayIdx][info->configKey.policy], dbPath,
+ char path[DbPathMaxLen] = {0};
+
+ if(PersistencePolicy_wt == info->configKey.policy)
+ {
+ snprintf(path, DbPathMaxLen, "%s%s", dbPath, gWt);
+ }
+ else if(PersistencePolicy_wc == info->configKey.policy)
+ {
+ snprintf(path, DbPathMaxLen, "%s%s", dbPath, gCached);
+ }
+ else
+ {
+ return btree;
+ }
+
+ state = itzam_btree_open(&gBtree[arrayIdx][info->configKey.policy], path,
itzam_comparator_string, error_handler, 0/*recover*/, 0/*read_only*/);
if (state != ITZAM_OKAY)
{
}
-
int pers_db_read_key(char* dbPath, char* key, PersistenceInfo_s* info, unsigned char* buffer, unsigned int buffer_size)
{
int read_size = -1;
|| PersistenceStorage_local == info->configKey.storage)
{
itzam_btree* btree = NULL;
+ itzam_btree btreeDefault;
+ itzam_btree btreeConfDefault;
KeyValuePair_s search;
+ int keyFound = 0;
+ itzam_state state = ITZAM_FAILED;
btree = pers_db_open(info, dbPath);
if(btree != NULL)
read_size = buffer_size; // truncate data size to buffer size
}
memcpy(buffer, search.m_data, read_size);
+ keyFound = 1;
}
- else
+ }
+
+
+ // 1. check if _configurable_ default data is available
+ // --------------------------------
+ if(keyFound == 0)
+ {
+ if(pers_db_open_default(&btreeConfDefault, info, dbPath, 1) != -1)
{
- read_size = EPERS_NOKEY;
+ if(itzam_true == itzam_btree_find(&btreeConfDefault, key, &search)) // read db
+ {
+ read_size = search.m_data_size;
+ if(read_size > buffer_size)
+ {
+ read_size = buffer_size; // truncate data size to buffer size
+ }
+ memcpy(buffer, search.m_data, read_size);
+
+ keyFound = 1;
+ }
+ else
+ {
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_db_read_key ==> 2. resource not found in default config => search in default db"), DLT_STRING(key));
+ }
+
+ state = itzam_btree_close(&btreeConfDefault);
+ if (state != ITZAM_OKAY)
+ {
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_db_read_key ==> default: itzam_btree_close => Itzam problem"), DLT_STRING(STATE_MESSAGES[state]));
+ }
}
}
- else
+
+ // 2. check if default data is available
+ // --------------------------------
+ if(keyFound == 0)
{
- DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_db_read_key ==>no resource config table"), DLT_STRING(dbPath), DLT_STRING(key) );
- read_size = EPERS_NOPRCTABLE;
+ if(pers_db_open_default(&btreeDefault, info, dbPath, 0) != -1)
+ {
+ if(itzam_true == itzam_btree_find(&btreeDefault, key, &search)) // read db
+ {
+ read_size = search.m_data_size;
+ if(read_size > buffer_size)
+ {
+ read_size = buffer_size; // truncate data size to buffer size
+ }
+ memcpy(buffer, search.m_data, read_size);
+ }
+ else
+ {
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_db_read_key ==> 3. reasoure not found in both default db's"), DLT_STRING(key) );
+ read_size = EPERS_NOKEY; // the key is not available neither in regular db nor in the default db's
+ }
+
+ state = itzam_btree_close(&btreeDefault);
+ if (state != ITZAM_OKAY)
+ {
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_db_read_key ==> default: itzam_btree_close => Itzam problem"), DLT_STRING(STATE_MESSAGES[state]));
+ }
+ }
+ else
+ {
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_db_read_key ==>no resource config table"), DLT_STRING(dbPath), DLT_STRING(key) );
+ read_size = EPERS_NOPRCTABLE;
+ }
}
+
+
}
else if(PersistenceStorage_custom == info->configKey.storage) // custom storage implementation via custom library
{
/// free handle array
-int gFreeHandleArray[MaxPersHandle];
+int gFreeHandleArray[MaxPersHandle] = {0};
int gFreeHandleIdxHead = 0;
switch(rct) // create db name
{
case PersistenceRCT_local:
- snprintf(filename, DbPathMaxLen, gLocalWtPath, gAppId, gResTableCfg);
+ snprintf(filename, DbPathMaxLen, gLocalWtPathKey, gAppId, gResTableCfg);
break;
case PersistenceRCT_shared_public:
- snprintf(filename, DbPathMaxLen, gSharedPublicWtPath, gAppId, gResTableCfg);
+ snprintf(filename, DbPathMaxLen, gSharedPublicWtPathKey, gAppId, gResTableCfg);
break;
case PersistenceRCT_shared_group:
- snprintf(filename, DbPathMaxLen, gSharedWtPath, gAppId, group, gResTableCfg);
+ snprintf(filename, DbPathMaxLen, gSharedWtPathKey, gAppId, group, gResTableCfg);
break;
default:
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("get_resource_cfg_table - error: no valid PersistenceRCT_e"));
if(PersistencePolicy_wc == dbContext->configKey.policy)
{
if(dbContext->configKey.type == PersistenceResourceType_key)
- snprintf(dbPath, DbPathMaxLen, gSharedCachePath, gAppId, dbContext->context.ldbid, gSharedCached);
+ snprintf(dbPath, DbPathMaxLen, gSharedCachePath, gAppId, dbContext->context.ldbid);
else
- snprintf(dbPath, DbPathMaxLen, gSharedCachePath, gAppId, dbContext->context.ldbid, dbKey);
+ snprintf(dbPath, DbPathMaxLen, gSharedCachePathKey, gAppId, dbContext->context.ldbid, dbKey);
}
else if(PersistencePolicy_wt == dbContext->configKey.policy)
{
if(dbContext->configKey.type == PersistenceResourceType_key)
- snprintf(dbPath, DbPathMaxLen, gSharedWtPath, gAppId, dbContext->context.ldbid, gSharedWt);
+ snprintf(dbPath, DbPathMaxLen, gSharedWtPath, gAppId, dbContext->context.ldbid);
else
- snprintf(dbPath, DbPathMaxLen, gSharedWtPath, gAppId, dbContext->context.ldbid, dbKey);
+ snprintf(dbPath, DbPathMaxLen, gSharedWtPathKey, gAppId, dbContext->context.ldbid, dbKey);
}
}
else
if(PersistencePolicy_wc == dbContext->configKey.policy)
{
if(dbContext->configKey.type == PersistenceResourceType_key)
- snprintf(dbPath, DbPathMaxLen, gSharedPublicCachePath, gAppId, gSharedCached);
+ snprintf(dbPath, DbPathMaxLen, gSharedPublicCachePath, gAppId);
else
- snprintf(dbPath, DbPathMaxLen, gSharedPublicCachePath, gAppId, dbKey);
+ snprintf(dbPath, DbPathMaxLen, gSharedPublicCachePathKey, gAppId, dbKey);
}
else if(PersistencePolicy_wt == dbContext->configKey.policy)
{
if(dbContext->configKey.type == PersistenceResourceType_key)
- snprintf(dbPath, DbPathMaxLen, gSharedPublicWtPath, gAppId, gSharedWt);
+ snprintf(dbPath, DbPathMaxLen, gSharedPublicWtPath, gAppId);
else
- snprintf(dbPath, DbPathMaxLen, gSharedPublicWtPath, gAppId, dbKey);
+ snprintf(dbPath, DbPathMaxLen, gSharedPublicWtPathKey, gAppId, dbKey);
}
}
if(PersistencePolicy_wc == dbContext->configKey.policy)
{
if(dbContext->configKey.type == PersistenceResourceType_key)
- snprintf(dbPath, DbPathMaxLen, gLocalCachePath, gAppId, gLocalCached);
+ snprintf(dbPath, DbPathMaxLen, gLocalCachePath, gAppId);
else
- snprintf(dbPath, DbPathMaxLen, gLocalCachePath, gAppId, dbKey);
+ snprintf(dbPath, DbPathMaxLen, gLocalCachePathKey, gAppId, dbKey);
}
else if(PersistencePolicy_wt == dbContext->configKey.policy)
{
if(dbContext->configKey.type == PersistenceResourceType_key)
- snprintf(dbPath, DbPathMaxLen, gLocalWtPath, gAppId, gLocalWt);
+ snprintf(dbPath, DbPathMaxLen, gLocalWtPath, gAppId);
else
- snprintf(dbPath, DbPathMaxLen, gLocalWtPath, gAppId, dbKey);
+ snprintf(dbPath, DbPathMaxLen, gLocalWtPathKey, gAppId, dbKey);
}
storePolicy = PersistenceStorage_local; // we have a local database
}
//printf("get_db_path_and_key - dbKey : [key ]: %s \n", dbKey);
- //printf("get_db_path_and_key - dbPath : [path]: %s\n\n", dbPath);
+ //printf("get_db_path_and_key - dbPath : [path]: %s\n", dbPath);
return storePolicy;
}
#define READ_SIZE 1024
/// application id
-char gTheAppId[MaxAppNameLen];
+char gTheAppId[MaxAppNameLen] = {0};
// definition of weekday
char* dayOfWeek[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int ret = 0;
unsigned int shutdownReg = (PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL);
- unsigned char buffer[READ_SIZE];
+ unsigned char buffer[READ_SIZE] = {0};
pclInitLibrary(gTheAppId, shutdownReg);
- memset(buffer, 0, READ_SIZE);
-
/**
* Logical DB ID: 0xFF with user 0 and seat 0
* ==> local value accessible by all users (user 0, seat 0)
int ret = 0, handle = 0, handle2 = 0, handle3 = 0, handle4 = 0, size = 0;
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
- unsigned char buffer[READ_SIZE];
+ unsigned char buffer[READ_SIZE] = {0};
struct tm *locTime;
char sysTimeBuffer[128];
pclInitLibrary(gTheAppId, shutdownReg);
time_t t = time(0);
- memset(buffer, 0, READ_SIZE);
locTime = localtime(&t);
{
int ret = 0;
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
- unsigned char buffer[READ_SIZE];
- char write1[READ_SIZE];
- char write2[READ_SIZE];
+ unsigned char buffer[READ_SIZE] = {0};
+ char write1[READ_SIZE] = {0};
+ char write2[READ_SIZE] = {0};
char sysTimeBuffer[256];
struct tm *locTime;
time_t t = time(0);
locTime = localtime(&t);
- memset(buffer, 0, READ_SIZE);
- memset(write1, 0, READ_SIZE);
- memset(write2, 0, READ_SIZE);
// write data
snprintf(sysTimeBuffer, 128, "\"%s %d.%d.%d - %d:%.2d:%.2d Uhr\"", dayOfWeek[locTime->tm_wday], locTime->tm_mday, locTime->tm_mon, (locTime->tm_year+1900),
{
int ret = 0;
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
- unsigned char buffer[READ_SIZE];
+ unsigned char buffer[READ_SIZE] = {0};
struct tm *locTime;
pclInitLibrary(gTheAppId, shutdownReg);
time_t t = time(0);
char sysTimeBuffer[128];
- memset(buffer, 0, READ_SIZE);
locTime = localtime(&t);
int writeSize = 16*1024;
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
- unsigned char buffer[READ_SIZE];
+ unsigned char buffer[READ_SIZE] = {0};
const char* refBuffer = "/Data/mnt-wt/lt-persistence_client_library_test/user/1/seat/1/media";
char* writeBuffer;
char* fileMap = NULL;
writeBuffer[idx++] = 'F';
writeBuffer[idx++] = ' ';
}
- memset(buffer, 0, READ_SIZE);
-
// create file
fd = open("/Data/mnt-wt/lt-persistence_client_library_test/user/1/seat/1/media/mediaDBWrite.db",
O_CREAT|O_RDWR|O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
START_TEST(test_Cursor)
{
int handle = -1, rval = 0, size = 0, handle1 = 0;
- char bufferKeySrc[READ_SIZE];
- char bufferDataSrc[READ_SIZE];
- char bufferKeyDst[READ_SIZE];
- char bufferDataDst[READ_SIZE];
+ char bufferKeySrc[READ_SIZE] = {0};
+ char bufferDataSrc[READ_SIZE] = {0};
+ char bufferKeyDst[READ_SIZE] = {0};
+ char bufferDataDst[READ_SIZE] = {0};
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
pclInitLibrary(gTheAppId, shutdownReg);
- memset(bufferKeySrc, 0, READ_SIZE);
- memset(bufferDataSrc, 0, READ_SIZE);
-
- memset(bufferKeyDst, 0, READ_SIZE);
- memset(bufferDataDst, 0, READ_SIZE);
-
// create cursor
handle = pers_db_cursor_create("/Data/mnt-c/lt-persistence_client_library_test/cached.itz");
fail_unless(handle != -1, "Failed to create cursor!!");
START_TEST(test_Plugin)
{
int ret = 0;
- unsigned char buffer[READ_SIZE];
+ unsigned char buffer[READ_SIZE] = {0};
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
pclInitLibrary(gTheAppId, shutdownReg);
+
+
+START_TEST(test_ReadDefault)
+{
+ int ret = 0;
+ unsigned char buffer[READ_SIZE] = {0};
+
+ unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+ pclInitLibrary(gTheAppId, shutdownReg);
+
+ ret = pclKeyReadData(0xFF, "statusHandle/default01", 3, 2, buffer, READ_SIZE);
+ fail_unless(ret != EPERS_NOT_INITIALIZED);
+ printf("B U F F E R: %s\n", buffer);
+ fail_unless(strncmp((char*)buffer,"DEFAULT_01!", strlen((char*)buffer)) == 0, "Buffer not correctly read");
+
+ ret = pclKeyReadData(0xFF, "statusHandle/default02", 3, 2, buffer, READ_SIZE);
+ fail_unless(ret != EPERS_NOT_INITIALIZED);
+ printf("B U F F E R: %s\n", buffer);
+ fail_unless(strncmp((char*)buffer,"DEFAULT_02!", strlen((char*)buffer)) == 0, "Buffer not correctly read");
+
+ pclDeinitLibrary();
+}
+END_TEST
+
+
+
+START_TEST(test_ReadConfDefault)
+{
+ int ret = 0;
+ unsigned char buffer[READ_SIZE] = {0};
+
+ unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+ pclInitLibrary(gTheAppId, shutdownReg);
+
+ ret = pclKeyReadData(0xFF, "statusHandle/confdefault01", 3, 2, buffer, READ_SIZE);
+ fail_unless(ret != EPERS_NOT_INITIALIZED);
+ fail_unless(strncmp((char*)buffer,"CONF_DEFAULT_01!", strlen((char*)buffer)) == 0, "Buffer not correctly read");
+
+ ret = pclKeyReadData(0xFF, "statusHandle/confdefault02", 3, 2, buffer, READ_SIZE);
+ fail_unless(ret != EPERS_NOT_INITIALIZED);
+ fail_unless(strncmp((char*)buffer,"CONF_DEFAULT_02!", strlen((char*)buffer)) == 0, "Buffer not correctly read");
+
+ pclDeinitLibrary();
+}
+END_TEST
+
+
+
static Suite * persistencyClientLib_suite()
{
Suite * s = suite_create("Persistency client library");
TCase * tc_Plugin = tcase_create("Plugin");
tcase_add_test(tc_Plugin, test_Plugin);
+ TCase * tc_ReadDefault = tcase_create("ReadDefault");
+ tcase_add_test(tc_ReadDefault, test_ReadDefault);
+
+ TCase * tc_ReadConfDefault = tcase_create("ReadConfDefault");
+ tcase_add_test(tc_ReadConfDefault, test_ReadConfDefault);
suite_add_tcase(s, tc_persGetData);
suite_add_tcase(s, tc_persSetData);
suite_add_tcase(s, tc_persDataFile);
suite_add_tcase(s, tc_persDataFileRecovery);
suite_add_tcase(s, tc_Cursor);
+ suite_add_tcase(s, tc_ReadDefault);
+ suite_add_tcase(s, tc_ReadConfDefault);
suite_add_tcase(s, tc_Plugin); // activate only if the plugins are available
return s;