Author: bdelacretaz
Date: Thu Sep 17 13:45:48 2015
New Revision: 1703622
URL: http://svn.apache.org/r1703622
Log:
SLING-5037 - do nothing if no bundle context present
Modified:
sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/Service.java
Modified:
sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/Service.java
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/Service.java?rev=1703622&r1=1703621&r2=1703622&view=diff
==============================================================================
---
sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/Service.java
(original)
+++
sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/Service.java
Thu Sep 17 13:45:48 2015
@@ -46,7 +46,11 @@ public class Service implements TestRule
final BundleContext bundleContext =
Activator.getBundleContext();
if (bundleContext == null) {
- throw new IllegalStateException("unable to obtain a bundle
context");
+ // No bundle context usually means we're running
client-side
+ // in a test that uses ServerSideTestRule. In this case,
this
+ // rule does nothing.
+ base.evaluate();
+ return;
}
final ServiceReference serviceReference =
bundleContext.getServiceReference(serviceClass.getName());