Class ConfigCollector
java.lang.Object
org.apache.sling.testing.mock.osgi.junit.ConfigCollector
- All Implemented Interfaces:
ConfigCollection
,org.junit.rules.TestRule
A
TestRule
that collects runtime-retained component property type annotations and
ConfigType
annotations from the current test method and
test class. This rule is also responsible for discovering
SetConfig
annotations and installing them into the
provided OsgiContextImpl
's ConfigurationAdmin service.-
Constructor Summary
ConstructorsConstructorDescriptionConfigCollector
(@NotNull OsgiContextImpl osgiContext) Create a new instance around the providedOsgiContextImpl
.ConfigCollector
(@NotNull OsgiContextImpl osgiContext, @NotNull Class component) Create a new instance around the providedOsgiContextImpl
.ConfigCollector
(@NotNull OsgiContextImpl osgiContext, @NotNull String pid) Create a new instance around the providedOsgiContextImpl
.ConfigCollector
(@NotNull OsgiContextImpl osgiContext, @Nullable Class component, @Nullable String pid) Create a new instance around the providedOsgiContextImpl
. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.sling.testing.mock.osgi.config.annotations.ConfigCollection
configStream, firstConfig, firstConfigMap, stream
-
Constructor Details
-
ConfigCollector
Create a new instance around the providedOsgiContextImpl
.- Parameters:
osgiContext
- an osgi context
-
ConfigCollector
Create a new instance around the providedOsgiContextImpl
.- Parameters:
osgiContext
- an osgi contextpid
- the configuration pid to apply
-
ConfigCollector
public ConfigCollector(@NotNull @NotNull OsgiContextImpl osgiContext, @NotNull @NotNull Class component) Create a new instance around the providedOsgiContextImpl
.- Parameters:
osgiContext
- an osgi contextcomponent
- the component type to use as a configuration pid to apply
-
ConfigCollector
public ConfigCollector(@NotNull @NotNull OsgiContextImpl osgiContext, @Nullable @Nullable Class component, @Nullable @Nullable String pid) Create a new instance around the providedOsgiContextImpl
. Specify a non-null applyPid value to override theConfigType.pid()
attributes of any collectedConfigType
annotations.- Parameters:
osgiContext
- an osgi contextcomponent
- an optional component type as configuration pid to applypid
- specify a non-empty configuration pid
-
-
Method Details
-
stream
- Specified by:
stream
in interfaceConfigCollection
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
-