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 2015/09/22 10:14:04 UTC

svn commit: r1704474 - in /sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit: annotations/SlingAnnotationsTestRunner.java annotations/TestReference.java rules/OSGiService.java rules/Service.java

Author: bdelacretaz
Date: Tue Sep 22 08:14:02 2015
New Revision: 1704474

URL: http://svn.apache.org/viewvc?rev=1704474&view=rev
Log:
SLING-5040 - deprecate a few things in favor of the TeleporterRule

Modified:
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/TestReference.java
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/OSGiService.java
    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/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=1704474&r1=1704473&r2=1704474&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 Sep 22 08:14:02 2015
@@ -29,7 +29,11 @@ import org.slf4j.LoggerFactory;
  *  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);
 

Modified: sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/TestReference.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/TestReference.java?rev=1704474&r1=1704473&r2=1704474&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/TestReference.java (original)
+++ sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/annotations/TestReference.java Tue Sep 22 08:14:02 2015
@@ -24,10 +24,14 @@ import java.lang.annotation.Target;
 
 /** 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.

Modified: sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/OSGiService.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/OSGiService.java?rev=1704474&r1=1704473&r2=1704474&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/OSGiService.java (original)
+++ sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/rules/OSGiService.java Tue Sep 22 08:14:02 2015
@@ -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;

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=1704474&r1=1704473&r2=1704474&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 Tue Sep 22 08:14:02 2015
@@ -27,8 +27,9 @@ import org.osgi.framework.BundleContext;
  * 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;