summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Huerner <ingo_huerner@mentor.com>2017-01-27 13:11:44 +0100
committerIngo Huerner <ingo_huerner@mentor.com>2017-01-27 13:11:44 +0100
commit2b2641432537b24e145350ac11719b87c50ab329 (patch)
treee3389917922d0ee3517819f198864a71a4116cdf
parent18e5dde1dd0d2dd61460cc27257b8a51f66f75b6 (diff)
downloadpersistence-client-library-2b2641432537b24e145350ac11719b87c50ab329.tar.gz
Make usage of plugins more robust (Nullpointer check); Added creation of test log file for file API tests
-rw-r--r--include/persistence_client_library_error_def.h4
-rw-r--r--src/persistence_client_library.c4
-rw-r--r--src/persistence_client_library_custom_loader.c86
-rw-r--r--src/persistence_client_library_db_access.c167
-rw-r--r--src/persistence_client_library_db_access.h23
-rw-r--r--src/persistence_client_library_prct_access.c63
-rw-r--r--src/persistence_client_library_prct_access.h2
-rw-r--r--test/persistence_client_library_test.c117
-rw-r--r--test/persistence_client_library_test_file.c4
-rw-r--r--test/persistence_test_customlib.c32
10 files changed, 383 insertions, 119 deletions
diff --git a/include/persistence_client_library_error_def.h b/include/persistence_client_library_error_def.h
index 7a9d80d..32f076a 100644
--- a/include/persistence_client_library_error_def.h
+++ b/include/persistence_client_library_error_def.h
@@ -121,6 +121,10 @@ extern "C" {
#define EPERS_SHUTDOWN_NO_TRUSTED (-43)
/// not the responsible application to modify shared data
#define EPERS_NOT_RESP_APP (-44)
+/// plugin function not available
+#define EPERS_NO_PLUGIN_FUNCT (-45)
+/// plugin variable not available
+#define EPERS_NO_PLUGIN_VAR (-46)
/// requested handle is not valid. \since PCL v7.0.3
#define EPERS_INVALID_HANDLE (-1000)
diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c
index e0c7d9b..022e2a4 100644
--- a/src/persistence_client_library.c
+++ b/src/persistence_client_library.c
@@ -205,9 +205,11 @@ static int private_pclInitLibrary(const char* appName, int shutdownMode)
DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("PAS interface not enabled, enable with \"./configure --enable-pasinterface\""));
#endif
- if(load_custom_plugins(customAsyncInitClbk) < 0) // load custom plugins
+ if((rval = load_custom_plugins(customAsyncInitClbk)) < 0) // load custom plugins
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("Failed to load custom plugins"));
+ pthread_mutex_unlock(&gDbusPendingRegMtx);
+ return rval;
}
init_key_handle_array();
diff --git a/src/persistence_client_library_custom_loader.c b/src/persistence_client_library_custom_loader.c
index be07b40..95235e3 100644
--- a/src/persistence_client_library_custom_loader.c
+++ b/src/persistence_client_library_custom_loader.c
@@ -320,7 +320,10 @@ int load_default_library(void* handle)
if(handle != NULL)
{
+ void * tmpLibVar = NULL;
+
/// D A T A B A S E F U N C T I O N S
+ // if a function could not be loaded, this is not an error
*(void **) (&plugin_persComDbOpen) = dlsym(handle, "persComDbOpen");
if ((error = dlerror()) != NULL)
{
@@ -380,45 +383,93 @@ int load_default_library(void* handle)
}
/// V A R I A B L E S
- plugin_gUser = *(char**)dlsym(handle, "gUser");
- if ((error = dlerror()) != NULL)
+ // it is an error if varaibles coulr not be loaded, and will cause an error
+ tmpLibVar = dlsym(handle, "gUser");
+ if(tmpLibVar != 0)
+ {
+ plugin_gUser = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gLocalWt = *(char**)dlsym(handle, "gLocalWt");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gLocalWt");
+ if(tmpLibVar != 0)
+ {
+ plugin_gLocalWt = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gSeat = *(char**)dlsym(handle, "gSeat");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gSeat");
+ if(tmpLibVar != 0)
+ {
+ plugin_gSeat = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gLocalFactoryDefault = *(char**)dlsym(handle, "gLocalFactoryDefault");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gLocalFactoryDefault");
+ if(tmpLibVar != 0)
+ {
+ plugin_gLocalFactoryDefault = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gLocalCached = *(char**) dlsym(handle, "gLocalCached");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gLocalCached");
+ if(tmpLibVar != 0)
+ {
+ plugin_gLocalCached = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gNode = *(char**)dlsym(handle, "gNode");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gNode");
+ if(tmpLibVar != 0)
+ {
+ plugin_gNode = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gLocalConfigurableDefault = *(char**)dlsym(handle, "gLocalConfigurableDefault");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gLocalConfigurableDefault");
+ if(tmpLibVar != 0)
+ {
+ plugin_gLocalConfigurableDefault = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gResTableCfg = *(char**)dlsym(handle, "gResTableCfg");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gResTableCfg");
+ if(tmpLibVar != 0)
+ {
+ plugin_gResTableCfg = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
}
else
@@ -653,11 +704,10 @@ int load_custom_plugins(plugin_callback_async_t pfInitCompletedCB)
{
if(getCustomLoadingType(i) == LoadType_PclInit) // check if the plugin must be loaded on pclInitLibrary
{
- if(load_custom_library(i, &gPersCustomFuncs[i] ) <= 0)
+ if((rval = load_custom_library(i, &gPersCustomFuncs[i] )) <= 0)
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("load_custom_plugins => E r r o r could not load plugin: "),
DLT_STRING(get_custom_client_lib_name(i)));
- rval = EPERS_COMMON;
}
}
}
diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c
index 6c40d3f..9b31400 100644
--- a/src/persistence_client_library_db_access.c
+++ b/src/persistence_client_library_db_access.c
@@ -92,15 +92,23 @@ static int database_get(PersistenceInfo_s* info, const char* dbPath, int dbType)
if (handleDB == -1)
{
- handleDB = plugin_persComDbOpen(path, openFlags);
- if(handleDB >= 0)
+ if(*plugin_persComDbOpen != NULL)
{
- gHandlesDB[arrayIdx][dbType] = handleDB ;
- gHandlesDBCreated[arrayIdx][dbType] = 1;
+ handleDB = plugin_persComDbOpen(path, openFlags);
+ if(handleDB >= 0)
+ {
+ gHandlesDB[arrayIdx][dbType] = handleDB ;
+ gHandlesDBCreated[arrayIdx][dbType] = 1;
+ }
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbGet - persComDbOpen() failed"));
+ }
}
else
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbGet - persComDbOpen() failed"));
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbGet - EPERS_NO_PLUGIN_FUNCT"));
+ handleDB = EPERS_NO_PLUGIN_FUNCT;
}
}
else
@@ -134,11 +142,23 @@ int pers_get_defaults(char* dbPath, char* key, PersistenceInfo_s* info, unsigned
{
if (PersGetDefault_Data == job)
{
- read_size = plugin_persComDbReadKey(handleDefaultDB, key, (char*)buffer, (signed int)buffer_size);
+ if(*plugin_persComDbReadKey != NULL)
+ read_size = plugin_persComDbReadKey(handleDefaultDB, key, (char*)buffer, (signed int)buffer_size);
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("getDefaults - EPERS_NO_PLUGIN_FUNCT"));
+ read_size = EPERS_NO_PLUGIN_FUNCT;
+ }
}
else if (PersGetDefault_Size == job)
{
- read_size = plugin_persComDbGetKeySize(handleDefaultDB, key);
+ if(*plugin_persComDbGetKeySize != NULL)
+ read_size = plugin_persComDbGetKeySize(handleDefaultDB, key);
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("getDefaults - EPERS_NO_PLUGIN_FUNCT"));
+ read_size = EPERS_NO_PLUGIN_FUNCT;
+ }
}
else
{
@@ -191,15 +211,22 @@ void database_close_all()
{
if(gHandlesDBCreated[i][j] == 1)
{
- int iErrorCode = plugin_persComDbClose(gHandlesDB[i][j]);
- if (iErrorCode < 0)
- {
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbCloseAll - Err close db"));
- }
- else
- {
- gHandlesDBCreated[i][j] = 0;
- }
+ if(*plugin_persComDbClose != NULL)
+ {
+ int iErrorCode = plugin_persComDbClose(gHandlesDB[i][j]);
+ if (iErrorCode < 0)
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbCloseAll - Err close db"));
+ }
+ else
+ {
+ gHandlesDBCreated[i][j] = 0;
+ }
+ }
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbCloseAll - plugin function NULL"));
+ }
}
}
}
@@ -217,10 +244,18 @@ int persistence_get_data(char* dbPath, char* key, const char* resourceID, Persis
int handleDB = database_get(info, dbPath, info->configKey.policy);
if(handleDB >= 0)
{
- read_size = plugin_persComDbReadKey(handleDB, key, (char*)buffer, buffer_size);
- if(read_size < 0)
+ if(*plugin_persComDbReadKey != NULL)
{
- read_size = pers_get_defaults(dbPath, (char*)resourceID, info, buffer, (unsigned int)buffer_size, PersGetDefault_Data); /* 0 ==> Get data */
+ read_size = plugin_persComDbReadKey(handleDB, key, (char*)buffer, buffer_size);
+ if(read_size < 0)
+ {
+ read_size = pers_get_defaults(dbPath, (char*)resourceID, info, buffer, (unsigned int)buffer_size, PersGetDefault_Data); /* 0 ==> Get data */
+ }
+ }
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("getData - EPERS_NO_PLUGIN_FUNCT"));
+ read_size = EPERS_NO_PLUGIN_FUNCT;
}
}
}
@@ -330,23 +365,31 @@ int persistence_set_data(char* dbPath, char* key, const char* resource_id, Persi
if(handleDB >= 0)
{
- write_size = plugin_persComDbWriteKey(handleDB, dbInput, (char*)buffer, buffer_size) ;
- if(write_size < 0)
- {
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - persComDbWriteKey() failure"));
- }
- else
+ if(*plugin_persComDbWriteKey != NULL)
{
- if(PersistenceStorage_shared == info->configKey.storage)
+ write_size = plugin_persComDbWriteKey(handleDB, dbInput, (char*)buffer, buffer_size) ;
+ if(write_size < 0)
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - persComDbWriteKey() failure"));
+ }
+ else
{
- int rval = pers_send_Notification_Signal(resource_id, &info->context, pclNotifyStatus_changed);
- if(rval <= 0)
+ if(PersistenceStorage_shared == info->configKey.storage)
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - Err to send noty sig"));
- write_size = rval;
+ int rval = pers_send_Notification_Signal(resource_id, &info->context, pclNotifyStatus_changed);
+ if(rval <= 0)
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - Err to send noty sig"));
+ write_size = rval;
+ }
}
}
}
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - EPERS_NO_PLUGIN_FUNCT"));
+ write_size = EPERS_NO_PLUGIN_FUNCT;
+ }
}
else
{
@@ -441,11 +484,18 @@ int persistence_get_data_size(char* dbPath, char* key, const char* resourceID, P
int handleDB = database_get(info, dbPath, info->configKey.policy);
if(handleDB >= 0)
{
-
- read_size = plugin_persComDbGetKeySize(handleDB, key);
- if(read_size < 0)
+ if(*plugin_persComDbGetKeySize != NULL)
+ {
+ read_size = plugin_persComDbGetKeySize(handleDB, key);
+ if(read_size < 0)
+ {
+ read_size = pers_get_defaults( dbPath, (char*)resourceID, info, NULL, 0, PersGetDefault_Size);
+ }
+ }
+ else
{
- read_size = pers_get_defaults( dbPath, (char*)resourceID, info, NULL, 0, PersGetDefault_Size);
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("getDataSize - EPERS_NO_PLUGIN_FUNCT"));
+ read_size = EPERS_NO_PLUGIN_FUNCT;
}
}
}
@@ -538,23 +588,31 @@ int persistence_delete_data(char* dbPath, char* key, const char* resource_id, Pe
int handleDB = database_get(info, dbPath, info->configKey.policy);
if(handleDB >= 0)
{
- ret = plugin_persComDbDeleteKey(handleDB, key) ;
- if(ret < 0)
+ if(*plugin_persComDbDeleteKey != NULL)
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("deleteData - failed: "), DLT_STRING(key));
- if(PERS_COM_ERR_NOT_FOUND == ret)
+ ret = plugin_persComDbDeleteKey(handleDB, key) ;
+ if(ret < 0)
{
- ret = EPERS_NOKEY ;
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("deleteData - failed: "), DLT_STRING(key));
+ if(PERS_COM_ERR_NOT_FOUND == ret)
+ {
+ ret = EPERS_NOKEY ;
+ }
+ else
+ {
+ ret = EPERS_DB_ERROR_INTERNAL ;
+ }
}
- else
+
+ if(PersistenceStorage_shared == info->configKey.storage)
{
- ret = EPERS_DB_ERROR_INTERNAL ;
+ pers_send_Notification_Signal(resource_id, &info->context, pclNotifyStatus_deleted);
}
}
-
- if(PersistenceStorage_shared == info->configKey.storage)
+ else
{
- pers_send_Notification_Signal(resource_id, &info->context, pclNotifyStatus_deleted);
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("deleteData - EPERS_NO_PLUGIN_FUNCT"));
+ ret = EPERS_NO_PLUGIN_FUNCT;
}
}
else
@@ -708,7 +766,7 @@ int persistence_notify_on_change(const char* resource_id, const char* dbKey, uns
if(-1 == deliverToMainloop(&data))
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("notifyOnChange - Err to write to pipe"), DLT_INT(errno));
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("notifyOnChange - Write to pipe"), DLT_INT(errno));
rval = -1;
}
@@ -741,7 +799,7 @@ int pers_send_Notification_Signal(const char* key, PersistenceDbContext_s* conte
if(-1 == deliverToMainloop(&data) )
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendNotifySig - Err write to pipe"), DLT_INT(errno));
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendNotifySig - Write to pipe"), DLT_INT(errno));
rval = EPERS_NOTIFY_SIG;
}
}
@@ -762,11 +820,18 @@ void pers_rct_close_all()
{
if(get_resource_cfg_table_by_idx(i) != -1)
{
- if(plugin_persComRctClose(get_resource_cfg_table_by_idx(i)) != 0)
- {
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("prepShtdwn - Err close db => index:"), DLT_INT(i));
- }
- invalidate_resource_cfg_table(i);
+ if(*plugin_persComRctClose != NULL)
+ {
+ if(plugin_persComRctClose(get_resource_cfg_table_by_idx(i)) != 0)
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("prepShtdwn - Close db => index:"), DLT_INT(i));
+ }
+ invalidate_resource_cfg_table(i);
+ }
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("prepShtdwn - No plugin function available"));
+ }
}
}
}
diff --git a/src/persistence_client_library_db_access.h b/src/persistence_client_library_db_access.h
index 5385dc3..ee97046 100644
--- a/src/persistence_client_library_db_access.h
+++ b/src/persistence_client_library_db_access.h
@@ -59,19 +59,6 @@ char* pers_get_raw_key(char *key);
/**
- * @brief open the default value database specified by the 'DefaultType'
- *
- * @param dbPath path to the directory were the databases are included in.
- * @param DefaultType the default type
- *
- * @return >= 0 for valid handler; if an error occured the following error code:
- * EPERS_COMMON
- */
-int pers_db_open_default(const char* dbPath, PersDefaultType_e DefaultType);
-
-
-
-/**
* @brief tries to get default values for a key from the configurable and factory default databases.
*
* @param dbPath the path to the directory where the default databases are in
@@ -83,7 +70,7 @@ int pers_db_open_default(const char* dbPath, PersDefaultType_e DefaultType);
*
* @return the number of bytes read or the size of the key (depends on parameter 'job').
negative value if an error occured and the following error code:
- * EPERS_NOKEY
+ * EPERS_NO_PLUGIN_FUNCT, EPERS_NOKEY
*/
int pers_get_defaults(char* dbPath, char* key, PersistenceInfo_s* info, unsigned char* buffer, unsigned int buffer_size, PersGetDefault_e job);
@@ -100,7 +87,7 @@ int pers_get_defaults(char* dbPath, char* key, PersistenceInfo_s* info, unsigned
* @param buffer_size the size of the buffer
*
* @return the number of bytes written or a negative value if an error occured with the following error codes:
- * EPERS_SETDTAFAILED EPERS_NOPRCTABLE EPERS_NOKEYDATA EPERS_NOKEY
+ * EPERS_NO_PLUGIN_FUNCT, EPERS_SETDTAFAILED EPERS_NOPRCTABLE EPERS_NOKEYDATA EPERS_NOKEY
*/
int persistence_set_data(char* dbPath, char* key, const char* resource_id, PersistenceInfo_s* info, unsigned char* buffer, int buffer_size);
@@ -117,7 +104,7 @@ int persistence_set_data(char* dbPath, char* key, const char* resource_id, Persi
* @param buffer_size the size of the buffer
*
* @return the number of bytes read or a negative value if an error occured with the following error codes:
- * EPERS_NOPRCTABLE EPERS_NOKEYDATA EPERS_NOKEY
+ * EPERS_NO_PLUGIN_FUNCT, EPERS_NOPRCTABLE EPERS_NOKEYDATA EPERS_NOKEY
*/
int persistence_get_data(char* dbPath, char* key, const char* resourceID, PersistenceInfo_s* info, unsigned char* buffer, int buffer_size);
@@ -132,7 +119,7 @@ int persistence_get_data(char* dbPath, char* key, const char* resourceID, Persis
* @param info persistence information
*
* @return size of data in bytes read from the key or on error a negative value with the following error codes:
- * EPERS_NOPRCTABLE or EPERS_NOKEY
+ * EPERS_NO_PLUGIN_FUNCT, EPERS_NOPRCTABLE or EPERS_NOKEY
*/
int persistence_get_data_size(char* dbPath, char* key, const char* resourceID, PersistenceInfo_s* info);
@@ -147,7 +134,7 @@ int persistence_get_data_size(char* dbPath, char* key, const char* resourceID, P
* @param info persistence information
*
* @return 0 if deletion was successfull;
- * or an error code: EPERS_DB_KEY_SIZE, EPERS_NOPRCTABLE, EPERS_DB_ERROR_INTERNAL or EPERS_NOPLUGINFUNCT
+ * or an error code: EPERS_NO_PLUGIN_FUNCT, EPERS_DB_KEY_SIZE, EPERS_NOPRCTABLE, EPERS_DB_ERROR_INTERNAL or EPERS_NOPLUGINFUNCT
*/
int persistence_delete_data(char* dbPath, char* key, const char* resource_id, PersistenceInfo_s* info);
diff --git a/src/persistence_client_library_prct_access.c b/src/persistence_client_library_prct_access.c
index db3860e..a983735 100644
--- a/src/persistence_client_library_prct_access.c
+++ b/src/persistence_client_library_prct_access.c
@@ -100,7 +100,7 @@ void invalidate_resource_cfg_table(int i)
int get_resource_cfg_table(PersistenceRCT_e rct, int group)
{
unsigned int arrayIdx = 0;
- int rval = -1;
+ int rval = EPERS_NOPRCTABLE;
// create array index: index is a combination of resource config table type and group
arrayIdx = (rct + (unsigned int)group);
@@ -126,16 +126,25 @@ int get_resource_cfg_table(PersistenceRCT_e rct, int group)
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gRCT - no valid PersistenceRCT_e"));
break;
}
- gResource_table[arrayIdx] = plugin_persComRctOpen(filename, 0x04); // 0x04 ==> open in read only mode
- if(gResource_table[arrayIdx] < 0)
+ if(*plugin_persComRctOpen != NULL)
{
- gResourceOpen[arrayIdx] = 0;
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gRCT - RCT problem"), DLT_INT(gResource_table[arrayIdx] ));
+ gResource_table[arrayIdx] = plugin_persComRctOpen(filename, 0x04); // 0x04 ==> open in read only mode
+
+ if(gResource_table[arrayIdx] < 0)
+ {
+ gResourceOpen[arrayIdx] = 0;
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gRCT - RCT problem"), DLT_INT(gResource_table[arrayIdx] ));
+ }
+ else
+ {
+ gResourceOpen[arrayIdx] = 1 ;
+ }
}
else
{
- gResourceOpen[arrayIdx] = 1 ;
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gRCT - no plugin function"));
+ rval = EPERS_NO_PLUGIN_FUNCT;
}
}
@@ -158,37 +167,45 @@ int get_db_context(PersistenceInfo_s* dbContext, const char* resource_id, unsign
if(handleRCT >= 0)
{
- PersistenceConfigurationKey_s sRctEntry ;
-
- // check if resouce id is in write through table
- int iErrCode = plugin_persComRctRead(handleRCT, resource_id, &sRctEntry) ;
-
- if(sizeof(PersistenceConfigurationKey_s) == iErrCode)
+ if(*plugin_persComRctRead != NULL)
{
- memcpy(&dbContext->configKey, &sRctEntry, sizeof(dbContext->configKey)) ;
- if(sRctEntry.storage != PersistenceStorage_custom )
+ PersistenceConfigurationKey_s sRctEntry ;
+
+ // check if resouce id is in write through table
+ int iErrCode = plugin_persComRctRead(handleRCT, resource_id, &sRctEntry) ;
+
+ if(sizeof(PersistenceConfigurationKey_s) == iErrCode)
{
- rval = get_db_path_and_key(dbContext, resource_id, dbKey, dbPath);
+ memcpy(&dbContext->configKey, &sRctEntry, sizeof(dbContext->configKey)) ;
+ if(sRctEntry.storage != PersistenceStorage_custom )
+ {
+ rval = get_db_path_and_key(dbContext, resource_id, dbKey, dbPath);
+ }
+ else
+ {
+ // if customer storage, we use the custom name as dbPath
+ strncpy(dbPath, dbContext->configKey.custom_name, strlen(dbContext->configKey.custom_name));
+
+ strncpy(dbKey, resource_id, strlen(resource_id)); // and resource_id as dbKey
+ }
+ resourceFound = 1;
}
else
{
- // if customer storage, we use the custom name as dbPath
- strncpy(dbPath, dbContext->configKey.custom_name, strlen(dbContext->configKey.custom_name));
-
- strncpy(dbKey, resource_id, strlen(resource_id)); // and resource_id as dbKey
+ DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("gDBCtx - RCT: no value for key:"), DLT_STRING(resource_id) );
+ rval = EPERS_NOKEYDATA;
}
- resourceFound = 1;
}
else
{
- DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("gDBCtx - RCT: no value for key:"), DLT_STRING(resource_id) );
- rval = EPERS_NOKEYDATA;
+ DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("gDBCtx - no plugin function available"));
+ rval = EPERS_NO_PLUGIN_FUNCT;
}
} // resource table
else
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gDBCtx - RCT"));
- rval = EPERS_NOPRCTABLE;
+ rval = handleRCT;
}
if((resourceFound == 0) && (dbContext->context.ldbid == PCL_LDBID_LOCAL) ) // create only when the resource is local data
diff --git a/src/persistence_client_library_prct_access.h b/src/persistence_client_library_prct_access.h
index 1737497..2aa822e 100644
--- a/src/persistence_client_library_prct_access.h
+++ b/src/persistence_client_library_prct_access.h
@@ -46,7 +46,7 @@ int get_db_path_and_key(PersistenceInfo_s* dbContext, const char* resource_id, c
* @param dbKey the array where the database key will be stored
* @param dbPath the array where the database location path will be stored
*
- * @return 0 or a negative value with one of the following errors: EPERS_NOKEYDATA or EPERS_NOPRCTABLE
+ * @return 0 or a negative value with one of the following errors: EPERS_NO_PLUGIN_FUNCT, EPERS_NOKEYDATA or EPERS_NOPRCTABLE
*/
int get_db_context(PersistenceInfo_s* dbContext, const char* resource_id, unsigned int isFile, char dbKey[], char dbPath[]);
diff --git a/test/persistence_client_library_test.c b/test/persistence_client_library_test.c
index e475ae8..146e41a 100644
--- a/test/persistence_client_library_test.c
+++ b/test/persistence_client_library_test.c
@@ -122,6 +122,8 @@ START_TEST(test_GetData)
int ret = 0;
unsigned char buffer[READ_SIZE] = {0};
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_GetData"));
+
/**
* Logical DB ID: PCL_LDBID_LOCAL with user 0 and seat 0
* ==> local value accessible by all users (user 0, seat 0)
@@ -189,6 +191,8 @@ START_TEST (test_GetDataHandle)
char sysTimeBuffer[128];
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_GetDataHandle"));
+
time_t t = time(0);
locTime = localtime(&t);
@@ -258,12 +262,15 @@ START_TEST(test_SetData)
{
int ret = 0;
unsigned char buffer[READ_SIZE] = {0};
+
char write1[READ_SIZE] = {0};
char write2[READ_SIZE] = {0};
char sysTimeBuffer[256];
struct tm *locTime;
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_SetData"));
+
/**
* Logical DB ID: PCL_LDBID_LOCAL with user 3 and seat 2
* ==> local USER value (user 3, seat 2)
@@ -315,6 +322,7 @@ START_TEST(test_SetData)
/*******************************************************************************************************************************************/
/* used for changed notification testing */
/*******************************************************************************************************************************************/
+#if 0
/**
* Logical DB ID: 0x84 with user 2 and seat 1
* ==> shared user value accessible by A GROUP (user 2 and seat 1)
@@ -323,6 +331,7 @@ START_TEST(test_SetData)
*/
//printf("Write data to trigger change notification\n");
ret = pclKeyWriteData(0x20, "links/last_link2", 2, 1, (unsigned char*)"Test notify shared data", strlen("Test notify shared data"));
+ printf("Ist: %d - Soll: %d\n", ret, (int)strlen("Test notify shared data"));
fail_unless(ret == (int)strlen("Test notify shared data"), "Wrong write size");
/**
@@ -344,6 +353,7 @@ START_TEST(test_SetData)
//printf("Write data to trigger change notification\n");
ret = pclKeyWriteData(0x20, "links/last_link4", 4, 1, (unsigned char*)"Test notify shared data", strlen("Test notify shared data"));
fail_unless(ret == strlen("Test notify shared data"), "Wrong write size");
+#endif
/*******************************************************************************************************************************************/
/*******************************************************************************************************************************************/
@@ -369,6 +379,7 @@ START_TEST(test_SetData)
ret = pclKeyReadData(PCL_LDBID_LOCAL, "key_70", 1, 2, buffer, READ_SIZE);
fail_unless(strncmp((char*)buffer, write2, strlen(write2)) == 0, "Buffer not correctly read");
fail_unless(ret == (int)strlen(write2), "Wrong read size");
+
}
END_TEST
@@ -389,6 +400,8 @@ START_TEST(test_SetDataNoPRCT)
char sysTimeBuffer[128];
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_SetDataNoPRCT"));
+
locTime = localtime(&t);
snprintf(sysTimeBuffer, 128, "TimeAndData: \"%s %d.%d.%d - %d:%.2d:%.2d Uhr\"", dayOfWeek[locTime->tm_wday], locTime->tm_mday, locTime->tm_mon+1, (locTime->tm_year+1900),
@@ -421,6 +434,8 @@ END_TEST
START_TEST(test_GetDataSize)
{
int size = 0;
+
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_GetDataSize"));
/**
* Logical DB ID: PCL_LDBID_LOCAL with user 3 and seat 2
* ==> local USER value (user 3, seat 2)
@@ -448,6 +463,8 @@ START_TEST(test_DeleteData)
int rval = 0;
unsigned char buffer[READ_SIZE];
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_DeleteData"));
+
// read data from key
rval = pclKeyReadData(PCL_LDBID_LOCAL, "key_70", 1, 2, buffer, READ_SIZE);
fail_unless(rval != EPERS_NOKEY, "Read form key key_70 fails");
@@ -506,6 +523,9 @@ void data_setupBackup(void)
START_TEST(test_DataHandleOpen)
{
int hd1 = -2, hd2 = -2, hd3 = -2, hd4 = -2, hd5 = -2, hd6 = -2, hd7 = -2, hd8 = -2, hd9 = -2, ret = 0;
+
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_DataHandleOpen"));
+
// open handles ----------------------------------------------------
hd1 = pclKeyHandleOpen(PCL_LDBID_LOCAL, "posHandle/last_position1", 0, 0);
fail_unless(hd1 == 1, "Failed to open handle ==> /posHandle/last_position1");
@@ -573,6 +593,8 @@ START_TEST(test_Plugin)
int ret = 0;
unsigned char buffer[READ_SIZE] = {0};
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_Plugin"));
+
ret = pclKeyReadData(PCL_LDBID_LOCAL, "secured", 0, 0, buffer, READ_SIZE);
//printf("B U F F E R - secure: \"%s\" => ist: %d | soll: %d\n", buffer, ret, strlen("Custom plugin -> plugin_get_data: secure!"));
fail_unless(ret == strlen("Custom plugin -> plugin_get_data: secure!") );
@@ -637,6 +659,8 @@ START_TEST(test_ReadDefault)
int ret = 0;
unsigned char buffer[READ_SIZE] = {0};
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_ReadDefault"));
+
ret = pclKeyReadData(PCL_LDBID_LOCAL, "statusHandle/default01", 3, 2, buffer, READ_SIZE);
//printf(" --- test_ReadConfDefault => statusHandle/default01: %s => retIst: %d retSoll: %d\n", buffer, ret, strlen("DEFAULT_01!"));
fail_unless(ret == strlen("DEFAULT_01!"));
@@ -647,7 +671,12 @@ START_TEST(test_ReadDefault)
fail_unless(ret == strlen("DEFAULT_02!"));
fail_unless(strncmp((char*)buffer,"DEFAULT_02!", strlen((char*)buffer)) == 0, "Buffer not correctly read");
+ ret = pclKeyGetSize(PCL_LDBID_LOCAL, "statusHandle/default02", 3, 2);
+ //printf("IST: %d - SOLL: %d\n", ret, (int)strlen("DEFAULT_02!"));
+ fail_unless(ret == strlen("DEFAULT_01!"), "Invalid size");
+
ret = pclKeyGetSize(PCL_LDBID_LOCAL, "statusHandle/default01", 3, 2);
+ //printf("IST: %d - SOLL: %d\n", ret, (int)strlen("DEFAULT_01!"));
fail_unless(ret == strlen("DEFAULT_01!"), "Invalid size");
}
END_TEST
@@ -658,6 +687,9 @@ START_TEST(test_ReadConfDefault)
{
int ret = 0;
unsigned char buffer[READ_SIZE] = {0};
+
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_ReadConfDefault"));
+
#if 1
ret = pclKeyReadData(PCL_LDBID_LOCAL, "statusHandle/confdefault01", 3, 2, buffer, READ_SIZE);
//printf(" --- test_ReadConfDefault => statusHandle/confdefault01: %s => retIst: %d retSoll: %d\n", buffer, ret, strlen("CONF_DEFAULT_01!"));
@@ -685,6 +717,7 @@ START_TEST(test_WriteConfDefault)
unsigned char writeBuffer2[] = "And this is a test string which is different form previous test string";
unsigned char readBuffer[READ_SIZE] = {0};
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_WriteConfDefault"));
// -- key-value interface ---
ret = pclKeyWriteData(PCL_LDBID_LOCAL, "statusHandle/writeconfdefault01", PCL_USER_DEFAULTDATA, 0, writeBuffer, (int)strlen((char*)writeBuffer));
@@ -712,6 +745,8 @@ START_TEST(test_InitDeinit)
int i = 0, rval = -1, handle = 0;
int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_InitDeinit"));
+
for(i=0; i<5; i++)
{
// initialize and deinitialize 1. time
@@ -776,6 +811,8 @@ START_TEST(test_NegHandle)
int negativeHandle = -17;
unsigned char buffer[128] = {0};
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_NegHandle"));
+
handle = pclKeyHandleOpen(PCL_LDBID_LOCAL, "posHandle/last_position", 0, 0);
fail_unless(handle >= 0, "Failed to open handle ==> /posHandle/last_position");
@@ -814,6 +851,8 @@ START_TEST(test_utf8_string)
const char* utf8StringBuffer = "String °^° Ñ text";
unsigned char buffer[128] = {0};
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_utf8_string"));
+
ret = pclKeyReadData(PCL_LDBID_LOCAL, "utf8String", 3, 2, buffer, READ_SIZE);
fail_unless(ret == (int)strlen(utf8StringBuffer), "Wrong read size");
fail_unless(strncmp((char*)buffer, utf8StringBuffer, (size_t)ret-1) == 0, "Buffer not correctly read => 1");
@@ -828,6 +867,9 @@ END_TEST
START_TEST(test_Notifications)
{
int ret = 0;
+
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_Notifications"));
+
ret = pclKeyRegisterNotifyOnChange(0x20, "address/home_address", 1, 1, myChangeCallback);
fail_unless(ret == 0, "Failed to register");
@@ -853,6 +895,8 @@ START_TEST(test_ValidApplication)
int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
unsigned char buffer[128] = {0};
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_ValidApplication"));
+
ret = pclInitLibrary("InvalidAppID", shutdownReg);
ret = pclKeyGetSize(PCL_LDBID_LOCAL, "JustTesting", 1, 1);
@@ -969,6 +1013,8 @@ START_TEST(test_SharedAccess)
struct tm *locTime;
time_t t = time(0);
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_SharedAccess"));
+
locTime = localtime(&t);
// write data
@@ -1015,6 +1061,9 @@ START_TEST(test_VO722)
char* writeBuffer2[] = {"2 - VO722 - Test - String One",
"2 - VO722 - Test - String Two -",
"2 - VO722 - Test - String Three -", };
+
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_VO722"));
+
(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], (int)strlen(writeBuffer[0]));
@@ -1101,6 +1150,8 @@ START_TEST(test_NoRct)
int ret = 0;
const char writeBuffer[] = "This is a test string";
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_NoRct"));
+
ret = pclKeyWriteData(PCL_LDBID_LOCAL, "someResourceId", 0, 0, (unsigned char*)writeBuffer, (int)strlen(writeBuffer));
fail_unless(ret == EPERS_NOPRCTABLE, "RCT available, but should not");
}
@@ -1113,6 +1164,8 @@ START_TEST(test_InvalidPluginfConf)
int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
const char* envVariable = "PERS_CLIENT_LIB_CUSTOM_LOAD";
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_InvalidPluginfConf"));
+
// change to an invalid plugin configuration file using environment variable
setenv(envVariable, "/tmp/whatever/pclCustomLibConfigFile.cfg", 1);
@@ -1128,8 +1181,6 @@ START_TEST(test_InvalidPluginfConf)
pclDeinitLibrary();
-
-
(void)unsetenv(envVariable);
}
END_TEST
@@ -1138,6 +1189,8 @@ END_TEST
START_TEST(test_SharedData)
{
int ret = 0;
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_SharedData"));
+
ret = pclKeyWriteData(0x20, "links/last_link2", 2, 1, (unsigned char*)"Test notify shared data___1111", strlen("Test notify shared data___1111"));
fail_unless(ret == (int)strlen("Test notify shared data___1111"), "Wrong write size");
@@ -1250,6 +1303,8 @@ START_TEST(test_MultiThreadedRead)
int i=0;
char threadName[NUM_THREADS][NAME_LEN];
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_MultiThreadedRead"));
+
if(pthread_barrier_init(&gBarrierOne, NULL, NUM_THREADS) == 0)
{
for(i=0; i<NUM_THREADS; i++)
@@ -1351,6 +1406,8 @@ START_TEST(test_MultiThreadedWrite)
pthread_t gWritethreads[NUM_THREADS];
t_threadData threadData[NUM_THREADS];
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_MultiThreadedWrite"));
+
if(pthread_barrier_init(&gBarrierTwo, NULL, NUM_THREADS) == 0)
{
for(i=0; i<NUM_THREADS; i++)
@@ -1384,6 +1441,46 @@ END_TEST
+START_TEST(test_NoPluginFunc)
+{
+ unsigned char buffer[READ_SIZE] = {0};
+ int ret = 0, handle;
+ int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+ const char* envVariable = "PERS_CLIENT_LIB_CUSTOM_LOAD";
+
+ DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_NoPluginFunc"));
+
+ // change to an wrong plugin configuration file using environment variable
+ setenv(envVariable, "/etc/pclCustomLibConfigFileWrongDefault.cfg", 1);
+
+ sleep(3);
+
+ (void)pclInitLibrary(gTheAppId, shutdownReg); // use the app id, the resource is registered for
+
+ ret = pclKeyReadData(PCL_LDBID_LOCAL, "status/open_document", 3, 2, buffer, READ_SIZE);
+ printf("*** ret: %d\n", ret);
+ ck_assert_int_eq(ret, EPERS_COMMON);
+
+ ret = pclKeyGetSize(PCL_LDBID_LOCAL, "status/open_document", 3, 2);
+ ck_assert_int_eq(ret, EPERS_COMMON);
+
+ handle = pclKeyHandleOpen(PCL_LDBID_LOCAL, "posHandle/last_position", 0, 0);
+ ck_assert_int_gt(handle, 0);
+
+ ret = pclKeyHandleReadData(handle, buffer, READ_SIZE);
+ ck_assert_int_eq(ret, EPERS_COMMON);
+
+ ret = pclKeyHandleClose(handle);
+ ck_assert_int_eq(ret, 1);
+
+ pclDeinitLibrary();
+
+ (void)unsetenv(envVariable);
+}
+END_TEST
+
+
+
static Suite * persistencyClientLib_suite()
{
const char* testSuiteName = "Persistency Client Library (Key-API)";
@@ -1418,7 +1515,6 @@ static Suite * persistencyClientLib_suite()
tcase_add_test(tc_persDataHandleOpen, test_DataHandleOpen);
tcase_set_timeout(tc_persDataHandleOpen, 3);
-
TCase * tc_Plugin = tcase_create("Plugin");
tcase_add_test(tc_Plugin, test_Plugin);
tcase_set_timeout(tc_Plugin, 3);
@@ -1477,6 +1573,9 @@ static Suite * persistencyClientLib_suite()
tcase_add_test(tc_NoRct, test_NoRct);
tcase_set_timeout(tc_NoRct, 3);
+ TCase * tc_NoPluginFunc = tcase_create("NoPluginFunc");
+ tcase_add_test(tc_NoPluginFunc, test_NoPluginFunc);
+
TCase * tc_InvalidPluginfConf = tcase_create("InvalidPluginfConf");
tcase_add_test(tc_InvalidPluginfConf, test_InvalidPluginfConf);
@@ -1492,12 +1591,14 @@ static Suite * persistencyClientLib_suite()
tcase_add_test(tc_MultiThreadedWrite, test_MultiThreadedWrite);
tcase_set_timeout(tc_MultiThreadedWrite, 20);
- suite_add_tcase(s, tc_persGetData);
- tcase_add_checked_fixture(tc_persGetData, data_setup, data_teardown);
suite_add_tcase(s, tc_persSetData);
tcase_add_checked_fixture(tc_persSetData, data_setup, data_teardown);
+ suite_add_tcase(s, tc_persGetData);
+ tcase_add_checked_fixture(tc_persGetData, data_setup, data_teardown);
+
+
suite_add_tcase(s, tc_persGetDataHandle);
tcase_add_checked_fixture(tc_persGetDataHandle, data_setup, data_teardown);
@@ -1542,8 +1643,10 @@ static Suite * persistencyClientLib_suite()
suite_add_tcase(s, tc_InitDeinit);
- suite_add_tcase(s, tc_SharedData);
- tcase_add_checked_fixture(tc_SharedData, data_setup, data_teardown);
+ //suite_add_tcase(s, tc_NoPluginFunc);
+
+ // suite_add_tcase(s, tc_SharedData);
+ // tcase_add_checked_fixture(tc_SharedData, data_setup, data_teardown);
suite_add_tcase(s, tc_MultiThreadedRead);
tcase_add_checked_fixture(tc_MultiThreadedRead, data_setup, data_teardown);
diff --git a/test/persistence_client_library_test_file.c b/test/persistence_client_library_test_file.c
index c336c45..3e3fffd 100644
--- a/test/persistence_client_library_test_file.c
+++ b/test/persistence_client_library_test_file.c
@@ -1011,6 +1011,10 @@ int main(int argc, char *argv[])
SRunner * sr = srunner_create(s);
srunner_set_fork_status(sr, CK_NOFORK);
+ srunner_set_xml(sr, "/tmp/persistenceClientLibraryTestFile.xml");
+ srunner_set_log(sr, "/tmp/persistenceClientLibraryTestFile.log");
+
+
srunner_run_all(sr, CK_VERBOSE /*CK_NORMAL CK_VERBOSE CK_SUBUNIT*/);
nr_failed = srunner_ntests_failed(sr);
diff --git a/test/persistence_test_customlib.c b/test/persistence_test_customlib.c
index 93cc80a..47dab63 100644
--- a/test/persistence_test_customlib.c
+++ b/test/persistence_test_customlib.c
@@ -36,6 +36,38 @@
#include "../include/persistence_client_custom.h"
+#define PERS_ORG_RCT_NAME "resource-table-cfg.itz"
+#define PERS_ORG_RCT_NAME_ "/"PERS_ORG_RCT_NAME
+const char* gResTableCfg = PERS_ORG_RCT_NAME_;
+
+#define PERS_ORG_LOCAL_CONFIGURABLE_DEFAULT_DB_NAME "configurable-default-data.itz"
+#define PERS_ORG_LOCAL_CONFIGURABLE_DEFAULT_DB_NAME_ "/"PERS_ORG_LOCAL_CONFIGURABLE_DEFAULT_DB_NAME
+const char* gLocalConfigurableDefault = PERS_ORG_LOCAL_CONFIGURABLE_DEFAULT_DB_NAME_;
+
+#define PERS_ORG_NODE_FOLDER_NAME "node"
+#define PERS_ORG_NODE_FOLDER_NAME_ "/" PERS_ORG_NODE_FOLDER_NAME
+const char* gNode = PERS_ORG_NODE_FOLDER_NAME_;
+
+#define PERS_ORG_LOCAL_CACHE_DB_NAME "cached.itz"
+#define PERS_ORG_LOCAL_CACHE_DB_NAME_ "/"PERS_ORG_LOCAL_CACHE_DB_NAME
+const char* gLocalCached = PERS_ORG_LOCAL_CACHE_DB_NAME_;
+
+#define PERS_ORG_LOCAL_FACTORY_DEFAULT_DB_NAME "default-data.itz"
+#define PERS_ORG_LOCAL_FACTORY_DEFAULT_DB_NAME_ "/"PERS_ORG_LOCAL_FACTORY_DEFAULT_DB_NAME
+const char* gLocalFactoryDefault = PERS_ORG_LOCAL_FACTORY_DEFAULT_DB_NAME_;
+
+#define PERS_ORG_SEAT_FOLDER_NAME "seat"
+#define PERS_ORG_SEAT_FOLDER_NAME_ "/"PERS_ORG_SEAT_FOLDER_NAME "/"
+const char* gSeat = PERS_ORG_SEAT_FOLDER_NAME_;
+
+#define PERS_ORG_LOCAL_WT_DB_NAME "wt.itz"
+#define PERS_ORG_LOCAL_WT_DB_NAME_ "/" PERS_ORG_LOCAL_WT_DB_NAME;
+const char* gLocalWt = PERS_ORG_LOCAL_WT_DB_NAME_;
+
+#define PERS_ORG_USER_FOLDER_NAME "user"
+#define PERS_ORG_USER_FOLDER_NAME_ "/"PERS_ORG_USER_FOLDER_NAME "/"
+const char* gUser = PERS_ORG_USER_FOLDER_NAME_;
+
/**
* @brief close the given handle
*