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

[celix] branch feature/pubsub_utils_test_fix updated (960a9d0 -> e313dd1)

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

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


    from 960a9d0  Updates the timestamp print format
     new 8cd3c9f  Adds "already added check" for pubsub serializerion provider.
     new 6d7f238  Revert "Updates the timestamp print format"
     new e313dd1  Revert "Adds a timestamp to the celix bundle cache for the PubSubSerializationProviderTestSuite"

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:
 .../src/PubSubSerializationProviderTestSuite.cc    | 11 +---------
 .../src/pubsub_serialization_provider.c            | 24 ++++++++++++++++++++++
 2 files changed, 25 insertions(+), 10 deletions(-)


[celix] 03/03: Revert "Adds a timestamp to the celix bundle cache for the PubSubSerializationProviderTestSuite"

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

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

commit e313dd1cc3333a2f205ca82fafa7da03c92da393
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Wed Jun 10 21:03:39 2020 +0200

    Revert "Adds a timestamp to the celix bundle cache for the PubSubSerializationProviderTestSuite"
    
    This reverts commit c7e75f869a6cbcbef9f414b2de52910526d5d2c7.
---
 .../gtest/src/PubSubSerializationProviderTestSuite.cc         | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc b/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
index 0604f51..2522bbf 100644
--- a/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
+++ b/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
@@ -20,7 +20,6 @@
 #include "gtest/gtest.h"
 
 #include <memory>
-#include <chrono>
 
 #include <celix_api.h>
 #include "pubsub_serialization_provider.h"
@@ -29,15 +28,7 @@ class PubSubSerializationProviderTestSuite : public ::testing::Test {
 public:
     PubSubSerializationProviderTestSuite() {
         auto* props = celix_properties_create();
-
-        //NOTE setting the cache using a timestamp. This test suite fails from time to time on CI.
-        //Cannot reproduce this on host, so testing if a timestamp improves stability.
-        const auto t = std::chrono::system_clock::now();
-        char *cache = nullptr;
-        asprintf(&cache, ".pubsub_serialization_provider_cache-%li", t.time_since_epoch().count());
-        celix_properties_set(props, OSGI_FRAMEWORK_FRAMEWORK_STORAGE, cache);
-        free(cache);
-
+        celix_properties_set(props, OSGI_FRAMEWORK_FRAMEWORK_STORAGE, ".pubsub_serialization_provider_cache");
         auto* fwPtr = celix_frameworkFactory_createFramework(props);
         auto* ctxPtr = celix_framework_getFrameworkContext(fwPtr);
         fw = std::shared_ptr<celix_framework_t>{fwPtr, [](auto* f) {celix_frameworkFactory_destroyFramework(f);}};


[celix] 01/03: Adds "already added check" for pubsub serializerion provider.

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

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

commit 8cd3c9fca8cb52f5320bf3bba4e96d13b5b451ca
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Wed Jun 10 21:03:25 2020 +0200

    Adds "already added check" for pubsub serializerion provider.
    
    This is to prevent possible entries added because of multiple bundle event being handled.
---
 .../src/pubsub_serialization_provider.c            | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c b/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c
index a0559e4..99e6d6b 100644
--- a/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c
+++ b/bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c
@@ -259,6 +259,21 @@ static dyn_message_type* pubsub_serializationProvider_parseDfiDescriptor(pubsub_
 //}
 
 /**
+ * Check if a pubsub serialization entry is already present (exact path)
+ *
+ * @return true if the entry is a already present
+ */
+static bool pubsub_serializationProvider_alreadyAddedEntry(pubsub_serialization_provider_t* provider, pubsub_serialization_entry_t* entry) {
+    for (int i = 0; i < celix_arrayList_size(provider->serializationSvcEntries); ++i) {
+        pubsub_serialization_entry_t *visit = celix_arrayList_get(provider->serializationSvcEntries, i);
+        if (celix_utils_stringEquals(visit->readFromEntryPath, entry->readFromEntryPath) {
+            return true;
+        }
+    }
+    return false;
+}
+
+/**
  * Validates an pubsub serialization entry and check if this is a new unique entry.
  *
  * Checks whether the entry is valid. Specifically checks:
@@ -407,6 +422,15 @@ static void pubsub_serializationProvider_parseDescriptors(pubsub_serialization_p
         serEntry->svc.freeDeserializedMsg = (void*)provider->freeDeserializeMsg;
         serEntry->svcId = -1L;
 
+        if (pubsub_serializationProvider_alreadyAddedEntry(provider, serEntry)) {
+            L_WARN("Skipping entry %s. Exact entry already present!. Double event triggered?", serEntry->readFromEntryPath);
+            free(serEntry->descriptorContent);
+            free(serEntry->readFromEntryPath);
+            free(serEntry->msgVersionStr);
+            dynMessage_destroy(serEntry->msgType);
+            free(serEntry);
+            continue;
+        }
 
         bool unique = pubsub_serializationProvider_validateEntry(provider, serEntry);
         if (unique && serEntry->valid) { //note only register if unique and valid


[celix] 02/03: Revert "Updates the timestamp print format"

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

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

commit 6d7f2382e11f741a949f8d9091cced7657202a30
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Wed Jun 10 21:03:28 2020 +0200

    Revert "Updates the timestamp print format"
    
    This reverts commit 960a9d0f2fc99244de51f14c60978b7d10bef055.
---
 .../pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc b/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
index 63979d7..0604f51 100644
--- a/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
+++ b/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
@@ -34,7 +34,7 @@ public:
         //Cannot reproduce this on host, so testing if a timestamp improves stability.
         const auto t = std::chrono::system_clock::now();
         char *cache = nullptr;
-        asprintf(&cache, ".pubsub_serialization_provider_cache-%lli", (long long int)t.time_since_epoch().count());
+        asprintf(&cache, ".pubsub_serialization_provider_cache-%li", t.time_since_epoch().count());
         celix_properties_set(props, OSGI_FRAMEWORK_FRAMEWORK_STORAGE, cache);
         free(cache);