Skip to content

Commit

Permalink
Merge branch 'master' into feature/dfi-cleanup
Browse files Browse the repository at this point in the history
# Conflicts:
#	bundles/pubsub/pubsub_serializer_json/src/pubsub_json_serialization_provider.c
#	bundles/pubsub/pubsub_utils/gtest/src/PubSubMatchingTestSuite.cpp
#	bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationHandlerTestSuite.cc
#	bundles/pubsub/pubsub_utils/src/pubsub_serialization_provider.c
  • Loading branch information
PengZheng committed Dec 25, 2023
2 parents b6d5e39 + 874c184 commit 20ef889
Show file tree
Hide file tree
Showing 228 changed files with 617 additions and 27,742 deletions.
1 change: 0 additions & 1 deletion .github/workflows/coverity-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
cmake \
libffi-dev \
libxml2-dev \
libczmq-dev \
libcpputest-dev \
rapidjson-dev \
libavahi-compat-libdnssd-dev \
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
uses: actions/checkout@v3.3.0
- name: Install dependencies
run: |
brew install lcov zeromq czmq cpputest jansson rapidjson libzip ccache
brew install lcov cpputest jansson rapidjson libzip ccache ninja
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
Expand All @@ -95,11 +95,12 @@ jobs:
-DENABLE_TESTING_ON_CI=ON
-DCMAKE_BUILD_TYPE=Release
-DENABLE_CCACHE=ON
-G Ninja
run: |
mkdir build install
cd build
cmake ${BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX=../install ..
make -j && make install
ninja && ninja install
- name: Test
run: |
cd $GITHUB_WORKSPACE/build
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ jobs:
cmake \
libffi-dev \
libxml2-dev \
libczmq-dev \
libcpputest-dev \
rapidjson-dev \
libavahi-compat-libdnssd-dev \
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

/.project
.DS_Store
.clion.source.upload.marker
.idea
.vscode
*.iml
Expand Down
10 changes: 7 additions & 3 deletions ...les/pubsub/pubsub_protocol/CMakeLists.txt → .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# 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
Expand All @@ -15,7 +16,10 @@
# specific language governing permissions and limitations
# under the License.

tasks:
- init: |
mkdir -p cmake-build-debug-gitpod
cd cmake-build-debug-gitpod && ../container/support-scripts/build-all.sh && make -j
add_subdirectory(pubsub_protocol_lib)
add_subdirectory(pubsub_protocol_wire_v1)
add_subdirectory(pubsub_protocol_wire_v2)
image:
file: container/Containerfile.gitpod
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ limitations under the License.
![Celix MacOS](https://github.com/apache/celix/workflows/Celix%20MacOS/badge.svg)
[![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)

Apache Celix is a framework for C and C++14 to develop dynamic modular software applications using component
and in-process service-oriented programming.
Expand Down
1 change: 0 additions & 1 deletion bundles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ add_subdirectory(http_admin)
add_subdirectory(logging)
add_subdirectory(shell)
add_subdirectory(remote_services)
add_subdirectory(pubsub)
add_subdirectory(cxx_remote_services)
add_subdirectory(components_ready_check)
81 changes: 28 additions & 53 deletions bundles/cxx_remote_services/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@ if (CXX_RSA_INTEGRATION)
add_celix_bundle(TestExportImportRemoteServiceFactory
SOURCES src/TestExportImportRemoteServiceFactory.cc
)
target_link_libraries(TestExportImportRemoteServiceFactory PRIVATE Celix::rsa_spi Celix::pubsub_api Celix::Promises Celix::PushStreams Celix::log_helper)
target_link_libraries(TestExportImportRemoteServiceFactory PRIVATE Celix::rsa_spi Celix::Promises Celix::PushStreams Celix::log_helper)
target_include_directories(TestExportImportRemoteServiceFactory PRIVATE include)
celix_bundle_files(TestExportImportRemoteServiceFactory
resources/Calculator$add$Invoke.descriptor
resources/Calculator$result$Event.descriptor
resources/Calculator$add$Return.descriptor
DESTINATION "META-INF/descriptors"
)

add_celix_bundle(CalculatorProvider
SOURCES src/CalculatorProvider.cc
Expand All @@ -47,55 +41,36 @@ if (CXX_RSA_INTEGRATION)
endif()

################# Integration examples ##################################
add_celix_container(RemoteCalculatorProvider
CXX
GROUP rsa
PROPERTIES
CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=debug
BUNDLES
Celix::ShellCxx
Celix::shell_tui

if (BUILD_LAUNCHER)
add_celix_container(RemoteCalculatorProvider
LAUNCHER Celix::launcher
GROUP rsa
USE_CONFIG
PROPERTIES
CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=trace
BUNDLES
Celix::ShellCxx
Celix::shell_tui

#Pubsub needed for remote services on pubsub
Celix::celix_pubsub_serializer_json
Celix::celix_pubsub_topology_manager
Celix::celix_pubsub_admin_zmq
Celix::celix_pubsub_protocol_wire_v2
Celix::celix_pubsub_discovery_etcd

#Remote Services
Celix::RemoteServiceAdmin
TestExportImportRemoteServiceFactory #needed to be able to create a ExportedService for ICalculator

CalculatorProvider
)
#Remote Services
Celix::RemoteServiceAdmin
TestExportImportRemoteServiceFactory #needed to be able to create a ExportedService for ICalculator

add_celix_container(RemoteCalculatorConsumer
LAUNCHER Celix::launcher
GROUP rsa
USE_CONFIG
PROPERTIES
CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=trace
BUNDLES
Celix::ShellCxx
Celix::shell_tui
CalculatorProvider
)

#Pubsub needed for remote services on pubsub
Celix::celix_pubsub_serializer_json
Celix::celix_pubsub_topology_manager
Celix::celix_pubsub_discovery_etcd
Celix::celix_pubsub_admin_zmq
Celix::celix_pubsub_protocol_wire_v2
add_celix_container(RemoteCalculatorConsumer
CXX
GROUP rsa
PROPERTIES
CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=debug
BUNDLES
Celix::ShellCxx
Celix::shell_tui

#Remote Services
Celix::RsaConfiguredDiscovery
Celix::RemoteServiceAdmin
TestExportImportRemoteServiceFactory #needed to be able to create a ExportedService for ICalculator
#Remote Services
Celix::RsaConfiguredDiscovery
Celix::RemoteServiceAdmin
TestExportImportRemoteServiceFactory #needed to be able to create a ExportedService for ICalculator

CalculatorConsumer
)
endif ()
CalculatorConsumer
)
endif()
8 changes: 8 additions & 0 deletions bundles/cxx_remote_services/integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# C++ Remote Service Amdatu Integration

This project part tests the integration of the C++ Remote Service Admin implementation with the
C++ configuration-based remote service discovery.

Because the C++ Remote Service Admin is based on export and import service factories and does not directly
implement a transportation or serializer technology, the integration tests are based on a simple implementation of
inter process communication message queue (IPC mq) for transportation and a simple memcpy for serialization.
15 changes: 0 additions & 15 deletions bundles/cxx_remote_services/integration/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,13 @@ target_link_libraries(test_cxx_remote_services_integration PRIVATE Celix::framew
target_include_directories(test_cxx_remote_services_integration PRIVATE ../include) #Add ICalculator

add_celix_bundle_dependencies(test_cxx_remote_services_integration
Celix::celix_pubsub_serializer_json
Celix::celix_pubsub_topology_manager
Celix::celix_pubsub_admin_zmq
Celix::celix_pubsub_protocol_wire_v2
Celix::RsaConfiguredDiscovery
Celix::RemoteServiceAdmin
TestExportImportRemoteServiceFactory
CalculatorProvider
CalculatorConsumer
)

celix_get_bundle_file(Celix::celix_pubsub_serializer_json PS_SER_BUNDLE_LOC)
target_compile_definitions(test_cxx_remote_services_integration PRIVATE PS_SER_BUNDLE_LOC="${PS_SER_BUNDLE_LOC}")

celix_get_bundle_file(Celix::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::celix_pubsub_admin_zmq 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::celix_pubsub_protocol_wire_v2 PS_WIRE_BUNDLE_LOC)
target_compile_definitions(test_cxx_remote_services_integration PRIVATE PS_WIRE_BUNDLE_LOC="${PS_WIRE_BUNDLE_LOC}")

celix_get_bundle_file(Celix::RsaConfiguredDiscovery RS_DISCOVERY_BUNDLE_LOC)
target_compile_definitions(test_cxx_remote_services_integration PRIVATE RS_DISCOVERY_BUNDLE_LOC="${RS_DISCOVERY_BUNDLE_LOC}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,23 @@
class RemoteServicesIntegrationTestSuite : public ::testing::Test {
public:
RemoteServicesIntegrationTestSuite() {
auto pubsubTestReturnIpc = std::string{"ipc:///tmp/pubsub-test-return"};
auto pubsubTestInvokeIpc = std::string{"ipc:///tmp/pubsub-test-invoke"};

celix::Properties clientConfig{
{"CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL", "info"},
{celix::FRAMEWORK_CACHE_DIR, ".clientCache"},
//Static configuration to let the pubsub zmq operate without discovery
{"PSA_ZMQ_STATIC_BIND_URL_FOR_test_invoke_default", pubsubTestInvokeIpc},
{"PSA_ZMQ_STATIC_CONNECT_URL_FOR_test_return_default", pubsubTestReturnIpc }
};
clientFw = celix::createFramework(clientConfig);
clientCtx = clientFw->getFrameworkBundleContext();

celix::Properties serverConfig{
{"CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL", "info"},
{celix::FRAMEWORK_CACHE_DIR, ".serverCache"},
//Static configuration to let the pubsub zmq operate without discovery
{"PSA_ZMQ_STATIC_BIND_URL_FOR_test_return_default", pubsubTestReturnIpc },
{"PSA_ZMQ_STATIC_CONNECT_URL_FOR_test_invoke_default", pubsubTestInvokeIpc }
};
serverFw = celix::createFramework(serverConfig);
serverCtx = serverFw->getFrameworkBundleContext();
}

static void installSharedBundles(std::shared_ptr<celix::BundleContext>& ctx) {
auto sharedBundles = {
PS_SER_BUNDLE_LOC,
PS_PSTM_BUNDLE_LOC,
PS_PSA_BUNDLE_LOC,
PS_WIRE_BUNDLE_LOC,
RS_DISCOVERY_BUNDLE_LOC,
RS_FACTORY_BUNDLE_LOC ,
RS_RSA_BUNDLE_LOC};
Expand Down Expand Up @@ -87,9 +74,6 @@ class RemoteServicesIntegrationTestSuite : public ::testing::Test {
}

void invokeRemoteCalcService() {
installProviderBundles();
installConsumerBundles();

//If a calculator provider bundle is installed I expect a exported calculator interface
auto count = serverCtx->useService<ICalculator>()
.setFilter("(service.exported.interfaces=*)")
Expand All @@ -111,8 +95,8 @@ class RemoteServicesIntegrationTestSuite : public ::testing::Test {

/*
* Testing the remote service in a while loop till it is successful or 10 seconds has passed.
* Note that because pubsub does not guarantee a connection when used, it is possible - and likely -
* that the first remote test iteration fails due to not yet completely connected pubsub.
* Note that because mq does not guarantee a connection when used, it is possible - and likely -
* that the first remote test iteration fails due to not yet completely connected mq.
*/
auto start = std::chrono::system_clock::now();
auto now = std::chrono::system_clock::now();
Expand Down Expand Up @@ -169,5 +153,7 @@ TEST_F(RemoteServicesIntegrationTestSuite, StartStopFrameworks) {
}

TEST_F(RemoteServicesIntegrationTestSuite, InvokeRemoteCalcService) {
installProviderBundles();
installConsumerBundles();
invokeRemoteCalcService();
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"endpoint.id": "id-01",
"service.imported": true,
"service.imported.configs": [
"pubsub"
"ipc-mq"
],
"service.exported.interfaces": "ICalculator",
"endpoint.objectClass": "ICalculator",
"endpoint.topic": "test",
"endpoint.scope": "default"
"endpoint.client.to.provider.channel.id": "1234",
"endpoint.provider.to.client.channel.id": "1235"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class CalculatorConsumer final : public celix::IShellCommand {
});
counter++;
}

private:
std::shared_ptr<ICalculator> calculator{};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CalculatorImpl final : public ICalculator {
while(!stopThread) {
ses->publish((double)counter);
counter++;
std::this_thread::sleep_for(std::chrono::milliseconds{100});
std::this_thread::sleep_for(std::chrono::milliseconds{5000});
}
});
return CELIX_SUCCESS;
Expand Down Expand Up @@ -98,8 +98,8 @@ class CalculatorProviderActivator {
.setCallbacks(&CalculatorImpl::setPushStreamProvider);
cmp.createProvidedService<ICalculator>()
.addProperty("service.exported.interfaces", celix::typeName<ICalculator>())
.addProperty("endpoint.topic", "test")
.addProperty("endpoint.scope", "default")
.addProperty("endpoint.client.to.provider.channel.id", "1234")
.addProperty("endpoint.provider.to.client.channel.id", "1235")
.addProperty("service.exported.intents", "osgi.async");

cmp.setCallbacks(&CalculatorImpl::init, &CalculatorImpl::start, &CalculatorImpl::stop, &CalculatorImpl::deinit);
Expand Down
Loading

0 comments on commit 20ef889

Please sign in to comment.