This is an automated email from the ASF dual-hosted git repository.
pengzheng pushed a commit to branch feature/correct_uninstall_semantics
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to
refs/heads/feature/correct_uninstall_semantics by this push:
new b1ab9caf Add test for bundle uninstall.
b1ab9caf is described below
commit b1ab9caffcaa3a56bb5bd8a4adade089447081e8
Author: PengZheng <[email protected]>
AuthorDate: Sat May 13 11:47:02 2023 +0800
Add test for bundle uninstall.
---
.../src/CelixBundleContextBundlesTestSuite.cc | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/libs/framework/gtest/src/CelixBundleContextBundlesTestSuite.cc
b/libs/framework/gtest/src/CelixBundleContextBundlesTestSuite.cc
index 1fa35982..2d8ae49c 100644
--- a/libs/framework/gtest/src/CelixBundleContextBundlesTestSuite.cc
+++ b/libs/framework/gtest/src/CelixBundleContextBundlesTestSuite.cc
@@ -28,6 +28,7 @@
#include <celix_log_utils.h>
#include "celix_api.h"
+#include "celix_file_utils.h"
class CelixBundleContextBundlesTestSuite : public ::testing::Test {
public:
@@ -152,6 +153,29 @@ TEST_F(CelixBundleContextBundlesTestSuite,
InstallAndUninstallBundlesTest) {
ASSERT_FALSE(celix_bundleContext_isBundleActive(ctx, bndId2)); //not auto
started
ASSERT_TRUE(celix_bundleContext_isBundleActive(ctx, bndId3));
+ char *bndRoot1 = nullptr;
+ ASSERT_TRUE(celix_bundleContext_useBundle(ctx, bndId1, &bndRoot1, [](void*
handle, const celix_bundle_t* bnd) {
+ char **root = static_cast<char **>(handle);
+ *root = celix_bundle_getEntry(bnd, "/");
+ }));
+ ASSERT_TRUE(bndRoot1 != nullptr);
+ char* bndRoot2 = nullptr;
+ ASSERT_TRUE(celix_bundleContext_useBundle(ctx, bndId2, &bndRoot2, [](void*
handle, const celix_bundle_t* bnd) {
+ char **root = static_cast<char **>(handle);
+ *root = celix_bundle_getEntry(bnd, "/");
+ }));
+ ASSERT_TRUE(bndRoot2 != nullptr);
+ char* bndRoot3 = nullptr;
+ ASSERT_TRUE(celix_bundleContext_useBundle(ctx, bndId3, &bndRoot3, [](void*
handle, const celix_bundle_t* bnd) {
+ char **root = static_cast<char **>(handle);
+ *root = celix_bundle_getEntry(bnd, "/");
+ }));
+ ASSERT_TRUE(bndRoot3 != nullptr);
+
+ ASSERT_TRUE(celix_utils_directoryExists(bndRoot1));
+ ASSERT_TRUE(celix_utils_directoryExists(bndRoot2));
+ ASSERT_TRUE(celix_utils_directoryExists(bndRoot3));
+
//uninstall bundles
ASSERT_TRUE(celix_bundleContext_uninstallBundle(ctx, bndId1));
ASSERT_TRUE(celix_bundleContext_uninstallBundle(ctx, bndId2));
@@ -165,6 +189,14 @@ TEST_F(CelixBundleContextBundlesTestSuite,
InstallAndUninstallBundlesTest) {
ASSERT_FALSE(celix_bundleContext_isBundleActive(ctx, bndId2));
ASSERT_FALSE(celix_bundleContext_isBundleActive(ctx, bndId3));
+ ASSERT_FALSE(celix_utils_directoryExists(bndRoot1));
+ ASSERT_FALSE(celix_utils_directoryExists(bndRoot2));
+ ASSERT_FALSE(celix_utils_directoryExists(bndRoot3));
+
+ free(bndRoot1);
+ free(bndRoot2);
+ free(bndRoot3);
+
//reinstall bundles
long bndId4 = celix_bundleContext_installBundle(ctx, TEST_BND1_LOC, true);
long bndId5 = celix_bundleContext_installBundle(ctx, TEST_BND2_LOC, false);