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

kwin pushed a commit to branch bugfix/SLING-10930
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git

commit 0a3de7c09cb451ad6ff20953b2ce9938b9a9506a
Author: Konrad Windszus <[email protected]>
AuthorDate: Fri Nov 19 09:06:12 2021 +0100

    SLING-10930 don't automatically call deactivate method
    
    This prevents double executions of deactivate() for DS component's
    registered for more than one service
---
 .../apache/sling/testing/mock/osgi/MockBundleContext.java  | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git 
a/core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java 
b/core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
index 3d4a2fc..8051ab8 100644
--- 
a/core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
+++ 
b/core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
@@ -22,7 +22,6 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -449,20 +448,11 @@ class MockBundleContext implements BundleContext {
     }
 
     /**
-     * Deactivates all bundles registered in this mocked bundle context.
+     * Cleans up the bundle's data file.
+     * It does not unregister the services which have been registered with 
this context!
      */
     @SuppressWarnings("null")
     public void shutdown() {
-        List<MockServiceRegistration> reversedRegisteredServices = new 
ArrayList<>(registeredServices);
-        Collections.reverse(reversedRegisteredServices);
-        for (MockServiceRegistration<?> serviceRegistration : 
reversedRegisteredServices) {
-            try {
-                MockOsgi.deactivate(serviceRegistration.getService(), this, 
serviceRegistration.getProperties());
-            }
-            catch (NoScrMetadataException ex) {
-                // ignore, no deactivate method is available then
-            }
-        }
         if (dataFileBaseDir != null) {
             try {
                 FileUtils.deleteDirectory(dataFileBaseDir);

Reply via email to