org.apache.sling.junit.impl
Class BundleTestsProvider

java.lang.Object
  extended by org.apache.sling.junit.impl.BundleTestsProvider
All Implemented Interfaces:
java.util.EventListener, TestsProvider, org.osgi.framework.BundleListener

@Service
public class BundleTestsProvider
extends java.lang.Object
implements TestsProvider, org.osgi.framework.BundleListener

A TestProvider that gets test classes from bundles that have a Sling-Test-Regexp header and corresponding exported classes.


Field Summary
static java.lang.String SLING_TEST_REGEXP
           
 
Constructor Summary
BundleTestsProvider()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext ctx)
           
 void bundleChanged(org.osgi.framework.BundleEvent event)
          Called when a bundle changes state
 java.lang.Class<?> createTestClass(java.lang.String testName)
          Create a test class to execute the specified test.
protected  void deactivate(org.osgi.service.component.ComponentContext ctx)
           
 java.lang.String getServicePid()
          Return this service's PID, client might use it later to instantiate a specific test.
 java.util.List<java.lang.String> getTestNames()
          Return the list of available tests
 long lastModified()
          Return the timestamp at which our list of tests was last modified
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SLING_TEST_REGEXP

public static final java.lang.String SLING_TEST_REGEXP
See Also:
Constant Field Values
Constructor Detail

BundleTestsProvider

public BundleTestsProvider()
Method Detail

activate

protected void activate(org.osgi.service.component.ComponentContext ctx)

deactivate

protected void deactivate(org.osgi.service.component.ComponentContext ctx)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

bundleChanged

public void bundleChanged(org.osgi.framework.BundleEvent event)
Called when a bundle changes state

Specified by:
bundleChanged in interface org.osgi.framework.BundleListener

createTestClass

public java.lang.Class<?> createTestClass(java.lang.String testName)
                                   throws java.lang.ClassNotFoundException
Description copied from interface: TestsProvider
Create a test class to execute the specified test. The test executes in the same thread that calls this method, to allow using ThreadLocals to pass context to the test if needed.

Specified by:
createTestClass in interface TestsProvider
Throws:
java.lang.ClassNotFoundException

lastModified

public long lastModified()
Description copied from interface: TestsProvider
Return the timestamp at which our list of tests was last modified

Specified by:
lastModified in interface TestsProvider

getServicePid

public java.lang.String getServicePid()
Description copied from interface: TestsProvider
Return this service's PID, client might use it later to instantiate a specific test.

Specified by:
getServicePid in interface TestsProvider

getTestNames

public java.util.List<java.lang.String> getTestNames()
Description copied from interface: TestsProvider
Return the list of available tests

Specified by:
getTestNames in interface TestsProvider


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.