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 2021/05/06 16:28:04 UTC

[celix] 02/02: Updates for merge with master and adds rapidjson install to macos ci configuration

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

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

commit a1719c226bdcf62ecbd708c89a1ece52eb9817c1
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Thu May 6 18:27:47 2021 +0200

    Updates for merge with master and adds rapidjson install to macos ci configuration
---
 .github/workflows/macos-nightly.yml                              | 2 +-
 .github/workflows/macos.yml                                      | 2 +-
 bundles/cxx_remote_services/admin/src/RemoteServiceAdmin.cc      | 9 +++------
 .../gtest/src/RsaConfiguredDiscoveryTestSuite.cc                 | 7 ++++---
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/macos-nightly.yml b/.github/workflows/macos-nightly.yml
index 98ec7ab..11694c9 100644
--- a/.github/workflows/macos-nightly.yml
+++ b/.github/workflows/macos-nightly.yml
@@ -19,7 +19,7 @@ jobs:
     - name: Install dependencies
       run: |
         brew update
-        brew install lcov zeromq czmq openssl cpputest jansson
+        brew install lcov zeromq czmq openssl cpputest jansson rapidjson
         brew unlink openssl && brew link openssl --force
     - name: Build
       env:
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index 363d47a..6023f7d 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -17,7 +17,7 @@ jobs:
     - name: Install dependencies
       run: |
         brew update
-        brew install lcov zeromq czmq openssl cpputest jansson
+        brew install lcov zeromq czmq openssl cpputest jansson rapidjson
         brew unlink openssl && brew link openssl --force
     - name: Build
       env:
diff --git a/bundles/cxx_remote_services/admin/src/RemoteServiceAdmin.cc b/bundles/cxx_remote_services/admin/src/RemoteServiceAdmin.cc
index e71c50c..4ed0e2f 100644
--- a/bundles/cxx_remote_services/admin/src/RemoteServiceAdmin.cc
+++ b/bundles/cxx_remote_services/admin/src/RemoteServiceAdmin.cc
@@ -180,13 +180,11 @@ void celix::rsa::RemoteServiceAdmin::removeService(const std::shared_ptr<void>&
 }
 
 void celix::rsa::RemoteServiceAdmin::createImportServices() {
-    auto it = _toBeImportedServices.begin();
-    while (it != _toBeImportedServices.end()) {
+    for (auto it = _toBeImportedServices.begin(); it != _toBeImportedServices.end(); ++it) {
         auto interface = (*it)->getInterface();
         auto existingFactory = _importServiceFactories.find(interface);
         if (existingFactory == end(_importServiceFactories)) {
             L_DEBUG("Adding endpoint to be imported but no factory available yet, delaying import");
-            ++it;
             continue;
         }
         auto endpointId = (*it)->getId();
@@ -197,8 +195,8 @@ void celix::rsa::RemoteServiceAdmin::createImportServices() {
 }
 
 void celix::rsa::RemoteServiceAdmin::createExportServices() {
-    auto it = _toBeExportedServices.begin();
-    while (it != _toBeExportedServices.end()) {
+
+    for (auto it = _toBeExportedServices.begin(); it != _toBeExportedServices.end(); ++it) {
         const auto& svcProperties = **it;
         auto serviceName = svcProperties.get(celix::SERVICE_NAME, "");
         auto svcId = svcProperties.getAsLong(celix::SERVICE_ID, -1);
@@ -209,7 +207,6 @@ void celix::rsa::RemoteServiceAdmin::createExportServices() {
         auto factory = _exportServiceFactories.find(serviceName);
         if (factory == end(_exportServiceFactories)) {
             L_DEBUG("Adding service to be exported but no factory available yet, delaying creation");
-            ++it;
             continue;
         }
         _exportedServices.emplace(svcId, factory->second->exportService(svcProperties));
diff --git a/bundles/cxx_remote_services/discovery_configured/gtest/src/RsaConfiguredDiscoveryTestSuite.cc b/bundles/cxx_remote_services/discovery_configured/gtest/src/RsaConfiguredDiscoveryTestSuite.cc
index 1f413f1..dcd900f 100644
--- a/bundles/cxx_remote_services/discovery_configured/gtest/src/RsaConfiguredDiscoveryTestSuite.cc
+++ b/bundles/cxx_remote_services/discovery_configured/gtest/src/RsaConfiguredDiscoveryTestSuite.cc
@@ -66,9 +66,9 @@ TEST_F(RsaConfiguredDiscoveryTestSuite, discoverConfiguredEndpoints) {
 }
 
 TEST_F(RsaConfiguredDiscoveryTestSuite, removeConfiguredEndpointFile) {
-    //When I install a configured discovery bundle with also a configured discovery file and will find
+    //When I install a configured discovery bundle with also a configured discovery file, I will find
     //2 EndpointDescriptions.
-    //If I then remove the configured discovery file using the IConfiguredDiscoveryManager service I will find
+    //If I then remove the configured discovery file using the IConfiguredDiscoveryManager service, I will find
     //0 EndpointDescriptions.
 
     auto bndId = ctx->installBundle(RSA_CONFIGURED_DISCOVERY_BUNDLE_LOCATION);
@@ -80,7 +80,8 @@ TEST_F(RsaConfiguredDiscoveryTestSuite, removeConfiguredEndpointFile) {
     count = ctx->useService<celix::rsa::IConfiguredDiscoveryManager>()
                 .addUseCallback([](auto& svc) {
                     auto files = svc.getConfiguredDiscoveryFiles();
-                    EXPECT_EQ(files.size(), 1);
+                    ASSERT_EQ(files.size(), 1);
+                    EXPECT_EQ(files[0], RSA_CONFIGURED_DISCOVERY_DISCOVERY_FILE);
                     svc.removeConfiguredDiscoveryFile(RSA_CONFIGURED_DISCOVERY_DISCOVERY_FILE);
                 })
                 .build();