Class ConfigCollector
- java.lang.Object
-
- org.apache.sling.testing.mock.osgi.junit.ConfigCollector
-
- All Implemented Interfaces:
ConfigCollection,org.junit.rules.TestRule
public class ConfigCollector extends Object implements org.junit.rules.TestRule, ConfigCollection
ATestRulethat collects runtime-retained component property type annotations andConfigTypeannotations from the current test method and test class. This rule is also responsible for discoveringSetConfigannotations and installing them into the providedOsgiContextImpl's ConfigurationAdmin service.
-
-
Constructor Summary
Constructors Constructor Description ConfigCollector(@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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description)Stream<TypedConfig>stream()-
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 Detail
-
ConfigCollector
public ConfigCollector(@NotNull @NotNull OsgiContextImpl osgiContext)Create a new instance around the providedOsgiContextImpl.- Parameters:
osgiContext- an osgi context
-
ConfigCollector
public ConfigCollector(@NotNull @NotNull OsgiContextImpl osgiContext, @NotNull @NotNull String pid)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 collectedConfigTypeannotations.- Parameters:
osgiContext- an osgi contextcomponent- an optional component type as configuration pid to applypid- specify a non-empty configuration pid
-
-
Method Detail
-
stream
public Stream<TypedConfig> stream()
- Specified by:
streamin interfaceConfigCollection
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)- Specified by:
applyin interfaceorg.junit.rules.TestRule
-
-