Package org.apache.sling.testing.mock.osgi.junit

# Class ConfigCollector

java.lang.Object
org.apache.sling.testing.mock.osgi.junit.ConfigCollector

All Implemented Interfaces:
  `org.apache.sling.testing.mock.osgi.config.annotations.ConfigCollection`, `org.junit.rules.TestRule`

public class ConfigCollector extends Object implements org.junit.rules.TestRule, org.apache.sling.testing.mock.osgi.config.annotations.ConfigCollection
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

Constructors
Constructor
Description
`ConfigCollector(@NotNull org.apache.sling.testing.mock.osgi.context.OsgiContextImpl osgiContext)`
Create a new instance around the provided `OsgiContextImpl`.
`ConfigCollector(@NotNull org.apache.sling.testing.mock.osgi.context.OsgiContextImpl osgiContext, @NotNull Class component)`
Create a new instance around the provided `OsgiContextImpl`.
`ConfigCollector(@NotNull org.apache.sling.testing.mock.osgi.context.OsgiContextImpl osgiContext, @NotNull String pid)`
Create a new instance around the provided `OsgiContextImpl`.
`ConfigCollector(@NotNull org.apache.sling.testing.mock.osgi.context.OsgiContextImpl osgiContext, @Nullable Class component, @Nullable String pid)`
Create a new instance around the provided `OsgiContextImpl`.

## Method Summary

Modifier and Type
Method
Description
`org.junit.runners.model.Statement`
`apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)`
`Stream<org.apache.sling.testing.mock.osgi.config.annotations.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 Details

### ConfigCollector

public ConfigCollector(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.OsgiContextImpl osgiContext)
Create a new instance around the provided `OsgiContextImpl`.

Parameters:
  `osgiContext` - an osgi context

### ConfigCollector

public ConfigCollector(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.OsgiContextImpl osgiContext, @NotNull @NotNull String pid)
Create a new instance around the provided `OsgiContextImpl`.

Parameters:
  `osgiContext` - an osgi context
  `pid` - the configuration pid to apply

### ConfigCollector

public ConfigCollector(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.OsgiContextImpl osgiContext, @NotNull @NotNull Class component)
Create a new instance around the provided `OsgiContextImpl`.

Parameters:
  `osgiContext` - an osgi context
  `component` - the component type to use as a configuration pid to apply

### ConfigCollector

public ConfigCollector(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.OsgiContextImpl osgiContext, @Nullable @Nullable Class component, @Nullable @Nullable String pid)
Create a new instance around the provided `OsgiContextImpl`. Specify a non-null applyPid value to override the `ConfigType.pid()` attributes of any collected `ConfigType` annotations.

Parameters:
  `osgiContext` - an osgi context
  `component` - an optional component type as configuration pid to apply
  `pid` - specify a non-empty configuration pid

## Method Details

### stream

public Stream<org.apache.sling.testing.mock.osgi.config.annotations.TypedConfig> stream()

Specified by:
  `stream` in interface `org.apache.sling.testing.mock.osgi.config.annotations.ConfigCollection`

### apply

public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)

Specified by:
  `apply` in interface `org.junit.rules.TestRule`