You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:19:20 UTC

[sling-org-apache-sling-caconfig-integration-tests] 01/14: SLING-6427 Move Sling Context-Aware Config out of contrib - move in svn - update all SCM URLs - update jenkins build jobs

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

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

commit 9cca67a96b751aa1a1923fdf174c5f5d74d44eb4
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Dec 22 09:52:16 2016 +0000

    SLING-6427 Move Sling Context-Aware Config out of contrib
    - move in svn
    - update all SCM URLs
    - update jenkins build jobs
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1775601 13f79535-47bb-0310-9956-ffa450edef68
---
 .gitignore                                         |   1 +
 pom.xml                                            | 261 +++++++++++++++++++++
 src/main/provisioning/integration-tests.txt        |  55 +++++
 .../sling/caconfig/it/AdaptToConfigClassIT.java    |  93 ++++++++
 .../sling/caconfig/it/ConfigurationManagerIT.java  | 163 +++++++++++++
 .../it/ConfigurationMetadataProviderIT.java        |  43 ++++
 .../it/ConfigurationResolverConfigClassIT.java     |  97 ++++++++
 .../it/ConfigurationResolverValueMapIT.java        |  95 ++++++++
 .../org/apache/sling/caconfig/it/TestUtils.java    |  67 ++++++
 .../sling/caconfig/it/example/SimpleConfig.java    |  34 +++
 .../junit/teleporter/customizers/ITCustomizer.java |  40 ++++
 11 files changed, 949 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1928457
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/infinitest.filters
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..0da4126
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>29</version>
+        <relativePath/>
+    </parent>
+
+    <artifactId>org.apache.sling.caconfig.integration-tests</artifactId>
+    <packaging>slingstart</packaging>
+    <version>1-SNAPSHOT</version>
+    <name>Apache Sling Context-Aware Configuration Integration Tests</name>
+    <description>Integration tests for the Apache Sling Context-Aware Configuration Implementation</description>
+
+    <properties>
+        <!-- hostname for integration tests -->
+        <test.host>localhost</test.host>
+  
+        <!--
+            Set this to true to stop mvn once the integration test Jetty instance is
+            started. Useful to manually test the integration testing webapp.
+        -->
+        <launchpad.keep.running>false</launchpad.keep.running>
+  
+        <!--
+          If set to "true" this will start the launchpad with standard debug options,
+          or set to a string to provide custom debug settings
+        -->
+        <launchpad.debug/>
+    </properties>
+  
+    <build>
+        <plugins>
+
+            <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>process-resources</phase>
+                      <configuration>
+                          <portNames>
+                              <portName>http.port</portName>
+                              <portName>sling.control.port</portName>
+                          </portNames>
+                      </configuration>
+                  </execution>
+              </executions>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <runOrder>alphabetical</runOrder>
+                    <systemPropertyVariables>
+                        <launchpad.http.server.url>http://${test.host}:${http.port}/</launchpad.http.server.url>
+                        <launchpad.webdav.server.url>http://${test.host}:${http.port}/${webdav.workspace.path}</launchpad.webdav.server.url>
+                    </systemPropertyVariables>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>slingstart-maven-plugin</artifactId>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>start-container</id>
+                        <goals>
+                            <goal>start</goal>
+                            <goal>stop</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <usePomDependencies>true</usePomDependencies>
+                    <servers>
+                        <server>
+                            <port>${http.port}</port>
+                            <controlPort>${sling.control.port}</controlPort>
+                            <contextPath>${http.base.path}</contextPath>
+                            <debug>${launchpad.debug}</debug>
+                        </server>
+                  </servers>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>infinitest.filters</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+
+            <!-- do not deploy this project into maven repository -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+    
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.caconfig.api</artifactId>
+            <version>1.1.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.caconfig.spi</artifactId>
+            <version>1.2.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.caconfig.impl</artifactId>
+            <version>1.2.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.testing</artifactId>
+            <version>2.1.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>junit</groupId>
+                    <artifactId>junit-dep</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-simple</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>asm</groupId>
+                    <artifactId>asm</artifactId>
+                </exclusion>
+            </exclusions>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.junit.teleporter</artifactId>
+            <version>1.0.8</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.junit.core</artifactId>
+            <version>1.0.21-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.tools</artifactId>
+            <version>1.0.14</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.resourcebuilder</artifactId>
+            <version>1.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.3.2</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.launchpad</artifactId>
+            <version>9-SNAPSHOT</version>
+            <type>slingfeature</type>
+            <classifier>slingfeature</classifier>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    
+    <profiles>
+        <!-- Start on port 8080 and keep running -->
+        <profile>
+            <id>run8080</id>
+            <properties>
+                <launchpad.keep.running>true</launchpad.keep.running>
+                <launchpad.debug>true</launchpad.debug>
+                <http.port>8080</http.port>
+            </properties>            
+        </profile>
+    </profiles>
+    
+</project>
diff --git a/src/main/provisioning/integration-tests.txt b/src/main/provisioning/integration-tests.txt
new file mode 100644
index 0000000..9bbb38f
--- /dev/null
+++ b/src/main/provisioning/integration-tests.txt
@@ -0,0 +1,55 @@
+#
+#  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.
+#
+[feature name=integration-tests]
+
+[artifacts]
+  org.apache.sling/org.apache.sling.launchpad//slingfeature/slingfeature
+
+[artifacts startLevel=15]
+  org.apache.commons/commons-lang3
+  org.apache.sling/org.apache.sling.junit.core
+  org.apache.sling/org.apache.sling.testing.tools
+  org.apache.sling/org.apache.sling.resourcebuilder
+  org.apache.sling/org.apache.sling.caconfig.api
+  org.apache.sling/org.apache.sling.caconfig.spi
+  org.apache.sling/org.apache.sling.caconfig.impl
+    
+[configurations]
+  org.apache.sling.commons.log.LogManager.factory.config-slingconfig.log
+    org.apache.sling.commons.log.names=["org.apache.sling.caconfig"]
+    org.apache.sling.commons.log.file="logs/sling-contextaware-config.log"
+    org.apache.sling.commons.log.level="debug"
+
+  org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-sling-caconfig
+    user.mapping=[
+      "org.apache.sling.caconfig.impl\=sling-caconfig"
+    ]
+
+  org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment-junitcore
+    whitelist.name="junitcore"
+    whitelist.bundles=["org.apache.sling.junit.core"]
+
+[:repoinit]
+    create service user sling-caconfig
+
+    create path (sling:Folder) /conf
+
+    set ACL for sling-caconfig
+        allow   jcr:read    on /
+    end
diff --git a/src/test/java/org/apache/sling/caconfig/it/AdaptToConfigClassIT.java b/src/test/java/org/apache/sling/caconfig/it/AdaptToConfigClassIT.java
new file mode 100644
index 0000000..34cdca2
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/AdaptToConfigClassIT.java
@@ -0,0 +1,93 @@
+/*
+ * 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 static org.apache.sling.caconfig.it.TestUtils.CONFIG_ROOT_PATH;
+import static org.apache.sling.caconfig.it.TestUtils.CONTENT_ROOT_PATH;
+import static org.apache.sling.caconfig.it.TestUtils.cleanUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+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.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;
+
+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";
+    
+    @SuppressWarnings("deprecation")
+    @Before
+    public void setUp() throws Exception {
+        resourceResolver = teleporter.getService(ResourceResolverFactory.class).getAdministrativeResourceResolver(null);
+        resourceBuilder = teleporter.getService(ResourceBuilderFactory.class).forResolver(resourceResolver);
+    }
+    
+    @After
+    public void tearDown() {
+        cleanUp(resourceResolver);
+        resourceResolver.close();
+    }
+    
+    @Test
+    public void testNonExistingConfig() throws Exception {
+        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
+    public void testExistingConfig() throws Exception {
+        resourceBuilder.resource(CONFIG_PATH + "/sling:configs/org.apache.sling.caconfig.it.example.SimpleConfig",
+                "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, (int)config.intParam());
+        assertEquals(true, config.boolParam());
+    }
+    
+}
diff --git a/src/test/java/org/apache/sling/caconfig/it/ConfigurationManagerIT.java b/src/test/java/org/apache/sling/caconfig/it/ConfigurationManagerIT.java
new file mode 100644
index 0000000..c53f539
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/ConfigurationManagerIT.java
@@ -0,0 +1,163 @@
+/*
+ * 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 static org.apache.sling.caconfig.it.TestUtils.CONFIG_ROOT_PATH;
+import static org.apache.sling.caconfig.it.TestUtils.CONTENT_ROOT_PATH;
+import static org.apache.sling.caconfig.it.TestUtils.cleanUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+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.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;
+
+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;
+    
+    @SuppressWarnings("deprecation")
+    @Before
+    public void setUp() throws Exception {
+        resourceResolver = teleporter.getService(ResourceResolverFactory.class).getAdministrativeResourceResolver(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() throws Exception {
+        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() throws Exception {
+        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, (int)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, (int)config2.intParam());
+        assertEquals(true, config2.boolParam());
+    }
+    
+}
diff --git a/src/test/java/org/apache/sling/caconfig/it/ConfigurationMetadataProviderIT.java b/src/test/java/org/apache/sling/caconfig/it/ConfigurationMetadataProviderIT.java
new file mode 100644
index 0000000..eccdac0
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/ConfigurationMetadataProviderIT.java
@@ -0,0 +1,43 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.sling.caconfig.it.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;
+
+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/ConfigurationResolverConfigClassIT.java b/src/test/java/org/apache/sling/caconfig/it/ConfigurationResolverConfigClassIT.java
new file mode 100644
index 0000000..d6dc264
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/ConfigurationResolverConfigClassIT.java
@@ -0,0 +1,97 @@
+/*
+ * 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 static org.apache.sling.caconfig.it.TestUtils.CONFIG_ROOT_PATH;
+import static org.apache.sling.caconfig.it.TestUtils.CONTENT_ROOT_PATH;
+import static org.apache.sling.caconfig.it.TestUtils.cleanUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+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.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;
+
+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";
+    
+    @SuppressWarnings("deprecation")
+    @Before
+    public void setUp() throws Exception {
+        resourceResolver = teleporter.getService(ResourceResolverFactory.class).getAdministrativeResourceResolver(null);
+        resourceBuilder = teleporter.getService(ResourceBuilderFactory.class).forResolver(resourceResolver);
+    }
+    
+    @After
+    public void tearDown() {
+        cleanUp(resourceResolver);
+        resourceResolver.close();
+    }
+    
+    @Test
+    public void testNonExistingConfig() throws Exception {
+        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
+    public void testExistingConfig() throws Exception {
+        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, (int)config.intParam());
+        assertEquals(true, config.boolParam());
+    }
+    
+}
diff --git a/src/test/java/org/apache/sling/caconfig/it/ConfigurationResolverValueMapIT.java b/src/test/java/org/apache/sling/caconfig/it/ConfigurationResolverValueMapIT.java
new file mode 100644
index 0000000..b66fb74
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/ConfigurationResolverValueMapIT.java
@@ -0,0 +1,95 @@
+/*
+ * 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 static org.apache.sling.caconfig.it.TestUtils.CONFIG_ROOT_PATH;
+import static org.apache.sling.caconfig.it.TestUtils.CONTENT_ROOT_PATH;
+import static org.apache.sling.caconfig.it.TestUtils.cleanUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+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;
+
+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";
+    
+    @SuppressWarnings("deprecation")
+    @Before
+    public void setUp() throws Exception {
+        resourceResolver = teleporter.getService(ResourceResolverFactory.class).getAdministrativeResourceResolver(null);
+        resourceBuilder = teleporter.getService(ResourceBuilderFactory.class).forResolver(resourceResolver);
+    }
+    
+    @After
+    public void tearDown() {
+        cleanUp(resourceResolver);
+        resourceResolver.close();
+    }
+    
+    @Test
+    public void testNonExistingConfig() throws Exception {
+        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
+    public void testExistingConfig() throws Exception {
+        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/TestUtils.java b/src/test/java/org/apache/sling/caconfig/it/TestUtils.java
new file mode 100644
index 0000000..484b349
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/TestUtils.java
@@ -0,0 +1,67 @@
+/*
+ * 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 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/caconfig/it/example/SimpleConfig.java b/src/test/java/org/apache/sling/caconfig/it/example/SimpleConfig.java
new file mode 100644
index 0000000..3cea6a7
--- /dev/null
+++ b/src/test/java/org/apache/sling/caconfig/it/example/SimpleConfig.java
@@ -0,0 +1,34 @@
+/*
+ * 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.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/junit/teleporter/customizers/ITCustomizer.java b/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java
new file mode 100644
index 0000000..9526d47
--- /dev/null
+++ b/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.sling.junit.rules.TeleporterRule;
+import org.apache.sling.testing.teleporter.client.ClientSideTeleporter;
+import org.apache.sling.testing.tools.sling.TimeoutsProvider;
+
+public class ITCustomizer implements TeleporterRule.Customizer {
+
+    public static final String BASE_URL_PROP = "launchpad.http.server.url";
+
+    @Override
+    public void customize(TeleporterRule t, String options) {
+        final ClientSideTeleporter cst = (ClientSideTeleporter)t;
+        cst.setBaseUrl(System.getProperty(BASE_URL_PROP, BASE_URL_PROP + "_IS_NOT_SET"));
+        cst.setServerCredentials("admin", "admin");
+        cst.includeDependencyPrefix("org.apache.sling.caconfig.it");
+        cst.setTestReadyTimeoutSeconds(TimeoutsProvider.getInstance().getTimeout(10));
+        
+        // list all configuration annotation classes here (separated by ",")
+        cst.getAdditionalBundleHeaders().put("Sling-ContextAware-Configuration-Classes",
+                "org.apache.sling.caconfig.it.example.SimpleConfig");
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.