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/06/07 15:30:20 UTC

[celix] 01/01: Updates ZMQ use in RSA to pubsub_zmq_v2 and adds missing linking to zmq libs

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

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

commit d3f17bef6f33d0c7d0d1c11e85832fdfc7241edd
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Mon Jun 7 17:30:04 2021 +0200

    Updates ZMQ use in RSA to pubsub_zmq_v2 and adds missing linking to zmq libs
---
 bundles/cxx_remote_services/CMakeLists.txt                   |  9 ++++++++-
 bundles/cxx_remote_services/integration/CMakeLists.txt       | 10 +++++-----
 bundles/cxx_remote_services/integration/gtest/CMakeLists.txt |  6 +++---
 bundles/pubsub/pubsub_admin_tcp/v2/src/pubsub_tcp_admin.c    |  1 +
 4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/bundles/cxx_remote_services/CMakeLists.txt b/bundles/cxx_remote_services/CMakeLists.txt
index d768861..f09ae80 100644
--- a/bundles/cxx_remote_services/CMakeLists.txt
+++ b/bundles/cxx_remote_services/CMakeLists.txt
@@ -21,7 +21,14 @@ if (REMOTE_SERVICE_ADMIN)
     add_subdirectory(rsa_spi)
     add_subdirectory(admin)
     add_subdirectory(discovery_configured)
-    add_subdirectory(integration)
+
+    find_package(ZMQ)
+    find_package(CZMQ)
+    if (ZMQ_FOUND AND CZMQ_FOUND)
+        add_subdirectory(integration)
+    else ()
+        message(STATUS "C++ RSA integration test will not be build, because they require zmq and czmq")
+    endif ()
 
     #NOTE the topology manager is not yet used. The discovery and RSA need to be refactor for this
     #add_subdirectory(topology_manager)
diff --git a/bundles/cxx_remote_services/integration/CMakeLists.txt b/bundles/cxx_remote_services/integration/CMakeLists.txt
index f5bf8c9..4b578ce 100644
--- a/bundles/cxx_remote_services/integration/CMakeLists.txt
+++ b/bundles/cxx_remote_services/integration/CMakeLists.txt
@@ -21,7 +21,6 @@ add_celix_bundle(TestExportImportRemoteServiceFactory
 target_link_libraries(TestExportImportRemoteServiceFactory PRIVATE Celix::rsa_spi Celix::pubsub_api Celix::Promises Celix::log_helper)
 target_compile_options(TestExportImportRemoteServiceFactory PRIVATE -std=c++17) #TODO how can this be improved (bring back -std=c++17 on INTERFACE for promises?
 target_include_directories(TestExportImportRemoteServiceFactory PRIVATE include)
-#TODO improve with serializer svc, for now using descriptors
 celix_bundle_files(TestExportImportRemoteServiceFactory
         resources/Calculator$add$Invoke.descriptor
         resources/Calculator$add$Return.descriptor
@@ -61,8 +60,7 @@ add_celix_container(RemoteCalculatorProvider
             #Pubsub needed for remote services on pubsub
             Celix::pubsub_serializer_json
             Celix::pubsub_topology_manager
-            #TODO replace with v1 when marker interfaces for a serializer type are introduced  Celix::pubsub_admin_zmq_v2
-            Celix::pubsub_admin_zmq
+            Celix::pubsub_admin_zmq_v2
             Celix::pubsub_protocol_wire_v2
             Celix::pubsub_discovery_etcd
 
@@ -72,6 +70,7 @@ add_celix_container(RemoteCalculatorProvider
 
             CalculatorProvider
 )
+target_link_libraries(RemoteCalculatorProvider PRIVATE ZMQ::lib CZMQ::lib)
 
 add_celix_container(RemoteCalculatorConsumer
         GROUP rsa
@@ -85,7 +84,7 @@ add_celix_container(RemoteCalculatorConsumer
             Celix::pubsub_serializer_json
             Celix::pubsub_topology_manager
             Celix::pubsub_discovery_etcd
-            Celix::pubsub_admin_zmq
+            Celix::pubsub_admin_zmq_v2
             Celix::pubsub_protocol_wire_v2
 
             #Remote Services
@@ -94,4 +93,5 @@ add_celix_container(RemoteCalculatorConsumer
             TestExportImportRemoteServiceFactory #needed to be able to create a ExportedService for ICalculator
 
             CalculatorConsumer
-)
\ No newline at end of file
+)
+target_link_libraries(RemoteCalculatorConsumer PRIVATE ZMQ::lib CZMQ::lib)
diff --git a/bundles/cxx_remote_services/integration/gtest/CMakeLists.txt b/bundles/cxx_remote_services/integration/gtest/CMakeLists.txt
index 824bd48..5c548ec 100644
--- a/bundles/cxx_remote_services/integration/gtest/CMakeLists.txt
+++ b/bundles/cxx_remote_services/integration/gtest/CMakeLists.txt
@@ -18,14 +18,14 @@
 add_executable(test_cxx_remote_services_integration
     src/RemoteServicesIntegrationTestSuite.cc
 )
-target_link_libraries(test_cxx_remote_services_integration PRIVATE Celix::framework Celix::Promises Celix::shell_api GTest::gtest GTest::gtest_main)
+target_link_libraries(test_cxx_remote_services_integration PRIVATE Celix::framework Celix::Promises Celix::shell_api ZMQ::lib CZMQ::lib GTest::gtest GTest::gtest_main)
 target_compile_options(test_cxx_remote_services_integration PRIVATE -std=c++17)
 target_include_directories(test_cxx_remote_services_integration PRIVATE ../include) #Add ICalculator
 
 add_celix_bundle_dependencies(test_cxx_remote_services_integration
     Celix::pubsub_serializer_json
     Celix::pubsub_topology_manager
-    Celix::pubsub_admin_zmq
+    Celix::pubsub_admin_zmq_v2
     Celix::pubsub_protocol_wire_v2
     Celix::RsaConfiguredDiscovery
     Celix::RemoteServiceAdmin
@@ -40,7 +40,7 @@ target_compile_definitions(test_cxx_remote_services_integration PRIVATE PS_SER_B
 celix_get_bundle_file(Celix::pubsub_topology_manager PS_PSTM_BUNDLE_LOC)
 target_compile_definitions(test_cxx_remote_services_integration PRIVATE PS_PSTM_BUNDLE_LOC="${PS_PSTM_BUNDLE_LOC}")
 
-celix_get_bundle_file(Celix::pubsub_admin_zmq PS_PSA_BUNDLE_LOC)
+celix_get_bundle_file(Celix::pubsub_admin_zmq_v2 PS_PSA_BUNDLE_LOC)
 target_compile_definitions(test_cxx_remote_services_integration PRIVATE PS_PSA_BUNDLE_LOC="${PS_PSA_BUNDLE_LOC}")
 
 celix_get_bundle_file(Celix::pubsub_protocol_wire_v2 PS_WIRE_BUNDLE_LOC)
diff --git a/bundles/pubsub/pubsub_admin_tcp/v2/src/pubsub_tcp_admin.c b/bundles/pubsub/pubsub_admin_tcp/v2/src/pubsub_tcp_admin.c
index f5f200f..9806991 100644
--- a/bundles/pubsub/pubsub_admin_tcp/v2/src/pubsub_tcp_admin.c
+++ b/bundles/pubsub/pubsub_admin_tcp/v2/src/pubsub_tcp_admin.c
@@ -700,6 +700,7 @@ bool pubsub_tcpAdmin_executeCommand(void *handle, const char *commandLine __attr
     celixThreadMutex_unlock(&psa->protocols.mutex);
     fprintf(out, "\n");
 
+    free(line);
     return status;
 }