Class ConfigCollector

  • All Implemented Interfaces:
    ConfigCollection, org.junit.rules.TestRule

    public class ConfigCollector
    extends Object
    implements org.junit.rules.TestRule, 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 Detail

      • ConfigCollector

        public ConfigCollector​(@NotNull
                               @NotNull OsgiContextImpl osgiContext)
        Create a new instance around the provided OsgiContextImpl.
        Parameters:
        osgiContext - an osgi context
      • ConfigCollector

        public ConfigCollector​(@NotNull
                               @NotNull 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 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 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 Detail

      • 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