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

pnoltes pushed a commit to branch feature/#80_bundle_start_with_exception
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/#80_bundle_start_with_exception by this push:
     new 74af6d4  #80: Fixes wrong update of the resolved status for a bundle.
74af6d4 is described below

commit 74af6d42605b1df76b1c8235fb6e9c452d217972
Author: Pepijn Noltes <[email protected]>
AuthorDate: Tue Oct 8 16:35:21 2019 +0200

    #80: Fixes wrong update of the resolved status for a bundle.
---
 libs/framework/src/framework.c                      | 4 +++-
 libs/framework/tst/CMakeLists.txt                   | 3 +--
 libs/framework/tst/bundle_context_bundles_tests.cpp | 8 ++++++++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index 34363ca..308e98f 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -1928,11 +1928,13 @@ celix_status_t 
framework_markResolvedModules(framework_pt framework, linked_list
 
             if (status == CELIX_SUCCESS) {
                 module_setWires(module, wires);
-                module_setResolved(module);
                 resolver_moduleResolved(module);
                 const char *mname = NULL;
                 module_getSymbolicName(module, &mname);
                 status = framework_markBundleResolved(framework, module);
+                if (status == CELIX_SUCCESS) {
+                    module_setResolved(module);
+                }
             }
             linkedListIterator_remove(iterator);
             free(iw);
diff --git a/libs/framework/tst/CMakeLists.txt 
b/libs/framework/tst/CMakeLists.txt
index 33a5efd..d59bb3a 100644
--- a/libs/framework/tst/CMakeLists.txt
+++ b/libs/framework/tst/CMakeLists.txt
@@ -22,8 +22,7 @@ add_celix_bundle(bundle_with_exception SOURCES 
nop_activator.c VERSION 1.0.0)
 add_subdirectory(subdir) #simple_test_bundle4, simple_test_bundle5 and sublib
 
 add_celix_bundle(unresolveable_bundle SOURCES nop_activator.c VERSION 1.0.0)
-target_link_directories(unresolveable_bundle PRIVATE 
${CMAKE_CURRENT_BINARY_DIR}/subdir)
-target_link_libraries(unresolveable_bundle PRIVATE "-lsublib")
+target_link_libraries(unresolveable_bundle PRIVATE 
"-L${CMAKE_CURRENT_BINARY_DIR}/subdir -lsublib")
 add_dependencies(unresolveable_bundle sublib)
 
 add_executable(test_framework
diff --git a/libs/framework/tst/bundle_context_bundles_tests.cpp 
b/libs/framework/tst/bundle_context_bundles_tests.cpp
index f173c96..1df3b2b 100644
--- a/libs/framework/tst/bundle_context_bundles_tests.cpp
+++ b/libs/framework/tst/bundle_context_bundles_tests.cpp
@@ -113,6 +113,14 @@ TEST(CelixBundleContextBundlesTests, 
startUnresolveableBundle) {
         CHECK_EQUAL(state, OSGI_FRAMEWORK_BUNDLE_INSTALLED);
     });
     CHECK_TRUE(called);
+
+    celix_bundleContext_startBundle(ctx, bndId);
+
+    celix_framework_useBundle(fw, false, bndId, nullptr, [](void */*handle*/, 
const celix_bundle_t *bnd) {
+        auto state = celix_bundle_getState(bnd);
+        CHECK_EQUAL(state, OSGI_FRAMEWORK_BUNDLE_INSTALLED);
+    });
+    CHECK_TRUE(called);
 }
 
 TEST(CelixBundleContextBundlesTests, useBundleTest) {

Reply via email to