celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [05/50] [abbrv] celix git commit: CELIX-237: Finished ccputest setup for testing the rsa dfi bundle. Cpputest uses the launcher to launch an embedded celix
Date Tue, 13 Oct 2015 10:21:33 GMT
CELIX-237: Finished ccputest setup for testing the rsa dfi bundle. Cpputest uses the launcher
to launch an embedded celix


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/481e5c86
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/481e5c86
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/481e5c86

Branch: refs/heads/develop
Commit: 481e5c86114ecdd2bef5b2f5f6afdb32a6a6a537
Parents: 1e618fb
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Fri Jul 31 22:56:02 2015 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Fri Jul 31 22:56:02 2015 +0200

----------------------------------------------------------------------
 launcher/private/src/launcher.c                 |  9 +++--
 launcher/public/include/launcher.h              |  1 +
 .../remote_service_admin_dfi/CMakeLists.txt     |  4 ++-
 .../remote_service_admin_dfi/tst/CMakeLists.txt | 18 ++++++----
 .../remote_service_admin_dfi/tst/rsa_tests.cpp  | 36 ++++++++++++++++++++
 .../remote_service_admin_dfi/tst/run_tests.cpp  | 21 +++++++++---
 6 files changed, 74 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/launcher/private/src/launcher.c
----------------------------------------------------------------------
diff --git a/launcher/private/src/launcher.c b/launcher/private/src/launcher.c
index 9292ffb..4f0f3de 100644
--- a/launcher/private/src/launcher.c
+++ b/launcher/private/src/launcher.c
@@ -183,15 +183,18 @@ void celixLauncher_waitForShutdown(void) {
     properties_destroy(config);
 }
 
+void celixLauncher_stop(void) {
+    bundle_pt fwBundle = NULL;
+    framework_getFrameworkBundle(framework, &fwBundle);
+    bundle_stop(fwBundle);
+}
 
 struct framework *celixLauncher_getFramework(void) {
     return framework;
 }
 
 static void launcher_shutdown(int signal) {
-    bundle_pt fwBundle = NULL;
-    framework_getFrameworkBundle(framework, &fwBundle);
-    bundle_stop(fwBundle);
+    celixLauncher_stop();
 //	if (framework_waitForStop(framework) != CELIX_SUCCESS) {
 //		celix_log("Error waiting for stop.");
 //	}

http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/launcher/public/include/launcher.h
----------------------------------------------------------------------
diff --git a/launcher/public/include/launcher.h b/launcher/public/include/launcher.h
index f95e160..6ee8357 100644
--- a/launcher/public/include/launcher.h
+++ b/launcher/public/include/launcher.h
@@ -32,6 +32,7 @@
 
 int celixLauncher_launch(const char *configFile);
 int celixLauncher_launchWithStream(FILE *config);
+void celixLauncher_stop(void);
 void celixLauncher_waitForShutdown(void);
 struct framework *celixLauncher_getFramework(void);
 

http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/remote_services/remote_service_admin_dfi/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/CMakeLists.txt b/remote_services/remote_service_admin_dfi/CMakeLists.txt
index 500e40e..3937605 100644
--- a/remote_services/remote_service_admin_dfi/CMakeLists.txt
+++ b/remote_services/remote_service_admin_dfi/CMakeLists.txt
@@ -46,7 +46,9 @@ if (RSA_REMOTE_SERVICE_ADMIN_DFI)
         ${PROJECT_SOURCE_DIR}/remote_services/utils/private/src/civetweb.c
         ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
     )
-    target_link_libraries(remote_service_admin_dfi celix_framework ${CURL_LIBRARIES} ${JANSSON_LIBRARIES}
${FFI_LIBRARIES} dfi)
+    target_link_libraries(remote_service_admin_dfi celix_framework celix_utils ${CURL_LIBRARIES}
${JANSSON_LIBRARIES} ${FFI_LIBRARIES} dfi)
 
     install_bundle(remote_service_admin_dfi)
+
+    add_subdirectory(tst)
 endif (RSA_REMOTE_SERVICE_ADMIN_DFI)

http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt b/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt
index fb1834a..d71186e 100644
--- a/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt
+++ b/remote_services/remote_service_admin_dfi/tst/CMakeLists.txt
@@ -3,20 +3,26 @@
 #
 
 include_directories(
-	${PROJECT_SOURCE_DIR}/launcher/public
+	${PROJECT_SOURCE_DIR}/launcher/public/include
     ${CPPUTEST_INCLUDE_DIR}
+    ${PROJECT_SOURCE_DIR}/framework/public/include
+    ${PROJECT_SOURCE_DIR}/utils/public/include
 )
 
-
 #if (FRAMEWORK_TESTS) TODO
+    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")
+
 	add_executable(rsa_dfi_tests
-		${PROJECT_SOURCE_DIR}/launcher/private/src/launcher
-	    tst/run_tests.cpp
+	    ${PROJECT_SOURCE_DIR}/launcher/private/src/launcher.c
+	    run_tests.cpp
+	    rsa_tests.cpp
 	)
-	target_link_libraries(rsa_dfi_tests ${CPPUTEST_LIBRARY}) #TODO add celix/launcer etc
+	target_link_libraries(rsa_dfi_tests ${CPPUTEST_LIBRARY} celix_framework celix_utils ${CURL_LIBRARIES})
 
 	get_property(rsa_bundle_file TARGET remote_service_admin_dfi PROPERTY BUNDLE)
-	configure_file(config.properties.in config-rsa.properties @ONLY)
+	configure_file(config.properties.in config.properties @ONLY)
 
 	add_test(NAME run_rsa_dfi_tests COMMAND rsa_dfi_tests)
 	SETUP_TARGET_FOR_COVERAGE(rsa_dfi_tests_cov rsa_dfi_tests ${CMAKE_BINARY_DIR}/coverage/rsa_dfi)

http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/remote_services/remote_service_admin_dfi/tst/rsa_tests.cpp
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/tst/rsa_tests.cpp b/remote_services/remote_service_admin_dfi/tst/rsa_tests.cpp
new file mode 100644
index 0000000..b9206da
--- /dev/null
+++ b/remote_services/remote_service_admin_dfi/tst/rsa_tests.cpp
@@ -0,0 +1,36 @@
+/*
+ * Licensed under Apache License v2. See LICENSE for more information.
+ */
+#include <CppUTest/TestHarness.h>
+#include "CppUTest/CommandLineTestRunner.h"                                             
                                                                                         
                                
+
+extern "C" {
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "launcher.h"
+#include "framework.h"
+
+
+static void testFindRsaService(void) {
+    struct framework *fm = celixLauncher_getFramework();
+    CHECK(fm != NULL);
+
+    //TODO get framework bundle context. lookup service -> test service
+}
+
+}
+
+
+TEST_GROUP(RsaDfiTests) {
+    void setup() {
+    }
+};
+
+TEST(RsaDfiTests, FindRsaService) {
+    testFindRsaService();
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/481e5c86/remote_services/remote_service_admin_dfi/tst/run_tests.cpp
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/tst/run_tests.cpp b/remote_services/remote_service_admin_dfi/tst/run_tests.cpp
index b5f29e7..dedb70a 100644
--- a/remote_services/remote_service_admin_dfi/tst/run_tests.cpp
+++ b/remote_services/remote_service_admin_dfi/tst/run_tests.cpp
@@ -4,15 +4,26 @@
 #include <CppUTest/TestHarness.h>
 #include "CppUTest/CommandLineTestRunner.h"
 
-#include <stdio.h>
 
-#include "launcher.h"
+extern "C" {
+    #include <stdio.h>
 
+    #include "launcher.h"
+    #include "framework.h"
+
+    static int startCelix(void) {
+        celixLauncher_launch("config.properties");
+    }
+
+    static int stopCelix(void) {
+        celixLauncher_stop();
+        celixLauncher_waitForShutdown();
+    }
+}
 
 int main(int argc, char** argv) {
-    celixLauncher_launch("config.properties");
+    startCelix();
     int rc = RUN_ALL_TESTS(argc, argv);
-    framework_stop((celixLauncher_getFramework()));
-    celixLauncher_waitForShutdown();
+    stopCelix();
     return rc;
 }
\ No newline at end of file


Mime
View raw message