in core/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java [56:74]
public MockServiceRegistration(final Bundle bundle, final String[] clazzes, final T service,
final Dictionary<String, Object> properties, MockBundleContext bundleContext) {
this.serviceId = SERVICE_ID_COUNTER.incrementAndGet();
this.clazzes = new HashSet<String>(Arrays.asList(clazzes));
if (service instanceof ServiceFactory) {
this.service = ((ServiceFactory<T>)service).getService(bundleContext.getBundle(), this);
}
else {
this.service = service;
}
readOsgiMetadata();
this.properties = new Hashtable<>();
this.updateProperties(properties);
this.serviceReference = new MockServiceReference<T>(bundle, this);
this.bundleContext = bundleContext;
}