This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-impl.git


The following commit(s) were added to refs/heads/master by this push:
     new e0a428c  SLING-13117 Include Integration Tests (#17)
e0a428c is described below

commit e0a428c34e2e3b55dee1e1e3ccca69ea11234e82
Author: Stefan Seifert <[email protected]>
AuthorDate: Mon Feb 16 13:52:04 2026 +0100

    SLING-13117 Include Integration Tests (#17)
---
 .gitignore                                         |   1 -
 pom.xml                                            | 283 ++++++++++++++++++++-
 src/test/it-features/it-launcher-repoinit.txt      |  23 ++
 src/test/it-features/it-launcher.json              |  38 +++
 .../sling/caconfig/it/GenerateTestBundle.java      |  96 +++++++
 .../it/testbundle/example/SimpleConfig.java        |  33 +++
 .../caconfig/it/testing/AdaptToConfigClassIT.java  | 100 ++++++++
 .../it/testing/ConfigurationManagerIT.java         | 170 +++++++++++++
 .../testing/ConfigurationMetadataProviderIT.java   |  44 ++++
 .../ConfigurationResolverConfigClassIT.java        | 103 ++++++++
 .../testing/ConfigurationResolverValueMapIT.java   | 101 ++++++++
 .../sling/caconfig/it/testing/TestUtils.java       |  65 +++++
 .../junit/teleporter/customizers/ITCustomizer.java |  57 +++++
 13 files changed, 1099 insertions(+), 15 deletions(-)

diff --git a/.gitignore b/.gitignore
index 12746f7..5b783ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,4 +15,3 @@ maven-eclipse.xml
 .DS_Store
 jcr.log
 atlassian-ide-plugin.xml
-dependency-reduced-pom.xml
diff --git a/pom.xml b/pom.xml
index 80499a7..1d8ae04 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,8 +41,15 @@
     </scm>
 
     <properties>
-        <sling.java.version>11</sling.java.version>
         
<project.build.outputTimestamp>2025-03-12T12:14:50Z</project.build.outputTimestamp>
+        <sling.java.version>11</sling.java.version>
+        <caconfig.api.version>1.2.0</caconfig.api.version>
+        <caconfig.spi.version>1.4.0</caconfig.spi.version>
+        <!-- integration tests -->
+        <sling.starter.version>14-SNAPSHOT</sling.starter.version>
+        <starter.min.bundles.count>200</starter.min.bundles.count>
+        <it.startTimeoutSeconds>60</it.startTimeoutSeconds>
+        <it.caconfig.log.level>debug</it.caconfig.log.level>
     </properties>
 
     <dependencies>
@@ -70,13 +77,13 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.caconfig.api</artifactId>
-            <version>1.2.0</version>
+            <version>${caconfig.api.version}</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.caconfig.spi</artifactId>
-            <version>1.4.0</version>
+            <version>${caconfig.spi.version}</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
@@ -208,36 +215,284 @@
             <scope>test</scope>
         </dependency>
 
+        <!-- Integration test dependencies -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.junit.core</artifactId>
+            <version>1.2.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.rules</artifactId>
+            <version>2.0.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.clients</artifactId>
+            <version>3.1.0</version>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>javax.servlet</groupId>
+                    <artifactId>servlet-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.junit.teleporter</artifactId>
+            <version>1.1.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.github.classgraph</groupId>
+            <artifactId>classgraph</artifactId>
+            <version>4.8.184</version>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
     <build>
         <plugins>
+            <!-- Generate IT Test Bundle on the fly via TinyBundles -->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>3.6.3</version>
+                <executions>
+                    <execution>
+                        <id>generate-it-testbundle</id>
+                        <goals>
+                            <goal>java</goal>
+                        </goals>
+                        <phase>prepare-package</phase>
+                        <configuration>
+                            <classpathScope>test</classpathScope>
+                            
<mainClass>org.apache.sling.caconfig.it.GenerateTestBundle</mainClass>
+                            <arguments>
+                                
<argument>${project.build.directory}/it-testbundle.jar</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>reserve-network-port</id>
+                        <goals>
+                            <goal>reserve-network-port</goal>
+                        </goals>
+                        <phase>initialize</phase>
+                        <configuration>
+                            <portNames>
+                                <portName>http.port</portName>
+                                <portName>jacoco.port</portName>
+                            </portNames>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>attach-it-testbundle</id>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    
<file>${project.build.directory}/it-testbundle.jar</file>
+                                    <type>jar</type>
+                                    <classifier>it-testbundle</classifier>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <executions>
+                    <!--
+                    Record integration test code coverage via jacoco, using 
TCP server
+                    We cannot rely on the default file-based approach as the 
sling JVM is stopped forcefully, preventing proper file write on shutdown.
+                    -->
+                    <execution>
+                        <id>prepare-agent-integration-launcher</id>
+                        <goals>
+                            <goal>prepare-agent-integration</goal>
+                        </goals>
+                        <configuration>
+                            
<propertyName>jacoco.launcher.command</propertyName>
+                            <output>tcpserver</output>
+                            <address>localhost</address>
+                            <port>${jacoco.port}</port>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>dump-coverage-launcher</id>
+                        <goals>
+                            <goal>dump</goal>
+                        </goals>
+                        <phase>post-integration-test</phase>
+                        <configuration>
+                            <address>localhost</address>
+                            <port>${jacoco.port}</port>
+                            
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
+                            <append>true</append>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
             <plugin>
-                <groupId>biz.aQute.bnd</groupId>
-                <artifactId>bnd-maven-plugin</artifactId>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>slingfeature-maven-plugin</artifactId>
+                <version>1.9.2</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <features>src/test/it-features</features>
+                    
<replacePropertyVariables>caconfig.api.version,caconfig.spi.version,it.caconfig.log.level</replacePropertyVariables>
+                    
<skipAddFeatureDependencies>true</skipAddFeatureDependencies>
+                    <aggregates>
+                        <aggregate>
+                            <classifier>it-app</classifier>
+                            <filesInclude>*.json</filesInclude>
+                            <variablesOverrides>
+                                <http.port>${http.port}</http.port>
+                            </variablesOverrides>
+                            <artifactsOverrides>
+                                
<artifactsOverride>org.apache.sling:org.apache.sling.caconfig.api:HIGHEST</artifactsOverride>
+                                
<artifactsOverride>org.apache.sling:org.apache.sling.caconfig.spi:HIGHEST</artifactsOverride>
+                                
<artifactsOverride>org.apache.sling:org.apache.sling.caconfig.impl:HIGHEST</artifactsOverride>
+                            </artifactsOverrides>
+                            <includeArtifact>
+                                <groupId>org.apache.sling</groupId>
+                                
<artifactId>org.apache.sling.starter</artifactId>
+                                <classifier>nosample_base</classifier>
+                                <version>${sling.starter.version}</version>
+                                <type>slingosgifeature</type>
+                            </includeArtifact>
+                            <includeArtifact>
+                                <groupId>org.apache.sling</groupId>
+                                
<artifactId>org.apache.sling.starter</artifactId>
+                                <classifier>oak_persistence_sns</classifier>
+                                <version>${sling.starter.version}</version>
+                                <type>slingosgifeature</type>
+                            </includeArtifact>
+                            <includeArtifact>
+                                <groupId>org.apache.sling</groupId>
+                                
<artifactId>org.apache.sling.starter</artifactId>
+                                <classifier>junit</classifier>
+                                <version>${sling.starter.version}</version>
+                                <type>slingosgifeature</type>
+                            </includeArtifact>
+                        </aggregate>
+                    </aggregates>
+                    <scans>
+                        <scan>
+                            <includeClassifier>it-app</includeClassifier>
+                        </scan>
+                    </scans>
+                </configuration>
                 <executions>
                     <execution>
-                        <id>bnd-process</id>
+                        <id>prepare-features</id>
                         <goals>
-                            <goal>bnd-process</goal>
+                            <goal>aggregate-features</goal>
+                            <goal>analyse-features</goal>
+                            <goal>attach-features</goal>
                         </goals>
+                        <phase>pre-integration-test</phase>
                     </execution>
                 </executions>
             </plugin>
+
             <plugin>
-                <groupId>biz.aQute.bnd</groupId>
-                <artifactId>bnd-baseline-maven-plugin</artifactId>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>feature-launcher-maven-plugin</artifactId>
+                <version>1.0.3-SNAPSHOT</version>
+                <configuration>
+                    <launches>
+                        <launch>
+                            <id>sling-starter-oak-tar</id>
+                            <feature>
+                                <groupId>org.apache.sling</groupId>
+                                
<artifactId>org.apache.sling.caconfig.impl</artifactId>
+                                <version>${project.version}</version>
+                                <classifier>it-app</classifier>
+                                <type>slingosgifeature</type>
+                            </feature>
+                            <launcherArguments>
+                                <vmOptions>
+                                    <value>--add-opens 
java.base/java.lang=ALL-UNNAMED</value>
+                                    <value>${jacoco.launcher.command}</value>
+                                </vmOptions>
+                                <frameworkProperties>
+                                    
<org.osgi.service.http.port>${http.port}</org.osgi.service.http.port>
+                                    
<org.apache.felix.http.jetty.responseBufferSize>5000000</org.apache.felix.http.jetty.responseBufferSize>
+                                </frameworkProperties>
+                            </launcherArguments>
+                            
<startTimeoutSeconds>${it.startTimeoutSeconds}</startTimeoutSeconds>
+                        </launch>
+                    </launches>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>launcher-start</id>
+                        <goals>
+                            <goal>start</goal>
+                            <goal>stop</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
+
             <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
+                <artifactId>maven-failsafe-plugin</artifactId>
                 <configuration>
-                    <excludes>
-                        <exclude>dependency-reduced-pom.xml</exclude>
-                    </excludes>
+                    <systemPropertyVariables>
+                        
<launchpad.http.server.url>http://localhost:${http.port}</launchpad.http.server.url>
+                        
<starter.http.test.ports>false:${http.port}</starter.http.test.ports>
+                        
<starter.min.bundles.count>${starter.min.bundles.count}</starter.min.bundles.count>
+                        <!-- Comma-separated list of paths to check for 200 
status -->
+                        
<starter.check.paths>/system/console/bundles,</starter.check.paths>
+                    </systemPropertyVariables>
                 </configuration>
+                <executions>
+                    <execution>
+                        <id>integration-test</id>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
         </plugins>
     </build>
 
+    <profiles>
+        <!--
+          Debugging profile:
+          - Run on port 8080 (not random port)
+          - Waits for user input after tests are completed to allow inspection 
before shutting down the Sling instance
+          - Sets log level for Sling CAConfig to TRACE
+         -->
+        <profile>
+            <id>it-debug</id>
+            <properties>
+                <http.port>8080</http.port>
+                
<feature-launcher.waitForInput>true</feature-launcher.waitForInput>
+                <it.caconfig.log.level>trace</it.caconfig.log.level>
+            </properties>
+        </profile>
+    </profiles>
+
 </project>
diff --git a/src/test/it-features/it-launcher-repoinit.txt 
b/src/test/it-features/it-launcher-repoinit.txt
new file mode 100644
index 0000000..4dc9965
--- /dev/null
+++ b/src/test/it-features/it-launcher-repoinit.txt
@@ -0,0 +1,23 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+create service user caconfig-it
+set ACL for caconfig-it
+    allow   jcr:all    on /
+end
diff --git a/src/test/it-features/it-launcher.json 
b/src/test/it-features/it-launcher.json
new file mode 100644
index 0000000..e68de1f
--- /dev/null
+++ b/src/test/it-features/it-launcher.json
@@ -0,0 +1,38 @@
+{
+    "bundles": [
+        {
+            "id": 
"org.apache.sling/org.apache.sling.caconfig.api/${caconfig.api.version}",
+            "start-order": 20
+        },
+        {
+            "id": 
"org.apache.sling/org.apache.sling.caconfig.spi/${caconfig.spi.version}",
+            "start-order": 20
+        },
+        {
+            "id": 
"org.apache.sling/org.apache.sling.caconfig.impl/${project.version}",
+            "start-order": 20
+        },
+        {
+            "id": "org.apache.sling/org.apache.sling.resourcebuilder/1.0.4",
+            "start-order": 20
+        },
+        {
+            "id": 
"org.apache.sling/org.apache.sling.caconfig.impl/${project.version}//it-testbundle",
+            "start-order": 20
+        }
+    ],
+    "configurations": {
+        
"org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~integration-tests":
 {
+            "user.mapping": [
+                "org.apache.sling.junit.core=caconfig-it"
+            ]
+        },
+        
"org.apache.sling.commons.log.LogManager.factory.config~integration-tests": {
+            "org.apache.sling.commons.log.names": [
+                "org.apache.sling.caconfig"
+            ],
+            "org.apache.sling.commons.log.level": "${it.caconfig.log.level}"
+        }
+    },
+    "repoinit:TEXT|true": "@file"
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/caconfig/it/GenerateTestBundle.java 
b/src/test/java/org/apache/sling/caconfig/it/GenerateTestBundle.java
new file mode 100644
index 0000000..168774d
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/GenerateTestBundle.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.caconfig.it;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+
+import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ClassInfo;
+import io.github.classgraph.ScanResult;
+import org.apache.sling.caconfig.annotation.Configuration;
+import org.ops4j.pax.tinybundles.TinyBundle;
+import org.ops4j.pax.tinybundles.TinyBundles;
+import org.osgi.framework.Constants;
+
+/**
+ * This uses tinybundles to create a test bundle that is deployed to sling
+ * starter. The test bundle contains all classes from the packages
+ * org.apache.sling.caconfig.it.testbundle.*
+ */
+public class GenerateTestBundle {
+
+    private static final String DUMMY_TEXT = "Dummy file for Integration Test 
bundle.";
+
+    public static void main(String[] args) throws Exception {
+        Path outputFile = Paths.get(args[0]);
+        try (InputStream bundleStream = 
createBundle().build(TinyBundles.bndBuilder())) {
+            Files.copy(bundleStream, outputFile);
+        }
+        System.out.println("Test bundle created at " + 
outputFile.toAbsolutePath());
+    }
+
+    static TinyBundle createBundle() {
+        TinyBundle bundle = TinyBundles.bundle()
+                .setHeader(
+                        Constants.BUNDLE_NAME,
+                        "Apache Sling Context-Aware Configuration 
Implementation - IT Test Bundle")
+                .setHeader(Constants.BUNDLE_VERSION, "1.0.0-SNAPSHOT")
+                .setHeader(Constants.EXPORT_PACKAGE, 
"org.apache.sling.caconfig.it.testbundle.*")
+                // add dummy files to please verify-legal-files check
+                .addResource("META-INF/LICENSE", new 
ByteArrayInputStream(DUMMY_TEXT.getBytes(StandardCharsets.UTF_8)))
+                .addResource("META-INF/NOTICE", new 
ByteArrayInputStream(DUMMY_TEXT.getBytes(StandardCharsets.UTF_8)));
+
+        // add all testbundle classes
+        Set<String> caconfigClassNames = new TreeSet<>();
+        getAllClasses().forEach(clazz -> {
+            bundle.addClass(clazz);
+            if (clazz.isAnnotationPresent(Configuration.class)) {
+                caconfigClassNames.add(clazz.getName());
+            }
+        });
+
+        // register caconfig classes
+        bundle.setHeader(
+                "Sling-ContextAware-Configuration-Classes",
+                caconfigClassNames.stream().collect(Collectors.joining(",")));
+
+        return bundle;
+    }
+
+    /**
+     * Dynamically find all classes in classpath under package(s) 
org.apache.sling.models.it.testbundle.*
+     */
+    static List<Class<?>> getAllClasses() {
+        try (ScanResult scanResult = new ClassGraph()
+                .enableClassInfo()
+                .acceptPackages("org.apache.sling.caconfig.it.testbundle")
+                .scan()) {
+            return 
scanResult.getAllClasses().stream().map(ClassInfo::loadClass).collect(Collectors.toList());
+        }
+    }
+}
diff --git 
a/src/test/java/org/apache/sling/caconfig/it/testbundle/example/SimpleConfig.java
 
b/src/test/java/org/apache/sling/caconfig/it/testbundle/example/SimpleConfig.java
new file mode 100644
index 0000000..5dab900
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/caconfig/it/testbundle/example/SimpleConfig.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.caconfig.it.testbundle.example;
+
+import org.apache.sling.caconfig.annotation.Configuration;
+
+@Configuration
+public @interface SimpleConfig {
+
+    String stringParam();
+
+    String stringParamDefault() default "defValue";
+
+    int intParam();
+
+    boolean boolParam();
+}
diff --git 
a/src/test/java/org/apache/sling/caconfig/it/testing/AdaptToConfigClassIT.java 
b/src/test/java/org/apache/sling/caconfig/it/testing/AdaptToConfigClassIT.java
new file mode 100644
index 0000000..a8ef860
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/caconfig/it/testing/AdaptToConfigClassIT.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.caconfig.it.testing;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.caconfig.ConfigurationBuilder;
+import org.apache.sling.caconfig.it.testbundle.example.SimpleConfig;
+import org.apache.sling.junit.rules.TeleporterRule;
+import org.apache.sling.resourcebuilder.api.ResourceBuilder;
+import org.apache.sling.resourcebuilder.api.ResourceBuilderFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.sling.caconfig.it.testing.TestUtils.CONFIG_ROOT_PATH;
+import static org.apache.sling.caconfig.it.testing.TestUtils.CONTENT_ROOT_PATH;
+import static org.apache.sling.caconfig.it.testing.TestUtils.cleanUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class AdaptToConfigClassIT {
+
+    @Rule
+    public TeleporterRule teleporter = TeleporterRule.forClass(getClass(), 
"IT");
+
+    private ResourceResolver resourceResolver;
+    private ResourceBuilder resourceBuilder;
+
+    private static final String PAGE_PATH = CONTENT_ROOT_PATH + "/page1";
+    private static final String CONFIG_PATH = CONFIG_ROOT_PATH + "/page1";
+
+    @Before
+    public void setUp() throws Exception {
+        resourceResolver = 
teleporter.getService(ResourceResolverFactory.class).getServiceResourceResolver(null);
+        resourceBuilder = 
teleporter.getService(ResourceBuilderFactory.class).forResolver(resourceResolver);
+    }
+
+    @After
+    public void tearDown() {
+        cleanUp(resourceResolver);
+        resourceResolver.close();
+    }
+
+    @Test
+    @SuppressWarnings("null")
+    public void testNonExistingConfig() {
+        Resource resourcePage1 = 
resourceBuilder.resource(PAGE_PATH).getCurrentParent();
+
+        SimpleConfig config = 
resourcePage1.adaptTo(ConfigurationBuilder.class).as(SimpleConfig.class);
+        assertNotNull(config);
+
+        assertNull(config.stringParam());
+        assertEquals(0, config.intParam());
+        assertEquals(false, config.boolParam());
+    }
+
+    @Test
+    @SuppressWarnings("null")
+    public void testExistingConfig() {
+        resourceBuilder
+                .resource(
+                        CONFIG_PATH + "/sling:configs/" + 
SimpleConfig.class.getName(),
+                        "stringParam",
+                        "value1",
+                        "intParam",
+                        123,
+                        "boolParam",
+                        true)
+                .resource(PAGE_PATH, "sling:configRef", CONFIG_PATH);
+
+        Resource resourcePage1 = resourceResolver.getResource(PAGE_PATH);
+
+        SimpleConfig config = 
resourcePage1.adaptTo(ConfigurationBuilder.class).as(SimpleConfig.class);
+        assertNotNull(config);
+
+        assertEquals("value1", config.stringParam());
+        assertEquals(123, config.intParam());
+        assertEquals(true, config.boolParam());
+    }
+}
diff --git 
a/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationManagerIT.java
 
b/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationManagerIT.java
new file mode 100644
index 0000000..5a7ffc2
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationManagerIT.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.caconfig.it.testing;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.caconfig.ConfigurationResolver;
+import org.apache.sling.caconfig.it.testbundle.example.SimpleConfig;
+import org.apache.sling.caconfig.management.ConfigurationData;
+import org.apache.sling.caconfig.management.ConfigurationManager;
+import org.apache.sling.caconfig.spi.ConfigurationCollectionPersistData;
+import org.apache.sling.caconfig.spi.ConfigurationPersistData;
+import org.apache.sling.junit.rules.TeleporterRule;
+import org.apache.sling.resourcebuilder.api.ResourceBuilder;
+import org.apache.sling.resourcebuilder.api.ResourceBuilderFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.sling.caconfig.it.testing.TestUtils.CONFIG_ROOT_PATH;
+import static org.apache.sling.caconfig.it.testing.TestUtils.CONTENT_ROOT_PATH;
+import static org.apache.sling.caconfig.it.testing.TestUtils.cleanUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class ConfigurationManagerIT {
+
+    @Rule
+    public TeleporterRule teleporter = TeleporterRule.forClass(getClass(), 
"IT");
+
+    private ResourceResolver resourceResolver;
+    private ResourceBuilder resourceBuilder;
+    private ConfigurationManager configManager;
+    private ConfigurationResolver configResolver;
+
+    private static final String PAGE_PATH = CONTENT_ROOT_PATH + "/page1";
+    private static final String CONFIG_PATH = CONFIG_ROOT_PATH + "/page1";
+    private static final String CONFIG_NAME = SimpleConfig.class.getName();
+
+    private Resource resourcePage1;
+
+    @Before
+    public void setUp() throws Exception {
+        resourceResolver = 
teleporter.getService(ResourceResolverFactory.class).getServiceResourceResolver(null);
+        resourceBuilder = 
teleporter.getService(ResourceBuilderFactory.class).forResolver(resourceResolver);
+        configManager = teleporter.getService(ConfigurationManager.class);
+        configResolver = teleporter.getService(ConfigurationResolver.class);
+
+        resourcePage1 = resourceBuilder
+                .resource(PAGE_PATH, "sling:configRef", CONFIG_PATH)
+                .getCurrentParent();
+    }
+
+    @After
+    public void tearDown() {
+        cleanUp(resourceResolver);
+        resourceResolver.close();
+    }
+
+    @Test
+    public void testNonExistingConfig() {
+        ConfigurationData config = 
configManager.getConfiguration(resourcePage1, CONFIG_NAME);
+        assertNotNull(config);
+
+        ValueMap props = config.getEffectiveValues();
+        assertNull(props.get("stringParam", String.class));
+        assertEquals("defValue", props.get("stringParamDefault", 
String.class));
+        assertEquals(0, (int) props.get("intParam", 0));
+        assertEquals(false, props.get("boolParam", false));
+    }
+
+    @Test
+    public void testExistingConfig() {
+        resourceBuilder.resource(
+                CONFIG_PATH + "/sling:configs/" + CONFIG_NAME,
+                "stringParam",
+                "value1",
+                "intParam",
+                123,
+                "boolParam",
+                true);
+
+        ConfigurationData config = 
configManager.getConfiguration(resourcePage1, CONFIG_NAME);
+        assertNotNull(config);
+
+        ValueMap props = config.getEffectiveValues();
+        assertEquals("value1", props.get("stringParam", String.class));
+        assertEquals("defValue", props.get("stringParamDefault", 
String.class));
+        assertEquals(123, (int) props.get("intParam", 0));
+        assertEquals(true, props.get("boolParam", false));
+    }
+
+    @Test
+    public void testWriteConfig() throws Exception {
+        // write configuration data via configuration manager
+        Map<String, Object> values = new HashMap<>();
+        values.put("stringParam", "valueA");
+        values.put("stringParamDefault", "valueB");
+        values.put("intParam", 55);
+        values.put("boolParam", true);
+        configManager.persistConfiguration(resourcePage1, CONFIG_NAME, new 
ConfigurationPersistData(values));
+        resourceResolver.commit();
+
+        // read config via configuration resolver
+        SimpleConfig config = 
configResolver.get(resourcePage1).as(SimpleConfig.class);
+        assertNotNull(config);
+
+        assertEquals("valueA", config.stringParam());
+        assertEquals("valueB", config.stringParamDefault());
+        assertEquals(55, config.intParam());
+        assertEquals(true, config.boolParam());
+    }
+
+    @Test
+    public void testWriteConfigCollection() throws Exception {
+        // write configuration data via configuration manager
+        Map<String, Object> values1 = new HashMap<>();
+        values1.put("stringParam", "valueA");
+        values1.put("stringParamDefault", "valueB");
+        Map<String, Object> values2 = new HashMap<>();
+        values2.put("intParam", 55);
+        values2.put("boolParam", true);
+        List<ConfigurationPersistData> items = new ArrayList<>();
+        items.add(new 
ConfigurationPersistData(values1).collectionItemName("item1"));
+        items.add(new 
ConfigurationPersistData(values2).collectionItemName("item2"));
+        configManager.persistConfigurationCollection(
+                resourcePage1, CONFIG_NAME, new 
ConfigurationCollectionPersistData(items));
+        resourceResolver.commit();
+
+        // read config via configuration resolver
+        Collection<SimpleConfig> config = 
configResolver.get(resourcePage1).asCollection(SimpleConfig.class);
+        assertEquals(2, config.size());
+
+        Iterator<SimpleConfig> configIterator = config.iterator();
+        SimpleConfig config1 = configIterator.next();
+        SimpleConfig config2 = configIterator.next();
+
+        assertEquals("valueA", config1.stringParam());
+        assertEquals("valueB", config1.stringParamDefault());
+        assertEquals(55, config2.intParam());
+        assertEquals(true, config2.boolParam());
+    }
+}
diff --git 
a/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationMetadataProviderIT.java
 
b/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationMetadataProviderIT.java
new file mode 100644
index 0000000..e325742
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationMetadataProviderIT.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.caconfig.it.testing;
+
+import org.apache.sling.caconfig.it.testbundle.example.SimpleConfig;
+import org.apache.sling.caconfig.spi.ConfigurationMetadataProvider;
+import org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata;
+import org.apache.sling.junit.rules.TeleporterRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class ConfigurationMetadataProviderIT {
+
+    @Rule
+    public TeleporterRule teleporter = TeleporterRule.forClass(getClass(), 
"IT");
+
+    @Test
+    public void testConfigurationMetadata() {
+        ConfigurationMetadataProvider underTest = 
teleporter.getService(ConfigurationMetadataProvider.class);
+
+        ConfigurationMetadata configMetadata = 
underTest.getConfigurationMetadata(SimpleConfig.class.getName());
+        assertNotNull(configMetadata);
+        assertEquals(SimpleConfig.class.getName(), configMetadata.getName());
+    }
+}
diff --git 
a/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationResolverConfigClassIT.java
 
b/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationResolverConfigClassIT.java
new file mode 100644
index 0000000..92cec30
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationResolverConfigClassIT.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.caconfig.it.testing;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.caconfig.ConfigurationResolver;
+import org.apache.sling.caconfig.it.testbundle.example.SimpleConfig;
+import org.apache.sling.junit.rules.TeleporterRule;
+import org.apache.sling.resourcebuilder.api.ResourceBuilder;
+import org.apache.sling.resourcebuilder.api.ResourceBuilderFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.sling.caconfig.it.testing.TestUtils.CONFIG_ROOT_PATH;
+import static org.apache.sling.caconfig.it.testing.TestUtils.CONTENT_ROOT_PATH;
+import static org.apache.sling.caconfig.it.testing.TestUtils.cleanUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class ConfigurationResolverConfigClassIT {
+
+    @Rule
+    public TeleporterRule teleporter = TeleporterRule.forClass(getClass(), 
"IT");
+
+    private ResourceResolver resourceResolver;
+    private ResourceBuilder resourceBuilder;
+
+    private static final String PAGE_PATH = CONTENT_ROOT_PATH + "/page1";
+    private static final String CONFIG_PATH = CONFIG_ROOT_PATH + "/page1";
+
+    @Before
+    public void setUp() throws Exception {
+        resourceResolver = 
teleporter.getService(ResourceResolverFactory.class).getServiceResourceResolver(null);
+        resourceBuilder = 
teleporter.getService(ResourceBuilderFactory.class).forResolver(resourceResolver);
+    }
+
+    @After
+    public void tearDown() {
+        cleanUp(resourceResolver);
+        resourceResolver.close();
+    }
+
+    @Test
+    public void testNonExistingConfig() {
+        Resource resourcePage1 = 
resourceBuilder.resource(PAGE_PATH).getCurrentParent();
+
+        ConfigurationResolver configResolver = 
teleporter.getService(ConfigurationResolver.class);
+        SimpleConfig config = 
configResolver.get(resourcePage1).name("test").as(SimpleConfig.class);
+        assertNotNull(config);
+
+        assertNull(config.stringParam());
+        assertEquals("defValue", config.stringParamDefault());
+        assertEquals(0, config.intParam());
+        assertEquals(false, config.boolParam());
+    }
+
+    @Test
+    @SuppressWarnings("null")
+    public void testExistingConfig() {
+        resourceBuilder
+                .resource(
+                        CONFIG_PATH + "/sling:configs/test",
+                        "stringParam",
+                        "value1",
+                        "intParam",
+                        123,
+                        "boolParam",
+                        true)
+                .resource(PAGE_PATH, "sling:configRef", CONFIG_PATH);
+
+        Resource resourcePage1 = resourceResolver.getResource(PAGE_PATH);
+
+        ConfigurationResolver configResolver = 
teleporter.getService(ConfigurationResolver.class);
+        SimpleConfig config = 
configResolver.get(resourcePage1).name("test").as(SimpleConfig.class);
+        assertNotNull(config);
+
+        assertEquals("value1", config.stringParam());
+        assertEquals("defValue", config.stringParamDefault());
+        assertEquals(123, config.intParam());
+        assertEquals(true, config.boolParam());
+    }
+}
diff --git 
a/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationResolverValueMapIT.java
 
b/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationResolverValueMapIT.java
new file mode 100644
index 0000000..70d6c6e
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/caconfig/it/testing/ConfigurationResolverValueMapIT.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.caconfig.it.testing;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.caconfig.ConfigurationResolver;
+import org.apache.sling.junit.rules.TeleporterRule;
+import org.apache.sling.resourcebuilder.api.ResourceBuilder;
+import org.apache.sling.resourcebuilder.api.ResourceBuilderFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.sling.caconfig.it.testing.TestUtils.CONFIG_ROOT_PATH;
+import static org.apache.sling.caconfig.it.testing.TestUtils.CONTENT_ROOT_PATH;
+import static org.apache.sling.caconfig.it.testing.TestUtils.cleanUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class ConfigurationResolverValueMapIT {
+
+    @Rule
+    public TeleporterRule teleporter = TeleporterRule.forClass(getClass(), 
"IT");
+
+    private ResourceResolver resourceResolver;
+    private ResourceBuilder resourceBuilder;
+
+    private static final String PAGE_PATH = CONTENT_ROOT_PATH + "/page1";
+    private static final String CONFIG_PATH = CONFIG_ROOT_PATH + "/page1";
+
+    @Before
+    public void setUp() throws Exception {
+        resourceResolver = 
teleporter.getService(ResourceResolverFactory.class).getServiceResourceResolver(null);
+        resourceBuilder = 
teleporter.getService(ResourceBuilderFactory.class).forResolver(resourceResolver);
+    }
+
+    @After
+    public void tearDown() {
+        cleanUp(resourceResolver);
+        resourceResolver.close();
+    }
+
+    @Test
+    public void testNonExistingConfig() {
+        Resource resourcePage1 = 
resourceBuilder.resource(PAGE_PATH).getCurrentParent();
+
+        ConfigurationResolver configResolver = 
teleporter.getService(ConfigurationResolver.class);
+        ValueMap props = 
configResolver.get(resourcePage1).name("test").asValueMap();
+        assertNotNull(props);
+
+        assertNull(props.get("stringParam", String.class));
+        assertEquals(0, (int) props.get("intParam", 0));
+        assertEquals(false, props.get("boolParam", false));
+    }
+
+    @Test
+    @SuppressWarnings("null")
+    public void testExistingConfig() {
+        resourceBuilder
+                .resource(
+                        CONFIG_PATH + "/sling:configs/test",
+                        "stringParam",
+                        "value1",
+                        "intParam",
+                        123,
+                        "boolParam",
+                        true)
+                .resource(PAGE_PATH, "sling:configRef", CONFIG_PATH);
+
+        Resource resourcePage1 = resourceResolver.getResource(PAGE_PATH);
+
+        ConfigurationResolver configResolver = 
teleporter.getService(ConfigurationResolver.class);
+        ValueMap props = 
configResolver.get(resourcePage1).name("test").asValueMap();
+        assertNotNull(props);
+
+        assertEquals("value1", props.get("stringParam", String.class));
+        assertEquals(123, (int) props.get("intParam", 0));
+        assertEquals(true, props.get("boolParam", false));
+    }
+}
diff --git a/src/test/java/org/apache/sling/caconfig/it/testing/TestUtils.java 
b/src/test/java/org/apache/sling/caconfig/it/testing/TestUtils.java
new file mode 100644
index 0000000..0678bba
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/testing/TestUtils.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.caconfig.it.testing;
+
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+final class TestUtils {
+
+    /**
+     * Root path for test content
+     */
+    public static final String CONTENT_ROOT_PATH = "/content/test";
+
+    /**
+     * Root path for config content
+     */
+    public static final String CONFIG_ROOT_PATH = "/conf/test";
+
+    private static final Logger log = LoggerFactory.getLogger(TestUtils.class);
+
+    private TestUtils() {
+        // static methods only
+    }
+
+    public static void cleanUp(ResourceResolver resourceResolver) {
+        deletePath(resourceResolver, CONTENT_ROOT_PATH);
+        deletePath(resourceResolver, CONFIG_ROOT_PATH);
+        try {
+            resourceResolver.commit();
+        } catch (PersistenceException ex) {
+            log.error("Unable clean up resources.", ex);
+        }
+    }
+
+    public static void deletePath(ResourceResolver resourceResolver, String 
path) {
+        Resource resource = resourceResolver.getResource(path);
+        if (resource != null) {
+            try {
+                resourceResolver.delete(resource);
+            } catch (PersistenceException ex) {
+                log.error("Unable to delete resource " + path, ex);
+            }
+        }
+    }
+}
diff --git 
a/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java 
b/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java
new file mode 100644
index 0000000..b0a85e2
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.junit.teleporter.customizers;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.sling.caconfig.impl.ConfigurationBuilderAdapterFactory;
+import org.apache.sling.junit.rules.TeleporterRule;
+import org.apache.sling.testing.clients.ClientException;
+import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
+import org.apache.sling.testing.serversetup.instance.SlingTestBase;
+import org.apache.sling.testing.teleporter.client.ClientSideTeleporter;
+import org.apache.sling.testing.timeouts.TimeoutsProvider;
+
+public class ITCustomizer implements TeleporterRule.Customizer {
+
+    private static final SlingTestBase S = new SlingTestBase();
+
+    private static final Class[] EXPECTED_COMPONENTS = new Class[] 
{ConfigurationBuilderAdapterFactory.class};
+
+    @Override
+    public void customize(TeleporterRule t, String options) {
+        final ClientSideTeleporter cst = (ClientSideTeleporter) t;
+        cst.setBaseUrl(S.getServerBaseUrl());
+        cst.setServerCredentials(S.getServerUsername(), S.getServerPassword());
+        
cst.setTestReadyTimeoutSeconds(TimeoutsProvider.getInstance().getTimeout(5));
+        cst.includeDependencyPrefix("org.apache.sling.caconfig.it.testing");
+
+        // additionally check for the registration of mandatory sling models 
components
+        try (OsgiConsoleClient osgiClient =
+                new OsgiConsoleClient(URI.create(S.getServerBaseUrl()), 
S.getServerUsername(), S.getServerPassword())) {
+            for (Class clazz : EXPECTED_COMPONENTS) {
+                osgiClient.waitComponentRegistered(clazz.getName(), 20000, 
200);
+            }
+        } catch (ClientException | TimeoutException | InterruptedException | 
IOException ex) {
+            throw new RuntimeException("Error waiting for expected 
components.", ex);
+        }
+    }
+}

Reply via email to