+ return AbstractConfigTest.this.mockedServiceRegistration;
+ }
+
+ public void invokeServiceHandler(final Object serviceInstance, final String className,
+ final Dictionary<String, ?> props) {
+ try {
+ final Class<?> serviceType = Class.forName(className);
+ invokeServiceHandler(serviceInstance, serviceType, props);
+ } catch (final ClassNotFoundException e) {
+ throw new IllegalStateException("Not handling service registration of type " + className, e);
+ }
+ }
+
+ private void invokeServiceHandler(final Object serviceInstance, final Class<?> serviceType,
+ final Dictionary<String, ?> props) {
+ final BundleContextServiceRegistrationHandler serviceRegistrationHandler =
+ getBundleContextServiceRegistrationHandler(serviceType);
+
+ if (serviceRegistrationHandler != null) {
+ serviceRegistrationHandler.handleServiceRegistration(serviceType, serviceInstance, props);
+ }
+ }
+ }
+
+ /**
+ * Expand inner exception wrapped by JMX.
+ *
+ * @param innerObject
+ * jmx proxy which will be wrapped and returned
+ */
+ protected <T> T rethrowCause(final T innerObject) {
+ @SuppressWarnings({ "unchecked", "checkstyle:avoidHidingCauseException" })
+ final T proxy = (T) Proxy.newProxyInstance(innerObject.getClass().getClassLoader(),
+ innerObject.getClass().getInterfaces(), (proxy1, method, args) -> {
+ try {
+ return method.invoke(innerObject, args);
+ } catch (final InvocationTargetException e) {