Stop libB and check for correct events
| 107 | |
| 108 | // Stop libB and check for correct events |
| 109 | void |
| 110 | frame030b(BundleContext context, TestBundleListener& listener) |
| 111 | { |
| 112 | auto bundleB = cppmicroservices::testing::GetBundle("TestBundleB", context); |
| 113 | // Test for non-null bundle |
| 114 | ASSERT_TRUE(bundleB); |
| 115 | |
| 116 | auto bundleImportedByB = cppmicroservices::testing::GetBundle("TestBundleImportedByB", context); |
| 117 | // Test for non-null bundle |
| 118 | ASSERT_TRUE(bundleImportedByB); |
| 119 | |
| 120 | std::vector<ServiceReferenceU> refs = context.GetServiceReferences("cppmicroservices::TestBundleBService"); |
| 121 | // Test for first valid service reference |
| 122 | ASSERT_TRUE(refs.front()); |
| 123 | // Test for second valid service reference |
| 124 | ASSERT_TRUE(refs.back()); |
| 125 | |
| 126 | EXPECT_NO_THROW(bundleB.Stop()) << "Stop bundle exception"; |
| 127 | // Test for stopped state |
| 128 | ASSERT_EQ(bundleB.GetState(), Bundle::STATE_RESOLVED); |
| 129 | |
| 130 | EXPECT_NO_THROW(bundleImportedByB.Stop()) << "Stop bundle exception"; |
| 131 | // Test for stopped state |
| 132 | ASSERT_EQ(bundleImportedByB.GetState(), Bundle::STATE_RESOLVED); |
| 133 | |
| 134 | std::vector<BundleEvent> pEvts; |
| 135 | pEvts.push_back(BundleEvent(BundleEvent::BUNDLE_STOPPING, bundleB)); |
| 136 | pEvts.push_back(BundleEvent(BundleEvent::BUNDLE_STOPPED, bundleB)); |
| 137 | pEvts.push_back(BundleEvent(BundleEvent::BUNDLE_STOPPING, bundleImportedByB)); |
| 138 | pEvts.push_back(BundleEvent(BundleEvent::BUNDLE_STOPPED, bundleImportedByB)); |
| 139 | |
| 140 | std::vector<ServiceEvent> seEvts; |
| 141 | seEvts.push_back(ServiceEvent(ServiceEvent::SERVICE_UNREGISTERING, refs.front())); |
| 142 | seEvts.push_back(ServiceEvent(ServiceEvent::SERVICE_UNREGISTERING, refs.back())); |
| 143 | |
| 144 | bool relaxed = false; |
| 145 | #ifndef US_BUILD_SHARED_LIBS |
| 146 | relaxed = true; |
| 147 | #endif |
| 148 | // Test for unexpected events |
| 149 | ASSERT_TRUE(listener.CheckListenerEvents(pEvts, seEvts, relaxed)); |
| 150 | } |
| 151 | |
| 152 | // Uninstall libB and check for correct events |
| 153 | #ifdef US_BUILD_SHARED_LIBS |
no test coverage detected