You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pe...@apache.org on 2023/08/25 09:19:19 UTC

[celix] branch hotfix/version-range-ldap created (now cef01ef3)

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

pengzheng pushed a change to branch hotfix/version-range-ldap
in repository https://gitbox.apache.org/repos/asf/celix.git


      at cef01ef3 Take qualifier into account when create LDAP filter for version range.

This branch includes the following new commits:

     new 777b2e97 Fix wrong return type of dmListCommand_execute
     new cef01ef3 Take qualifier into account when create LDAP filter for version range.

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: Fix wrong return type of dmListCommand_execute

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

pengzheng pushed a commit to branch hotfix/version-range-ldap
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 777b2e970dac40a2648e64c95a782be48260a2ec
Author: PengZheng <ho...@gmail.com>
AuthorDate: Fri Aug 25 17:18:01 2023 +0800

    Fix wrong return type of dmListCommand_execute
---
 bundles/shell/shell/src/dm_shell_list_command.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bundles/shell/shell/src/dm_shell_list_command.c b/bundles/shell/shell/src/dm_shell_list_command.c
index cfe625c9..7148c27a 100644
--- a/bundles/shell/shell/src/dm_shell_list_command.c
+++ b/bundles/shell/shell/src/dm_shell_list_command.c
@@ -24,6 +24,7 @@
 #include "celix_bundle_context.h"
 #include "celix_dependency_manager.h"
 #include "celix_dm_component.h"
+#include "std_commands.h"
 
 static void parseCommandLine(const char*line, celix_array_list_t **requestedBundleIds, bool *fullInfo, bool *wtf, FILE *err) {
     *fullInfo = false;
@@ -49,7 +50,7 @@ static void parseCommandLine(const char*line, celix_array_list_t **requestedBund
     free (str);
 }
 
-celix_status_t dmListCommand_execute(void* handle, char * line, FILE *out, FILE *err) {
+bool dmListCommand_execute(void* handle, const char* line, FILE *out, FILE *err) {
     celix_bundle_context_t *ctx = handle;
     celix_dependency_manager_t *mng = celix_bundleContext_getDependencyManager(ctx);
 
@@ -91,5 +92,5 @@ celix_status_t dmListCommand_execute(void* handle, char * line, FILE *out, FILE
 
     celix_arrayList_destroy(bundleIds);
 
-    return CELIX_SUCCESS;
+    return true;
 }


[celix] 02/02: Take qualifier into account when create LDAP filter for version range.

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

pengzheng pushed a commit to branch hotfix/version-range-ldap
in repository https://gitbox.apache.org/repos/asf/celix.git

commit cef01ef33e339690628e0cd29c126203d51d1b2d
Author: PengZheng <ho...@gmail.com>
AuthorDate: Fri Aug 25 17:18:56 2023 +0800

    Take qualifier into account when create LDAP filter for version range.
---
 libs/utils/gtest/src/VersionRangeTestSuite.cc | 11 +++++++++++
 libs/utils/src/version_range.c                | 14 ++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/libs/utils/gtest/src/VersionRangeTestSuite.cc b/libs/utils/gtest/src/VersionRangeTestSuite.cc
index 4ae74772..e51a5348 100644
--- a/libs/utils/gtest/src/VersionRangeTestSuite.cc
+++ b/libs/utils/gtest/src/VersionRangeTestSuite.cc
@@ -21,6 +21,7 @@
 
 #include "version.h"
 #include "version_range.h" //NOTE testing celix_version_range through the deprecated version_range api.
+#include "celix_stdlib_cleanup.h"
 #include "celix_version_range.h"
 #include "version_private.h"
 
@@ -415,3 +416,13 @@ TEST_F(VersionRangeTestSuite, createLdapFilterInPlaceInfiniteHigh) {
 
     versionRange_destroy(range);
 }
+
+TEST_F(VersionRangeTestSuite, createLdapFilterWithQualifier) {
+    celix_autoptr(celix_version_t) low = celix_version_createVersion(1, 2, 2, "0");
+    celix_autoptr(celix_version_t) high = celix_version_createVersion(1, 2, 2, "0");
+
+    celix_autoptr(celix_version_range_t) range = celix_versionRange_createVersionRange(celix_steal_ptr(low), true,
+                                                                                       celix_steal_ptr(high), true);
+    celix_autofree char* filter = celix_versionRange_createLDAPFilter(range, "service.version");
+    EXPECT_STREQ(filter, "(&(service.version>=1.2.2.0)(service.version<=1.2.2.0))");
+}
diff --git a/libs/utils/src/version_range.c b/libs/utils/src/version_range.c
index f03fee94..ca661291 100644
--- a/libs/utils/src/version_range.c
+++ b/libs/utils/src/version_range.c
@@ -246,15 +246,21 @@ char* celix_versionRange_createLDAPFilter(const celix_version_range_t* range, co
 
     int ret = -1;
     if(range->high == NULL) {
-        ret = asprintf(&output, "(&(%s%s%i.%i.%i))",
+        ret = asprintf(&output, "(&(%s%s%i.%i.%i%s%s))",
                        serviceVersionAttributeName, range->isLowInclusive ? ">=" : ">", range->low->major,
-                       range->low->minor, range->low->micro);
+                       range->low->minor, range->low->micro,
+                       range->low->qualifier ? "." : "",
+                       range->low->qualifier ? range->low->qualifier : "");
     } else {
-        ret = asprintf(&output, "(&(%s%s%i.%i.%i)(%s%s%i.%i.%i))",
+        ret = asprintf(&output, "(&(%s%s%i.%i.%i%s%s)(%s%s%i.%i.%i%s%s))",
                        serviceVersionAttributeName, range->isLowInclusive ? ">=" : ">", range->low->major,
                        range->low->minor, range->low->micro,
+                       range->low->qualifier ? "." : "",
+                          range->low->qualifier ? range->low->qualifier : "",
                        serviceVersionAttributeName, range->isHighInclusive ? "<=" : "<", range->high->major,
-                       range->high->minor, range->high->micro);
+                       range->high->minor, range->high->micro,
+                       range->high->qualifier ? "." : "",
+                       range->high->qualifier ? range->high->qualifier : "");
     }
 
     if (ret < 0) {