You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2024/05/30 17:24:08 UTC

(celix) branch feature/685-update-container-config-properties-usage created (now b8c6ab5ca)

This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-update-container-config-properties-usage
in repository https://gitbox.apache.org/repos/asf/celix.git


      at b8c6ab5ca gh-685: Change space sep in auto start bundle to comma seperator

This branch includes the following new commits:

     new 2c28348ee gh-685: Remove of old properties load and store
     new 74f425794 gh-685: Refactor config prop cmake gen and test config props
     new 0a0709a2d gh-685: Improve error handling for properties save/load
     new 0566315d6 gh-685: Rename properties load2/loadFromString2 to load/loadFromString
     new b8c6ab5ca gh-685: Change space sep in auto start bundle to comma seperator

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(celix) 01/05: gh-685: Remove of old properties load and store

Posted by pn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-update-container-config-properties-usage
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 2c28348ee8a5d4c166a6b2635f620269c3af3a60
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Fri May 24 12:54:25 2024 +0200

    gh-685: Remove of old properties load and store
    
    Also introduces some additional error test to check
    the handling of properties load/save with an error
    return.
---
 .../gtest/src/rsa_client_server_tests.cc           |  42 ++--
 .../gtest/src/rsa_tests.cc                         |  25 +-
 cmake/cmake_celix/ContainerPackaging.cmake         |   9 +-
 .../BundleArchiveWithErrorInjectionTestSuite.cc    |  27 ++-
 .../src/CelixBundleCacheErrorInjectionTestSuite.cc |  42 +++-
 .../framework/gtest/src/CelixFrameworkTestSuite.cc |   3 +-
 libs/framework/src/bundle_archive.c                |  14 +-
 libs/framework/src/celix_bundle_cache.c            |   9 +-
 libs/framework/src/celix_launcher.c                | 176 +++++++-------
 .../error_injector/celix_properties/CMakeLists.txt |   2 +
 .../celix_properties/include/celix_properties_ei.h |   2 +
 .../celix_properties/src/celix_properties_ei.cc    |  22 ++
 libs/utils/gtest/src/CxxPropertiesTestSuite.cc     |  22 --
 libs/utils/gtest/src/FileUtilsTestSuite.cc         |  13 +-
 .../gtest/src/PropertiesErrorInjectionTestSuite.cc | 127 ----------
 libs/utils/gtest/src/PropertiesTestSuite.cc        |  68 ------
 libs/utils/include/celix/Properties.h              |  40 ----
 libs/utils/include/celix_properties.h              |  51 ----
 libs/utils/src/properties.c                        | 264 ---------------------
 19 files changed, 250 insertions(+), 708 deletions(-)

diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc
index 7e903e1e9..a5d241cf1 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc
@@ -44,16 +44,16 @@ typedef struct rsa_dfi_exception_test_service {
     int (*func1)(void *handle);
 }rsa_dfi_exception_test_service_t;
 
-    static celix_framework_t *serverFramework = NULL;
-    static celix_bundle_context_t *serverContext = NULL;
+    static celix_framework_t *serverFramework = nullptr;
+    static celix_bundle_context_t *serverContext = nullptr;
 
-    static celix_framework_t *clientFramework = NULL;
-    static celix_bundle_context_t *clientContext = NULL;
+    static celix_framework_t *clientFramework = nullptr;
+    static celix_bundle_context_t *clientContext = nullptr;
 
-    static rsa_dfi_exception_test_service_t *exceptionTestService = NULL;
+    static rsa_dfi_exception_test_service_t *exceptionTestService = nullptr;
     static long exceptionTestSvcId = -1L;
-    static remote_interceptor_t *serverSvcInterceptor=NULL;
-    static remote_interceptor_t *clientSvcInterceptor=NULL;
+    static remote_interceptor_t *serverSvcInterceptor=nullptr;
+    static remote_interceptor_t *clientSvcInterceptor=nullptr;
     static long serverSvcInterceptorSvcId = -1L;
     static long clientSvcInterceptorSvcId = -1L;
     static bool clientInterceptorPreProxyCallRetval=true;
@@ -61,21 +61,23 @@ typedef struct rsa_dfi_exception_test_service {
 
     static void setupFm(bool useCurlShare) {
         //server
-        celix_properties_t *serverProps = celix_properties_load("server.properties");
-        ASSERT_TRUE(serverProps != NULL);
+        celix_properties_t *serverProps = nullptr;
+        ASSERT_EQ(CELIX_SUCCESS, celix_properties_load2("server.properties", 0, &serverProps));
+        ASSERT_TRUE(serverProps != nullptr);
         serverFramework = celix_frameworkFactory_createFramework(serverProps);
-        ASSERT_TRUE(serverFramework != NULL);
+        ASSERT_TRUE(serverFramework != nullptr);
         serverContext = celix_framework_getFrameworkContext(serverFramework);
-        ASSERT_TRUE(serverContext != NULL);
+        ASSERT_TRUE(serverContext != nullptr);
 
         //client
-        celix_properties_t *clientProperties = celix_properties_load("client.properties");
+        celix_properties_t *clientProperties = nullptr;
+        ASSERT_EQ(CELIX_SUCCESS, celix_properties_load2("client.properties", 0, &clientProperties));
         celix_properties_setBool(clientProperties, "RSA_DFI_USE_CURL_SHARE_HANDLE", useCurlShare);
-        ASSERT_TRUE(clientProperties != NULL);
+        ASSERT_TRUE(clientProperties != nullptr);
         clientFramework = celix_frameworkFactory_createFramework(clientProperties);
-        ASSERT_TRUE(clientFramework != NULL);
+        ASSERT_TRUE(clientFramework != nullptr);
         clientContext = celix_framework_getFrameworkContext(clientFramework);
-        ASSERT_TRUE(clientContext != NULL);
+        ASSERT_TRUE(clientContext != nullptr);
     }
 
     static void teardownFm(void) {
@@ -92,7 +94,7 @@ typedef struct rsa_dfi_exception_test_service {
         celix_properties_set(properties, CELIX_RSA_SERVICE_EXPORTED_INTERFACES, RSA_DIF_EXCEPTION_TEST_SERVICE);
         celix_properties_set(properties, CELIX_RSA_SERVICE_EXPORTED_CONFIGS, "org.amdatu.remote.admin.http");
         exceptionTestService = (rsa_dfi_exception_test_service_t *)calloc(1,sizeof(*exceptionTestService));
-        exceptionTestService->handle = NULL;
+        exceptionTestService->handle = nullptr;
         exceptionTestService->func1 = rsaDfi_excepTestFunc1;
         exceptionTestSvcId = celix_bundleContext_registerService(serverContext, exceptionTestService, RSA_DIF_EXCEPTION_TEST_SERVICE, properties);
     }
@@ -137,7 +139,7 @@ typedef struct rsa_dfi_exception_test_service {
     static void registerInterceptorService(void) {
         svcInterceptorPreExportCallRetval = true;
         serverSvcInterceptor = (remote_interceptor_t *)calloc(1,sizeof(*serverSvcInterceptor));
-        serverSvcInterceptor->handle = NULL;
+        serverSvcInterceptor->handle = nullptr;
         serverSvcInterceptor->preProxyCall = serverServiceInterceptor_preProxyCall;
         serverSvcInterceptor->postProxyCall = serverServiceInterceptor_postProxyCall;
         serverSvcInterceptor->preExportCall = serverServiceInterceptor_preExportCall;
@@ -153,7 +155,7 @@ typedef struct rsa_dfi_exception_test_service {
 
         clientInterceptorPreProxyCallRetval = true;
         clientSvcInterceptor = (remote_interceptor_t *)calloc(1,sizeof(*clientSvcInterceptor));
-        clientSvcInterceptor->handle = NULL;
+        clientSvcInterceptor->handle = nullptr;
         clientSvcInterceptor->preProxyCall = clientServiceInterceptor_preProxyCall;
         clientSvcInterceptor->postProxyCall = clientServiceInterceptor_postProxyCall;
         clientSvcInterceptor->preExportCall = clientServiceInterceptor_preExportCall;
@@ -472,8 +474,8 @@ public:
 
         char calcIdStr[32] = {0};
         snprintf(calcIdStr, 32, "%li", calcId);
-        celix_array_list_t *svcRegistrations = NULL;
-        auto status = serverRsaSvc->exportService(serverRsaSvc->admin, calcIdStr, NULL, &svcRegistrations);
+        celix_array_list_t *svcRegistrations = nullptr;
+        auto status = serverRsaSvc->exportService(serverRsaSvc->admin, calcIdStr, nullptr, &svcRegistrations);
         ASSERT_EQ(CELIX_SUCCESS, status);
         ASSERT_EQ(1, celix_arrayList_size(svcRegistrations));
         export_registration_t *exportedReg = static_cast<export_registration_t*>(celix_arrayList_get(svcRegistrations, 0));
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc
index 3195b4630..8d8fef378 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc
@@ -33,18 +33,19 @@ extern "C" {
 
 #define TST_CONFIGURATION_TYPE "org.amdatu.remote.admin.http"
 
-    static celix_framework_t *framework = NULL;
-    static celix_bundle_context_t *context = NULL;
+    static celix_framework_t *framework = nullptr;
+    static celix_bundle_context_t *context = nullptr;
 
     long calcSvcId = -1L;
 
     static void setupFm(void) {
-        celix_properties_t *fwProperties = celix_properties_load("config.properties");
-        ASSERT_TRUE(fwProperties != NULL);
+        celix_properties_t *fwProperties = nullptr;
+        EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2("config.properties", 0, &fwProperties));
+        ASSERT_TRUE(fwProperties != nullptr);
         framework = celix_frameworkFactory_createFramework(fwProperties);
-        ASSERT_TRUE(framework != NULL);
+        ASSERT_TRUE(framework != nullptr);
         context = celix_framework_getFrameworkContext(framework);
-        ASSERT_TRUE(context != NULL);
+        ASSERT_TRUE(context != nullptr);
 
 
         calcSvcId = celix_bundleContext_findService(context, CALCULATOR_SERVICE);
@@ -87,8 +88,8 @@ extern "C" {
         char strSvcId[64];
         snprintf(strSvcId, 64, "%li", calcSvcId);
 
-        celix_array_list_t *svcRegistration = NULL;
-        int rc = rsa->exportService(rsa->admin, strSvcId, NULL, &svcRegistration);
+        celix_array_list_t *svcRegistration = nullptr;
+        int rc = rsa->exportService(rsa->admin, strSvcId, nullptr, &svcRegistration);
         ASSERT_EQ(CELIX_SUCCESS, rc);
 
         ASSERT_EQ(1, celix_arrayList_size(svcRegistration));
@@ -155,7 +156,7 @@ extern "C" {
     }
 
     static void testBundles(void) {
-        celix_array_list_t* bundles = NULL;
+        celix_array_list_t* bundles = nullptr;
 
         int rc = bundleContext_getBundles(context, &bundles);
         ASSERT_EQ(0, rc);
@@ -165,9 +166,9 @@ extern "C" {
         int size = arrayList_size(bundles);
         int i;
         for (i = 0; i < size; i += 1) {
-            celix_bundle_t *bundle = NULL;
-            module_pt module = NULL;
-            char *name = NULL;
+            celix_bundle_t *bundle = nullptr;
+            module_pt module = nullptr;
+            char *name = nullptr;
 
             bundle = (celix_bundle_t *) arrayList_get(bundles, i);
             bundle_getCurrentModule(bundle, &module);
diff --git a/cmake/cmake_celix/ContainerPackaging.cmake b/cmake/cmake_celix/ContainerPackaging.cmake
index 78e799eb9..382a2bd16 100644
--- a/cmake/cmake_celix/ContainerPackaging.cmake
+++ b/cmake/cmake_celix/ContainerPackaging.cmake
@@ -221,6 +221,8 @@ function(add_celix_container)
         file(GENERATE
                 OUTPUT "${STAGE1_LAUNCHER_SRC}"
                 CONTENT "#include <celix_launcher.h>
+#include <celix_err.h>
+
 int main(int argc, char *argv[]) {
     const char * config = \"\\
 CELIX_CONTAINER_NAME=$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_NAME>\\n\\
@@ -236,7 +238,12 @@ $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:CELIX
 $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,\\n\\
 >\";
 
-    celix_properties_t *embeddedProps = celix_properties_loadFromString(config);
+    celix_properties_t *embeddedProps;
+    celix_status_t status = celix_properties_loadFromString2(config, 0, &embeddedProps);
+    if (status != CELIX_SUCCESS) {
+        celix_err_printErrors(stderr, \"Error creating embedded properties.\", NULL);
+        return -1;
+    }
     return celixLauncher_launchAndWaitForShutdown(argc, argv, embeddedProps);
 }
 "
diff --git a/libs/framework/gtest/src/BundleArchiveWithErrorInjectionTestSuite.cc b/libs/framework/gtest/src/BundleArchiveWithErrorInjectionTestSuite.cc
index 03100ddff..b7d1e5568 100644
--- a/libs/framework/gtest/src/BundleArchiveWithErrorInjectionTestSuite.cc
+++ b/libs/framework/gtest/src/BundleArchiveWithErrorInjectionTestSuite.cc
@@ -57,6 +57,7 @@ class BundleArchiveWithErrorInjectionTestSuite : public ::testing::Test {
 
     void teardownErrorInjectors() {
         celix_ei_expect_celix_properties_create(nullptr, 0, nullptr);
+        celix_ei_expect_celix_properties_save(nullptr, 0, CELIX_SUCCESS);
         celix_ei_expect_asprintf(nullptr, 0, 0);
         celix_ei_expect_calloc(nullptr, 0, nullptr);
         celix_ei_expect_malloc(nullptr, 0, nullptr);
@@ -257,4 +258,28 @@ TEST_F(CelixBundleArchiveErrorInjectionTestSuite, ArchiveCreateErrorTest) {
     teardownErrorInjectors();
 
     EXPECT_EQ(CELIX_SUCCESS, celix_bundleCache_destroy(cache));
-}
\ No newline at end of file
+}
+
+TEST_F(CelixBundleArchiveErrorInjectionTestSuite, StoreBundleStatePropertiesErrorTest) {
+    // Given a framework
+    auto fw = celix::createFramework({
+        {CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE, "true"},
+    });
+    auto ctx = fw->getFrameworkBundleContext();
+
+    // When an error is prepped for celix_properties_save
+    celix_ei_expect_celix_properties_save((void*)celix_bundleCache_findBundleIdForLocation, 1, CELIX_FILE_IO_EXCEPTION);
+
+    // When the bundle install, a bundle id is returned (async bundle install)
+    long bndId = ctx->installBundle(SIMPLE_TEST_BUNDLE1_LOCATION);
+    EXPECT_GE(bndId, 0);
+
+    // Then the bundle is not successfully installed
+
+    celix_bundleContext_useBundle(
+        ctx->getCBundleContext(), bndId, nullptr, [](void* /*handle*/, const celix_bundle_t* bnd) {
+            auto status = celix_bundle_getState(bnd);
+            // TODO fixme, bundle is installed and active, this is not correct
+            EXPECT_EQ(CELIX_BUNDLE_EVENT_INSTALLED, status);
+        });
+}
diff --git a/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc b/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
index 2082013e4..732119441 100644
--- a/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
@@ -21,6 +21,7 @@
 
 #include <string>
 
+#include "celix/FrameworkFactory.h"
 #include "celix_bundle_cache.h"
 #include "celix_constants.h"
 #include "celix_file_utils.h"
@@ -28,6 +29,7 @@
 #include "celix_log.h"
 #include "celix_properties.h"
 #include "celix_utils_ei.h"
+#include "celix_properties_ei.h"
 
 #include "asprintf_ei.h"
 #include "bundle_archive_private.h"
@@ -54,6 +56,7 @@ class CelixBundleCacheErrorInjectionTestSuite : public ::testing::Test {
         celix_ei_expect_celix_stringHashMap_create(nullptr, 0, nullptr);
         celix_ei_expect_malloc(nullptr, 0, nullptr);
         celix_ei_expect_calloc(nullptr, 0, nullptr);
+        celix_ei_expect_celix_properties_load2(nullptr, 0, CELIX_SUCCESS);
         celix_frameworkLogger_destroy(fw.logger);
         celix_properties_destroy(fw.configurationMap);
     }
@@ -163,4 +166,41 @@ TEST_F(CelixBundleCacheErrorInjectionTestSuite, CreateBundleArchivesCacheErrorTe
     celix_ei_expect_celix_utils_writeOrCreateString((void*)celix_bundleCache_createArchive, 0, nullptr);
     EXPECT_EQ(CELIX_ENOMEM, celix_bundleCache_createBundleArchivesCache(&fw, true));
     EXPECT_EQ(CELIX_SUCCESS, celix_bundleCache_destroy(cache));
-}
\ No newline at end of file
+}
+
+TEST_F(CelixBundleCacheErrorInjectionTestSuite, LoadBundleStatePropertiesErrorTest) {
+    // Given a celix framework
+    auto fw = celix::createFramework(
+        {{"CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL", "trace"}, {CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE, "true"}});
+    auto ctx = fw->getFrameworkBundleContext();
+
+    // And an installed bundle (with a bundle cache)
+    long bndId = ctx->installBundle(SIMPLE_TEST_BUNDLE1_LOCATION);
+    EXPECT_GT(bndId, -1);
+
+    // When framework is stopped
+    ctx.reset();
+    fw.reset();
+
+    // And a new framework is created
+    fw = celix::createFramework(
+        {{"CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL", "trace"}, {CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE, "false"}});
+    ctx = fw->getFrameworkBundleContext();
+
+    // When the bundle is uninstalled
+    celix_bundleContext_uninstallBundle(ctx->getCBundleContext(), bndId);
+
+    // And a celix_properties_load error is injected
+    celix_ei_expect_celix_properties_load2(
+        (void*)celix_bundleCache_findBundleIdForLocation, 1, CELIX_FILE_IO_EXCEPTION);
+
+    // Then installing the bundle will fail
+    bndId = ctx->installBundle(SIMPLE_TEST_BUNDLE1_LOCATION);
+    EXPECT_GT(bndId, -1); //async install, so bundle id is returned
+    celix_bundleContext_useBundle(
+        ctx->getCBundleContext(), bndId, nullptr, [](void* /*handle*/, const celix_bundle_t* bnd) {
+            auto status = celix_bundle_getState(bnd);
+            // TODO fixme, bundle is installed and active, this is not correct
+            EXPECT_EQ(CELIX_BUNDLE_EVENT_INSTALLED, status);
+        });
+}
diff --git a/libs/framework/gtest/src/CelixFrameworkTestSuite.cc b/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
index 3eae055c6..5af8f391f 100644
--- a/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
+++ b/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
@@ -324,7 +324,8 @@ TEST_F(FrameworkFactoryTestSuite, LaunchFrameworkWithConfigTest) {
      * the specified bundles will be installed and - if needed - started.
      */
 
-    auto* config = celix_properties_load(INSTALL_AND_START_BUNDLES_CONFIG_PROPERTIES_FILE);
+    celix_properties_t* config = nullptr;
+    ASSERT_EQ(CELIX_SUCCESS, celix_properties_load2(INSTALL_AND_START_BUNDLES_CONFIG_PROPERTIES_FILE, 0, &config));
     ASSERT_TRUE(config != nullptr);
 
     framework_t* fw = celix_frameworkFactory_createFramework(config);
diff --git a/libs/framework/src/bundle_archive.c b/libs/framework/src/bundle_archive.c
index 688567345..b3cdd5e83 100644
--- a/libs/framework/src/bundle_archive.c
+++ b/libs/framework/src/bundle_archive.c
@@ -62,9 +62,9 @@ struct bundleArchive {
 
 static celix_status_t celix_bundleArchive_storeBundleStateProperties(bundle_archive_pt archive) {
     bool needUpdate = false;
-    celix_properties_t* bundleStateProperties = NULL;
-    bundleStateProperties = celix_properties_load(archive->savedBundleStatePropertiesPath);
-    if (bundleStateProperties == NULL) {
+    celix_properties_t* bundleStateProperties;
+    celix_status_t status = celix_properties_load2(archive->savedBundleStatePropertiesPath, 0, &bundleStateProperties);
+    if (status != CELIX_SUCCESS) {
         celix_framework_logTssErrors(archive->fw->logger, CELIX_LOG_LEVEL_ERROR);
         bundleStateProperties = celix_properties_create();
     }
@@ -91,8 +91,12 @@ static celix_status_t celix_bundleArchive_storeBundleStateProperties(bundle_arch
 
     //save bundle cache state properties
     if (needUpdate) {
-        celix_properties_store(bundleStateProperties, archive->savedBundleStatePropertiesPath,
-                               "Bundle State Properties");
+        status = celix_properties_save(
+            bundleStateProperties, archive->savedBundleStatePropertiesPath, CELIX_PROPERTIES_ENCODE_PRETTY);
+        if (status != CELIX_SUCCESS) {
+            celix_framework_logTssErrors(archive->fw->logger, CELIX_LOG_LEVEL_ERROR);
+            return status;
+        }
     }
     celix_properties_destroy(bundleStateProperties);
     return CELIX_SUCCESS;
diff --git a/libs/framework/src/celix_bundle_cache.c b/libs/framework/src/celix_bundle_cache.c
index d1917e2d2..770d83b33 100644
--- a/libs/framework/src/celix_bundle_cache.c
+++ b/libs/framework/src/celix_bundle_cache.c
@@ -235,7 +235,14 @@ static void celix_bundleCache_updateIdForLocationLookupMap(celix_bundle_cache_t*
                                                                       "%s/%s/%s", cache->cacheDir, dent->d_name,
                                                                       CELIX_BUNDLE_ARCHIVE_STATE_PROPERTIES_FILE_NAME);
         if (celix_utils_fileExists(bundleStateProperties)) {
-            celix_properties_t* props = celix_properties_load(bundleStateProperties);
+            celix_properties_t* props;
+            celix_status_t status = celix_properties_load2(bundleStateProperties, 0, &props); //validate the file (and ignore the result
+            if (status != CELIX_SUCCESS) {
+                    fw_logCode(cache->fw->logger, CELIX_LOG_LEVEL_ERROR, status,
+                               "Cannot load bundle state properties from %s", bundleStateProperties);
+                    celix_framework_logTssErrors(cache->fw->logger, CELIX_LOG_LEVEL_ERROR);
+                    continue;
+            }
             const char* visitLoc = celix_properties_get(props, CELIX_BUNDLE_ARCHIVE_LOCATION_PROPERTY_NAME, NULL);
             long bndId = celix_properties_getAsLong(props, CELIX_BUNDLE_ARCHIVE_BUNDLE_ID_PROPERTY_NAME, -1);
             if (visitLoc != NULL && bndId >= 0) {
diff --git a/libs/framework/src/celix_launcher.c b/libs/framework/src/celix_launcher.c
index 8cf32a6f3..e3a72e29c 100644
--- a/libs/framework/src/celix_launcher.c
+++ b/libs/framework/src/celix_launcher.c
@@ -17,32 +17,33 @@
  * under the License.
  */
 
-
 #include "celix_launcher.h"
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
 #include <libgen.h>
 #include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #ifndef CELIX_NO_CURLINIT
 #include <curl/curl.h>
 #endif
 
-#include "framework.h"
-#include "celix_framework_factory.h"
 #include "celix_constants.h"
+#include "celix_framework_factory.h"
 #include "celix_framework_utils.h"
+#include "celix_err.h"
 
 static void celixLauncher_shutdownFramework(int signal);
 static void celixLauncher_ignore(int signal);
-static int celixLauncher_launchWithConfigAndProps(const char *configFile, celix_framework_t* *framework, celix_properties_t* packedConfig);
-static void celixLauncher_combineProperties(celix_properties_t *original, const celix_properties_t *append);
+static int celixLauncher_launchWithConfigAndProps(const char* configFile,
+                                                  celix_framework_t** framework,
+                                                  celix_properties_t* packedConfig);
+static void celixLauncher_combineProperties(celix_properties_t* original, const celix_properties_t* append);
 static celix_properties_t* celixLauncher_createConfig(const char* configFile, celix_properties_t* embeddedProperties);
 
 static void celixLauncher_printUsage(char* progName);
-static void celixLauncher_printProperties(celix_properties_t *embeddedProps, const char* configFile);
+static void celixLauncher_printProperties(celix_properties_t* embeddedProps, const char* configFile);
 static int celixLauncher_createBundleCache(celix_properties_t* embeddedProperties, const char* configFile);
 
 #define DEFAULT_CONFIG_FILE "config.properties"
@@ -50,11 +51,9 @@ static int celixLauncher_createBundleCache(celix_properties_t* embeddedPropertie
 #define CELIX_LAUNCHER_OK_EXIT_CODE 0
 #define CELIX_LAUNCHER_ERROR_EXIT_CODE 1
 
-static framework_t *g_fw = NULL;
-
+static framework_t* g_fw = NULL;
 
-
-int celixLauncher_launchAndWaitForShutdown(int argc, char *argv[], celix_properties_t* packedConfig) {
+int celixLauncher_launchAndWaitForShutdown(int argc, char* argv[], celix_properties_t* packedConfig) {
     celix_framework_t* framework = NULL;
     int rc = celixLauncher_launchWithArgv(argc, argv, packedConfig, &framework);
     if (rc == 0 && framework != NULL) {
@@ -131,43 +130,45 @@ int celixLauncher_launchWithArgv(int argc,
 }
 
 static void celixLauncher_shutdownFramework(int signal) {
-	if (g_fw != NULL) {
-		celixLauncher_stop(g_fw); //NOTE main thread will destroy
-	}
+    if (g_fw != NULL) {
+        celixLauncher_stop(g_fw); // NOTE main thread will destroy
+    }
 }
 
 static void celixLauncher_ignore(int signal) {
-	//ignoring for signal SIGUSR1, SIGUSR2. Can be used on threads
+    // ignoring for signal SIGUSR1, SIGUSR2. Can be used on threads
 }
 
-int celixLauncher_launch(const char *configFile, celix_framework_t* *framework) {
-	return celixLauncher_launchWithConfigAndProps(configFile, framework, NULL);
+int celixLauncher_launch(const char* configFile, celix_framework_t** framework) {
+    return celixLauncher_launchWithConfigAndProps(configFile, framework, NULL);
 }
 
-static int celixLauncher_launchWithConfigAndProps(const char *configFile, celix_framework_t** framework, celix_properties_t* packedConfig) {
+static int celixLauncher_launchWithConfigAndProps(const char* configFile,
+                                                  celix_framework_t** framework,
+                                                  celix_properties_t* packedConfig) {
     celix_properties_t* config = celixLauncher_createConfig(configFile, packedConfig);
+    if (!config) {
+        return CELIX_LAUNCHER_ERROR_EXIT_CODE;
+    }
     return celixLauncher_launchWithProperties(config, framework);
 }
 
-
 int celixLauncher_launchWithProperties(celix_properties_t* config, celix_framework_t** framework) {
 #ifndef CELIX_NO_CURLINIT
-	// Before doing anything else, let's setup Curl
-	curl_global_init(CURL_GLOBAL_ALL);
+    // Before doing anything else, let's setup Curl
+    curl_global_init(CURL_GLOBAL_ALL);
 #endif
-	*framework = celix_frameworkFactory_createFramework(config);
-	return *framework != NULL ? CELIX_LAUNCHER_OK_EXIT_CODE : CELIX_LAUNCHER_ERROR_EXIT_CODE;
+    *framework = celix_frameworkFactory_createFramework(config);
+    return *framework != NULL ? CELIX_LAUNCHER_OK_EXIT_CODE : CELIX_LAUNCHER_ERROR_EXIT_CODE;
 }
 
-void celixLauncher_waitForShutdown(celix_framework_t* framework) {
-    celix_framework_waitForStop(framework);
-}
+void celixLauncher_waitForShutdown(celix_framework_t* framework) { celix_framework_waitForStop(framework); }
 
 void celixLauncher_destroy(celix_framework_t* framework) {
     celix_frameworkFactory_destroyFramework(framework);
 #ifndef CELIX_NO_CURLINIT
-	// Cleanup Curl
-	curl_global_cleanup();
+    // Cleanup Curl
+    curl_global_cleanup();
 #endif
 }
 
@@ -175,7 +176,6 @@ void celixLauncher_stop(celix_framework_t* framework) {
     celix_framework_stopBundle(framework, CELIX_FRAMEWORK_BUNDLE_ID);
 }
 
-
 static void celixLauncher_printUsage(char* progName) {
     printf("Usage:\n  %s [-h|-p] [path/to/runtime/config.properties]\n", basename(progName));
     printf("Options:\n");
@@ -186,67 +186,69 @@ static void celixLauncher_printUsage(char* progName) {
     printf("\n");
 }
 
-static void celixLauncher_printProperties(celix_properties_t *embeddedProps, const char *configFile) {
-	celix_properties_t *keys = celix_properties_create(); //only to store the keys
+static void celixLauncher_printProperties(celix_properties_t* embeddedProps, const char* configFile) {
+    celix_properties_t* keys = celix_properties_create(); // only to store the keys
 
-	printf("Embedded properties:\n");
-	if (embeddedProps == NULL || celix_properties_size(embeddedProps) == 0) {
-		printf("|- Empty!\n");
-	} else {
+    printf("Embedded properties:\n");
+    if (embeddedProps == NULL || celix_properties_size(embeddedProps) == 0) {
+        printf("|- Empty!\n");
+    } else {
         CELIX_PROPERTIES_ITERATE(embeddedProps, visit) {
-			printf("|- %s=%s\n", visit.key, visit.entry.value);
+            printf("|- %s=%s\n", visit.key, visit.entry.value);
             celix_properties_set(keys, visit.key, NULL);
         }
-	}
-	printf("\n");
-
-	celix_properties_t *runtimeProps = NULL;
-	if (configFile != NULL) {
-        runtimeProps = celix_properties_load(configFile);
-	}
-	printf("Runtime properties (input %s):\n", configFile);
-	if (runtimeProps == NULL || celix_properties_size(runtimeProps) == 0) {
-		printf("|- Empty!\n");
-	} else {
+    }
+    printf("\n");
+
+    celix_properties_t* runtimeProps = NULL;
+    if (configFile != NULL) {
+        celix_status_t status = celix_properties_load2(configFile, 0, &runtimeProps);
+        if (status != CELIX_SUCCESS) {
+            celix_err_printErrors(stderr, "Error loading config file.", NULL);
+        }
+    }
+    printf("Runtime properties (input %s):\n", configFile);
+    if (runtimeProps == NULL || celix_properties_size(runtimeProps) == 0) {
+        printf("|- Empty!\n");
+    } else {
         CELIX_PROPERTIES_ITERATE(runtimeProps, visit) {
-			printf("|- %s=%s\n", visit.key, visit.entry.value);
+            printf("|- %s=%s\n", visit.key, visit.entry.value);
             celix_properties_set(keys, visit.key, NULL);
         }
-	}
+    }
     printf("\n");
 
-	//combined result
-	printf("Resolved (env, runtime and embedded) properties:\n");
-	if (celix_properties_size(keys) == 0) {
-		printf("|- Empty!\n");
-	} else {
+    // combined result
+    printf("Resolved (env, runtime and embedded) properties:\n");
+    if (celix_properties_size(keys) == 0) {
+        printf("|- Empty!\n");
+    } else {
         CELIX_PROPERTIES_ITERATE(keys, visit) {
-			const char *valEm = celix_properties_get(embeddedProps, visit.key, NULL);
-            const char *valRt = celix_properties_get(runtimeProps, visit.key, NULL);
-            const char *envVal = getenv(visit.key);
-            const char *val = envVal != NULL ? envVal : valRt != NULL ? valRt : valEm;
-            const char *source = envVal != NULL ? "environment" : valRt != NULL ? "runtime" : "embedded";
-			printf("|- %s=%s (source %s)\n", visit.key, val, source);
-		}
-	}
+            const char* valEm = celix_properties_get(embeddedProps, visit.key, NULL);
+            const char* valRt = celix_properties_get(runtimeProps, visit.key, NULL);
+            const char* envVal = getenv(visit.key);
+            const char* val = envVal != NULL ? envVal : valRt != NULL ? valRt : valEm;
+            const char* source = envVal != NULL ? "environment" : valRt != NULL ? "runtime" : "embedded";
+            printf("|- %s=%s (source %s)\n", visit.key, val, source);
+        }
+    }
     printf("\n");
 
-	if (runtimeProps != NULL) {
-		celix_properties_destroy(runtimeProps);
-	}
-	celix_properties_destroy(keys);
+    if (runtimeProps != NULL) {
+        celix_properties_destroy(runtimeProps);
+    }
+    celix_properties_destroy(keys);
 }
 
 static int celixLauncher_createBundleCache(celix_properties_t* embeddedProperties, const char* configFile) {
-    celix_framework_t* fw = NULL;
     celix_properties_t* config = celixLauncher_createConfig(configFile, embeddedProperties);
-    celix_status_t status = framework_create(&fw, config);
-    if (status != CELIX_SUCCESS) {
+    celix_framework_t* fw = celix_frameworkFactory_createFramework(config);
+    if (!fw) {
         fprintf(stderr, "Failed to create framework for bundle cache creation\n");
         return CELIX_LAUNCHER_ERROR_EXIT_CODE;
     }
-    status = celix_framework_utils_createBundleArchivesCache(fw);
-    (void)framework_destroy(fw);
+    celix_status_t status = celix_framework_utils_createBundleArchivesCache(fw);
+    celix_frameworkFactory_destroyFramework(fw);
     if (status != CELIX_SUCCESS) {
         fprintf(stderr, "Failed to create bundle cache\n");
         return CELIX_LAUNCHER_ERROR_EXIT_CODE;
@@ -254,28 +256,24 @@ static int celixLauncher_createBundleCache(celix_properties_t* embeddedPropertie
     return CELIX_LAUNCHER_OK_EXIT_CODE;
 }
 
-static void celixLauncher_combineProperties(celix_properties_t *original, const celix_properties_t *append) {
-	if (original != NULL && append != NULL) {
-        CELIX_PROPERTIES_ITERATE(append, visit) {
-			celix_properties_setEntry(original, visit.key, &visit.entry);
-		}
-	}
+static void celixLauncher_combineProperties(celix_properties_t* original, const celix_properties_t* append) {
+    if (original != NULL && append != NULL) {
+        CELIX_PROPERTIES_ITERATE(append, visit) { celix_properties_setEntry(original, visit.key, &visit.entry); }
+    }
 }
 
 static celix_properties_t* celixLauncher_createConfig(const char* configFile, celix_properties_t* embeddedProperties) {
-    if (embeddedProperties == NULL) {
+    if (!embeddedProperties) {
         embeddedProperties = celix_properties_create();
     }
 
-    FILE *config = fopen(configFile, "r");
-    if (config != NULL) {
-        celix_properties_t *configProps = celix_properties_loadWithStream(config);
-        fclose(config);
-        if (configProps != NULL) {
-            celixLauncher_combineProperties(embeddedProperties, configProps);
-            celix_properties_destroy(configProps);
-        }
+    celix_autoptr(celix_properties_t) configProperties = NULL;
+    celix_status_t status = celix_properties_load2(configFile, 0, &configProperties);
+    if (status != CELIX_SUCCESS) {
+        fprintf(stderr, "Error loading config file %s\n", configFile);
+        celix_properties_destroy(embeddedProperties);
+        return NULL;
     }
-
+    celixLauncher_combineProperties(embeddedProperties, configProperties);
     return embeddedProperties;
 }
diff --git a/libs/utils/error_injector/celix_properties/CMakeLists.txt b/libs/utils/error_injector/celix_properties/CMakeLists.txt
index 7f65cd902..717cb50a5 100644
--- a/libs/utils/error_injector/celix_properties/CMakeLists.txt
+++ b/libs/utils/error_injector/celix_properties/CMakeLists.txt
@@ -26,5 +26,7 @@ target_link_options(properties_ei INTERFACE
         LINKER:--wrap,celix_properties_set
         LINKER:--wrap,celix_properties_setLong
         LINKER:--wrap,celix_properties_setVersion
+        LINKER:--wrap,celix_properties_save
+        LINKER:--wrap,celix_properties_load2
         )
 add_library(Celix::properties_ei ALIAS properties_ei)
diff --git a/libs/utils/error_injector/celix_properties/include/celix_properties_ei.h b/libs/utils/error_injector/celix_properties/include/celix_properties_ei.h
index ad5f7184d..c4076ec46 100644
--- a/libs/utils/error_injector/celix_properties/include/celix_properties_ei.h
+++ b/libs/utils/error_injector/celix_properties/include/celix_properties_ei.h
@@ -31,6 +31,8 @@ CELIX_EI_DECLARE(celix_properties_copy, celix_properties_t*);
 CELIX_EI_DECLARE(celix_properties_set, celix_status_t);
 CELIX_EI_DECLARE(celix_properties_setLong, celix_status_t);
 CELIX_EI_DECLARE(celix_properties_setVersion, celix_status_t);
+CELIX_EI_DECLARE(celix_properties_save, celix_status_t);
+CELIX_EI_DECLARE(celix_properties_load2, celix_status_t);
 
 #ifdef __cplusplus
 }
diff --git a/libs/utils/error_injector/celix_properties/src/celix_properties_ei.cc b/libs/utils/error_injector/celix_properties/src/celix_properties_ei.cc
index 1c9ace21c..1f2eeba60 100644
--- a/libs/utils/error_injector/celix_properties/src/celix_properties_ei.cc
+++ b/libs/utils/error_injector/celix_properties/src/celix_properties_ei.cc
@@ -55,4 +55,26 @@ celix_status_t __wrap_celix_properties_setVersion(celix_properties_t *properties
     return __real_celix_properties_setVersion(properties, key, version);
 }
 
+celix_status_t
+__real_celix_properties_save(const celix_properties_t* properties, const char* filename, int encodeFlags);
+CELIX_EI_DEFINE(celix_properties_save, celix_status_t)
+celix_status_t
+__wrap_celix_properties_save(const celix_properties_t* properties, const char* filename, int encodeFlags) {
+    CELIX_EI_IMPL(celix_properties_save);
+    return __real_celix_properties_save(properties, filename, encodeFlags);
+}
+
+celix_status_t
+__real_celix_properties_load2(const char* filename,
+                                    int decodeFlags,
+                                    celix_properties_t** out);
+CELIX_EI_DEFINE(celix_properties_load2, celix_status_t)
+celix_status_t
+__wrap_celix_properties_load2(const char* filename,
+                              int decodeFlags,
+                              celix_properties_t** out) {
+    CELIX_EI_IMPL(celix_properties_load2);
+    return __real_celix_properties_load2(filename, decodeFlags, out);
+}
+
 }
\ No newline at end of file
diff --git a/libs/utils/gtest/src/CxxPropertiesTestSuite.cc b/libs/utils/gtest/src/CxxPropertiesTestSuite.cc
index 1e65bb4f7..c95986743 100644
--- a/libs/utils/gtest/src/CxxPropertiesTestSuite.cc
+++ b/libs/utils/gtest/src/CxxPropertiesTestSuite.cc
@@ -325,25 +325,3 @@ TEST_F(CxxPropertiesTestSuite, ArrayListTest) {
     EXPECT_EQ(versions.size(), 1);
     EXPECT_EQ(versions[0], checkVersion);
 }
-
-TEST_F(CxxPropertiesTestSuite, StoreAndLoadTest) {
-    std::string path{"cxx_store_and_load_test.properties"};
-
-    celix::Properties props{};
-    props.set("key1", "1");
-    props.set("key2", "2");
-
-    EXPECT_NO_THROW(props.store(path));
-
-    celix::Properties loadedProps{};
-    EXPECT_NO_THROW(loadedProps = celix::Properties::load(path));
-    EXPECT_TRUE(loadedProps == props);
-
-    try {
-        loadedProps = celix::Properties::load("non-existence");
-        (void)loadedProps;
-        FAIL() << "Expected exception not thrown";
-    } catch (const celix::IOException& e) {
-        EXPECT_TRUE(strstr(e.what(), "Cannot load celix::Properties"));
-    }
-}
diff --git a/libs/utils/gtest/src/FileUtilsTestSuite.cc b/libs/utils/gtest/src/FileUtilsTestSuite.cc
index 6ff80d79c..775bcb108 100644
--- a/libs/utils/gtest/src/FileUtilsTestSuite.cc
+++ b/libs/utils/gtest/src/FileUtilsTestSuite.cc
@@ -178,13 +178,14 @@ TEST_F(FileUtilsTestSuite, ExtractZipFileTest) {
     EXPECT_EQ(status, CELIX_SUCCESS);
 
     EXPECT_TRUE(celix_utils_fileExists(file1));
-    auto* props = celix_properties_load(file1);
-    EXPECT_NE(props, nullptr);
+    celix_properties_t* props = nullptr;
+    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2(file1, 0, &props));
     EXPECT_EQ(celix_properties_getAsLong(props, "level", 0), 1);
     celix_properties_destroy(props);
 
     EXPECT_TRUE(celix_utils_fileExists(file2));
-    props = celix_properties_load(file2);
+    props = nullptr;
+    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2(file2, 0, &props));
     EXPECT_NE(props, nullptr);
     EXPECT_EQ(celix_properties_getAsLong(props, "level", 0), 2);
     celix_properties_destroy(props);
@@ -262,13 +263,15 @@ TEST_F(FileUtilsTestSuite, ExtractZipDataTest) {
     EXPECT_EQ(status, CELIX_SUCCESS);
 
     EXPECT_TRUE(celix_utils_fileExists(file1));
-    auto* props = celix_properties_load(file1);
+    celix_properties_t* props = nullptr;
+    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2(file1, 0, &props));
     EXPECT_NE(props, nullptr);
     EXPECT_EQ(celix_properties_getAsLong(props, "level", 0), 1);
     celix_properties_destroy(props);
 
     EXPECT_TRUE(celix_utils_fileExists(file2));
-    props = celix_properties_load(file2);
+    props = nullptr;
+    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2(file2, 0, &props));
     EXPECT_NE(props, nullptr);
     EXPECT_EQ(celix_properties_getAsLong(props, "level", 0), 2);
     celix_properties_destroy(props);
diff --git a/libs/utils/gtest/src/PropertiesErrorInjectionTestSuite.cc b/libs/utils/gtest/src/PropertiesErrorInjectionTestSuite.cc
index e7916ea38..2ff3ff66c 100644
--- a/libs/utils/gtest/src/PropertiesErrorInjectionTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesErrorInjectionTestSuite.cc
@@ -50,14 +50,8 @@ class PropertiesErrorInjectionTestSuite : public ::testing::Test {
         celix_ei_expect_celix_stringHashMap_createWithOptions(nullptr, 0, nullptr);
         celix_ei_expect_celix_arrayList_copy(nullptr, 0, nullptr);
         celix_ei_expect_celix_utils_strdup(nullptr, 0, nullptr);
-        celix_ei_expect_fopen(nullptr, 0, nullptr);
-        celix_ei_expect_fputc(nullptr, 0, 0);
-        celix_ei_expect_fseek(nullptr, 0, 0);
-        celix_ei_expect_ftell(nullptr, 0, 0);
-        celix_ei_expect_celix_utils_strdup(nullptr, 0, nullptr);
         celix_ei_expect_celix_stringHashMap_put(nullptr, 0, 0);
         celix_ei_expect_celix_version_copy(nullptr, 0, nullptr);
-        celix_ei_expect_celix_arrayList_createWithOptions(nullptr, 0, nullptr);
         celix_ei_expect_celix_arrayList_copy(nullptr, 0, nullptr);
     }
 
@@ -176,116 +170,6 @@ TEST_F(PropertiesErrorInjectionTestSuite, SetFailureTest) {
     ASSERT_THROW(cxxProps.set("key", "value"), std::bad_alloc);
 }
 
-TEST_F(PropertiesErrorInjectionTestSuite, StoreFailureTest) {
-    // C API
-    // Given a celix properties object
-    celix_autoptr(celix_properties_t) props = celix_properties_create();
-    celix_properties_set(props, "key", "value");
-
-    // When a fopen error injection is set for celix_properties_store (during fopen)
-    celix_ei_expect_fopen((void*)celix_properties_store, 0, nullptr);
-    // Then the celix_properties_store call fails
-    auto status = celix_properties_store(props, "file", nullptr);
-    ASSERT_EQ(status, CELIX_FILE_IO_EXCEPTION);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    // When a fputc error injection is set for celix_properties_store (during fputc)
-    celix_ei_expect_fputc((void*)celix_properties_store, 0, EOF);
-    // Then the celix_properties_store call fails
-    status = celix_properties_store(props, "file", nullptr);
-    ASSERT_EQ(status, CELIX_FILE_IO_EXCEPTION);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    // C++ API
-    // Given a C++ celix properties object.
-    auto cxxProps = celix::Properties{};
-    cxxProps.set("key", "value");
-
-    // When a fopen error injection is set for celix_properties_store (during fopen)
-    celix_ei_expect_fopen((void*)celix_properties_store, 0, nullptr);
-    // Then the Properties:store throws a celix::IOException exception
-    EXPECT_THROW(cxxProps.store("file"), celix::IOException);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-}
-
-TEST_F(PropertiesErrorInjectionTestSuite, LoadFailureTest) {
-    // C API
-    // Given a fmemstream buffer with a properties file
-    const char* content = "key=value\n";
-    auto* memStream = fmemopen((void*)content, strlen(content), "r");
-
-    // When a fopen error injection is set for celix_properties_load (during fopen)
-    celix_ei_expect_fopen((void*)celix_properties_load, 0, nullptr);
-    // Then the celix_properties_load call fails
-    auto props = celix_properties_load("file");
-    ASSERT_EQ(nullptr, props);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    // When a malloc error injection is set for celix_properties_loadWithStream (during properties create)
-    celix_ei_expect_malloc((void*)celix_properties_create, 0, nullptr);
-    // Then the celix_properties_loadWithStream call fails
-    props = celix_properties_loadWithStream(memStream);
-    ASSERT_EQ(nullptr, props);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    // When a fseek error injection is set for celix_properties_loadWithStream
-    celix_ei_expect_fseek((void*)celix_properties_loadWithStream, 0, -1);
-    // Then the celix_properties_loadWithStream call fails
-    props = celix_properties_loadWithStream(memStream);
-    ASSERT_EQ(nullptr, props);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    // When a fseek error injection is set for celix_properties_loadWithStream, ordinal 2
-    celix_ei_expect_fseek((void*)celix_properties_loadWithStream, 0, -1, 2);
-    // Then the celix_properties_loadWithStream call fails
-    props = celix_properties_loadWithStream(memStream);
-    ASSERT_EQ(nullptr, props);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    // When a ftell error injection is set for celix_properties_loadWithStream
-    celix_ei_expect_ftell((void*)celix_properties_loadWithStream, 0, -1);
-    // Then the celix_properties_loadWithStream call fails
-    props = celix_properties_loadWithStream(memStream);
-    ASSERT_EQ(nullptr, props);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    // When a malloc error injection is set for celix_properties_loadWithStream
-    celix_ei_expect_malloc((void*)celix_properties_loadWithStream, 0, nullptr);
-    // Then the celix_properties_loadWithStream call fails
-    props = celix_properties_loadWithStream(memStream);
-    ASSERT_EQ(nullptr, props);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    //C++ API
-    // When a fopen error injection is set for celix_properties_load (during fopen)
-    celix_ei_expect_fopen((void*)celix_properties_load, 0, nullptr);
-    // Then the celix::Properties::load call throws a celix::IOException exception
-    EXPECT_THROW(celix::Properties::load("file"), celix::IOException);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-
-    fclose(memStream);
-}
-
 TEST_F(PropertiesErrorInjectionTestSuite, GetAsVersionWithVersionCopyFailedTest) {
     //Given a properties set with a version
     celix_autoptr(celix_properties_t) props = celix_properties_create();
@@ -428,17 +312,6 @@ TEST_F(PropertiesErrorInjectionTestSuite, AssignFailureTest) {
     celix_err_resetErrors();
 }
 
-TEST_F(PropertiesErrorInjectionTestSuite, LoadFromStringFailureTest) {
-    // When a strdup error injection is set for celix_properties_loadFromString (during strdup)
-    celix_ei_expect_celix_utils_strdup((void*)celix_properties_loadFromString, 0, nullptr);
-    // Then the celix_properties_loadFromString call fails
-    auto props = celix_properties_loadFromString("key=value");
-    ASSERT_EQ(nullptr, props);
-    // And a celix err msg is set
-    ASSERT_EQ(1, celix_err_getErrorCount());
-    celix_err_resetErrors();
-}
-
 TEST_F(PropertiesErrorInjectionTestSuite, SetVersionFailureTest) {
     // Given a celix properties object
     celix_autoptr(celix_properties_t) props = celix_properties_create();
diff --git a/libs/utils/gtest/src/PropertiesTestSuite.cc b/libs/utils/gtest/src/PropertiesTestSuite.cc
index f44e0b077..391488c4c 100644
--- a/libs/utils/gtest/src/PropertiesTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesTestSuite.cc
@@ -54,69 +54,6 @@ TEST_F(PropertiesTestSuite, CreateTest) {
     celix_properties_destroy(properties);
 }
 
-TEST_F(PropertiesTestSuite, LoadTest) {
-    char propertiesFile[] = "resources-test/properties.txt";
-    auto* properties = celix_properties_load(propertiesFile);
-    EXPECT_EQ(4, celix_properties_size(properties));
-
-    const char keyA[] = "a";
-    const char *valueA = celix_properties_get(properties, keyA, nullptr);
-    EXPECT_STREQ("b", valueA);
-
-    const char keyNiceA[] = "nice_a";
-    const char *valueNiceA = celix_properties_get(properties, keyNiceA, nullptr);
-    EXPECT_STREQ("nice_b", valueNiceA);
-
-    const char keyB[] = "b";
-    const char *valueB = celix_properties_get(properties, keyB, nullptr);
-    EXPECT_STREQ("c \t d", valueB);
-
-    celix_properties_destroy(properties);
-}
-
-TEST_F(PropertiesTestSuite, LoadFromStringTest) {
-    const char* string = "key1=value1\nkey2=value2";
-    auto* props = celix_properties_loadFromString(string);
-    EXPECT_EQ(2, celix_properties_size(props));
-    EXPECT_STREQ("value1", celix_properties_get(props, "key1", ""));
-    EXPECT_STREQ("value2", celix_properties_get(props, "key2", ""));
-    celix_properties_destroy(props);
-}
-
-
-TEST_F(PropertiesTestSuite, StoreTest) {
-    const char* propertiesFile = "resources-test/properties_out.txt";
-    celix_autoptr(celix_properties_t) properties = celix_properties_create();
-    celix_properties_set(properties, "keyA", "valueA");
-    celix_properties_set(properties, "keyB", "valueB");
-    celix_properties_store(properties, propertiesFile, nullptr);
-
-    celix_autoptr(celix_properties_t) properties2 = celix_properties_load(propertiesFile);
-    EXPECT_EQ(celix_properties_size(properties), celix_properties_size(properties2));
-    EXPECT_STREQ(celix_properties_get(properties, "keyA", ""), celix_properties_get(properties2, "keyA", ""));
-    EXPECT_STREQ(celix_properties_get(properties, "keyB", ""), celix_properties_get(properties2, "keyB", ""));
-}
-
-TEST_F(PropertiesTestSuite, StoreWithHeaderTest) {
-    const char* propertiesFile = "resources-test/properties_with_header_out.txt";
-    celix_autoptr(celix_properties_t) properties = celix_properties_create();
-    celix_properties_set(properties, "keyA", "valueA");
-    celix_properties_set(properties, "keyB", "valueB");
-    celix_properties_store(properties, propertiesFile, "header");
-
-    celix_autoptr(celix_properties_t) properties2 = celix_properties_load(propertiesFile);
-    EXPECT_EQ(celix_properties_size(properties), celix_properties_size(properties2));
-    EXPECT_STREQ(celix_properties_get(properties, "keyA", ""), celix_properties_get(properties2, "keyA", ""));
-    EXPECT_STREQ(celix_properties_get(properties, "keyB", ""), celix_properties_get(properties2, "keyB", ""));
-
-    //check if provided header text is present in file
-    FILE *f = fopen(propertiesFile, "r");
-    char line[1024];
-    fgets(line, sizeof(line), f);
-    EXPECT_STREQ("#header\n", line);
-    fclose(f);
-}
-
 TEST_F(PropertiesTestSuite, GetAsLongTest) {
     celix_properties_t *props = celix_properties_create();
     celix_properties_set(props, "t1", "42");
@@ -662,11 +599,6 @@ TEST_F(PropertiesTestSuite, PropertiesAutoCleanupTest) {
     celix_autoptr(celix_properties_t) props = celix_properties_create();
 }
 
-TEST_F(PropertiesTestSuite, NullArgumentsTest) {
-    auto props = celix_properties_loadWithStream(nullptr);
-    EXPECT_EQ(nullptr, props);
-}
-
 TEST_F(PropertiesTestSuite, PropertiesEqualsTest) {
     EXPECT_TRUE(celix_properties_equals(nullptr, nullptr));
 
diff --git a/libs/utils/include/celix/Properties.h b/libs/utils/include/celix/Properties.h
index ee71925ea..2ca9672d1 100644
--- a/libs/utils/include/celix/Properties.h
+++ b/libs/utils/include/celix/Properties.h
@@ -932,21 +932,6 @@ namespace celix {
             return result;
         }
 
-        /**
-         * @brief Store the property set to the given file path.
-         *
-         * This function writes the properties in the given set to the specified file path in a format suitable
-         * for loading with the load() function.
-         * If a non-empty header string is provided, it will be written as a comment at the beginning of the file.
-         *
-         * @param[in] file The file to store the properties to.
-         * @param[in] header An optional (single line) header string to include as a comment at the beginning of the file.
-         * @throws celix::IOException If an error occurs while writing to the file.
-         */
-        void store(const std::string& path, const std::string& header = {}) const {
-            storeTo(path.data(), header.empty() ? nullptr : header.data());
-        }
-
         /**
          * @brief Enum class for encoding flags used in Celix properties JSON encoding.
          *
@@ -1044,16 +1029,6 @@ namespace celix {
             Strict = CELIX_PROPERTIES_DECODE_STRICT /**< If set, decoding will fail if there are any errors. */
         };
 
-        /**
-         * @brief Loads properties from the file at the given path.
-         * @param[in] path The path to the file containing the properties.
-         * @return A new Properties object containing the properties from the file.
-         * @throws celix::IOException If the file cannot be opened or read.
-         * @throws celix::IllegalArgumentException if the provided input cannot be decoded to a properties object.
-         * @throws std::bad_alloc If there was not enough memory to load the properties.
-         */
-        static Properties load(const std::string& path) { return loadFrom(path.data()); }
-
         /**
          * @brief Load a Properties object from a file.
          *
@@ -1153,21 +1128,6 @@ namespace celix {
             }
         }
 
-        static celix::Properties loadFrom(const char* path) {
-            auto* cProps = celix_properties_load(path);
-            if (cProps) {
-                return celix::Properties::own(cProps);
-            }
-            throw celix::IOException{"Cannot load celix::Properties from path " + std::string{path}};
-        }
-
-        void storeTo(const char* path, const char* header) const {
-            auto status = celix_properties_store(cProps.get(), path, header);
-            if (status != CELIX_SUCCESS) {
-                throw celix::IOException{"Cannot store celix::Properties to " + std::string{path}};
-            }
-        }
-
         template<typename T>
         std::vector<T> convertToVector(const celix_array_list_t* list, const std::vector<T>& defaultValue, T (*get)(const celix_array_list_t*, int index)) const {
             if (list) {
diff --git a/libs/utils/include/celix_properties.h b/libs/utils/include/celix_properties.h
index f49d4628b..bf927935e 100644
--- a/libs/utils/include/celix_properties.h
+++ b/libs/utils/include/celix_properties.h
@@ -129,57 +129,6 @@ CELIX_UTILS_EXPORT void celix_properties_destroy(celix_properties_t* properties)
 
 CELIX_DEFINE_AUTOPTR_CLEANUP_FUNC(celix_properties_t, celix_properties_destroy)
 
-/**
- * @brief Load properties from a file.
- *
- * If the return status is an error, an error message is logged to celix_err.
- *
- * @param[in] filename The name of the file to load properties from.
- * @return A property set containing the properties from the file.
- * @retval NULL If an error occurred (e.g. file not found).
- */
-CELIX_UTILS_EXPORT celix_properties_t* celix_properties_load(const char* filename);
-
-/**
- * @brief Load properties from a stream.
- *
- * If the return status is an error, an error message is logged to celix_err.
- *
- * @param[in,out] stream The stream to load properties from.
- * @return A property set containing the properties from the stream.
- * @retval NULL If an error occurred (e.g. invalid format).
- */
-CELIX_UTILS_EXPORT celix_properties_t* celix_properties_loadWithStream(FILE* stream);
-
-/**
- * @brief Load properties from a string.
- *
- * If the return status is an error, an error message is logged to celix_err.
- *
- * @param[in] input The string to load properties from.
- * @return A property set containing the properties from the string.
- * @retval NULL If an error occurred (e.g. invalid format).
- */
-CELIX_UTILS_EXPORT celix_properties_t* celix_properties_loadFromString(const char* input);
-
-/**
- * @brief Store properties to a file.
- *
- * @note Properties values are always stored as string values, regardless of their actual underlining types.
- *
- * If the return status is an error, an error message is logged to celix_err.
- *
- * @param[in] properties The property set to store.
- * @param[in] file The name of the file to store the properties to.
- * @param[in] header An optional - single line - header to write to the file before the properties.
- *                   Will be prefix with a '#' character.
- * @return CELIX_SUCCESS if the operation was successful, CELIX_FILE_IO_EXCEPTION if there was an error writing to the
- *         file.
- */
-CELIX_UTILS_EXPORT celix_status_t celix_properties_store(celix_properties_t* properties,
-                                                         const char* file,
-                                                         const char* header);
-
 /**
  * @brief Get the entry for a given key in a property set.
  *
diff --git a/libs/utils/src/properties.c b/libs/utils/src/properties.c
index 5c8b657e0..53f84fff1 100644
--- a/libs/utils/src/properties.c
+++ b/libs/utils/src/properties.c
@@ -74,27 +74,6 @@ struct celix_properties {
     int currentEntriesBufferIndex;
 };
 
-#define MALLOC_BLOCK_SIZE 5
-
-static celix_status_t celix_properties_parseLine(const char* line, celix_properties_t* props);
-
-static void
-celix_properties_updateBuffers(char** key, char** value, char** output, int outputPos, int* key_len, int* value_len) {
-    if (*output == *key) {
-        if (outputPos == (*key_len) - 1) {
-            (*key_len) += MALLOC_BLOCK_SIZE;
-            *key = realloc(*key, *key_len);
-            *output = *key;
-        }
-    } else {
-        if (outputPos == (*value_len) - 1) {
-            (*value_len) += MALLOC_BLOCK_SIZE;
-            *value = realloc(*value, *value_len);
-            *output = *value;
-        }
-    }
-}
-
 /**
  * Create a new string from the provided str by either using strdup or storing the string the short properties
  * optimization string buffer.
@@ -347,249 +326,6 @@ void celix_properties_destroy(celix_properties_t* props) {
     }
 }
 
-celix_properties_t* celix_properties_load(const char* filename) {
-    FILE* file = fopen(filename, "r");
-    if (file == NULL) {
-        celix_err_pushf("Cannot open file '%s'", filename);
-        return NULL;
-    }
-    celix_properties_t* props = celix_properties_loadWithStream(file);
-    fclose(file);
-    return props;
-}
-
-static celix_status_t celix_properties_parseLine(const char* line, celix_properties_t* props) {
-    int linePos;
-    int outputPos;
-
-    bool precedingCharIsBackslash = false;
-    char* output = NULL;
-    int key_len = MALLOC_BLOCK_SIZE;
-    int value_len = MALLOC_BLOCK_SIZE;
-    linePos = 0;
-    precedingCharIsBackslash = false;
-    output = NULL;
-    outputPos = 0;
-
-    // Ignore empty lines
-    if (line[0] == '\n' && line[1] == '\0') {
-        return CELIX_SUCCESS;
-    }
-
-    celix_autofree char* key = calloc(1, key_len);
-    celix_autofree char* value = calloc(1, value_len);
-    if (!key || !value) {
-        celix_err_pushf("Cannot allocate memory for key or value. Got error %i", errno);
-        return CELIX_ENOMEM;
-    }
-
-    key[0] = '\0';
-    value[0] = '\0';
-
-    while (line[linePos] != '\0') {
-        if (line[linePos] == ' ' || line[linePos] == '\t') {
-            if (output == NULL) {
-                // ignore
-                linePos += 1;
-                continue;
-            }
-        } else {
-            if (output == NULL) {
-                output = key;
-            }
-        }
-        if (line[linePos] == '=' || line[linePos] == ':' || line[linePos] == '#' || line[linePos] == '!') {
-            if (precedingCharIsBackslash) {
-                // escaped special character
-                output[outputPos++] = line[linePos];
-                celix_properties_updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
-                precedingCharIsBackslash = false;
-            } else {
-                if (line[linePos] == '#' || line[linePos] == '!') {
-                    if (outputPos == 0) {
-                        // comment line, ignore
-                        return CELIX_SUCCESS;
-                    } else {
-                        output[outputPos++] = line[linePos];
-                        celix_properties_updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
-                    }
-                } else {                   // = or :
-                    if (output == value) { // already have a seperator
-                        output[outputPos++] = line[linePos];
-                        celix_properties_updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
-                    } else {
-                        output[outputPos++] = '\0';
-                        celix_properties_updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
-                        output = value;
-                        outputPos = 0;
-                    }
-                }
-            }
-        } else if (line[linePos] == '\\') {
-            if (precedingCharIsBackslash) { // double backslash -> backslash
-                output[outputPos++] = '\\';
-                celix_properties_updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
-            }
-            precedingCharIsBackslash = true;
-        } else { // normal character
-            precedingCharIsBackslash = false;
-            output[outputPos++] = line[linePos];
-            celix_properties_updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
-        }
-        linePos += 1;
-    }
-    if (output != NULL) {
-        output[outputPos] = '\0';
-    }
-
-    return celix_properties_set(props, celix_utils_trimInPlace(key), celix_utils_trimInPlace(value));
-}
-
-celix_properties_t* celix_properties_loadWithStream(FILE* file) {
-    if (file == NULL) {
-        return NULL;
-    }
-
-
-    celix_autoptr(celix_properties_t) props = celix_properties_create();
-    if (!props) {
-        return NULL;
-    }
-
-    int rc = fseek(file, 0, SEEK_END);
-    if (rc != 0) {
-        celix_err_pushf("Cannot seek to end of file. Got error %i", errno);
-        return NULL;
-    }
-
-    long fileSize = ftell(file);
-    if (fileSize < 0) {
-        celix_err_pushf("Cannot get file size. Got error %i", errno);
-        return NULL;
-    }
-
-    rc = fseek(file, 0, SEEK_SET);
-    if (rc != 0) {
-        celix_err_pushf("Cannot seek to start of file. Got error %i", errno);
-        return NULL;
-    }
-
-    celix_autofree char* fileBuffer = malloc(fileSize + 1);
-    if (fileBuffer == NULL) {
-        celix_err_pushf("Cannot allocate memory for file buffer. Got error %i", errno);
-        return NULL;
-    }
-
-    size_t rs = fread(fileBuffer, sizeof(char), fileSize, file);
-    if (rs < fileSize) {
-        celix_err_pushf("fread read only %zu bytes out of %zu\n", rs, fileSize);
-        return NULL;
-    }
-    fileBuffer[fileSize] = '\0'; // ensure a '\0' at the end of the fileBuffer
-
-    char* savePtr = NULL;
-    char* line = strtok_r(fileBuffer, "\n", &savePtr);
-    while (line != NULL) {
-        celix_status_t status = celix_properties_parseLine(line, props);
-        if (status != CELIX_SUCCESS) {
-            celix_err_pushf("Failed to parse line '%s'", line);
-            return NULL;
-        }
-        line = strtok_r(NULL, "\n", &savePtr);
-    }
-
-    return celix_steal_ptr(props);
-}
-
-celix_properties_t* celix_properties_loadFromString(const char* input) {
-    celix_autoptr(celix_properties_t) props = celix_properties_create();
-    celix_autofree char* in = celix_utils_strdup(input);
-    if (!props || !in) {
-        celix_err_push("Failed to create properties or duplicate input string");
-        return NULL;
-    }
-
-    char* line = NULL;
-    char* saveLinePointer = NULL;
-    line = strtok_r(in, "\n", &saveLinePointer);
-    while (line != NULL) {
-        celix_status_t status = celix_properties_parseLine(line, props);
-        if (status != CELIX_SUCCESS) {
-            celix_err_pushf("Failed to parse line '%s'", line);
-            return NULL;
-        }
-        line = strtok_r(NULL, "\n", &saveLinePointer);
-    }
-    return celix_steal_ptr(props);
-}
-
-/**
- * @brief Store properties string to file and escape the characters '#', '!', '=' and ':' if encountered.
- */
-static int celix_properties_storeEscapedString(FILE* file, const char* str) {
-    int rc = 0;
-    size_t len = strlen(str);
-    for (size_t i = 0; i < len && rc != EOF; i += 1) {
-        if (str[i] == '#' || str[i] == '!' || str[i] == '=' || str[i] == ':') {
-            rc = fputc('\\', file);
-            if (rc == EOF) {
-                continue;
-            }
-        }
-        rc = fputc(str[i], file);
-    }
-    return rc;
-}
-
-celix_status_t celix_properties_store(celix_properties_t* properties, const char* filename, const char* header) {
-    FILE* file = fopen(filename, "w+");
-
-    if (file == NULL) {
-        celix_err_pushf("Cannot open file '%s'", filename);
-        return CELIX_FILE_IO_EXCEPTION;
-    }
-
-    int rc = 0;
-
-    if (header && strstr("\n", header)) {
-        celix_err_push("Header cannot contain newlines. Ignoring header.");
-    } else if (header) {
-        rc = fputc('#', file);
-        if (rc != EOF) {
-            rc = fputs(header, file);
-        }
-        if (rc != EOF) {
-            rc = fputc('\n', file);
-        }
-    }
-
-    CELIX_PROPERTIES_ITERATE(properties, iter) {
-        const char* val = iter.entry.value;
-        if (rc != EOF) {
-            rc = celix_properties_storeEscapedString(file, iter.key);
-        }
-        if (rc != EOF) {
-            rc = fputc('=', file);
-        }
-        if (rc != EOF) {
-            rc = celix_properties_storeEscapedString(file, val);
-        }
-        if (rc != EOF) {
-            rc = fputc('\n', file);
-        }
-    }
-    if (rc != EOF) {
-        rc = fclose(file);
-    } else {
-        fclose(file);
-    }
-    if (rc == EOF) {
-        celix_err_push("Failed to write properties to file");
-        return CELIX_FILE_IO_EXCEPTION;
-    }
-    return CELIX_SUCCESS;
-}
-
 celix_properties_t* celix_properties_copy(const celix_properties_t* properties) {
     celix_properties_t* copy = celix_properties_create();
 


(celix) 05/05: gh-685: Change space sep in auto start bundle to comma seperator

Posted by pn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-update-container-config-properties-usage
in repository https://gitbox.apache.org/repos/asf/celix.git

commit b8c6ab5ca9b16e029121c871a6f088342cb65835
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Thu May 30 19:23:52 2024 +0200

    gh-685: Change space sep in auto start bundle to comma seperator
---
 CHANGES.md                                         |   2 +
 .../gtest/client.properties.in                     |   2 +-
 .../gtest/config.properties.in                     |   2 +-
 .../gtest/server.properties.in                     |   2 +-
 .../topology_manager/tms_tst/CMakeLists.txt        |   4 +-
 cmake/cmake_celix/ContainerPackaging.cmake         |  32 +++---
 .../gtest/install_and_start_bundles.properties.in  |   6 +-
 libs/framework/include/celix/Constants.h           |   4 +-
 libs/framework/include/celix_constants.h           |  16 +--
 libs/framework/src/framework.c                     | 120 ++++++++++++---------
 10 files changed, 107 insertions(+), 83 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 593decd40..9c06b449e 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -73,6 +73,8 @@ limitations under the License.
   to add service properties with the correct type.
 - Celix C++ Exception are now defined in the `celix/exceptions.h` header file. The `celix/Exception.h`
   and `celix/IOException.h` are removed.
+- The seperator for `CELIX_AUTO_START_0` .. `CELIX_AUTO_START_6` and `CELIX_AUTO_INSTALL` is now a comma instead of a
+  space.
 
 ## New Features
 
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
index 00ef4e8cd..76433350f 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
@@ -1,5 +1,5 @@
 {
-    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@ @tst_bundle_file@",
+    "CELIX_AUTO_START_1":"@rsa_bundle_file@,@discovery_bundle_file@,@topology_manager_bundle_file@,@tst_bundle_file@",
     "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
     "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
     "CELIX_FRAMEWORK_CACHE_DIR":".cacheClient",
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
index cac7390d2..864e1cbdd 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
@@ -1,5 +1,5 @@
 {
-    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @calc_bundle_file@",
+    "CELIX_AUTO_START_1":"@rsa_bundle_file@,@calc_bundle_file@",
     "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
     "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true
 }
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
index 8d74011aa..b15507049 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
@@ -1,5 +1,5 @@
 {
-    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @calc_bundle_file@ @remote_example_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@",
+    "CELIX_AUTO_START_1":"@rsa_bundle_file@,@calc_bundle_file@,@remote_example_bundle_file@,@discovery_bundle_file@,@topology_manager_bundle_file@",
     "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
     "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
     "CELIX_FRAMEWORK_CACHE_DIR":".cacheServer",
diff --git a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
index 332677cc1..c6884b0a5 100644
--- a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
+++ b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
@@ -55,7 +55,7 @@ add_celix_bundle_dependencies(test_tm_scoped Celix::rsa_dfi Celix::rsa_topology_
 file(GENERATE 
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config.properties"
     CONTENT "{
-    \"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>\",
+    \"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE>,$<TARGET_PROPERTY:calculator,BUNDLE_FILE>,$<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE>,$<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>\",
     \"LOGHELPER_ENABLE_STDOUT_FALLBACK\":true,
     \"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE\":true
 }")
@@ -63,7 +63,7 @@ file(GENERATE
 file(GENERATE 
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config_import.properties"
     CONTENT "{
-    \"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>\",
+    \"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE>,$<TARGET_PROPERTY:calculator,BUNDLE_FILE>,$<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE>,$<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>\",
     \"LOGHELPER_ENABLE_STDOUT_FALLBACK\":true,
     \"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE\":true
 }")
diff --git a/cmake/cmake_celix/ContainerPackaging.cmake b/cmake/cmake_celix/ContainerPackaging.cmake
index 31a3e7f26..e37e8a8d9 100644
--- a/cmake/cmake_celix/ContainerPackaging.cmake
+++ b/cmake/cmake_celix/ContainerPackaging.cmake
@@ -224,14 +224,14 @@ function(add_celix_container)
 int main(int argc, char *argv[]) {
     const char * config = CELIX_MULTI_LINE_STRING(
 {
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>,$<COMMA>>\"$<COMMA>>
     $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,$<COMMA>
     >$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>>:$<COMMA>>
     \"CELIX_BUNDLES_PATH\":\"bundles\"$<COMMA>
@@ -278,14 +278,14 @@ int main(int argc, char *argv[]) {
         file(GENERATE
                 OUTPUT "${STAGE1_PROPERTIES}"
                 CONTENT "{
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>, >\"$<COMMA>>
-    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>,$<COMMA>>\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>,$<COMMA>>\"$<COMMA>>
     $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,$<COMMA>
     >$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>>:$<COMMA>>
     \"CELIX_BUNDLES_PATH\":\"bundles\"$<COMMA>
diff --git a/libs/framework/gtest/install_and_start_bundles.properties.in b/libs/framework/gtest/install_and_start_bundles.properties.in
index f7fdc6dca..b730adb94 100644
--- a/libs/framework/gtest/install_and_start_bundles.properties.in
+++ b/libs/framework/gtest/install_and_start_bundles.properties.in
@@ -1,8 +1,8 @@
 {
     "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
-    "CELIX_AUTO_START_1":"@SIMPLE_TEST_BUNDLE1@ @SIMPLE_TEST_BUNDLE2@ Invalid1.zip",
-    "CELIX_AUTO_START_3":"@SIMPLE_TEST_BUNDLE2@ @SIMPLE_TEST_BUNDLE3@ Invalid2.zip",
-    "CELIX_AUTO_INSTALL":"@SIMPLE_TEST_BUNDLE3@ @SIMPLE_TEST_BUNDLE4@ @SIMPLE_TEST_BUNDLE5@ Invalid3.zip"
+    "CELIX_AUTO_START_1":"@SIMPLE_TEST_BUNDLE1@,@SIMPLE_TEST_BUNDLE2@,Invalid1.zip",
+    "CELIX_AUTO_START_3":"@SIMPLE_TEST_BUNDLE2@,@SIMPLE_TEST_BUNDLE3@,Invalid2.zip",
+    "CELIX_AUTO_INSTALL":"@SIMPLE_TEST_BUNDLE3@,@SIMPLE_TEST_BUNDLE4@,@SIMPLE_TEST_BUNDLE5@,Invalid3.zip"
 }
 
 
diff --git a/libs/framework/include/celix/Constants.h b/libs/framework/include/celix/Constants.h
index 9d5cccbac..b00fe8059 100644
--- a/libs/framework/include/celix/Constants.h
+++ b/libs/framework/include/celix/Constants.h
@@ -139,7 +139,7 @@ namespace celix {
     constexpr const char * const FRAMEWORK_STATIC_EVENT_QUEUE_SIZE = CELIX_FRAMEWORK_STATIC_EVENT_QUEUE_SIZE;
 
     /**
-     * @brief Celix framework environment property (named "CELIX_AUTO_START_0") which specified a (ordered) space
+     * @brief Celix framework environment property (named "CELIX_AUTO_START_0") which specified a (ordered) comma
      * separated set of bundles to load and auto start when the Celix framework is started.
      *
      * The Celix framework will first start bundles in for AUTO_START_0 and lastly start bundles in AUTO_START_6.
@@ -181,7 +181,7 @@ namespace celix {
     constexpr const char * const AUTO_START_6 = CELIX_AUTO_START_6;
 
     /**
-     * @brief Celix framework environment property (named "CELIX_AUTO_INSTALL") which specified a (ordered) space
+     * @brief Celix framework environment property (named "CELIX_AUTO_INSTALL") which specified a (ordered) comma
      * separated set of bundles to install when the Celix framework is started.
      *
      * The Celix framework will first install and start bundles defined in the properties CELIX_AUTO_START_0 till
diff --git a/libs/framework/include/celix_constants.h b/libs/framework/include/celix_constants.h
index ae98e626e..ffc0abcfb 100644
--- a/libs/framework/include/celix_constants.h
+++ b/libs/framework/include/celix_constants.h
@@ -221,16 +221,16 @@ extern "C" {
 #define CELIX_FRAMEWORK_STATIC_EVENT_QUEUE_SIZE "CELIX_FRAMEWORK_STATIC_EVENT_QUEUE_SIZE"
 
 /**
- * @brief Celix framework environment property (named "CELIX_AUTO_START_0") which specified a (ordered) space
+ * @brief Celix framework environment property (named "CELIX_AUTO_START_0") which specified a (ordered) comma
  * separated set of bundles to load and auto start when the Celix framework is started.
  *
- * Note: Because the list is space separated path with spaces are not allowed.
+ * Note: Because the list is comma separated, paths with commas are not supported.
  *
- * The Celix framework will first start bundles in for CELIX_AUTO_START_0 and lastly start bundles in CELIX_AUTO_START_6.
- * Bundles which are also started in the order they appear in the AUTO_START set; first bundles mentioned is started
+ * The Celix framework will first start bundles in for CELIX_AUTO_START_0 and lastly start bundles in
+ * CELIX_AUTO_START_6. Bundles which are also started in the order they appear in the AUTO_START set; first bundles
+ * mentioned is started first. When the Celix framework stops the bundles are stopped in the reverse order. Bundles in
+ * CELIX_AUTO_START_6 are stopped first and of those bundles, the bundle mentioned last in a AUTO_START set is stopped
  * first.
- * When the Celix framework stops the bundles are stopped in the reverse order. Bundles in CELIX_AUTO_START_6 are stopped
- * first and of those bundles, the bundle mentioned last in a AUTO_START set is stopped first.
  */
 #define CELIX_AUTO_START_0 "CELIX_AUTO_START_0"
 
@@ -265,11 +265,11 @@ extern "C" {
 #define CELIX_AUTO_START_6 "CELIX_AUTO_START_6"
 
 /**
- * @brief Celix framework environment property (named "CELIX_AUTO_INSTALL") which specified a (ordered) space
+ * @brief Celix framework environment property (named "CELIX_AUTO_INSTALL") which specified a (ordered) comma
  * separated set of bundles to install when the Celix framework is started.
  *
  * The Celix framework will first install and start bundles defined in the properties CELIX_AUTO_START_0 till
- * CELIX_AUTO_START_6 and then install (ano not start!) the bundles listed in CELIX_AUTO_INSTALL.
+ * CELIX_AUTO_START_6 and then install (and not start!) the bundles listed in CELIX_AUTO_INSTALL.
  *
  * When the Celix framework stops the bundles are stopped in the reverse order. Started bundles in CELIX_AUTO_INSTALL
  * are stopped first and of those bundles, the bundle mentioned last in a CELIX_AUTO_INSTALL set is stopped first.
diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index 99d4946f1..5d2044a8b 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -159,10 +159,10 @@ static void *fw_eventDispatcher(void *fw);
 celix_status_t fw_invokeBundleListener(framework_pt framework, bundle_listener_pt listener, bundle_event_pt event, bundle_pt bundle);
 celix_status_t fw_invokeFrameworkListener(framework_pt framework, framework_listener_pt listener, framework_event_pt event, bundle_pt bundle);
 
-static celix_status_t framework_autoStartConfiguredBundles(celix_framework_t *fw);
-static celix_status_t framework_autoInstallConfiguredBundles(celix_framework_t *fw);
-static celix_status_t framework_autoInstallConfiguredBundlesForList(celix_framework_t *fw, const char *autoStart, celix_array_list_t *installedBundles);
-static celix_status_t framework_autoStartConfiguredBundlesForList(celix_framework_t* fw, const celix_array_list_t *installedBundles);
+static celix_status_t framework_autoStartConfiguredBundles(celix_framework_t *fw, bool* startedAllBundles);
+static celix_status_t framework_autoInstallConfiguredBundles(celix_framework_t *fw, bool* installedAllBundles);
+static bool framework_autoInstallConfiguredBundlesForList(celix_framework_t *fw, const char *autoStart, celix_array_list_t *installedBundles);
+static bool framework_autoStartConfiguredBundlesForList(celix_framework_t* fw, const celix_array_list_t *installedBundles);
 static void celix_framework_addToEventQueue(celix_framework_t *fw, const celix_framework_event_t* event);
 static void celix_framework_stopAndJoinEventQueue(celix_framework_t* fw);
 
@@ -458,71 +458,83 @@ celix_status_t framework_start(celix_framework_t* framework) {
     fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_STARTED, entry);
     celix_framework_bundleEntry_decreaseUseCount(entry);
 
-    celix_status_t startStatus = framework_autoStartConfiguredBundles(framework);
-    celix_status_t installStatus = framework_autoInstallConfiguredBundles(framework);
+    bool allStarted = false;
+    status = framework_autoStartConfiguredBundles(framework, &allStarted);
+    bool allInstalled = false;
+    status = CELIX_DO_IF(status, framework_autoInstallConfiguredBundles(framework, &allInstalled));
 
-    if (startStatus == CELIX_SUCCESS && installStatus == CELIX_SUCCESS) {
-        //fire started event if all bundles are started/installed and the event queue is empty
+    if (status != CELIX_SUCCESS) {
+        fw_log(framework->logger, CELIX_LOG_LEVEL_ERROR, "Celix framework failed to start");
+        return status;
+    }
+
+    if (allStarted && allInstalled) {
+        // fire started event if all bundles are started/installed and the event queue is empty
         celix_framework_waitForEmptyEventQueue(framework);
         fw_fireFrameworkEvent(framework, OSGI_FRAMEWORK_EVENT_STARTED, CELIX_SUCCESS);
     } else {
-        //note not returning an error, because the framework is started, but not all bundles are started/installed
-        fw_logCode(framework->logger, CELIX_LOG_LEVEL_ERROR, status, "Could not auto start or install all configured bundles");
+        // note not returning an error, because the framework is started, but not all bundles are started/installed
+        fw_logCode(
+            framework->logger, CELIX_LOG_LEVEL_ERROR, status, "Could not auto start or install all configured bundles");
         fw_fireFrameworkEvent(framework, OSGI_FRAMEWORK_EVENT_ERROR, CELIX_BUNDLE_EXCEPTION);
     }
 
-    if (status == CELIX_SUCCESS) {
-        fw_log(framework->logger, CELIX_LOG_LEVEL_INFO, "Celix framework started");
-        fw_log(framework->logger,
-               CELIX_LOG_LEVEL_TRACE,
-               "Celix framework started with uuid %s",
-               celix_framework_getUUID(framework));
-    } else {
-        fw_log(framework->logger, CELIX_LOG_LEVEL_ERROR, "Celix framework failed to start");
-    }
+    fw_log(framework->logger, CELIX_LOG_LEVEL_INFO, "Celix framework started");
+    fw_log(framework->logger,
+           CELIX_LOG_LEVEL_TRACE,
+           "Celix framework started with uuid %s",
+           celix_framework_getUUID(framework));
 
-    return status;
+    return CELIX_SUCCESS;
 }
 
-static celix_status_t framework_autoStartConfiguredBundles(celix_framework_t* fw) {
+static celix_status_t framework_autoStartConfiguredBundles(celix_framework_t* fw, bool *startedAllBundles) {
     celix_status_t status = CELIX_SUCCESS;
     const char* const celixKeys[] = {CELIX_AUTO_START_0, CELIX_AUTO_START_1, CELIX_AUTO_START_2, CELIX_AUTO_START_3, CELIX_AUTO_START_4, CELIX_AUTO_START_5, CELIX_AUTO_START_6, NULL};
-    celix_array_list_t *installedBundles = celix_arrayList_create();
+    celix_autoptr(celix_array_list_t) installedBundles = celix_arrayList_create();
+    if (!installedBundles) {
+        celix_framework_logTssErrors(fw->logger, CELIX_LOG_LEVEL_ERROR);
+        return ENOMEM;
+    }
+
+    bool allStarted = true;
     for (int i = 0; celixKeys[i] != NULL; ++i) {
         const char *autoStart = celix_framework_getConfigProperty(fw, celixKeys[i], NULL, NULL);
         if (autoStart != NULL) {
-            if (framework_autoInstallConfiguredBundlesForList(fw, autoStart, installedBundles) != CELIX_SUCCESS) {
-                status = CELIX_BUNDLE_EXCEPTION;
+            if (!framework_autoInstallConfiguredBundlesForList(fw, autoStart, installedBundles)) {
+                allStarted = false;
             }
         }
     }
-    celix_status_t startStatus = framework_autoStartConfiguredBundlesForList(fw, installedBundles);
-    if (status == CELIX_SUCCESS) {
-        status = startStatus;
+    if (!framework_autoStartConfiguredBundlesForList(fw, installedBundles)) {
+        allStarted = false;
     }
-    celix_arrayList_destroy(installedBundles);
+    *startedAllBundles = allStarted;
     return status;
 }
 
-static celix_status_t framework_autoInstallConfiguredBundles(celix_framework_t* fw) {
+static celix_status_t framework_autoInstallConfiguredBundles(celix_framework_t* fw, bool* installedAllBundles) {
+    *installedAllBundles = true;
     const char* autoInstall = celix_framework_getConfigProperty(fw, CELIX_AUTO_INSTALL, NULL, NULL);
     if (autoInstall != NULL) {
-        return framework_autoInstallConfiguredBundlesForList(fw, autoInstall, NULL);
+        *installedAllBundles = framework_autoInstallConfiguredBundlesForList(fw, autoInstall, NULL);
     }
     return CELIX_SUCCESS;
 }
 
-
-static celix_status_t framework_autoInstallConfiguredBundlesForList(celix_framework_t* fw, const char *autoStartIn, celix_array_list_t *installedBundles) {
-    celix_status_t status = CELIX_SUCCESS;
-    char delims[] = " ";
-    char *save_ptr = NULL;
+static bool framework_autoInstallConfiguredBundlesForList(celix_framework_t* fw,
+                                                          const char* autoStartIn,
+                                                          celix_array_list_t* installedBundles) {
+    bool allInstalled = true;
+    const char* delim = ",";
+    char* save_ptr = NULL;
     char autoStartBuffer[CELIX_DEFAULT_STRING_CREATE_BUFFER_SIZE];
     char* autoStart = celix_utils_writeOrCreateString(autoStartBuffer, sizeof(autoStartBuffer), "%s", autoStartIn);
+    celix_auto(celix_utils_string_guard_t) grd = celix_utils_stringGuard_init(autoStartBuffer, autoStart);
     if (autoStart != NULL) {
-        char *location = strtok_r(autoStart, delims, &save_ptr);
+        char* location = strtok_r(autoStart, delim, &save_ptr);
         while (location != NULL) {
-            //first install
+            // first install
             long id = -1L;
             if (celix_framework_installBundleInternal(fw, location, &id) == CELIX_SUCCESS) {
                 if (installedBundles) {
@@ -530,19 +542,21 @@ static celix_status_t framework_autoInstallConfiguredBundlesForList(celix_framew
                 }
             } else {
                 fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Could not install bundle from location '%s'.", location);
-                status = CELIX_BUNDLE_EXCEPTION;
+                allInstalled = false;
             }
-            location = strtok_r(NULL, delims, &save_ptr);
+            location = strtok_r(NULL, delim, &save_ptr);
         }
     } else {
-        fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Could not auto install bundles, out of memory.");
+        fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Could create auto install bundle list, out of memory.");
+        allInstalled = false;
+        // note out of memory, but framework can continue
     }
-    celix_utils_freeStringIfNotEqual(autoStartBuffer, autoStart);
-    return status;;
+    return allInstalled;
 }
 
-static celix_status_t framework_autoStartConfiguredBundlesForList(celix_framework_t* fw, const celix_array_list_t *installedBundles) {
-    celix_status_t status = CELIX_SUCCESS;
+static bool framework_autoStartConfiguredBundlesForList(celix_framework_t* fw,
+                                                        const celix_array_list_t* installedBundles) {
+    bool allStarted = true;
     assert(!celix_framework_isCurrentThreadTheEventLoop(fw));
     for (int i = 0; i < celix_arrayList_size(installedBundles); ++i) {
         long bndId = celix_arrayList_getLong(installedBundles, i);
@@ -550,14 +564,23 @@ static celix_status_t framework_autoStartConfiguredBundlesForList(celix_framewor
         if (celix_bundle_getState(bnd) != OSGI_FRAMEWORK_BUNDLE_ACTIVE) {
             bool started = celix_framework_startBundle(fw, bndId);
             if (!started) {
-                fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Could not start bundle %s (bnd id = %li)\n", bnd->symbolicName, bndId);
+                fw_log(fw->logger,
+                       CELIX_LOG_LEVEL_ERROR,
+                       "Could not start bundle %s (bnd id = %li)\n",
+                       bnd->symbolicName,
+                       bndId);
+                allStarted = false;
             }
         } else {
-            fw_log(fw->logger, CELIX_LOG_LEVEL_TRACE, "Cannot start bundle %s (bnd id = %li), because it is already started\n", bnd->symbolicName, bndId);
-            status = CELIX_BUNDLE_EXCEPTION;
+            fw_log(fw->logger,
+                   CELIX_LOG_LEVEL_TRACE,
+                   "Cannot start bundle %s (bnd id = %li), because it is already started\n",
+                   bnd->symbolicName,
+                   bndId);
+            allStarted = false;
         }
     }
-    return status;
+    return allStarted;
 }
 
 celix_status_t framework_stop(framework_pt framework) {
@@ -1596,7 +1619,6 @@ bool celix_framework_useBundle(framework_t *fw, bool onlyActive, long bundleId,
     if (bundleId >= 0) {
         celix_framework_bundle_entry_t *entry = celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(fw,
                                                                                                               bundleId);
-
         if (entry != NULL) {
             if (onlyActive) {
                 celixThreadRwlock_readLock(&entry->fsmMutex);


(celix) 04/05: gh-685: Rename properties load2/loadFromString2 to load/loadFromString

Posted by pn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-update-container-config-properties-usage
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 0566315d6d9aac188956f18493ed9b293f0f88a4
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Thu May 30 18:33:35 2024 +0200

    gh-685: Rename properties load2/loadFromString2 to load/loadFromString
---
 .../gtest/src/rsa_client_server_tests.cc           |  4 +--
 .../gtest/src/rsa_tests.cc                         |  2 +-
 cmake/cmake_celix/ContainerPackaging.cmake         |  2 +-
 documents/containers.md                            |  4 +--
 documents/properties_encoding.md                   |  4 +--
 .../src/CelixBundleCacheErrorInjectionTestSuite.cc |  4 +--
 .../framework/gtest/src/CelixFrameworkTestSuite.cc |  2 +-
 libs/framework/src/bundle_archive.c                |  2 +-
 libs/framework/src/celix_bundle_cache.c            |  2 +-
 libs/framework/src/celix_launcher.c                |  2 +-
 .../error_injector/celix_properties/CMakeLists.txt |  2 +-
 .../celix_properties/include/celix_properties_ei.h |  2 +-
 .../celix_properties/src/celix_properties_ei.cc    | 10 +++----
 libs/utils/gtest/src/FileUtilsTestSuite.cc         |  8 ++---
 .../PropertiesEncodingErrorInjectionTestSuite.cc   | 24 +++++++--------
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 34 +++++++++++-----------
 libs/utils/include/celix/Properties.h              |  4 +--
 libs/utils/include/celix_properties.h              |  4 +--
 libs/utils/src/properties_encoding.c               |  4 +--
 19 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc
index a5d241cf1..e8fd6719a 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc
@@ -62,7 +62,7 @@ typedef struct rsa_dfi_exception_test_service {
     static void setupFm(bool useCurlShare) {
         //server
         celix_properties_t *serverProps = nullptr;
-        ASSERT_EQ(CELIX_SUCCESS, celix_properties_load2("server.properties", 0, &serverProps));
+        ASSERT_EQ(CELIX_SUCCESS, celix_properties_load("server.properties", 0, &serverProps));
         ASSERT_TRUE(serverProps != nullptr);
         serverFramework = celix_frameworkFactory_createFramework(serverProps);
         ASSERT_TRUE(serverFramework != nullptr);
@@ -71,7 +71,7 @@ typedef struct rsa_dfi_exception_test_service {
 
         //client
         celix_properties_t *clientProperties = nullptr;
-        ASSERT_EQ(CELIX_SUCCESS, celix_properties_load2("client.properties", 0, &clientProperties));
+        ASSERT_EQ(CELIX_SUCCESS, celix_properties_load("client.properties", 0, &clientProperties));
         celix_properties_setBool(clientProperties, "RSA_DFI_USE_CURL_SHARE_HANDLE", useCurlShare);
         ASSERT_TRUE(clientProperties != nullptr);
         clientFramework = celix_frameworkFactory_createFramework(clientProperties);
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc
index 8d8fef378..ad29905d8 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc
@@ -40,7 +40,7 @@ extern "C" {
 
     static void setupFm(void) {
         celix_properties_t *fwProperties = nullptr;
-        EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2("config.properties", 0, &fwProperties));
+        EXPECT_EQ(CELIX_SUCCESS, celix_properties_load("config.properties", 0, &fwProperties));
         ASSERT_TRUE(fwProperties != nullptr);
         framework = celix_frameworkFactory_createFramework(fwProperties);
         ASSERT_TRUE(framework != nullptr);
diff --git a/cmake/cmake_celix/ContainerPackaging.cmake b/cmake/cmake_celix/ContainerPackaging.cmake
index 6523b3d44..31a3e7f26 100644
--- a/cmake/cmake_celix/ContainerPackaging.cmake
+++ b/cmake/cmake_celix/ContainerPackaging.cmake
@@ -239,7 +239,7 @@ int main(int argc, char *argv[]) {
 });
 
     celix_properties_t *embeddedProps;
-    celix_status_t status = celix_properties_loadFromString2(config, 0, &embeddedProps);
+    celix_status_t status = celix_properties_loadFromString(config, 0, &embeddedProps);
     if (status != CELIX_SUCCESS) {
         celix_err_printErrors(stderr, \"Error creating embedded properties.\", NULL);
         return -1;
diff --git a/documents/containers.md b/documents/containers.md
index 37e366b37..3bdcf1dec 100644
--- a/documents/containers.md
+++ b/documents/containers.md
@@ -55,7 +55,7 @@ int main(int argc, char *argv[]) {
 });
 
     celix_properties_t *embeddedProps;
-    celix_status_t status = celix_properties_loadFromString2(config, 0, &embeddedProps);
+    celix_status_t status = celix_properties_loadFromString(config, 0, &embeddedProps);
     if (status != CELIX_SUCCESS) {
         celix_err_printErrors(stderr, "Error creating embedded properties.", NULL);
         return -1;
@@ -106,7 +106,7 @@ int main(int argc, char *argv[]) {
 });
 
     celix_properties_t *embeddedProps;
-    celix_status_t status = celix_properties_loadFromString2(config, 0, &embeddedProps);
+    celix_status_t status = celix_properties_loadFromString(config, 0, &embeddedProps);
     if (status != CELIX_SUCCESS) {
         celix_err_printErrors(stderr, "Error creating embedded properties.", NULL);
         return -1;
diff --git a/documents/properties_encoding.md b/documents/properties_encoding.md
index c4cdb38d7..29078de25 100644
--- a/documents/properties_encoding.md
+++ b/documents/properties_encoding.md
@@ -255,7 +255,7 @@ Properties encoding flags can be used control the behavior of the encoding. The
 ## Properties Decoding
 
 JSON can be decoded to an Apache Celix properties object using
-the `celix_properties_load2`, `celix_properties_loadFromStream` and `celix_properties_loadFromString2` functions. These
+the `celix_properties_load`, `celix_properties_loadFromStream` and `celix_properties_loadFromString` functions. These
 functions take a JSON input and decode it to a properties object. Because properties use a flat key structure,
 decoding a nested JSON object to properties results in combining JSON object keys to a flat key structure. This can
 result in key collisions. 
@@ -290,7 +290,7 @@ Combined with the following code:
 
 int main() {
     celix_autoptr(celix_properties_t) props;
-    celix_status_t status = celix_properties_load2("example.json", 0, &props):
+    celix_status_t status = celix_properties_load("example.json", 0, &props):
     (void)status; //for production code check status
     CELIX_PROPERTIES_ITERATE(props, iter) { 
         printf("key=%s, value=%s\n", celix_properties_key(iter.key), celix_properties_value(iter.entry.value));        
diff --git a/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc b/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
index 84b8a0464..9745da35f 100644
--- a/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
@@ -56,7 +56,7 @@ class CelixBundleCacheErrorInjectionTestSuite : public ::testing::Test {
         celix_ei_expect_celix_stringHashMap_create(nullptr, 0, nullptr);
         celix_ei_expect_malloc(nullptr, 0, nullptr);
         celix_ei_expect_calloc(nullptr, 0, nullptr);
-        celix_ei_expect_celix_properties_load2(nullptr, 0, CELIX_SUCCESS);
+        celix_ei_expect_celix_properties_load(nullptr, 0, CELIX_SUCCESS);
         celix_frameworkLogger_destroy(fw.logger);
         celix_properties_destroy(fw.configurationMap);
     }
@@ -196,7 +196,7 @@ TEST_F(CelixBundleCacheErrorInjectionTestSuite, LoadBundleStatePropertiesErrorTe
     celix_bundleContext_uninstallBundle(ctx->getCBundleContext(), bndId);
 
     // And a celix_properties_load error is injected
-    celix_ei_expect_celix_properties_load2(
+    celix_ei_expect_celix_properties_load(
         (void*)celix_bundleCache_findBundleIdForLocation, 1, CELIX_FILE_IO_EXCEPTION);
 
     // Then installing the bundle will fail
diff --git a/libs/framework/gtest/src/CelixFrameworkTestSuite.cc b/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
index 5af8f391f..57c82c529 100644
--- a/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
+++ b/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
@@ -325,7 +325,7 @@ TEST_F(FrameworkFactoryTestSuite, LaunchFrameworkWithConfigTest) {
      */
 
     celix_properties_t* config = nullptr;
-    ASSERT_EQ(CELIX_SUCCESS, celix_properties_load2(INSTALL_AND_START_BUNDLES_CONFIG_PROPERTIES_FILE, 0, &config));
+    ASSERT_EQ(CELIX_SUCCESS, celix_properties_load(INSTALL_AND_START_BUNDLES_CONFIG_PROPERTIES_FILE, 0, &config));
     ASSERT_TRUE(config != nullptr);
 
     framework_t* fw = celix_frameworkFactory_createFramework(config);
diff --git a/libs/framework/src/bundle_archive.c b/libs/framework/src/bundle_archive.c
index 4607a7b62..bba4befde 100644
--- a/libs/framework/src/bundle_archive.c
+++ b/libs/framework/src/bundle_archive.c
@@ -62,7 +62,7 @@ struct bundleArchive {
 static celix_status_t celix_bundleArchive_storeBundleStateProperties(bundle_archive_pt archive) {
     bool needUpdate = false;
     celix_properties_t* bundleStateProperties;
-    celix_status_t status = celix_properties_load2(archive->savedBundleStatePropertiesPath, 0, &bundleStateProperties);
+    celix_status_t status = celix_properties_load(archive->savedBundleStatePropertiesPath, 0, &bundleStateProperties);
     if (status != CELIX_SUCCESS) {
         celix_framework_logTssErrors(archive->fw->logger, CELIX_LOG_LEVEL_ERROR);
         bundleStateProperties = celix_properties_create();
diff --git a/libs/framework/src/celix_bundle_cache.c b/libs/framework/src/celix_bundle_cache.c
index 54d6fc2fb..d99f64fc5 100644
--- a/libs/framework/src/celix_bundle_cache.c
+++ b/libs/framework/src/celix_bundle_cache.c
@@ -237,7 +237,7 @@ static celix_status_t celix_bundleCache_updateIdForLocationLookupMap(celix_bundl
         celix_auto(celix_utils_string_guard_t) strGuard = celix_utils_stringGuard_init(archiveRootBuffer, bundleStateProperties);
         if (celix_utils_fileExists(bundleStateProperties)) {
             celix_autoptr(celix_properties_t) props = NULL;
-            celix_status_t status = celix_properties_load2(bundleStateProperties, 0, &props);
+            celix_status_t status = celix_properties_load(bundleStateProperties, 0, &props);
             if (status != CELIX_SUCCESS) {
                     fw_logCode(cache->fw->logger, CELIX_LOG_LEVEL_ERROR, status,
                                "Cannot load bundle state properties from %s", bundleStateProperties);
diff --git a/libs/framework/src/celix_launcher.c b/libs/framework/src/celix_launcher.c
index 2d2791292..96a9279ee 100644
--- a/libs/framework/src/celix_launcher.c
+++ b/libs/framework/src/celix_launcher.c
@@ -282,7 +282,7 @@ static celix_status_t celixLauncher_loadConfigProperties(const char* configFile,
         configFile = DEFAULT_CONFIG_FILE;
     }
     if (loadConfig) {
-        celix_status_t status = celix_properties_load2(configFile, 0, &configProperties);
+        celix_status_t status = celix_properties_load(configFile, 0, &configProperties);
         if (status != CELIX_SUCCESS) {
             celix_err_printErrors(stderr, "Error loading config file: ", NULL);
             *outConfigProperties = NULL;
diff --git a/libs/utils/error_injector/celix_properties/CMakeLists.txt b/libs/utils/error_injector/celix_properties/CMakeLists.txt
index 717cb50a5..445c544ea 100644
--- a/libs/utils/error_injector/celix_properties/CMakeLists.txt
+++ b/libs/utils/error_injector/celix_properties/CMakeLists.txt
@@ -27,6 +27,6 @@ target_link_options(properties_ei INTERFACE
         LINKER:--wrap,celix_properties_setLong
         LINKER:--wrap,celix_properties_setVersion
         LINKER:--wrap,celix_properties_save
-        LINKER:--wrap,celix_properties_load2
+        LINKER:--wrap,celix_properties_load
         )
 add_library(Celix::properties_ei ALIAS properties_ei)
diff --git a/libs/utils/error_injector/celix_properties/include/celix_properties_ei.h b/libs/utils/error_injector/celix_properties/include/celix_properties_ei.h
index c4076ec46..4c7d54ee5 100644
--- a/libs/utils/error_injector/celix_properties/include/celix_properties_ei.h
+++ b/libs/utils/error_injector/celix_properties/include/celix_properties_ei.h
@@ -32,7 +32,7 @@ CELIX_EI_DECLARE(celix_properties_set, celix_status_t);
 CELIX_EI_DECLARE(celix_properties_setLong, celix_status_t);
 CELIX_EI_DECLARE(celix_properties_setVersion, celix_status_t);
 CELIX_EI_DECLARE(celix_properties_save, celix_status_t);
-CELIX_EI_DECLARE(celix_properties_load2, celix_status_t);
+CELIX_EI_DECLARE(celix_properties_load, celix_status_t);
 
 #ifdef __cplusplus
 }
diff --git a/libs/utils/error_injector/celix_properties/src/celix_properties_ei.cc b/libs/utils/error_injector/celix_properties/src/celix_properties_ei.cc
index 1f2eeba60..c6616ee00 100644
--- a/libs/utils/error_injector/celix_properties/src/celix_properties_ei.cc
+++ b/libs/utils/error_injector/celix_properties/src/celix_properties_ei.cc
@@ -65,16 +65,16 @@ __wrap_celix_properties_save(const celix_properties_t* properties, const char* f
 }
 
 celix_status_t
-__real_celix_properties_load2(const char* filename,
+__real_celix_properties_load(const char* filename,
                                     int decodeFlags,
                                     celix_properties_t** out);
-CELIX_EI_DEFINE(celix_properties_load2, celix_status_t)
+CELIX_EI_DEFINE(celix_properties_load, celix_status_t)
 celix_status_t
-__wrap_celix_properties_load2(const char* filename,
+__wrap_celix_properties_load(const char* filename,
                               int decodeFlags,
                               celix_properties_t** out) {
-    CELIX_EI_IMPL(celix_properties_load2);
-    return __real_celix_properties_load2(filename, decodeFlags, out);
+    CELIX_EI_IMPL(celix_properties_load);
+    return __real_celix_properties_load(filename, decodeFlags, out);
 }
 
 }
\ No newline at end of file
diff --git a/libs/utils/gtest/src/FileUtilsTestSuite.cc b/libs/utils/gtest/src/FileUtilsTestSuite.cc
index 775bcb108..e61afc8ff 100644
--- a/libs/utils/gtest/src/FileUtilsTestSuite.cc
+++ b/libs/utils/gtest/src/FileUtilsTestSuite.cc
@@ -179,13 +179,13 @@ TEST_F(FileUtilsTestSuite, ExtractZipFileTest) {
 
     EXPECT_TRUE(celix_utils_fileExists(file1));
     celix_properties_t* props = nullptr;
-    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2(file1, 0, &props));
+    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load(file1, 0, &props));
     EXPECT_EQ(celix_properties_getAsLong(props, "level", 0), 1);
     celix_properties_destroy(props);
 
     EXPECT_TRUE(celix_utils_fileExists(file2));
     props = nullptr;
-    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2(file2, 0, &props));
+    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load(file2, 0, &props));
     EXPECT_NE(props, nullptr);
     EXPECT_EQ(celix_properties_getAsLong(props, "level", 0), 2);
     celix_properties_destroy(props);
@@ -264,14 +264,14 @@ TEST_F(FileUtilsTestSuite, ExtractZipDataTest) {
 
     EXPECT_TRUE(celix_utils_fileExists(file1));
     celix_properties_t* props = nullptr;
-    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2(file1, 0, &props));
+    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load(file1, 0, &props));
     EXPECT_NE(props, nullptr);
     EXPECT_EQ(celix_properties_getAsLong(props, "level", 0), 1);
     celix_properties_destroy(props);
 
     EXPECT_TRUE(celix_utils_fileExists(file2));
     props = nullptr;
-    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load2(file2, 0, &props));
+    EXPECT_EQ(CELIX_SUCCESS, celix_properties_load(file2, 0, &props));
     EXPECT_NE(props, nullptr);
     EXPECT_EQ(celix_properties_getAsLong(props, "level", 0), 2);
     celix_properties_destroy(props);
diff --git a/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc b/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
index 9a5c15f7e..1ec9e7dd3 100644
--- a/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
@@ -254,11 +254,11 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, LoadErrorTest) {
     const char* json = R"({"key":"value"})";
 
     //When an error injected is prepared for fmemopen() from loadFromString2
-    celix_ei_expect_fmemopen((void*)celix_properties_loadFromString2, 0, nullptr);
+    celix_ei_expect_fmemopen((void*)celix_properties_loadFromString, 0, nullptr);
 
     //When I call celix_properties_loadFromString
     celix_properties_t* props;
-    auto status = celix_properties_loadFromString2(json, 0, &props);
+    auto status = celix_properties_loadFromString(json, 0, &props);
 
     //Then I expect an error
     EXPECT_EQ(ENOMEM, status);
@@ -273,20 +273,20 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, DecodeErrorTest) {
     const char* json = R"({"key":"value", "object": {"key":"value"}})";
 
     //When an error injected is prepared for celix_properties_create()->malloc() from celix_properties_loadFromString2
-    celix_ei_expect_malloc((void*)celix_properties_loadFromString2, 3, nullptr);
+    celix_ei_expect_malloc((void*)celix_properties_loadFromString, 3, nullptr);
 
     //When I call celix_properties_loadFromString
     celix_properties_t* props;
-    auto status = celix_properties_loadFromString2(json, 0, &props);
+    auto status = celix_properties_loadFromString(json, 0, &props);
 
     //Then I expect an error
     EXPECT_EQ(ENOMEM, status);
 
     //When an error injected is prepared for celix_utils_writeOrCreateString() from celix_properties_loadFromString2
-    celix_ei_expect_celix_utils_writeOrCreateString((void*)celix_properties_loadFromString2, 3, nullptr);
+    celix_ei_expect_celix_utils_writeOrCreateString((void*)celix_properties_loadFromString, 3, nullptr);
 
     //When I call celix_properties_loadFromString
-    status = celix_properties_loadFromString2(json, 0, &props);
+    status = celix_properties_loadFromString(json, 0, &props);
 
     //Then I expect an error
     EXPECT_EQ(ENOMEM, status);
@@ -301,20 +301,20 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, DecodeArrayErrorTest) {
     const char* json = R"({"key":["value1", "value2"]})";
 
     // When an error injected is prepared for celix_arrayList_createWithOptions() from celix_properties_loadFromString2
-    celix_ei_expect_celix_arrayList_createWithOptions((void*)celix_properties_loadFromString2, 4, nullptr);
+    celix_ei_expect_celix_arrayList_createWithOptions((void*)celix_properties_loadFromString, 4, nullptr);
 
     //When I call celix_properties_loadFromString
     celix_properties_t* props;
-    auto status = celix_properties_loadFromString2(json, 0, &props);
+    auto status = celix_properties_loadFromString(json, 0, &props);
 
     //Then I expect an error
     EXPECT_EQ(ENOMEM, status);
 
     // When an error injected is prepared for celix_arrayList_addString() from celix_properties_loadFromString2
-    celix_ei_expect_celix_arrayList_addString((void*)celix_properties_loadFromString2, 4, ENOMEM);
+    celix_ei_expect_celix_arrayList_addString((void*)celix_properties_loadFromString, 4, ENOMEM);
 
     //When I call celix_properties_loadFromString
-    status = celix_properties_loadFromString2(json, 0, &props);
+    status = celix_properties_loadFromString(json, 0, &props);
 
     //Then I expect an error
     EXPECT_EQ(ENOMEM, status);
@@ -330,11 +330,11 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, DecodeVersionErrorTest) {
     const char* json = R"({"key":"version<1.2.3.qualifier>"})";
 
     // When an error injected is prepared for celix_utils_writeOrCreateString() from celix_properties_loadFromString2
-    celix_ei_expect_celix_utils_writeOrCreateString((void*)celix_properties_loadFromString2, 4, nullptr);
+    celix_ei_expect_celix_utils_writeOrCreateString((void*)celix_properties_loadFromString, 4, nullptr);
 
     // And I call celix_properties_loadFromString
     celix_properties_t* props;
-    auto status = celix_properties_loadFromString2(json, 0, &props);
+    auto status = celix_properties_loadFromString(json, 0, &props);
 
     // Then I expect an error
     EXPECT_EQ(ENOMEM, status);
diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index fedec728a..a1eceb4aa 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -241,7 +241,7 @@ TEST_F(PropertiesSerializationTestSuite, SaveEmptyKeyTest) {
     ASSERT_EQ(CELIX_SUCCESS, status);
 
     celix_autoptr(celix_properties_t) prop2 = nullptr;
-    status = celix_properties_loadFromString2(output1, 0, &prop2);
+    status = celix_properties_loadFromString(output1, 0, &prop2);
     ASSERT_EQ(CELIX_SUCCESS, status);
 
     ASSERT_TRUE(celix_properties_equals(props, prop2));
@@ -524,7 +524,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadEmptyPropertiesTest) {
 
     //When loading the properties from the stream
     celix_autoptr(celix_properties_t) props = nullptr;
-    auto status = celix_properties_loadFromString2(json, 0, &props);
+    auto status = celix_properties_loadFromString(json, 0, &props);
     ASSERT_EQ(CELIX_SUCCESS, status);
 
     //Then the properties object is empty
@@ -681,7 +681,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithEmptyArrayTest) {
 
     //When loading the properties from string
     celix_autoptr(celix_properties_t) props = nullptr;
-    auto status = celix_properties_loadFromString2(inputJSON, 0, &props);
+    auto status = celix_properties_loadFromString(inputJSON, 0, &props);
 
     //Then loading succeeds
     ASSERT_EQ(CELIX_SUCCESS, status);
@@ -691,7 +691,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithEmptyArrayTest) {
 
     //When loading the properties from string with a strict flag
     celix_properties_t* props2;
-    status = celix_properties_loadFromString2(inputJSON, CELIX_PROPERTIES_DECODE_ERROR_ON_EMPTY_ARRAYS, &props2);
+    status = celix_properties_loadFromString(inputJSON, CELIX_PROPERTIES_DECODE_ERROR_ON_EMPTY_ARRAYS, &props2);
 
     //Then loading fails, because the empty array generates an error
     ASSERT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -746,7 +746,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithDuplicatesTest) {
 
     // When loading the properties from a string.
     celix_autoptr(celix_properties_t) props = nullptr;
-    auto status = celix_properties_loadFromString2(jsonInput, 0, &props);
+    auto status = celix_properties_loadFromString(jsonInput, 0, &props);
 
     // Then loading succeeds
     ASSERT_EQ(CELIX_SUCCESS, status);
@@ -757,7 +757,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithDuplicatesTest) {
 
     // When decoding the properties from the stream using a flog that does not allow duplicates
     celix_properties_t* props2;
-    status = celix_properties_loadFromString2(jsonInput, CELIX_PROPERTIES_DECODE_ERROR_ON_DUPLICATES, &props2);
+    status = celix_properties_loadFromString(jsonInput, CELIX_PROPERTIES_DECODE_ERROR_ON_DUPLICATES, &props2);
 
     // Then loading fails, because of a duplicate key
     EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -793,7 +793,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesEscapedDotsTest) {
 
     // When loading the properties from a string.
     celix_autoptr(celix_properties_t) props;
-    auto status = celix_properties_loadFromString2(jsonInput, 0, &props);
+    auto status = celix_properties_loadFromString(jsonInput, 0, &props);
 
     // Then loading succeeds
     ASSERT_EQ(CELIX_SUCCESS, status);
@@ -809,7 +809,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesEscapedDotsTest) {
 
     // When decoding the properties from a string using a flag that allows duplicates
     celix_properties_t* props2;
-    status = celix_properties_loadFromString2(jsonInput, CELIX_PROPERTIES_DECODE_ERROR_ON_DUPLICATES, &props2);
+    status = celix_properties_loadFromString(jsonInput, CELIX_PROPERTIES_DECODE_ERROR_ON_DUPLICATES, &props2);
 
     // Then loading fails, because of a duplicate key
     EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -820,7 +820,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesEscapedDotsTest) {
 
     // When decoding the properties from a string using a flag that allows collisions
     celix_properties_t* props3;
-    status = celix_properties_loadFromString2(jsonInput, CELIX_PROPERTIES_DECODE_ERROR_ON_COLLISIONS, &props3);
+    status = celix_properties_loadFromString(jsonInput, CELIX_PROPERTIES_DECODE_ERROR_ON_COLLISIONS, &props3);
 
     // Then loading fails, because of a collision
     EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -889,7 +889,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithUnsupportedArrayTypes
     for (auto& invalidArray : invalidArrays) {
         // When loading the properties from the string
         celix_autoptr(celix_properties_t) props = nullptr;
-        auto status = celix_properties_loadFromString2(invalidArray, 0, &props);
+        auto status = celix_properties_loadFromString(invalidArray, 0, &props);
 
         // Then decoding succeeds, because strict is disabled
         ASSERT_EQ(CELIX_SUCCESS, status);
@@ -903,7 +903,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithUnsupportedArrayTypes
     for (auto& invalidArray : invalidArrays) {
         // When loading the properties from the string
         celix_autoptr(celix_properties_t) props = nullptr;
-        auto status = celix_properties_loadFromString2(invalidArray, CELIX_PROPERTIES_DECODE_STRICT, &props);
+        auto status = celix_properties_loadFromString(invalidArray, CELIX_PROPERTIES_DECODE_STRICT, &props);
 
         // Then decoding fails
         EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -914,8 +914,8 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithUnsupportedArrayTypes
 
         // When loading the properties from the CELIX_PROPERTIES_DECODE_ERROR_ON_UNSUPPORTED_ARRAYS flag
         celix_properties_t* props2;
-        status = celix_properties_loadFromString2(
-            invalidArray, CELIX_PROPERTIES_DECODE_ERROR_ON_UNSUPPORTED_ARRAYS, &props2);
+        status =
+            celix_properties_loadFromString(invalidArray, CELIX_PROPERTIES_DECODE_ERROR_ON_UNSUPPORTED_ARRAYS, &props2);
 
         // Then decoding fails
         EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -965,7 +965,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithInvalidVersionsTest)
 
     // When loading the properties from the stream
     celix_autoptr(celix_properties_t) props = nullptr;
-    auto status = celix_properties_loadFromString2(jsonInput, 0, &props);
+    auto status = celix_properties_loadFromString(jsonInput, 0, &props);
 
     // Then loading fails
     ASSERT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -979,7 +979,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadPropertiesWithInvalidVersionsTest)
         R"( {"key1":"version<1.2.3", "key2":"version1.2.3>", "key3":"ver<1.2.3>}", "key4":"celix_version<1.2.3>"} )";
 
     // When loading the properties from the stream
-    status = celix_properties_loadFromString2(jsonInput, 0, &props);
+    status = celix_properties_loadFromString(jsonInput, 0, &props);
 
     // Then loading succeeds
     ASSERT_EQ(CELIX_SUCCESS, status);
@@ -995,7 +995,7 @@ TEST_F(PropertiesSerializationTestSuite, LoadWithInvalidStreamTest) {
     celix_properties_t* dummyProps = nullptr;
 
     // Loading properties with invalid stream will fail
-    auto status = celix_properties_load2("non_existing_file.json", 0, &dummyProps);
+    auto status = celix_properties_load("non_existing_file.json", 0, &dummyProps);
     EXPECT_EQ(CELIX_FILE_IO_EXCEPTION, status);
     EXPECT_EQ(1, celix_err_getErrorCount());
 
@@ -1084,7 +1084,7 @@ TEST_F(PropertiesSerializationTestSuite, SaveAndLoadFlatProperties) {
 
     // When loading the properties from the properties_test.json file
     celix_autoptr(celix_properties_t) loadedProps = nullptr;
-    status = celix_properties_load2(filename, 0, &loadedProps);
+    status = celix_properties_load(filename, 0, &loadedProps);
 
     // Then loading succeeds
     ASSERT_EQ(CELIX_SUCCESS, status);
diff --git a/libs/utils/include/celix/Properties.h b/libs/utils/include/celix/Properties.h
index 2ca9672d1..9389d0950 100644
--- a/libs/utils/include/celix/Properties.h
+++ b/libs/utils/include/celix/Properties.h
@@ -1049,7 +1049,7 @@ namespace celix {
          */
         static Properties load2(const std::string& filename, DecodeFlags decodeFlags = DecodeFlags::None) {
             celix_properties_t* props;
-            auto status = celix_properties_load2(filename.c_str(), static_cast<int>(decodeFlags), &props);
+            auto status = celix_properties_load(filename.c_str(), static_cast<int>(decodeFlags), &props);
             if (status == ENOMEM) {
                 throw std::bad_alloc();
             } else if (status != CELIX_SUCCESS) {
@@ -1075,7 +1075,7 @@ namespace celix {
          */
         static Properties loadFromString(const std::string& input, DecodeFlags decodeFlags = DecodeFlags::None) {
             celix_properties_t* props;
-            auto status = celix_properties_loadFromString2(input.c_str(), static_cast<int>(decodeFlags), &props);
+            auto status = celix_properties_loadFromString(input.c_str(), static_cast<int>(decodeFlags), &props);
             if (status == ENOMEM) {
                 throw std::bad_alloc();
             } else if (status != CELIX_SUCCESS) {
diff --git a/libs/utils/include/celix_properties.h b/libs/utils/include/celix_properties.h
index bf927935e..b145fc72d 100644
--- a/libs/utils/include/celix_properties.h
+++ b/libs/utils/include/celix_properties.h
@@ -1208,7 +1208,7 @@ CELIX_UTILS_EXPORT celix_status_t celix_properties_loadFromStream(FILE* stream,
  * decoded to a properties object and ENOMEM if there was not enough memory. CELIX_FILE_IO_EXCEPTION if the file
  * could not be opened.
  */
-CELIX_UTILS_EXPORT celix_status_t celix_properties_load2(const char* filename,
+CELIX_UTILS_EXPORT celix_status_t celix_properties_load(const char* filename,
                                                          int decodeFlags,
                                                          celix_properties_t** out);
 
@@ -1232,7 +1232,7 @@ CELIX_UTILS_EXPORT celix_status_t celix_properties_load2(const char* filename,
  * @return CELIX_SUCCESS if the operation was successful, CELIX_ILLEGAL_ARGUMENT if the provided input cannot be
  * decoded to a properties object and ENOMEM if there was not enough memory.
  */
-CELIX_UTILS_EXPORT celix_status_t celix_properties_loadFromString2(const char* input,
+CELIX_UTILS_EXPORT celix_status_t celix_properties_loadFromString(const char* input,
                                                                    int decodeFlags,
                                                                    celix_properties_t** out);
 
diff --git a/libs/utils/src/properties_encoding.c b/libs/utils/src/properties_encoding.c
index 53af5ec4b..93897b7a2 100644
--- a/libs/utils/src/properties_encoding.c
+++ b/libs/utils/src/properties_encoding.c
@@ -593,7 +593,7 @@ celix_status_t celix_properties_loadFromStream(FILE* stream, int decodeFlags, ce
     return celix_properties_decodeFromJson(root, decodeFlags, out);
 }
 
-celix_status_t celix_properties_load2(const char* filename, int decodeFlags, celix_properties_t** out) {
+celix_status_t celix_properties_load(const char* filename, int decodeFlags, celix_properties_t** out) {
     FILE* stream = fopen(filename, "r");
     if (!stream) {
         celix_err_pushf("Failed to open file %s.", filename);
@@ -604,7 +604,7 @@ celix_status_t celix_properties_load2(const char* filename, int decodeFlags, cel
     return status;
 }
 
-celix_status_t celix_properties_loadFromString2(const char* input, int decodeFlags, celix_properties_t** out) {
+celix_status_t celix_properties_loadFromString(const char* input, int decodeFlags, celix_properties_t** out) {
     FILE* stream = fmemopen((void*)input, strlen(input), "r");
     if (!stream) {
         celix_err_push("Failed to open memstream.");


(celix) 03/05: gh-685: Improve error handling for properties save/load

Posted by pn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-update-container-config-properties-usage
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 0a0709a2d65d98e34ce6a8730bbc1333d21f3759
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Thu May 30 18:30:12 2024 +0200

    gh-685: Improve error handling for properties save/load
---
 documents/containers.md                            |  44 +++--
 .../BundleArchiveWithErrorInjectionTestSuite.cc    |  13 +-
 .../src/CelixBundleCacheErrorInjectionTestSuite.cc |  17 +-
 .../gtest/src/CelixBundleCacheTestSuite.cc         |  23 ++-
 libs/framework/src/bundle_archive.c                |   2 -
 libs/framework/src/celix_bundle_cache.c            |  36 ++--
 libs/framework/src/celix_bundle_cache.h            |  10 +-
 libs/framework/src/celix_log.c                     |   4 +-
 libs/framework/src/framework.c                     | 199 +++++++++++----------
 .../gtest/src/CelixUtilsAutoCleanupTestSuite.cc    |   4 +
 libs/utils/include/celix_stdio_cleanup.h           |   3 +
 libs/utils/include/celix_threads.h                 |   1 +
 12 files changed, 201 insertions(+), 155 deletions(-)

diff --git a/documents/containers.md b/documents/containers.md
index 77e673e89..37e366b37 100644
--- a/documents/containers.md
+++ b/documents/containers.md
@@ -45,12 +45,21 @@ will create the following main source file (note: reformatted for display purpos
 ```C++
 //${CMAKE_BINARY_DIR}/celix/gen/containers/my_empty_container/main.cc
 #include <celix_launcher.h>
+#include <celix_err.h>
+#define CELIX_MULTI_LINE_STRING(...) #__VA_ARGS__
 int main(int argc, char *argv[]) {
-    const char * config = "\
-CELIX_CONTAINER_NAME=my_empty_container\n\
-CELIX_BUNDLES_PATH=bundles\n\
-";
-    celix_properties_t *embeddedProps = celix_properties_loadFromString(config);
+    const char * config = CELIX_MULTI_LINE_STRING(
+{
+    "CELIX_BUNDLES_PATH":"bundles",
+    "CELIX_CONTAINER_NAME":"my_empty_container"
+});
+
+    celix_properties_t *embeddedProps;
+    celix_status_t status = celix_properties_loadFromString2(config, 0, &embeddedProps);
+    if (status != CELIX_SUCCESS) {
+        celix_err_printErrors(stderr, "Error creating embedded properties.", NULL);
+        return -1;
+    }
     return celixLauncher_launchAndWaitForShutdown(argc, argv, embeddedProps);
 }
 ```
@@ -84,15 +93,24 @@ add_celix_container(my_web_shell_container
 will create the following main source file (note: reformatted for display purpose):
 ```C++
 #include <celix_launcher.h>
+#include <celix_err.h>
+#define CELIX_MULTI_LINE_STRING(...) #__VA_ARGS__
 int main(int argc, char *argv[]) {
-    const char * config = "\
-CELIX_CONTAINER_NAME=my_web_shell_container\n\
-CELIX_BUNDLES_PATH=bundles\n\
-CELIX_AUTO_START_3=celix_http_admin-Debug.zip celix_shell-Debug.zip celix_shell_wui-Debug.zip\n\
-CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=debug\n\
-CELIX_HTTP_ADMIN_LISTENING_PORTS=8888";
-
-    celix_properties_t *embeddedProps = celix_properties_loadFromString(config);
+    const char * config = CELIX_MULTI_LINE_STRING(
+{
+    "CELIX_AUTO_START_3":"celix_http_admin-Debug.zip celix_shell-Debug.zip celix_shell_wui-Debug.zip",
+    "CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL":"debug",
+    "CELIX_HTTP_ADMIN_LISTENING_PORTS":"8888",
+    "CELIX_BUNDLES_PATH":"bundles",
+    "CELIX_CONTAINER_NAME":"my_web_shell_container"
+});
+
+    celix_properties_t *embeddedProps;
+    celix_status_t status = celix_properties_loadFromString2(config, 0, &embeddedProps);
+    if (status != CELIX_SUCCESS) {
+        celix_err_printErrors(stderr, "Error creating embedded properties.", NULL);
+        return -1;
+    }
     return celixLauncher_launchAndWaitForShutdown(argc, argv, embeddedProps);
 }
 ```
diff --git a/libs/framework/gtest/src/BundleArchiveWithErrorInjectionTestSuite.cc b/libs/framework/gtest/src/BundleArchiveWithErrorInjectionTestSuite.cc
index b7d1e5568..2aeb425c3 100644
--- a/libs/framework/gtest/src/BundleArchiveWithErrorInjectionTestSuite.cc
+++ b/libs/framework/gtest/src/BundleArchiveWithErrorInjectionTestSuite.cc
@@ -268,18 +268,9 @@ TEST_F(CelixBundleArchiveErrorInjectionTestSuite, StoreBundleStatePropertiesErro
     auto ctx = fw->getFrameworkBundleContext();
 
     // When an error is prepped for celix_properties_save
-    celix_ei_expect_celix_properties_save((void*)celix_bundleCache_findBundleIdForLocation, 1, CELIX_FILE_IO_EXCEPTION);
+    celix_ei_expect_celix_properties_save((void*)celix_bundleArchive_create, 1, CELIX_FILE_IO_EXCEPTION);
 
     // When the bundle install, a bundle id is returned (async bundle install)
     long bndId = ctx->installBundle(SIMPLE_TEST_BUNDLE1_LOCATION);
-    EXPECT_GE(bndId, 0);
-
-    // Then the bundle is not successfully installed
-
-    celix_bundleContext_useBundle(
-        ctx->getCBundleContext(), bndId, nullptr, [](void* /*handle*/, const celix_bundle_t* bnd) {
-            auto status = celix_bundle_getState(bnd);
-            // TODO fixme, bundle is installed and active, this is not correct
-            EXPECT_EQ(CELIX_BUNDLE_EVENT_INSTALLED, status);
-        });
+    EXPECT_LT(bndId, 0);
 }
diff --git a/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc b/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
index 732119441..84b8a0464 100644
--- a/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleCacheErrorInjectionTestSuite.cc
@@ -110,13 +110,18 @@ TEST_F(CelixBundleCacheErrorInjectionTestSuite, ArchiveCreateErrorTest) {
     celix_ei_expect_celix_utils_writeOrCreateString((void*)celix_bundleCache_createArchive, 0, nullptr);
     EXPECT_EQ(CELIX_ENOMEM, celix_bundleCache_createArchive(cache, 1, SIMPLE_TEST_BUNDLE1_LOCATION, &archive));
     EXPECT_EQ(nullptr, archive);
-    EXPECT_EQ(-1, celix_bundleCache_findBundleIdForLocation(cache, SIMPLE_TEST_BUNDLE1_LOCATION));
+    long bndId;
+    auto status = celix_bundleCache_findBundleIdForLocation(cache, SIMPLE_TEST_BUNDLE1_LOCATION, &bndId);
+    EXPECT_EQ(CELIX_SUCCESS, status);
+    EXPECT_EQ(-1, bndId);
     EXPECT_FALSE(celix_bundleCache_isBundleIdAlreadyUsed(cache, 1));
 
     celix_ei_expect_calloc((void*)celix_bundleArchive_create, 0, nullptr);
     EXPECT_EQ(CELIX_ENOMEM, celix_bundleCache_createArchive(cache, 1, SIMPLE_TEST_BUNDLE1_LOCATION, &archive));
     EXPECT_EQ(nullptr, archive);
-    EXPECT_EQ(-1, celix_bundleCache_findBundleIdForLocation(cache, SIMPLE_TEST_BUNDLE1_LOCATION));
+    status = celix_bundleCache_findBundleIdForLocation(cache, SIMPLE_TEST_BUNDLE1_LOCATION, &bndId);
+    EXPECT_EQ(CELIX_SUCCESS, status);
+    EXPECT_EQ(-1, bndId);
     EXPECT_FALSE(celix_bundleCache_isBundleIdAlreadyUsed(cache, 1));
 
     EXPECT_EQ(CELIX_SUCCESS, celix_bundleCache_destroy(cache));
@@ -196,11 +201,5 @@ TEST_F(CelixBundleCacheErrorInjectionTestSuite, LoadBundleStatePropertiesErrorTe
 
     // Then installing the bundle will fail
     bndId = ctx->installBundle(SIMPLE_TEST_BUNDLE1_LOCATION);
-    EXPECT_GT(bndId, -1); //async install, so bundle id is returned
-    celix_bundleContext_useBundle(
-        ctx->getCBundleContext(), bndId, nullptr, [](void* /*handle*/, const celix_bundle_t* bnd) {
-            auto status = celix_bundle_getState(bnd);
-            // TODO fixme, bundle is installed and active, this is not correct
-            EXPECT_EQ(CELIX_BUNDLE_EVENT_INSTALLED, status);
-        });
+    EXPECT_EQ(bndId, -1); //async install, so bundle id is returned
 }
diff --git a/libs/framework/gtest/src/CelixBundleCacheTestSuite.cc b/libs/framework/gtest/src/CelixBundleCacheTestSuite.cc
index 42e397c53..a9393adfd 100644
--- a/libs/framework/gtest/src/CelixBundleCacheTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleCacheTestSuite.cc
@@ -54,13 +54,18 @@ TEST_F(CelixBundleCacheTestSuite, ArchiveCreateDestroyTest) {
     auto location = celix_bundleArchive_getLocation(archive);
     EXPECT_STREQ(SIMPLE_TEST_BUNDLE1_LOCATION, location);
     free(location);
-    EXPECT_EQ(1, celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE1_LOCATION));
+    long bndId;
+    auto status = celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE1_LOCATION, &bndId);
+    EXPECT_EQ(CELIX_SUCCESS, status);
+    EXPECT_EQ(1, bndId);
     EXPECT_TRUE(celix_bundleCache_isBundleIdAlreadyUsed(fw.cache, 1));
     std::string loc = celix_bundleArchive_getPersistentStoreRoot(archive);
     EXPECT_TRUE(celix_utils_directoryExists(loc.c_str()));
     celix_bundleArchive_invalidate(archive);
     celix_bundleCache_destroyArchive(fw.cache, archive);
-    EXPECT_EQ(-1, celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE1_LOCATION));
+    status = celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE1_LOCATION, &bndId);
+    EXPECT_EQ(CELIX_SUCCESS, status);
+    EXPECT_EQ(-1, bndId);
     EXPECT_FALSE(celix_bundleCache_isBundleIdAlreadyUsed(fw.cache, 1));
     EXPECT_FALSE(celix_utils_directoryExists(loc.c_str()));
 }
@@ -72,7 +77,10 @@ TEST_F(CelixBundleCacheTestSuite, NonPermanentDestroyTest) {
     std::string loc = celix_bundleArchive_getPersistentStoreRoot(archive);
     EXPECT_TRUE(celix_utils_directoryExists(loc.c_str()));
     celix_bundleCache_destroyArchive(fw.cache, archive);
-    EXPECT_EQ(1, celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE1_LOCATION));
+    long bndId;
+    auto status = celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE1_LOCATION, &bndId);
+    EXPECT_EQ(CELIX_SUCCESS, status);
+    EXPECT_EQ(1, bndId);
     EXPECT_TRUE(celix_bundleCache_isBundleIdAlreadyUsed(fw.cache, 1));
     EXPECT_TRUE(celix_utils_directoryExists(loc.c_str()));
 }
@@ -94,8 +102,13 @@ TEST_F(CelixBundleCacheTestSuite, CreateBundleArchivesCacheTest) {
     celix_properties_set(fw.configurationMap, CELIX_AUTO_START_1, SIMPLE_TEST_BUNDLE1_LOCATION);
     celix_properties_set(fw.configurationMap, CELIX_AUTO_INSTALL, SIMPLE_TEST_BUNDLE2_LOCATION);
     EXPECT_EQ(CELIX_SUCCESS, celix_bundleCache_createBundleArchivesCache(&fw, true));
-    EXPECT_EQ(1, celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE1_LOCATION));
+    long bndId;
+    auto status = celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE1_LOCATION, &bndId);
+    EXPECT_EQ(CELIX_SUCCESS, status);
+    EXPECT_EQ(1, bndId);
     EXPECT_TRUE(celix_bundleCache_isBundleIdAlreadyUsed(fw.cache, 1));
-    EXPECT_EQ(2, celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE2_LOCATION));
+    status = celix_bundleCache_findBundleIdForLocation(fw.cache, SIMPLE_TEST_BUNDLE2_LOCATION, &bndId);
+    EXPECT_EQ(CELIX_SUCCESS, status);
+    EXPECT_EQ(2, bndId);
     EXPECT_TRUE(celix_bundleCache_isBundleIdAlreadyUsed(fw.cache, 2));
 }
\ No newline at end of file
diff --git a/libs/framework/src/bundle_archive.c b/libs/framework/src/bundle_archive.c
index b3cdd5e83..4607a7b62 100644
--- a/libs/framework/src/bundle_archive.c
+++ b/libs/framework/src/bundle_archive.c
@@ -18,7 +18,6 @@
  */
 
 #include <assert.h>
-#include <dirent.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -94,7 +93,6 @@ static celix_status_t celix_bundleArchive_storeBundleStateProperties(bundle_arch
         status = celix_properties_save(
             bundleStateProperties, archive->savedBundleStatePropertiesPath, CELIX_PROPERTIES_ENCODE_PRETTY);
         if (status != CELIX_SUCCESS) {
-            celix_framework_logTssErrors(archive->fw->logger, CELIX_LOG_LEVEL_ERROR);
             return status;
         }
     }
diff --git a/libs/framework/src/celix_bundle_cache.c b/libs/framework/src/celix_bundle_cache.c
index 770d83b33..54d6fc2fb 100644
--- a/libs/framework/src/celix_bundle_cache.c
+++ b/libs/framework/src/celix_bundle_cache.c
@@ -35,7 +35,7 @@
 #include "framework_private.h"
 #include "bundle_archive_private.h"
 #include "celix_string_hash_map.h"
-#include "celix_build_assert.h"
+#include "celix_stdio_cleanup.h"
 
 //for Celix 3.0 update to a different bundle root scheme
 //#define CELIX_BUNDLE_ARCHIVE_ROOT_FORMAT "%s/bundle_%li"
@@ -218,12 +218,12 @@ void celix_bundleCache_destroyArchive(celix_bundle_cache_t* cache, bundle_archiv
 /**
  * Update location->bundle id lookup map.
  */
-static void celix_bundleCache_updateIdForLocationLookupMap(celix_bundle_cache_t* cache) {
-    DIR* dir = opendir(cache->cacheDir);
+static celix_status_t celix_bundleCache_updateIdForLocationLookupMap(celix_bundle_cache_t* cache) {
+    celix_autoptr(DIR) dir = opendir(cache->cacheDir);
     if (dir == NULL) {
         fw_logCode(cache->fw->logger, CELIX_LOG_LEVEL_ERROR, CELIX_BUNDLE_EXCEPTION,
                    "Cannot open bundle cache directory %s", cache->cacheDir);
-        return;
+        return CELIX_FILE_IO_EXCEPTION;
     }
     char archiveRootBuffer[CELIX_DEFAULT_STRING_CREATE_BUFFER_SIZE];
     struct dirent* dent = NULL;
@@ -234,14 +234,15 @@ static void celix_bundleCache_updateIdForLocationLookupMap(celix_bundle_cache_t*
         char* bundleStateProperties = celix_utils_writeOrCreateString(archiveRootBuffer, sizeof(archiveRootBuffer),
                                                                       "%s/%s/%s", cache->cacheDir, dent->d_name,
                                                                       CELIX_BUNDLE_ARCHIVE_STATE_PROPERTIES_FILE_NAME);
+        celix_auto(celix_utils_string_guard_t) strGuard = celix_utils_stringGuard_init(archiveRootBuffer, bundleStateProperties);
         if (celix_utils_fileExists(bundleStateProperties)) {
-            celix_properties_t* props;
-            celix_status_t status = celix_properties_load2(bundleStateProperties, 0, &props); //validate the file (and ignore the result
+            celix_autoptr(celix_properties_t) props = NULL;
+            celix_status_t status = celix_properties_load2(bundleStateProperties, 0, &props);
             if (status != CELIX_SUCCESS) {
                     fw_logCode(cache->fw->logger, CELIX_LOG_LEVEL_ERROR, status,
                                "Cannot load bundle state properties from %s", bundleStateProperties);
                     celix_framework_logTssErrors(cache->fw->logger, CELIX_LOG_LEVEL_ERROR);
-                    continue;
+                    return CELIX_FILE_IO_EXCEPTION;
             }
             const char* visitLoc = celix_properties_get(props, CELIX_BUNDLE_ARCHIVE_LOCATION_PROPERTY_NAME, NULL);
             long bndId = celix_properties_getAsLong(props, CELIX_BUNDLE_ARCHIVE_BUNDLE_ID_PROPERTY_NAME, -1);
@@ -250,25 +251,26 @@ static void celix_bundleCache_updateIdForLocationLookupMap(celix_bundle_cache_t*
                        visitLoc, bndId);
                 celix_stringHashMap_putLong(cache->locationToBundleIdLookupMap, visitLoc, bndId);
             }
-            celix_properties_destroy(props);
         }
-        celix_utils_freeStringIfNotEqual(archiveRootBuffer, bundleStateProperties);
     }
-    closedir(dir);
+    return CELIX_SUCCESS;
 }
 
-long celix_bundleCache_findBundleIdForLocation(celix_bundle_cache_t* cache, const char* location) {
-    long bndId = -1;
-    celixThreadMutex_lock(&cache->mutex);
+celix_status_t
+celix_bundleCache_findBundleIdForLocation(celix_bundle_cache_t* cache, const char* location, long* outBndId) {
+    *outBndId = -1L;
+    celix_auto(celix_mutex_lock_guard_t) lck = celixMutexLockGuard_init(&cache->mutex);
     if (!cache->locationToBundleIdLookupMapLoaded) {
-        celix_bundleCache_updateIdForLocationLookupMap(cache);
+        celix_status_t status = celix_bundleCache_updateIdForLocationLookupMap(cache);
+        if (status != CELIX_SUCCESS) {
+            return status;
+        }
         cache->locationToBundleIdLookupMapLoaded = true;
     }
     if (celix_stringHashMap_hasKey(cache->locationToBundleIdLookupMap, location)) {
-        bndId = celix_stringHashMap_getLong(cache->locationToBundleIdLookupMap, location, -1);
+        *outBndId = celix_stringHashMap_getLong(cache->locationToBundleIdLookupMap, location, -1);
     }
-    celixThreadMutex_unlock(&cache->mutex);
-    return bndId;
+    return CELIX_SUCCESS;
 }
 
 bool celix_bundleCache_isBundleIdAlreadyUsed(celix_bundle_cache_t* cache, long bndId) {
diff --git a/libs/framework/src/celix_bundle_cache.h b/libs/framework/src/celix_bundle_cache.h
index fef8a7422..c6b559716 100644
--- a/libs/framework/src/celix_bundle_cache.h
+++ b/libs/framework/src/celix_bundle_cache.h
@@ -112,11 +112,13 @@ celix_status_t celix_bundleCache_deleteCacheDir(celix_bundle_cache_t* cache);
  * @brief Find if the there is already a bundle cache for the provided bundle zip location and if this is true
  * return the bundle id for the bundle cache entry.
  *
- * @param cache The cache.
- * @param location The location of the bundle zip to find the id for.
- * @return The bundle id or -1 if not found.
+ * @param[in]  cache The cache.
+ * @param[in] location The location of the bundle zip to find the id for.
+ * @param[out] outBndId The bundle id for the bundle cache entry.
+ * @return CELIX_SUCCESS if the bundle id is found and CELIX_FILE_IO_EXCEPTION if the cache cannot be opened or read.
  */
-long celix_bundleCache_findBundleIdForLocation(celix_bundle_cache_t* cache, const char* location);
+celix_status_t
+celix_bundleCache_findBundleIdForLocation(celix_bundle_cache_t* cache, const char* location, long* outBndId);
 
 /**
  * @brief Find if the there is already a bundle cache for the provided bundle id.
diff --git a/libs/framework/src/celix_log.c b/libs/framework/src/celix_log.c
index c8606b43a..ebe3f236d 100644
--- a/libs/framework/src/celix_log.c
+++ b/libs/framework/src/celix_log.c
@@ -145,10 +145,10 @@ void celix_framework_logCode(celix_framework_logger_t*  logger, celix_log_level_
 
 void celix_framework_logTssErrors(celix_framework_logger_t* logger, celix_log_level_e level) {
     char buf[CELIX_ERR_BUFFER_SIZE] = {0};
-    if (celix_err_dump(buf, sizeof(buf), "[TssErr] ", NULL) == 0) {
+    if (celix_err_dump(buf, sizeof(buf), NULL, NULL) == 0) {
         // nothing to output
         return;
     }
     celix_err_resetErrors();
-    celix_framework_log(logger, level, NULL, NULL, 0, "Detected tss errors:\n%s", buf);
+    celix_framework_log(logger, level, NULL, NULL, 0, "Detected tss errors: %s", buf);
 }
diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index 54e360595..99d4946f1 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -42,11 +42,12 @@
 #include "bundle_archive_private.h"
 #include "bundle_context_private.h"
 #include "bundle_private.h"
+#include "celix_err.h"
+#include "celix_scheduled_event.h"
+#include "celix_stdlib_cleanup.h"
 #include "framework_private.h"
 #include "service_reference_private.h"
 #include "service_registration_private.h"
-#include "celix_scheduled_event.h"
-#include "celix_err.h"
 #include "utils.h"
 
 struct celix_bundle_activator {
@@ -624,63 +625,62 @@ bool celix_framework_getConfigPropertyAsBool(celix_framework_t* framework, const
 
 static celix_status_t
 celix_framework_installBundleInternalImpl(celix_framework_t* framework, const char* bndLoc, long* bndId) {
-    celix_status_t status = CELIX_SUCCESS;
-    celix_bundle_t* bundle = NULL;
-    long id = -1L;
-
-    bundle_state_e state = CELIX_BUNDLE_STATE_UNKNOWN;
-
     bool valid = celix_framework_utils_isBundleUrlValid(framework, bndLoc, false);
     if (!valid) {
         return CELIX_FILE_IO_EXCEPTION;
     }
 
-    //increase use count of framework bundle to prevent a stop.
-    celix_framework_bundle_entry_t *fwBundleEntry = celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(framework,
-                                                                                                                  framework->bundleId);
-    status = CELIX_DO_IF(status, bundle_getState(framework->bundle, &state));
-    if (status == CELIX_SUCCESS) {
-        if (state == CELIX_BUNDLE_STATE_STOPPING || state == CELIX_BUNDLE_STATE_UNINSTALLED) {
-            fw_log(framework->logger, CELIX_LOG_LEVEL_INFO,  "The framework is being shutdown");
-            status = CELIX_FRAMEWORK_SHUTDOWN;
-        }
+    // increase use count of framework bundle to prevent a stop.
+    celix_framework_bundle_entry_t* fwBundleEntry =
+        celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(framework, framework->bundleId);
+
+    celix_bundle_state_e bndState = celix_bundle_getState(framework->bundle);
+    if (bndState == CELIX_BUNDLE_STATE_STOPPING || bndState == CELIX_BUNDLE_STATE_UNINSTALLED) {
+        fw_log(framework->logger, CELIX_LOG_LEVEL_INFO,  "The framework is being shutdown");
+        return CELIX_FRAMEWORK_SHUTDOWN;
     }
 
-    if (status == CELIX_SUCCESS) {
-        if (*bndId == -1L) {
-            id = framework_getBundle(framework, bndLoc);
-            if (id != -1L) {
-                celix_framework_bundleEntry_decreaseUseCount(fwBundleEntry);
-                *bndId = id;
-                return CELIX_SUCCESS;
-            }
-            long alreadyExistingBndId = celix_bundleCache_findBundleIdForLocation(framework->cache, bndLoc);
-            id = alreadyExistingBndId == -1 ? framework_getNextBundleId(framework) : alreadyExistingBndId;
-        } else {
-            id = *bndId;
+    long id;
+    if (*bndId == -1L) {
+        id = framework_getBundle(framework, bndLoc);
+        if (id != -1L) {
+            celix_framework_bundleEntry_decreaseUseCount(fwBundleEntry);
+            *bndId = id;
+            return CELIX_SUCCESS;
         }
-        bundle_archive_t* archive = NULL;
-        status = CELIX_DO_IF(status, celix_bundleCache_createArchive(framework->cache, id, bndLoc, &archive));
-        status = CELIX_DO_IF(status, celix_bundle_createFromArchive(framework, archive, &bundle));
-        if (status == CELIX_SUCCESS) {
-            celix_framework_bundle_entry_t *bEntry = fw_bundleEntry_create(bundle);
-            celix_framework_bundleEntry_increaseUseCount(bEntry);
-            celixThreadMutex_lock(&framework->installedBundles.mutex);
-            celix_arrayList_add(framework->installedBundles.entries, bEntry);
-            celixThreadMutex_unlock(&framework->installedBundles.mutex);
-            fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_INSTALLED, bEntry);
-            celix_framework_bundleEntry_decreaseUseCount(bEntry);
+        long alreadyExistingBndId;
+        celix_status_t status =
+            celix_bundleCache_findBundleIdForLocation(framework->cache, bndLoc, &alreadyExistingBndId);
+        if (status != CELIX_SUCCESS) {
+            celix_framework_bundleEntry_decreaseUseCount(fwBundleEntry);
+            fw_logCode(framework->logger, CELIX_LOG_LEVEL_ERROR, status, "Could not install bundle");
+            return status;
         }
+        id = alreadyExistingBndId == -1 ? framework_getNextBundleId(framework) : alreadyExistingBndId;
+    } else {
+        id = *bndId;
     }
 
-    if (status == CELIX_SUCCESS) {
-        *bndId = id;
-    } else {
+    bundle_archive_t* archive = NULL;
+    celix_bundle_t* bundle = NULL;
+    celix_status_t status = celix_bundleCache_createArchive(framework->cache, id, bndLoc, &archive);
+    status = CELIX_DO_IF(status, celix_bundle_createFromArchive(framework, archive, &bundle));
+    if (status != CELIX_SUCCESS) {
+        celix_framework_bundleEntry_decreaseUseCount(fwBundleEntry);
         fw_logCode(framework->logger, CELIX_LOG_LEVEL_ERROR, status, "Could not install bundle");
+        return status;
     }
 
+    celix_framework_bundle_entry_t *bEntry = fw_bundleEntry_create(bundle);
+    celix_framework_bundleEntry_increaseUseCount(bEntry);
+    celixThreadMutex_lock(&framework->installedBundles.mutex);
+    celix_arrayList_add(framework->installedBundles.entries, bEntry);
+    celixThreadMutex_unlock(&framework->installedBundles.mutex);
+    fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_INSTALLED, bEntry);
+    celix_framework_bundleEntry_decreaseUseCount(bEntry);
     celix_framework_bundleEntry_decreaseUseCount(fwBundleEntry);
-    return status;
+    *bndId = id;
+    return CELIX_SUCCESS;
 }
 
 celix_status_t
@@ -2349,57 +2349,72 @@ celix_status_t celix_framework_updateBundleEntry(celix_framework_t* framework,
                                                  const char* updatedBundleUrl) {
     celix_status_t status = CELIX_SUCCESS;
     long bundleId = bndEntry->bndId;
-    const char* errMsg;
     fw_log(framework->logger, CELIX_LOG_LEVEL_DEBUG, "Updating bundle %s", celix_bundle_getSymbolicName(bndEntry->bnd));
     celix_bundle_state_e bndState = celix_bundle_getState(bndEntry->bnd);
-    char *location = celix_bundle_getLocation(bndEntry->bnd);
-    do {
-        // lock to reuse the bundle id
-        celixThreadMutex_lock(&framework->installLock);
-        if (updatedBundleUrl == NULL) {
-            updatedBundleUrl = location;
-        } else if (strcmp(location, updatedBundleUrl) != 0) {
-            long alreadyExistingBndId = celix_bundleCache_findBundleIdForLocation(framework->cache, updatedBundleUrl);
-            if (alreadyExistingBndId != -1 && alreadyExistingBndId != bundleId) {
-                errMsg = "specified bundle location exists in cache with a different id";
-                celix_framework_bundleEntry_decreaseUseCount(bndEntry);
-                celixThreadMutex_unlock(&framework->installLock);
-                status = CELIX_ILLEGAL_STATE;
-                break;
-            }
-            celix_bundleArchive_invalidateCache(celix_bundle_getArchive(bndEntry->bnd));
-        }
-        status = celix_framework_uninstallBundleEntryImpl(framework, bndEntry, false);
+    celix_autofree char* location = celix_bundle_getLocation(bndEntry->bnd);
+
+    // lock to reuse the bundle id
+    celix_auto(celix_mutex_lock_guard_t) lck = celixMutexLockGuard_init(&framework->installLock);
+    if (updatedBundleUrl == NULL) {
+        updatedBundleUrl = location;
+    } else if (strcmp(location, updatedBundleUrl) != 0) {
+        long existingBndId;
+        status = celix_bundleCache_findBundleIdForLocation(framework->cache, updatedBundleUrl, &existingBndId);
         if (status != CELIX_SUCCESS) {
-            errMsg = "uninstall failure";
-            celixThreadMutex_unlock(&framework->installLock);
-            break;
-        }
-        // bndEntry is now invalid
-        status = celix_framework_installBundleInternalImpl(framework, updatedBundleUrl, &bundleId);
-        if (status != CELIX_SUCCESS) {
-            errMsg = "reinstall failure";
-            celixThreadMutex_unlock(&framework->installLock);
-            break;
-        }
-        if (bndState != CELIX_BUNDLE_STATE_STARTING && bndState != CELIX_BUNDLE_STATE_ACTIVE) {
-            // no need to restart the updated bundle
-            celixThreadMutex_unlock(&framework->installLock);
-            break;
-        }
-        celix_framework_bundle_entry_t* entry = celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(framework, bundleId);
-        celixThreadMutex_unlock(&framework->installLock);
-        // assert(entry != NULL);
-        status = celix_framework_startBundleEntry(framework, entry);
-        celix_framework_bundleEntry_decreaseUseCount(entry);
-        if (status != CELIX_SUCCESS) {
-            errMsg = "restart failure";
-            break;
-        }
-    } while(0);
-    framework_logIfError(framework->logger, status, errMsg, "Could not update bundle from %s", updatedBundleUrl);
-    free(location);
-    return status;
+            fw_log(framework->logger,
+                   CELIX_LOG_LEVEL_ERROR,
+                   "Could not read bundle cache to check if bundle location %s exists in cache. Update failed.",
+                   updatedBundleUrl);
+            return status;
+        } else if (existingBndId != -1 && existingBndId != bundleId) {
+            fw_log(framework->logger,
+                   CELIX_LOG_LEVEL_ERROR,
+                   "Specified bundle location %s exists in cache with a different id. Update failed.",
+                   updatedBundleUrl);
+            celix_framework_bundleEntry_decreaseUseCount(bndEntry);
+            return CELIX_ILLEGAL_STATE;
+        }
+        celix_bundleArchive_invalidateCache(celix_bundle_getArchive(bndEntry->bnd));
+    }
+    status = celix_framework_uninstallBundleEntryImpl(framework, bndEntry, false);
+    if (status != CELIX_SUCCESS) {
+        fw_log(framework->logger,
+               CELIX_LOG_LEVEL_ERROR,
+               "Failed to uninstall bundle %s",
+               celix_bundle_getSymbolicName(bndEntry->bnd));
+        return status;
+    }
+
+    // bndEntry is now invalid
+    status = celix_framework_installBundleInternalImpl(framework, updatedBundleUrl, &bundleId);
+    if (status != CELIX_SUCCESS) {
+        fw_log(framework->logger,
+               CELIX_LOG_LEVEL_ERROR,
+               "Failed to install updated bundle %s",
+               updatedBundleUrl);
+        return status;
+    }
+
+    if (bndState != CELIX_BUNDLE_STATE_STARTING && bndState != CELIX_BUNDLE_STATE_ACTIVE) {
+        // no need to restart the updated bundle
+        fw_log(framework->logger, CELIX_LOG_LEVEL_DEBUG, "Bundle %li is not active, no need to restart", bundleId);
+        return CELIX_SUCCESS;
+    }
+
+    celix_framework_bundle_entry_t* entry =
+        celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(framework, bundleId);
+    celixMutexLockGuard_deinit(&lck);
+    status = celix_framework_startBundleEntry(framework, entry);
+    celix_framework_bundleEntry_decreaseUseCount(entry);
+    if (status != CELIX_SUCCESS) {
+        fw_log(framework->logger,
+               CELIX_LOG_LEVEL_ERROR,
+               "Failed to start updated bundle %s",
+               celix_bundle_getSymbolicName(bndEntry->bnd));
+        return CELIX_BUNDLE_EXCEPTION;
+    }
+
+    return CELIX_SUCCESS;
 }
 
 bool celix_framework_updateBundle(celix_framework_t *fw, long bndId, const char* updatedBundleUrl) {
diff --git a/libs/utils/gtest/src/CelixUtilsAutoCleanupTestSuite.cc b/libs/utils/gtest/src/CelixUtilsAutoCleanupTestSuite.cc
index a74a6f331..5f02a9a99 100644
--- a/libs/utils/gtest/src/CelixUtilsAutoCleanupTestSuite.cc
+++ b/libs/utils/gtest/src/CelixUtilsAutoCleanupTestSuite.cc
@@ -193,3 +193,7 @@ TEST_F(CelixUtilsCleanupTestSuite, StealFdTest) {
 TEST_F(CelixUtilsCleanupTestSuite, FileTest) {
     celix_autoptr(FILE) file = tmpfile();
 }
+
+TEST_F(CelixUtilsCleanupTestSuite, DirTest) {
+    celix_autoptr(DIR) dir = opendir(".");
+}
diff --git a/libs/utils/include/celix_stdio_cleanup.h b/libs/utils/include/celix_stdio_cleanup.h
index 43cbff16b..32c4868a7 100644
--- a/libs/utils/include/celix_stdio_cleanup.h
+++ b/libs/utils/include/celix_stdio_cleanup.h
@@ -25,11 +25,14 @@ extern "C" {
 #endif
 
 #include <stdio.h>
+#include <dirent.h>
 
 #include "celix_cleanup.h"
 
 CELIX_DEFINE_AUTOPTR_CLEANUP_FUNC(FILE, fclose)
 
+CELIX_DEFINE_AUTOPTR_CLEANUP_FUNC(DIR, closedir)
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/libs/utils/include/celix_threads.h b/libs/utils/include/celix_threads.h
index 19c585f3b..612c1869e 100644
--- a/libs/utils/include/celix_threads.h
+++ b/libs/utils/include/celix_threads.h
@@ -142,6 +142,7 @@ static CELIX_UNUSED inline void celixMutexLockGuard_deinit(celix_mutex_lock_guar
     if (guard->mutex) {
         celixThreadMutex_unlock(guard->mutex);
     }
+    guard->mutex = NULL;
 }
 
 CELIX_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(celix_mutex_lock_guard_t, celixMutexLockGuard_deinit)


(celix) 02/05: gh-685: Refactor config prop cmake gen and test config props

Posted by pn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-update-container-config-properties-usage
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 74f425794cadb0b7ce71056da9727b178eaca4f2
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Thu May 30 15:42:43 2024 +0200

    gh-685: Refactor config prop cmake gen and test config props
---
 CHANGES.md                                         |   2 +-
 .../gtest/client.properties.in                     |  21 ++--
 .../gtest/config.properties.in                     |  25 +----
 .../gtest/server.properties.in                     |  37 ++-----
 .../topology_manager/tms_tst/CMakeLists.txt        |  20 ++--
 cmake/cmake_celix/BundlePackaging.cmake            |  26 ++---
 cmake/cmake_celix/ContainerPackaging.cmake         | 123 ++++++++++++---------
 .../bundle_with_private_lib/CMakeLists.txt         |   2 +-
 .../celix-examples/hello_world_c/CMakeLists.txt    |   3 +-
 libs/framework/gtest/config.properties.in          |  23 +---
 libs/framework/gtest/framework1.properties.in      |  25 +----
 libs/framework/gtest/framework2.properties.in      |  25 +----
 .../gtest/install_and_start_bundles.properties.in  |  33 +-----
 libs/framework/src/celix_launcher.c                |  59 ++++++----
 libs/utils/gtest/CMakeLists.txt                    |   4 +-
 .../config_admin_tst/config.properties.in          |  25 +----
 16 files changed, 188 insertions(+), 265 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 2720590a4..593decd40 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -33,7 +33,7 @@ limitations under the License.
 - pubsub_serializer.h is removed and no longer supported. Use pubsub_message_serialization_service.h instead.
 - C++11 support for dm is removed. C++14 is now the minimum required version.
 - C++17 string_view support is removed from the utils and framework lib.
-- Apache Celix CMake bundle functions without a celix_ prefix or infix are removed.
+- Apache Celix CMake container & bundle functions without a celix_ prefix or infix are removed.
 - Apache Celix CMake support for creating docker images and creating runtimes dirs is removed.
 - Support and usage of "service.lang" service property is removed.
 - Rename of `CELIX_FRAMEWORK_FRAMEWORK_CACHE_DIR` config property to `CELIX_FRAMEWORK_CACHE_DIR`.
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
index 506ed25ea..00ef4e8cd 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
@@ -1,10 +1,11 @@
-CELIX_AUTO_START_1=@rsa_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@ @tst_bundle_file@
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
-CELIX_FRAMEWORK_CACHE_DIR=.cacheClient
-
-DISCOVERY_CFG_POLL_INTERVAL=1
-DISCOVERY_CFG_POLL_TIMEOUT=5
-RSA_PORT=50881
-DISCOVERY_CFG_SERVER_PORT=50991
-DISCOVERY_CFG_POLL_ENDPOINTS=http://localhost:50992/org.apache.celix.discovery.configured
\ No newline at end of file
+{
+    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@ @tst_bundle_file@",
+    "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
+    "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
+    "CELIX_FRAMEWORK_CACHE_DIR":".cacheClient",
+    "DISCOVERY_CFG_POLL_INTERVAL":1,
+    "DISCOVERY_CFG_POLL_TIMEOUT":5,
+    "RSA_PORT":50881,
+    "DISCOVERY_CFG_SERVER_PORT":50991,
+    "DISCOVERY_CFG_POLL_ENDPOINTS":"http://localhost:50992/org.apache.celix.discovery.configured"
+}
\ No newline at end of file
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
index 52730b288..cac7390d2 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
@@ -1,20 +1,5 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-CELIX_AUTO_START_1=@rsa_bundle_file@ @calc_bundle_file@
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
+{
+    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @calc_bundle_file@",
+    "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
+    "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true
+}
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
index 7812c7fe0..8d74011aa 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
@@ -1,26 +1,11 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-CELIX_AUTO_START_1=@rsa_bundle_file@ @calc_bundle_file@ @remote_example_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
-CELIX_FRAMEWORK_CACHE_DIR=.cacheServer
-
-DISCOVERY_CFG_POLL_INTERVAL=1
-DISCOVERY_CFG_POLL_TIMEOUT=5
-RSA_PORT=50882
-DISCOVERY_CFG_SERVER_PORT=50992
-DISCOVERY_CFG_POLL_ENDPOINTS=http://localhost:50991/org.apache.celix.discovery.configured
+{
+    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @calc_bundle_file@ @remote_example_bundle_file@ @discovery_bundle_file@ @topology_manager_bundle_file@",
+    "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
+    "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
+    "CELIX_FRAMEWORK_CACHE_DIR":".cacheServer",
+    "DISCOVERY_CFG_POLL_INTERVAL":1,
+    "DISCOVERY_CFG_POLL_TIMEOUT":5,
+    "RSA_PORT":50882,
+    "DISCOVERY_CFG_SERVER_PORT":50992,
+    "DISCOVERY_CFG_POLL_ENDPOINTS":"http://localhost:50991/org.apache.celix.discovery.configured"
+}
diff --git a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
index dfb913135..332677cc1 100644
--- a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
+++ b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
@@ -54,19 +54,19 @@ add_celix_bundle_dependencies(test_tm_scoped Celix::rsa_dfi Celix::rsa_topology_
 
 file(GENERATE 
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config.properties"
-    CONTENT "
-CELIX_AUTO_START_1=$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
-")
+    CONTENT "{
+    \"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>\",
+    \"LOGHELPER_ENABLE_STDOUT_FALLBACK\":true,
+    \"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE\":true
+}")
 
 file(GENERATE 
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config_import.properties"
-    CONTENT "
-CELIX_AUTO_START_1=$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
-")
+    CONTENT "{
+    \"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>\",
+    \"LOGHELPER_ENABLE_STDOUT_FALLBACK\":true,
+    \"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE\":true
+}")
 
 configure_file("scope.json" "scope.json")
 configure_file("scope2.json" "scope2.json")
diff --git a/cmake/cmake_celix/BundlePackaging.cmake b/cmake/cmake_celix/BundlePackaging.cmake
index 112d942f4..0bdf0f654 100644
--- a/cmake/cmake_celix/BundlePackaging.cmake
+++ b/cmake/cmake_celix/BundlePackaging.cmake
@@ -31,13 +31,13 @@ endif ()
 find_program(JAR_COMMAND jar NO_CMAKE_FIND_ROOT_PATH)
 
 if (JAR_COMMAND AND NOT CELIX_USE_ZIP_INSTEAD_OF_JAR)
-    message(STATUS "Using jar to create bundles")
+    message(DEBUG "Using jar to create bundles")
 else ()
     find_program(ZIP_COMMAND zip NO_CMAKE_FIND_ROOT_PATH)
     if (ZIP_COMMAND)
-        message(STATUS "Using zip to create bundles")
+        message(DEBUG "Using zip to create bundles")
     else ()
-        message(FATAL_ERROR "A jar or zip command is needed to jar/zip bundles")
+        message(FATAL_ERROR "A jar or zip command is needed to created bundles")
     endif ()
 endif ()
 
@@ -48,7 +48,7 @@ if (NOT TARGET celix-bundles)
 endif ()
 #####
 
-macro(extract_version_parts VERSION MAJOR MINOR PATCH)
+macro(_extract_version_parts VERSION MAJOR MINOR PATCH)
     set(MAJOR "0")
     set(MINOR "0")
     set(PATCH "0")
@@ -67,20 +67,20 @@ macro(extract_version_parts VERSION MAJOR MINOR PATCH)
     endif ()
 endmacro()
 
-function(set_library_version TARGET VERSION)
+function(celix_set_library_version TARGET VERSION)
     if (VERSION AND TARGET)
-        extract_version_parts("${VERSION}" MAJOR MINOR PATCH)
+        _extract_version_parts("${VERSION}" MAJOR MINOR PATCH)
 
         #NOTE setting aligning ABI version with major part of the interface version.
         #This is simpeler than using the <current>:<revision>:<age> approach of libtool
         set_property(TARGET ${TARGET} PROPERTY VERSION "${VERSION}")
         set_property(TARGET ${TARGET} PROPERTY SOVERSION ${MAJOR})
     else ()
-        message(WARNING "set_library_version: Cannot set version info TARGET and/or VERSION not provided")
+        message(WARNING "celix_set_library_version: Cannot set version info TARGET and/or VERSION not provided")
     endif ()
 endfunction()
 
-function(check_lib LIB)
+function(_check_lib LIB)
     if (TARGET ${LIB})
         #ok
     elseif (IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
@@ -90,7 +90,7 @@ function(check_lib LIB)
     endif ()
 endfunction()
 
-function(check_bundle BUNDLE)
+function(_check_bundle BUNDLE)
     if (TARGET ${BUNDLE})
         get_target_property(BUNDLE_FILE ${BUNDLE} "BUNDLE_FILE")
         if (NOT BUNDLE_FILE)
@@ -191,7 +191,7 @@ function(add_celix_bundle)
         message(FATAL_ERROR "add_bundle function requires a value for SOURCES or ACTIVATOR not both")
     endif ()
     if (BUNDLE_ACTIVATOR)
-        check_lib(${BUNDLE_ACTIVATOR})
+        _check_lib(${BUNDLE_ACTIVATOR})
     endif ()
     if (NOT DEFINED BUNDLE_GROUP)
         set(BUNDLE_GROUP "")
@@ -246,7 +246,7 @@ function(add_celix_bundle)
     if (BUNDLE_SOURCES)
         #create lib from sources
         add_library(${BUNDLE_TARGET_NAME} SHARED ${BUNDLE_SOURCES})
-        set_library_version(${BUNDLE_TARGET_NAME} ${BUNDLE_VERSION})
+        celix_set_library_version(${BUNDLE_TARGET_NAME} ${BUNDLE_VERSION})
         set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES
                 "BUNDLE_TARGET_IS_LIB" TRUE
                 "BUNDLE_TARGET" "${BUNDLE_TARGET_NAME}_bundle"
@@ -451,7 +451,7 @@ function(celix_bundle_libs)
     list(REMOVE_AT ARGN 0)
 
     #check if arg 0 is corrent
-    check_bundle(${BUNDLE})
+    _check_bundle(${BUNDLE})
     get_target_property(BUNDLE_DIR ${BUNDLE} "BUNDLE_CONTENT_DIR")
     get_target_property(BUNDLE_GEN_DIR ${BUNDLE} "BUNDLE_GEN_DIR")
 
@@ -536,7 +536,7 @@ function(celix_bundle_import_libs)
     list(REMOVE_AT ARGN 0)
 
     #check if arg 0 is correct
-    check_bundle(${BUNDLE})
+    _check_bundle(${BUNDLE})
 
     get_target_property(LIBS ${BUNDLE} "BUNDLE_IMPORT_LIBS")
 
diff --git a/cmake/cmake_celix/ContainerPackaging.cmake b/cmake/cmake_celix/ContainerPackaging.cmake
index 382a2bd16..6523b3d44 100644
--- a/cmake/cmake_celix/ContainerPackaging.cmake
+++ b/cmake/cmake_celix/ContainerPackaging.cmake
@@ -18,7 +18,7 @@
 
 set(CELIX_DEFAULT_CONTAINER_CXX_OPTION ON CACHE BOOL "Whether the default container options is CXX. If OFF this will be C")
 
-##### setup bundles/container target
+# Setup bundles/container target
 if (NOT TARGET celix-containers)
 	add_custom_target(celix-containers ALL
 		DEPENDS $<TARGET_PROPERTY:celix-containers,CONTAINER_DEPLOYMENTS>
@@ -30,12 +30,8 @@ if (NOT TARGET celix-containers)
 	list(APPEND CLEANFILES "${CMAKE_BINARY_DIR}/celix")
 	set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES "${CLEANFILES}")
 endif ()
-#####
 
-function(add_deploy)
-    message(DEPRECATION "deploy_bundles_dir is depecrated, use celix_container_bundles_dir instead.")
-    add_celix_container(${ARGN})
-endfunction()
+
 
 #[[
 Add a Celix container, consisting out of a selection of bundles and a Celix launcher.
@@ -223,20 +219,24 @@ function(add_celix_container)
                 CONTENT "#include <celix_launcher.h>
 #include <celix_err.h>
 
+#define CELIX_MULTI_LINE_STRING(...) #__VA_ARGS__
+
 int main(int argc, char *argv[]) {
-    const char * config = \"\\
-CELIX_CONTAINER_NAME=$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_NAME>\\n\\
-CELIX_BUNDLES_PATH=bundles\\n\\
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:CELIX_AUTO_START_0=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>, >\\n>\\
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:CELIX_AUTO_START_1=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>, >\\n>\\
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:CELIX_AUTO_START_2=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>, >\\n>\\
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:CELIX_AUTO_START_3=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>, >\\n>\\
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:CELIX_AUTO_START_4=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>, >\\n>\\
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:CELIX_AUTO_START_5=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>, >\\n>\\
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:CELIX_AUTO_START_6=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>, >\\n>\\
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:CELIX_AUTO_INSTALL=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>, >\\n>\\
-$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,\\n\\
->\";
+    const char * config = CELIX_MULTI_LINE_STRING(
+{
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>, >\"$<COMMA>>
+    $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,$<COMMA>
+    >$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>>:$<COMMA>>
+    \"CELIX_BUNDLES_PATH\":\"bundles\"$<COMMA>
+    \"CELIX_CONTAINER_NAME\":\"$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_NAME>\"
+});
 
     celix_properties_t *embeddedProps;
     celix_status_t status = celix_properties_loadFromString2(config, 0, &embeddedProps);
@@ -277,18 +277,20 @@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,\\n\
     if (CONTAINER_USE_CONFIG)
         file(GENERATE
                 OUTPUT "${STAGE1_PROPERTIES}"
-                CONTENT "CELIX_CONTAINER_NAME=$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_NAME>
-CELIX_BUNDLES_PATH=bundles
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:CELIX_AUTO_START_0=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>, >>
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:CELIX_AUTO_START_1=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>, >>
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:CELIX_AUTO_START_2=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>, >>
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:CELIX_AUTO_START_3=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>, >>
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:CELIX_AUTO_START_4=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>, >>
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:CELIX_AUTO_START_5=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>, >>
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:CELIX_AUTO_START_6=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>, >>
-$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:CELIX_AUTO_INSTALL=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>, >>
-$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>,
->"
+                CONTENT "{
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>, >\"$<COMMA>>
+    $<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>, >\"$<COMMA>>
+    $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,$<COMMA>
+    >$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>>:$<COMMA>>
+    \"CELIX_BUNDLES_PATH\":\"bundles\"$<COMMA>
+    \"CELIX_CONTAINER_NAME\":\"$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_NAME>\"
+}"
         )
         file(GENERATE
                 OUTPUT "${CONTAINER_PROPS}"
@@ -297,9 +299,10 @@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>,
     else ()
         file(GENERATE
                 OUTPUT "${STAGE1_PROPERTIES}"
-                CONTENT "$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>,
->
-"
+                CONTENT "{
+    $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>,$<COMMA>
+    >
+}"
                 )
         #Condition is there so that config.properties file will only be generated if there are runtime properties
         file(GENERATE
@@ -374,13 +377,6 @@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>,
     set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES "${CLEANFILES}")
 endfunction()
 
-
-#NOTE can be used for drivers/proxies/endpoints bundle dirs
-function(deploy_bundles_dir)
-    message(DEPRECATION "deploy_bundles_dir is depecrated, use celix_container_bundles_dir instead.")
-    celix_container_bundles_dir(${ARGN})
-endfunction()
-
 #[[
 Copy the specified bundles to a specified dir in the container build dir.
 
@@ -463,11 +459,6 @@ function(celix_container_bundles_dir)
     endforeach()
 endfunction()
 
-function(deploy_bundles)
-    message(DEPRECATION "deploy_bundles is depecrated, use celix_container_bundles instead.")
-    celix_container_bundles(${ARGN})
-endfunction()
-
 #[[
 Add a selection of bundles to the Celix container.
 
@@ -572,6 +563,7 @@ function(celix_container_bundles)
        endif ()
     endforeach()
 
+    list(REMOVE_DUPLICATES BUNDLES)
     if (BUNDLES_INSTALL)
         set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_INSTALL" "${BUNDLES}")
     else () #bundle level 0,1,2,3,4,5 or 6
@@ -609,8 +601,36 @@ function(_celix_container_check_duplicate_bundles)
     endforeach()
 endfunction()
 
-function(deploy_properties)
-    celix_container_runtime_properties(${ARGN})
+#[[
+Internal function that converts a property string to a JSON field entry.
+The result is stored in the OUTPUT_VAR_NAME variable.
+
+In the key the char `=` is not allowed and should be escaped as `\=` (in CMake this is `\\=`, because \ is already an
+escape char in CMake).
+In the value the char `=` is allowed.
+
+To handle \= string sequences the \= entries are replaced with a placeholder (__<CELIX_ESCAPED_EQUAL>__) and after the
+split the placeholder is replaced with =.
+
+```CMake
+_celix_convert_property_to_json("prop1=val1" OUTPUT_VAR_NAME) # OUTPUT_VAR_NAME will be set to "\"prop1\":\"val1\""
+_celix_convert_property_to_json("prop1=va=l1" OUTPUT_VAR_NAME) # OUTPUT_VAR_NAME will be set to "\"prop1\":\"va=l1\""
+_celix_convert_property_to_json("prop\\=1=val1" OUTPUT_VAR_NAME) # OUTPUT_VAR_NAME will be set to "\"prop=1\":\"val1\""
+```
+]]
+function(_celix_convert_property_to_json INPUT_STR OUTPUT_VAR_NAME)
+    set(PLACEHOLDER "__<CELIX_ESCAPED_EQUAL>__")
+    string(REPLACE "\\=" "${PLACEHOLDER}" TEMP_INPUT_STR "${INPUT_STR}")
+
+    string(REGEX MATCH "([^=]+)=(.*)" _ ${TEMP_INPUT_STR})
+    set(KEY ${CMAKE_MATCH_1})
+    set(VALUE ${CMAKE_MATCH_2})
+
+    #Replace replaced \= and \\ with = and \
+    string(REPLACE "${PLACEHOLDER}" "=" KEY "${KEY}")
+    string(REPLACE "${PLACEHOLDER}" "=" VALUE "${VALUE}")
+
+    set(${OUTPUT_VAR_NAME} "\"${KEY}\":\"${VALUE}\"" PARENT_SCOPE)
 endfunction()
 
 #[[
@@ -634,17 +654,13 @@ function(celix_container_runtime_properties)
     get_target_property(PROPS ${CONTAINER_TARGET} "CONTAINER_RUNTIME_PROPERTIES")
 
     foreach(PROP IN ITEMS ${ARGN})
+        _celix_convert_property_to_json(${PROP} PROP)
         list(APPEND PROPS ${PROP})
     endforeach()
 
    set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_RUNTIME_PROPERTIES" "${PROPS}")
 endfunction()
 
-function(deploy_embedded_properties)
-    message(DEPRECATION "deploy_embedded_properties is depecrated, use celix_container_embedded_properties instead.")
-    celix_container_embedded_properties(${ARGN})
-endfunction()
-
 #[[
 Add the provided properties to the target Celix container config properties.
 These properties will be embedded into the generated Celix launcher.
@@ -666,6 +682,7 @@ function(celix_container_embedded_properties)
     get_target_property(PROPS ${CONTAINER_TARGET} "CONTAINER_EMBEDDED_PROPERTIES")
 
     foreach(PROP IN ITEMS ${ARGN})
+        _celix_convert_property_to_json(${PROP} PROP)
         list(APPEND PROPS ${PROP})
     endforeach()
 
diff --git a/examples/celix-examples/bundle_with_private_lib/CMakeLists.txt b/examples/celix-examples/bundle_with_private_lib/CMakeLists.txt
index ab963418b..8c839f504 100644
--- a/examples/celix-examples/bundle_with_private_lib/CMakeLists.txt
+++ b/examples/celix-examples/bundle_with_private_lib/CMakeLists.txt
@@ -19,7 +19,7 @@ add_library(tlib SHARED
         tlib/src/test.c
 )
 target_include_directories(tlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tlib/include)
-set_library_version(tlib "4.3.2") # sets target propery VERSION to 4.3.2 and SOVERSION to 4
+celix_set_library_version(tlib "4.3.2") # sets target propery VERSION to 4.3.2 and SOVERSION to 4
 
 add_celix_bundle(hellotest
     VERSION "1.2"
diff --git a/examples/celix-examples/hello_world_c/CMakeLists.txt b/examples/celix-examples/hello_world_c/CMakeLists.txt
index de275ead0..1ae721f5d 100644
--- a/examples/celix-examples/hello_world_c/CMakeLists.txt
+++ b/examples/celix-examples/hello_world_c/CMakeLists.txt
@@ -21,9 +21,10 @@ add_celix_bundle(hello_world_c
 )
 
 add_celix_container(hello_world_c_container
+    C
     GROUP c_examples
     BUNDLES
         Celix::shell
         Celix::shell_tui
         hello_world_c
-)
\ No newline at end of file
+)
diff --git a/libs/framework/gtest/config.properties.in b/libs/framework/gtest/config.properties.in
index f5931a4a5..f594096d2 100644
--- a/libs/framework/gtest/config.properties.in
+++ b/libs/framework/gtest/config.properties.in
@@ -1,19 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
\ No newline at end of file
+{
+    "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
+    "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true
+}
diff --git a/libs/framework/gtest/framework1.properties.in b/libs/framework/gtest/framework1.properties.in
index 567d19732..1d72fbbd7 100644
--- a/libs/framework/gtest/framework1.properties.in
+++ b/libs/framework/gtest/framework1.properties.in
@@ -1,20 +1,5 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
-CELIX_FRAMEWORK_FRAMEWORK_CACHE_DIR=.cacheFramework1
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
+{
+    "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
+    "CELIX_FRAMEWORK_FRAMEWORK_CACHE_DIR":".cacheFramework1",
+    "LOGHELPER_ENABLE_STDOUT_FALLBACK":true
+}
diff --git a/libs/framework/gtest/framework2.properties.in b/libs/framework/gtest/framework2.properties.in
index 234b7a20e..d9ff4738e 100644
--- a/libs/framework/gtest/framework2.properties.in
+++ b/libs/framework/gtest/framework2.properties.in
@@ -1,20 +1,5 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
-CELIX_FRAMEWORK_FRAMEWORK_CACHE_DIR=.cacheFramework2
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
+{
+    "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
+    "CELIX_FRAMEWORK_FRAMEWORK_CACHE_DIR":".cacheFramework2",
+    "LOGHELPER_ENABLE_STDOUT_FALLBACK":true
+}
diff --git a/libs/framework/gtest/install_and_start_bundles.properties.in b/libs/framework/gtest/install_and_start_bundles.properties.in
index d51721efe..f7fdc6dca 100644
--- a/libs/framework/gtest/install_and_start_bundles.properties.in
+++ b/libs/framework/gtest/install_and_start_bundles.properties.in
@@ -1,29 +1,8 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
-
-#3 bundles, where 2 are valid and 1 non existing
-CELIX_AUTO_START_1=@SIMPLE_TEST_BUNDLE1@ @SIMPLE_TEST_BUNDLE2@ Invalid1.zip
-
-#3 bundles, 1 is valid, 1 non existing and 1 already started
-CELIX_AUTO_START_3=@SIMPLE_TEST_BUNDLE2@ @SIMPLE_TEST_BUNDLE3@ Invalid2.zip
-
-#4 bundles, 2 valid, 1 non existing and 1 already started
-CELIX_AUTO_INSTALL=@SIMPLE_TEST_BUNDLE3@ @SIMPLE_TEST_BUNDLE4@ @SIMPLE_TEST_BUNDLE5@ Invalid3.zip
+{
+    "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
+    "CELIX_AUTO_START_1":"@SIMPLE_TEST_BUNDLE1@ @SIMPLE_TEST_BUNDLE2@ Invalid1.zip",
+    "CELIX_AUTO_START_3":"@SIMPLE_TEST_BUNDLE2@ @SIMPLE_TEST_BUNDLE3@ Invalid2.zip",
+    "CELIX_AUTO_INSTALL":"@SIMPLE_TEST_BUNDLE3@ @SIMPLE_TEST_BUNDLE4@ @SIMPLE_TEST_BUNDLE5@ Invalid3.zip"
+}
 
 
diff --git a/libs/framework/src/celix_launcher.c b/libs/framework/src/celix_launcher.c
index e3a72e29c..2d2791292 100644
--- a/libs/framework/src/celix_launcher.c
+++ b/libs/framework/src/celix_launcher.c
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #ifndef CELIX_NO_CURLINIT
 #include <curl/curl.h>
@@ -45,6 +46,8 @@ static celix_properties_t* celixLauncher_createConfig(const char* configFile, ce
 static void celixLauncher_printUsage(char* progName);
 static void celixLauncher_printProperties(celix_properties_t* embeddedProps, const char* configFile);
 static int celixLauncher_createBundleCache(celix_properties_t* embeddedProperties, const char* configFile);
+static celix_status_t celixLauncher_loadConfigProperties(const char* configFile,
+                                                         celix_properties_t** outConfigProperties);
 
 #define DEFAULT_CONFIG_FILE "config.properties"
 
@@ -92,10 +95,6 @@ int celixLauncher_launchWithArgv(int argc,
         }
     }
 
-    if (configFile == NULL) {
-        configFile = DEFAULT_CONFIG_FILE;
-    }
-
     if (embeddedConfig == NULL) {
         embeddedConfig = celix_properties_create();
     }
@@ -187,7 +186,7 @@ static void celixLauncher_printUsage(char* progName) {
 }
 
 static void celixLauncher_printProperties(celix_properties_t* embeddedProps, const char* configFile) {
-    celix_properties_t* keys = celix_properties_create(); // only to store the keys
+    celix_autoptr(celix_properties_t) keys = celix_properties_create(); // only to store the keys
 
     printf("Embedded properties:\n");
     if (embeddedProps == NULL || celix_properties_size(embeddedProps) == 0) {
@@ -200,14 +199,9 @@ static void celixLauncher_printProperties(celix_properties_t* embeddedProps, con
     }
     printf("\n");
 
-    celix_properties_t* runtimeProps = NULL;
-    if (configFile != NULL) {
-        celix_status_t status = celix_properties_load2(configFile, 0, &runtimeProps);
-        if (status != CELIX_SUCCESS) {
-            celix_err_printErrors(stderr, "Error loading config file.", NULL);
-        }
-    }
-    printf("Runtime properties (input %s):\n", configFile);
+    celix_autoptr(celix_properties_t) runtimeProps;
+    (void)celixLauncher_loadConfigProperties(configFile, &runtimeProps);
+    printf("Runtime properties (input %s):\n", configFile ? configFile : "none");
     if (runtimeProps == NULL || celix_properties_size(runtimeProps) == 0) {
         printf("|- Empty!\n");
     } else {
@@ -233,15 +227,13 @@ static void celixLauncher_printProperties(celix_properties_t* embeddedProps, con
         }
     }
     printf("\n");
-
-    if (runtimeProps != NULL) {
-        celix_properties_destroy(runtimeProps);
-    }
-    celix_properties_destroy(keys);
 }
 
 static int celixLauncher_createBundleCache(celix_properties_t* embeddedProperties, const char* configFile) {
     celix_properties_t* config = celixLauncher_createConfig(configFile, embeddedProperties);
+    if (!config) {
+        return CELIX_LAUNCHER_ERROR_EXIT_CODE;
+    }
     celix_framework_t* fw = celix_frameworkFactory_createFramework(config);
     if (!fw) {
         fprintf(stderr, "Failed to create framework for bundle cache creation\n");
@@ -266,14 +258,37 @@ static celix_properties_t* celixLauncher_createConfig(const char* configFile, ce
     if (!embeddedProperties) {
         embeddedProperties = celix_properties_create();
     }
-
-    celix_autoptr(celix_properties_t) configProperties = NULL;
-    celix_status_t status = celix_properties_load2(configFile, 0, &configProperties);
+    celix_autoptr(celix_properties_t) configProperties;
+    celix_status_t status = celixLauncher_loadConfigProperties(configFile, &configProperties);
     if (status != CELIX_SUCCESS) {
-        fprintf(stderr, "Error loading config file %s\n", configFile);
         celix_properties_destroy(embeddedProperties);
         return NULL;
     }
     celixLauncher_combineProperties(embeddedProperties, configProperties);
     return embeddedProperties;
 }
+
+/**
+ * @brief Load the config properties from the given file.
+ * If configFile is NULL, config properties will only be loaded if DEFAULT_CONFIG_FILE exists.
+ */
+static celix_status_t celixLauncher_loadConfigProperties(const char* configFile,
+                                                         celix_properties_t** outConfigProperties) {
+    celix_properties_t* configProperties = NULL;
+    bool loadConfig = configFile != NULL;
+    if (!loadConfig) {
+        struct stat buffer;
+        loadConfig = stat(DEFAULT_CONFIG_FILE, &buffer) == 0;
+        configFile = DEFAULT_CONFIG_FILE;
+    }
+    if (loadConfig) {
+        celix_status_t status = celix_properties_load2(configFile, 0, &configProperties);
+        if (status != CELIX_SUCCESS) {
+            celix_err_printErrors(stderr, "Error loading config file: ", NULL);
+            *outConfigProperties = NULL;
+            return status;
+        }
+    }
+    *outConfigProperties = configProperties;
+    return CELIX_SUCCESS;
+}
diff --git a/libs/utils/gtest/CMakeLists.txt b/libs/utils/gtest/CMakeLists.txt
index 0d717e1fa..be04e0a75 100644
--- a/libs/utils/gtest/CMakeLists.txt
+++ b/libs/utils/gtest/CMakeLists.txt
@@ -56,8 +56,8 @@ if (CELIX_CXX17)
 endif ()
 
 ####### generating zip file used for testing ##########################################################################
-file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/zip_content/top.properties" CONTENT "level=1\n")
-file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/zip_content/subdir/sub.properties" CONTENT "level=2\n")
+file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/zip_content/top.properties" CONTENT "{\"level\":1}")
+file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/zip_content/subdir/sub.properties" CONTENT "{\"level\":2}")
 set(TEST_ZIP_FILE "${CMAKE_CURRENT_BINARY_DIR}/test.zip")
 if(ZIP_COMMAND)
     add_custom_command(OUTPUT ${TEST_ZIP_FILE}
diff --git a/misc/experimental/bundles/config_admin/config_admin_tst/config.properties.in b/misc/experimental/bundles/config_admin/config_admin_tst/config.properties.in
index d4db56716..0d3133d7e 100644
--- a/misc/experimental/bundles/config_admin/config_admin_tst/config.properties.in
+++ b/misc/experimental/bundles/config_admin/config_admin_tst/config.properties.in
@@ -1,20 +1,5 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-CELIX_FRAMEWORK_FRAMEWORK_CACHE_DIR=@config_admin_bundle_file@ @example_test_bundle_file@ @example_test2_bundle_file@
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE=true
\ No newline at end of file
+{
+    "CELIX_FRAMEWORK_FRAMEWORK_CACHE_DIR":"@config_admin_bundle_file@ @example_test_bundle_file@ @example_test2_bundle_file@",
+    "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
+    "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true
+}
\ No newline at end of file