in core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java [472:498]
public void shutdown() {
log.debug("Shutting down MockBundleContext, bundleContext={}", this);
List<MockServiceRegistration> reversedRegisteredServices = new ArrayList<>(registeredServices);
Collections.reverse(reversedRegisteredServices);
Set<Object> deactivatedComponents = new HashSet<>();
for (MockServiceRegistration<?> serviceRegistration : reversedRegisteredServices) {
Object componentInstance = serviceRegistration.getService();
if (deactivatedComponents.contains(componentInstance)) {
continue;
}
try {
MockOsgi.deactivate(componentInstance, this, serviceRegistration.getProperties());
}
catch (NoScrMetadataException ex) {
// ignore, no deactivate method is available then
}
deactivatedComponents.add(componentInstance);
}
if (dataFileBaseDir != null) {
try {
FileUtils.deleteDirectory(dataFileBaseDir);
} catch (IOException e) {
// ignore
}
}
}