(celix) branch feature/685-properties-json-serialization updated (3a761223 -> dbe1468d)

2024-05-20 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


from 3a761223 gh-685: Fix memleak and add missing test
 add dbe1468d gh-685: Add decode of unsupported JSON obj/array arrays

No new revisions were added by this update.

Summary of changes:
 .../PropertiesEncodingErrorInjectionTestSuite.cc   | 21 ++-
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 71 --
 libs/utils/include/celix/Properties.h  |  5 +-
 libs/utils/include/celix_properties.h  | 34 ++-
 libs/utils/src/properties_encoding.c   | 13 ++--
 5 files changed, 118 insertions(+), 26 deletions(-)



(celix) branch feature/685-properties-json-serialization updated (7aa44860 -> 3a761223)

2024-05-20 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


from 7aa44860 gh-685: Add JSON C++ save/load wrapper methods
 add 3a761223 gh-685: Fix memleak and add missing test

No new revisions were added by this update.

Summary of changes:
 libs/error_injector/jansson/CMakeLists.txt |  1 +
 libs/error_injector/jansson/include/jansson_ei.h   |  1 +
 libs/error_injector/jansson/src/jansson_ei.cc  |  7 ++
 .../PropertiesEncodingErrorInjectionTestSuite.cc   | 20 +++
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 16 
 libs/utils/gtest/src/PropertiesTestSuite.cc|  1 +
 libs/utils/include/celix_properties.h  | 13 ++
 libs/utils/src/properties_encoding.c   | 29 ++
 8 files changed, 72 insertions(+), 16 deletions(-)



(celix) branch feature/685-properties-json-serialization updated (19a22169 -> 7aa44860)

2024-04-16 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


from 19a22169 gh-685: Fix celix_properties_setVersion ei test
 add 7aa44860 gh-685: Add JSON C++ save/load wrapper methods

No new revisions were added by this update.

Summary of changes:
 .../PropertiesEncodingErrorInjectionTestSuite.cc   |  43 -
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc |  85 ++
 libs/utils/include/celix/Properties.h  | 179 -
 libs/utils/include/celix_properties.h  |   3 +-
 4 files changed, 306 insertions(+), 4 deletions(-)



(celix) branch feature/685-properties-json-serialization updated (c46a483b -> 19a22169)

2024-04-16 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


from c46a483b gh-685: Some whitespace corrections
 add 3437c045 gh-674: Add missing array list support to several 
celix_properties functions, add more tests.
 add d38f0b10 gh-674: Add missing test for celix_properties_setEntry.
 add 6a9713e0 gh-674: Rename array el type enum to string values
 add cb381850 Merge pull request #721 from 
apache/feature/674-improve-properties
 add 4f84298d Merge branch 'refs/heads/master' into 
feature/685-properties-json-serialization
 add 19a22169 gh-685: Fix celix_properties_setVersion ei test

No new revisions were added by this update.

Summary of changes:
 libs/utils/gtest/src/ArrayListTestSuite.cc | 21 +++-
 .../gtest/src/PropertiesErrorInjectionTestSuite.cc | 47 -
 libs/utils/gtest/src/PropertiesTestSuite.cc| 60 +++---
 libs/utils/include/celix_properties.h  | 13 +++--
 libs/utils/src/array_list.c| 14 ++---
 libs/utils/src/properties.c| 43 ++--
 6 files changed, 137 insertions(+), 61 deletions(-)



(celix) branch feature/devcontainer updated (9310ddcb -> dc8afe8f)

2024-04-16 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/devcontainer
in repository https://gitbox.apache.org/repos/asf/celix.git


from 9310ddcb Add devcontainer badge in README.md
 add dc8afe8f Update .devcontainer/devcontainer.json

No new revisions were added by this update.

Summary of changes:
 .devcontainer/devcontainer.json | 3 +++
 1 file changed, 3 insertions(+)



(celix) branch feature/685-properties-json-serialization updated: gh-685: Some whitespace corrections

2024-04-15 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/685-properties-json-serialization by this push:
 new c46a483b gh-685: Some whitespace corrections
c46a483b is described below

commit c46a483bc8031edc14e11739a8bec5aa7043e4ee
Author: Pepijn Noltes 
AuthorDate: Mon Apr 15 23:25:05 2024 +0200

gh-685: Some whitespace corrections
---
 conanfile.py| 2 +-
 libs/error_injector/jansson/src/jansson_ei.cc   | 2 +-
 libs/utils/error_injector/celix_version/src/celix_version_ei.cc | 2 +-
 libs/utils/gtest/src/PropertiesEncodingTestSuite.cc | 2 +-
 libs/utils/include/celix_utils.h| 9 -
 5 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/conanfile.py b/conanfile.py
index d8b46d01..dbf956ba 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -309,7 +309,7 @@ class CelixConan(ConanFile):
 self.options['openssl'].shared = True
 if self.options.build_celix_dfi:
 self.options['libffi'].shared = True
-if self.options.build_utils or  self.options.build_celix_dfi or 
self.options.build_celix_etcdlib:
+if self.options.build_utils or self.options.build_celix_dfi or 
self.options.build_celix_etcdlib:
 self.options['jansson'].shared = True
 
 def requirements(self):
diff --git a/libs/error_injector/jansson/src/jansson_ei.cc 
b/libs/error_injector/jansson/src/jansson_ei.cc
index 1d820629..515d4567 100644
--- a/libs/error_injector/jansson/src/jansson_ei.cc
+++ b/libs/error_injector/jansson/src/jansson_ei.cc
@@ -106,4 +106,4 @@ json_t* __wrap_json_sprintf(const char* fmt, ...) {
 return obj;
 }
 
-}
\ No newline at end of file
+}
diff --git a/libs/utils/error_injector/celix_version/src/celix_version_ei.cc 
b/libs/utils/error_injector/celix_version/src/celix_version_ei.cc
index ddcdf9f8..b09339cd 100644
--- a/libs/utils/error_injector/celix_version/src/celix_version_ei.cc
+++ b/libs/utils/error_injector/celix_version/src/celix_version_ei.cc
@@ -48,4 +48,4 @@ char* __wrap_celix_version_toString(const celix_version_t* 
version) {
 return __real_celix_version_toString(version);
 }
 
-}
\ No newline at end of file
+}
diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index 3e03b77e..4232131b 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -914,4 +914,4 @@ TEST_F(PropertiesSerializationTestSuite, 
SaveAndLoadFlatProperties) {
 
 // And the loaded properties are equal to the original properties
 EXPECT_TRUE(celix_properties_equals(props, loadedProps));
-}
\ No newline at end of file
+}
diff --git a/libs/utils/include/celix_utils.h b/libs/utils/include/celix_utils.h
index 6f58f2b7..19a4fd94 100644
--- a/libs/utils/include/celix_utils.h
+++ b/libs/utils/include/celix_utils.h
@@ -97,9 +97,7 @@ CELIX_UTILS_EXPORT void 
celix_utils_freeStringIfNotEqual(const char* buffer, cha
  * @brief Guard for a string created with celix_utils_writeOrCreateString, 
celix_utils_writeOrCreateVString.
  *
  * Can be used with celix_auto() to automatically and correctly free the 
string.
- * If the string is pointing to the buffer, the string should be freed, 
otherwise the string should be freed.
- *
- *
+ * If the string is pointing to the buffer, the string should not be freed, 
otherwise the string should be freed.
  */
 typedef struct celix_utils_string_guard {
 const char* buffer;
@@ -107,7 +105,8 @@ typedef struct celix_utils_string_guard {
 } celix_utils_string_guard_t;
 
 /**
- * @brief Initialize a guard for a string created with 
celix_utils_writeOrCreateString, celix_utils_writeOrCreateVString.
+ * @brief Initialize a guard for a string created with 
celix_utils_writeOrCreateString or
+ * celix_utils_writeOrCreateVString.
  *
  * De-initialize with celix_utils_stringGuard_deinit().
  *
@@ -115,7 +114,7 @@ typedef struct celix_utils_string_guard {
  * This is intended to be used with celix_auto().
  *
  * * Example:
-* ```
+ * ```
  * const char* possibleLongString = ...
  * char buffer[64];
  * char* str = celix_utils_writeOrCreateString(buffer, sizeof(buffer), "Hello 
%s", possibleLongString);



(celix) 02/02: gh-685: Add properties encoding documentation

2024-04-15 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit aa29987def9709f35b569280d61a2dd0aead5d12
Author: Pepijn Noltes 
AuthorDate: Mon Apr 15 23:17:21 2024 +0200

gh-685: Add properties encoding documentation
---
 documents/README.md  |   1 +
 documents/properties_encoding.md | 333 +++
 2 files changed, 334 insertions(+)

diff --git a/documents/README.md b/documents/README.md
index 3930498a..c174acbe 100644
--- a/documents/README.md
+++ b/documents/README.md
@@ -86,6 +86,7 @@ bundles contains binaries depending on the stdlibc++ library.
   * [Apache Celix C Patterns](c_patterns.md)
 * Utils
   * [Apache Celix Properties & Filter](properties_and_filter.md)
+  * [Apache Celix Properties Encoding](properties_encoding.md)
 * Framework 
   * [Apache Celix Bundles](bundles.md)
   * [Apache Celix Services](services.md)
diff --git a/documents/properties_encoding.md b/documents/properties_encoding.md
new file mode 100644
index ..c4cdb38d
--- /dev/null
+++ b/documents/properties_encoding.md
@@ -0,0 +1,333 @@
+---
+title: Apache Celix Properties Encoding
+---
+
+
+
+# Apache Celix Properties JSON Encoding
+
+## Introduction
+
+In Apache Celix, properties represent key-value pairs, often used for 
configuration. While these properties are not JSON
+objects inherently, they can be encoded to and decoded from JSON for 
interoperability or storage. This page explains how
+Apache Celix properties are encoded to and decoded from JSON.
+
+### Encoding limitations
+
+Except for empty arrays and the double values NaN, Infinity, and -Infinity, 
all Apache Celix properties types can
+be encoded to JSON.
+
+The reason for the empty array limitation is that for a properties array entry 
the array list element type is must be
+known, this is not possible to infer from an empty JSON array. To ensure that 
everything this is encoded, can be decoded
+again, a properties array entry with an empty array is not encoded to JSON.
+
+The reason for the double values NaN, Infinity, and -Infinity limitation is 
that JSON does not support these values.
+
+### Decoding limitations
+
+When decoding JSON to Apache Celix properties, the following limitations apply:
+
+- Mixed array types are not supported. For example, an array with both strings 
and longs cannot be decoded to a
+  properties' entry.
+- null values are not supported, because properties does not support a null 
value type.
+- Empty arrays are not supported, because the array list element type must be 
known, this is not possible to infer from
+  an empty JSON array.
+- JSON keys that collide on the created properties' key level are not 
supported.
+  See [Properties Decoding](##Properties Decoding) for more information.
+
+## Properties Encoding
+
+Apache Celix properties can be encoded to JSON using the 
`celix_properties_save`, `celix_properties_saveToStream`
+and `celix_properties_saveToString` functions. These functions take a 
properties object and encode it to a JSON object
+string. The encoding can be controlled using flags and can be done in a flat 
or nested structure.
+
+### Properties Flat Encoding
+
+By default, the encoding is done in a flat structure, because a flat structure 
ensures that all keys of the properties
+can be represented in JSON format. When properties are encoded to JSON in a 
flat structure, the reverse operation,
+decoding JSON that has been encoded from properties, will result in the same 
properties (except for the previously
+mentioned limitations (empty arrays and the double values NaN, Infinity, and 
-Infinity)).
+
+Flat Encoding example:
+
+```C
+#include 
+#include 
+
+int main() {
+celix_autoptr(celix_properties_t) props = celix_properties_create();
+
+celix_properties_set(props, "single/strKey", "strValue");
+celix_properties_setLong(props, "single/longKey", 42);
+celix_properties_setDouble(props, "single/doubleKey", 2.0);
+celix_properties_setBool(props, "single/boolKey", true);
+celix_properties_assignVersion(props, "single/versionKey", 
celix_version_create(1, 2, 3, "qualifier"));
+
+celix_array_list_t* strArr = celix_arrayList_createStringArray();
+celix_arrayList_addString(strArr, "value1");
+celix_arrayList_addString(strArr, "value2");
+celix_properties_assignArrayList(props, "array/stringArr", strArr);
+
+celix_array_list_t* longArr = celix_arrayList_createLongArray();
+celix_arrayList_addLong(longArr, 1);
+celix_arrayList_addLong(longArr, 2);
+celix_properties_assignArrayList(props, "array/longArr", longArr);
+
+celix_array_list_t* doubleArr = celix_arrayList_createDoubleArray();
+celix_arrayList_addDouble(doubleArr, 1.0);
+ce

(celix) branch feature/685-properties-json-serialization updated (ae4464ca -> aa29987d)

2024-04-15 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


from ae4464ca gh-685: Fix incorrect celix_autoptr usage
 new a4814f3f gh-685: Fix incorrect celix_autoptr usage
 new aa29987d gh-685: Add properties encoding documentation

The 2 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.


Summary of changes:
 documents/README.md|   1 +
 documents/properties_encoding.md   | 333 +
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc |  23 +-
 3 files changed, 344 insertions(+), 13 deletions(-)
 create mode 100644 documents/properties_encoding.md



(celix) 01/02: gh-685: Fix incorrect celix_autoptr usage

2024-04-15 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit a4814f3f4955fe0b260e2fc416849ef1eb1d82a0
Author: Pepijn Noltes 
AuthorDate: Mon Apr 15 23:05:01 2024 +0200

gh-685: Fix incorrect celix_autoptr usage
---
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 23 ++
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index 1b0035c0..3e03b77e 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -210,27 +210,23 @@ TEST_F(PropertiesSerializationTestSuite, 
SaveJPathKeysTest) {
 celix_properties_set(props, "object3/object4/key6", "value6");
 
 //And an in-memory stream
-celix_autofree char* buf = nullptr;
-size_t bufLen = 0;
-FILE* stream = open_memstream(, );
+celix_autofree char* output;
 
 //When saving the properties to the stream
-auto status = celix_properties_saveToStream(props, stream, 
CELIX_PROPERTIES_ENCODE_NESTED_STYLE);
+auto status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED_STYLE, );
 ASSERT_EQ(CELIX_SUCCESS, status);
 
 //Then the stream contains the JSON representation snippets of the 
properties
-fclose(stream);
-EXPECT_NE(nullptr, strstr(buf, R"("key1":"value1")")) << "JSON: " << buf;
-EXPECT_NE(nullptr, strstr(buf, R"("key2":"value2")")) << "JSON: " << buf;
-EXPECT_NE(nullptr, strstr(buf, 
R"("object1":{"key3":"value3","key4":"value4"})")) << "JSON: " << buf;
-EXPECT_NE(nullptr, strstr(buf, R"("object2":{"key5":"value5"})")) << 
"JSON: " << buf;
-EXPECT_NE(nullptr, strstr(buf, 
R"("object3":{"object4":{"key6":"value6"}})")) << "JSON: " << buf;
+EXPECT_NE(nullptr, strstr(output, R"("key1":"value1")")) << "JSON: " << 
output;
+EXPECT_NE(nullptr, strstr(output, R"("key2":"value2")")) << "JSON: " << 
output;
+EXPECT_NE(nullptr, strstr(output, 
R"("object1":{"key3":"value3","key4":"value4"})")) << "JSON: " << output;
+EXPECT_NE(nullptr, strstr(output, R"("object2":{"key5":"value5"})")) << 
"JSON: " << output;
+EXPECT_NE(nullptr, strstr(output, 
R"("object3":{"object4":{"key6":"value6"}})")) << "JSON: " << output;
 
 //And the buf is a valid JSON object
 json_error_t error;
-json_t* root = json_loads(buf, 0, );
+json_auto_t* root = json_loads(output, 0, );
 EXPECT_NE(nullptr, root) << "Unexpected JSON error: " << error.text;
-json_decref(root);
 }
 
 TEST_F(PropertiesSerializationTestSuite, SaveJPathKeysWithCollisionTest) {
@@ -374,7 +370,8 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithAndWithoutStrictFlagT
 ASSERT_EQ(CELIX_SUCCESS, status);
 
 //When saving the properties to a string with the strict flag
-status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_STRICT, );
+char* output2;
+status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_STRICT, );
 
 //Then the save fails, because the empty array generates an error
 ASSERT_EQ(CELIX_ILLEGAL_ARGUMENT, status);



(celix) branch feature/685-properties-json-serialization updated: gh-685: Fix incorrect celix_autoptr usage

2024-04-15 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/685-properties-json-serialization by this push:
 new ae4464ca gh-685: Fix incorrect celix_autoptr usage
ae4464ca is described below

commit ae4464ca46775eb69978d8bfc0de20564b5c553a
Author: Pepijn Noltes 
AuthorDate: Mon Apr 15 19:17:17 2024 +0200

gh-685: Fix incorrect celix_autoptr usage
---
 libs/utils/gtest/src/PropertiesEncodingTestSuite.cc | 6 +++---
 libs/utils/src/properties_encoding.c| 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index 0771aa3c..1b0035c0 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -659,7 +659,7 @@ TEST_F(PropertiesSerializationTestSuite, 
LoadPropertiesWithDuplicatesTest) {
 EXPECT_EQ(3, celix_properties_getLong(props, "key", 0));
 
 // When decoding the properties from the stream using a flog that does not 
allow duplicates
-celix_autoptr(celix_properties_t) props2;
+celix_properties_t* props2;
 status = celix_properties_loadFromString2(jsonInput, 
CELIX_PROPERTIES_DECODE_ERROR_ON_DUPLICATES, );
 
 // Then loading fails, because of a duplicate key
@@ -711,7 +711,7 @@ TEST_F(PropertiesSerializationTestSuite, 
LoadPropertiesEscapedSlashesTest) {
 EXPECT_STREQ("value7", celix_properties_getString(props, "object3/key4"));
 
 // When decoding the properties from a string using a flag that allows 
duplicates
-celix_autoptr(celix_properties_t) props2;
+celix_properties_t* props2;
 status = celix_properties_loadFromString2(jsonInput, 
CELIX_PROPERTIES_DECODE_ERROR_ON_DUPLICATES, );
 
 // Then loading fails, because of a duplicate key
@@ -722,7 +722,7 @@ TEST_F(PropertiesSerializationTestSuite, 
LoadPropertiesEscapedSlashesTest) {
 celix_err_printErrors(stderr, "Test Error: ", "\n");
 
 // When decoding the properties from a string using a flag that allows 
collisions
-celix_autoptr(celix_properties_t) props3;
+celix_properties_t* props3;
 status = celix_properties_loadFromString2(jsonInput, 
CELIX_PROPERTIES_DECODE_ERROR_ON_COLLISIONS, );
 
 // Then loading fails, because of a collision
diff --git a/libs/utils/src/properties_encoding.c 
b/libs/utils/src/properties_encoding.c
index eba39207..74103f48 100644
--- a/libs/utils/src/properties_encoding.c
+++ b/libs/utils/src/properties_encoding.c
@@ -519,6 +519,7 @@ celix_properties_decodeValue(celix_properties_t* props, 
const char* key, json_t*
 }
 
 static celix_status_t celix_properties_decodeFromJson(json_t* obj, int flags, 
celix_properties_t** out) {
+*out = NULL;
 if (!json_is_object(obj)) {
 celix_err_push("Expected json object.");
 return CELIX_ILLEGAL_ARGUMENT;



(celix) branch feature/685-properties-json-serialization updated: gh-685: Fix several memleaks in properties encoding

2024-04-14 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/685-properties-json-serialization by this push:
 new 0e589441 gh-685: Fix several memleaks in properties encoding
0e589441 is described below

commit 0e5894419921ddbb5f4c4868cf6e7c99b463bfd2
Author: Pepijn Noltes 
AuthorDate: Sun Apr 14 23:03:53 2024 +0200

gh-685: Fix several memleaks in properties encoding
---
 .../PropertiesEncodingErrorInjectionTestSuite.cc   |   8 +-
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 107 -
 libs/utils/include/celix_properties.h  |  52 +-
 libs/utils/src/properties_encoding.c   |  23 +++--
 4 files changed, 126 insertions(+), 64 deletions(-)

diff --git a/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
index 3bcc804e..2553e0e9 100644
--- a/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
@@ -69,7 +69,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
SaveErrorTest) {
 celix_ei_expect_open_memstream((void*)celix_properties_saveToString, 0, 
nullptr);
 
 //When I call celix_properties_saveToString
-char* out = nullptr;
+char* out;
 status = celix_properties_saveToString(props, 0, );
 
 //Then I expect an error
@@ -90,7 +90,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
EncodeErrorTest) {
 
celix_ei_expect_celix_utils_writeOrCreateString((void*)celix_properties_saveToString,
 2, nullptr);
 
 // And I call celix_properties_saveToString using NESTED encoding 
(whitebox-knowledge)
-char* out = nullptr;
+char* out;
 auto status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED_STYLE, );
 
 // Then I expect an error
@@ -149,7 +149,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
EncodeArrayErrorTest) {
 celix_ei_expect_json_array((void*)celix_properties_saveToString, 4, 
nullptr);
 
 // And I call celix_properties_saveToString
-char* out = nullptr;
+char* out;
 auto status = celix_properties_saveToString(props, 0, );
 
 // Then I expect an error
@@ -189,7 +189,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
EncodeVersionErrorTest) {
 celix_ei_expect_json_sprintf((void*)celix_properties_saveToString, 4, 
nullptr);
 
 // And I call celix_properties_saveToString
-char* out = nullptr;
+char* out;
 auto status = celix_properties_saveToString(props, 0, );
 
 // Then I expect an error
diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index d4ff8e17..0771aa3c 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -93,14 +93,17 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithNaNAndInfValuesTest)
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 celix_properties_setDouble(props, key, strtod(key, nullptr));
 
-//And an in-memory stream
-celix_autofree char* buf = nullptr;
-size_t bufLen = 0;
-FILE* stream = open_memstream(, );
+// Then saving the properties to a string succeeds, but value is not 
added to the JSON (because JSON does not
+// support NAN, INF and -INF)
+celix_autofree char* output;
+auto status = celix_properties_saveToString(props, 0, );
+ASSERT_EQ(CELIX_SUCCESS, status);
+EXPECT_STREQ("{}", output);
 
-//Then saving the properties to the stream fails, because JSON does 
not support NAN, INF and -INF
+//And saving the properties to a string with the flag 
CELIX_PROPERTIES_ENCODE_ERROR_ON_NAN_INF fails
 celix_err_resetErrors();
-auto status = celix_properties_saveToStream(props, stream, 0);
+char* output2;
+status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_ERROR_ON_NAN_INF, );
 EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
 
 //And an error msg is added to celix_err
@@ -112,25 +115,30 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithNaNAndInfValuesTest)
 TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithArrayListsTest) {
 // Given a properties object with array list values
 celix_autoptr(celix_properties_t) props = celix_properties_create();
+
 celix_array_list_t* list1 = celix_arrayList_createStringArray();
 celix_arrayList_addString(list1, "value1");
 celix_arrayList_addString(list1, "value2");
 celix_properties_assignArrayList(props, "key1", list1);
+
 celix_array_list_t*

(celix) branch feature/685-properties-json-serialization updated: gh-685: Refactor assert to prevent used var

2024-04-14 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/685-properties-json-serialization by this push:
 new ac2b1319 gh-685: Refactor assert to prevent used var
ac2b1319 is described below

commit ac2b13197f5cc863e4dd9e341a71c7188db2a533
Author: Pepijn Noltes 
AuthorDate: Sun Apr 14 19:48:16 2024 +0200

gh-685: Refactor assert to prevent used var

Also: Rename the nested / flat encoding style flag.
---
 conanfile.py   |   2 +-
 .../PropertiesEncodingErrorInjectionTestSuite.cc   |  10 +-
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc |  10 +-
 libs/utils/include/celix_properties.h  | 295 +++--
 libs/utils/src/properties_encoding.c   |  11 +-
 5 files changed, 283 insertions(+), 45 deletions(-)

diff --git a/conanfile.py b/conanfile.py
index 63d9ac00..d8b46d01 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -332,7 +332,7 @@ class CelixConan(ConanFile):
 self.requires("civetweb/1.16")
 if self.options.build_celix_dfi:
 self.requires("libffi/[>=3.2.1 <4.0.0]")
-if self.option.build_utils or self.options.build_celix_dfi or 
self.options.build_celix_etcdlib:
+if self.options.build_utils or self.options.build_celix_dfi or 
self.options.build_celix_etcdlib:
 self.requires("jansson/[>=2.12 <3.0.0]")
 if self.options.build_rsa_discovery_zeroconf:
 # TODO: To be replaced with mdnsresponder/1790.80.10, resolve some 
problems of mdnsresponder
diff --git a/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
index 9e2d3bc3..3bcc804e 100644
--- a/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc
@@ -91,7 +91,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
EncodeErrorTest) {
 
 // And I call celix_properties_saveToString using NESTED encoding 
(whitebox-knowledge)
 char* out = nullptr;
-auto status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED, );
+auto status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED_STYLE, );
 
 // Then I expect an error
 EXPECT_EQ(ENOMEM, status);
@@ -100,7 +100,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
EncodeErrorTest) {
 celix_ei_expect_json_object((void*)celix_properties_saveToString, 2, 
nullptr);
 
 // And I call celix_properties_saveToString using NESTED encoding 
(whitebox-knowledge)
-status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED, );
+status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED_STYLE, );
 
 // Then I expect an error
 EXPECT_EQ(ENOMEM, status);
@@ -109,7 +109,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
EncodeErrorTest) {
 celix_ei_expect_json_object_set_new((void*)celix_properties_saveToString, 
2, -1);
 
 // And I call celix_properties_saveToString using NESTED encoding 
(whitebox-knowledge)
-status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED, );
+status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED_STYLE, );
 
 // Then I expect an error
 EXPECT_EQ(ENOMEM, status);
@@ -118,7 +118,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
EncodeErrorTest) {
 celix_ei_expect_json_string((void*)celix_properties_saveToString, 3, 
nullptr);
 
 // And I call celix_properties_saveToString using NESTED encoding 
(whitebox-knowledge)
-status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED, );
+status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_NESTED_STYLE, );
 
 // Then I expect an error
 EXPECT_EQ(ENOMEM, status);
@@ -127,7 +127,7 @@ TEST_F(PropertiesEncodingErrorInjectionTestSuite, 
EncodeErrorTest) {
 celix_ei_expect_json_object_set_new((void*)celix_properties_saveToString, 
3, -1);
 
 // And I call celix_properties_saveToString using FLAT encoding 
(whitebox-knowledge)
-status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_FLAT, );
+status = celix_properties_saveToString(props, 
CELIX_PROPERTIES_ENCODE_FLAT_STYLE, );
 
 // 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 bece2147..d4ff8e17 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -206,7 +206,7 @@ TEST_F(PropertiesSerializationTestSuite, SaveJPathKeysTest) 
{
 FILE* stream 

(celix) branch feature/685-properties-json-serialization updated: gh-685: Separate version ei testing to prevent own ei code inteference

2024-04-14 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/685-properties-json-serialization by this push:
 new 56c67673 gh-685: Separate version ei testing to prevent own ei code 
inteference
56c67673 is described below

commit 56c67673b6d4dc15ac710113719389656246241d
Author: Pepijn Noltes 
AuthorDate: Sun Apr 14 19:34:09 2024 +0200

gh-685: Separate version ei testing to prevent own ei code inteference
---
 libs/utils/gtest/CMakeLists.txt | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libs/utils/gtest/CMakeLists.txt b/libs/utils/gtest/CMakeLists.txt
index 08be2b58..48f820a6 100644
--- a/libs/utils/gtest/CMakeLists.txt
+++ b/libs/utils/gtest/CMakeLists.txt
@@ -105,6 +105,19 @@ if (EI_TESTS)
 add_test(NAME test_utils_celix_err_with_ei COMMAND 
test_utils_celix_err_with_ei)
 setup_target_for_coverage(test_utils_celix_err_with_ei SCAN_DIR ..)
 
+#Note testing version seperated, otherwise version calls are already 
wrapped
+add_executable(test_utils_version_with_ei
+src/VersionErrorInjectionTestSuite.cc
+)
+target_link_libraries(test_utils_version_with_ei PRIVATE
+utils_cut
+Celix::malloc_ei
+Celix::asprintf_ei
+Celix::utils_ei
+GTest::gtest GTest::gtest_main
+)
+add_test(NAME test_utils_version_with_ei COMMAND 
test_utils_version_with_ei)
+setup_target_for_coverage(test_utils_version_with_ei SCAN_DIR ..)
 
 #Note testing array list seperated, otherwise array list calls are already 
wrapped
 add_executable(test_utils_array_list_with_ei
@@ -124,7 +137,6 @@ if (EI_TESTS)
 src/FileUtilsErrorInjectionTestSuite.cc
 src/ConvertUtilsErrorInjectionTestSuite.cc
 src/PropertiesErrorInjectionTestSuite.cc
-src/VersionErrorInjectionTestSuite.cc
 src/HashMapErrorInjectionTestSuite.cc
 src/FilterErrorInjectionTestSuite.cc
 src/PropertiesEncodingErrorInjectionTestSuite.cc



(celix) 03/03: gh-685: Add error injection test for properties encoding

2024-04-14 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 99e503aa62a02173818a7d518c102f7dd8edaa12
Author: Pepijn Noltes 
AuthorDate: Sun Apr 14 16:54:16 2024 +0200

gh-685: Add error injection test for properties encoding
---
 conanfile.py   |   4 +-
 libs/error_injector/jansson/CMakeLists.txt |   2 +
 libs/error_injector/jansson/include/jansson_ei.h   |   2 +
 libs/error_injector/jansson/src/jansson_ei.cc  |  58 ++--
 .../error_injector/celix_version/CMakeLists.txt|   1 +
 .../celix_version/include/celix_version_ei.h   |   2 +
 .../celix_version/src/celix_version_ei.cc  |   7 +
 libs/utils/gtest/CMakeLists.txt|   2 +
 .../PropertiesEncodingErrorInjectionTestSuite.cc   | 305 +
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc |  30 +-
 libs/utils/src/properties.c|   3 +-
 libs/utils/src/properties_encoding.c   |  53 ++--
 12 files changed, 403 insertions(+), 66 deletions(-)

diff --git a/conanfile.py b/conanfile.py
index 609082c8..63d9ac00 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -309,7 +309,7 @@ class CelixConan(ConanFile):
 self.options['openssl'].shared = True
 if self.options.build_celix_dfi:
 self.options['libffi'].shared = True
-if self.options.build_celix_dfi or self.options.build_celix_etcdlib:
+if self.options.build_utils or  self.options.build_celix_dfi or 
self.options.build_celix_etcdlib:
 self.options['jansson'].shared = True
 
 def requirements(self):
@@ -332,7 +332,7 @@ class CelixConan(ConanFile):
 self.requires("civetweb/1.16")
 if self.options.build_celix_dfi:
 self.requires("libffi/[>=3.2.1 <4.0.0]")
-if self.options.build_celix_dfi or self.options.build_celix_etcdlib:
+if self.option.build_utils or self.options.build_celix_dfi or 
self.options.build_celix_etcdlib:
 self.requires("jansson/[>=2.12 <3.0.0]")
 if self.options.build_rsa_discovery_zeroconf:
 # TODO: To be replaced with mdnsresponder/1790.80.10, resolve some 
problems of mdnsresponder
diff --git a/libs/error_injector/jansson/CMakeLists.txt 
b/libs/error_injector/jansson/CMakeLists.txt
index b536956a..b093901d 100644
--- a/libs/error_injector/jansson/CMakeLists.txt
+++ b/libs/error_injector/jansson/CMakeLists.txt
@@ -35,5 +35,7 @@ target_link_options(jansson_ei INTERFACE
 LINKER:--wrap,json_integer
 LINKER:--wrap,json_string
 LINKER:--wrap,json_real
+LINKER:--wrap,json_vsprintf
+LINKER:--wrap,json_sprintf
 )
 add_library(Celix::jansson_ei ALIAS jansson_ei)
diff --git a/libs/error_injector/jansson/include/jansson_ei.h 
b/libs/error_injector/jansson/include/jansson_ei.h
index 60f04e45..167ace85 100644
--- a/libs/error_injector/jansson/include/jansson_ei.h
+++ b/libs/error_injector/jansson/include/jansson_ei.h
@@ -34,6 +34,8 @@ CELIX_EI_DECLARE(json_array_append_new, int);
 CELIX_EI_DECLARE(json_integer, json_t*);
 CELIX_EI_DECLARE(json_string, json_t*);
 CELIX_EI_DECLARE(json_real, json_t*);
+CELIX_EI_DECLARE(json_vsprintf,json_t*);
+CELIX_EI_DECLARE(json_sprintf, json_t*);
 
 #ifdef __cplusplus
 }
diff --git a/libs/error_injector/jansson/src/jansson_ei.cc 
b/libs/error_injector/jansson/src/jansson_ei.cc
index 57033c0c..1d820629 100644
--- a/libs/error_injector/jansson/src/jansson_ei.cc
+++ b/libs/error_injector/jansson/src/jansson_ei.cc
@@ -23,69 +23,87 @@
 
 extern "C" {
 
-size_t __real_json_array_size(const json_t *array);
+size_t __real_json_array_size(const json_t* array);
 CELIX_EI_DEFINE(json_array_size, size_t)
-size_t __wrap_json_array_size(const json_t *array) {
+size_t __wrap_json_array_size(const json_t* array) {
 CELIX_EI_IMPL(json_array_size);
 return __real_json_array_size(array);
 }
 
-char *__real_json_dumps(const json_t *json, size_t flags);
+char* __real_json_dumps(const json_t* json, size_t flags);
 CELIX_EI_DEFINE(json_dumps, char*)
-char *__wrap_json_dumps(const json_t *json, size_t flags) {
+char* __wrap_json_dumps(const json_t* json, size_t flags) {
 CELIX_EI_IMPL(json_dumps);
 return __real_json_dumps(json, flags);
 }
 
-json_t *__real_json_object(void);
+json_t* __real_json_object(void);
 CELIX_EI_DEFINE(json_object, json_t*)
-json_t *__wrap_json_object(void) {
+json_t* __wrap_json_object(void) {
 CELIX_EI_IMPL(json_object);
 return __real_json_object();
 }
 
-int __real_json_object_set_new(json_t *object, const char *key, json_t *value);
+int __real_json_object_set_new(json_t* object, const char* key, json_t* value);
 CELIX_EI_DEFINE(json_object_set_new, int)
-int __wrap_json_object_set_new(json_t *object, const char *key, j

(celix) 02/03: gh-685: Add additional prop encoding test based on test cov

2024-04-14 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 0ceaeb8f0f7eddf0e05b156e6c61f583db07ea4b
Author: Pepijn Noltes 
AuthorDate: Sat Apr 13 19:59:35 2024 +0200

gh-685: Add additional prop encoding test based on test cov
---
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 132 +++--
 libs/utils/src/properties_encoding.c   |  86 +++---
 2 files changed, 161 insertions(+), 57 deletions(-)

diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index 84ed5d0a..b854e183 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -76,7 +76,7 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithSingleValuesTest) {
 EXPECT_NE(nullptr, strstr(buf, R"("key3":3)")) << "JSON: " << buf;
 EXPECT_NE(nullptr, strstr(buf, R"("key4":4.0)")) << "JSON: " << buf;
 EXPECT_NE(nullptr, strstr(buf, R"("key5":true)")) << "JSON: " << buf;
-EXPECT_NE(nullptr, strstr(buf, 
R"("key6":"celix_version<1.2.3.qualifier>")")) << "JSON: " << buf;
+EXPECT_NE(nullptr, strstr(buf, 
R"("key6":"version<1.2.3.qualifier>")")) << "JSON: " << buf;
 
 //And the buf is a valid JSON object
 json_error_t error;
@@ -150,7 +150,7 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithArrayListsTest) {
 EXPECT_NE(nullptr, strstr(buf, R"("key2":[1,2])")) << "JSON: " << buf;
 EXPECT_NE(nullptr, strstr(buf, R"("key3":[1.0,2.0])")) << "JSON: " << buf;
 EXPECT_NE(nullptr, strstr(buf, R"("key4":[true,false])")) << "JSON: " << 
buf;
-EXPECT_NE(nullptr, strstr(buf, 
R"("key5":["celix_version<1.2.3.qualifier>","celix_version<4.5.6.qualifier>"])"))
+EXPECT_NE(nullptr, strstr(buf, 
R"("key5":["version<1.2.3.qualifier>","version<4.5.6.qualifier>"])"))
 << "JSON: " << buf;
 
 // And the buf is a valid JSON object
@@ -260,9 +260,7 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithKeyNamesWithSlashesTe
 //Given a properties set with key names with slashes
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 celix_properties_set(props, "a/key/name/with/slashes", "value1");
-//TODO test separately celix_properties_set(props, "/", "value2");
 celix_properties_set(props, "/keyThatStartsWithSlash", "value3");
-//TODO test separately celix_properties_set(props, 
"//keyThatStartsWithDoubleSlashes", "value4");
 celix_properties_set(props, "keyThatEndsWithSlash/", "value5");
 celix_properties_set(props, "keyThatEndsWithDoubleSlashes//", "value6");
 celix_properties_set(props, "key//With//Double//Slashes", "value7");
@@ -397,6 +395,24 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithPrettyPrintTest) {
 EXPECT_STREQ(expected, output);
 }
 
+TEST_F(PropertiesSerializationTestSuite, SaveWithInvalidStreamTest) {
+celix_autoptr(celix_properties_t) properties = celix_properties_create();
+celix_properties_set(properties, "key", "value");
+
+// Saving properties with invalid stream will fail
+auto status = celix_properties_save(properties, 
"/non-existing/no/rights/file.json", 0);
+EXPECT_EQ(CELIX_FILE_IO_EXCEPTION, status);
+EXPECT_EQ(1, celix_err_getErrorCount());
+
+auto* readStream = fopen("/dev/null", "r");
+status = celix_properties_saveToStream(properties, readStream, 0);
+EXPECT_EQ(CELIX_FILE_IO_EXCEPTION, status);
+EXPECT_EQ(2, celix_err_getErrorCount());
+fclose(readStream);
+
+celix_err_printErrors(stderr, "Error: ", "\n");
+}
+
 TEST_F(PropertiesSerializationTestSuite, LoadEmptyPropertiesTest) {
 //Given an empty JSON object
 const char* json = "{}";
@@ -420,7 +436,7 @@ TEST_F(PropertiesSerializationTestSuite, 
LoadPropertiesWithSingleValuesTest) {
 "longKey":42,
 "doubleKey":2.0,
 "boolKey":true,
-"versionKey":"celix_version<1.2.3.qualifier>"
+"versionKey":"version<1.2.3.qualifier>&q

(celix) 01/03: gh-685: Add support for a flat and nested flag for prop encoding

2024-04-14 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 8e03a828be1f707df23b3fe77b62d491a3adf527
Author: Pepijn Noltes 
AuthorDate: Wed Apr 10 23:27:59 2024 +0200

gh-685: Add support for a flat and nested flag for prop encoding
---
 libs/utils/gtest/src/CelixUtilsTestSuite.cc|  32 ++
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 435 ++---
 libs/utils/include/celix_properties.h  |  81 ++--
 libs/utils/include/celix_utils.h   |  56 +++
 libs/utils/src/properties_encoding.c   | 208 +++---
 5 files changed, 588 insertions(+), 224 deletions(-)

diff --git a/libs/utils/gtest/src/CelixUtilsTestSuite.cc 
b/libs/utils/gtest/src/CelixUtilsTestSuite.cc
index 26bef64b..95e143d4 100644
--- a/libs/utils/gtest/src/CelixUtilsTestSuite.cc
+++ b/libs/utils/gtest/src/CelixUtilsTestSuite.cc
@@ -315,6 +315,38 @@ TEST_F(UtilsTestSuite, WriteOrCreateStringTest) {
 celix_utils_freeStringIfNotEqual(buffer2, out2);
 }
 
+TEST_F(UtilsTestSuite, WriteOrCreateStringGuardTest) {
+// Given a small buffer
+char buffer[16];
+
+{
+// When writing a string that fits in the buffer
+char* str = celix_utils_writeOrCreateString(buffer, sizeof(buffer), 
"abc");
+
+// Then the str is equal to the buffer (in this case no malloc was 
needed)
+EXPECT_EQ(buffer, str);
+
+// And using celix_auto with a string guard
+celix_auto(celix_utils_string_guard_t) guard = 
celix_utils_stringGuard_init(buffer, str);
+
+// Then the guard will not free the string when going out of scope
+}
+
+{
+// When writing a string that does not fit in the buffer
+char* str = celix_utils_writeOrCreateString(
+buffer, sizeof(buffer), 
"abc123def456ghi789jkl012mno345pqr678stu901vwx234yz");
+
+// Then the str is not equal to the buffer (in this case a malloc was 
needed)
+EXPECT_NE(buffer, str);
+
+// And using celix_auto with a string guard
+celix_auto(celix_utils_string_guard_t) guard = 
celix_utils_stringGuard_init(buffer, str);
+
+// Then the guard will free the string when going out of scope
+}
+}
+
 TEST_F(UtilsTestSuite, StrDupAndStrLenTest) {
 celix_autofree char* str = celix_utils_strdup("abc");
 ASSERT_NE(nullptr, str);
diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index d346f5f6..84ed5d0a 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -32,7 +32,7 @@ class PropertiesSerializationTestSuite : public 
::testing::Test {
 PropertiesSerializationTestSuite() { celix_err_resetErrors(); }
 };
 
-TEST_F(PropertiesSerializationTestSuite, EncodeEmptyPropertiesTest) {
+TEST_F(PropertiesSerializationTestSuite, SaveEmptyPropertiesTest) {
 //Given an empty properties object
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 
@@ -41,8 +41,8 @@ TEST_F(PropertiesSerializationTestSuite, 
EncodeEmptyPropertiesTest) {
 size_t bufLen = 0;
 FILE* stream = open_memstream(, );
 
-//When encoding the properties to the stream
-auto status = celix_properties_encodeToStream(props, stream, 0);
+//When saving the properties to the stream
+auto status = celix_properties_saveToStream(props, stream, 0);
 ASSERT_EQ(CELIX_SUCCESS, status);
 
 //Then the stream contains an empty JSON object
@@ -50,7 +50,7 @@ TEST_F(PropertiesSerializationTestSuite, 
EncodeEmptyPropertiesTest) {
 EXPECT_STREQ("{}", buf);
 }
 
-TEST_F(PropertiesSerializationTestSuite, EncodePropertiesWithSingleValuesTest) 
{
+TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithSingleValuesTest) {
 //Given a properties object with single values
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 celix_properties_set(props, "key1", "value1");
@@ -65,8 +65,8 @@ TEST_F(PropertiesSerializationTestSuite, 
EncodePropertiesWithSingleValuesTest) {
 size_t bufLen = 0;
 FILE* stream = open_memstream(, );
 
-//When encoding the properties to the stream
-auto status = celix_properties_encodeToStream(props, stream, 0);
+//When saving the properties to the stream
+auto status = celix_properties_saveToStream(props, stream, 0);
 ASSERT_EQ(CELIX_SUCCESS, status);
 
 //Then the stream contains the JSON representation snippets of the 
properties
@@ -85,7 +85,7 @@ TEST_F(PropertiesSerializationTestSuite, 
EncodePropertiesWithSingleValuesTest) {
 json_decref(root);
 }
 
-TEST_F(PropertiesSerializationTestSuite, 
EncodePropertiesWithNaNAndInfValuesTest) {
+TEST_F(PropertiesSe

(celix) branch feature/685-properties-json-serialization updated (72c785df -> 99e503aa)

2024-04-14 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


from 72c785df gh-685: Add initial setup for properties decode flags
 new 8e03a828 gh-685: Add support for a flat and nested flag for prop 
encoding
 new 0ceaeb8f gh-685: Add additional prop encoding test based on test cov
 new 99e503aa gh-685: Add error injection test for properties encoding

The 3 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.


Summary of changes:
 conanfile.py   |   4 +-
 libs/error_injector/jansson/CMakeLists.txt |   2 +
 libs/error_injector/jansson/include/jansson_ei.h   |   2 +
 libs/error_injector/jansson/src/jansson_ei.cc  |  58 ++-
 .../error_injector/celix_version/CMakeLists.txt|   1 +
 .../celix_version/include/celix_version_ei.h   |   2 +
 .../celix_version/src/celix_version_ei.cc  |   7 +
 libs/utils/gtest/CMakeLists.txt|   2 +
 libs/utils/gtest/src/CelixUtilsTestSuite.cc|  32 ++
 .../PropertiesEncodingErrorInjectionTestSuite.cc   | 305 +++
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 571 +++--
 libs/utils/include/celix_properties.h  |  81 ++-
 libs/utils/include/celix_utils.h   |  56 ++
 libs/utils/src/properties.c|   3 +-
 libs/utils/src/properties_encoding.c   | 301 +++
 15 files changed, 1116 insertions(+), 311 deletions(-)
 create mode 100644 
libs/utils/gtest/src/PropertiesEncodingErrorInjectionTestSuite.cc



(celix) 05/06: gh-685: Rename prop serialization sources to prop encoding

2024-04-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 77cd6b37e7bae39663b20dee7c6fb31593a00c89
Author: Pepijn Noltes 
AuthorDate: Tue Apr 9 20:05:33 2024 +0200

gh-685: Rename prop serialization sources to prop encoding
---
 libs/utils/CMakeLists.txt   | 2 +-
 libs/utils/gtest/CMakeLists.txt | 2 +-
 ...opertiesSerializationTestSuite.cc => PropertiesEncodingTestSuite.cc} | 0
 libs/utils/src/{properties_serialization.c => properties_encoding.c}| 0
 4 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt
index 4180b48b..cec80f41 100644
--- a/libs/utils/CMakeLists.txt
+++ b/libs/utils/CMakeLists.txt
@@ -30,7 +30,7 @@ if (UTILS)
 src/version.c
 src/version_range.c
 src/properties.c
-src/properties_serialization.c
+src/properties_encoding.c
 src/utils.c
 src/filter.c
 src/celix_log_level.c
diff --git a/libs/utils/gtest/CMakeLists.txt b/libs/utils/gtest/CMakeLists.txt
index 62c1ac0c..11c6ec00 100644
--- a/libs/utils/gtest/CMakeLists.txt
+++ b/libs/utils/gtest/CMakeLists.txt
@@ -29,7 +29,7 @@ add_executable(test_utils
 src/CelixUtilsTestSuite.cc
 src/ConvertUtilsTestSuite.cc
 src/PropertiesTestSuite.cc
-src/PropertiesSerializationTestSuite.cc
+src/PropertiesEncodingTestSuite.cc
 src/VersionTestSuite.cc
 src/ErrTestSuite.cc
 src/ThreadsTestSuite.cc
diff --git a/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
similarity index 100%
rename from libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
rename to libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
diff --git a/libs/utils/src/properties_serialization.c 
b/libs/utils/src/properties_encoding.c
similarity index 100%
rename from libs/utils/src/properties_serialization.c
rename to libs/utils/src/properties_encoding.c



(celix) 03/06: gh-685: Add json prop loading for primitive and initial arr.

2024-04-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit de0725649450bcbcfbc8145d652b7fb0ea6f0716
Author: Pepijn Noltes 
AuthorDate: Mon Apr 8 23:03:03 2024 +0200

gh-685: Add json prop loading for primitive and initial arr.
---
 .../gtest/src/PropertiesSerializationTestSuite.cc  | 311 ++-
 libs/utils/src/properties_serialization.c  | 420 ++---
 2 files changed, 653 insertions(+), 78 deletions(-)

diff --git a/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc 
b/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
index 99cbeceb..a5d6a1df 100644
--- a/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+#include 
 #include 
 #include 
 
@@ -49,23 +50,7 @@ TEST_F(PropertiesSerializationTestSuite, 
SaveEmptyPropertiesTest) {
 EXPECT_STREQ("{}", buf);
 }
 
-TEST_F(PropertiesSerializationTestSuite, LoadEmptyPropertiesTest) {
-//Given an empty JSON object
-const char* json = "{}";
-FILE* stream = fmemopen((void*)json, strlen(json), "r");
-
-//When loading the properties from the stream
-celix_autoptr(celix_properties_t) props = nullptr;
-auto status = celix_properties_loadFromStream(stream, );
-EXPECT_EQ(CELIX_SUCCESS, status);
-
-//Then the properties object is empty
-EXPECT_EQ(0, celix_properties_size(props));
-
-fclose(stream);
-}
-
-TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithSingelValuesTest) {
+TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithSingleValuesTest) {
 //Given a properties object with single values
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 celix_properties_set(props, "key1", "value1");
@@ -102,14 +87,115 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithSingelValuesTest) {
 json_decref(root);
 }
 
+TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithNaNAndInfValuesTest) {
+//Given a NAN, INF and -INF value
+auto keys = {"NAN", "INF", "-INF"};
+for (const auto& key : keys) {
+//For every value
+
+//Given a properties object with a NAN, INF or -INF value
+celix_autoptr(celix_properties_t) props = celix_properties_create();
+celix_properties_setDouble(props, key, strtod(key, nullptr));
+
+//And an in-memory stream
+celix_autofree char* buf = nullptr;
+size_t bufLen = 0;
+FILE* stream = open_memstream(, );
+
+//Then saving the properties to the stream fails, because JSON does 
not support NAN, INF and -INF
+celix_err_resetErrors();
+auto status = celix_properties_saveToStream(props, stream);
+EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
+
+//And an error msg is added to celix_err
+EXPECT_EQ(1, celix_err_getErrorCount());
+}
+}
+
+
 TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithArrayListsTest) {
-//Given a properties object with array list values
+// Given a properties object with array list values
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 celix_array_list_t* list1 = celix_arrayList_createStringArray();
 celix_arrayList_addString(list1, "value1");
 celix_arrayList_addString(list1, "value2");
 celix_properties_assignArrayList(props, "key1", list1);
-//TODO long, double, bool, version
+celix_array_list_t* list2 = celix_arrayList_createLongArray();
+celix_arrayList_addLong(list2, 1);
+celix_arrayList_addLong(list2, 2);
+celix_properties_assignArrayList(props, "key2", list2);
+celix_array_list_t* list3 = celix_arrayList_createDoubleArray();
+celix_arrayList_addDouble(list3, 1.0);
+celix_arrayList_addDouble(list3, 2.0);
+celix_properties_assignArrayList(props, "key3", list3);
+celix_array_list_t* list4 = celix_arrayList_createBoolArray();
+celix_arrayList_addBool(list4, true);
+celix_arrayList_addBool(list4, false);
+celix_properties_assignArrayList(props, "key4", list4);
+celix_array_list_t* list5 = celix_arrayList_createVersionArray();
+celix_arrayList_addVersion(list5, celix_version_create(1, 2, 3, 
"qualifier"));
+celix_arrayList_addVersion(list5, celix_version_create(4, 5, 6, 
"qualifier"));
+celix_properties_assignArrayList(props, "key5", list5);
+
+// And an in-memory stream
+celix_autofree char* buf = nullptr;
+size_t bufLen = 0;
+FILE* stream = open_memstream(, );
+
+// When saving the properties to the stream
+auto status = celix_properties_saveToStream(props, stream);
+  

(celix) 06/06: gh-685: Add initial setup for properties decode flags

2024-04-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 72c785dfc706630c87322604b4363542ed9c0f5f
Author: Pepijn Noltes 
AuthorDate: Tue Apr 9 23:16:02 2024 +0200

gh-685: Add initial setup for properties decode flags
---
 .../utils/gtest/src/PropertiesEncodingTestSuite.cc | 197 +++--
 libs/utils/gtest/src/PropertiesTestSuite.cc|   7 +
 libs/utils/include/celix_properties.h  |  14 +-
 libs/utils/src/properties_encoding.c   |  81 ++---
 4 files changed, 217 insertions(+), 82 deletions(-)

diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc 
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index 4aa2469d..d346f5f6 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -252,6 +252,49 @@ TEST_F(PropertiesSerializationTestSuite, 
EncodeJPathKeysWithCollisionTest) {
 json_decref(root);
 }
 
+
+//TODO check desired behaviour, currently every "/" leads to a new object 
(except if an collision occurs)
+//TEST_F(PropertiesSerializationTestSuite, 
EncodePropertiesWithSpecialKeyNamesTest) {
+////Given a properties set with special key names (slashes)
+//celix_autoptr(celix_properties_t) props = celix_properties_create();
+//celix_properties_set(props, "/", "value1");
+//celix_properties_set(props, "keyThatEndsWithSlash/", "value2");
+//celix_properties_set(props, "key//With//Double//Slash", "value3");
+//celix_properties_set(props, "object/", "value5");
+//celix_properties_set(props, "object//", "value4");
+//celix_properties_set(props, "object/keyThatEndsWithSlash/", "value6");
+//celix_properties_set(props, "object/key//With//Double//Slash", "value7");
+//
+////And an in-memory stream
+//celix_autofree char* buf = nullptr;
+//size_t bufLen = 0;
+//FILE* stream = open_memstream(, );
+//
+////When encoding the properties to the stream
+//auto status = celix_properties_encodeToStream(props, stream, 0);
+//ASSERT_EQ(CELIX_SUCCESS, status);
+//
+//std::cout << buf << std::endl;
+//
+////Then the stream contains the JSON representation snippets of the 
properties
+//fclose(stream);
+//EXPECT_NE(nullptr, strstr(buf, R"("/":"value1")")) << "JSON: " << buf;
+//EXPECT_NE(nullptr, strstr(buf, R"("keyThatEndsWithSlash/":"value2")")) 
<< "JSON: " << buf;
+//EXPECT_NE(nullptr, strstr(buf, 
R"("key//With//Double//Slash":"value3")")) << "JSON: " << buf;
+//EXPECT_NE(nullptr, strstr(buf, R"("object/":"value5")")) << "JSON: " << 
buf;
+//EXPECT_NE(nullptr, strstr(buf, R"("/":"value5")")) << "JSON: " << buf; 
//child of object
+//EXPECT_NE(nullptr, strstr(buf, R"("keyThatEndsWithSlash/":"value6")")) 
<< "JSON: " << buf; //child of object
+//EXPECT_NE(nullptr, strstr(buf, 
R"("key//With//Double//Slash":"value7")")) << "JSON: " << buf; //child of object
+//
+//
+////And the buf is a valid JSON object
+//json_error_t error;
+//json_t* root = json_loads(buf, 0, );
+//EXPECT_NE(nullptr, root) << "Unexpected JSON error: " << error.text;
+//json_decref(root);
+//}
+
+
 TEST_F(PropertiesSerializationTestSuite, DecodeEmptyPropertiesTest) {
 //Given an empty JSON object
 const char* json = "{}";
@@ -392,8 +435,6 @@ TEST_F(PropertiesSerializationTestSuite, 
DecodePropertiesWithInvalidInputTest) {
 R"({)",// invalid JSON (caught by jansson)
 R"([])",   // unsupported JSON (top level 
array not supported)
 R"(42)",   // invalid JSON (caught by jansson)
-R"({"mixedArr":["string", true]})", // Mixed array, not supported
-R"({"key1":null})", // Null value, not supported
 };
 for (auto& invalidInput: invalidInputs) {
 //Given an invalid JSON object
@@ -477,7 +518,9 @@ TEST_F(PropertiesSerializationTestSuite, 
DecodePropertiesWithNestedObjectsAndJPa
 "key1":true
 }
 },
-"object1/object2/key1":6
+"object1/object2/key1":6,
+"key2":2,
+"key

(celix) 02/06: gh-685: Add jansson dep for simple properties save/load

2024-04-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 9511610bb2c7379570c1bd3a9705202c0723a865
Author: Pepijn Noltes 
AuthorDate: Tue Apr 2 20:25:09 2024 +0200

gh-685: Add jansson dep for simple properties save/load
---
 libs/utils/CMakeLists.txt  |   3 +-
 .../gtest/src/PropertiesSerializationTestSuite.cc  |  70 -
 libs/utils/src/properties.c|   2 +-
 libs/utils/src/properties_serialization.c  | 112 -
 4 files changed, 180 insertions(+), 7 deletions(-)

diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt
index 064c9683..4180b48b 100644
--- a/libs/utils/CMakeLists.txt
+++ b/libs/utils/CMakeLists.txt
@@ -18,6 +18,7 @@
 celix_subproject(UTILS "Option to enable building the Utilities library" ON)
 if (UTILS)
 find_package(libzip REQUIRED)
+find_package(jansson REQUIRED) #TODO add jansson dep info to build (conan) 
and documentation info
 
 set(MEMSTREAM_SOURCES )
 set(MEMSTREAM_INCLUDES )
@@ -42,7 +43,7 @@ if (UTILS)
 src/celix_cleanup.c
 ${MEMSTREAM_SOURCES}
 )
-set(UTILS_PRIVATE_DEPS libzip::zip)
+set(UTILS_PRIVATE_DEPS libzip::zip jansson::jansson)
 set(UTILS_PUBLIC_DEPS)
 
 add_library(utils SHARED ${UTILS_SRC})
diff --git a/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc 
b/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
index d3bf6aa0..99cbeceb 100644
--- a/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
@@ -18,9 +18,11 @@
  */
 
 #include 
+#include 
 
 #include "celix_err.h"
 #include "celix_properties.h"
+#include "celix_stdlib_cleanup.h"
 
 using ::testing::MatchesRegex;
 
@@ -34,7 +36,7 @@ TEST_F(PropertiesSerializationTestSuite, 
SaveEmptyPropertiesTest) {
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 
 //And an in-memory stream
-char* buf = nullptr;
+celix_autofree char* buf = nullptr;
 size_t bufLen = 0;
 FILE* stream = open_memstream(, );
 
@@ -62,3 +64,69 @@ TEST_F(PropertiesSerializationTestSuite, 
LoadEmptyPropertiesTest) {
 
 fclose(stream);
 }
+
+TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithSingelValuesTest) {
+//Given a properties object with single values
+celix_autoptr(celix_properties_t) props = celix_properties_create();
+celix_properties_set(props, "key1", "value1");
+celix_properties_set(props, "key2", "value2");
+celix_properties_setLong(props, "key3", 3);
+celix_properties_setDouble(props, "key4", 4.0);
+celix_properties_setBool(props, "key5", true);
+celix_properties_assignVersion(props, "key6", celix_version_create(1, 
2, 3, "qualifier"));
+
+//And an in-memory stream
+celix_autofree char* buf = nullptr;
+size_t bufLen = 0;
+FILE* stream = open_memstream(, );
+
+//When saving the properties to the stream
+auto status = celix_properties_saveToStream(props, stream);
+EXPECT_EQ(CELIX_SUCCESS, status);
+
+//Then the stream contains the JSON representation snippets of the 
properties
+fclose(stream);
+EXPECT_NE(nullptr, strstr(buf, R"("key1":"value1")")) << "JSON: " << 
buf;
+EXPECT_NE(nullptr, strstr(buf, R"("key2":"value2")")) << "JSON: " << 
buf;
+EXPECT_NE(nullptr, strstr(buf, R"("key3":3)")) << "JSON: " << buf;
+EXPECT_NE(nullptr, strstr(buf, R"("key4":4.0)")) << "JSON: " << buf;
+EXPECT_NE(nullptr, strstr(buf, R"("key5":true)")) << "JSON: " << buf;
+
+//TODO how are versions serialized? A string representation is needed 
to reconstruct the version from JSON
+EXPECT_NE(nullptr, strstr(buf, 
R"("key6":"celix_version<1.2.3.qualifier>")")) << "JSON: " << buf;
+
+//And the buf is a valid JSON object
+json_error_t error;
+json_t* root = json_loads(buf, 0, );
+EXPECT_NE(nullptr, root) << "Unexpected JSON error: " << error.text;
+json_decref(root);
+}
+
+TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithArrayListsTest) {
+//Given a properties object with array list values
+celix_autoptr(celix_properties_t) props = celix_properties_create();
+celix_array_list_t* list1 = celix_arrayList_createStringArray();
+celi

(celix) 01/06: gh-685: Initial properties save/load setup

2024-04-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 3acdb746e55738f45134a6412602f66fc9b80a39
Author: Pepijn Noltes 
AuthorDate: Mon Apr 1 20:28:02 2024 +0200

gh-685: Initial properties save/load setup
---
 libs/utils/CMakeLists.txt  |  1 +
 libs/utils/gtest/CMakeLists.txt|  1 +
 .../gtest/src/PropertiesSerializationTestSuite.cc  | 64 ++
 libs/utils/include/celix_properties.h  |  6 ++
 libs/utils/src/properties_serialization.c  | 35 
 5 files changed, 107 insertions(+)

diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt
index e1b49835..064c9683 100644
--- a/libs/utils/CMakeLists.txt
+++ b/libs/utils/CMakeLists.txt
@@ -29,6 +29,7 @@ if (UTILS)
 src/version.c
 src/version_range.c
 src/properties.c
+src/properties_serialization.c
 src/utils.c
 src/filter.c
 src/celix_log_level.c
diff --git a/libs/utils/gtest/CMakeLists.txt b/libs/utils/gtest/CMakeLists.txt
index d04f9e30..62c1ac0c 100644
--- a/libs/utils/gtest/CMakeLists.txt
+++ b/libs/utils/gtest/CMakeLists.txt
@@ -29,6 +29,7 @@ add_executable(test_utils
 src/CelixUtilsTestSuite.cc
 src/ConvertUtilsTestSuite.cc
 src/PropertiesTestSuite.cc
+src/PropertiesSerializationTestSuite.cc
 src/VersionTestSuite.cc
 src/ErrTestSuite.cc
 src/ThreadsTestSuite.cc
diff --git a/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc 
b/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
new file mode 100644
index ..d3bf6aa0
--- /dev/null
+++ b/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+#include 
+
+#include "celix_err.h"
+#include "celix_properties.h"
+
+using ::testing::MatchesRegex;
+
+class PropertiesSerializationTestSuite : public ::testing::Test {
+  public:
+PropertiesSerializationTestSuite() { celix_err_resetErrors(); }
+};
+
+TEST_F(PropertiesSerializationTestSuite, SaveEmptyPropertiesTest) {
+//Given an empty properties object
+celix_autoptr(celix_properties_t) props = celix_properties_create();
+
+//And an in-memory stream
+char* buf = nullptr;
+size_t bufLen = 0;
+FILE* stream = open_memstream(, );
+
+//When saving the properties to the stream
+auto status = celix_properties_saveToStream(props, stream);
+EXPECT_EQ(CELIX_SUCCESS, status);
+
+//Then the stream contains an empty JSON object
+fclose(stream);
+EXPECT_STREQ("{}", buf);
+}
+
+TEST_F(PropertiesSerializationTestSuite, LoadEmptyPropertiesTest) {
+//Given an empty JSON object
+const char* json = "{}";
+FILE* stream = fmemopen((void*)json, strlen(json), "r");
+
+//When loading the properties from the stream
+celix_autoptr(celix_properties_t) props = nullptr;
+auto status = celix_properties_loadFromStream(stream, );
+EXPECT_EQ(CELIX_SUCCESS, status);
+
+//Then the properties object is empty
+EXPECT_EQ(0, celix_properties_size(props));
+
+fclose(stream);
+}
diff --git a/libs/utils/include/celix_properties.h 
b/libs/utils/include/celix_properties.h
index 39e87c66..5903ecaa 100644
--- a/libs/utils/include/celix_properties.h
+++ b/libs/utils/include/celix_properties.h
@@ -180,6 +180,12 @@ CELIX_UTILS_EXPORT celix_status_t 
celix_properties_store(celix_properties_t* pro
  const char* file,
  const char* header);
 
+//TODO doc
+CELIX_UTILS_EXPORT celix_status_t celix_properties_saveToStream(const 
celix_properties_t* properties, FILE* stream);
+
+//TODO doc
+CELIX_UTILS_EXPORT celix_status_t celix_properties_loadFromStream(FILE* 
stream, celix_properties_t** out);
+
 /**
  * @brief Get the entry for a given key in a property set.
  *
diff --git a/libs/utils/src/properties_seri

(celix) 04/06: gh-685: Add support for nested obj properties decoding

2024-04-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 04bccbd3741e427b52790d4bfc3659f9e30c1583
Author: Pepijn Noltes 
AuthorDate: Tue Apr 9 20:03:50 2024 +0200

gh-685: Add support for nested obj properties decoding
---
 .../gtest/src/PropertiesSerializationTestSuite.cc  | 246 -
 libs/utils/include/celix_properties.h  |  21 +-
 libs/utils/src/properties_serialization.c  |  72 --
 3 files changed, 262 insertions(+), 77 deletions(-)

diff --git a/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc 
b/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
index a5d6a1df..4aa2469d 100644
--- a/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesSerializationTestSuite.cc
@@ -32,7 +32,7 @@ class PropertiesSerializationTestSuite : public 
::testing::Test {
 PropertiesSerializationTestSuite() { celix_err_resetErrors(); }
 };
 
-TEST_F(PropertiesSerializationTestSuite, SaveEmptyPropertiesTest) {
+TEST_F(PropertiesSerializationTestSuite, EncodeEmptyPropertiesTest) {
 //Given an empty properties object
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 
@@ -41,16 +41,16 @@ TEST_F(PropertiesSerializationTestSuite, 
SaveEmptyPropertiesTest) {
 size_t bufLen = 0;
 FILE* stream = open_memstream(, );
 
-//When saving the properties to the stream
-auto status = celix_properties_saveToStream(props, stream);
-EXPECT_EQ(CELIX_SUCCESS, status);
+//When encoding the properties to the stream
+auto status = celix_properties_encodeToStream(props, stream, 0);
+ASSERT_EQ(CELIX_SUCCESS, status);
 
 //Then the stream contains an empty JSON object
 fclose(stream);
 EXPECT_STREQ("{}", buf);
 }
 
-TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithSingleValuesTest) {
+TEST_F(PropertiesSerializationTestSuite, EncodePropertiesWithSingleValuesTest) 
{
 //Given a properties object with single values
 celix_autoptr(celix_properties_t) props = celix_properties_create();
 celix_properties_set(props, "key1", "value1");
@@ -65,9 +65,9 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithSingleValuesTest) {
 size_t bufLen = 0;
 FILE* stream = open_memstream(, );
 
-//When saving the properties to the stream
-auto status = celix_properties_saveToStream(props, stream);
-EXPECT_EQ(CELIX_SUCCESS, status);
+//When encoding the properties to the stream
+auto status = celix_properties_encodeToStream(props, stream, 0);
+ASSERT_EQ(CELIX_SUCCESS, status);
 
 //Then the stream contains the JSON representation snippets of the 
properties
 fclose(stream);
@@ -76,8 +76,6 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithSingleValuesTest) {
 EXPECT_NE(nullptr, strstr(buf, R"("key3":3)")) << "JSON: " << buf;
 EXPECT_NE(nullptr, strstr(buf, R"("key4":4.0)")) << "JSON: " << buf;
 EXPECT_NE(nullptr, strstr(buf, R"("key5":true)")) << "JSON: " << buf;
-
-//TODO how are versions serialized? A string representation is needed 
to reconstruct the version from JSON
 EXPECT_NE(nullptr, strstr(buf, 
R"("key6":"celix_version<1.2.3.qualifier>")")) << "JSON: " << buf;
 
 //And the buf is a valid JSON object
@@ -87,7 +85,7 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithSingleValuesTest) {
 json_decref(root);
 }
 
-TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithNaNAndInfValuesTest) {
+TEST_F(PropertiesSerializationTestSuite, 
EncodePropertiesWithNaNAndInfValuesTest) {
 //Given a NAN, INF and -INF value
 auto keys = {"NAN", "INF", "-INF"};
 for (const auto& key : keys) {
@@ -104,7 +102,7 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithNaNAndInfValuesTest)
 
 //Then saving the properties to the stream fails, because JSON does 
not support NAN, INF and -INF
 celix_err_resetErrors();
-auto status = celix_properties_saveToStream(props, stream);
+auto status = celix_properties_encodeToStream(props, stream, 0);
 EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
 
 //And an error msg is added to celix_err
@@ -113,7 +111,7 @@ TEST_F(PropertiesSerializationTestSuite, 
SavePropertiesWithNaNAndInfValuesTest)
 }
 
 
-TEST_F(PropertiesSerializationTestSuite, SavePropertiesWithArrayListsTest) {
+TEST_F(PropertiesSerializationTestSuite, EncodePropertiesWithArrayListsTest) {
 // Given a properties object with array list values
 celix_

(celix) branch feature/685-properties-json-serialization created (now 72c785df)

2024-04-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git


  at 72c785df gh-685: Add initial setup for properties decode flags

This branch includes the following new commits:

 new 3acdb746 gh-685: Initial properties save/load setup
 new 9511610b gh-685: Add jansson dep for simple properties save/load
 new de072564 gh-685: Add json prop loading for primitive and initial arr.
 new 04bccbd3 gh-685: Add support for nested obj properties decoding
 new 77cd6b37 gh-685: Rename prop serialization sources to prop encoding
 new 72c785df gh-685: Add initial setup for properties decode flags

The 6 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/01: Merge pull request #721 from apache/feature/674-improve-properties

2024-04-02 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git

commit cb381850835a50ab06646fc199f10faca2ec2047
Merge: 8acbe780 6a9713e0
Author: Pepijn Noltes 
AuthorDate: Tue Apr 2 22:21:16 2024 +0200

Merge pull request #721 from apache/feature/674-improve-properties

Feature/674 improve properties

 CHANGES.md |   4 +-
 NOTICE |   2 +-
 bundles/remote_services/CMakeLists.txt |   1 +
 .../remote_service_admin_dfi/CMakeLists.txt|   1 +
 .../src/import_registration_dfi.c  |  17 +-
 .../rsa_shm/src/rsa_shm_impl.c |   9 +-
 .../remote_services/rsa_rpc_json/CMakeLists.txt|   1 +
 .../rsa_rpc_json/src/rsa_json_rpc_proxy_impl.c |  57 ++-
 bundles/remote_services/rsa_utils/CMakeLists.txt   |  39 ++
 .../rsa_utils/gtest}/CMakeLists.txt|  33 +-
 .../gtest/src/RsaUtilsErrorInjectionTestSuite.cc   |  53 +++
 .../rsa_utils/gtest/src/RsaUtilsTestSuite.cc   |  77 
 .../rsa_utils/include/celix_rsa_utils.h|  51 +++
 .../rsa_utils/src/celix_rsa_utils.c|  52 +++
 documents/README.md|   2 +
 documents/patterns.md  |   2 +-
 documents/properties_and_filter.md | 121 +
 examples/conan_test_package/CMakeLists.txt |   4 +
 examples/conan_test_package/conanfile.py   |   1 +
 examples/conan_test_package/test_rsa_utils.cc  |  28 ++
 examples/conan_test_package_v2/conanfile.py|   2 +
 .../src/CelixBundleContextServicesTestSuite.cc |  56 +++
 libs/framework/src/bundle_context.c|  55 ++-
 libs/framework/src/dm_component_impl.c |   4 +-
 .../error_injector/celix_array_list/CMakeLists.txt |   4 +
 .../celix_array_list/include/celix_array_list_ei.h |   4 +
 .../celix_array_list/src/celix_array_list_ei.cc|  22 +-
 .../error_injector/celix_version/CMakeLists.txt|   1 +
 .../celix_version/include/celix_version_ei.h   |   2 +
 .../celix_version/src/celix_version_ei.cc  |   7 +
 .../gtest/src/ArrayListErrorInjectionTestSuite.cc  |  45 +-
 libs/utils/gtest/src/ArrayListTestSuite.cc |  42 ++
 .../src/ConvertUtilsErrorInjectionTestSuite.cc | 151 +-
 libs/utils/gtest/src/ConvertUtilsTestSuite.cc  | 342 --
 libs/utils/gtest/src/CxxFilterTestSuite.cc |  82 ++--
 libs/utils/gtest/src/CxxPropertiesTestSuite.cc | 142 ++
 .../gtest/src/FilterErrorInjectionTestSuite.cc |   7 +
 libs/utils/gtest/src/FilterTestSuite.cc| 171 +++
 .../gtest/src/PropertiesErrorInjectionTestSuite.cc | 174 ++-
 libs/utils/gtest/src/PropertiesTestSuite.cc| 414 ++---
 libs/utils/gtest/src/VersionRangeTestSuite.cc  |  52 +--
 libs/utils/gtest/src/VersionTestSuite.cc   | 100 +++-
 libs/utils/include/celix/Properties.h  | 508 -
 libs/utils/include/celix_array_list.h  |  28 +-
 libs/utils/include/celix_convert_utils.h   | 157 ++-
 libs/utils/include/celix_filter.h  |  49 +-
 .../celix_filter_type.h}   |  21 +-
 libs/utils/include/celix_properties.h  | 498 ++--
 .../celix_properties_type.h}   |  21 +-
 libs/utils/include/celix_version.h |  38 +-
 libs/utils/src/array_list.c|  41 +-
 libs/utils/src/celix_convert_utils.c   | 298 +++-
 .../celix_convert_utils_private.h} |  13 +-
 libs/utils/src/filter.c| 288 +++-
 libs/utils/src/properties.c| 410 +
 libs/utils/src/version.c   | 139 +++---
 56 files changed, 4298 insertions(+), 645 deletions(-)



(celix) branch feature/674-improve-properties deleted (was 6a9713e0)

2024-04-02 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


 was 6a9713e0 gh-674: Rename array el type enum to string values

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(celix) branch master updated (8acbe780 -> cb381850)

2024-04-02 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


from 8acbe780 Merge pull request #740 from 
apache/feature/add-dispatch-for-coverity-workflow
 add ebfbb7ea Refactor properties get version non-owning func names
 add 2acc4821 Add initial long array list support for properties
 add 9c0a9c62 Merge branch 'master' into feature/674-improve-properties
 add 6843859f Add missing convert utils doxygen and fix unit tests
 add f41a0f6e Fix convert utils ei tests
 add c4a601f3 Add get/setString support for array list
 add a8038ecf Add str, long, double, bool and version array support to 
properties
 add 968cc8ae Add support for filter match with an array property set entry
 add 5963dbc9 Update C++ Properties for vector support
 add 9a51102e Improve C/C++ properties code documentation
 add 4a4e53d2 Add filter/properties type header with only a typedef
 add 301064f6 Add rsa_utils static lib
 add e5b99c1e Fix RSA import due to changed properties behaviour
 add 45b12107 Add addition properties unit tests
 add 03df1646 Add missing linking of rsa utils lib
 add a555df97 Add automatic conversion of ranking/version props for ctx
 add 21731030 Fix memleak in celix_properties_setVersions
 add abb64566 Fix parse error in celix_version_parse
 add ccd4b358 Add getString / getAsString to celix properties
 add d55c411e Fix memleak in properties
 add 82246c13 Improve references handling in rsa_shm_impl.c
 add 7047b644 Add properties and filter introduction documentation
 add e448d007 Merge branch 'master' into feature/674-improve-properties
 add dbfb90d7 Add additional properties ei tests
 add e2373dfa Fix memleak in properties setStrings and setVersions
 add 234ccc06 Update NOTICE (2019->2024)
 add 96019472 Update CHANGES.md
 add 4841034b Update codecov-action.
 add 51db9646 Refactor conversion of string to/from string array list
 add e66e4f19 Merge branch 'master' into feature/674-improve-properties
 add 016c3661 gh-87: Resolve merge issues
 add 5bb38593 gh-87: Refactor convert string to typed array utils functions
 add 0ad0e94c gh-87: Refactor properties and filter to use typed array 
lists.
 add 5cfdf198 gh-674: Fix properties/convert ei tests
 add 0ce0841f gh-674: Add abort for unreachable code
 add f3854479 Remove duplicated declarations.
 add 04432b31 Fix minor typo.
 add 70d0ae09 Merge branch 'master' into feature/674-improve-properties
 add 9133f178 gh-674: Combine typed array list to string utils functions
 add f57bb1b5 Fix the documentation error and add a corresponding test case.
 add 38f90c2a gh-674: Add missing documentation about return value and 
usage of celix_err.
 add bc8d9540 gh-674: Fix documentation and add test_package for rsa_utils.
 add f830c2ab gh-674: Optimize celix_version_parse to avoid unnecessary 
memory allocation.
 add 06f14933 gh-674: Fix broken hash and compare functions of version.
 add fc556fad gh-674: Fix broken version range test cases.
 add be178de3 gh-674: Optimize memstream usage to reduce dynamic allocation 
and handle CELIX_ILLEGAL_ARGUMENT of addEntry callback.
 add 81ee2598 gh-674: Add more tests for celix_convert_utils.
 add e082a650 gh-674: Update celix_rsa_utils documentation and add 
corresponding test case.
 add 8e968176 gh-674: Add more tests for array_list.
 add eb2cf8a9 gh-674: Fix broken equality test for substring filters and 
add more tests for filter.
 add 4d94de27 gh-674: Fix broken substring match.
 add be6ca791 gh-674: Refactor array list type for properties
 add 3989ce18 gh-674: Remove defaultValue arg from props get array functions
 add 10473c5b gh-674: Remove defaultValue arg from properties get* 
functions with a ptr return
 add 3437c045 gh-674: Add missing array list support to several 
celix_properties functions, add more tests.
 add d38f0b10 gh-674: Add missing test for celix_properties_setEntry.
 add 6a9713e0 gh-674: Rename array el type enum to string values
 new cb381850 Merge pull request #721 from 
apache/feature/674-improve-properties

The 1 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.


Summary of changes:
 CHANGES.md |   4 +-
 NOTICE |   2 +-
 bundles/remote_services/CMakeLists.txt |   1 +
 .../remote_service_admin_dfi/CMakeLists.txt|   1 +
 .../src/import_registration_dfi.c  |  17 +-
 .../rsa_shm/src/rsa_shm_impl.c |   9 +-
 .../remote_services/rsa_rpc_json/

(celix) branch feature/674-improve-properties updated (d38f0b10 -> 6a9713e0)

2024-04-02 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


from d38f0b10 gh-674: Add missing test for celix_properties_setEntry.
 add 6a9713e0 gh-674: Rename array el type enum to string values

No new revisions were added by this update.

Summary of changes:
 libs/utils/gtest/src/ArrayListTestSuite.cc | 21 -
 libs/utils/src/array_list.c| 14 +++---
 2 files changed, 15 insertions(+), 20 deletions(-)



(celix) branch feature/674-improve-properties updated (4d94de27 -> 10473c5b)

2024-04-01 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


from 4d94de27 gh-674: Fix broken substring match.
 add be6ca791 gh-674: Refactor array list type for properties
 add 3989ce18 gh-674: Remove defaultValue arg from props get array functions
 add 10473c5b gh-674: Remove defaultValue arg from properties get* 
functions with a ptr return

No new revisions were added by this update.

Summary of changes:
 libs/utils/gtest/src/ArrayListTestSuite.cc |  17 ++
 libs/utils/gtest/src/CxxPropertiesTestSuite.cc |  10 +-
 .../gtest/src/PropertiesErrorInjectionTestSuite.cc |  10 +-
 libs/utils/gtest/src/PropertiesTestSuite.cc|  87 +--
 libs/utils/include/celix/Properties.h  |  45 ++--
 libs/utils/include/celix_array_list.h  |   9 +
 libs/utils/include/celix_properties.h  | 162 -
 libs/utils/src/array_list.c|  29 +++
 libs/utils/src/filter.c|  20 +-
 libs/utils/src/properties.c| 267 -
 10 files changed, 353 insertions(+), 303 deletions(-)



(celix) branch feature/674-improve-properties updated (04432b31 -> 9133f178)

2024-03-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


from 04432b31 Fix minor typo.
 add ef72d72f Add event admin feature
 add b75476ff Add event admin feature
 add 2777331e Add event admin feature
 add cf37e53f Add doc for event admin
 add d3a22c2a remove event admin from misc/experimental/bundles
 add 3a3f2b3d Fix doc for event admin
 add 7d377c9a Merge branch 'master' of https://github.com/xuzhenbao/celix 
into event_admin
 add 012f8264 Change the header file include order
 add a8fc3a7d Add error code for celix_eventAdmin_create
 add 17bfe649 Resolve the build failure for macos
 add 7ede7ee0 Resolve the test failure for macos
 add 8d138f6f Merge branch 'apache:master' into event_admin
 add eb585352 Fix event admin doc grammar error
 add 1335da9d Update 
bundles/event_admin/event_admin_api/include/celix_event_admin_service.h
 add b9b2b560 Improve code based on code review
 add 1f1ba1f0 Improve code based on code review, and remove errno setting 
in celix_eventAdmin_create
 add 3d201736 Merge pull request #738 from xuzhenbao/event_admin
 add 03c0a2ac gh-87: Refactor ctx useService* impl to reuse service tracker.
 add f0e1b228 gh-87: Remove use direct and sod option from useService* 
functions
 add 3d1d8bca gh-87: Update useService doxygen documentation
 add 9776dafb gh-87: Update conan test package useService usage
 add 1c4b4dea Merge branch 'master' into feature/87-refactor-use-services
 add 10cef0b8 Merge pull request #741 from 
apache/feature/87-refactor-use-services
 add f3a7790d Add dispatch option for coverity workflow
 add 8acbe780 Merge pull request #740 from 
apache/feature/add-dispatch-for-coverity-workflow
 add 70d0ae09 Merge branch 'master' into feature/674-improve-properties
 add 9133f178 gh-674: Combine typed array list to string utils functions

No new revisions were added by this update.

Summary of changes:
 .github/workflows/coverity-scan.yml|   3 +-
 CHANGES.md |   3 +
 bundles/CMakeLists.txt |   1 +
 .../bundles => bundles/event_admin}/CMakeLists.txt |  10 +-
 bundles/event_admin/README.md  |  42 ++
 bundles/event_admin/event_admin/CMakeLists.txt |  58 ++
 bundles/event_admin/event_admin/README.md  | 113 
 .../event_admin/diagrams/async_delivery_seq.png| Bin 0 -> 41668 bytes
 .../event_admin/diagrams/async_delivery_seq.puml   |  43 ++
 .../event_admin/diagrams/sync_delivery_seq.png | Bin 0 -> 14289 bytes
 .../event_admin/diagrams/sync_delivery_seq.puml|  21 +-
 .../event_admin/event_admin/gtest/CMakeLists.txt   |  94 +++
 .../CelixEventAdapterErrorInjectionTestSuite.cc| 180 ++
 .../gtest/src/CelixEventAdapterTestSuite.cc| 140 +
 .../src/CelixEventAdapterTestSuiteBaseClass.h  |  69 +++
 ...ixEventAdminActivatorErrorInjectionTestSuite.cc | 176 ++
 .../gtest/src/CelixEventAdminActivatorTestSuite.cc |  57 ++
 .../src/CelixEventAdminErrorInjectionTestSuite.cc  | 342 +++
 .../src/CelixEventAdminIntegrationTestSuite.cc}|  37 +-
 .../gtest/src/CelixEventAdminTestSuite.cc  | 682 +
 .../gtest/src/CelixEventAdminTestSuiteBaseClass.h  | 192 ++
 .../gtest/src/CelixEventErrorInjectionTestSuite.cc |  55 ++
 .../event_admin/gtest/src/CelixEventTestSuite.cc   |  45 ++
 bundles/event_admin/event_admin/src/celix_event.c  |  82 +++
 .../event_admin/event_admin/src/celix_event.h  |  26 +-
 .../event_admin/src/celix_event_adapter.c  | 274 +
 .../event_admin/src/celix_event_adapter.h  |  31 +-
 .../event_admin/src/celix_event_admin.c| 650 
 .../event_admin/src/celix_event_admin.h|  33 +-
 .../event_admin/src/celix_event_admin_activator.c  | 135 
 .../event_admin_api}/CMakeLists.txt|  15 +-
 .../include/celix_event_admin_service.h|  67 ++
 .../include/celix_event_constants.h| 115 
 .../include/celix_event_handler_service.h  |  67 ++
 .../gtest => event_admin/examples}/CMakeLists.txt  |  33 +-
 .../examples/event_handler}/CMakeLists.txt |  18 +-
 .../src/celix_example_event_handler_activator.c|  52 ++
 .../examples/event_publisher}/CMakeLists.txt   |  18 +-
 .../src/celix_example_event_publisher_activator.c  | 109 
 .../rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc   |   2 -
 bundles/shell/shell/gtest/CMakeLists.txt   |   6 +-
 bundles/shell/shell/gtest/src/ShellTestSuite.cc|  54 +-
 bundles/shell/shell/src/help_command.c |  40 +-
 conanfile.py   |  13 +
 examples/conan_test_package/CMakeLists.txt |  11 +
 examples/conan_

(celix) branch feature/add-dispatch-for-coverity-workflow deleted (was f3a7790d)

2024-03-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/add-dispatch-for-coverity-workflow
in repository https://gitbox.apache.org/repos/asf/celix.git


 was f3a7790d Add dispatch option for coverity workflow

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(celix) 01/01: Merge pull request #740 from apache/feature/add-dispatch-for-coverity-workflow

2024-03-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 8acbe780d1d2c183da52e9c139aaa574cf53504f
Merge: 10cef0b8 f3a7790d
Author: Pepijn Noltes 
AuthorDate: Mon Mar 25 17:26:17 2024 +0100

Merge pull request #740 from 
apache/feature/add-dispatch-for-coverity-workflow

Add dispatch option for coverity workflow

 .github/workflows/coverity-scan.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)



(celix) branch master updated (10cef0b8 -> 8acbe780)

2024-03-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


from 10cef0b8 Merge pull request #741 from 
apache/feature/87-refactor-use-services
 add f3a7790d Add dispatch option for coverity workflow
 new 8acbe780 Merge pull request #740 from 
apache/feature/add-dispatch-for-coverity-workflow

The 1 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.


Summary of changes:
 .github/workflows/coverity-scan.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)



(celix) branch feature/87-refactor-use-services deleted (was 1c4b4dea)

2024-03-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/87-refactor-use-services
in repository https://gitbox.apache.org/repos/asf/celix.git


 was 1c4b4dea Merge branch 'master' into feature/87-refactor-use-services

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(celix) 01/01: Merge pull request #741 from apache/feature/87-refactor-use-services

2024-03-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 10cef0b8ffc154ed15dedb3a6cbab43547fb4956
Merge: 3d201736 1c4b4dea
Author: Pepijn Noltes 
AuthorDate: Mon Mar 25 17:25:47 2024 +0100

Merge pull request #741 from apache/feature/87-refactor-use-services

Feature/87 refactor use services

 CHANGES.md |   3 +
 .../rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc   |   2 -
 bundles/shell/shell/gtest/CMakeLists.txt   |   6 +-
 bundles/shell/shell/gtest/src/ShellTestSuite.cc|  54 +---
 bundles/shell/shell/src/help_command.c |  40 +++---
 examples/conan_test_package/test_shell.c   |   3 -
 .../src/CelixBundleContextServicesTestSuite.cc |  85 +++-
 libs/framework/include/celix/BundleContext.h   |  20 ++-
 libs/framework/include/celix_bundle_context.h  |  68 +-
 libs/framework/src/bundle_context.c| 148 ++---
 10 files changed, 178 insertions(+), 251 deletions(-)



(celix) branch master updated (3d201736 -> 10cef0b8)

2024-03-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


from 3d201736 Merge pull request #738 from xuzhenbao/event_admin
 add 03c0a2ac gh-87: Refactor ctx useService* impl to reuse service tracker.
 add f0e1b228 gh-87: Remove use direct and sod option from useService* 
functions
 add 3d1d8bca gh-87: Update useService doxygen documentation
 add 9776dafb gh-87: Update conan test package useService usage
 add 1c4b4dea Merge branch 'master' into feature/87-refactor-use-services
 new 10cef0b8 Merge pull request #741 from 
apache/feature/87-refactor-use-services

The 1 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.


Summary of changes:
 CHANGES.md |   3 +
 .../rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc   |   2 -
 bundles/shell/shell/gtest/CMakeLists.txt   |   6 +-
 bundles/shell/shell/gtest/src/ShellTestSuite.cc|  54 +---
 bundles/shell/shell/src/help_command.c |  40 +++---
 examples/conan_test_package/test_shell.c   |   3 -
 .../src/CelixBundleContextServicesTestSuite.cc |  85 +++-
 libs/framework/include/celix/BundleContext.h   |  20 ++-
 libs/framework/include/celix_bundle_context.h  |  68 +-
 libs/framework/src/bundle_context.c| 148 ++---
 10 files changed, 178 insertions(+), 251 deletions(-)



(celix) branch feature/87-refactor-use-services updated (9776dafb -> 1c4b4dea)

2024-03-24 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/87-refactor-use-services
in repository https://gitbox.apache.org/repos/asf/celix.git


from 9776dafb gh-87: Update conan test package useService usage
 add 5c8883e9 Improve doc for RSA
 add 3bad2b3b Improve doc for RSA
 add bac6049f Update doc of remote service
 add d1616812 Merge branch 'master' of https://github.com/xuzhenbao/celix 
into improve_doc
 add 14ea9139 Merge branch 'apache:master' into improve_doc
 add 891db5f1 Merge branch 'apache:master' into improve_doc
 add 90f02c19 Merge branch 'improve_doc' of 
https://github.com/xuzhenbao/celix into improve_doc
 add 2f9a93ab Merge branch 'master' of https://github.com/xuzhenbao/celix 
into improve_doc
 add 7b3ea01f Add document for libdfi and dynamic ip mechanism
 add bc099827 Merge pull request #690 from xuzhenbao/improve_doc
 add 3c3227af gh-87: Address review issues in gh-734.
 add 0601f957 Merge pull request #734 from 
apache/feature/87-create-service-tracker-inside-useTrackedService-call
 add f75a4197 Fix linker error caused by private linking of transitive 
dependencies.
 add 6f147b8b Fix copy error in generate method.
 add 1db9b858 Fix copy error in generate method.
 add 3b12f3b6 Add more tracing to CI.
 add 2d285da3 Add more tracing to CI.
 add 09cfcaee Revert "Fix copy error in generate method."
 add 52eaaf83 Revert "Fix copy error in generate method."
 add 4d831cc8 Fix assertion failure when dep.cpp_info.libdir is None.
 add fdf96fd1 Fix assertion failure when dep.cpp_info.libdir is None.
 add acabf59f Fix broken test_package for conan1.
 add d90acf5b Merge pull request #735 from apache/hotfix/conan-private-dep
 add 3bd54746 Copy dependent libraries in Pythonic way.
 add 1df05889 Merge pull request #736 from apache/hotfix/conan-private-dep
 add 35e30c10 Revert "Fix linker error caused by private linking of 
transitive dependencies."
 add d46d9838 Merge pull request #737 from 
apache/hotfix/revert-conan-private-dep-fix
 new 1c4b4dea Merge branch 'master' into feature/87-refactor-use-services

The 1 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.


Summary of changes:
 bundles/remote_services/README.md  |  83 ---
 .../diagrams/dynamic_ip_filling_seq.png| Bin 0 -> 61463 bytes
 .../diagrams/dynamic_ip_filling_seq.puml   |  43 
 .../remote_services/discovery_zeroconf/README.md   |  78 +++
 .../diagrams/multiple_txt_record_snapshot.png  | Bin 0 -> 128663 bytes
 .../diagrams/service_announce_seq.png  | Bin 0 -> 45197 bytes
 .../diagrams/service_announce_seq.puml |  45 
 .../diagrams/service_discovery_seq.png | Bin 0 -> 57853 bytes
 .../diagrams/service_discovery_seq.puml|  53 +
 .../remote_services/doc/discovery_zeroconf.adoc| 129 ---
 bundles/remote_services/doc/rsa_shm_v2.adoc| 164 --
 .../remote_service_admin_dfi/README.md |   9 +-
 .../remote_service_admin_shm_v2/README.md  |  86 +++
 .../diagrams/rsa_shm_component_diagram.png | Bin 0 -> 25998 bytes
 .../diagrams/rsa_shm_component_diagram.puml|  48 
 .../diagrams/rsa_shm_ipc_seq.png   | Bin 0 -> 47480 bytes
 .../diagrams/rsa_shm_ipc_seq.puml  |  43 
 .../diagrams/rsa_shm_remote_service_call_seq.png   | Bin 0 -> 59257 bytes
 .../diagrams/rsa_shm_remote_service_call_seq.puml  |  51 +
 bundles/remote_services/rsa_rpc_json/README.md |  68 ++
 .../diagrams/remote_service_endpoint_use_seq.png   | Bin 0 -> 43996 bytes
 .../diagrams/remote_service_endpoint_use_seq.puml  |  37 +++
 .../diagrams/remote_service_proxy_use_seq.png  | Bin 0 -> 43223 bytes
 .../diagrams/remote_service_proxy_use_seq.puml |  42 ++--
 documents/subprojects.md   |   2 +-
 libs/dfi/README.md | 251 -
 libs/framework/src/bundle_context.c|   8 +-
 27 files changed, 884 insertions(+), 356 deletions(-)
 create mode 100644 bundles/remote_services/diagrams/dynamic_ip_filling_seq.png
 create mode 100644 bundles/remote_services/diagrams/dynamic_ip_filling_seq.puml
 create mode 100644 bundles/remote_services/discovery_zeroconf/README.md
 create mode 100644 
bundles/remote_services/discovery_zeroconf/diagrams/multiple_txt_record_snapshot.png
 create mode 100644 
bundles/remote_services/discovery_zeroconf/diagrams/service_announce_seq.png
 create mode 100644 
bundles/remote_services/discovery_zeroconf/diagrams/service_announce_seq.

(celix) 01/01: Merge branch 'master' into feature/87-refactor-use-services

2024-03-24 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/87-refactor-use-services
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 1c4b4deae23a3c6f902609f0e15115a9c2f4f83d
Merge: 9776dafb d46d9838
Author: Pepijn Noltes 
AuthorDate: Sun Mar 24 19:03:43 2024 +0100

Merge branch 'master' into feature/87-refactor-use-services

 bundles/remote_services/README.md  |  83 ---
 .../diagrams/dynamic_ip_filling_seq.png| Bin 0 -> 61463 bytes
 .../diagrams/dynamic_ip_filling_seq.puml   |  43 
 .../remote_services/discovery_zeroconf/README.md   |  78 +++
 .../diagrams/multiple_txt_record_snapshot.png  | Bin 0 -> 128663 bytes
 .../diagrams/service_announce_seq.png  | Bin 0 -> 45197 bytes
 .../diagrams/service_announce_seq.puml |  45 
 .../diagrams/service_discovery_seq.png | Bin 0 -> 57853 bytes
 .../diagrams/service_discovery_seq.puml|  53 +
 .../remote_services/doc/discovery_zeroconf.adoc| 129 ---
 bundles/remote_services/doc/rsa_shm_v2.adoc| 164 --
 .../remote_service_admin_dfi/README.md |   9 +-
 .../remote_service_admin_shm_v2/README.md  |  86 +++
 .../diagrams/rsa_shm_component_diagram.png | Bin 0 -> 25998 bytes
 .../diagrams/rsa_shm_component_diagram.puml|  48 
 .../diagrams/rsa_shm_ipc_seq.png   | Bin 0 -> 47480 bytes
 .../diagrams/rsa_shm_ipc_seq.puml  |  43 
 .../diagrams/rsa_shm_remote_service_call_seq.png   | Bin 0 -> 59257 bytes
 .../diagrams/rsa_shm_remote_service_call_seq.puml  |  51 +
 bundles/remote_services/rsa_rpc_json/README.md |  68 ++
 .../diagrams/remote_service_endpoint_use_seq.png   | Bin 0 -> 43996 bytes
 .../diagrams/remote_service_endpoint_use_seq.puml  |  37 +++
 .../diagrams/remote_service_proxy_use_seq.png  | Bin 0 -> 43223 bytes
 .../diagrams/remote_service_proxy_use_seq.puml |  34 +++
 documents/subprojects.md   |   2 +-
 libs/dfi/README.md | 251 -
 libs/framework/src/bundle_context.c|   8 +-
 27 files changed, 900 insertions(+), 332 deletions(-)




(celix) branch feature/87-refactor-use-services updated: gh-87: Update conan test package useService usage

2024-03-24 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/87-refactor-use-services
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/87-refactor-use-services by this push:
 new 9776dafb gh-87: Update conan test package useService usage
9776dafb is described below

commit 9776dafb17fc05e866a7c8ef29b93699420698d2
Author: Pepijn Noltes 
AuthorDate: Sun Mar 24 16:55:37 2024 +0100

gh-87: Update conan test package useService usage
---
 examples/conan_test_package/test_shell.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/examples/conan_test_package/test_shell.c 
b/examples/conan_test_package/test_shell.c
index b4919350..626202e5 100644
--- a/examples/conan_test_package/test_shell.c
+++ b/examples/conan_test_package/test_shell.c
@@ -65,7 +65,6 @@ int main() {
 opts.filter.serviceName = CELIX_SHELL_SERVICE_NAME;
 opts.callbackHandle = NULL;
 opts.waitTimeoutInSeconds = 1.0;
-opts.flags = CELIX_SERVICE_USE_DIRECT | CELIX_SERVICE_USE_SOD;
 opts.use = use;
 bool called = celix_bundleContext_useServiceWithOptions(ctx, );
 assert(called);
@@ -73,5 +72,3 @@ int main() {
 celix_frameworkFactory_destroyFramework(fw);
 return 0;
 }
-
-



(celix) branch feature/674-improve-properties updated (5cfdf198 -> 0ce0841f)

2024-03-24 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


from 5cfdf198 gh-674: Fix properties/convert ei tests
 add 0ce0841f gh-674: Add abort for unreachable code

No new revisions were added by this update.

Summary of changes:
 libs/utils/src/properties.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



(celix) branch feature/87-refactor-use-services updated: gh-87: Update useService doxygen documentation

2024-03-24 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/87-refactor-use-services
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/87-refactor-use-services by this push:
 new 3d1d8bca gh-87: Update useService doxygen documentation
3d1d8bca is described below

commit 3d1d8bca2d8f5b5917d388a21f538cee7f863b38
Author: Pepijn Noltes 
AuthorDate: Sun Mar 24 16:22:03 2024 +0100

gh-87: Update useService doxygen documentation
---
 libs/framework/include/celix/BundleContext.h  | 24 ++--
 libs/framework/include/celix_bundle_context.h | 54 ---
 2 files changed, 45 insertions(+), 33 deletions(-)

diff --git a/libs/framework/include/celix/BundleContext.h 
b/libs/framework/include/celix/BundleContext.h
index 1bb89fae..608fa37f 100644
--- a/libs/framework/include/celix/BundleContext.h
+++ b/libs/framework/include/celix/BundleContext.h
@@ -106,14 +106,16 @@ namespace celix {
 /**
  * @brief Use a service registered in the Celix framework using a 
fluent builder API.
  *
- * @deprecated celix_bundleContext_useService are deprecated and 
should be considered test utils functions. In
- * operational code use celix_bundleContext_trackService* combined 
with celix_bundleContext_useTrackedService*
- * functions instead.
+ * @warning Cannot be called from the Celix event thread.
+ *
+ * @note celix::BundleContext::useService should be considered a test 
util method.
+ * For production code, use celix::BundleContext::trackServices 
combined with use callback methods on the
+ * service tracker instead.
  *
  * The service use can be fine tuned using the returned 
UseServiceBuilder API.
  *
  * With this API a Celix service can be used by providing use 
functions.
- * The use function will be executed on the Celix event thread and the 
Celix framework
+ * The use function will be executed on the calling thread and the 
Celix framework
  * will ensure that the service cannot be removed while in use.
  *
  * If there are more 1 matching service, the highest ranking service 
will be used.
@@ -134,7 +136,6 @@ namespace celix {
  * @return A UseServiceBuilder object.
  */
 template
-[[deprecated]]
 UseServiceBuilder useService(const std::string& name = {}) {
 return UseServiceBuilder{cCtx, celix::typeName(name), true};
 }
@@ -142,15 +143,17 @@ namespace celix {
 /**
  * @brief Use services registered in the Celix framework using a 
fluent builder API.
  *
- * @deprecated celix_bundleContext_useService are deprecated and 
should be considered test utils functions. In
- * operational code use celix_bundleContext_trackService* combined 
with celix_bundleContext_useTrackedService*
- * functions instead.
+ * @warning Cannot be called from the Celix event thread.
+ *
+ * @note celix::BundleContext::useServices should be considered a test 
util method.
+ * For production code, use celix::BundleContext::trackServices 
combined with use callback methods on the
+ * service tracker instead.
  *
  * The service use can be fine tuned using the returned 
UseServiceBuilder API.
  *
  * With this API Celix services can be used by providing use functions.
- * The use function will be executed on the Celix event thread and the 
Celix framework
- * will ensure that the service cannot be removed while in use.
+ * The use function will be executed on the calling thread and the 
Celix framework
+ * will ensure that the used services cannot be removed while in use.
  *
  * The use callbacks will be called for every matching service found.
  *
@@ -167,7 +170,6 @@ namespace celix {
  * @return A UseServiceBuilder object.
  */
 template
-[[deprecated]]
 UseServiceBuilder useServices(const std::string& name = {}) {
 return UseServiceBuilder{cCtx, celix::typeName(name), false};
 }
diff --git a/libs/framework/include/celix_bundle_context.h 
b/libs/framework/include/celix_bundle_context.h
index e93d88aa..890de3fe 100644
--- a/libs/framework/include/celix_bundle_context.h
+++ b/libs/framework/include/celix_bundle_context.h
@@ -376,7 +376,8 @@ typedef struct celix_service_filter_options {
  * @param opts The pointer to the filter options.
  * @return If found a valid service id (>= 0) if not found -1.
  */
-CELIX_FRAMEWORK_EXPORT long 
celix_bundleContext_findServiceWithOptions(celix_bundle_context_t *ctx, const 
celix_service_filter_options_t *opts);
+CELIX_FRAMEWORK_EXPORT long 
celix_bundleContext_findServiceWithOptions(celix_bundle_con

(celix) branch feature/674-improve-properties updated (51db9646 -> 5cfdf198)

2024-03-24 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


from 51db9646 Refactor conversion of string to/from string array list
 add 63fa8b1a Remove deprecated version.h and version_range.h
 add 65f53a13 Merge branch 'master' into 
feature/509-remove-deprecated-version
 add fce59eda Fix incorrect double assigment
 add 47b2f766 Merge remote-tracking branch 'origin/master' into 
feature/509-remove-deprecated-version
 add a727b468 Fix incorrect ENOMEM return in rsa_dfi
 add 3e61888b Replace dfi_log_util.h by celix_err.h.
 add 452bfb36 Make gcov play nicely with Conan2.
 add ba397036 #509 Remove embedded memstream from utils.
 add ccbd7b09 Add error injection for dyn_interface.
 add ad1fa88e Remove unnecessary null check (guaranteed by class invariant).
 add cced65cf Code deduplication and coverage improvements for dyn_common.
 add 45bc7d2f Add more tests for dyn_common.c
 add 2a0314d7 Add const qualifier to dyn_interface.h and apply early return 
to dynInterface_parse.
 add e27d73af Add const qualifier, apply early return error handling 
patterns, and improve interface ergonomic to dyn_interface.
 add 9e9b14f5 Improve ergonomics of dynInterface_methods.
 add b6d5e395 Apply const qualifier to dyn_type and improve ergonomics for 
functions that cannot fail.
 add 20ef8891 Merge branch 'master' into feature/dfi-cleanup
 add 04692bce Add dynType_parseOfName to avoid unnecessary string 
duplication during parsing.
 add 7936dca6 Extract common functionality of dyn_interface and dyn_message 
into dyn_descriptor and improve ergonomics of dyn_message API.
 add b7354954 Avoid explicit function pointer conversion.
 add d0c1ede2 Extend dynType_parseWithStreamOfName for code deduplication, 
and remove tail recursion from dynType_findType.
 add 179a3bf8 Merge branch 'master' into feature/dfi-cleanup
 add 24228794 Refactor dynType_parseComplex to return early on error and 
handle error of missing the closing brace.
 add 53c5da76 Remove tail recursion in dynType_alloc and add more parsing 
tests.
 add 0e790759 Merge branch 'master' into feature/dfi-cleanup
 add 32be748a Merge branch 'master' into feature/dfi-cleanup
 add 9758b649 Merge branch 'master' into feature/dfi-cleanup
 add 90dd0c07 Merge branch 'master' into feature/dfi-cleanup
 add 78b7d2d8 Refactor dynType_sequence_alloc and dynType_sequence_reserve.
 add 84b45788 Refactor other dynType_sequence methods.
 add dfc647c0 Merge branch 'master' into feature/dfi-cleanup
 add e84ac213 Make double-reference work for dynType, and improve 
dynType_print robustness and coverage.
 add a6e22f76 Upgrade to conan 1.62.
 add 1ff4bc15 Skip typedefs for reference when printing a dynType.
 add 0bde38e5 Only Skip typedefs already printed when printing a dynType.
 add e3562a5f Apply const qualifier to dynFunction.
 add bfc57bdd Refactor dynFunction_parse and dynFunction_parseWithStr.
 add 1c370b1e Add more tests for dynFunction_parse.
 add 86a90957 Code cleanup and testing coverage improvement of dynFunction.
 add 4c2b4d41 Treat unknown complex member as error when parsing and 
refactor json deserialization.
 add 4c6d4dbd More tests for `jsonSerializer_parseAny`.
 add b61b6bd4 Fix unit test error in 
TEST_F(JsonSerializerErrorInjectionTestSuite, SerilizationError).
 add 8e38c03f Fix compilation error linux-build-apt CI.
 add 58589ade Fix compilation error linux-build-apt CI.
 add 3f039d3e Add option to control whether to install Find modules defined 
by Celix, and skip it in conan build.
 add f6a42e85 Remove unnecessary find_dependency from CelixDeps.cmake.in.
 add e1dd1b88 Improve dyn_type deserialization.
 add 88d43dd7 Merge branch 'master' into feature/dfi-cleanup
 add 927926c8 Remove unnecessary recursions caused by type reference by 
name.
 add 782325e6 Improve dyn_type serialization.
 add 7f1391d4 Add more serialization tests.
 add 6fffb96b Support nullptr when serialize text.
 add 1220311c Optimize dyn_function's arguments handling.
 add 74f1243d Avoid list iteration in dynInterface_nrOfMethods.
 add 6223856e Add dynType_realType for code deduplication.
 add ba398d32 Remove unnecessary calloc and fix crash caused by pointer 
reference in jsonRpc_call.
 add 797e9755 Add some type checking to dyn_function.
 add 86249373 Update codecov-action.
 add 9b4501d2 Update codecov-action.
 add 29fa7d0f Merge pull request #722 from apache/hotfix/codecov-fix
 add f8966015 Merge branch 'master' into feature/dfi-cleanup
 add e34eb00b #723 Add triviality test for dynType so that definitions of 
dfi argument types can be given.
 add 823c131b Fix compilation error.
 add aebe9750 Merge triviality test

(celix) 01/01: Add dispatch option for coverity workflow

2024-03-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/add-dispatch-for-coverity-workflow
in repository https://gitbox.apache.org/repos/asf/celix.git

commit f3a7790d264c6d01710c9e7fd062da49b3fda0f0
Author: Pepijn Noltes 
AuthorDate: Sat Mar 9 15:51:00 2024 +0100

Add dispatch option for coverity workflow
---
 .github/workflows/coverity-scan.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/.github/workflows/coverity-scan.yml 
b/.github/workflows/coverity-scan.yml
index 53473347..25d0191a 100644
--- a/.github/workflows/coverity-scan.yml
+++ b/.github/workflows/coverity-scan.yml
@@ -1,10 +1,9 @@
 name: Celix Coverity Scan
 
 on:
-#  push:
-#  pull_request:
   schedule:
 - cron: '0 0 * * 0' # Weekly at 00:00 UTC
+  workflow_dispatch:
 
 jobs:
   latest:



(celix) branch feature/add-dispatch-for-coverity-workflow created (now f3a7790d)

2024-03-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/add-dispatch-for-coverity-workflow
in repository https://gitbox.apache.org/repos/asf/celix.git


  at f3a7790d Add dispatch option for coverity workflow

This branch includes the following new commits:

 new f3a7790d Add dispatch option for coverity workflow

The 1 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) branch feature/87-refactor-use-services updated: gh-87: Remove use direct and sod option from useService* functions

2024-03-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/87-refactor-use-services
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/87-refactor-use-services by this push:
 new f0e1b228 gh-87: Remove use direct and sod option from useService* 
functions
f0e1b228 is described below

commit f0e1b228ffcca1a024a3571adc5e7b810f03153b
Author: Pepijn Noltes 
AuthorDate: Sat Mar 9 15:49:38 2024 +0100

gh-87: Remove use direct and sod option from useService* functions
---
 .../rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc   |  2 -
 .../src/CelixBundleContextServicesTestSuite.cc | 53 --
 libs/framework/include/celix_bundle_context.h  | 15 +-
 3 files changed, 10 insertions(+), 60 deletions(-)

diff --git 
a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc
 
b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc
index e602ee9e..833b55a0 100644
--- 
a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc
+++ 
b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc
@@ -813,7 +813,6 @@ TEST_F(RsaShmRpcTestSuite, CallRemoteService) {
 EXPECT_EQ(CELIX_SUCCESS, calc->add(calc->handle, 1, 2, ));
 EXPECT_EQ(3.0, result);
 };
-opts.flags = CELIX_SERVICE_USE_DIRECT | CELIX_SERVICE_USE_SOD;
 auto found = celix_bundleContext_useServiceWithOptions(clientCtx.get(), 
);
 EXPECT_TRUE(found);
 
@@ -835,7 +834,6 @@ TEST_F(RsaShmRpcTestSuite, CallRemoteService) {
 double result;
 EXPECT_NE(CELIX_SUCCESS, calc->add(calc->handle, 1, 2, ));
 };
-opts.flags = CELIX_SERVICE_USE_DIRECT | CELIX_SERVICE_USE_SOD;
 found = celix_bundleContext_useServiceWithOptions(clientCtx.get(), );
 EXPECT_TRUE(found);
 
diff --git a/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc 
b/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
index a164520f..0a0c6af9 100644
--- a/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
@@ -64,7 +64,7 @@ public:
 CelixBundleContextServicesTestSuite& 
operator=(CelixBundleContextServicesTestSuite&&) = delete;
 CelixBundleContextServicesTestSuite& operator=(const 
CelixBundleContextServicesTestSuite&) = delete;
 
-void registerAndUseServiceWithCorrectVersion(bool direct) const {
+void registerAndUseServiceWithCorrectVersion() const {
 struct calc {
 int (*calc)(int);
 };
@@ -78,9 +78,6 @@ public:
 celix_service_use_options_t use_opts{};
 use_opts.filter.serviceName = "calc";
 use_opts.filter.versionRange = "[1,2)";
-if(direct) {
-use_opts.flags = CELIX_SERVICE_USE_DIRECT;
-}
 
 celix_service_registration_options_t reg_opts{};
 reg_opts.serviceName = calcName;
@@ -105,7 +102,7 @@ public:
 celix_bundleContext_unregisterService(ctx, svcId);
 }
 
-void registerAndUseServiceWithIncorrectVersion(bool direct) const {
+void registerAndUseServiceWithIncorrectVersion() const {
 struct calc {
 int (*calc)(int);
 };
@@ -119,9 +116,6 @@ public:
 celix_service_use_options_t use_opts{};
 use_opts.filter.serviceName = "calc";
 use_opts.filter.versionRange = "[2,3)";
-if(direct) {
-use_opts.flags = CELIX_SERVICE_USE_DIRECT;
-}
 
 celix_service_registration_options_t reg_opts{};
 reg_opts.serviceName = calcName;
@@ -145,7 +139,7 @@ public:
 celix_bundleContext_unregisterService(ctx, svcId);
 }
 
-void registerAndUseServiceWithTimeout(bool direct) const {
+void registerAndUseServiceWithTimeout() const {
 const int NR_ITERATIONS = 5; //NOTE this test is sensitive for 
triggering race condition in the celix framework, therefore is used a few times.
 for (int i = 0; i < NR_ITERATIONS; ++i) {
 printf("Iter %i\n", i);
@@ -161,9 +155,6 @@ public:
 
 celix_service_use_options_t opts{};
 opts.filter.serviceName = "calc";
-if(direct) {
-opts.flags = CELIX_SERVICE_USE_DIRECT;
-}
 
 bool called = celix_bundleContext_useServiceWithOptions(ctx, 
);
 EXPECT_FALSE(called); //service not avail.
@@ -197,7 +188,7 @@ public:
 }
 }
 
-void registerAsyncAndUseServiceWithTimeout(bool direct) const {
+void registerAsyncAndUseServiceWithTimeout() const {
 const int NR_ITERATIONS = 5; //NOTE this test is sensitive for 
triggering race condition in the celix framework, therefore is used

(celix) 01/01: gh-87: Refactor ctx useService* impl to reuse service tracker.

2024-03-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/87-refactor-use-services
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 03c0a2ac78dee60fe487e056f1ab106942c27714
Author: Pepijn Noltes 
AuthorDate: Sat Mar 9 14:39:55 2024 +0100

gh-87: Refactor ctx useService* impl to reuse service tracker.

Note that also means that useService* functions and
methods are no longer use-able in the Celix event thread.
---
 CHANGES.md |   3 +
 bundles/shell/shell/gtest/CMakeLists.txt   |   6 +-
 bundles/shell/shell/gtest/src/ShellTestSuite.cc|  54 +---
 bundles/shell/shell/src/help_command.c |  40 +++---
 .../src/CelixBundleContextServicesTestSuite.cc |  32 +
 libs/framework/include/celix/BundleContext.h   |  12 +-
 libs/framework/include/celix_bundle_context.h  |  15 ++-
 libs/framework/src/bundle_context.c| 148 ++---
 8 files changed, 139 insertions(+), 171 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 3221802a..7fee14e7 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -66,6 +66,9 @@ limitations under the License.
   The `celix_bundleContext_trackServicesWithOptions` is still available for 
more advanced use-cases.
 - Function `celix_bundle_destroyServiceTrackerList` is removed. The returned 
array list from 
   `celix_bundle_listServiceTrackers` is now configured to destroy the service 
trackers info entries.
+- It is no longer possible to use the `celix_bundleContext_useService*` 
functions or `celix::BundleContxt::useService*` 
+  methods on the Celix event thread. The calls will now immediately return and 
log an error if called on the
+  Celix event thread.
 
 ## New Features
 
diff --git a/bundles/shell/shell/gtest/CMakeLists.txt 
b/bundles/shell/shell/gtest/CMakeLists.txt
index 91a50aef..75d18ea8 100644
--- a/bundles/shell/shell/gtest/CMakeLists.txt
+++ b/bundles/shell/shell/gtest/CMakeLists.txt
@@ -19,8 +19,10 @@ add_executable(test_shell
 src/ShellTestSuite.cc
 )
 
+add_celix_bundle(celix_shell_empty_resource_test_bundle NO_ACTIVATOR VERSION 
0.0.0)
+
 target_link_libraries(test_shell PRIVATE Celix::framework Celix::shell_api 
GTest::gtest GTest::gtest_main)
-celix_target_bundle_set_definition(test_shell NAME TEST_BUNDLES Celix::shell)
+celix_target_bundle_set_definition(test_shell NAME TEST_BUNDLES Celix::shell 
celix_shell_empty_resource_test_bundle)
 target_compile_options(test_shell PRIVATE -Wno-deprecated-declarations)
 
 add_test(NAME test_shell COMMAND test_shell)
@@ -31,7 +33,7 @@ if (CELIX_CXX14)
 add_executable(test_cxx_shell src/ShellTestSuite.cc)
 
 target_link_libraries(test_cxx_shell PRIVATE Celix::framework 
Celix::shell_api GTest::gtest GTest::gtest_main)
-celix_target_bundle_set_definition(test_cxx_shell NAME TEST_BUNDLES 
Celix::ShellCxx)
+celix_target_bundle_set_definition(test_cxx_shell NAME TEST_BUNDLES 
Celix::ShellCxx celix_shell_empty_resource_test_bundle)
 target_compile_definitions(test_cxx_shell PRIVATE -DCXX_SHELL)
 
 add_test(NAME test_cxx_shell COMMAND test_cxx_shell)
diff --git a/bundles/shell/shell/gtest/src/ShellTestSuite.cc 
b/bundles/shell/shell/gtest/src/ShellTestSuite.cc
index 318a8379..b7b5f791 100644
--- a/bundles/shell/shell/gtest/src/ShellTestSuite.cc
+++ b/bundles/shell/shell/gtest/src/ShellTestSuite.cc
@@ -21,19 +21,20 @@
 #include 
 #include 
 
-#include "celix_shell_command.h"
-#include "celix_framework_factory.h"
 #include "celix_bundle_context.h"
-#include "celix_shell.h"
-#include "celix_framework_utils.h"
 #include "celix_constants.h"
+#include "celix_framework_factory.h"
+#include "celix_framework_utils.h"
+#include "celix_shell.h"
+#include "celix_shell_command.h"
+#include "celix_stdlib_cleanup.h"
 
 class ShellTestSuite : public ::testing::Test {
 public:
 ShellTestSuite() : ctx{createFrameworkContext()} {
 auto* fw = celix_bundleContext_getFramework(ctx.get());
 size_t nr = celix_framework_utils_installBundleSet(fw, TEST_BUNDLES, 
true);
-EXPECT_EQ(nr, 1); //shell bundle
+EXPECT_EQ(nr, 2); //shell and  celix_shell_empty_resource_test_bundle 
bundle
 }
 
 static std::shared_ptr createFrameworkContext() {
@@ -54,12 +55,25 @@ public:
 }};
 }
 
+long getBundleIdForResourceBundle() const {
+celix_autoptr(celix_array_list_t) bundles = 
celix_bundleContext_listBundles(ctx.get());
+for (auto i = 0 ; i < celix_arrayList_size(bundles); ++i) {
+auto bndId = celix_arrayList_getLong(bundles, i);
+celix_autofree char* name = 
celix_bundleContext_getBundleSymbolicName(ctx.get(), bndId);
+if (strstr(name, "resource") != nullptr) {
+return bndId;
+}
+
+}
+  

(celix) branch feature/87-refactor-use-services created (now 03c0a2ac)

2024-03-09 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/87-refactor-use-services
in repository https://gitbox.apache.org/repos/asf/celix.git


  at 03c0a2ac gh-87: Refactor ctx useService* impl to reuse service tracker.

This branch includes the following new commits:

 new 03c0a2ac gh-87: Refactor ctx useService* impl to reuse service tracker.

The 1 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) branch feature/87-create-service-tracker-inside-useTrackedService-call deleted (was 3c3227af)

2024-03-04 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch 
feature/87-create-service-tracker-inside-useTrackedService-call
in repository https://gitbox.apache.org/repos/asf/celix.git


 was 3c3227af gh-87: Address review issues in gh-734.

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(celix) 01/01: Merge pull request #734 from apache/feature/87-create-service-tracker-inside-useTrackedService-call

2024-03-04 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 0601f9574dfb02bb2259202b0b18df870c20dcf8
Merge: bc099827 3c3227af
Author: Pepijn Noltes 
AuthorDate: Mon Mar 4 10:59:23 2024 +0100

Merge pull request #734 from 
apache/feature/87-create-service-tracker-inside-useTrackedService-call

Feature/87 create service tracker inside use tracked service call

 .../src/CelixBundleContextServicesTestSuite.cc |  59 +++
 libs/framework/src/bundle_context.c| 111 ++---
 libs/framework/src/bundle_context_private.h|   3 +
 3 files changed, 135 insertions(+), 38 deletions(-)



(celix) branch master updated (bc099827 -> 0601f957)

2024-03-04 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


from bc099827 Merge pull request #690 from xuzhenbao/improve_doc
 add dbadfebc gh-87: Add test to call useTrackedService on the event thread.
 add e665364e gh-87: Support creating service tracker inside a 
useTrackedService call
 add 3c3227af gh-87: Address review issues in gh-734.
 new 0601f957 Merge pull request #734 from 
apache/feature/87-create-service-tracker-inside-useTrackedService-call

The 1 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.


Summary of changes:
 .../src/CelixBundleContextServicesTestSuite.cc |  59 +++
 libs/framework/src/bundle_context.c| 111 ++---
 libs/framework/src/bundle_context_private.h|   3 +
 3 files changed, 135 insertions(+), 38 deletions(-)



(celix) 02/02: gh-87: Support creating service tracker inside a useTrackedService call

2024-03-03 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch 
feature/87-create-service-tracker-inside-useTrackedService-call
in repository https://gitbox.apache.org/repos/asf/celix.git

commit e665364e8dfa02db26b130d1f17bd87acc63e2dc
Author: Pepijn Noltes 
AuthorDate: Sun Mar 3 11:24:47 2024 +0100

gh-87: Support creating service tracker inside a useTrackedService call
---
 .../src/CelixBundleContextServicesTestSuite.cc |  23 +
 libs/framework/src/bundle_context.c| 111 ++---
 libs/framework/src/bundle_context_private.h|   3 +
 3 files changed, 99 insertions(+), 38 deletions(-)

diff --git a/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc 
b/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
index 607cb208..12ffcd94 100644
--- a/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
@@ -2045,3 +2045,26 @@ TEST_F(CelixBundleContextServicesTestSuite, 
UseTrackedServiceOnTheCelixEventThre
 nullptr);
 celix_framework_waitForGenericEvent(fw, eventId);
 }
+
+TEST_F(CelixBundleContextServicesTestSuite, 
CreateServiceTrackedOnUseServiceTrackerCall) {
+//Given a registered service with a service registration guard
+long svcId = celix_bundleContext_registerService(ctx, (void*)0x42, "test", 
nullptr);
+celix_auto(celix_service_registration_guard_t) svcGuard = 
celix_serviceRegistrationGuard_init(ctx, svcId);
+
+//And a  service tracker for the "test" service with a service tracker 
guard
+long trkId = celix_bundleContext_trackServices(ctx, "test");
+celix_auto(celix_tracker_guard_t) trkGuard = celix_trackerGuard_init(ctx, 
trkId);
+
+//When all events are processed
+celix_bundleContext_waitForEvents(ctx);
+
+//Then I can create and destroy an additional service tracker on the 
callback of the useTrackedService function
+auto useCallback = [](void *data, void* /*svc*/) {
+auto c = static_cast(data);
+long additionalTrkId = celix_bundleContext_trackServices(c, "foo");
+EXPECT_GT(additionalTrkId, 0);
+celix_bundleContext_stopTracker(c, additionalTrkId);
+};
+bool called = celix_bundleContext_useTrackedService(ctx, trkId, ctx, 
useCallback);
+EXPECT_TRUE(called);
+}
diff --git a/libs/framework/src/bundle_context.c 
b/libs/framework/src/bundle_context.c
index ee890648..99624cae 100644
--- a/libs/framework/src/bundle_context.c
+++ b/libs/framework/src/bundle_context.c
@@ -43,6 +43,8 @@
 #include "celix_array_list.h"
 #include "celix_convert_utils.h"
 
+#define TRACKER_WARN_THRESHOLD_SEC 5
+
 static celix_status_t bundleContext_bundleChanged(void* listenerSvc, 
bundle_event_t* event);
 static void bundleContext_cleanupBundleTrackers(bundle_context_t *ct);
 static void bundleContext_cleanupServiceTrackers(bundle_context_t *ctx);
@@ -839,7 +841,28 @@ static void 
celix_bundleContext_removeServiceTrackerTracker(void *data) {
 free(tracker);
 }
 
-static void celix_bundleContext_stopTrackerInternal(bundle_context_t *ctx, 
long trackerId, bool async, void *doneData, void (*doneCallback)(void* 
doneData)) {
+static void 
celix_bundleContext_waitForUnusedServiceTracker(celix_bundle_context_t* ctx,
+
celix_bundle_context_service_tracker_entry_t* trkEntry) {
+// busy wait till the tracker is not used anymore
+// note that the use count cannot be increased anymore, because the 
tracker is removed from the map
+struct timespec start = celix_gettime(CLOCK_MONOTONIC);
+int logCount = 0;
+while (__atomic_load_n(>useCount, __ATOMIC_RELAXED) > 0) {
+if (celix_elapsedtime(CLOCK_MONOTONIC, start) > 
TRACKER_WARN_THRESHOLD_SEC) {
+fw_log(ctx->framework->logger,
+   CELIX_LOG_LEVEL_WARNING,
+   "Service tracker with trk id %li is still in use after %i 
seconds. "
+   "This might indicate a programming error.",
+   trkEntry->trackerId,
+   logCount * TRACKER_WARN_THRESHOLD_SEC);
+start = celix_gettime(CLOCK_MONOTONIC);
+logCount++;
+}
+usleep(1);
+}
+}
+
+static void celix_bundleContext_stopTrackerInternal(celix_bundle_context_t* 
ctx, long trackerId, bool async, void *doneData, void (*doneCallback)(void* 
doneData)) {
 if (ctx == NULL || trackerId <= 0) {
 return;
 }
@@ -888,6 +911,7 @@ static void 
celix_bundleContext_stopTrackerInternal(bundle_context_t *ctx, long
 fw_removeBundleListener(ctx->framework, ctx->bundle, 
>listener);
 free(bundleTracker);
 } else if (serviceTracker != NULL) {
+celix_bundleContext_waitForUnusedServiceTracker(ctx, 
servic

(celix) branch feature/87-create-service-tracker-inside-useTrackedService-call created (now e665364e)

2024-03-03 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch 
feature/87-create-service-tracker-inside-useTrackedService-call
in repository https://gitbox.apache.org/repos/asf/celix.git


  at e665364e gh-87: Support creating service tracker inside a 
useTrackedService call

This branch includes the following new commits:

 new dbadfebc gh-87: Add test to call useTrackedService on the event thread.
 new e665364e gh-87: Support creating service tracker inside a 
useTrackedService call

The 2 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/02: gh-87: Add test to call useTrackedService on the event thread.

2024-03-03 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch 
feature/87-create-service-tracker-inside-useTrackedService-call
in repository https://gitbox.apache.org/repos/asf/celix.git

commit dbadfebcc4401b7f51a02c2f504d23863ca114e9
Author: Pepijn Noltes 
AuthorDate: Sat Mar 2 13:28:09 2024 +0100

gh-87: Add test to call useTrackedService on the event thread.
---
 .../src/CelixBundleContextServicesTestSuite.cc | 36 ++
 1 file changed, 36 insertions(+)

diff --git a/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc 
b/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
index 8218ecf0..607cb208 100644
--- a/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
@@ -2009,3 +2009,39 @@ TEST_F(CelixBundleContextServicesTestSuite, 
UseTrackedServiceDuringTrackerCreati
 serviceFound = celix_bundleContext_useTrackedService(ctx, trkId, nullptr, 
nullptr);
 EXPECT_TRUE(serviceFound);
 }
+
+TEST_F(CelixBundleContextServicesTestSuite, 
UseTrackedServiceOnTheCelixEventThread) {
+//Given a registered service with a service registration guard
+long svcId = celix_bundleContext_registerService(ctx, (void*)0x42, "test", 
nullptr);
+celix_auto(celix_service_registration_guard_t) svcGuard = 
celix_serviceRegistrationGuard_init(ctx, svcId);
+
+//And a  service tracker for the "test" service with a service tracker 
guard
+long trkId = celix_bundleContext_trackServices(ctx, "test");
+celix_auto(celix_tracker_guard_t) trkGuard = celix_trackerGuard_init(ctx, 
trkId);
+
+//When all events are processed
+celix_bundleContext_waitForEvents(ctx);
+
+//Then I can use the tracked service on the Celix event thread
+struct callback_data {
+celix_bundle_context_t* ctx;
+long trkId;
+};
+callback_data cbData{ctx, trkId};
+auto eventCallback = [](void *data) {
+auto d = static_cast(data);
+bool called = celix_bundleContext_useTrackedService(d->ctx, d->trkId, 
nullptr, nullptr);
+EXPECT_TRUE(called);
+};
+
+long eventId = celix_framework_fireGenericEvent(
+fw,
+-1,
+celix_bundle_getId(celix_framework_getFrameworkBundle(fw)),
+"use tracked service",
+(void*),
+eventCallback,
+nullptr,
+nullptr);
+celix_framework_waitForGenericEvent(fw, eventId);
+}



(celix) 01/01: Merge pull request #729 from apache/feature/87-add-additional-svc-tracker-bundle-context-funtions

2024-02-27 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 6c2b8395b0debdbdb08e34227f85582425368a8f
Merge: e6dc3ca4 8ca876da
Author: Pepijn Noltes 
AuthorDate: Tue Feb 27 22:36:40 2024 +0100

Merge pull request #729 from 
apache/feature/87-add-additional-svc-tracker-bundle-context-funtions

Feature/87 add additional svc tracker bundle context funtions

 CHANGES.md |   5 +
 .../log_admin/gtest/src/LogAdminTestSuite.cc   |   6 +-
 .../gtest/src/rsa_client_server_tests.cc   |  27 +-
 bundles/shell/shell/gtest/src/ShellTestSuite.cc|   9 +-
 bundles/shell/shell/src/query_command.c|   2 +-
 .../src/simple_consumer_example.c  |   7 +-
 .../track_tracker_example/src/activator.c  |  23 +-
 .../src/CelixBundleContextBundlesTestSuite.cc  |   4 +-
 .../src/CelixBundleContextServicesTestSuite.cc | 342 --
 .../gtest/src/CxxBundleContextTestSuite.cc | 103 +++
 libs/framework/include/celix/Trackers.h| 119 
 libs/framework/include/celix_bundle.h  |  12 +-
 libs/framework/include/celix_bundle_context.h  | 739 +
 libs/framework/include/celix_bundle_context_type.h |  41 ++
 libs/framework/include/celix_types.h   |   4 +-
 .../framework/include_deprecated/service_tracker.h |  18 +-
 libs/framework/src/bundle.c|  36 +-
 libs/framework/src/bundle_context.c| 470 -
 libs/framework/src/bundle_context_private.h|  61 +-
 libs/framework/src/service_tracker.c   | 237 +++
 libs/framework/src/service_tracker_private.h   |  57 +-
 libs/utils/include/celix_threads.h |  12 +-
 22 files changed, 1632 insertions(+), 702 deletions(-)

diff --cc CHANGES.md
index 1ca2af68,8dab49dc..3221802a
--- a/CHANGES.md
+++ b/CHANGES.md
@@@ -58,9 -58,13 +58,14 @@@ limitations under the License
  - linked_list.h is removed and no longer supported. Use celix_array_list.h 
instead.
  - ip_utils.h is removed and no longer supported.  
  - array_list.h is removed and no longer supported. Use celix_array_list.h 
instead.
 +- the celix_arrayList_add function no longer accepts a NULL value.
  - version.h and version_range.h are removed and no longer supported. Use 
celix_version.h and celix_version_range.h 
instead.
+ - The signature of `celix_bundleContext_trackServices` has changed. The 
signature is now simpler to better support
+   the use-case of using a service tracker with the 
`celix_bundleContext_useTrackedService*` functions.
+   The `celix_bundleContext_trackServicesWithOptions` is still available for 
more advanced use-cases.
+ - Function `celix_bundle_destroyServiceTrackerList` is removed. The returned 
array list from 
+   `celix_bundle_listServiceTrackers` is now configured to destroy the service 
trackers info entries.
  
  ## New Features
  



(celix) branch master updated (e6dc3ca4 -> 6c2b8395)

2024-02-27 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


from e6dc3ca4 Merge pull request #727 from 
apache/feature/674-add-element-type-to-array-list
 add b5ee724a gh-509: Add bundle context functions to use underlying svc 
tracker
 add 7b37d720 gh-87: Change signature celix_bundleContext_trackServices
 add 9d2e7a51 gh-87: Add celix_bundle_context_type.h header.
 add 9321f514 gh-87: Add useService(s) methods to C++ ServiceTracker
 add 67e80c76 Merge branch 'master' into 
feature/87-add-additional-svc-tracker-bundle-context-funtions
 add 5446bf01 gh-87: Move svc tracker state fields to an anon state struct
 add eb6e6995 gh-87: Refactor bnd ctx to use a rwlock instead of mutex.
 add 8f2f5526 gh-87: Revert clear tracker maps in bnd ctx cleanup.
 add 603a1da5 Merge branch 'master' into 
feature/87-add-additional-svc-tracker-bundle-context-funtions
 add 102cd333 gh-87: Replace trackService usage in rsa test with 
trackServiceWithOptions
 add 67b1240f gh-87: Remove unused APIs.
 add 6af4f405 Some minor documentation corrections.
 add 5f6b628e Merge remote-tracking branch 
'upstream/feature/87-add-additional-svc-tracker-bundle-context-funtions' into 
feature/87-add-additional-svc-tracker-bundle-context-funtions
 add c44da398 gh-87: Fix crash caused by wait on event loop.
 add 13fb8236 gh-87: Add test case to wait for non-existing tracker.
 add b2d197eb gh-87: Support lock stealing from a lock guard.
 add 8ca876da gh-87: Avoid write lock in bundleContext_cleanupXXX when 
possible and fix possible nullptr dereference.
 new 6c2b8395 Merge pull request #729 from 
apache/feature/87-add-additional-svc-tracker-bundle-context-funtions

The 1 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.


Summary of changes:
 CHANGES.md |   5 +
 .../log_admin/gtest/src/LogAdminTestSuite.cc   |   6 +-
 .../gtest/src/rsa_client_server_tests.cc   |  27 +-
 bundles/shell/shell/gtest/src/ShellTestSuite.cc|   9 +-
 bundles/shell/shell/src/query_command.c|   2 +-
 .../src/simple_consumer_example.c  |   7 +-
 .../track_tracker_example/src/activator.c  |  23 +-
 .../src/CelixBundleContextBundlesTestSuite.cc  |   4 +-
 .../src/CelixBundleContextServicesTestSuite.cc | 342 --
 .../gtest/src/CxxBundleContextTestSuite.cc | 103 +++
 libs/framework/include/celix/Trackers.h| 119 
 libs/framework/include/celix_bundle.h  |  12 +-
 libs/framework/include/celix_bundle_context.h  | 739 +
 .../include/celix_bundle_context_type.h}   |  15 +-
 libs/framework/include/celix_types.h   |   4 +-
 .../framework/include_deprecated/service_tracker.h |  18 +-
 libs/framework/src/bundle.c|  36 +-
 libs/framework/src/bundle_context.c| 470 -
 libs/framework/src/bundle_context_private.h|  61 +-
 libs/framework/src/service_tracker.c   | 237 +++
 libs/framework/src/service_tracker_private.h   |  57 +-
 libs/utils/include/celix_threads.h |  12 +-
 22 files changed, 1598 insertions(+), 710 deletions(-)
 copy libs/{utils/include/celix_version_range_type.h => 
framework/include/celix_bundle_context_type.h} (70%)



(celix) branch feature/87-add-additional-svc-tracker-bundle-context-funtions deleted (was 8ca876da)

2024-02-27 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git


 was 8ca876da gh-87: Avoid write lock in bundleContext_cleanupXXX when 
possible and fix possible nullptr dereference.

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(celix) branch feature/674-add-element-type-to-array-list deleted (was 9ae479eb)

2024-02-26 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


 was 9ae479eb gh-674: Add missing equals callback check in array list equals

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(celix) branch master updated (423abb8a -> e6dc3ca4)

2024-02-26 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


from 423abb8a Merge pull request #733 from 
apache/hotfix/730-realloc-leak-fix
 add b4df54cc #674 Fix in push stream for gcc 13
 add ba42e664 #674 Refactor array list compare in ctx, reg and rsa
 add 21f379de #674 Add initial element type support for array list
 add f0ff9d94 #674 Add array list element type testing
 add 1f324c5b #674 Add array list equal and copy function
 add 21051234 #674 Add additional array list ei tests
 add 5097e483 #674 Add add/assign nullptr test for array list
 add 86e3b7a4 #674 Add test that triggers a realloc for the array list
 add 05047d54 gh-674: Refactor array list to not allow NULL entries.
 add 2bd5e42f Merge branch 'master' into 
feature/674-add-element-type-to-array-list
 add a8937f1a gh-674: Add copy callback support for array list
 add 9ae479eb gh-674: Add missing equals callback check in array list equals
 new e6dc3ca4 Merge pull request #727 from 
apache/feature/674-add-element-type-to-array-list

The 1 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.


Summary of changes:
 CHANGES.md |   1 +
 .../log_admin/gtest/src/LogAdminTestSuite.cc   |   8 -
 bundles/logging/log_admin/src/celix_log_admin.c|  18 +-
 .../log_service_api/include/celix_log_control.h|  12 +
 .../src/endpoint_discovery_poller.c|   8 +-
 .../rsa_common/src/remote_interceptors_handler.c   |  10 +-
 .../include_deprecated/service_registry.h  |   2 +-
 libs/framework/src/bundle_context.c|   4 +-
 libs/framework/src/service_registry.c  |  10 +-
 .../api/celix/impl/BufferedPushStream.h|   4 +-
 .../error_injector/celix_array_list/CMakeLists.txt |   7 +-
 .../celix_array_list/include/celix_array_list_ei.h |  15 +-
 .../celix_array_list/src/celix_array_list_ei.cc|  55 +--
 libs/utils/gtest/CMakeLists.txt|  26 +-
 .../gtest/src/ArrayListErrorInjectionTestSuite.cc  |  84 +++-
 libs/utils/gtest/src/ArrayListTestSuite.cc | 431 +-
 .../gtest/src/FilterErrorInjectionTestSuite.cc |  37 +-
 libs/utils/include/celix_array_list.h  | 468 +--
 libs/utils/src/array_list.c| 496 +++--
 libs/utils/src/array_list_private.h|  41 --
 libs/utils/src/filter.c|  25 +-
 21 files changed, 1213 insertions(+), 549 deletions(-)
 delete mode 100644 libs/utils/src/array_list_private.h



(celix) 01/01: Merge pull request #727 from apache/feature/674-add-element-type-to-array-list

2024-02-26 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git

commit e6dc3ca4c86c3bdc0e7464165d74ef8248112f33
Merge: 423abb8a 9ae479eb
Author: Pepijn Noltes 
AuthorDate: Mon Feb 26 12:18:30 2024 +0100

Merge pull request #727 from 
apache/feature/674-add-element-type-to-array-list

 CHANGES.md |   1 +
 .../log_admin/gtest/src/LogAdminTestSuite.cc   |   8 -
 bundles/logging/log_admin/src/celix_log_admin.c|  18 +-
 .../log_service_api/include/celix_log_control.h|  12 +
 .../src/endpoint_discovery_poller.c|   8 +-
 .../rsa_common/src/remote_interceptors_handler.c   |  10 +-
 .../include_deprecated/service_registry.h  |   2 +-
 libs/framework/src/bundle_context.c|   4 +-
 libs/framework/src/service_registry.c  |  10 +-
 .../api/celix/impl/BufferedPushStream.h|   4 +-
 .../error_injector/celix_array_list/CMakeLists.txt |   7 +-
 .../celix_array_list/include/celix_array_list_ei.h |  15 +-
 .../celix_array_list/src/celix_array_list_ei.cc|  55 +--
 libs/utils/gtest/CMakeLists.txt|  26 +-
 .../gtest/src/ArrayListErrorInjectionTestSuite.cc  |  84 +++-
 libs/utils/gtest/src/ArrayListTestSuite.cc | 431 +-
 .../gtest/src/FilterErrorInjectionTestSuite.cc |  37 +-
 libs/utils/include/celix_array_list.h  | 468 +--
 libs/utils/src/array_list.c| 496 +++--
 libs/utils/src/array_list_private.h|  41 --
 libs/utils/src/filter.c|  25 +-
 21 files changed, 1213 insertions(+), 549 deletions(-)




(celix) branch feature/87-add-additional-svc-tracker-bundle-context-funtions updated (8f2f5526 -> 102cd333)

2024-02-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git


from 8f2f5526 gh-87: Revert clear tracker maps in bnd ctx cleanup.
 add a38a77af Use the real hostname for remote service
 add 0a920227 Remove uuid in the service instance name
 add 28e775bb Add process ID to service instance name for easier debugging
 add 92ce33ad Resolve ip addresses and set it to endpoint description
 add 0705bf5f Resolve ip addresses and set it to endpoint description
 add 4fdeadef Add the interval time of endpoint watcher thead loop
 add f92eb6c4 Add the interval time of endpoint watcher thead loop
 add 73308d5d Remove the service resolved timeout mechanism, it is not 
necessary
 add 89e4dbcf Add retry cnt for DNSServiceGetAddrInfo
 add f5e276e3 Map the config type to mDNS service subtype and improve some 
code
 add dbc603d7 Improve discovery_zeroconf and its unit test
 add f6cfb5ec Refresh remote service endpoint when RSA is removed
 add 9266360a Add remote.configs.supported property for RSA service,and add 
celix.remote.admin.shm.rpc_type property for RSA_SHM configuration type
 add 3b061167 fix bugs for discovery_zeroconf
 add ddcd91b9 Add zeroconf configuration type for rsa_dfi
 add ea552e56 Add zeroconf configuration type for rsa_dfi
 add eedf073b Rename the configurations name of rsa_shm
 add 11c8fdc5 Rename remote service bundles
 add 8100c7f9 Fix bugs for discovery_zeroconf
 add 47366913 Fix unit test failure
 add 4de2144a Fix unit test failure
 add 1ae3 Merge branch 'master' of https://github.com/xuzhenbao/celix 
into improve_zeroconf_discovery
 add 768c5c75 Merge master
 add 356ec2ba Add CELIX_RSA prefix for constants of rsa_spi
 add 21b088f7 Fix code based on code review
 add e95dcefe Topology Manager implement dynamic IP mechanism
 add 66a3f10c Improve unit test of discovery_zeroconf
 add 2cb9b5cb Merge branch 'master' of https://github.com/xuzhenbao/celix 
into improve_zeroconf_discovery
 add ce4dc3be Replace OSGI_RSA_ prefix to CELIX_RSA_
 add 8e14b974 Remove IPV6 server for RSA_DFI, because civetweb not support 
IPV6 in linux-build-apt workflow
 add e48e5ed6 Improve CURL error code handling
 add 0bca5eff Merge pull request #710 from 
xuzhenbao/improve_zeroconf_discovery
 add d729e7a2 gh-730: Fix leaks caused by realloc failure.
 add 423abb8a Merge pull request #733 from 
apache/hotfix/730-realloc-leak-fix
 add 603a1da5 Merge branch 'master' into 
feature/87-add-additional-svc-tracker-bundle-context-funtions
 add 102cd333 gh-87: Replace trackService usage in rsa test with 
trackServiceWithOptions

No new revisions were added by this update.

Summary of changes:
 bundles/remote_services/CMakeLists.txt |8 +-
 .../discovery_common/src/discovery.c   |4 +-
 .../discovery_common/src/discovery_activator.c |   10 +-
 .../src/endpoint_descriptor_writer.c   |2 +-
 .../src/endpoint_discovery_poller.c|   11 +-
 .../discovery_configured/CMakeLists.txt|1 +
 .../remote_services/discovery_etcd/CMakeLists.txt  |1 +
 .../discovery_zeroconf/CMakeLists.txt  |5 +-
 .../discovery_zeroconf/gtest/CMakeLists.txt|9 +
 .../src/DiscoveryZeroconfActivatorTestSuite.cc |  139 +++
 .../src/DiscoveryZeroconfAnnouncerTestSuite.cc |  416 
 .../src/DiscoveryZeroconfIntegrationTestSuite.cc   |2 +-
 .../gtest/src/DiscoveryZeroconfWatcherTestSuite.cc |  885 +++--
 .../src/discovery_zeroconf_activator.c |  102 +-
 .../src/discovery_zeroconf_announcer.c |  372 ---
 .../src/discovery_zeroconf_announcer.h |6 +-
 .../src/discovery_zeroconf_constants.h |   33 +-
 .../src/discovery_zeroconf_watcher.c   | 1035 
 .../src/discovery_zeroconf_watcher.h   |8 +
 .../calculator_service/src/calculator_activator.c  |4 +-
 .../interceptors/src/rs_interceptor_activator.c|8 +-
 .../src/remote_example_activator.c |2 +-
 .../src/remote_example_impl.c  |2 +-
 .../remote_service_admin_dfi/CMakeLists.txt|1 +
 .../remote_service_admin_dfi/gtest/CMakeLists.txt  |4 +
 .../gtest/src/rsa_client_server_tests.cc   |  155 ++-
 .../gtest/src/rsa_tests.cc |   14 +-
 .../src/export_registration_dfi.c  |2 +-
 .../src/import_registration_dfi.c  |   13 +-
 .../src/import_registration_dfi.h  |5 +-
 .../src/remote_service_admin_activator.c   |   21 +-
 .../src/remote_service_admin_dfi.c |  204 +++-
 .../src/remote_service_admin_dfi_constants.h

(celix) branch feature/87-add-additional-svc-tracker-bundle-context-funtions updated (67e80c76 -> 8f2f5526)

2024-02-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git


from 67e80c76 Merge branch 'master' into 
feature/87-add-additional-svc-tracker-bundle-context-funtions
 add 5446bf01 gh-87: Move svc tracker state fields to an anon state struct
 add eb6e6995 gh-87: Refactor bnd ctx to use a rwlock instead of mutex.
 add 8f2f5526 gh-87: Revert clear tracker maps in bnd ctx cleanup.

No new revisions were added by this update.

Summary of changes:
 CHANGES.md |   2 +
 .../log_admin/gtest/src/LogAdminTestSuite.cc   |   6 +-
 bundles/shell/shell/src/query_command.c|   2 +-
 .../src/CelixBundleContextBundlesTestSuite.cc  |   2 +-
 .../src/CelixBundleContextServicesTestSuite.cc |   2 +-
 libs/framework/include/celix_bundle.h  |  12 +-
 libs/framework/include/celix_bundle_context.h  | 297 ++---
 libs/framework/src/bundle.c|  31 +--
 libs/framework/src/bundle_context.c| 107 
 libs/framework/src/bundle_context_private.h|   4 +-
 libs/framework/src/service_tracker.c   | 215 ---
 libs/framework/src/service_tracker_private.h   |  57 ++--
 12 files changed, 367 insertions(+), 370 deletions(-)



(celix) branch feature/674-add-element-type-to-array-list updated (a8937f1a -> 9ae479eb)

2024-02-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


from a8937f1a gh-674: Add copy callback support for array list
 add 9ae479eb gh-674: Add missing equals callback check in array list equals

No new revisions were added by this update.

Summary of changes:
 libs/utils/gtest/src/ArrayListTestSuite.cc | 20 +---
 libs/utils/include/celix_array_list.h  |  2 +-
 libs/utils/src/array_list.c|  3 +++
 3 files changed, 21 insertions(+), 4 deletions(-)



(celix) branch feature/674-add-element-type-to-array-list updated (2bd5e42f -> a8937f1a)

2024-02-25 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


from 2bd5e42f Merge branch 'master' into 
feature/674-add-element-type-to-array-list
 add a8937f1a gh-674: Add copy callback support for array list

No new revisions were added by this update.

Summary of changes:
 .../gtest/src/ArrayListErrorInjectionTestSuite.cc  |  20 +-
 libs/utils/gtest/src/ArrayListTestSuite.cc |  54 +++--
 libs/utils/include/celix_array_list.h  | 268 -
 libs/utils/src/array_list.c|  83 ---
 4 files changed, 205 insertions(+), 220 deletions(-)



(celix) branch feature/devcontainer updated: Add devcontainer badge in README.md

2024-02-19 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/devcontainer
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/feature/devcontainer by this 
push:
 new 9310ddcb Add devcontainer badge in README.md
9310ddcb is described below

commit 9310ddcb39886869aabb07ecbf62cd6835cd3f28
Author: Pepijn Noltes 
AuthorDate: Mon Feb 19 10:27:24 2024 +0100

Add devcontainer badge in README.md
---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index dc7528a2..dbd86af8 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,7 @@ limitations under the License.
 
[![codecov](https://codecov.io/gh/apache/celix/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/celix)
 [![Coverity Scan Build 
Status](https://scan.coverity.com/projects/6685/badge.svg)](https://scan.coverity.com/projects/6685)
 [![Gitpod 
ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/apache/celix)
+[![Open in Dev 
Containers](https://img.shields.io/static/v1?label=Dev%20Containers=Open=blue=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/apache/celix)
 
 Apache Celix is a framework for C and C++14 to develop dynamic modular 
software applications using component 
 and in-process service-oriented programming. 



(celix) branch feature/devcontainer updated: Fix trailing commas in devcontainer.json

2024-02-18 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/devcontainer
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/feature/devcontainer by this 
push:
 new 74450e1f Fix trailing commas in devcontainer.json
74450e1f is described below

commit 74450e1f98ba795f8d0ebac2d48a3ede21171484
Author: Pepijn Noltes 
AuthorDate: Sun Feb 18 20:51:03 2024 +0100

Fix trailing commas in devcontainer.json
---
 .devcontainer/devcontainer.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index d1f7e633..b4f66731 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,7 +1,7 @@
 {
 "name": "Apache Celix Dev Container",
 "build": {
-"dockerfile": "Dockerfile",
+"dockerfile": "Dockerfile"
 },
-"postCreateCommand": "sh .devcontainer/setup.sh",
+"postCreateCommand": "sh .devcontainer/setup.sh"
 }



(celix) 01/01: Add initial setup for devcontainer

2024-02-18 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/devcontainer
in repository https://gitbox.apache.org/repos/asf/celix.git

commit eb385917cfdc8955f6521695ffaa44055ceded2d
Author: Pepijn Noltes 
AuthorDate: Sun Feb 18 20:47:42 2024 +0100

Add initial setup for devcontainer
---
 .devcontainer/Dockerfile| 68 +
 .devcontainer/devcontainer.json |  7 +
 .devcontainer/setup.sh  | 33 
 3 files changed, 108 insertions(+)

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index ..c6b003ed
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,68 @@
+# 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.
+
+FROM 
docker.io/library/ubuntu:22.04@sha256:b492494d8e0113c4ad3fe4528a4b5ff89faa5331f7d52c5c138196f69ce176a6
+
+# Install dependencies
+RUN DEBIAN_FRONTEND="noninteractive" apt-get update && \
+DEBIAN_FRONTEND="noninteractive" apt-get install -y 
--no-install-recommends \
+# Development dependencies \
+dos2unix \
+git \
+locales-all \
+rsync \
+tar \
+ssh \
+tzdata \
+sudo \
+vim \
+# Build dependencies \
+build-essential \
+ccache \
+cmake \
+cmake-curses-gui \
+curl \
+default-jdk \
+gcc \
+g++ \
+gdb \
+make \
+lcov \
+python3 \
+python3-pip \
+# Celix dependencies \
+civetweb \
+libavahi-compat-libdnssd-dev \
+libcivetweb-dev \
+libcpputest-dev \
+libcurl4-openssl-dev \
+libczmq-dev \
+libffi-dev \
+libjansson-dev \
+libxml2-dev \
+libzip-dev \
+rapidjson-dev \
+uuid-dev && \
+apt-get clean
+
+# Install conan
+RUN pip3 install conan && pip3 cache purge
+
+# Add user celixdev with sudo rights and a "celixdev" password
+RUN useradd -m -s /bin/bash -G sudo celixdev
+RUN echo "celixdev:celixdev" | chpasswd
+USER celixdev
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index ..d1f7e633
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,7 @@
+{
+"name": "Apache Celix Dev Container",
+"build": {
+"dockerfile": "Dockerfile",
+},
+"postCreateCommand": "sh .devcontainer/setup.sh",
+}
diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh
new file mode 100755
index ..6ee40756
--- /dev/null
+++ b/.devcontainer/setup.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# 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.
+
+BUILD_TYPE=${1:-Debug}
+LC_BUILD_TYPE=$(echo ${BUILD_TYPE} | tr '[:upper:]' '[:lower:]')
+
+mkdir -p cmake-build-${LC_BUILD_TYPE}
+
+cmake -S . \
+  -B cmake-build-${LC_BUILD_TYPE} \
+  -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
+  -DCMAKE_INSTALL_PREFIX=/tmp/celix-install \
+  -DENABLE_TESTING=ON \
+  -DENABLE_ADDRESS_SANITIZER=ON \
+  -DRSA_JSON_RPC=ON \
+  -DRSA_SHM=ON \
+  -DRSA_REMOTE_SERVICE_ADMIN_SHM_V2=ON



(celix) branch feature/devcontainer created (now eb385917)

2024-02-18 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/devcontainer
in repository https://gitbox.apache.org/repos/asf/celix.git


  at eb385917 Add initial setup for devcontainer

This branch includes the following new commits:

 new eb385917 Add initial setup for devcontainer

The 1 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) branch feature/674-add-element-type-to-array-list updated (05047d54 -> 2bd5e42f)

2024-02-17 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


from 05047d54 gh-674: Refactor array list to not allow NULL entries.
 add 63fa8b1a Remove deprecated version.h and version_range.h
 add 65f53a13 Merge branch 'master' into 
feature/509-remove-deprecated-version
 add fce59eda Fix incorrect double assigment
 add 47b2f766 Merge remote-tracking branch 'origin/master' into 
feature/509-remove-deprecated-version
 add a727b468 Fix incorrect ENOMEM return in rsa_dfi
 add 2ea4904f Merge remote-tracking branch 'origin/master' into 
feature/509-remove-deprecated-version
 add ce00d0df #509 Replace version with celix_version usage a dfi test
 add 65e032cb #509 Add version and version_range type header
 add a051b04b #509 Remove dup version typedef
 add f0dc1c19 #509 Add missing include for endpoint_descriptor_reader.c
 add cc69c9fe #715: Update CHANGES.md for removed versions.h
 add 6a550a44 Merge pull request #728 from 
apache/feature/509-remove-deprecated-version
 add 2bd5e42f Merge branch 'master' into 
feature/674-add-element-type-to-array-list

No new revisions were added by this update.

Summary of changes:
 CHANGES.md |   2 +
 .../src/endpoint_descriptor_reader.c   |   1 +
 libs/dfi/gtest/src/dyn_message_tests.cpp   |  24 +-
 libs/framework/include_deprecated/module.h |   3 +-
 libs/framework/src/manifest_parser.c   |  22 +-
 libs/framework/src/manifest_parser.h   |   4 +-
 libs/framework/src/module.c|  48 ++--
 libs/utils/gtest/src/VersionRangeTestSuite.cc  | 264 +
 libs/utils/gtest/src/VersionTestSuite.cc   | 189 ---
 libs/utils/include/celix_version.h |   8 +-
 libs/utils/include/celix_version_range.h   |  18 +-
 .../include/celix_version_range_type.h}|  23 +-
 .../include/celix_version_type.h}  |  26 +-
 libs/utils/include_deprecated/celix_utils_api.h|   1 +
 libs/utils/include_deprecated/version.h| 181 --
 libs/utils/include_deprecated/version_range.h  | 174 --
 libs/utils/src/version.c   |  69 --
 libs/utils/src/version_range.c | 103 +---
 18 files changed, 258 insertions(+), 902 deletions(-)
 copy libs/{framework/src/dm_dependency.h => 
utils/include/celix_version_range_type.h} (70%)
 copy libs/{promises/api/celix/PromiseIllegalStateException.h => 
utils/include/celix_version_type.h} (65%)
 delete mode 100644 libs/utils/include_deprecated/version.h
 delete mode 100644 libs/utils/include_deprecated/version_range.h



(celix) branch feature/674-add-element-type-to-array-list updated (86e3b7a4 -> 05047d54)

2024-02-17 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


from 86e3b7a4 #674 Add test that triggers a realloc for the array list
 add 05047d54 gh-674: Refactor array list to not allow NULL entries.

No new revisions were added by this update.

Summary of changes:
 CHANGES.md |   1 +
 .../error_injector/celix_array_list/CMakeLists.txt |   7 +-
 .../celix_array_list/include/celix_array_list_ei.h |  15 +-
 .../celix_array_list/src/celix_array_list_ei.cc|  55 ++---
 libs/utils/gtest/CMakeLists.txt|  24 ++-
 .../gtest/src/ArrayListErrorInjectionTestSuite.cc  |  11 +-
 libs/utils/gtest/src/ArrayListTestSuite.cc | 219 +++-
 .../gtest/src/FilterErrorInjectionTestSuite.cc |  37 +++-
 libs/utils/include/celix_array_list.h  | 221 +---
 libs/utils/src/array_list.c| 229 ++---
 libs/utils/src/filter.c|  25 +--
 11 files changed, 146 insertions(+), 698 deletions(-)



(celix) branch feature/87-add-additional-svc-tracker-bundle-context-funtions updated (9321f514 -> 67e80c76)

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git


from 9321f514 gh-87: Add useService(s) methods to C++ ServiceTracker
 add 63fa8b1a Remove deprecated version.h and version_range.h
 add 65f53a13 Merge branch 'master' into 
feature/509-remove-deprecated-version
 add fce59eda Fix incorrect double assigment
 add 47b2f766 Merge remote-tracking branch 'origin/master' into 
feature/509-remove-deprecated-version
 add a727b468 Fix incorrect ENOMEM return in rsa_dfi
 add 2ea4904f Merge remote-tracking branch 'origin/master' into 
feature/509-remove-deprecated-version
 add ce00d0df #509 Replace version with celix_version usage a dfi test
 add 65e032cb #509 Add version and version_range type header
 add a051b04b #509 Remove dup version typedef
 add f0dc1c19 #509 Add missing include for endpoint_descriptor_reader.c
 add cc69c9fe #715: Update CHANGES.md for removed versions.h
 add 6a550a44 Merge pull request #728 from 
apache/feature/509-remove-deprecated-version
 add 67e80c76 Merge branch 'master' into 
feature/87-add-additional-svc-tracker-bundle-context-funtions

No new revisions were added by this update.

Summary of changes:
 CHANGES.md |   2 +
 .../src/endpoint_descriptor_reader.c   |   1 +
 libs/dfi/gtest/src/dyn_message_tests.cpp   |  24 +-
 libs/framework/include_deprecated/module.h |   3 +-
 libs/framework/src/manifest_parser.c   |  22 +-
 libs/framework/src/manifest_parser.h   |   4 +-
 libs/framework/src/module.c|  48 ++--
 libs/utils/gtest/src/VersionRangeTestSuite.cc  | 264 +
 libs/utils/gtest/src/VersionTestSuite.cc   | 189 ---
 libs/utils/include/celix_version.h |   8 +-
 libs/utils/include/celix_version_range.h   |  18 +-
 .../include/celix_version_range_type.h}|  15 +-
 .../include/celix_version_type.h}  |  26 +-
 libs/utils/include_deprecated/celix_utils_api.h|   1 +
 libs/utils/include_deprecated/version.h| 181 --
 libs/utils/include_deprecated/version_range.h  | 174 --
 libs/utils/src/version.c   |  69 --
 libs/utils/src/version_range.c | 103 +---
 18 files changed, 254 insertions(+), 898 deletions(-)
 copy libs/{framework/include/celix_bundle_context_type.h => 
utils/include/celix_version_range_type.h} (70%)
 copy libs/{promises/api/celix/PromiseIllegalStateException.h => 
utils/include/celix_version_type.h} (65%)
 delete mode 100644 libs/utils/include_deprecated/version.h
 delete mode 100644 libs/utils/include_deprecated/version_range.h



(celix) branch feature/87-add-additional-svc-tracker-bundle-context-funtions updated: gh-87: Add useService(s) methods to C++ ServiceTracker

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/87-add-additional-svc-tracker-bundle-context-funtions by 
this push:
 new 9321f514 gh-87: Add useService(s) methods to C++ ServiceTracker
9321f514 is described below

commit 9321f514d4613b577debab7f3e8e9fc0a46410d0
Author: Pepijn Noltes 
AuthorDate: Sun Feb 11 17:17:34 2024 +0100

gh-87: Add useService(s) methods to C++ ServiceTracker
---
 .../gtest/src/CxxBundleContextTestSuite.cc | 103 ++
 libs/framework/include/celix/Trackers.h| 119 +
 2 files changed, 222 insertions(+)

diff --git a/libs/framework/gtest/src/CxxBundleContextTestSuite.cc 
b/libs/framework/gtest/src/CxxBundleContextTestSuite.cc
index 5155c2bb..b987d28b 100644
--- a/libs/framework/gtest/src/CxxBundleContextTestSuite.cc
+++ b/libs/framework/gtest/src/CxxBundleContextTestSuite.cc
@@ -784,3 +784,106 @@ TEST_F(CxxBundleContextTestSuite, 
TestOldCStyleTrackerWithCxxMetaTracker) {
 serviceTracker_close(tracker);
 serviceTracker_destroy(tracker);
 }
+
+TEST_F(CxxBundleContextTestSuite, UseTrackedServidesTest) {
+// Given 2 registered services
+auto svc1 = std::make_shared(CInterface{nullptr, nullptr});
+auto svcReg1 = ctx->registerService(svc1).build();
+auto svc2 = std::make_shared(CInterface{nullptr, nullptr});
+auto svcReg2 = ctx->registerService(svc2).build();
+
+// And a tracker for the services
+auto tracker = ctx->trackServices().build();
+tracker->wait();
+
+// Then I can use the useServices method to use the services
+int count{0}; // note useService(s) callback are called in the current 
thread, so no need for atomic
+size_t nrCalled = tracker->useServices([](CInterface& svc) {
+(void)svc;
+count++;
+});
+EXPECT_EQ(2, nrCalled);
+EXPECT_EQ(2, count);
+
+// And I can use the useServicesWithProperties method to use the services 
with their properties
+count = 0;
+nrCalled = tracker->useServicesWithProperties([](CInterface& svc, 
const celix::Properties& props) {
+(void)svc;
+long svcId = props.getAsLong(CELIX_FRAMEWORK_SERVICE_ID, -1L);
+EXPECT_GE(svcId, 0);
+count++;
+});
+EXPECT_EQ(2, nrCalled);
+EXPECT_EQ(2, count);
+
+// And I can use the useServicesWithOwner method to use the services with 
their properties and the bundle
+count = 0;
+nrCalled = tracker->useServicesWithOwner(
+[](CInterface& svc, const celix::Properties& props, const 
celix::Bundle& bnd) {
+(void)svc;
+long svcId = props.getAsLong(CELIX_FRAMEWORK_SERVICE_ID, -1L);
+EXPECT_GE(svcId, 0);
+EXPECT_GE(bnd.getId(), 0);
+count++;
+});
+EXPECT_EQ(2, nrCalled);
+EXPECT_EQ(2, count);
+
+// And I can use the useService method to use the highest ranking service
+count = 0;
+bool called = tracker->useService([](CInterface& svc) {
+(void)svc;
+count++;
+});
+EXPECT_TRUE(called);
+EXPECT_EQ(1, count);
+
+// And I can use the useServiceWithProperties method to use the highest 
ranking service with its properties
+count = 0;
+called = tracker->useServiceWithProperties([](CInterface& svc, const 
celix::Properties& props) {
+(void)svc;
+long svcId = props.getAsLong(CELIX_FRAMEWORK_SERVICE_ID, -1L);
+EXPECT_GE(svcId, 0);
+count++;
+});
+EXPECT_TRUE(called);
+EXPECT_EQ(1, count);
+
+// And I can use the useServiceWithOwner method to use the highest ranking 
service with its properties and the
+// bundle
+count = 0;
+called = tracker->useServiceWithOwner(
+[](CInterface& svc, const celix::Properties& props, const 
celix::Bundle& bnd) {
+(void)svc;
+long svcId = props.getAsLong(CELIX_FRAMEWORK_SERVICE_ID, -1L);
+EXPECT_GE(svcId, 0);
+EXPECT_GE(bnd.getId(), 0);
+count++;
+});
+EXPECT_TRUE(called);
+EXPECT_EQ(1, count);
+
+// When registering a new service with a service raking of 100
+auto svc3 = std::make_shared(CInterface{nullptr, nullptr});
+auto svcReg3 = 
ctx->registerService(svc3).addProperty(celix::SERVICE_RANKING, 
100).build();
+svcReg3->wait();
+
+// Then the useServices method returns 3 services
+count = 0;
+nrCalled = tracker->useServices([](CInterface& svc) {
+(void)svc;
+count++;
+});
+EXPECT_EQ(3, nrCalled);
+EXPECT_EQ(3, count);
+
+// And the useServiceWithProperties method is called with a service with a 
service ranking of 100 and returns true
+count = 0;
+

(celix) branch feature/509-remove-deprecated-version deleted (was cc69c9fe)

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git


 was cc69c9fe #715: Update CHANGES.md for removed versions.h

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(celix) branch master updated (70548d61 -> 6a550a44)

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


from 70548d61 Merge pull request #725 from apache/hotfix/codecov-action-fix
 add 63fa8b1a Remove deprecated version.h and version_range.h
 add 65f53a13 Merge branch 'master' into 
feature/509-remove-deprecated-version
 add fce59eda Fix incorrect double assigment
 add 47b2f766 Merge remote-tracking branch 'origin/master' into 
feature/509-remove-deprecated-version
 add a727b468 Fix incorrect ENOMEM return in rsa_dfi
 add 2ea4904f Merge remote-tracking branch 'origin/master' into 
feature/509-remove-deprecated-version
 add ce00d0df #509 Replace version with celix_version usage a dfi test
 add 65e032cb #509 Add version and version_range type header
 add a051b04b #509 Remove dup version typedef
 add f0dc1c19 #509 Add missing include for endpoint_descriptor_reader.c
 add cc69c9fe #715: Update CHANGES.md for removed versions.h
 new 6a550a44 Merge pull request #728 from 
apache/feature/509-remove-deprecated-version

The 1 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.


Summary of changes:
 CHANGES.md |   2 +
 .../src/endpoint_descriptor_reader.c   |   1 +
 libs/dfi/gtest/src/dyn_message_tests.cpp   |  24 +-
 libs/framework/include_deprecated/module.h |   3 +-
 libs/framework/src/manifest_parser.c   |  22 +-
 libs/framework/src/manifest_parser.h   |   4 +-
 libs/framework/src/module.c|  48 ++--
 libs/utils/gtest/src/VersionRangeTestSuite.cc  | 264 +
 libs/utils/gtest/src/VersionTestSuite.cc   | 189 ---
 libs/utils/include/celix_version.h |   8 +-
 libs/utils/include/celix_version_range.h   |  18 +-
 .../include/celix_version_range_type.h}|  23 +-
 .../include/celix_version_type.h}  |  26 +-
 libs/utils/include_deprecated/celix_utils_api.h|   1 +
 libs/utils/include_deprecated/version.h| 181 --
 libs/utils/include_deprecated/version_range.h  | 174 --
 libs/utils/src/version.c   |  69 --
 libs/utils/src/version_range.c | 103 +---
 18 files changed, 258 insertions(+), 902 deletions(-)
 copy libs/{framework/src/dm_dependency.h => 
utils/include/celix_version_range_type.h} (70%)
 copy libs/{promises/api/celix/PromiseIllegalStateException.h => 
utils/include/celix_version_type.h} (65%)
 delete mode 100644 libs/utils/include_deprecated/version.h
 delete mode 100644 libs/utils/include_deprecated/version_range.h



(celix) 01/01: Merge pull request #728 from apache/feature/509-remove-deprecated-version

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 6a550a448adeb205f1b0e4ccc0d96d235c5e1d6b
Merge: 70548d61 cc69c9fe
Author: Pepijn Noltes 
AuthorDate: Sun Feb 11 16:08:16 2024 +0100

Merge pull request #728 from apache/feature/509-remove-deprecated-version

Feature/509 remove deprecated version

 CHANGES.md |   2 +
 .../src/endpoint_descriptor_reader.c   |   1 +
 libs/dfi/gtest/src/dyn_message_tests.cpp   |  24 +-
 libs/framework/include_deprecated/module.h |   3 +-
 libs/framework/src/manifest_parser.c   |  22 +-
 libs/framework/src/manifest_parser.h   |   4 +-
 libs/framework/src/module.c|  48 ++--
 libs/utils/gtest/src/VersionRangeTestSuite.cc  | 264 +
 libs/utils/gtest/src/VersionTestSuite.cc   | 189 ---
 libs/utils/include/celix_version.h |   8 +-
 libs/utils/include/celix_version_range.h   |  18 +-
 .../celix_version_range_type.h}|  32 ++-
 libs/utils/include/celix_version_type.h|  41 
 libs/utils/include_deprecated/celix_utils_api.h|   1 +
 libs/utils/include_deprecated/version.h| 181 --
 libs/utils/include_deprecated/version_range.h  | 174 --
 libs/utils/src/version.c   |  69 --
 libs/utils/src/version_range.c | 103 +---
 18 files changed, 290 insertions(+), 894 deletions(-)



(celix) branch feature/509-remove-deprecated-version updated (f0dc1c19 -> cc69c9fe)

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git


from f0dc1c19 #509 Add missing include for endpoint_descriptor_reader.c
 add cc69c9fe #715: Update CHANGES.md for removed versions.h

No new revisions were added by this update.

Summary of changes:
 CHANGES.md   | 2 ++
 libs/framework/src/manifest_parser.c | 9 -
 2 files changed, 6 insertions(+), 5 deletions(-)



(celix) 01/03: gh-509: Add bundle context functions to use underlying svc tracker

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git

commit b5ee724a43a4bfc7def24102f8648b4c58388d8e
Author: Pepijn Noltes 
AuthorDate: Sat Feb 10 17:15:29 2024 +0100

gh-509: Add bundle context functions to use underlying svc tracker
---
 .../src/CelixBundleContextServicesTestSuite.cc | 168 +++
 libs/framework/include/celix_bundle_context.h  | 555 +++--
 .../framework/include_deprecated/service_tracker.h |  17 +-
 libs/framework/src/bundle.c|   5 +-
 libs/framework/src/bundle_context.c| 261 +++---
 libs/framework/src/bundle_context_private.h|  29 +-
 libs/framework/src/service_tracker.c   |  30 +-
 7 files changed, 821 insertions(+), 244 deletions(-)

diff --git a/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc 
b/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
index d17b3892..02c49949 100644
--- a/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
@@ -52,6 +52,8 @@ public:
 
 fw = celix_frameworkFactory_createFramework(properties);
 ctx = framework_getContext(fw);
+
+celix_err_resetErrors();
 }
 
 ~CelixBundleContextServicesTestSuite() override {
@@ -1741,3 +1743,169 @@ TEST_F(CelixBundleContextServicesTestSuite, 
SetServicesWithTrackerWhenMultipleRe
 celix_bundleContext_unregisterService(ctx, svcId2);
 celix_bundleContext_unregisterService(ctx, svcId3);
 }
+
+
+TEST_F(CelixBundleContextServicesTestSuite, 
InvalidArgumentsForUseTrackedServicesTest) {
+EXPECT_FALSE(celix_bundleContext_useTrackedService(ctx, -1, nullptr, 
nullptr));
+EXPECT_FALSE(celix_bundleContext_useTrackedService(ctx, 1 /*non 
existing*/, nullptr, nullptr));
+
+EXPECT_EQ(0, celix_bundleContext_useTrackedServices(ctx, -1, nullptr, 
nullptr));
+EXPECT_EQ(0, celix_bundleContext_useTrackedServices(ctx, 1 /*non 
existing*/, nullptr, nullptr));
+
+celix_tracked_service_use_options_t useOpts{};
+EXPECT_FALSE(celix_bundleContext_useTrackedServiceWithOptions(ctx, -1, 
));
+EXPECT_FALSE(celix_bundleContext_useTrackedServiceWithOptions(ctx, 1 /*non 
existing*/, ));
+
+EXPECT_EQ(0, celix_bundleContext_useTrackedServicesWithOptions(ctx, -1, 
));
+EXPECT_EQ(0, celix_bundleContext_useTrackedServicesWithOptions(ctx, 1 
/*non existing*/, ));
+
+EXPECT_EQ(0, celix_bundleContext_getTrackedServiceCount(ctx, -1));
+EXPECT_EQ(0, celix_bundleContext_getTrackedServiceCount(ctx, 1 /*non 
existing*/));
+
+EXPECT_EQ(nullptr, celix_bundleContext_getTrackedServiceName(ctx, -1));
+EXPECT_EQ(nullptr, celix_bundleContext_getTrackedServiceName(ctx, 1 /*non 
existing*/));
+
+EXPECT_EQ(nullptr, celix_bundleContext_getTrackedServiceFilter(ctx, -1));
+EXPECT_EQ(nullptr, celix_bundleContext_getTrackedServiceFilter(ctx, 1 
/*non existing*/));
+
+EXPECT_FALSE(celix_bundleContext_isValidTrackerId(ctx, -1));
+}
+
+TEST_F(CelixBundleContextServicesTestSuite, IsValidTrackerIdTest) {
+long trkId = celix_bundleContext_trackServices(ctx, "test", nullptr, 
nullptr, nullptr);
+EXPECT_TRUE(celix_bundleContext_isValidTrackerId(ctx, trkId));
+celix_bundleContext_stopTracker(ctx, trkId);
+EXPECT_FALSE(celix_bundleContext_isValidTrackerId(ctx, trkId));
+}
+
+TEST_F(CelixBundleContextServicesTestSuite, UseTrackedServiceTest) {
+// Given 3 foo services with different service properties
+celix_properties_t* props1 = celix_properties_create();
+celix_properties_set(props1, "key", "1");
+long svcId1 = celix_bundleContext_registerService(ctx, (void*)0x42, 
"test", props1);
+celix_auto(celix_service_registration_guard_t) guard1 = 
celix_serviceRegistrationGuard_init(ctx, svcId1);
+
+celix_properties_t* props2 = celix_properties_create();
+celix_properties_set(props2, "key", "2");
+long svcId2 = celix_bundleContext_registerService(ctx, (void*)0x42, 
"test", props2);
+celix_auto(celix_service_registration_guard_t) guard2 = 
celix_serviceRegistrationGuard_init(ctx, svcId2);
+
+celix_properties_t* props3 = celix_properties_create();
+celix_properties_set(props3, "key", "3");
+long svcId3 = celix_bundleContext_registerService(ctx, (void*)0x42, 
"test", props3);
+celix_auto(celix_service_registration_guard_t) guard3 = 
celix_serviceRegistrationGuard_init(ctx, svcId3);
+
+// When tracking services for a service name
+long trkId = celix_bundleContext_trackServices(ctx, "test", nullptr, 
nullptr, nullptr);
+celix_auto(celix_tracker_guard_t) trkGuard = celix_trackerGuard_init(ctx, 
trkId);
+
+// Then the useTrackedService function 

(celix) branch feature/87-add-additional-svc-tracker-bundle-context-funtions created (now 9d2e7a51)

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git


  at 9d2e7a51 gh-87: Add celix_bundle_context_type.h header.

This branch includes the following new commits:

 new b5ee724a gh-509: Add bundle context functions to use underlying svc 
tracker
 new 7b37d720 gh-87: Change signature celix_bundleContext_trackServices
 new 9d2e7a51 gh-87: Add celix_bundle_context_type.h header.

The 3 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) 02/03: gh-87: Change signature celix_bundleContext_trackServices

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 7b37d720a06b756b3a07576de8708bc400afd460
Author: Pepijn Noltes 
AuthorDate: Sun Feb 11 15:28:06 2024 +0100

gh-87: Change signature celix_bundleContext_trackServices

Also update the celix_bundleContext_trackServices usage.
---
 CHANGES.md |   3 +
 .../log_admin/gtest/src/LogAdminTestSuite.cc   |   6 +-
 bundles/shell/shell/gtest/src/ShellTestSuite.cc|   9 +-
 .../src/simple_consumer_example.c  |   7 +-
 .../track_tracker_example/src/activator.c  |  23 ++--
 .../src/CelixBundleContextBundlesTestSuite.cc  |   2 +-
 .../src/CelixBundleContextServicesTestSuite.cc | 142 +++--
 libs/framework/include/celix_bundle_context.h  | 114 +++--
 .../framework/include_deprecated/service_tracker.h |   9 +-
 libs/framework/src/bundle_context.c|  76 +--
 libs/framework/src/bundle_context_private.h|  32 ++---
 11 files changed, 238 insertions(+), 185 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 4dd00c48..416ca230 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -58,6 +58,9 @@ limitations under the License.
 - linked_list.h is removed and no longer supported. Use celix_array_list.h 
instead.
 - ip_utils.h is removed and no longer supported.  
 - array_list.h is removed and no longer supported. Use celix_array_list.h 
instead.
+- The signature of `celix_bundleContext_trackServices` has changed. The 
signature is now simpler to better support
+  the use-case of using a service tracker with the 
`celix_bundleContext_useTrackedService*` functions.
+  The `celix_bundleContext_trackServicesWithOptions` is still available for 
more advanced use-cases.
 
 ## New Features
 
diff --git a/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc 
b/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
index 859a24a7..606b07ec 100644
--- a/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
+++ b/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
@@ -84,11 +84,11 @@ TEST_F(LogBundleTestSuite, NrOfLogServices) {
 EXPECT_EQ(1, control->nrOfLogServices(control->handle, nullptr)); 
//default the framework log services is available
 
 //request "default" log service
-long trkId1 = celix_bundleContext_trackService(ctx.get(), 
CELIX_LOG_SERVICE_NAME, nullptr, nullptr);
+long trkId1 = celix_bundleContext_trackService(ctx.get(), 
CELIX_LOG_SERVICE_NAME);
 EXPECT_EQ(2, control->nrOfLogServices(control->handle, nullptr));
 
 //request "default" log service -> already created
-long trkId2 = celix_bundleContext_trackService(ctx.get(), 
CELIX_LOG_SERVICE_NAME, nullptr, nullptr);
+long trkId2 = celix_bundleContext_trackService(ctx.get(), 
CELIX_LOG_SERVICE_NAME);
 EXPECT_EQ(2, control->nrOfLogServices(control->handle, nullptr));
 
 //request a 'logger1' log service
@@ -225,7 +225,7 @@ TEST_F(LogBundleTestSuite, SinkLogControl) {
 
 TEST_F(LogBundleTestSuite, LogServiceControl) {
 //request "default" log service
-long trkId1 = celix_bundleContext_trackService(ctx.get(), 
CELIX_LOG_SERVICE_NAME, nullptr, nullptr);
+long trkId1 = celix_bundleContext_trackService(ctx.get(), 
CELIX_LOG_SERVICE_NAME);
 celix_framework_waitForEmptyEventQueue(fw.get());
 EXPECT_EQ(2, control->nrOfLogServices(control->handle, nullptr));
 
diff --git a/bundles/shell/shell/gtest/src/ShellTestSuite.cc 
b/bundles/shell/shell/gtest/src/ShellTestSuite.cc
index e9ffc53f..318a8379 100644
--- a/bundles/shell/shell/gtest/src/ShellTestSuite.cc
+++ b/bundles/shell/shell/gtest/src/ShellTestSuite.cc
@@ -77,8 +77,10 @@ static void 
callCommand(std::shared_ptr& ctx, const char
 data.cmdLine = cmdLine;
 data.cmdShouldSucceed = cmdShouldSucceed;
 data.context = ctx.get();
-data.tracker = celix_bundleContext_trackService(ctx.get(), 
CELIX_SHELL_SERVICE_NAME,
-static_cast(), 
[](void * handle, void * svc) {
+celix_service_tracking_options_t opts{};
+opts.filter.serviceName = CELIX_SHELL_SERVICE_NAME;
+opts.callbackHandle = 
+opts.set = [](void * handle, void * svc) {
 if (svc == nullptr) {
 return;
 }
@@ -93,7 +95,8 @@ static void 
callCommand(std::shared_ptr& ctx, const char
 }
 celix_bundleContext_stopTracker(d->context, d->tracker);
 d->barrier.set_value();
-});
+};
+data.tracker = celix_bundleContext_trackServicesWithOptions(ctx.get(), 
);
 data.barrier.get_future().wait();
 }
 
diff --git 
a/examples/celix-examples/services_example_c/src/simple_consumer_example.c 
b/examples/celix-examples/servic

(celix) 03/03: gh-87: Add celix_bundle_context_type.h header.

2024-02-11 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch 
feature/87-add-additional-svc-tracker-bundle-context-funtions
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 9d2e7a51c66221ccf71ac77a7932ba9d5637cc60
Author: Pepijn Noltes 
AuthorDate: Sun Feb 11 15:37:45 2024 +0100

gh-87: Add celix_bundle_context_type.h header.
---
 libs/framework/include/celix_bundle_context.h  | 11 ++
 libs/framework/include/celix_bundle_context_type.h | 41 ++
 libs/framework/include/celix_types.h   |  4 +--
 3 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/libs/framework/include/celix_bundle_context.h 
b/libs/framework/include/celix_bundle_context.h
index dea42003..e46996e9 100644
--- a/libs/framework/include/celix_bundle_context.h
+++ b/libs/framework/include/celix_bundle_context.h
@@ -20,17 +20,12 @@
 #ifndef CELIX_BUNDLE_CONTEXT_H_
 #define CELIX_BUNDLE_CONTEXT_H_
 
-#include 
-
-#include "celix_cleanup.h"
-#include "celix_types.h"
-#include "celix_service_factory.h"
-#include "celix_properties.h"
-#include "celix_array_list.h"
+#include "celix_bundle_context_type.h"
+#include "celix_framework_export.h"
 #include "celix_filter.h"
+#include "celix_service_factory.h"
 #include "celix_bundle_event.h"
 #include "celix_log_level.h"
-#include "celix_framework_export.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/libs/framework/include/celix_bundle_context_type.h 
b/libs/framework/include/celix_bundle_context_type.h
new file mode 100644
index ..1ccedef0
--- /dev/null
+++ b/libs/framework/include/celix_bundle_context_type.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#ifndef CELIX_BUNDLE_CONTEXT_TYPE_H
+#define CELIX_BUNDLE_CONTEXT_TYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file celix_bundle_context_type.h
+ * @brief Header file for celix_bundle_context_t opaque type. Can be used for 
forward declaration.
+ */
+
+/**
+ * @brief The opaque type representing a bundle context.
+ */
+typedef struct celix_bundle_context celix_bundle_context_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //CELIX_BUNDLE_CONTEXT_TYPE_H
diff --git a/libs/framework/include/celix_types.h 
b/libs/framework/include/celix_types.h
index 201875fe..a73bac6f 100644
--- a/libs/framework/include/celix_types.h
+++ b/libs/framework/include/celix_types.h
@@ -20,12 +20,13 @@
 #ifndef CELIX_CELIX_TYPES_H
 #define CELIX_CELIX_TYPES_H
 
+#include "celix_bundle_context_type.h"
+
 /**
  * Celix types contains the declaration of many of the celix types.
  * These types are declared in a separate header for forward declaration
  */
 
-
 #ifdef ADD_CELIX_DEPRECATED_WARNING
 #define CELIX_DEPRECATED_ATTR __attribute__ ((deprecated))
 #define CELIX_DEPRECATED_ATTR_MSG(msg) __attribute__ ((deprecated(msg)))
@@ -40,7 +41,6 @@ extern "C" {
 
 typedef struct celix_framework celix_framework_t;
 typedef struct celix_bundle celix_bundle_t;
-typedef struct celix_bundle_context celix_bundle_context_t;
 typedef struct celix_dependency_manager celix_dependency_manager_t;
 typedef struct celix_dm_component_struct celix_dm_component_t;
 typedef struct celix_dm_service_dependency celix_dm_service_dependency_t;



(celix) branch feature/509-remove-deprecated-version updated: #509 Add missing include for endpoint_descriptor_reader.c

2024-02-10 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/509-remove-deprecated-version by this push:
 new f0dc1c19 #509 Add missing include for endpoint_descriptor_reader.c
f0dc1c19 is described below

commit f0dc1c19fc842709c7bb07107e8acc681f94e61c
Author: Pepijn Noltes 
AuthorDate: Sat Feb 10 12:11:54 2024 +0100

#509 Add missing include for endpoint_descriptor_reader.c
---
 .../remote_services/discovery_common/src/endpoint_descriptor_reader.c| 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/bundles/remote_services/discovery_common/src/endpoint_descriptor_reader.c 
b/bundles/remote_services/discovery_common/src/endpoint_descriptor_reader.c
index cf87fe59..57230515 100644
--- a/bundles/remote_services/discovery_common/src/endpoint_descriptor_reader.c
+++ b/bundles/remote_services/discovery_common/src/endpoint_descriptor_reader.c
@@ -26,6 +26,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "celix_log_helper.h"



(celix) branch feature/509-remove-deprecated-version updated: #509 Remove dup version typedef

2024-02-08 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/509-remove-deprecated-version by this push:
 new a051b04b #509 Remove dup version typedef
a051b04b is described below

commit a051b04b12168618b5fb65910ea74f12796b7af8
Author: Pepijn Noltes 
AuthorDate: Thu Feb 8 22:55:44 2024 +0100

#509 Remove dup version typedef
---
 libs/utils/include/celix_version.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libs/utils/include/celix_version.h 
b/libs/utils/include/celix_version.h
index e711baaf..70c78e12 100644
--- a/libs/utils/include/celix_version.h
+++ b/libs/utils/include/celix_version.h
@@ -41,11 +41,6 @@ extern "C" {
  * Functions are provided for creating and destroying version objects, 
comparing versions, and extracting the individual version components.
  */
 
-/**
- * @brief The definition of the celix_version_t* abstract data type.
- */
-typedef struct celix_version celix_version_t;
-
 /**
  * @brief Create a new celix_version_t* using the supplied arguments.
  *



(celix) branch feature/509-remove-deprecated-version updated: #509 Add version and version_range type header

2024-02-08 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/509-remove-deprecated-version by this push:
 new 65e032cb #509 Add version and version_range type header
65e032cb is described below

commit 65e032cbd3ff7ff988f1a4c691dcc7297693039e
Author: Pepijn Noltes 
AuthorDate: Thu Feb 8 19:37:13 2024 +0100

#509 Add version and version_range type header
---
 libs/utils/include/celix_version.h|  3 +-
 libs/utils/include/celix_version_range.h  | 18 +---
 libs/utils/include/celix_version_range_type.h | 42 +++
 libs/utils/include/celix_version_type.h   | 41 ++
 4 files changed, 92 insertions(+), 12 deletions(-)

diff --git a/libs/utils/include/celix_version.h 
b/libs/utils/include/celix_version.h
index 34e67c25..e711baaf 100644
--- a/libs/utils/include/celix_version.h
+++ b/libs/utils/include/celix_version.h
@@ -21,8 +21,9 @@
 #define CELIX_CELIX_VERSION_H
 
 #include 
-#include 
+#include 
 
+#include "celix_version_type.h"
 #include "celix_cleanup.h"
 #include "celix_utils_export.h"
 
diff --git a/libs/utils/include/celix_version_range.h 
b/libs/utils/include/celix_version_range.h
index 977dc71c..cddfbc78 100644
--- a/libs/utils/include/celix_version_range.h
+++ b/libs/utils/include/celix_version_range.h
@@ -18,25 +18,21 @@
  */
 
 
-#ifndef CELIX_VERSION_RANGE_H_
-#define CELIX_VERSION_RANGE_H_
+#ifndef CELIX_VERSION_RANGE_H
+#define CELIX_VERSION_RANGE_H
 
 #include 
 
-#include "celix_cleanup.h"
-#include "celix_errno.h"
-#include "celix_version.h"
+#include "celix_version_range_type.h"
+#include "celix_version_type.h"
 #include "celix_utils_export.h"
+#include "celix_errno.h"
+#include "celix_cleanup.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/**
- * Type definition for the celix_version_range_t abstract data type.
- */
-typedef struct celix_version_range celix_version_range_t;
-
 /**
  * Creates a new celix_version_range_t*.
  *
@@ -146,4 +142,4 @@ CELIX_UTILS_EXPORT bool 
celix_versionRange_createLDAPFilterInPlace(const celix_v
 }
 #endif
 
-#endif /* CELIX_VERSION_RANGE_H_ */
+#endif /* CELIX_VERSION_RANGE_H */
diff --git a/libs/utils/include/celix_version_range_type.h 
b/libs/utils/include/celix_version_range_type.h
new file mode 100644
index ..a2dd7ec2
--- /dev/null
+++ b/libs/utils/include/celix_version_range_type.h
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+
+#ifndef CELIX_VERSION_RANGE_TYPE_H
+#define CELIX_VERSION_RANGE_TYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file celix_version_range_type.h
+ * @brief Header file for celix_version_range_t opaque type. Can be used for 
forward declaration.
+ */
+
+/**
+ * Type definition for the celix_version_range_t abstract data type.
+ */
+typedef struct celix_version_range celix_version_range_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CELIX_VERSION_RANGE_TYPE_H */
diff --git a/libs/utils/include/celix_version_type.h 
b/libs/utils/include/celix_version_type.h
new file mode 100644
index ..dff2151b
--- /dev/null
+++ b/libs/utils/include/celix_version_type.h
@@ -0,0 +1,41 @@
+/**
+ *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

(celix) 02/02: #509 Replace version with celix_version usage a dfi test

2024-02-08 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git

commit ce00d0dfb6e312f1fb72f3251ff191935508ee77
Author: Pepijn Noltes 
AuthorDate: Thu Feb 8 19:24:48 2024 +0100

#509 Replace version with celix_version usage a dfi test
---
 libs/dfi/gtest/src/dyn_message_tests.cpp | 24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/libs/dfi/gtest/src/dyn_message_tests.cpp 
b/libs/dfi/gtest/src/dyn_message_tests.cpp
index 85e5578b..851320ef 100644
--- a/libs/dfi/gtest/src/dyn_message_tests.cpp
+++ b/libs/dfi/gtest/src/dyn_message_tests.cpp
@@ -19,8 +19,7 @@
 
 #include "gtest/gtest.h"
 
-#include 
-#include "version.h"
+#include "celix_version.h"
 
 
 extern "C" {
@@ -37,24 +36,21 @@ extern "C" {
 #include "celix_err.h"
 #include "celix_version.h"
 
-static void checkMessageVersion(dyn_message_type* dynMsg, const char* v){
-   int status = 0;
+static void checkMessageVersion(dyn_message_type* dynMsg, const char* v) {
+int status = 0;
 
-   const char* version = dynMessage_getVersionString(dynMsg);
-   ASSERT_STREQ(v, version);
+const char* version = dynMessage_getVersionString(dynMsg);
+ASSERT_STREQ(v, version);
 const celix_version_t* msgVersion = nullptr;
-celix_version_t* localMsgVersion = nullptr;
-   int cmpVersion = -1;
-   version_createVersionFromString(version,);
+celix_version_t* localMsgVersion = 
celix_version_createVersionFromString(version);
+int cmpVersion = -1;
 msgVersion = dynMessage_getVersion(dynMsg);
-   ASSERT_EQ(0, status);
+ASSERT_EQ(0, status);
 cmpVersion = celix_version_compareTo(msgVersion, localMsgVersion);
-   ASSERT_EQ(cmpVersion,0);
-   version_destroy(localMsgVersion);
-
+ASSERT_EQ(cmpVersion, 0);
+celix_version_destroy(localMsgVersion);
 }
 
-
 static void msg_test1(void) {
int status = 0;
dyn_message_type *dynMsg = NULL;



(celix) 01/02: Merge remote-tracking branch 'origin/master' into feature/509-remove-deprecated-version

2024-02-08 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 2ea4904f43aad6c896db8a92c9cebcdae768742c
Merge: a727b468 70548d61
Author: Pepijn Noltes 
AuthorDate: Thu Feb 8 19:16:32 2024 +0100

Merge remote-tracking branch 'origin/master' into 
feature/509-remove-deprecated-version

# Conflicts:
#   
bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c
#   libs/dfi/gtest/src/dyn_interface_tests.cpp
#   libs/dfi/gtest/src/dyn_message_tests.cpp

 .github/workflows/coverage.yml |   6 +-
 .github/workflows/ubuntu.yml   |   2 +-
 CMakeLists.txt |   5 +-
 .../src/export_registration_dfi.c  |   8 +-
 .../src/import_registration_dfi.c  |  58 +-
 .../gtest/src/RsaJsonRpcUnitTestSuite.cc   |  33 -
 .../rsa_rpc_json/src/rsa_json_rpc_endpoint_impl.c  |   9 +-
 .../rsa_rpc_json/src/rsa_json_rpc_impl.c   |   1 +
 .../rsa_rpc_json/src/rsa_json_rpc_proxy_impl.c |  25 +-
 cmake/CelixDeps.cmake.in   |   1 -
 cmake/celix_project/CodeCoverage.cmake |   4 +-
 conanfile.py   |   3 +
 libs/dfi/CMakeLists.txt|  12 +-
 libs/dfi/error_injector/CMakeLists.txt |   3 +-
 libs/dfi/error_injector/dfi/CMakeLists.txt |   1 -
 libs/dfi/error_injector/dfi/include/dfi_ei.h   |   2 -
 libs/dfi/error_injector/dfi/src/dfi_ei.cc  |   7 -
 .../error_injector/ffi}/CMakeLists.txt |  16 +-
 .../{dfi/include/dfi_ei.h => ffi/include/ffi_ei.h} |  16 +-
 libs/dfi/error_injector/ffi/src/ffi_ei.cc  |  44 +
 libs/dfi/gtest/CMakeLists.txt  |  30 +-
 libs/dfi/gtest/descriptors/example6.descriptor |   6 +-
 libs/dfi/gtest/descriptors/example7.descriptor |  13 +
 .../gtest/descriptors/invalids/garbage.descriptor  |   1 +
 .../invalids/invalidExtraSection.descriptor|  15 +
 .../invalidInterfaceAnnotations.descriptor |  13 +
 .../invalids/invalidMetaType.descriptor|   2 +-
 ...tor => invalidMethodMissingEquality.descriptor} |   2 +-
 ...=> invalidMethodMissingFunctionName.descriptor} |   2 +-
 ...escriptor => invalidMethodMissingId.descriptor} |   2 +-
 ...descriptor => invalidMsgMissingName.descriptor} |   3 +-
 ...criptor => invalidMsgMissingNewline.descriptor} |   4 +-
 .../invalids/invalidMsgMissingVersion.descriptor   |   3 +-
 ...ersion.descriptor => invalidMsgType.descriptor} |   4 +-
 .../invalids/invalidTypeMissingEquality.descriptor |  10 +
 ...> invalidTypeUnrecognizedSimpleType.descriptor} |   4 +-
 .../invalids/methodMissingHandle.descriptor|  13 +
 ...riptor => methodWithMultipleHandles.descriptor} |   4 +-
 .../invalids/methodWithTooManyArgs.descriptor  |  10 +
 .../invalids/methodWithoutArguments.descriptor |  13 +
 .../descriptors/invalids/multiOutArgs.descriptor   |   1 -
 ...tArgs.descriptor => multiPreOutArgs.descriptor} |   1 -
 .../gtest/descriptors/invalids/noName.descriptor   |  12 +
 .../gtest/descriptors/invalids/noType.descriptor   |  12 +
 ...idMetaType.descriptor => noTypeName.descriptor} |   4 +-
 .../invalids/outArgAtWrongPosition.descriptor  |   8 +
 libs/dfi/gtest/src/dyn_closure_tests.cpp   |  14 -
 libs/dfi/gtest/src/dyn_common_ei_tests.cc  |  84 ++
 libs/dfi/gtest/src/dyn_common_tests.cc | 149 
 libs/dfi/gtest/src/dyn_example_functions.c |   4 +
 libs/dfi/gtest/src/dyn_example_functions.h |   2 +
 libs/dfi/gtest/src/dyn_function_ei_tests.cc| 112 +++
 libs/dfi/gtest/src/dyn_function_tests.cpp  | 184 ++--
 libs/dfi/gtest/src/dyn_interface_ei_tests.cc   | 101 +++
 libs/dfi/gtest/src/dyn_interface_tests.cpp | 264 --
 libs/dfi/gtest/src/dyn_message_ei_tests.cc |  45 +
 libs/dfi/gtest/src/dyn_message_tests.cpp   |  92 +-
 libs/dfi/gtest/src/dyn_type_ei_tests.cc| 192 
 libs/dfi/gtest/src/dyn_type_tests.cpp  | 338 ++-
 libs/dfi/gtest/src/json_rpc_ei_tests.cc| 189 
 libs/dfi/gtest/src/json_rpc_test.c |  67 ++
 .../src/json_rpc_test.h}   |  41 +-
 libs/dfi/gtest/src/json_rpc_tests.cpp  | 719 +++
 libs/dfi/gtest/src/json_serializer_ei_tests.cc | 172 
 libs/dfi/gtest/src/json_serializer_tests.cpp   | 242 -
 libs/dfi/include/dfi_log_util.h|  78 --
 libs/dfi/include/dyn_function.h|  54 +-
 libs/dfi/include/dyn_interface.h   |  67 +-
 libs/dfi/include/dyn_message.h |  51 +-
 libs/dfi/include/dyn_type.h| 128 +--
 libs/dfi/include/json_r

(celix) branch feature/509-remove-deprecated-version updated (a727b468 -> ce00d0df)

2024-02-08 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git


from a727b468 Fix incorrect ENOMEM return in rsa_dfi
 add 3e61888b Replace dfi_log_util.h by celix_err.h.
 add 452bfb36 Make gcov play nicely with Conan2.
 add ba397036 #509 Remove embedded memstream from utils.
 add ccbd7b09 Add error injection for dyn_interface.
 add ad1fa88e Remove unnecessary null check (guaranteed by class invariant).
 add cced65cf Code deduplication and coverage improvements for dyn_common.
 add 45bc7d2f Add more tests for dyn_common.c
 add 2a0314d7 Add const qualifier to dyn_interface.h and apply early return 
to dynInterface_parse.
 add e27d73af Add const qualifier, apply early return error handling 
patterns, and improve interface ergonomic to dyn_interface.
 add 9e9b14f5 Improve ergonomics of dynInterface_methods.
 add b6d5e395 Apply const qualifier to dyn_type and improve ergonomics for 
functions that cannot fail.
 add 20ef8891 Merge branch 'master' into feature/dfi-cleanup
 add 04692bce Add dynType_parseOfName to avoid unnecessary string 
duplication during parsing.
 add 7936dca6 Extract common functionality of dyn_interface and dyn_message 
into dyn_descriptor and improve ergonomics of dyn_message API.
 add b7354954 Avoid explicit function pointer conversion.
 add d0c1ede2 Extend dynType_parseWithStreamOfName for code deduplication, 
and remove tail recursion from dynType_findType.
 add 179a3bf8 Merge branch 'master' into feature/dfi-cleanup
 add 24228794 Refactor dynType_parseComplex to return early on error and 
handle error of missing the closing brace.
 add 53c5da76 Remove tail recursion in dynType_alloc and add more parsing 
tests.
 add 0e790759 Merge branch 'master' into feature/dfi-cleanup
 add 32be748a Merge branch 'master' into feature/dfi-cleanup
 add 9758b649 Merge branch 'master' into feature/dfi-cleanup
 add 90dd0c07 Merge branch 'master' into feature/dfi-cleanup
 add 78b7d2d8 Refactor dynType_sequence_alloc and dynType_sequence_reserve.
 add 84b45788 Refactor other dynType_sequence methods.
 add dfc647c0 Merge branch 'master' into feature/dfi-cleanup
 add e84ac213 Make double-reference work for dynType, and improve 
dynType_print robustness and coverage.
 add a6e22f76 Upgrade to conan 1.62.
 add 1ff4bc15 Skip typedefs for reference when printing a dynType.
 add 0bde38e5 Only Skip typedefs already printed when printing a dynType.
 add e3562a5f Apply const qualifier to dynFunction.
 add bfc57bdd Refactor dynFunction_parse and dynFunction_parseWithStr.
 add 1c370b1e Add more tests for dynFunction_parse.
 add 86a90957 Code cleanup and testing coverage improvement of dynFunction.
 add 4c2b4d41 Treat unknown complex member as error when parsing and 
refactor json deserialization.
 add 4c6d4dbd More tests for `jsonSerializer_parseAny`.
 add b61b6bd4 Fix unit test error in 
TEST_F(JsonSerializerErrorInjectionTestSuite, SerilizationError).
 add 8e38c03f Fix compilation error linux-build-apt CI.
 add 58589ade Fix compilation error linux-build-apt CI.
 add 3f039d3e Add option to control whether to install Find modules defined 
by Celix, and skip it in conan build.
 add f6a42e85 Remove unnecessary find_dependency from CelixDeps.cmake.in.
 add e1dd1b88 Improve dyn_type deserialization.
 add 86db9e4e Upgrade to conan 1.62.
 add 62b42f2a Remove unnecessary find_dependency from CelixDeps.cmake.in.
 add 5afee1eb Merge pull request #720 from apache/hotfix/ci-build
 add 88d43dd7 Merge branch 'master' into feature/dfi-cleanup
 add 927926c8 Remove unnecessary recursions caused by type reference by 
name.
 add 782325e6 Improve dyn_type serialization.
 add 7f1391d4 Add more serialization tests.
 add 6fffb96b Support nullptr when serialize text.
 add 1220311c Optimize dyn_function's arguments handling.
 add 74f1243d Avoid list iteration in dynInterface_nrOfMethods.
 add 6223856e Add dynType_realType for code deduplication.
 add ba398d32 Remove unnecessary calloc and fix crash caused by pointer 
reference in jsonRpc_call.
 add 797e9755 Add some type checking to dyn_function.
 add 86249373 Update codecov-action.
 add 9b4501d2 Update codecov-action.
 add 29fa7d0f Merge pull request #722 from apache/hotfix/codecov-fix
 add f8966015 Merge branch 'master' into feature/dfi-cleanup
 add e34eb00b #723 Add triviality test for dynType so that definitions of 
dfi argument types can be given.
 add 823c131b Fix compilation error.
 add aebe9750 Merge triviality test for dynType into parsing.
 add 28db6c37 Perform more strict checking on interface method.
 add 56abd7d5 Optimize jsonRpc_handleReply.
 add d833f70b Fix issue caused by reference

(celix) branch feature/674-add-element-type-to-array-list updated (5097e483 -> 86e3b7a4)

2024-02-07 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


from 5097e483 #674 Add add/assign nullptr test for array list
 add 86e3b7a4 #674 Add test that triggers a realloc for the array list

No new revisions were added by this update.

Summary of changes:
 libs/utils/gtest/src/ArrayListTestSuite.cc | 16 
 1 file changed, 16 insertions(+)



(celix) branch feature/674-add-element-type-to-array-list updated: #674 Add add/assign nullptr test for array list

2024-02-07 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/674-add-element-type-to-array-list by this push:
 new 5097e483 #674 Add add/assign nullptr test for array list
5097e483 is described below

commit 5097e4831f20dbe3c947c0fb327327a1ad3cd3e3
Author: Pepijn Noltes 
AuthorDate: Wed Feb 7 19:25:38 2024 +0100

#674 Add add/assign nullptr test for array list
---
 .../gtest/src/ArrayListErrorInjectionTestSuite.cc  | 26 +++-
 libs/utils/gtest/src/ArrayListTestSuite.cc | 64 
 libs/utils/include/celix_array_list.h  | 43 +-
 libs/utils/src/array_list.c| 69 +++---
 4 files changed, 162 insertions(+), 40 deletions(-)

diff --git a/libs/utils/gtest/src/ArrayListErrorInjectionTestSuite.cc 
b/libs/utils/gtest/src/ArrayListErrorInjectionTestSuite.cc
index 309d54d0..f808d3af 100644
--- a/libs/utils/gtest/src/ArrayListErrorInjectionTestSuite.cc
+++ b/libs/utils/gtest/src/ArrayListErrorInjectionTestSuite.cc
@@ -20,7 +20,6 @@
 #include 
 
 #include "celix_array_list.h"
-#include "celix_array_list_ei.h"
 #include "celix_err.h"
 #include "celix_utils_ei.h"
 #include "celix_version_ei.h"
@@ -34,10 +33,28 @@ public:
 celix_ei_expect_calloc(nullptr, 0, nullptr);
 celix_ei_expect_celix_utils_strdup(nullptr, 0, nullptr);
 celix_ei_expect_celix_version_copy(nullptr, 0, nullptr);
+celix_err_resetErrors();
 }
 };
 
-TEST_F(ArrayListErrorInjectionTestSuite, TestAddFunctions) {
+TEST_F(ArrayListErrorInjectionTestSuite, CreateTest) {
+//Given an error is injected for calloc (used for the array struct)
+celix_ei_expect_calloc(CELIX_EI_UNKNOWN_CALLER, 1, nullptr);
+//Then creating an array list should fail
+EXPECT_EQ(nullptr, celix_arrayList_create());
+//And an error is logged to the celix_err
+EXPECT_EQ(1, celix_err_getErrorCount());
+
+//Given an error is injected for malloc (used for the element data)
+celix_ei_expect_malloc(CELIX_EI_UNKNOWN_CALLER, 0, nullptr);
+//Then creating an array list should fail
+EXPECT_EQ(nullptr, celix_arrayList_create());
+//And an error is logged to the celix_err
+EXPECT_EQ(2, celix_err_getErrorCount());
+}
+
+
+TEST_F(ArrayListErrorInjectionTestSuite, AddFunctionsTest) {
 //Given an array list with a capacity of 10 (whitebox knowledge)
 auto* list = celix_arrayList_create();
 
@@ -53,6 +70,8 @@ TEST_F(ArrayListErrorInjectionTestSuite, TestAddFunctions) {
 //Then adding an element should fail
 EXPECT_EQ(CELIX_ENOMEM, celix_arrayList_addInt(list, 10));
 EXPECT_EQ(10, celix_arrayList_size(list));
+//And an error is logged to the celix_err
+EXPECT_EQ(1, celix_err_getErrorCount());
 
 celix_arrayList_destroy(list);
 }
@@ -70,7 +89,8 @@ TEST_F(ArrayListErrorInjectionTestSuite, 
AddStringAndAddVersionFailureTest) {
 // When an error is injected for celix_version_copy
 celix_ei_expect_celix_version_copy((void*)celix_arrayList_addVersion, 0, 
nullptr);
 // Then adding a version should fail
-EXPECT_EQ(CELIX_ENOMEM, celix_arrayList_addVersion(versionList, NULL));
+celix_autoptr(celix_version_t) version = 
celix_version_createVersionFromString("1.0.0");
+EXPECT_EQ(CELIX_ENOMEM, celix_arrayList_addVersion(versionList, version));
 }
 
 TEST_F(ArrayListErrorInjectionTestSuite, CopyArrayListFailureTest) {
diff --git a/libs/utils/gtest/src/ArrayListTestSuite.cc 
b/libs/utils/gtest/src/ArrayListTestSuite.cc
index 0bc61c26..e820f714 100644
--- a/libs/utils/gtest/src/ArrayListTestSuite.cc
+++ b/libs/utils/gtest/src/ArrayListTestSuite.cc
@@ -528,3 +528,67 @@ TEST_F(ArrayListTestSuite, AutoCleanupTest) {
 celix_autoptr(celix_array_list_t) list = celix_arrayList_create();
 EXPECT_NE(nullptr, list);
 }
+
+TEST_F(ArrayListTestSuite, AddNullTest) {
+// Given an undefined type, string, string ref and version list
+celix_autoptr(celix_array_list_t) list = celix_arrayList_create();
+celix_autoptr(celix_array_list_t) stringList = 
celix_arrayList_createStringArray();
+celix_autoptr(celix_array_list_t) stringRefList = 
celix_arrayList_createStringRefArray();
+celix_autoptr(celix_array_list_t) versionList = 
celix_arrayList_createVersionArray();
+
+// When adding a null value to the lists
+celix_arrayList_add(list, nullptr);
+celix_arrayList_addString(stringList, nullptr);
+celix_arrayList_addString(stringRefList, nullptr);
+celix_arrayList_addVersion(versionList, nullptr);
+
+// Then the lists contain the null value
+EXPECT_EQ(1, celix_arrayList_size(list));
+EXPECT_EQ(nullptr, celix_arrayList_get(list, 0));
+EXPECT_EQ(1, celix_arrayList_size(stringList));
+  

(celix) branch feature/674-add-element-type-to-array-list updated: #674 Add additional array list ei tests

2024-02-05 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/674-add-element-type-to-array-list by this push:
 new 21051234 #674 Add additional array list ei tests
21051234 is described below

commit 210512347eef75d758386ed1dcd6305ed231e480
Author: Pepijn Noltes 
AuthorDate: Mon Feb 5 23:14:23 2024 +0100

#674 Add additional array list ei tests
---
 .../gtest/src/ArrayListErrorInjectionTestSuite.cc  | 43 ++
 libs/utils/gtest/src/ArrayListTestSuite.cc | 18 -
 libs/utils/include/celix_array_list.h  |  2 +
 libs/utils/src/array_list.c| 25 +++--
 4 files changed, 60 insertions(+), 28 deletions(-)

diff --git a/libs/utils/gtest/src/ArrayListErrorInjectionTestSuite.cc 
b/libs/utils/gtest/src/ArrayListErrorInjectionTestSuite.cc
index 1d3d3a7d..309d54d0 100644
--- a/libs/utils/gtest/src/ArrayListErrorInjectionTestSuite.cc
+++ b/libs/utils/gtest/src/ArrayListErrorInjectionTestSuite.cc
@@ -20,6 +20,10 @@
 #include 
 
 #include "celix_array_list.h"
+#include "celix_array_list_ei.h"
+#include "celix_err.h"
+#include "celix_utils_ei.h"
+#include "celix_version_ei.h"
 #include "malloc_ei.h"
 
 class ArrayListErrorInjectionTestSuite : public ::testing::Test {
@@ -27,6 +31,9 @@ public:
 ArrayListErrorInjectionTestSuite() = default;
 ~ArrayListErrorInjectionTestSuite() noexcept override {
 celix_ei_expect_realloc(nullptr, 0, nullptr);
+celix_ei_expect_calloc(nullptr, 0, nullptr);
+celix_ei_expect_celix_utils_strdup(nullptr, 0, nullptr);
+celix_ei_expect_celix_version_copy(nullptr, 0, nullptr);
 }
 };
 
@@ -49,3 +56,39 @@ TEST_F(ArrayListErrorInjectionTestSuite, TestAddFunctions) {
 
 celix_arrayList_destroy(list);
 }
+
+TEST_F(ArrayListErrorInjectionTestSuite, AddStringAndAddVersionFailureTest) {
+// Given a string array list
+celix_autoptr(celix_array_list_t) stringList = 
celix_arrayList_createStringArray();
+// When an error is injected for celix_utils_strdup
+celix_ei_expect_celix_utils_strdup((void*)celix_arrayList_addString, 0, 
nullptr);
+// Then adding a string should fail
+EXPECT_EQ(CELIX_ENOMEM, celix_arrayList_addString(stringList, "test"));
+
+// Given a version array list
+celix_autoptr(celix_array_list_t) versionList = 
celix_arrayList_createVersionArray();
+// When an error is injected for celix_version_copy
+celix_ei_expect_celix_version_copy((void*)celix_arrayList_addVersion, 0, 
nullptr);
+// Then adding a version should fail
+EXPECT_EQ(CELIX_ENOMEM, celix_arrayList_addVersion(versionList, NULL));
+}
+
+TEST_F(ArrayListErrorInjectionTestSuite, CopyArrayListFailureTest) {
+// Given a string array list with 10 elements (whitebox knowledge)
+celix_autoptr(celix_array_list_t) stringList = 
celix_arrayList_createStringArray();
+celix_arrayList_addString(stringList, "test1");
+
+// When an error is injected for calloc
+celix_ei_expect_calloc((void*)celix_arrayList_copy, 1, nullptr);
+// Then copying an array list should fail
+EXPECT_EQ(nullptr, celix_arrayList_copy(stringList));
+// And a celix_err is expected
+EXPECT_EQ(1, celix_err_getErrorCount());
+
+// When an error is injected for celix_utils_strdup
+celix_ei_expect_celix_utils_strdup((void*)celix_arrayList_addString, 0, 
nullptr);
+// Then copying an array list should fail
+EXPECT_EQ(nullptr, celix_arrayList_copy(stringList));
+// And a celix_err is expected
+EXPECT_EQ(2, celix_err_getErrorCount());
+}
diff --git a/libs/utils/gtest/src/ArrayListTestSuite.cc 
b/libs/utils/gtest/src/ArrayListTestSuite.cc
index 18069db7..0bc61c26 100644
--- a/libs/utils/gtest/src/ArrayListTestSuite.cc
+++ b/libs/utils/gtest/src/ArrayListTestSuite.cc
@@ -26,14 +26,14 @@ class ArrayListTestSuite : public ::testing::Test {
 public:
 };
 
-TEST_F(ArrayListTestSuite, TestCreateDestroyHashMap) {
+TEST_F(ArrayListTestSuite, CreateDestroyArrayListTest) {
 auto* list = celix_arrayList_create();
 EXPECT_TRUE(list != nullptr);
 EXPECT_EQ(0, celix_arrayList_size(list));
 celix_arrayList_destroy(list);
 }
 
-TEST_F(ArrayListTestSuite, TestArrayListWithEquals) {
+TEST_F(ArrayListTestSuite, ArrayListWithEqualsTest) {
 celix_array_list_create_options_t opts{};
 opts.equalsCallback = [](celix_array_list_entry_t a, 
celix_array_list_entry_t b) -> bool {
 const char* sa = (char*)a.voidPtrVal;
@@ -109,7 +109,7 @@ void testArrayListForTemplateType(const std::vector& 
entries,
 celix_arrayList_destroy(list);
 }
 
-TEST_F(ArrayListTestSuite, TestDifferentEntyTypesForArrayList) {
+TEST_F(ArrayListTestSui

(celix) branch feature/674-add-element-type-to-array-list updated: #674 Add array list equal and copy function

2024-02-05 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/674-add-element-type-to-array-list by this push:
 new 1f324c5b #674 Add array list equal and copy function
1f324c5b is described below

commit 1f324c5b2bb5ff20defaa9f2bdb32a66d1d33034
Author: Pepijn Noltes 
AuthorDate: Mon Feb 5 19:56:44 2024 +0100

#674 Add array list equal and copy function
---
 libs/utils/gtest/src/ArrayListTestSuite.cc | 61 +
 libs/utils/include/celix_array_list.h  | 73 ++
 libs/utils/src/array_list.c| 60 
 3 files changed, 175 insertions(+), 19 deletions(-)

diff --git a/libs/utils/gtest/src/ArrayListTestSuite.cc 
b/libs/utils/gtest/src/ArrayListTestSuite.cc
index 6a508188..18069db7 100644
--- a/libs/utils/gtest/src/ArrayListTestSuite.cc
+++ b/libs/utils/gtest/src/ArrayListTestSuite.cc
@@ -376,6 +376,67 @@ TEST_F(ArrayListTestSuite, SortTypedArrayLists) {
 EXPECT_EQ(0, 
celix_version_compareToMajorMinor(celix_arrayList_getVersion(versionList, 4), 
3, 2));
 }
 
+TEST_F(ArrayListTestSuite, EqualCheck) {
+//Given a selection of long list and a double list
+celix_autoptr(celix_array_list_t) list1 = 
celix_arrayList_createLongArray();
+celix_arrayList_addLong(list1, 1L);
+celix_autoptr(celix_array_list_t) list2 = 
celix_arrayList_createLongArray(); //same as list1
+celix_arrayList_addLong(list2, 1L);
+celix_autoptr(celix_array_list_t) list3 = 
celix_arrayList_createLongArray(); //different values than list1
+celix_arrayList_addLong(list3, 2L);
+celix_autoptr(celix_array_list_t) list4 = 
celix_arrayList_createLongArray(); //different size than list1
+celix_arrayList_addLong(list4, 1L);
+celix_arrayList_addLong(list4, 2L);
+celix_autoptr(celix_array_list_t) list5 = 
celix_arrayList_createDoubleArray(); //different type than list1
+celix_arrayList_addDouble(list5, 1.0);
+
+//The lists can be checked for equality
+EXPECT_TRUE(celix_arrayList_equals(list1, list2));
+EXPECT_TRUE(celix_arrayList_equals(list1, list1));
+EXPECT_TRUE(celix_arrayList_equals(nullptr, nullptr));
+
+EXPECT_FALSE(celix_arrayList_equals(nullptr, list1));
+EXPECT_FALSE(celix_arrayList_equals(list1, nullptr));
+EXPECT_FALSE(celix_arrayList_equals(list1, list3));
+EXPECT_FALSE(celix_arrayList_equals(list1, list4));
+EXPECT_FALSE(celix_arrayList_equals(list1, list5));
+}
+
+TEST_F(ArrayListTestSuite, CopyArrayTest) {
+// Given a long, string, string ref and version list
+celix_autoptr(celix_array_list_t) longList = 
celix_arrayList_createLongArray();
+celix_arrayList_addLong(longList, 1L);
+celix_arrayList_addLong(longList, 2L);
+celix_arrayList_addLong(longList, 3L);
+
+celix_autoptr(celix_array_list_t) stringList = 
celix_arrayList_createStringArray();
+celix_arrayList_addString(stringList, "1");
+celix_arrayList_addString(stringList, "2");
+celix_arrayList_addString(stringList, "3");
+
+celix_autoptr(celix_array_list_t) stringRefList = 
celix_arrayList_createStringRefArray();
+celix_arrayList_addString(stringRefList, "1");
+celix_arrayList_addString(stringRefList, "2");
+celix_arrayList_addString(stringRefList, "3");
+
+celix_autoptr(celix_array_list_t) versionList = 
celix_arrayList_createVersionArray();
+celix_arrayList_assignVersion(versionList, celix_version_create(1, 0, 0, 
""));
+celix_arrayList_assignVersion(versionList, celix_version_create(2, 0, 0, 
""));
+celix_arrayList_assignVersion(versionList, celix_version_create(3, 0, 0, 
""));
+
+// When copying the lists
+celix_autoptr(celix_array_list_t) longListCopy = 
celix_arrayList_copy(longList);
+celix_autoptr(celix_array_list_t) stringListCopy = 
celix_arrayList_copy(stringList);
+celix_autoptr(celix_array_list_t) stringRefListCopy = 
celix_arrayList_copy(stringRefList);
+celix_autoptr(celix_array_list_t) versionListCopy = 
celix_arrayList_copy(versionList);
+
+// Then the copied lists are equal to the original lists
+EXPECT_TRUE(celix_arrayList_equals(longList, longListCopy));
+EXPECT_TRUE(celix_arrayList_equals(stringList, stringListCopy));
+EXPECT_TRUE(celix_arrayList_equals(stringRefList, stringRefListCopy));
+EXPECT_TRUE(celix_arrayList_equals(versionList, versionListCopy));
+}
+
 TEST_F(ArrayListTestSuite, TestSimpleRemovedCallbacksForArrayList) {
 celix_array_list_create_options_t opts{};
 opts.simpleRemovedCallback = free;
diff --git a/libs/utils/include/celix_array_list.h 
b/libs/utils/include/celix_array_list.h
index b4c2dc58..3a0b0ff9 100644
--- a/libs/utils/include/celix_a

(celix) 03/04: #674 Add initial element type support for array list

2024-02-04 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 21f379de8a0ef8923e64453b851747add74ebdc6
Author: Pepijn Noltes 
AuthorDate: Sun Feb 4 19:07:44 2024 +0100

#674 Add initial element type support for array list
---
 bundles/logging/log_admin/src/celix_log_admin.c |  14 +-
 libs/utils/gtest/src/ArrayListTestSuite.cc  |   2 +-
 libs/utils/include/celix_array_list.h   | 453 ---
 libs/utils/src/array_list.c | 465 
 libs/utils/src/array_list_private.h |  41 ---
 5 files changed, 813 insertions(+), 162 deletions(-)

diff --git a/bundles/logging/log_admin/src/celix_log_admin.c 
b/bundles/logging/log_admin/src/celix_log_admin.c
index 5b983ef1..6b1be0f5 100644
--- a/bundles/logging/log_admin/src/celix_log_admin.c
+++ b/bundles/logging/log_admin/src/celix_log_admin.c
@@ -429,12 +429,12 @@ static size_t celix_logAdmin_setSinkEnabled(void *handle, 
const char* select, bo
 
 static celix_array_list_t* celix_logAdmin_currentLogServices(void *handle) {
 celix_log_admin_t* admin = handle;
-celix_array_list_t* loggers = celix_arrayList_create();
+celix_array_list_t* loggers = celix_arrayList_createStringArray();
 celixThreadRwlock_readLock(>lock);
 hash_map_iterator_t iter = hashMapIterator_construct(admin->loggers);
 while (hashMapIterator_hasNext()) {
 celix_log_service_entry_t* visit = hashMapIterator_nextValue();
-celix_arrayList_add(loggers, celix_utils_strdup(visit->name));
+celix_arrayList_addString(loggers, visit->name);
 }
 celixThreadRwlock_unlock(>lock);
 return loggers;
@@ -442,12 +442,12 @@ static celix_array_list_t* 
celix_logAdmin_currentLogServices(void *handle) {
 
 static celix_array_list_t* celix_logAdmin_currentSinks(void *handle) {
 celix_log_admin_t* admin = handle;
-celix_array_list_t* sinks = celix_arrayList_create();
+celix_array_list_t* sinks = celix_arrayList_createStringArray();
 celixThreadRwlock_readLock(>lock);
 hash_map_iterator_t iter = hashMapIterator_construct(admin->sinks);
 while (hashMapIterator_hasNext()) {
 celix_log_sink_entry_t* entry = hashMapIterator_nextValue();
-celix_arrayList_add(sinks, celix_utils_strdup(entry->name));
+celix_arrayList_addString(sinks, entry->name);
 }
 celixThreadRwlock_unlock(>lock);
 return sinks;
@@ -539,8 +539,8 @@ static void 
celix_logAdmin_setSinkEnabledCmd(celix_log_admin_t* admin, const cha
 static void celix_logAdmin_InfoCmd(celix_log_admin_t* admin, FILE* outStream, 
FILE* errorStream CELIX_UNUSED) {
 celix_array_list_t* logServices = celix_logAdmin_currentLogServices(admin);
 celix_array_list_t* sinks = celix_logAdmin_currentSinks(admin);
-celix_arrayList_sort(logServices, (void*)strcmp);
-celix_arrayList_sort(sinks, (void*)strcmp);
+celix_arrayList_sort(logServices);
+celix_arrayList_sort(sinks);
 
 fprintf(outStream, "Log Admin provided log services:\n");
 for (int i = 0 ; i < celix_arrayList_size(logServices); ++i) {
@@ -552,7 +552,6 @@ static void celix_logAdmin_InfoCmd(celix_log_admin_t* 
admin, FILE* outStream, FI
 fprintf(outStream, " |- %i) Log Service %20s, active log level %s, 
%s\n",
 i+1, name, celix_logUtils_logLevelToString(level), 
detailed ? "detailed" : "brief");
 }
-free(name);
 }
 celix_arrayList_destroy(logServices);
 
@@ -565,7 +564,6 @@ static void celix_logAdmin_InfoCmd(celix_log_admin_t* 
admin, FILE* outStream, FI
 if (found) {
 fprintf(outStream, " |- %i) Log Sink %20s, %s\n", i+1, name, 
enabled ? "enabled" : "disabled");
 }
-free(name);
 }
 } else {
 fprintf(outStream, "Log Admin has found 0 log sinks\n");
diff --git a/libs/utils/gtest/src/ArrayListTestSuite.cc 
b/libs/utils/gtest/src/ArrayListTestSuite.cc
index 5a0e60c3..488f069f 100644
--- a/libs/utils/gtest/src/ArrayListTestSuite.cc
+++ b/libs/utils/gtest/src/ArrayListTestSuite.cc
@@ -219,7 +219,7 @@ TEST_F(ArrayListTestSuite, TestSortForArrayList) {
 EXPECT_EQ(celix_arrayList_getInt(list, 3), 4);
 
 
-celix_array_list_sort_entries_fp sort = [](celix_array_list_entry_t a, 
celix_array_list_entry_t b) -> int {
+celix_array_list_compare_entries_fp sort = [](celix_array_list_entry_t a, 
celix_array_list_entry_t b) -> int {
 return a.intVal - b.intVal;
 };
 celix_arrayList_sortEntries(list, sort);
diff --git a/libs/utils/include/celix_array_list.h 
b/libs/utils/include/celix_array_list.h
index b38772b8..25925c89 100644
--- a/libs/utils/include/celix_array_list.h
+++ b/libs/utils/include/cel

(celix) 02/04: #674 Refactor array list compare in ctx, reg and rsa

2024-02-04 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git

commit ba42e664ca5eff9e43a2d0df1400538161cac2d7
Author: Pepijn Noltes 
AuthorDate: Sun Feb 4 19:07:24 2024 +0100

#674 Refactor array list compare in ctx, reg and rsa
---
 .../discovery_common/src/endpoint_discovery_poller.c   |  8 ++--
 .../rsa_common/src/remote_interceptors_handler.c   | 10 +-
 libs/framework/include_deprecated/service_registry.h   |  2 +-
 libs/framework/src/bundle_context.c|  4 ++--
 libs/framework/src/service_registry.c  | 10 +-
 5 files changed, 19 insertions(+), 15 deletions(-)

diff --git 
a/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c 
b/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c
index edf560fc..567ff84b 100644
--- a/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c
+++ b/bundles/remote_services/discovery_common/src/endpoint_discovery_poller.c
@@ -195,7 +195,9 @@ celix_status_t 
endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_p
 // Avoid memory leaks when adding an already existing URL...
 celix_array_list_t* endpoints = hashMap_get(poller->entries, url);
 if (endpoints == NULL) {
-endpoints = 
celix_arrayList_createWithEquals(endpointDiscoveryPoller_endpointDescriptionEquals);
+celix_array_list_create_options_t opts = 
CELIX_EMPTY_ARRAY_LIST_CREATE_OPTIONS;
+opts.equalsCallback = 
endpointDiscoveryPoller_endpointDescriptionEquals;
+endpoints = celix_arrayList_createWithOptions();
 
 if (endpoints) {
 celix_logHelper_debug(*poller->loghelper, "ENDPOINT_POLLER: add 
new discovery endpoint with url %s", url);
@@ -253,7 +255,9 @@ celix_status_t 
endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discover
 celix_status_t
 endpointDiscoveryPoller_poll(endpoint_discovery_poller_t* poller, char* url, 
celix_array_list_t* currentEndpoints) {
 // create an arraylist with a custom equality test to ensure we can find 
endpoints properly...
-celix_array_list_t* updatedEndpoints = 
celix_arrayList_createWithEquals(endpointDiscoveryPoller_endpointDescriptionEquals);
+celix_array_list_create_options_t opts = 
CELIX_EMPTY_ARRAY_LIST_CREATE_OPTIONS;
+opts.equalsCallback = endpointDiscoveryPoller_endpointDescriptionEquals;
+celix_array_list_t* updatedEndpoints = 
celix_arrayList_createWithOptions();
 if (!updatedEndpoints) {
 return CELIX_ENOMEM;
 }
diff --git 
a/bundles/remote_services/rsa_common/src/remote_interceptors_handler.c 
b/bundles/remote_services/rsa_common/src/remote_interceptors_handler.c
index 65c25207..591e7322 100644
--- a/bundles/remote_services/rsa_common/src/remote_interceptors_handler.c
+++ b/bundles/remote_services/rsa_common/src/remote_interceptors_handler.c
@@ -42,7 +42,7 @@ struct remote_interceptors_handler {
 celix_thread_mutex_t lock;
 };
 
-static int referenceCompare(const void *a, const void *b);
+static int referenceCompare(celix_array_list_entry_t a, 
celix_array_list_entry_t b);
 
 static void remoteInterceptorsHandler_addInterceptor(void *handle, void *svc, 
const celix_properties_t *props);
 static void remoteInterceptorsHandler_removeInterceptor(void *handle, void 
*svc, const celix_properties_t *props);
@@ -104,7 +104,7 @@ void remoteInterceptorsHandler_addInterceptor(void *handle, 
void *svc, const cel
 entry->interceptor = svc;
 celix_arrayList_add(handler->interceptors, entry);
 
-celix_arrayList_sort(handler->interceptors, referenceCompare);
+celix_arrayList_sortEntries(handler->interceptors, referenceCompare);
 }
 
 celixThreadMutex_unlock(>lock);
@@ -197,9 +197,9 @@ void 
remoteInterceptorHandler_invokePostProxyCall(remote_interceptors_handler_t
 celixThreadMutex_unlock(>lock);
 }
 
-int referenceCompare(const void *a, const void *b) {
-const entry_t *aEntry = a;
-const entry_t *bEntry = b;
+int referenceCompare(celix_array_list_entry_t a, celix_array_list_entry_t b) {
+const entry_t *aEntry = a.voidPtrVal;
+const entry_t *bEntry = b.voidPtrVal;
 
 long servIdA = celix_properties_getAsLong(aEntry->properties, 
CELIX_FRAMEWORK_SERVICE_ID, 0);
 long servIdB = celix_properties_getAsLong(bEntry->properties, 
CELIX_FRAMEWORK_SERVICE_ID, 0);
diff --git a/libs/framework/include_deprecated/service_registry.h 
b/libs/framework/include_deprecated/service_registry.h
index 84a55104..7cdb785d 100644
--- a/libs/framework/include_deprecated/service_registry.h
+++ b/libs/framework/include_deprecated/service_registry.h
@@ -152,7 +152,7 @@ CELIX_FRAMEWORK_EXPORT char* 
celix_serviceRegistry_createFilterFor(
  * Find services and return a array list of servi

(celix) branch feature/674-add-element-type-to-array-list created (now f0ff9d94)

2024-02-04 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git


  at f0ff9d94 #674 Add array list element type testing

This branch includes the following new commits:

 new b4df54cc #674 Fix in push stream for gcc 13
 new ba42e664 #674 Refactor array list compare in ctx, reg and rsa
 new 21f379de #674 Add initial element type support for array list
 new f0ff9d94 #674 Add array list element type testing

The 4 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/04: #674 Fix in push stream for gcc 13

2024-02-04 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git

commit b4df54cc4626309d11b6e4337f9581d35c07dfac
Author: Pepijn Noltes 
AuthorDate: Sun Feb 4 19:05:47 2024 +0100

#674 Fix in push stream for gcc 13
---
 libs/pushstreams/api/celix/impl/BufferedPushStream.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/pushstreams/api/celix/impl/BufferedPushStream.h 
b/libs/pushstreams/api/celix/impl/BufferedPushStream.h
index 5172f42e..6a2d1e6f 100644
--- a/libs/pushstreams/api/celix/impl/BufferedPushStream.h
+++ b/libs/pushstreams/api/celix/impl/BufferedPushStream.h
@@ -98,10 +98,10 @@ void celix::BufferedPushStream::startWorker() {
 std::weak_ptr>>> weak{queue};
 auto lk = weak.lock();
 if (lk) {
-std::unique_ptr> event = std::move(popQueue());
+std::unique_ptr> event = popQueue();
 while (event != nullptr) {
 this->nextEvent.accept(*event);
-event = std::move(popQueue());
+event = popQueue();
 }
 cv.notify_all();
 }



(celix) 04/04: #674 Add array list element type testing

2024-02-04 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-add-element-type-to-array-list
in repository https://gitbox.apache.org/repos/asf/celix.git

commit f0ff9d94eb83ba3589e644988c338086db251b18
Author: Pepijn Noltes 
AuthorDate: Sun Feb 4 23:32:00 2024 +0100

#674 Add array list element type testing
---
 .../log_admin/gtest/src/LogAdminTestSuite.cc   |   8 -
 bundles/logging/log_admin/src/celix_log_admin.c|   4 +-
 .../log_service_api/include/celix_log_control.h|  12 +
 libs/utils/gtest/CMakeLists.txt|   2 +-
 libs/utils/gtest/src/ArrayListTestSuite.cc | 351 -
 libs/utils/include/celix_array_list.h  |  10 +-
 libs/utils/src/array_list.c|  40 ++-
 7 files changed, 330 insertions(+), 97 deletions(-)

diff --git a/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc 
b/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
index 859a24a7..fe11a78f 100644
--- a/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
+++ b/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
@@ -208,10 +208,6 @@ TEST_F(LogBundleTestSuite, SinkLogControl) {
 
 auto *list = control->currentSinks(control->handle);
 EXPECT_EQ(3, celix_arrayList_size(list));
-for (int i = 0; i < celix_arrayList_size(list); ++i) {
-auto *item = celix_arrayList_get(list, i);
-free(item);
-}
 celix_arrayList_destroy(list);
 
 
@@ -277,10 +273,6 @@ TEST_F(LogBundleTestSuite, LogServiceControl) {
 
 auto *list = control->currentLogServices(control->handle);
 EXPECT_EQ(4, celix_arrayList_size(list));
-for (int i = 0; i < celix_arrayList_size(list); ++i) {
-auto *item = celix_arrayList_get(list, i);
-free(item);
-}
 celix_arrayList_destroy(list);
 
 celix_bundleContext_stopTracker(ctx.get(), trkId1);
diff --git a/bundles/logging/log_admin/src/celix_log_admin.c 
b/bundles/logging/log_admin/src/celix_log_admin.c
index 6b1be0f5..5ed38d53 100644
--- a/bundles/logging/log_admin/src/celix_log_admin.c
+++ b/bundles/logging/log_admin/src/celix_log_admin.c
@@ -544,7 +544,7 @@ static void celix_logAdmin_InfoCmd(celix_log_admin_t* 
admin, FILE* outStream, FI
 
 fprintf(outStream, "Log Admin provided log services:\n");
 for (int i = 0 ; i < celix_arrayList_size(logServices); ++i) {
-char *name = celix_arrayList_get(logServices, i);
+const char *name = celix_arrayList_getString(logServices, i);
 celix_log_level_e level;
 bool detailed;
 bool found = celix_logAdmin_logServiceInfoEx(admin, name, , 
);
@@ -558,7 +558,7 @@ static void celix_logAdmin_InfoCmd(celix_log_admin_t* 
admin, FILE* outStream, FI
 if (celix_arrayList_size(sinks) > 0) {
 fprintf(outStream, "Log Admin found log sinks:\n");
 for (int i = 0 ; i < celix_arrayList_size(sinks); ++i) {
-char *name = celix_arrayList_get(sinks, i);
+const char *name = celix_arrayList_getString(sinks, i);
 bool enabled;
 bool found = celix_logAdmin_sinkInfo(admin, name, );
 if (found) {
diff --git a/bundles/logging/log_service_api/include/celix_log_control.h 
b/bundles/logging/log_service_api/include/celix_log_control.h
index 5f3d82f3..98c9a31d 100644
--- a/bundles/logging/log_service_api/include/celix_log_control.h
+++ b/bundles/logging/log_service_api/include/celix_log_control.h
@@ -44,8 +44,20 @@ typedef struct celix_log_control {
 
 size_t (*setSinkEnabled)(void *handle, const char* select, bool enabled);
 
+/**
+ * @brief Get a list of names for the log service provided by the log 
service.
+ * @param handle The service handle.
+ * @return A string array list.
+ * The array list is owned by the caller and should be destroyed 
by calling celix_arrayList_destroy.
+ */
 celix_array_list_t* (*currentLogServices)(void *handle);
 
+/**
+ * @brief Get a list of sinks names used by the log service.
+ * @param handle The service handle.
+ * @return A string array list.
+ *The array list is owned by the caller and should be destroyed by 
calling celix_arrayList_destroy.
+ */
 celix_array_list_t* (*currentSinks)(void *handle);
 
 bool (*logServiceInfo)(void *handle, const char* loggerName, 
celix_log_level_e* outActiveLogLevel);
diff --git a/libs/utils/gtest/CMakeLists.txt b/libs/utils/gtest/CMakeLists.txt
index e1e22ef7..db39b903 100644
--- a/libs/utils/gtest/CMakeLists.txt
+++ b/libs/utils/gtest/CMakeLists.txt
@@ -34,6 +34,7 @@ add_executable(test_utils
 src/ThreadsTestSuite.cc
 src/CelixErrnoTestSuite.cc
 src/CelixUtilsAutoCleanupTestSuite.cc
+src/ArrayListTestSuite.cc
 src/DeprecatedHashmapTestSuite.cc
 )
 
@@ -45,7 +46,6 @@ configure_file(resources/properties.txt 
${CMAKE_CURRENT_BINARY_DIR}/re

(celix) branch feature/674-improve-properties updated (4841034b -> 51db9646)

2024-01-28 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


from 4841034b Update codecov-action.
 add 51db9646 Refactor conversion of string to/from string array list

No new revisions were added by this update.

Summary of changes:
 .../src/ConvertUtilsErrorInjectionTestSuite.cc | 28 +++-
 libs/utils/gtest/src/ConvertUtilsTestSuite.cc  | 72 +++
 libs/utils/include/celix_array_list.h  |  2 +-
 libs/utils/include/celix_convert_utils.h   |  3 +
 libs/utils/src/celix_convert_utils.c   | 81 --
 5 files changed, 149 insertions(+), 37 deletions(-)



(celix) 01/02: Update NOTICE (2019->2024)

2024-01-22 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 234ccc06d3ae7c40a3e8e65d3a32433fe362d61e
Author: Pepijn Noltes 
AuthorDate: Mon Jan 22 19:58:05 2024 +0100

Update NOTICE (2019->2024)
---
 NOTICE | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NOTICE b/NOTICE
index ffb146db..2695bd0a 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache Celix
-Copyright [2010-2019] The Apache Software Foundation
+Copyright [2010-2024] The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).



(celix) branch feature/674-improve-properties updated (e2373dfa -> 96019472)

2024-01-22 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


from e2373dfa Fix memleak in properties setStrings and setVersions
 new 234ccc06 Update NOTICE (2019->2024)
 new 96019472 Update CHANGES.md

The 2 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.


Summary of changes:
 CHANGES.md | 4 +++-
 NOTICE | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)



(celix) 02/02: Update CHANGES.md

2024-01-22 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 96019472ba6985144ab0074753ea547cf427f6a5
Author: Pepijn Noltes 
AuthorDate: Mon Jan 22 20:00:32 2024 +0100

Update CHANGES.md
---
 CHANGES.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 4dd00c48..4b42b913 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -58,10 +58,12 @@ limitations under the License.
 - linked_list.h is removed and no longer supported. Use celix_array_list.h 
instead.
 - ip_utils.h is removed and no longer supported.  
 - array_list.h is removed and no longer supported. Use celix_array_list.h 
instead.
+- Apache Celix filter now use the underlying properties value types for 
matching. This means that it is more important
+  to add service properties with the correct type.
 
 ## New Features
 
-- Basic type support for value in celix Properties.
+- Type support for value in celix Properties, including support for arrays.
 
 # Noteworthy Changes for 2.4.0 (2023-09-27)
 



(celix) 03/03: Fix memleak in properties setStrings and setVersions

2024-01-22 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git

commit e2373dfa0cd023ef9e6a9828339fc78eb716a0f9
Author: Pepijn Noltes 
AuthorDate: Mon Jan 22 19:56:37 2024 +0100

Fix memleak in properties setStrings and setVersions
---
 libs/utils/src/properties.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libs/utils/src/properties.c b/libs/utils/src/properties.c
index 1fd9753e..b478bf7d 100644
--- a/libs/utils/src/properties.c
+++ b/libs/utils/src/properties.c
@@ -1223,6 +1223,7 @@ celix_properties_setStrings(celix_properties_t* 
properties, const char* key, con
 celix_status_t status = celix_arrayList_addString(list, copy);
 if (status != CELIX_SUCCESS) {
 celix_err_push("Failed to add string to array list");
+free(copy);
 return status;
 }
 }
@@ -1354,6 +1355,7 @@ celix_properties_setVersions(celix_properties_t* 
properties, const char* key, co
 celix_status_t status = celix_arrayList_add(list, copy);
 if (status != CELIX_SUCCESS) {
 celix_err_push("Failed to add version to array list");
+celix_version_destroy(copy);
 return status;
 }
 }



(celix) branch feature/674-improve-properties updated (7047b644 -> e2373dfa)

2024-01-22 Thread pnoltes
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git


from 7047b644 Add properties and filter introduction documentation
 add 2070f583 [CID 339894]Remove dead code.
 add 41aad66a Merge pull request #716 from apache/hotfix/coverity
 add 7e050ed1 container: Remove incorrect comment in Gitpod container
 add 2fa08300 container: Rename 'start' script to 'run' script
 add 99e9b7b0 container: Update README to advise using 'build' directory
 add 171db15e container: Fix variable globbing in run script
 add d99179a7 container: Add container build workflow
 add a800c426 Merge pull request #717 from 
apache/feature/add-build-job-for-dev-container
 add 86db9e4e Upgrade to conan 1.62.
 add 62b42f2a Remove unnecessary find_dependency from CelixDeps.cmake.in.
 add 5afee1eb Merge pull request #720 from apache/hotfix/ci-build
 new e448d007 Merge branch 'master' into feature/674-improve-properties
 new dbfb90d7 Add additional properties ei tests
 new e2373dfa Fix memleak in properties setStrings and setVersions

The 3 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.


Summary of changes:
 .github/workflows/containers.yml   |  38 +++
 .github/workflows/coverage.yml |   2 +-
 .github/workflows/ubuntu.yml   |   2 +-
 cmake/CelixDeps.cmake.in   |   1 -
 container/Containerfile.gitpod |   3 -
 container/README.md|  11 +--
 container/build-ubuntu-container.sh|   1 -
 ...ubuntu-container.sh => run-ubuntu-container.sh} |   3 +-
 container/support-scripts/build-all.sh |   1 -
 libs/framework/src/service_registry.c  |  37 +++
 .../error_injector/celix_array_list/CMakeLists.txt |   1 +
 .../celix_array_list/include/celix_array_list_ei.h |   2 +
 .../celix_array_list/src/celix_array_list_ei.cc|   7 ++
 .../gtest/src/PropertiesErrorInjectionTestSuite.cc | 109 +
 libs/utils/src/properties.c|   2 +
 15 files changed, 182 insertions(+), 38 deletions(-)
 create mode 100644 .github/workflows/containers.yml
 rename container/{start-ubuntu-container.sh => run-ubuntu-container.sh} (96%)



  1   2   3   4   5   6   7   8   9   10   >