Package org.apache.sling.testing.paxexam
Class TestSupport
java.lang.Object
org.apache.sling.testing.paxexam.TestSupport
Test Support for OPS4J Pax Exam.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.osgi.service.cm.ConfigurationAdmin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.ops4j.pax.exam.options.ModifiableCompositeOption
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
Provides commons property and provisioning options for both default and server mode.static org.ops4j.pax.exam.options.SystemPropertyOption
Provides an option to set the System propertypax.exam.osgi.unresolved.fail
to"true"
.static int
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 propertyjacoco.command
is set.static org.ops4j.pax.exam.options.OptionalCompositeOption
Reads the System propertymaven.repo.local
and provides an option to set the System propertyorg.ops4j.pax.url.mvn.localRepository
when former is not empty.protected org.ops4j.pax.exam.options.ModifiableCompositeOption
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
Provides a random path for a working directory below Maven's build target directory.
-
Field Details
-
configurationAdmin
@Inject protected org.osgi.service.cm.ConfigurationAdmin configurationAdmin
-
-
Constructor Details
-
TestSupport
public TestSupport()
-
-
Method Details
-
workingDirectory
Provides a random path for a working directory below Maven's build target directory.- Returns:
- the absolute path for working directory
-
httpPort
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 propertyjacoco.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 propertypax.exam.osgi.unresolved.fail
to"true"
.- Returns:
- the property option
-
localMavenRepo
public static org.ops4j.pax.exam.options.OptionalCompositeOption localMavenRepo()Reads the System propertymaven.repo.local
and provides an option to set the System propertyorg.ops4j.pax.url.mvn.localRepository
when former is not empty.- Returns:
- the property option
-
testBundle
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
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
-