Package org.apache.sling.testing.paxexam

# Class TestSupport

java.lang.Object
org.apache.sling.testing.paxexam.TestSupport

public abstract class TestSupport extends Object
Test Support for OPS4J Pax Exam.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected org.osgi.service.cm.ConfigurationAdmin`
`configurationAdmin`

## Constructor Summary

Constructors
Constructor
Description
`TestSupport()`

## Method Summary

Modifier and Type
Method
Description
`protected org.ops4j.pax.exam.options.ModifiableCompositeOption`
`baseConfiguration()`
Provides base property and provisioning options for default mode.
`static org.ops4j.pax.exam.options.UrlProvisionOption`
`buildBundleWithBnd(Class... classes)`
Builds an OSGi bundle with bnd from given classes and provides it as provisioning option.
`protected org.ops4j.pax.exam.options.ModifiableCompositeOption`
`commonConfiguration()`
Provides commons property and provisioning options for both default and server mode.
`static org.ops4j.pax.exam.options.SystemPropertyOption`
`failOnUnresolvedBundles()`
Provides an option to set the System property `pax.exam.osgi.unresolved.fail` to `"true"`.
`static int`
`findFreePort()`
Finds a free local port.
`protected int`
`httpPort()`
Provides Felix HTTP Service's HTTP port (`org.osgi.service.http.port`).
`protected org.ops4j.pax.exam.options.OptionalCompositeOption`
`jacoco()`
Provides the Jacoco VM option when System property `jacoco.command` is set.
`static org.ops4j.pax.exam.options.OptionalCompositeOption`
`localMavenRepo()`
Reads the System property `maven.repo.local` and provides an option to set the System property `org.ops4j.pax.url.mvn.localRepository` when former is not empty.
`protected org.ops4j.pax.exam.options.ModifiableCompositeOption`
`serverBaseConfiguration()`
Provides base property and provisioning options for server mode.
`static org.ops4j.pax.exam.options.UrlProvisionOption`
`testBundle(String systemProperty)`
Reads the pathname of the test bundle from the given System property and provides a provisioning option.
`protected String`
`workingDirectory()`
Provides a random path for a working directory below Maven's build target directory.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### configurationAdmin

@Inject protected org.osgi.service.cm.ConfigurationAdmin configurationAdmin

## Constructor Details

### TestSupport

public TestSupport()

## Method Details

### workingDirectory

protected String workingDirectory()
Provides a random path for a working directory below Maven's build target directory.

Returns:
  the absolute path for working directory

### httpPort

protected int httpPort() throws IOException
Provides Felix HTTP Service's HTTP port (`org.osgi.service.http.port`).

Returns:
  the HTTP port
Throws:
  `IOException` - if reading OSGi configuration fails

### jacoco

protected org.ops4j.pax.exam.options.OptionalCompositeOption jacoco()
Provides the Jacoco VM option when System property `jacoco.command` is set.

Returns:
  the property option

### commonConfiguration

protected org.ops4j.pax.exam.options.ModifiableCompositeOption commonConfiguration()
Provides commons property and provisioning options for both default and server mode.

Returns:
  the composite option

### baseConfiguration

protected org.ops4j.pax.exam.options.ModifiableCompositeOption baseConfiguration()
Provides base property and provisioning options for default mode.

Returns:
  the composite option

### serverBaseConfiguration

protected org.ops4j.pax.exam.options.ModifiableCompositeOption serverBaseConfiguration()
Provides base property and provisioning options for server mode.

Returns:
  the composite option

### findFreePort

public static int findFreePort()
Finds a free local port.

Returns:
  the free local port

### failOnUnresolvedBundles

public static org.ops4j.pax.exam.options.SystemPropertyOption failOnUnresolvedBundles()
Provides an option to set the System property `pax.exam.osgi.unresolved.fail` to `"true"`.

Returns:
  the property option

### localMavenRepo

public static org.ops4j.pax.exam.options.OptionalCompositeOption localMavenRepo()
Reads the System property `maven.repo.local` and provides an option to set the System property `org.ops4j.pax.url.mvn.localRepository` when former is not empty.

Returns:
  the property option

### testBundle

public static org.ops4j.pax.exam.options.UrlProvisionOption testBundle(String systemProperty)
Reads the pathname of the test bundle from the given System property and provides a provisioning option.

Parameters:
  `systemProperty` - the System property which contains the pathname of the test bundle
Returns:
  the provisioning option

### buildBundleWithBnd

public static org.ops4j.pax.exam.options.UrlProvisionOption buildBundleWithBnd(Class... classes)
Builds an OSGi bundle with bnd from given classes and provides it as provisioning option.

Parameters:
  `classes` - the classes to include in the OSGi bundle
Returns:
  the provisioning option