Skip to content

Commit

Permalink
SLING-5040 - deprecate a few things in favor of the TeleporterRule
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1704474 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
bdelacretaz committed Sep 22, 2015
1 parent 43668eb commit c7f98b1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
* handle annotations in test classes.
* A test that has RunWith=SlingAnnotationsTestRunner can
* use @TestReference, for example, to access OSGi services.
*
* @deprecated - the {#link TeleporterRule} is a much simpler way of executing
* server-side tests, including OSGi service injection.
*/
@Deprecated
public class SlingAnnotationsTestRunner extends BlockJUnit4ClassRunner {
private static final Logger log = LoggerFactory.getLogger(SlingAnnotationsTestRunner.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@

/** Annotation used to inject services in test classes. Similar
* to the Felix @Reference annotation, but we need RetentionPolicy.RUNTIME
* so we cannot use that one.
* so we cannot use that one.
*
* @deprecated - the {#link TeleporterRule} is a much simpler way of executing
* server-side tests, including OSGi service injection.
*/
@Target( { ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Deprecated
public @interface TestReference {
/**
* The local name of the reference.
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/apache/sling/junit/rules/OSGiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
*/
package org.apache.sling.junit.rules;

/** Improved variant of the Service class that uses generics */
/** Improved variant of the Service class that uses generics.
*
* The {#link TeleporterRule} also provides access to OSGi
* services for server-side tests, in a more integrated way.
*/
public class OSGiService <T> extends Service {

private final Class<T> clazz;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/apache/sling/junit/rules/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
* Allows a test class to obtain a reference to an OSGi service. This rule embodies the logic to get a bundle context,
* obtain a service reference, fetch the reference to the object and perform the proper cleanup after the test has run.
*
* The newer OSGiService class uses generics and is more convenient to use.
*/
* The {#link TeleporterRule} also provides access to OSGi
* services for server-side tests, in a more integrated way.
*/
public class Service implements TestRule {

private final Class<?> serviceClass;
Expand Down

0 comments on commit c7f98b1

Please sign in to comment.