You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2014/11/25 18:36:26 UTC

svn commit: r1641657 - /sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java

Author: bdelacretaz
Date: Tue Nov 25 17:36:25 2014
New Revision: 1641657

URL: http://svn.apache.org/r1641657
Log:
SLING-4101 - accept running outside of an OSGi environment, for example when combined with SlingRemoteExecutionRule. Patch contributed by Rob Ryan, thanks!

Modified:
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java

Modified: sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java?rev=1641657&r1=1641656&r2=1641657&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java (original)
+++ sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java Tue Nov 25 17:36:25 2014
@@ -40,7 +40,8 @@ public class SlingAnnotationsTestRunner 
     @Override
     protected Object createTest() throws Exception {
         final BundleContext ctx = Activator.getBundleContext();
-        final ServiceReference ref = ctx.getServiceReference(TestObjectProcessor.class.getName());
+        final ServiceReference ref =
+	    ctx == null ? null : ctx.getServiceReference(TestObjectProcessor.class.getName());
         final TestObjectProcessor top = ref == null ? null : (TestObjectProcessor)ctx.getService(ref);
 
         if(top == null) {