Class MockContextAwareConfig


  • @ProviderType
    public final class MockContextAwareConfig
    extends Object
    Helps setting up a mock environment for Context-Aware Configuration.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void registerAnnotationClasses​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull Class @NotNull ... classes)
      Search classpath for given class names to scan for and register all classes with @Configuration annotation.
      static void registerAnnotationClasses​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull String @NotNull ... classNames)
      Search classpath for given class names to scan for and register all classes with @Configuration annotation.
      static void registerAnnotationPackages​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull String @NotNull ... packageNames)
      Search classpath for given class names to scan for and register all classes with @Configuration annotation.
      static void writeConfiguration​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull String contextPath, @NotNull Class<?> configClass, @NotNull Map<String,​Object> values)
      Writes configuration parameters using the primary configured persistence provider.
      static void writeConfiguration​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull String contextPath, @NotNull String configName, @NotNull Object @NotNull ... values)
      Writes configuration parameters using the primary configured persistence provider.
      static void writeConfiguration​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull String contextPath, @NotNull String configName, @NotNull Map<String,​Object> values)
      Writes configuration parameters using the primary configured persistence provider.
      static void writeConfiguration​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull String contextPath, Class<?> configClass, @NotNull Object @NotNull ... values)
      Writes configuration parameters using the primary configured persistence provider.
      static void writeConfigurationCollection​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull String contextPath, @NotNull Class<?> configClass, @NotNull Collection<@NotNull Map<String,​Object>> values)
      Writes a collection of configuration parameters using the primary configured persistence provider.
      static void writeConfigurationCollection​(@NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context, @NotNull String contextPath, @NotNull String configName, @NotNull Collection<@NotNull Map<String,​Object>> values)
      Writes a collection of configuration parameters using the primary configured persistence provider.
    • Method Detail

      • registerAnnotationClasses

        public static void registerAnnotationClasses​(@NotNull
                                                     @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                                     @NotNull
                                                     @NotNull String @NotNull ... classNames)
        Search classpath for given class names to scan for and register all classes with @Configuration annotation.
        Parameters:
        context - Sling context
        classNames - Java class names
      • registerAnnotationClasses

        public static void registerAnnotationClasses​(@NotNull
                                                     @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                                     @NotNull
                                                     @NotNull Class @NotNull ... classes)
        Search classpath for given class names to scan for and register all classes with @Configuration annotation.
        Parameters:
        context - Sling context
        classes - Java classes
      • registerAnnotationPackages

        public static void registerAnnotationPackages​(@NotNull
                                                      @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                                      @NotNull
                                                      @NotNull String @NotNull ... packageNames)
        Search classpath for given class names to scan for and register all classes with @Configuration annotation.
        Parameters:
        context - Sling context
        packageNames - Java package names
      • writeConfiguration

        public static void writeConfiguration​(@NotNull
                                              @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                              @NotNull
                                              @NotNull String contextPath,
                                              @NotNull
                                              @NotNull Class<?> configClass,
                                              @NotNull
                                              @NotNull Map<String,​Object> values)
        Writes configuration parameters using the primary configured persistence provider.
        Parameters:
        context - Sling context
        contextPath - Context path
        configClass - Configuration class
        values - Configuration values
      • writeConfiguration

        public static void writeConfiguration​(@NotNull
                                              @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                              @NotNull
                                              @NotNull String contextPath,
                                              @NotNull
                                              @NotNull String configName,
                                              @NotNull
                                              @NotNull Map<String,​Object> values)
        Writes configuration parameters using the primary configured persistence provider.
        Parameters:
        context - Sling context
        contextPath - Context path
        configName - Config name
        values - Configuration values
      • writeConfiguration

        public static void writeConfiguration​(@NotNull
                                              @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                              @NotNull
                                              @NotNull String contextPath,
                                              Class<?> configClass,
                                              @NotNull
                                              @NotNull Object @NotNull ... values)
        Writes configuration parameters using the primary configured persistence provider.
        Parameters:
        context - Sling context
        contextPath - Context path
        configClass - Configuration class
        values - Configuration values
      • writeConfiguration

        public static void writeConfiguration​(@NotNull
                                              @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                              @NotNull
                                              @NotNull String contextPath,
                                              @NotNull
                                              @NotNull String configName,
                                              @NotNull
                                              @NotNull Object @NotNull ... values)
        Writes configuration parameters using the primary configured persistence provider.
        Parameters:
        context - Sling context
        contextPath - Context path
        configName - Config name
        values - Configuration values
      • writeConfigurationCollection

        public static void writeConfigurationCollection​(@NotNull
                                                        @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                                        @NotNull
                                                        @NotNull String contextPath,
                                                        @NotNull
                                                        @NotNull Class<?> configClass,
                                                        @NotNull
                                                        @NotNull Collection<@NotNull Map<String,​Object>> values)
        Writes a collection of configuration parameters using the primary configured persistence provider.
        Parameters:
        context - Sling context
        contextPath - Context path
        configClass - Configuration class
        values - Configuration values
      • writeConfigurationCollection

        public static void writeConfigurationCollection​(@NotNull
                                                        @NotNull org.apache.sling.testing.mock.sling.context.SlingContextImpl context,
                                                        @NotNull
                                                        @NotNull String contextPath,
                                                        @NotNull
                                                        @NotNull String configName,
                                                        @NotNull
                                                        @NotNull Collection<@NotNull Map<String,​Object>> values)
        Writes a collection of configuration parameters using the primary configured persistence provider.
        Parameters:
        context - Sling context
        contextPath - Context path
        configName - Config name
        values - Configuration values