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/02/08 13:11:05 UTC

[celix] 01/02: Merge branch 'develop' into feature/query_command

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

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

commit c83706418f9b26c3c7866f87f4916e34db11c31e
Merge: 707c5a9 5ed4693
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Sat Feb 8 14:07:23 2020 +0100

    Merge branch 'develop' into feature/query_command
    
    # Conflicts:
    #	libs/framework/src/framework.c
    #	libs/framework/test/bundle_context_bundles_tests.cpp

 cmake/cmake_celix/BundlePackaging.cmake            |   7 +-
 libs/framework/CMakeLists.txt                      |   2 +-
 libs/framework/include/celix_bundle_context.h      |  22 +-
 libs/framework/include/celix_framework.h           |  58 ++
 libs/framework/private/mock/framework_mock.c       |  59 +-
 .../framework/private/test/bundle_context_test.cpp |  10 +-
 libs/framework/private/test/bundle_test.cpp        |  12 +-
 libs/framework/src/bundle.c                        |   6 +-
 libs/framework/src/bundle_context.c                |  72 +--
 libs/framework/src/framework.c                     | 621 ++++++++++++---------
 libs/framework/src/framework_private.h             |   8 +-
 libs/framework/{tst => test}/CMakeLists.txt        |   0
 .../{tst => test}/bundle_context_bundles_tests.cpp |  74 ++-
 .../{tst => test}/bundle_context_services_test.cpp |   0
 libs/framework/{tst => test}/config.properties.in  |   0
 libs/framework/{tst => test}/dm_tests.cpp          |   0
 .../{tst => test}/framework1.properties.in         |   0
 .../{tst => test}/framework2.properties.in         |   0
 .../{tst => test}/multiple_frameworks_test.cpp     |   0
 libs/framework/{tst => test}/nop_activator.c       |   0
 libs/framework/{tst => test}/run_tests.cpp         |   0
 .../{tst => test}/single_framework_test.cpp        |   0
 libs/framework/{tst => test}/subdir/CMakeLists.txt |   0
 libs/framework/{tst => test}/subdir/src/foo.c      |   0
 24 files changed, 563 insertions(+), 388 deletions(-)

diff --cc libs/framework/test/bundle_context_bundles_tests.cpp
index 9f8794b,99ea18b..354ed79
--- a/libs/framework/test/bundle_context_bundles_tests.cpp
+++ b/libs/framework/test/bundle_context_bundles_tests.cpp
@@@ -379,39 -413,4 +413,39 @@@ TEST(CelixBundleContextBundlesTests, us
      std::cout << "use thread joined" << std::endl;
      uninstallThread.join();
      std::cout << "uninstall thread joined" << std::endl;
- };*/
 -};
++};
 +
 +TEST(CelixBundleContextBundlesTests, bundleInfoTests) {
 +    struct data {
 +        int provideCount{0};
 +        int requestedCount{0};
 +    };
 +    struct data data;
 +
 +    void (*updateCountFp)(void *, const celix_bundle_t*) = [](void *handle, const celix_bundle_t *bnd) {
 +        auto *data = static_cast<struct data*>(handle);
 +        auto *trackers = celix_bundle_listServiceTrackers(bnd);
 +        auto *services = celix_bundle_listRegisteredServices(bnd);
 +        data->requestedCount = celix_arrayList_size(trackers);
 +        data->provideCount = celix_arrayList_size(services);
 +        celix_bundle_destroyServiceTrackerList(trackers);
 +        celix_bundle_destroyRegisteredServicesList(services);
 +    };
 +
 +    bool called = celix_bundleContext_useBundle(ctx, 0, &data, updateCountFp);
 +    CHECK_TRUE(called);
 +    CHECK_EQUAL(0, data.provideCount);
 +    CHECK_EQUAL(0, data.requestedCount);
 +
 +
 +    long svcId = celix_bundleContext_registerService(ctx, (void*)0x42, "NopService", NULL);
 +    long trackerId = celix_bundleContext_trackServices(ctx, "AService", NULL, NULL, NULL);
 +
 +    called = celix_bundleContext_useBundle(ctx, 0, &data, updateCountFp);
 +    CHECK_TRUE(called);
 +    CHECK_EQUAL(1, data.provideCount);
 +    CHECK_EQUAL(1, data.requestedCount);
 +
 +    celix_bundleContext_unregisterService(ctx, svcId);
 +    celix_bundleContext_stopTracker(ctx, trackerId);
 +}