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 2018/05/29 20:08:16 UTC

celix git commit: CELIX-446: Fixes bundle context test for bundleContext_getProperty

Repository: celix
Updated Branches:
  refs/heads/develop 3e27acf53 -> b1a91a4cc


CELIX-446: Fixes bundle context test for bundleContext_getProperty


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

Branch: refs/heads/develop
Commit: b1a91a4cc19f041bd404c837f228e6713cbfc566
Parents: 3e27acf
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue May 29 22:07:56 2018 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue May 29 22:07:56 2018 +0200

----------------------------------------------------------------------
 libs/framework/private/test/bundle_context_test.cpp | 6 +-----
 libs/framework/src/bundle_context.c                 | 8 +++++++-
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/b1a91a4c/libs/framework/private/test/bundle_context_test.cpp
----------------------------------------------------------------------
diff --git a/libs/framework/private/test/bundle_context_test.cpp b/libs/framework/private/test/bundle_context_test.cpp
index 21abb80..9ae57e0 100644
--- a/libs/framework/private/test/bundle_context_test.cpp
+++ b/libs/framework/private/test/bundle_context_test.cpp
@@ -590,7 +590,7 @@ TEST(bundle_context, removeFrameworkListener){
 }
 
 TEST(bundle_context, getProperty) {
-	mock().expectOneCall("framework_logCode").withParameter("code", CELIX_ILLEGAL_ARGUMENT);
+//	mock().expectOneCall("framework_logCode").withParameter("code", CELIX_ILLEGAL_ARGUMENT);
 
 	bundle_context_pt context = (bundle_context_pt) malloc(sizeof(*context));
 	framework_pt framework = (framework_pt) 0x10;
@@ -612,9 +612,5 @@ TEST(bundle_context, getProperty) {
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 	STRCMP_EQUAL(value, actualValue);
 
-	actualValue = NULL;
-	status = bundleContext_getProperty(context, NULL, &actualValue);
-
-	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
 	free(context);
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/b1a91a4c/libs/framework/src/bundle_context.c
----------------------------------------------------------------------
diff --git a/libs/framework/src/bundle_context.c b/libs/framework/src/bundle_context.c
index d3a2c1e..84d6346 100644
--- a/libs/framework/src/bundle_context.c
+++ b/libs/framework/src/bundle_context.c
@@ -108,9 +108,15 @@ celix_status_t bundleContext_destroy(bundle_context_pt context) {
 celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *out) {
 	celix_status_t status = CELIX_SUCCESS;
     celix_bundle_t *bnd = celix_bundleContext_getBundle(context);
+    if (context == NULL) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
     if (out != NULL) {
         *out = bnd;
     }
+
+    framework_logIfError(logger, status, NULL, "Failed to get bundle");
+
 	return status;
 }
 
@@ -961,4 +967,4 @@ const char* celix_bundleContext_getProperty(celix_bundle_context_t *ctx, const c
         fw_getProperty(ctx->framework, key, defaultVal, &val);
     }
     return val;
-}
\ No newline at end of file
+}