This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/use_async_api_for_rsa
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to refs/heads/feature/use_async_api_for_rsa
by this push:
new 6cbabd7 Refactors C remote service topology manager test to gtest and
for changed timing behaviour.
6cbabd7 is described below
commit 6cbabd7d9151673a93182d0adc152835f4339f05
Author: Pepijn Noltes <[email protected]>
AuthorDate: Thu Jun 10 17:39:58 2021 +0200
Refactors C remote service topology manager test to gtest and for changed
timing behaviour.
---
.../remote_service_admin_dfi/gtest/CMakeLists.txt | 3 -
.../topology_manager/CMakeLists.txt | 13 +-
.../topology_manager/src/activator.c | 4 +-
.../topology_manager/tms_tst/CMakeLists.txt | 9 +-
.../topology_manager/tms_tst/run_tests.cpp | 25 --
.../topology_manager/tms_tst/scope2.json | 2 +-
.../topology_manager/tms_tst/scope3.json | 2 +-
.../topology_manager/tms_tst/scope4.json | 4 +-
.../topology_manager/tms_tst/tms_tests.cpp | 254 ++++++++++-----------
9 files changed, 134 insertions(+), 182 deletions(-)
diff --git
a/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt
b/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt
index 02e4a95..f3931c7 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt
@@ -15,9 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-find_package(CppUTest REQUIRED)
-include_directories(SYSTEM PRIVATE ${CppUTest_INCLUDE_DIR})
-
add_celix_bundle(rsa_dfi_tst_bundle
VERSION 0.0.1
SOURCES
diff --git a/bundles/remote_services/topology_manager/CMakeLists.txt
b/bundles/remote_services/topology_manager/CMakeLists.txt
index fba3663..0425934 100644
--- a/bundles/remote_services/topology_manager/CMakeLists.txt
+++ b/bundles/remote_services/topology_manager/CMakeLists.txt
@@ -29,15 +29,10 @@ target_include_directories(rsa_topology_manager PRIVATE src)
target_include_directories(rsa_topology_manager PRIVATE include)
target_link_libraries(rsa_topology_manager PRIVATE Celix::log_helper
Celix::deprecated_rsa_spi)
-#TODO FIXME renable top man test
-#if (ENABLE_TESTING)
-# find_package(CppUTest REQUIRED)
-# find_package(Jansson REQUIRED)
-#
-# include_directories("SYSTEM PRIVATE ${CppUTest_INCLUDE_DIR}")
-# include_directories("SYSTEM PRIVATE ${CPPUTEST_EXT_INCLUDE_DIR}")
-# add_subdirectory(tms_tst)
-#endif (ENABLE_TESTING)
+if (ENABLE_TESTING)
+ find_package(Jansson REQUIRED)
+ add_subdirectory(tms_tst)
+endif (ENABLE_TESTING)
install_celix_bundle(rsa_topology_manager EXPORT celix COMPONENT rsa)
#Setup target aliases to match external usage
diff --git a/bundles/remote_services/topology_manager/src/activator.c
b/bundles/remote_services/topology_manager/src/activator.c
index d2aa195..e074c68 100644
--- a/bundles/remote_services/topology_manager/src/activator.c
+++ b/bundles/remote_services/topology_manager/src/activator.c
@@ -201,11 +201,11 @@ celix_status_t bundleActivator_start(void * userData,
celix_bundle_context_t *co
bundleContext_registerService(context, (char *)
OSGI_FRAMEWORK_LISTENER_HOOK_SERVICE_NAME, hookService, NULL, &activator->hook);
if (status == CELIX_SUCCESS) {
- status = serviceTracker_open(activator->exportedServicesTracker);
+ serviceTracker_open(activator->remoteServiceAdminTracker);
}
if (status == CELIX_SUCCESS) {
- serviceTracker_open(activator->remoteServiceAdminTracker);
+ status = serviceTracker_open(activator->exportedServicesTracker);
}
if (status == CELIX_SUCCESS) {
diff --git a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
index 82a7136..2a7442d 100644
--- a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
+++ b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
@@ -29,18 +29,13 @@ include_directories(
add_subdirectory(bundle)
add_subdirectory(disc_mock)
-#SET(CMAKE_SKIP_BUILD_RPATH FALSE) #TODO needed?
-#SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) #TODO needed?
-#SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/framework"
"${PROJECT_BINARY_DIR}/utils" "${PROJECT_BINARY_DIR}/dfi")
-
add_executable(test_tm_scoped
- run_tests.cpp
- tms_tests.cpp
+ tms_tests.cpp
)
target_include_directories(test_tm_scoped SYSTEM PRIVATE
${CppUTest_INCLUDE_DIR} PRIVATE ../src ../include)
target_link_libraries(test_tm_scoped PRIVATE
Celix::framework
- ${CppUTest_LIBRARY}
+ GTest::gtest GTest::gtest_main
Jansson
calculator_api
Celix::rsa_common
diff --git a/bundles/remote_services/topology_manager/tms_tst/run_tests.cpp
b/bundles/remote_services/topology_manager/tms_tst/run_tests.cpp
deleted file mode 100644
index 1da4975..0000000
--- a/bundles/remote_services/topology_manager/tms_tst/run_tests.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <CppUTest/TestHarness.h>
-#include "CppUTest/CommandLineTestRunner.h"
-
-int main(int argc, char** argv) {
- return RUN_ALL_TESTS(argc, argv);
-}
diff --git a/bundles/remote_services/topology_manager/tms_tst/scope2.json
b/bundles/remote_services/topology_manager/tms_tst/scope2.json
index 0d2daef..3474b72 100644
--- a/bundles/remote_services/topology_manager/tms_tst/scope2.json
+++ b/bundles/remote_services/topology_manager/tms_tst/scope2.json
@@ -2,7 +2,7 @@
"exportServices": [
{
"filter": "(&(objectClass=org.apache.celix.calc.api.Calculator)(module=Calc))",
-"zone": "thales"
+"zone": "a_zone"
},
{
"filter": "(objectClass=org.apache.celix.calc.*)",
diff --git a/bundles/remote_services/topology_manager/tms_tst/scope3.json
b/bundles/remote_services/topology_manager/tms_tst/scope3.json
index efa1b40..0768a99 100644
--- a/bundles/remote_services/topology_manager/tms_tst/scope3.json
+++ b/bundles/remote_services/topology_manager/tms_tst/scope3.json
@@ -2,7 +2,7 @@
"exportServices": [
{
"filter": "(&(objectClass=org.apache.celix.calc.api.Calculator)(module=Calc))",
-"zone": "thales",
+"zone": "a_zone",
"key1": "value1"
},
{
diff --git a/bundles/remote_services/topology_manager/tms_tst/scope4.json
b/bundles/remote_services/topology_manager/tms_tst/scope4.json
index 5f98cd8..508937a 100644
--- a/bundles/remote_services/topology_manager/tms_tst/scope4.json
+++ b/bundles/remote_services/topology_manager/tms_tst/scope4.json
@@ -2,7 +2,7 @@
"exportServices": [
{
"filter": "(objectClass=org.apache.celix.calc.api.Calculator)",
-"zone": "thales"
+"zone": "a_zone"
},
{
"filter": "(objectClass=org.apache.celix.calc.*)",
@@ -14,7 +14,7 @@
"filter": "(key3=value3)"
},
{
-"filter": "(zone=thales)"
+"filter": "(zone=a_zone)"
}
]
}
diff --git a/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
b/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
index 5de0a74..b44f126 100644
--- a/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
+++ b/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
@@ -17,13 +17,12 @@
* under the License.
*/
+#include "gtest/gtest.h"
+
#include <stdlib.h>
#include <stdio.h>
-#include "CppUTest/TestHarness.h"
-#include "CppUTest/TestHarness_c.h"
-#include "CppUTest/CommandLineTestRunner.h"
-#include "CppUTestExt/MockSupport.h"
+#include "celix_bundle_context.h"
extern "C" {
@@ -82,42 +81,42 @@ extern "C" {
static void setupFm(void) {
int rc = 0;
rc = celixLauncher_launch("config.properties", &framework);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
celix_bundle_t *bundle = NULL;
rc = framework_getFrameworkBundle(framework, &bundle);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundle_getContext(bundle, &context);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_getServiceReference(context, (char
*)OSGI_RSA_REMOTE_SERVICE_ADMIN, &rsaRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
- CHECK(rsaRef != NULL);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ EXPECT_TRUE(rsaRef != NULL);
rc = bundleContext_getService(context, rsaRef, (void **)&rsa);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_getServiceReference(context, (char
*)TOPOLOGYMANAGER_SCOPE_SERVICE, &scopeServiceRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
- CHECK(scopeServiceRef != NULL);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ EXPECT_TRUE(scopeServiceRef != NULL);
rc = bundleContext_getService(context, scopeServiceRef, (void
**)&tmScopeService);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_getServiceReference(context, (char
*)CALCULATOR_SERVICE, &calcRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
- CHECK(calcRef != NULL);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ EXPECT_TRUE(calcRef != NULL);
rc = bundleContext_getService(context, calcRef, (void **)&calc);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_getServiceReference(context, (char
*)DISC_MOCK_SERVICE_NAME, &discRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
- CHECK(discRef != NULL);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ EXPECT_TRUE(discRef != NULL);
rc = bundleContext_getService(context, discRef, (void **)&discMock);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
printf("==> Finished setup.\n");
}
@@ -127,24 +126,24 @@ extern "C" {
int rc = 0;
rc = bundleContext_ungetService(context, scopeServiceRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetServiceReference(context,scopeServiceRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetService(context, calcRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetServiceReference(context,calcRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetService(context, rsaRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetServiceReference(context,rsaRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetService(context, discRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetServiceReference(context,discRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
celixLauncher_stop(framework);
celixLauncher_waitForShutdown(framework);
@@ -173,66 +172,70 @@ extern "C" {
static void setupFmImport(void) {
int rc = 0;
rc = celixLauncher_launch("config_import.properties", &framework);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
celix_bundle_t *bundle = NULL;
rc = framework_getFrameworkBundle(framework, &bundle);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundle_getContext(bundle, &context);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+
+ celix_array_list_t* bundles = celix_bundleContext_listBundles(context);
+ EXPECT_EQ(celix_arrayList_size(bundles), 4); //rsa, calculator,
topman, test bundle
+ celix_arrayList_destroy(bundles);
rc = bundleContext_getServiceReference(context, (char
*)OSGI_RSA_REMOTE_SERVICE_ADMIN, &rsaRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
- CHECK(rsaRef != NULL);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ EXPECT_TRUE(rsaRef != NULL);
rc = bundleContext_getService(context, rsaRef, (void **)&rsa);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_getServiceReference(context, (char
*)TOPOLOGYMANAGER_SCOPE_SERVICE, &scopeServiceRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
- CHECK(scopeServiceRef != NULL);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ EXPECT_TRUE(scopeServiceRef != NULL);
rc = bundleContext_getService(context, scopeServiceRef, (void
**)&tmScopeService);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_getServiceReference(context, (char
*)TST_SERVICE_NAME, &testRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
- CHECK(testRef != NULL);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ EXPECT_TRUE(testRef != NULL);
rc = bundleContext_getService(context, testRef, (void **)&testImport);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_getServiceReference(context,
(char*)OSGI_ENDPOINT_LISTENER_SERVICE, &eplRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
- CHECK(eplRef != NULL);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ EXPECT_TRUE(eplRef != NULL);
rc = bundleContext_getService(context, eplRef, (void **)&eplService);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
}
static void teardownFmImport(void) {
int rc = 0;
rc = bundleContext_ungetService(context, rsaRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetServiceReference(context,rsaRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetService(context, scopeServiceRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetServiceReference(context,scopeServiceRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetService(context, testRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetServiceReference(context,testRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetService(context, eplRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = bundleContext_ungetServiceReference(context,eplRef);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
celixLauncher_stop(framework);
celixLauncher_waitForShutdown(framework);
@@ -267,8 +270,8 @@ extern "C" {
array_list_pt bundles = NULL;
int rc = bundleContext_getBundles(context, &bundles);
- CHECK_EQUAL(0, rc);
- CHECK_EQUAL(5, arrayList_size(bundles)); //framework, scopeService
& calc & rsa
+ EXPECT_EQ(0, rc);
+ EXPECT_EQ(5, arrayList_size(bundles)); //framework, scopeService &
calc & rsa
/*
int size = arrayList_size(bundles);
@@ -371,7 +374,7 @@ extern "C" {
printf("File error: line %d position %d\n", error.line,
error.position);
status = CELIX_FILE_IO_EXCEPTION;
}
- CHECK_EQUAL(CELIX_SUCCESS, status);
+ EXPECT_EQ(CELIX_SUCCESS, status);
}
/// \TEST_CASE_ID{2}
@@ -385,18 +388,18 @@ extern "C" {
printf("\nBegin: %s\n", __func__);
scopeInit("scope.json", &nr_exported, &nr_imported);
- CHECK_EQUAL(2, nr_exported);
- CHECK_EQUAL(0, nr_imported);
+ EXPECT_EQ(2, nr_exported);
+ EXPECT_EQ(0, nr_imported);
discMock->getEPDescriptors(discMock->handle, &epList);
// We export one service: Calculator, which has DFI bundle info
- CHECK_EQUAL(1, arrayList_size(epList));
+ EXPECT_EQ(1, arrayList_size(epList));
for (unsigned int i = 0; i < arrayList_size(epList); i++) {
endpoint_description_t *ep = (endpoint_description_t *)
arrayList_get(epList, i);
celix_properties_t *props = ep->properties;
hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"key2");
char* value = (char*) hashMapEntry_getValue(entry);
- STRCMP_EQUAL("inaetics", value);
+ EXPECT_STREQ("inaetics", value);
/*
printf("Service: %s ", ep->service);
hash_map_iterator_pt iter = hashMapIterator_create(props);
@@ -422,17 +425,17 @@ extern "C" {
array_list_pt epList;
printf("\nBegin: %s\n", __func__);
scopeInit("scope2.json", &nr_exported, &nr_imported);
- CHECK_EQUAL(3, nr_exported);
- CHECK_EQUAL(1, nr_imported);
+ EXPECT_EQ(3, nr_exported);
+ EXPECT_EQ(1, nr_imported);
discMock->getEPDescriptors(discMock->handle, &epList);
// We export one service: Calculator, which has DFI bundle info
- CHECK_EQUAL(1, arrayList_size(epList));
+ EXPECT_EQ(1, arrayList_size(epList));
for (unsigned int i = 0; i < arrayList_size(epList); i++) {
endpoint_description_t *ep = (endpoint_description_t *)
arrayList_get(epList, i);
celix_properties_t *props = ep->properties;
hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"key2");
char* value = (char*) hashMapEntry_getValue(entry);
- STRCMP_EQUAL("inaetics", value);
+ EXPECT_STREQ("inaetics", value);
}
printf("End: %s\n", __func__);
}
@@ -447,17 +450,17 @@ extern "C" {
array_list_pt epList;
printf("\nBegin: %s\n", __func__);
scopeInit("scope3.json", &nr_exported, &nr_imported);
- CHECK_EQUAL(3, nr_exported);
- CHECK_EQUAL(1, nr_imported);
+ EXPECT_EQ(3, nr_exported);
+ EXPECT_EQ(1, nr_imported);
discMock->getEPDescriptors(discMock->handle, &epList);
// We export one service: Calculator, which has DFI bundle info
- CHECK_EQUAL(1, arrayList_size(epList));
+ EXPECT_EQ(1, arrayList_size(epList));
for (unsigned int i = 0; i < arrayList_size(epList); i++) {
endpoint_description_t *ep = (endpoint_description_t *)
arrayList_get(epList, i);
celix_properties_t *props = ep->properties;
hash_map_entry_pt entry = hashMap_getEntry(props, (void *)"key2");
char* value = (char*) hashMapEntry_getValue(entry);
- STRCMP_EQUAL("inaetics", value);
+ EXPECT_STREQ("inaetics", value);
}
printf("End: %s\n", __func__);
}
@@ -473,17 +476,17 @@ extern "C" {
array_list_pt epList;
printf("\nBegin: %s\n", __func__);
scopeInit("scope4.json", &nr_exported, &nr_imported);
- CHECK_EQUAL(2, nr_exported);
+ EXPECT_EQ(2, nr_exported);
discMock->getEPDescriptors(discMock->handle, &epList);
// We export two services: Calculator and Calculator2, but only 1 has
DFI bundle info
- CHECK_EQUAL(1, arrayList_size(epList));
+ EXPECT_EQ(1, arrayList_size(epList));
for (unsigned int i = 0; i < arrayList_size(epList); i++) {
endpoint_description_t *ep = (endpoint_description_t *)
arrayList_get(epList, i);
celix_properties_t *props = ep->properties;
hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"zone");
char* value = (char*) hashMapEntry_getValue(entry);
- STRCMP_EQUAL("inaetics", value);
- CHECK_TRUE((entry == NULL));
+ EXPECT_STREQ("inaetics", value);
+ EXPECT_TRUE_TRUE((entry == NULL));
}
printf("End: %s\n", __func__);
}*/
@@ -498,7 +501,7 @@ extern "C" {
printf("\nBegin: %s\n", __func__);
scopeInit("scope.json", &nr_exported, &nr_imported);
- CHECK_EQUAL(0, nr_imported);
+ EXPECT_EQ(0, nr_imported);
int rc = 0;
endpoint_description_t *endpoint = NULL;
@@ -509,23 +512,23 @@ extern "C" {
celix_properties_set(props, OSGI_RSA_ENDPOINT_ID,
"eec5404d-51d0-47ef-8d86-c825a8beda42-42");
celix_properties_set(props, OSGI_RSA_SERVICE_IMPORTED_CONFIGS,
TST_CONFIGURATION_TYPE);
celix_properties_set(props, OSGI_FRAMEWORK_OBJECTCLASS,
"org.apache.celix.test.MyBundle");
- celix_properties_set(props, "service.version", "1.0.0"); //TODO find
out standard in osgi spec
- celix_properties_set(props, "zone", "thales");
+ celix_properties_set(props, "service.version", "1.0.0");
+ celix_properties_set(props, "zone", "a_zone");
rc = endpointDescription_create(props, &endpoint);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = eplService->endpointAdded(eplService->handle, endpoint, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
bool imported = testImport->IsImported(testImport);
- CHECK_EQUAL(true, imported);
+ EXPECT_EQ(true, imported);
rc = eplService->endpointRemoved(eplService->handle, endpoint, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = endpointDescription_destroy(endpoint);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
printf("*****After importService\n");
printf("End: %s\n", __func__);
@@ -541,7 +544,7 @@ extern "C" {
printf("\nBegin: %s\n", __func__);
scopeInit("scope2.json", &nr_exported, &nr_imported);
- CHECK_EQUAL(1, nr_imported);
+ EXPECT_EQ(1, nr_imported);
int rc = 0;
endpoint_description_t *endpoint = NULL;
@@ -552,23 +555,23 @@ extern "C" {
celix_properties_set(props, OSGI_RSA_ENDPOINT_ID,
"eec5404d-51d0-47ef-8d86-c825a8beda42-42");
celix_properties_set(props, OSGI_RSA_SERVICE_IMPORTED_CONFIGS,
TST_CONFIGURATION_TYPE);
celix_properties_set(props, OSGI_FRAMEWORK_OBJECTCLASS,
"org.apache.celix.test.MyBundle");
- celix_properties_set(props, "service.version", "1.0.0"); //TODO find
out standard in osgi spec
- celix_properties_set(props, "zone", "thales");
+ celix_properties_set(props, "service.version", "1.0.0");
+ celix_properties_set(props, "zone", "a_zone");
rc = endpointDescription_create(props, &endpoint);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = eplService->endpointAdded(eplService->handle, endpoint, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
bool imported = testImport->IsImported(testImport);
- CHECK_EQUAL(true, imported);
+ EXPECT_EQ(true, imported);
rc = eplService->endpointRemoved(eplService->handle, endpoint, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = endpointDescription_destroy(endpoint);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
printf("End: %s\n", __func__);
}
@@ -583,7 +586,7 @@ extern "C" {
printf("\nBegin: %s\n", __func__);
scopeInit("scope3.json", &nr_exported, &nr_imported);
- CHECK_EQUAL(1, nr_imported);
+ EXPECT_EQ(1, nr_imported);
int rc = 0;
endpoint_description_t *endpoint = NULL;
@@ -595,22 +598,22 @@ extern "C" {
celix_properties_set(props, OSGI_RSA_SERVICE_IMPORTED_CONFIGS,
TST_CONFIGURATION_TYPE);
celix_properties_set(props, OSGI_FRAMEWORK_OBJECTCLASS,
"org.apache.celix.test.MyBundle");
celix_properties_set(props, "service.version", "1.0.0"); //TODO find
out standard in osgi spec
- celix_properties_set(props, "zone", "thales");
+ celix_properties_set(props, "zone", "a_zone");
rc = endpointDescription_create(props, &endpoint);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = eplService->endpointAdded(eplService->handle, endpoint, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
bool imported = testImport->IsImported(testImport);
- CHECK_EQUAL(false, imported);
+ EXPECT_EQ(false, imported);
rc = eplService->endpointRemoved(eplService->handle, endpoint, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = endpointDescription_destroy(endpoint);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
printf("End: %s\n", __func__);
}
@@ -625,7 +628,7 @@ extern "C" {
printf("\nBegin: %s\n", __func__);
scopeInit("scope4.json", &nr_exported, &nr_imported);
- CHECK_EQUAL(2, nr_imported);
+ EXPECT_EQ(2, nr_imported);
int rc = 0;
endpoint_description_t *endpoint = NULL;
@@ -636,92 +639,79 @@ extern "C" {
celix_properties_set(props, OSGI_RSA_ENDPOINT_ID,
"eec5404d-51d0-47ef-8d86-c825a8beda42-42");
celix_properties_set(props, OSGI_RSA_SERVICE_IMPORTED_CONFIGS,
TST_CONFIGURATION_TYPE);
celix_properties_set(props, OSGI_FRAMEWORK_OBJECTCLASS,
"org.apache.celix.test.MyBundle");
- celix_properties_set(props, "service.version", "1.0.0"); //TODO find
out standard in osgi spec
- celix_properties_set(props, "zone", "thales");
+ celix_properties_set(props, "service.version", "1.0.0");
+ celix_properties_set(props, "zone", "a_zone");
rc = endpointDescription_create(props, &endpoint);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = eplService->endpointAdded(eplService->handle, endpoint, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
+ celix_framework_waitForEmptyEventQueue(framework);
bool imported = testImport->IsImported(testImport);
- CHECK_EQUAL(true, imported);
+ EXPECT_EQ(true, imported);
rc = eplService->endpointRemoved(eplService->handle, endpoint, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
rc = endpointDescription_destroy(endpoint);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
+ EXPECT_EQ(CELIX_SUCCESS, rc);
printf("End: %s\n", __func__);
}
}
-TEST_GROUP(topology_manager_scoped_export) {
- void setup(void) {
+class RemoteServiceTopologyAdminExportTestSuite : public ::testing::Test {
+public:
+ RemoteServiceTopologyAdminExportTestSuite() {
setupFm();
}
-
- void teardown() {
+ ~RemoteServiceTopologyAdminExportTestSuite() override {
teardownFm();
}
+
};
-TEST_GROUP(topology_manager_scoped_import) {
- void setup(void) {
+class RemoteServiceTopologyAdminImportTestSuite : public ::testing::Test {
+public:
+ RemoteServiceTopologyAdminImportTestSuite() {
setupFmImport();
}
-
- void teardown() {
+ ~RemoteServiceTopologyAdminImportTestSuite() override {
teardownFmImport();
}
+
};
-// Test9
-TEST(topology_manager_scoped_import, scope_import_multiple) {
+TEST_F(RemoteServiceTopologyAdminImportTestSuite, scope_import_multiple) {
testImportScopeMultiple();
}
-// Test8
-TEST(topology_manager_scoped_import, scope_import_fail) {
+TEST_F(RemoteServiceTopologyAdminImportTestSuite, scope_import_fail) {
testImportScopeFail();
}
-// Test7
-TEST(topology_manager_scoped_import, scope_import_match) {
+TEST_F(RemoteServiceTopologyAdminImportTestSuite, scope_import_match) {
testImportScopeMatch();
}
-// Test6
-TEST(topology_manager_scoped_import, scope_import) {
+TEST_F(RemoteServiceTopologyAdminImportTestSuite, scope_import) {
testImportScope();
}
-// Test5
-/*
-TODO: NYI
-TEST(topology_manager_scoped_export, scope_init4) {
- testScope4();
-}
-*/
-
-// Test4
-TEST(topology_manager_scoped_export, scope_init3) {
+TEST_F(RemoteServiceTopologyAdminExportTestSuite, scope_init3) {
testScope3();
}
-// Test3
-TEST(topology_manager_scoped_export, scope_init2) {
+TEST_F(RemoteServiceTopologyAdminExportTestSuite, scope_init2) {
testScope2();
}
-// Test2
-TEST(topology_manager_scoped_export, scope_init) {
+TEST_F(RemoteServiceTopologyAdminExportTestSuite, scope_init) {
testScope();
}
-// Test1
-TEST(topology_manager_scoped_export, init_test) {
+TEST_F(RemoteServiceTopologyAdminExportTestSuite, init_test) {
testBundles();
}