This is an automated email from the ASF dual-hosted git repository. pengzheng pushed a commit to branch feature/refactor_bundle_cache in repository https://gitbox.apache.org/repos/asf/celix.git
commit 3873c152a9a5da4a5684d6d04f4e1493c6aa32a2 Author: PengZheng <[email protected]> AuthorDate: Fri Mar 10 21:00:44 2023 +0800 Add test for tmp bundle cache. --- .../gtest/src/bundle_context_bundles_tests.cpp | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/libs/framework/gtest/src/bundle_context_bundles_tests.cpp b/libs/framework/gtest/src/bundle_context_bundles_tests.cpp index 35669628..07d24dc9 100644 --- a/libs/framework/gtest/src/bundle_context_bundles_tests.cpp +++ b/libs/framework/gtest/src/bundle_context_bundles_tests.cpp @@ -641,4 +641,35 @@ TEST_F(CelixBundleContextBundlesTests, testBundleStateToString) { result = celix_bundleState_getName((celix_bundle_state_e)444 /*invalid*/); EXPECT_STREQ(result, "UNKNOWN"); -} \ No newline at end of file +} + +class CelixBundleContextTempBundlesTests : public ::testing::Test { +public: + celix_framework_t* fw = nullptr; + celix_bundle_context_t *ctx = nullptr; + celix_properties_t *properties = nullptr; + + const char * const TEST_BND1_LOC = "" SIMPLE_TEST_BUNDLE1_LOCATION ""; + + CelixBundleContextTempBundlesTests() { + properties = celix_properties_create(); + celix_properties_setBool(properties, "LOGHELPER_ENABLE_STDOUT_FALLBACK", true); + celix_properties_setBool(properties, CELIX_FRAMEWORK_CACHE_USE_TMP_DIR, true); + fw = celix_frameworkFactory_createFramework(properties); + ctx = framework_getContext(fw); + } + + ~CelixBundleContextTempBundlesTests() override { + celix_frameworkFactory_destroyFramework(fw); + } + + CelixBundleContextTempBundlesTests(CelixBundleContextTempBundlesTests&&) = delete; + CelixBundleContextTempBundlesTests(const CelixBundleContextTempBundlesTests&) = delete; + CelixBundleContextTempBundlesTests& operator=(CelixBundleContextTempBundlesTests&&) = delete; + CelixBundleContextTempBundlesTests& operator=(const CelixBundleContextTempBundlesTests&) = delete; +}; + +TEST_F(CelixBundleContextTempBundlesTests, installABundleTest) { + long bndId = celix_bundleContext_installBundle(ctx, TEST_BND1_LOC, true); + ASSERT_TRUE(bndId >= 0); +}
