sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1769151 - /sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java
Date Thu, 10 Nov 2016 16:30:58 GMT
Author: rombert
Date: Thu Nov 10 16:30:58 2016
New Revision: 1769151

URL: http://svn.apache.org/viewvc?rev=1769151&view=rev
Log:
DynamicClassLoaderIT: cleanup

Modified:
    sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java

Modified: sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java?rev=1769151&r1=1769150&r2=1769151&view=diff
==============================================================================
--- sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java
(original)
+++ sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java
Thu Nov 10 16:30:58 2016
@@ -59,16 +59,16 @@ public class DynamicClassLoaderIT {
 
     protected ClassLoader dynamicClassLoader;
 
-    protected ServiceReference classLoaderManagerReference;
+    protected ServiceReference<DynamicClassLoaderManager> classLoaderManagerReference;
 
     /**
      * Helper method to get a service of the given type
      */
-    @SuppressWarnings("unchecked")
 	protected <T> T getService(Class<T> clazz) {
-    	final ServiceReference ref = bundleContext.getServiceReference(clazz.getName());
+        
+    	final ServiceReference<T> ref = bundleContext.getServiceReference(clazz);
     	assertNotNull("getService(" + clazz.getName() + ") must find ServiceReference", ref);
-    	final T result = (T)(bundleContext.getService(ref));
+    	final T result = bundleContext.getService(ref);
     	assertNotNull("getService(" + clazz.getName() + ") must find service", result);
     	return result;
     }
@@ -76,10 +76,10 @@ public class DynamicClassLoaderIT {
     protected ClassLoader getDynamicClassLoader() {
         if ( classLoaderManagerReference == null || classLoaderManagerReference.getBundle()
== null ) {
             dynamicClassLoader = null;
-            classLoaderManagerReference = bundleContext.getServiceReference(DynamicClassLoaderManager.class.getName());
+            classLoaderManagerReference = bundleContext.getServiceReference(DynamicClassLoaderManager.class);
         }
         if ( dynamicClassLoader == null && classLoaderManagerReference != null )
{
-            final DynamicClassLoaderManager dclm = (DynamicClassLoaderManager) bundleContext.getService(classLoaderManagerReference);
+            final DynamicClassLoaderManager dclm = bundleContext.getService(classLoaderManagerReference);
             if ( dclm != null ) {
                 dynamicClassLoader = dclm.getDynamicClassLoader();
             }



Mime
View raw message