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/01/21 15:54:54 UTC

[celix] branch feature/gh-142-rsa-issues created (now 85776f1)

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

pnoltes pushed a change to branch feature/gh-142-rsa-issues
in repository https://gitbox.apache.org/repos/asf/celix.git.


      at 85776f1  gh-142: Refactors RSA tests and adds an additional remote service example for testing

This branch includes the following new commits:

     new 85776f1  gh-142: Refactors RSA tests and adds an additional remote service example for testing

The 1 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.



[celix] 01/01: gh-142: Refactors RSA tests and adds an additional remote service example for testing

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

pnoltes pushed a commit to branch feature/gh-142-rsa-issues
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 85776f1c933c7550d1be09f7f4876d62dadfa0d7
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Tue Jan 21 16:54:16 2020 +0100

    gh-142: Refactors RSA tests and adds an additional remote service example for testing
---
 bundles/remote_services/examples/CMakeLists.txt    |  3 +
 .../examples/calculator_api/CMakeLists.txt         |  4 +-
 .../calculator_api/include/calculator_service.h    | 17 +----
 .../org.apache.celix.calc.api.Calculator.avpr      |  0
 ...org.apache.celix.calc.api.Calculator.descriptor |  0
 .../examples/calculator_service/CMakeLists.txt     |  2 +-
 .../calculator_service/src/calculator_activator.c  | 88 ++++++----------------
 .../calculator_service/src/calculator_impl.c       | 37 +++------
 .../calculator_service/src/calculator_impl.h       | 14 ++--
 .../examples/calculator_shell/CMakeLists.txt       |  2 +-
 .../examples/calculator_shell/src/add_command.c    |  2 +-
 .../examples/calculator_shell/src/sqrt_command.c   |  2 +-
 .../examples/calculator_shell/src/sub_command.c    |  2 +-
 .../remote_service_admin_dfi/test/CMakeLists.txt   | 16 +++-
 .../test/server.properties.in                      |  2 +-
 .../test/src/rsa_client_server_tests.cpp           | 19 +++--
 .../test/src/rsa_tests.cpp                         |  2 +-
 .../test/src/tst_activator.c                       | 75 +++++++++++++++---
 .../test/src/tst_service.h                         |  5 +-
 libs/dfi/include/dyn_type.h                        |  2 +-
 20 files changed, 155 insertions(+), 139 deletions(-)

diff --git a/bundles/remote_services/examples/CMakeLists.txt b/bundles/remote_services/examples/CMakeLists.txt
index b0c9a5c..c9feea5 100644
--- a/bundles/remote_services/examples/CMakeLists.txt
+++ b/bundles/remote_services/examples/CMakeLists.txt
@@ -21,6 +21,9 @@ if (RSA_EXAMPLES)
     add_subdirectory(calculator_service)
     add_subdirectory(calculator_shell)
 
+    add_subdirectory(remote_example_api)
+    add_subdirectory(remote_example_service)
+
 
 #    TODO refactor shm remote service admin to use dfi
 #    if (BUILD_RSA_REMOTE_SERVICE_ADMIN_SHM AND BUILD_RSA_DISCOVERY_SHM)
diff --git a/bundles/remote_services/examples/calculator_api/CMakeLists.txt b/bundles/remote_services/examples/calculator_api/CMakeLists.txt
index a87945f..3b0e334 100644
--- a/bundles/remote_services/examples/calculator_api/CMakeLists.txt
+++ b/bundles/remote_services/examples/calculator_api/CMakeLists.txt
@@ -18,5 +18,5 @@
 add_library(calculator_api INTERFACE)
 target_include_directories(calculator_api INTERFACE include)
 set_target_properties(calculator_api PROPERTIES
-    "INTERFACE_CALCULATOR_DESCRIPTOR"
-    "${CMAKE_CURRENT_LIST_DIR}/include/org.apache.celix.calc.api.Calculator.avpr")
+    "INTERFACE_DESCRIPTOR"
+    "${CMAKE_CURRENT_LIST_DIR}/org.apache.celix.calc.api.Calculator.avpr")
diff --git a/bundles/remote_services/examples/calculator_api/include/calculator_service.h b/bundles/remote_services/examples/calculator_api/include/calculator_service.h
index 19e9741..6458554 100644
--- a/bundles/remote_services/examples/calculator_api/include/calculator_service.h
+++ b/bundles/remote_services/examples/calculator_api/include/calculator_service.h
@@ -16,13 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-/**
- * calculator_service.h
- *
- *  \date       Oct 5, 2011
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
 
 #ifndef CALCULATOR_SERVICE_H_
 #define CALCULATOR_SERVICE_H_
@@ -30,8 +23,6 @@
 #define CALCULATOR_SERVICE              "org.apache.celix.calc.api.Calculator"
 #define CALCULATOR_CONFIGURATION_TYPE   "org.amdatu.remote.admin.http"
 
-typedef struct calculator calculator_t;
-
 typedef struct calculator_service calculator_service_t;
 
 /*
@@ -44,10 +35,10 @@ typedef struct calculator_service calculator_service_t;
  * }
  */
 struct calculator_service {
-    calculator_t *calculator;
-    int (*add)(calculator_t *calculator, double a, double b, double *result);
-    int (*sub)(calculator_t *calculator, double a, double b, double *result);
-    int (*sqrt)(calculator_t *calculator, double a, double *result);
+    void *handle;
+    int (*add)(void *handle, double a, double b, double *result);
+    int (*sub)(void *handle, double a, double b, double *result);
+    int (*sqrt)(void *handle, double a, double *result);
 };
 
 
diff --git a/bundles/remote_services/examples/calculator_api/include/org.apache.celix.calc.api.Calculator.avpr b/bundles/remote_services/examples/calculator_api/org.apache.celix.calc.api.Calculator.avpr
similarity index 100%
rename from bundles/remote_services/examples/calculator_api/include/org.apache.celix.calc.api.Calculator.avpr
rename to bundles/remote_services/examples/calculator_api/org.apache.celix.calc.api.Calculator.avpr
diff --git a/bundles/remote_services/examples/calculator_api/include/org.apache.celix.calc.api.Calculator.descriptor b/bundles/remote_services/examples/calculator_api/org.apache.celix.calc.api.Calculator.descriptor
similarity index 100%
rename from bundles/remote_services/examples/calculator_api/include/org.apache.celix.calc.api.Calculator.descriptor
rename to bundles/remote_services/examples/calculator_api/org.apache.celix.calc.api.Calculator.descriptor
diff --git a/bundles/remote_services/examples/calculator_service/CMakeLists.txt b/bundles/remote_services/examples/calculator_service/CMakeLists.txt
index b47a3ae..2d55e0b 100644
--- a/bundles/remote_services/examples/calculator_service/CMakeLists.txt
+++ b/bundles/remote_services/examples/calculator_service/CMakeLists.txt
@@ -25,5 +25,5 @@ add_celix_bundle(calculator
 target_include_directories(calculator PRIVATE src)
 target_link_libraries(calculator PRIVATE Celix::rsa_spi calculator_api)
 
-get_target_property(DESCR calculator_api INTERFACE_CALCULATOR_DESCRIPTOR)
+get_target_property(DESCR calculator_api INTERFACE_DESCRIPTOR)
 celix_bundle_files(calculator ${DESCR} DESTINATION .)
diff --git a/bundles/remote_services/examples/calculator_service/src/calculator_activator.c b/bundles/remote_services/examples/calculator_service/src/calculator_activator.c
index 41737f1..e616fb4 100644
--- a/bundles/remote_services/examples/calculator_service/src/calculator_activator.c
+++ b/bundles/remote_services/examples/calculator_service/src/calculator_activator.c
@@ -16,88 +16,44 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-/**
- * calculator_activator.c
- *
- *  \date       Oct 5, 2011
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
 
 #include <stdlib.h>
 
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "service_registration.h"
+#include <celix_api.h>
 
 #include "calculator_impl.h"
 #include "remote_constants.h"
 
 struct activator {
     calculator_t *calculator;
-    calculator_service_t *service;
-
-    service_registration_t *calculatorReg;
+    calculator_service_t service;
+    long svcId;
 };
 
-celix_status_t bundleActivator_create(celix_bundle_context_t *context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator;
+celix_status_t calculatorBndStart(struct activator *act, celix_bundle_context_t *ctx) {
+    act->svcId = -1L;
+    act->calculator = calculator_create();
+    if (act->calculator != NULL) {
+        act->service.handle = act->calculator;
+        act->service.add = (void*)calculator_add;
+        act->service.sub = (void*)calculator_sub;
+        act->service.sqrt = (void*)calculator_sqrt;
 
-    activator = calloc(1, sizeof(*activator));
-    if (!activator) {
-        status = CELIX_ENOMEM;
-    } else {
-        activator->calculatorReg = NULL;
+        celix_properties_t *properties = celix_properties_create();
+        celix_properties_set(properties, OSGI_RSA_SERVICE_EXPORTED_INTERFACES, CALCULATOR_SERVICE);
+        celix_properties_set(properties, OSGI_RSA_SERVICE_EXPORTED_CONFIGS, CALCULATOR_CONFIGURATION_TYPE);
 
-        *userData = activator;
+        act->svcId = celix_bundleContext_registerService(ctx, &act->service, CALCULATOR_SERVICE, properties);
     }
-
-    return status;
+    return CELIX_SUCCESS;
 }
 
-celix_status_t bundleActivator_start(void * userData, celix_bundle_context_t *context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    status = calculator_create(&activator->calculator);
-    if (status == CELIX_SUCCESS) {
-        activator->service = calloc(1, sizeof(*activator->service));
-        if (!activator->service) {
-            status = CELIX_ENOMEM;
-        } else {
-            activator->service->calculator = activator->calculator;
-            activator->service->add = calculator_add;
-            activator->service->sub = calculator_sub;
-            activator->service->sqrt = calculator_sqrt;
-
-            celix_properties_t *properties = celix_properties_create();
-            celix_properties_set(properties, OSGI_RSA_SERVICE_EXPORTED_INTERFACES, CALCULATOR_SERVICE);
-            celix_properties_set(properties, OSGI_RSA_SERVICE_EXPORTED_CONFIGS, CALCULATOR_CONFIGURATION_TYPE);
-            bundleContext_registerService(context, CALCULATOR_SERVICE, activator->service, properties, &activator->calculatorReg);
-        }
+celix_status_t calculatorBndStop(struct activator *act, celix_bundle_context_t *ctx) {
+    celix_bundleContext_unregisterService(ctx, act->svcId);
+    if (act->calculator != NULL) {
+        calculator_destroy(act->calculator);
     }
-
-    return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, celix_bundle_context_t *context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    serviceRegistration_unregister(activator->calculatorReg);
-
-    free(activator->service);
-
-    calculator_destroy(&activator->calculator);
-
-    return status;
+    return CELIX_SUCCESS;
 }
 
-celix_status_t bundleActivator_destroy(void * userData, celix_bundle_context_t *context) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    free(userData);
-
-    return status;
-}
+CELIX_GEN_BUNDLE_ACTIVATOR(struct activator, calculatorBndStart, calculatorBndStop);
diff --git a/bundles/remote_services/examples/calculator_service/src/calculator_impl.c b/bundles/remote_services/examples/calculator_service/src/calculator_impl.c
index ad59820..db6b7b8 100644
--- a/bundles/remote_services/examples/calculator_service/src/calculator_impl.c
+++ b/bundles/remote_services/examples/calculator_service/src/calculator_impl.c
@@ -16,13 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-/**
- * calculator_impl.c
- *
- *  \date       Oct 5, 2011
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+
 
 #include <math.h>
 
@@ -31,24 +25,17 @@
 
 #include "calculator_impl.h"
 
-celix_status_t calculator_create(calculator_t **calculator) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    *calculator = calloc(1, sizeof(**calculator));
-    if (!*calculator) {
-        status = CELIX_ENOMEM;
-    }
-
-    return status;
+calculator_t* calculator_create(void) {
+    struct calculator *calc = calloc(1, sizeof(*calc));
+    return calc;
 }
 
-celix_status_t calculator_destroy(calculator_t **calculator) {
-    free(*calculator);
-    return CELIX_SUCCESS;
+void calculator_destroy(calculator_t *calculator) {
+    free(calculator);
 }
 
-celix_status_t calculator_add(calculator_t *calculator, double a, double b, double *result) {
-    celix_status_t status = CELIX_SUCCESS;
+int calculator_add(calculator_t *calculator __attribute__((unused)), double a, double b, double *result) {
+    int status = CELIX_SUCCESS;
 
     *result = a + b;
     printf("CALCULATOR: Add: %f + %f = %f\n", a, b, *result);
@@ -56,8 +43,8 @@ celix_status_t calculator_add(calculator_t *calculator, double a, double b, doub
     return status;
 }
 
-celix_status_t calculator_sub(calculator_t *calculator, double a, double b, double *result) {
-    celix_status_t status = CELIX_SUCCESS;
+int calculator_sub(calculator_t *calculator __attribute__((unused)), double a, double b, double *result) {
+    int status = CELIX_SUCCESS;
 
     *result = a - b;
     printf("CALCULATOR: Sub: %f + %f = %f\n", a, b, *result);
@@ -65,8 +52,8 @@ celix_status_t calculator_sub(calculator_t *calculator, double a, double b, doub
     return status;
 }
 
-celix_status_t calculator_sqrt(calculator_t *calculator, double a, double *result) {
-    celix_status_t status = CELIX_SUCCESS;
+int calculator_sqrt(calculator_t *calculator __attribute__((unused)), double a, double *result) {
+    int status = CELIX_SUCCESS;
 
     if (a > 0) {
         *result = sqrt(a);
diff --git a/bundles/remote_services/examples/calculator_service/src/calculator_impl.h b/bundles/remote_services/examples/calculator_service/src/calculator_impl.h
index 94023f8..c70b2f9 100644
--- a/bundles/remote_services/examples/calculator_service/src/calculator_impl.h
+++ b/bundles/remote_services/examples/calculator_service/src/calculator_impl.h
@@ -31,13 +31,13 @@
 
 #include "calculator_service.h"
 
-struct calculator {
-};
+typedef struct calculator {
+} calculator_t;
 
-celix_status_t calculator_create(calculator_t **calculator);
-celix_status_t calculator_destroy(calculator_t **calculator);
-celix_status_t calculator_add(calculator_t *calculator, double a, double b, double *result);
-celix_status_t calculator_sub(calculator_t *calculator, double a, double b, double *result);
-celix_status_t calculator_sqrt(calculator_t *calculator, double a, double *result);
+calculator_t* calculator_create(void);
+void calculator_destroy(calculator_t *calculator);
+int calculator_add(calculator_t *calculator, double a, double b, double *result);
+int calculator_sub(calculator_t *calculator, double a, double b, double *result);
+int calculator_sqrt(calculator_t *calculator, double a, double *result);
 
 #endif /* CALCULATOR_IMPL_H_ */
diff --git a/bundles/remote_services/examples/calculator_shell/CMakeLists.txt b/bundles/remote_services/examples/calculator_shell/CMakeLists.txt
index 14087e3..2c0158a 100644
--- a/bundles/remote_services/examples/calculator_shell/CMakeLists.txt
+++ b/bundles/remote_services/examples/calculator_shell/CMakeLists.txt
@@ -28,7 +28,7 @@ target_include_directories(calculator_shell PRIVATE src)
 target_link_libraries(calculator_shell PRIVATE Celix::shell_api calculator_api)
 
 celix_bundle_files(calculator_shell
-    ../calculator_api/include/org.apache.celix.calc.api.Calculator.avpr
+    ../calculator_api/org.apache.celix.calc.api.Calculator.avpr
     #src/org.apache.celix.calc.api.Calculator2.descriptor ##Use this descriptor in case you want to try out versioning!
     DESTINATION .
 )
diff --git a/bundles/remote_services/examples/calculator_shell/src/add_command.c b/bundles/remote_services/examples/calculator_shell/src/add_command.c
index 6e66edd..12e08ee 100644
--- a/bundles/remote_services/examples/calculator_shell/src/add_command.c
+++ b/bundles/remote_services/examples/calculator_shell/src/add_command.c
@@ -61,7 +61,7 @@ void addCommand_execute(celix_bundle_context_t *context, char *line, FILE *out,
                     double a = atof(aStr);
                     double b = atof(bStr);
                     double result = 0;
-                    status = calculator->add(calculator->calculator, a, b, &result);
+                    status = calculator->add(calculator->handle, a, b, &result);
                     if (status == CELIX_SUCCESS) {
                         fprintf(out, "CALCULATOR_SHELL: Add: %f + %f = %f\n", a, b, result);
                     } else {
diff --git a/bundles/remote_services/examples/calculator_shell/src/sqrt_command.c b/bundles/remote_services/examples/calculator_shell/src/sqrt_command.c
index 07de852..c014092 100644
--- a/bundles/remote_services/examples/calculator_shell/src/sqrt_command.c
+++ b/bundles/remote_services/examples/calculator_shell/src/sqrt_command.c
@@ -56,7 +56,7 @@ void sqrtCommand_execute(celix_bundle_context_t *context, char *line, FILE *out,
                 if (status == CELIX_SUCCESS && calculator != NULL) {
                     double a = atof(aStr);
                     double result = 0;
-                    status = calculator->sqrt(calculator->calculator, a, &result);
+                    status = calculator->sqrt(calculator->handle, a, &result);
                     if (status == CELIX_SUCCESS) {
                         fprintf(out, "CALCULATOR_SHELL: Sqrt: %f = %f\n", a, result);
                     } else {
diff --git a/bundles/remote_services/examples/calculator_shell/src/sub_command.c b/bundles/remote_services/examples/calculator_shell/src/sub_command.c
index 9dbd5c1..b275b6c 100644
--- a/bundles/remote_services/examples/calculator_shell/src/sub_command.c
+++ b/bundles/remote_services/examples/calculator_shell/src/sub_command.c
@@ -59,7 +59,7 @@ void subCommand_execute(celix_bundle_context_t *context, char *line, FILE *out,
                     double a = atof(aStr);
                     double b = atof(bStr);
                     double result = 0;
-                    status = calculator->sub(calculator->calculator, a, b, &result);
+                    status = calculator->sub(calculator->handle, a, b, &result);
                     if (status == CELIX_SUCCESS) {
                         fprintf(out, "CALCULATOR_SHELL: Sub: %f - %f = %f\n", a, b, result);
                     } else {
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt b/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt
index 20efa08..dddd0a5 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt
+++ b/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt
@@ -23,9 +23,16 @@ add_celix_bundle(rsa_dfi_tst_bundle
     SOURCES
         src/tst_activator.c
 )
-get_target_property(DESCR calculator_api INTERFACE_CALCULATOR_DESCRIPTOR)
+
+#add calculator avpr
+get_target_property(DESCR calculator_api INTERFACE_DESCRIPTOR)
+celix_bundle_files(rsa_dfi_tst_bundle ${DESCR} DESTINATION .)
+
+#add remote example avpr
+get_target_property(DESCR remote_example_api INTERFACE_DESCRIPTOR)
 celix_bundle_files(rsa_dfi_tst_bundle ${DESCR} DESTINATION .)
-target_link_libraries(rsa_dfi_tst_bundle PRIVATE ${CPPUTEST_LIBRARY} calculator_api)
+
+target_link_libraries(rsa_dfi_tst_bundle PRIVATE ${CPPUTEST_LIBRARY} calculator_api remote_example_api)
 target_include_directories(rsa_dfi_tst_bundle PRIVATE src)
 
 add_executable(test_rsa_dfi
@@ -37,7 +44,8 @@ target_include_directories(test_rsa_dfi PRIVATE src)
 target_link_libraries(test_rsa_dfi PRIVATE CURL::libcurl ${CPPUTEST_LIBRARY}
         Celix::framework
         Celix::rsa_common
-        calculator_api)
+        calculator_api
+)
 
 get_property(rsa_bundle_file TARGET rsa_dfi PROPERTY BUNDLE_FILE)
 get_property(calc_bundle_file TARGET calculator PROPERTY BUNDLE_FILE)
@@ -45,6 +53,7 @@ get_property(calculator_shell_bundle_file TARGET calculator_shell PROPERTY BUNDL
 get_property(discovery_configured_bundle_file TARGET rsa_discovery_configured PROPERTY BUNDLE_FILE)
 get_property(topology_manager_bundle_file TARGET Celix::rsa_topology_manager PROPERTY BUNDLE_FILE)
 get_property(tst_bundle_file TARGET rsa_dfi_tst_bundle PROPERTY BUNDLE_FILE)
+get_property(remote_example_bundle_file TARGET remote_example_service PROPERTY BUNDLE_FILE)
 
 configure_file(config.properties.in config.properties)
 configure_file(client.properties.in client.properties)
@@ -53,6 +62,7 @@ configure_file(server.properties.in server.properties)
 add_dependencies(test_rsa_dfi
         rsa_dfi_bundle #note depend on the target creating the bundle zip not the lib target
         calculator_bundle
+        remote_example_service_bundle
 )
 
 add_test(NAME run_test_rsa_dfi COMMAND test_rsa_dfi)
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/server.properties.in b/bundles/remote_services/remote_service_admin_dfi/test/server.properties.in
index 92e3407..5a1fa7d 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/server.properties.in
+++ b/bundles/remote_services/remote_service_admin_dfi/test/server.properties.in
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-cosgi.auto.start.1=@rsa_bundle_file@ @calc_bundle_file@ @discovery_configured_bundle_file@ @topology_manager_bundle_file@
+cosgi.auto.start.1=@rsa_bundle_file@ @calc_bundle_file@ @remote_example_bundle_file@ @discovery_configured_bundle_file@ @topology_manager_bundle_file@
 LOGHELPER_ENABLE_STDOUT_FALLBACK=true
 org.osgi.framework.storage.clean=onFirstInit
 org.osgi.framework.storage=.cacheServer
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp
index 05935a6..bef4301 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp
+++ b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp
@@ -22,7 +22,6 @@
 #include "celix_constants.h"
 #include <tst_service.h>
 #include "CppUTest/CommandLineTestRunner.h"
-#include "calculator_service.h"
 
 extern "C" {
 
@@ -36,7 +35,6 @@ extern "C" {
 #include "celix_launcher.h"
 #include "framework.h"
 #include "remote_service_admin.h"
-#include "calculator_service.h"
 
     static celix_framework_t *serverFramework = NULL;
     static celix_bundle_context_t *serverContext = NULL;
@@ -87,7 +85,9 @@ extern "C" {
         clientFramework = NULL;
     }
 
-    static void test1(void) {
+    static void test(void) {
+        //TODO refactor to use celix_bundleContext_useService calls
+
         celix_status_t rc;
         service_reference_pt ref = NULL;
         tst_service_t *tst = NULL;
@@ -107,9 +107,18 @@ extern "C" {
         CHECK_EQUAL(CELIX_SUCCESS, rc);
         CHECK(tst != NULL);
 
-        rc = tst->test(tst->handle);
+        rc = tst->isCalcDiscovered(tst->handle);
+        CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+        rc = tst->testCalculator(tst->handle);
         CHECK_EQUAL(CELIX_SUCCESS, rc);
 
+//        rc = tst->isRemoteExampleDiscovered(tst->handle);
+//        CHECK_EQUAL(CELIX_SUCCESS, rc);
+//
+//        rc = tst->testRemoteExample(tst->handle);
+//        CHECK_EQUAL(CELIX_SUCCESS, rc);
+
         bool result;
         bundleContext_ungetService(clientContext, ref, &result);
         bundleContext_ungetServiceReference(clientContext, ref);
@@ -129,5 +138,5 @@ TEST_GROUP(RsaDfiClientServerTests) {
 };
 
 TEST(RsaDfiClientServerTests, Test1) {
-    test1();
+    test();
 }
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp
index fe25fa0..4d8e993 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp
+++ b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp
@@ -117,7 +117,7 @@ extern "C" {
         CHECK_EQUAL(0, arrayList_size(imported));
 
         double result = 0;
-        rc = calc->add(calc->calculator, 2.0, 5.0, &result);
+        rc = calc->add(calc->handle, 2.0, 5.0, &result);
         CHECK_EQUAL(CELIX_SUCCESS, rc);
         CHECK_EQUAL(7.0, result);
 
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c b/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c
index 98612e2..ab84e22 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c
+++ b/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c
@@ -24,16 +24,19 @@
 
 #include "tst_service.h"
 #include "calculator_service.h"
+#include "remote_example.h"
 #include <unistd.h>
 
 struct activator {
     long svcId;
     struct tst_service testSvc;
 
-    long trackerId;
+    long trackerId1;
+    long trackerId2;
 
     pthread_mutex_t mutex; //protects below
     calculator_service_t *calc;
+    remote_example_t *remoteExample;
 };
 
 static void bndSetCalc(void* handle, void* svc) {
@@ -43,11 +46,15 @@ static void bndSetCalc(void* handle, void* svc) {
     pthread_mutex_unlock(&act->mutex);
 }
 
-static int bndTest(void *handle) {
-    int status = 0;
-    struct activator *act = handle;
+static void bndSetRemoteExample(void* handle, void* svc) {
+    struct activator * act = handle;
+    pthread_mutex_lock(&act->mutex);
+    act->remoteExample = svc;
+    pthread_mutex_unlock(&act->mutex);
+}
 
-    double result = -1.0;
+static bool bndIsCalculatorDiscovered(void *handle) {
+    struct activator *act = handle;
 
     int retries = 40;
 
@@ -64,11 +71,42 @@ static int bndTest(void *handle) {
         pthread_mutex_unlock(&act->mutex);
     }
 
+    bool discovered = local != NULL;
+    return discovered;
+}
+
+static bool bndIsRemoteExampleDiscovered(void *handle) {
+    struct activator *act = handle;
+
+    int retries = 40;
+
+    pthread_mutex_lock(&act->mutex);
+    remote_example_t *local = act->remoteExample;
+    pthread_mutex_unlock(&act->mutex);
+
+    while (local == NULL && retries > 0) {
+        printf("Waiting for remote example service .. %d\n", retries);
+        usleep(100000);
+        --retries;
+        pthread_mutex_lock(&act->mutex);
+        local = act->remoteExample;
+        pthread_mutex_unlock(&act->mutex);
+    }
+
+    bool discovered = local != NULL;
+    return discovered;
+}
+
+static int bndTestCalculator(void *handle) {
+    int status = 0;
+    struct activator *act = handle;
+
+    double result = -1.0;
 
     pthread_mutex_lock(&act->mutex);
     int rc = 1;
     if (act->calc != NULL) {
-        rc = act->calc->sqrt(act->calc->calculator, 4, &result);
+        rc = act->calc->sqrt(act->calc->handle, 4, &result);
         printf("calc result is %f\n", result);
     } else {
         printf("calc not ready\n");
@@ -82,10 +120,20 @@ static int bndTest(void *handle) {
     return status;
 }
 
+static int bndTestRemoteExample(void *handle) {
+    return 1;//TODO
+//    int status = 0;
+//    struct activator *act = handle;
+//    return status;
+}
+
 static celix_status_t bndStart(struct activator *act, celix_bundle_context_t* ctx) {
     //initialize service struct
     act->testSvc.handle = act;
-    act->testSvc.test = bndTest;
+    act->testSvc.isCalcDiscovered = bndIsCalculatorDiscovered;
+    act->testSvc.isRemoteExampleDiscovered = bndIsRemoteExampleDiscovered;
+    act->testSvc.testCalculator = bndTestCalculator;
+    act->testSvc.testRemoteExample = bndTestRemoteExample;
 
     //create mutex
     pthread_mutex_init(&act->mutex, NULL);
@@ -97,7 +145,15 @@ static celix_status_t bndStart(struct activator *act, celix_bundle_context_t* ct
         opts.callbackHandle = act;
         opts.filter.serviceName = CALCULATOR_SERVICE;
         opts.filter.ignoreServiceLanguage = true;
-        act->trackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts);
+        act->trackerId1 = celix_bundleContext_trackServicesWithOptions(ctx, &opts);
+    }
+    {
+        celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
+        opts.set = bndSetRemoteExample;
+        opts.callbackHandle = act;
+        opts.filter.serviceName = REMOTE_EXAMPLE_NAME;
+        opts.filter.ignoreServiceLanguage = true;
+        act->trackerId2 = celix_bundleContext_trackServicesWithOptions(ctx, &opts);
     }
 
     //register test service
@@ -107,7 +163,8 @@ static celix_status_t bndStart(struct activator *act, celix_bundle_context_t* ct
 
 static celix_status_t bndStop(struct activator *act, celix_bundle_context_t* ctx) {
     celix_bundleContext_unregisterService(ctx, act->svcId);
-    celix_bundleContext_stopTracker(ctx, act->trackerId);
+    celix_bundleContext_stopTracker(ctx, act->trackerId1);
+    celix_bundleContext_stopTracker(ctx, act->trackerId2);
     pthread_mutex_destroy(&act->mutex);
     return CELIX_SUCCESS;
 }
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h b/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h
index 0724794..132b779 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h
+++ b/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h
@@ -24,7 +24,10 @@
 
 struct tst_service {
     void *handle;
-    int (*test)(void *handle);
+    bool (*isCalcDiscovered)(void *handle);
+    bool (*isRemoteExampleDiscovered)(void *handle);
+    int (*testCalculator)(void *handle);
+    int (*testRemoteExample)(void *handle);
 };
 
 typedef struct tst_service tst_service_t;
diff --git a/libs/dfi/include/dyn_type.h b/libs/dfi/include/dyn_type.h
index 500764b..1dff59e 100644
--- a/libs/dfi/include/dyn_type.h
+++ b/libs/dfi/include/dyn_type.h
@@ -89,7 +89,7 @@
  * TypedPointer
  * *(Type)
  *
- * MetaInfo TODO
+ * MetaInfo
  * #Name=Value;
  *
  *