Merge pull request #1 from apache/it-with-invoker-plugin

SLING-2938 - move integration tests here, using invoker plugin
diff --git a/.gitignore b/.gitignore
index 974f3bf..8e3be41 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-/target/
+target
 /.project
 /.settings/
 /.classpath
@@ -15,4 +15,4 @@
 .DS_Store
 jcr.log
 atlassian-ide-plugin.xml
-.vscode/
\ No newline at end of file
+.vscode/
diff --git a/pom.xml b/pom.xml
index b89de64..bf5e3aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,65 @@
         <sling.java.version>7</sling.java.version>
     </properties>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>3.0.0-M5</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-invoker-plugin</artifactId>
+                <version>3.2.1</version>
+                <configuration>
+                    <debug>false</debug>
+                    <projectsDirectory>src/it</projectsDirectory>
+                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+                    <pomIncludes>
+                        <pomInclude>*/pom.xml</pomInclude>
+                    </pomIncludes>
+                    <postBuildHookScript>verify</postBuildHookScript>
+                    <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
+                    <settingsFile>src/it/settings.xml</settingsFile>
+                    <!-- this causes verbose output, probably good to have for CI builds? -->
+                    <streamLogs>true</streamLogs>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>integration-test</id>
+                        <goals>
+                            <goal>install</goal>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>src/it/annotations-it/target/**</exclude>
+                        <exclude>src/it/annotations-it/README.md</exclude>
+                        <exclude>src/it/annotations-it/bnd.bnd</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-clean-plugin</artifactId>
+                <configuration>
+                    <filesets>
+                        <fileset>
+                            <directory>src/it/annotations-it/target</directory>
+                        </fileset>
+                    </filesets>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
     <dependencies>
         <!-- all transitive dependencies should have scope "provided" to prevent classpath
              pollution of referencing projects -->
diff --git a/src/it/annotations-it/README.md b/src/it/annotations-it/README.md
new file mode 100644
index 0000000..c1f510c
--- /dev/null
+++ b/src/it/annotations-it/README.md
@@ -0,0 +1 @@
+Integration tests for the adapter annotations module.
\ No newline at end of file
diff --git a/src/it/annotations-it/bnd.bnd b/src/it/annotations-it/bnd.bnd
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/it/annotations-it/bnd.bnd
@@ -0,0 +1 @@
+
diff --git a/src/it/annotations-it/invoker.properties b/src/it/annotations-it/invoker.properties
new file mode 100644
index 0000000..b9bcb58
--- /dev/null
+++ b/src/it/annotations-it/invoker.properties
@@ -0,0 +1,17 @@
+# 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.
+
+invoker.goals = clean verify -Dannotations.bundle.version=${project.version} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
+invoker.debug = false
\ No newline at end of file
diff --git a/src/it/annotations-it/pom.xml b/src/it/annotations-it/pom.xml
new file mode 100644
index 0000000..466f278
--- /dev/null
+++ b/src/it/annotations-it/pom.xml
@@ -0,0 +1,235 @@
+<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>34</version>
+        <relativePath/>
+    </parent>
+
+    <artifactId>org.apache.sling.adapter.annotations.it</artifactId>
+    <version>2.0.0</version>
+
+    <name>Apache Sling Adapter Annotations IT</name>
+    <description>
+        Integration tests for OSGi DS 1.4 component property type annotations for Sling adapters
+    </description>
+
+    <properties>
+        <sling.java.version>8</sling.java.version>
+        <http.host>localhost</http.host>
+        <!-- start with -DkeepITServerRunning=true to allow to rerun ITs or inspect the server after the ITs have been executed there -->
+        <keepITServerRunning>false</keepITServerRunning>
+        <annotations.bundle.version>MUST_BE_SET_BY_INVOKER</annotations.bundle.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>3.0.0-M5</version>
+            </plugin>
+            <plugin>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-maven-plugin</artifactId>
+                <version>5.0.0</version>
+            </plugin>
+            <plugin>
+                <!-- Find free ports to run our server -->
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>reserve-server-port</id>
+                        <goals>
+                            <goal>reserve-network-port</goal>
+                        </goals>
+                        <phase>pre-integration-test</phase>
+                        <configuration>
+                            <portNames>
+                                <!-- used port name must be stored in property because it must be used for the base url -->
+                                <portName>http.port</portName>
+                            </portNames>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <!-- the Sling instance is provisioned from the model in src/main/provisioning/it-model.txt -->
+                <groupId>org.apache.sling</groupId>
+                <artifactId>slingstart-maven-plugin</artifactId>
+                <!-- for https://issues.apache.org/jira/browse/SLING-7662 -->
+                <version>1.8.2</version>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>customise-starter</id>
+                        <goals>
+                            <goal>prepare-package</goal>
+                        </goals>
+                        <configuration>
+                            <modelDirectory>${project.basedir}/src/test/provisioning</modelDirectory>
+                            <usePomDependencies>true</usePomDependencies>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>package-starter</id>
+                        <goals>
+                            <goal>package</goal>
+                        </goals>
+                        <configuration>
+                            <attachArtifact>false</attachArtifact>
+                            <modelDirectory>${project.basedir}/src/test/provisioning</modelDirectory>
+                            <usePomDependencies>true</usePomDependencies>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>start-container-before-IT</id>
+                        <goals>
+                            <goal>start</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>stop-container-after-IT</id>
+                        <goals>
+                            <goal>stop</goal>
+                        </goals>
+                        <configuration>
+                            <shouldBlockUntilKeyIsPressed>${keepITServerRunning}</shouldBlockUntilKeyIsPressed>
+                        </configuration>
+                    </execution>
+                </executions>
+                <configuration>
+                    <servers>
+                        <!-- this configuration applies to both 'start' and 'stop' -->
+                        <server>
+                            <id>singleinstance</id>
+                            <port>${http.port}</port>
+                            <vmOpts>${sling.vm.options}</vmOpts>
+                            <stdOutFile>sling/logs/stdout.log</stdOutFile>
+                        </server>
+                    </servers>
+                    <!-- this configuration only applies to 'prepare-package' and 'package' -->
+                    <disableExtendingMavenClasspath>true</disableExtendingMavenClasspath>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <systemPropertyVariables>
+                        <baseUrl>http://${http.host}:${http.port}/</baseUrl>
+                        <bundleFile>${project.build.directory}/${project.build.finalName}.jar</bundleFile>
+                        <bundleSymbolicName>${project.artifactId}</bundleSymbolicName>
+                    </systemPropertyVariables>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <!-- The bundle under test -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.adapter.annotations</artifactId>
+            <version>${annotations.bundle.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+            <version>1.3.0</version><!-- to be compliant with DS 1.3 -->
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <!-- keep the version in sync with it-model-txt (SLING-8080) -->
+            <version>2.20.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.adapter</artifactId>
+            <version>2.1.10</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- testing dependencies -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.servlets.resolver</artifactId>
+            <!-- keep the version in sync with it-model-txt (SLING-8080) -->
+            <version>2.5.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.clients</artifactId>
+            <version>2.0.6</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.rules</artifactId>
+            <version>2.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.core</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/AbstractNoOpAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/AbstractNoOpAdapterFactory.java
new file mode 100644
index 0000000..9c82cdd
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/AbstractNoOpAdapterFactory.java
@@ -0,0 +1,29 @@
+/*
+ * 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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.api.adapter.AdapterFactory;
+
+public abstract class AbstractNoOpAdapterFactory implements AdapterFactory {
+    public static final String INVALID_CONFIGURATION_MESSAGE = "Configuration is invalid";
+
+    @Override
+    @SuppressWarnings("squid:S00119")
+    public <AdapterType> AdapterType getAdapter(final Object adaptable, final Class<AdapterType> type) {
+        return null;
+    }
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/DeprecatedAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/DeprecatedAdapterFactory.java
new file mode 100644
index 0000000..07dfec4
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/DeprecatedAdapterFactory.java
@@ -0,0 +1,35 @@
+/*
+ * 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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.adapter.annotations.AdapterDeprecated;
+import org.apache.sling.adapter.annotations.SlingAdapter;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.apache.sling.api.resource.Resource;
+import org.osgi.service.component.annotations.Component;
+
+@Component(service = AdapterFactory.class)
+@SlingAdapter(adaptables = SlingHttpServletRequest.class, adapters = Resource.class)
+@AdapterDeprecated // Just use request.getResource()
+public class DeprecatedAdapterFactory implements AdapterFactory {
+    @Override
+    @SuppressWarnings({"squid:S00119", "unchecked"})
+    public <AdapterType> AdapterType getAdapter(final Object adaptable, final Class<AdapterType> type) {
+        return (AdapterType)((SlingHttpServletRequest)adaptable).getResource();
+    }
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/IntegerAndShortToLongAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/IntegerAndShortToLongAdapterFactory.java
new file mode 100644
index 0000000..b848b53
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/IntegerAndShortToLongAdapterFactory.java
@@ -0,0 +1,29 @@
+/*
+ * 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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.adapter.annotations.SlingAdapter;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.osgi.service.component.annotations.Component;
+
+@Component(service = AdapterFactory.class)
+@SlingAdapter(
+        adaptables = {Integer.class, Short.class},
+        adapters = Long.class
+)
+public class IntegerAndShortToLongAdapterFactory extends AbstractNoOpAdapterFactory {
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidEmptyAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidEmptyAdapterFactory.java
new file mode 100644
index 0000000..3135e71
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidEmptyAdapterFactory.java
@@ -0,0 +1,28 @@
+/*
+ * 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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.adapter.annotations.AdapterCondition;
+import org.apache.sling.adapter.annotations.SlingAdapter;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.osgi.service.component.annotations.Component;
+
+@Component(service = AdapterFactory.class)
+@SlingAdapter(adaptables = {}, adapters = {})
+@AdapterCondition(AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)
+public class InvalidEmptyAdapterFactory extends AbstractNoOpAdapterFactory {
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidNoAdaptablesAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidNoAdaptablesAdapterFactory.java
new file mode 100644
index 0000000..0c98d90
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidNoAdaptablesAdapterFactory.java
@@ -0,0 +1,28 @@
+/*
+ * 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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.adapter.annotations.AdapterCondition;
+import org.apache.sling.adapter.annotations.SlingAdapter;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.osgi.service.component.annotations.Component;
+
+@Component(service = AdapterFactory.class)
+@SlingAdapter(adaptables = {}, adapters = Void.class)
+@AdapterCondition(AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)
+public class InvalidNoAdaptablesAdapterFactory extends AbstractNoOpAdapterFactory {
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidNoAdaptersAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidNoAdaptersAdapterFactory.java
new file mode 100644
index 0000000..d7cb8ca
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/InvalidNoAdaptersAdapterFactory.java
@@ -0,0 +1,28 @@
+/*
+ * 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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.adapter.annotations.AdapterCondition;
+import org.apache.sling.adapter.annotations.SlingAdapter;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.osgi.service.component.annotations.Component;
+
+@Component(service = AdapterFactory.class)
+@SlingAdapter(adaptables = Void.class, adapters = {})
+@AdapterCondition(AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)
+public class InvalidNoAdaptersAdapterFactory extends AbstractNoOpAdapterFactory {
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/LongToIntegerIfFitsAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/LongToIntegerIfFitsAdapterFactory.java
new file mode 100644
index 0000000..f134243
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/LongToIntegerIfFitsAdapterFactory.java
@@ -0,0 +1,32 @@
+/*
+ * 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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.adapter.annotations.AdapterCondition;
+import org.apache.sling.adapter.annotations.SlingAdapter;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.osgi.service.component.annotations.Component;
+
+@Component(service = AdapterFactory.class)
+@SlingAdapter(
+        adaptables = Long.class,
+        adapters = Integer.class
+)
+@AdapterCondition(LongToIntegerIfFitsAdapterFactory.CONDITION)
+public class LongToIntegerIfFitsAdapterFactory extends AbstractNoOpAdapterFactory {
+    public static final String CONDITION = "If the value is small enough to fit in an integer.";
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/ShortToIntegerAndLongAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/ShortToIntegerAndLongAdapterFactory.java
new file mode 100644
index 0000000..74d77e1
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/ShortToIntegerAndLongAdapterFactory.java
@@ -0,0 +1,26 @@
+/*
+ * 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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.adapter.annotations.SlingAdapter;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.osgi.service.component.annotations.Component;
+
+@Component(service = AdapterFactory.class)
+@SlingAdapter(adaptables = Short.class, adapters = {Integer.class, Long.class})
+public class ShortToIntegerAndLongAdapterFactory extends AbstractNoOpAdapterFactory {
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/TextLengthIfFitsAdapterFactory.java b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/TextLengthIfFitsAdapterFactory.java
new file mode 100644
index 0000000..0af1e61
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/adapter/annotations/testing/adapters/TextLengthIfFitsAdapterFactory.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.adapter.annotations.testing.adapters;
+
+import org.apache.sling.adapter.annotations.AdapterCondition;
+import org.apache.sling.adapter.annotations.SlingAdapter;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.osgi.service.component.annotations.Component;
+
+import java.math.BigInteger;
+
+@Component(service = AdapterFactory.class)
+@SlingAdapter(
+        adaptables = {CharSequence.class, String.class},
+        adapters = {Short.class, Integer.class, Long.class, BigInteger.class}
+)
+@AdapterCondition(TextLengthIfFitsAdapterFactory.CONDITION)
+public class TextLengthIfFitsAdapterFactory extends AbstractNoOpAdapterFactory {
+    public static final String CONDITION = "If the text length fits in the requested type.";
+}
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterAnnotationsIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterAnnotationsIT.java
new file mode 100644
index 0000000..a24da5b
--- /dev/null
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterAnnotationsIT.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.adapter.annotations;
+
+import org.apache.sling.testing.clients.ClientException;
+import org.junit.Test;
+
+public interface AdapterAnnotationsIT {
+    @Test
+    void testLongToIntegerIfFitsAdapterFactory() throws ClientException;
+
+    @Test
+    void testTextLengthIfFitsAdapterFactory() throws ClientException;
+
+    @Test
+    void testShortToIntegerAndLongAdapterFactory() throws ClientException;
+
+    @Test
+    void testIntegerAndShortToLongAdapterFactory() throws ClientException;
+
+    @Test
+    void testDeprecatedAdapterFactory() throws ClientException;
+
+    @Test
+    void testInvalidAdapterFactories() throws ClientException;
+}
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterRegistrationIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterRegistrationIT.java
new file mode 100644
index 0000000..1b60716
--- /dev/null
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterRegistrationIT.java
@@ -0,0 +1,128 @@
+/*
+ * 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.adapter.annotations;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.sling.adapter.Adaption;
+import org.apache.sling.adapter.annotations.util.AppSlingClient;
+import org.apache.sling.adapter.annotations.util.Util;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.testing.clients.ClientException;
+import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
+import org.apache.sling.testing.clients.osgi.ServiceInfo;
+import org.apache.sling.testing.clients.osgi.ServicesInfo;
+import org.apache.sling.testing.clients.util.JsonUtils;
+import org.codehaus.jackson.JsonNode;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeoutException;
+import java.util.function.UnaryOperator;
+
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+
+public class AdapterRegistrationIT implements AdapterAnnotationsIT {
+    private static Set<Map<String, Object>> registeredAdaptions;
+
+    @BeforeClass
+    public static void setUpAdaptions() throws ClientException, InterruptedException, TimeoutException, URISyntaxException, IOException {
+        try (final OsgiConsoleClient client = AppSlingClient.newSlingClient().adaptTo(OsgiConsoleClient.class)) {
+            registeredAdaptions = new HashSet<>();
+            final String servicesJsonString = client.doGet("/system/console/services.json").getContent();
+            final ServicesInfo services = new ServicesInfo(JsonUtils.getJsonNodeFromString(servicesJsonString));
+            for (final ServiceInfo serviceInfo : services.forType(Adaption.class.getName())) {
+                final String serviceJsonString = client.doGet("/system/console/services/" + serviceInfo.getId() + ".json").getContent();
+                try {
+                    final JsonNode serviceJson = JsonUtils.getJsonNodeFromString(serviceJsonString);
+                    registeredAdaptions.add(Util.getNonDynamicPropertiesForService(serviceJson));
+                } catch (final ClientException e) {
+                    System.err.println("Unable to find proper JSON content for " + serviceJsonString + " - skipping.");
+                    e.printStackTrace(System.err);
+                }
+            }
+        }
+    }
+
+    @Override
+    @Test
+    public void testLongToIntegerIfFitsAdapterFactory() {
+        assertAdaption(properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Long.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Integer.class.getName())));
+    }
+
+    @Override
+    @Test
+    public void testTextLengthIfFitsAdapterFactory() {
+        assertAdaption(properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Arrays.asList(CharSequence.class.getName(), String.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Arrays.asList(
+                        Short.class.getName(),
+                        Integer.class.getName(),
+                        Long.class.getName(),
+                        BigInteger.class.getName())));
+    }
+
+    @Override
+    @Test
+    public void testShortToIntegerAndLongAdapterFactory() {
+        assertAdaption(properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Short.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Arrays.asList(Integer.class.getName(), Long.class.getName())));
+    }
+
+    @Override
+    @Test
+    public void testIntegerAndShortToLongAdapterFactory() {
+        assertAdaption(properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Arrays.asList(Integer.class.getName(), Short.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Long.class.getName())));
+    }
+
+    @Override
+    @Test
+    public void testDeprecatedAdapterFactory() {
+        assertAdaption(properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(SlingHttpServletRequest.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Resource.class.getName())));
+    }
+
+    @Override
+    @Test
+    public void testInvalidAdapterFactories() {
+        assertFalse(registeredAdaptions.stream().anyMatch(properties -> properties.containsValue(Collections.singletonList(Void.class.getName()))));
+    }
+
+    private static void assertAdaption(final UnaryOperator<ImmutableMap.Builder<String, Object>> properties) {
+        assertThat(registeredAdaptions, hasItem(properties.apply(ImmutableMap.<String, Object>builder()
+                .put(Constants.SERVICE_SCOPE, Constants.SCOPE_SINGLETON)
+        ).build()));
+    }
+}
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterStatusIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterStatusIT.java
new file mode 100644
index 0000000..4760138
--- /dev/null
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterStatusIT.java
@@ -0,0 +1,104 @@
+/*
+ * 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.adapter.annotations;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.adapter.annotations.testing.adapters.AbstractNoOpAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.LongToIntegerIfFitsAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.TextLengthIfFitsAdapterFactory;
+import org.apache.sling.adapter.annotations.util.AppConstants;
+import org.apache.sling.adapter.annotations.util.AppSlingClient;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.testing.clients.ClientException;
+import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.URISyntaxException;
+import java.util.concurrent.TimeoutException;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertThat;
+
+public class AdapterStatusIT implements AdapterAnnotationsIT {
+    private static String adaptersStatus;
+
+    @BeforeClass
+    public static void setUpAdaptersStatus() throws ClientException, InterruptedException, TimeoutException, URISyntaxException, IOException {
+        try (final OsgiConsoleClient client = AppSlingClient.newSlingClient().adaptTo(OsgiConsoleClient.class)) {
+            adaptersStatus = client.doGet("/system/console/status-adapters.txt").getContent();
+            adaptersStatus = StringUtils.replace(adaptersStatus, "\r", StringUtils.EMPTY); // Prevent platform-specific issues
+        }
+    }
+
+    @Override
+    @Test
+    public void testLongToIntegerIfFitsAdapterFactory() {
+        assertAdapterDescriptor(Long.class, LongToIntegerIfFitsAdapterFactory.CONDITION, Integer.class);
+    }
+
+    @Override
+    @Test
+    public void testShortToIntegerAndLongAdapterFactory() {
+        assertAdapterDescriptor(Short.class, null, Integer.class, Long.class);
+    }
+
+    @Override
+    @Test
+    public void testIntegerAndShortToLongAdapterFactory() {
+        assertAdapterDescriptor(Integer.class, null, Long.class);
+        assertAdapterDescriptor(Short.class, null, Long.class);
+    }
+
+    @Override
+    @Test
+    public void testTextLengthIfFitsAdapterFactory() {
+        assertAdapterDescriptor(CharSequence.class, TextLengthIfFitsAdapterFactory.CONDITION, Short.class, Integer.class, Long.class, BigInteger.class);
+        assertAdapterDescriptor(String.class, TextLengthIfFitsAdapterFactory.CONDITION, Short.class, Integer.class, Long.class, BigInteger.class);
+    }
+
+    @Override
+    @Test
+    public void testDeprecatedAdapterFactory() {
+        // Deprecated status is not dumped on the status page
+        assertAdapterDescriptor(SlingHttpServletRequest.class, null, Resource.class);
+    }
+
+    @Override
+    @Test
+    public void testInvalidAdapterFactories() {
+        assertThat(adaptersStatus, not(containsString("\nCondition: " + AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE + "\n")));
+    }
+
+    private static void assertAdapterDescriptor(final Class<?> adaptable, final String condition, final Class<?>... adapters) {
+        final StringBuilder descriptor = new StringBuilder("\nAdaptable: ").append(adaptable.getName()).append("\n");
+        if (condition != null) {
+            descriptor.append("Condition: ").append(condition).append("\n");
+        }
+        descriptor.append("Providing Bundle: ").append(AppConstants.BUNDLE_SYMBOLIC_NAME).append("\n");
+        descriptor.append("Available Adapters:\n");
+        for (final Class<?> adapter : adapters) {
+            descriptor.append(" * ").append(adapter.getName()).append("\n");
+        }
+        descriptor.append("\n");
+        assertThat(adaptersStatus, containsString(descriptor.toString()));
+    }
+}
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/ServicePropertiesIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/ServicePropertiesIT.java
new file mode 100644
index 0000000..2d896d4
--- /dev/null
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/ServicePropertiesIT.java
@@ -0,0 +1,180 @@
+/*
+ * 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.adapter.annotations;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.sling.adapter.annotations.testing.adapters.AbstractNoOpAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.DeprecatedAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.InvalidNoAdaptablesAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.InvalidEmptyAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.InvalidNoAdaptersAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.ShortToIntegerAndLongAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.LongToIntegerIfFitsAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.IntegerAndShortToLongAdapterFactory;
+import org.apache.sling.adapter.annotations.testing.adapters.TextLengthIfFitsAdapterFactory;
+import org.apache.sling.adapter.annotations.util.AppSlingClient;
+import org.apache.sling.adapter.annotations.util.Util;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.adapter.AdapterFactory;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.testing.clients.ClientException;
+import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
+import org.apache.sling.testing.clients.util.JsonUtils;
+import org.codehaus.jackson.JsonNode;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+import org.osgi.service.component.ComponentConstants;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.TimeoutException;
+import java.util.function.UnaryOperator;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServicePropertiesIT implements AdapterAnnotationsIT {
+    private static final String ADAPTER_CONDITION = "adapter.condition";
+    private static final String ADAPTER_DEPRECATED = "adapter.deprecated";
+
+    private static OsgiConsoleClient client;
+
+    @BeforeClass
+    public static void setUpOnce() throws InterruptedException, TimeoutException, ClientException, URISyntaxException {
+        client = AppSlingClient.newSlingClient().adaptTo(OsgiConsoleClient.class);
+    }
+
+    @AfterClass
+    public static void tearDown() throws IOException {
+        if (client != null) {
+            client.close();
+        }
+    }
+
+    @Override
+    @Test
+    public void testLongToIntegerIfFitsAdapterFactory() throws ClientException {
+        assertProperties(LongToIntegerIfFitsAdapterFactory.class.getName(), properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Long.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Integer.class.getName()))
+                .put(ADAPTER_CONDITION, LongToIntegerIfFitsAdapterFactory.CONDITION));
+    }
+
+    @Override
+    @Test
+    public void testTextLengthIfFitsAdapterFactory() throws ClientException {
+        assertProperties(TextLengthIfFitsAdapterFactory.class.getName(), properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Arrays.asList(CharSequence.class.getName(), String.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Arrays.asList(
+                        Short.class.getName(),
+                        Integer.class.getName(),
+                        Long.class.getName(),
+                        BigInteger.class.getName()
+                ))
+                .put(ADAPTER_CONDITION, TextLengthIfFitsAdapterFactory.CONDITION));
+    }
+
+    @Override
+    @Test
+    public void testShortToIntegerAndLongAdapterFactory() throws ClientException {
+        assertProperties(ShortToIntegerAndLongAdapterFactory.class.getName(), properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Short.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Arrays.asList(Integer.class.getName(), Long.class.getName())));
+    }
+
+    @Override
+    @Test
+    public void testIntegerAndShortToLongAdapterFactory() throws ClientException {
+        assertProperties(IntegerAndShortToLongAdapterFactory.class.getName(), properties -> properties
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Arrays.asList(Integer.class.getName(), Short.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Long.class.getName())));
+    }
+
+    @Test
+    public void testInvalidMissingAdaptablesAndAdaptersAdapter() throws ClientException {
+        assertProperties(InvalidEmptyAdapterFactory.class.getName(), properties -> properties
+                .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE));
+    }
+
+    @Test
+    public void testInvalidMissingAdaptablesAdapter() throws ClientException {
+        assertProperties(InvalidNoAdaptablesAdapterFactory.class.getName(), properties -> properties
+                .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)
+                .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Void.class.getName())));
+    }
+
+    @Test
+    public void testInvalidMissingAdaptersAdapter() throws ClientException {
+        assertProperties(InvalidNoAdaptersAdapterFactory.class.getName(), properties -> properties
+                .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Void.class.getName())));
+    }
+
+    @Override
+    @Test
+    public void testDeprecatedAdapterFactory() throws ClientException {
+        assertProperties(DeprecatedAdapterFactory.class.getName(), properties -> properties
+                .put(ADAPTER_DEPRECATED, true)
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(SlingHttpServletRequest.class.getName()))
+                .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Resource.class.getName())));
+    }
+
+    @Override
+    @Test
+    public void testInvalidAdapterFactories() throws ClientException {
+        assertProperties(InvalidEmptyAdapterFactory.class.getName(), properties -> properties
+                .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE));
+        assertProperties(InvalidNoAdaptablesAdapterFactory.class.getName(), properties -> properties
+                .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)
+                .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Void.class.getName())));
+        assertProperties(InvalidNoAdaptersAdapterFactory.class.getName(), properties -> properties
+                .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)
+                .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Void.class.getName())));
+    }
+
+    private static void assertProperties(final String componentName,
+                                         final UnaryOperator<ImmutableMap.Builder<String, Object>> properties) throws ClientException {
+        final Map<String, Object> expected = properties.apply(ImmutableMap.<String, Object>builder()
+                .put(ComponentConstants.COMPONENT_NAME, componentName)
+                .put(Constants.SERVICE_SCOPE, Constants.SCOPE_BUNDLE))
+                .build();
+        assertEquals(expected, getNonDynamicPropertiesOfComponentService(componentName));
+    }
+
+    private static Map<String, Object> getNonDynamicPropertiesOfComponentService(final String nameOrId) throws ClientException {
+        final JsonNode componentJson = JsonUtils.getJsonNodeFromString(
+                client.doGet("/system/console/components/" + nameOrId + ".json").getContent());
+        final JsonNode serviceJson = JsonUtils.getJsonNodeFromString(
+                client.doGet("/system/console/services/" + getServiceIdFromComponentJson(componentJson) + ".json").getContent());
+        return Util.getNonDynamicPropertiesForService(serviceJson);
+    }
+
+    private static int getServiceIdFromComponentJson(final JsonNode componentJson) {
+        final JsonNode props = componentJson.get("data").get(0).get("props");
+        for (final JsonNode prop : props) {
+            if ("serviceId".equals(prop.get("key").getValueAsText())) {
+                return Integer.parseInt(prop.get("value").getValueAsText());
+            }
+        }
+        throw new AssertionError("No service ID found");
+    }
+}
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppConstants.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppConstants.java
new file mode 100644
index 0000000..9e987f6
--- /dev/null
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppConstants.java
@@ -0,0 +1,26 @@
+/*
+ * 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.adapter.annotations.util;
+
+public class AppConstants {
+    public AppConstants() {
+        // Constants class
+    }
+
+    public static final String BUNDLE_SYMBOLIC_NAME = System.getProperty("bundleSymbolicName");
+    public static final String BUNDLE_FILE = System.getProperty("bundleFile");
+}
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppSlingClient.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppSlingClient.java
new file mode 100644
index 0000000..63c058e
--- /dev/null
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppSlingClient.java
@@ -0,0 +1,48 @@
+/*
+ * 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.adapter.annotations.util;
+
+import org.apache.sling.testing.clients.ClientException;
+import org.apache.sling.testing.clients.SlingClient;
+import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
+import org.apache.sling.testing.clients.util.poller.Polling;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.concurrent.TimeoutException;
+
+public class AppSlingClient {
+    private static boolean bundleInstalledAndStarted;
+
+    @SuppressWarnings("squid:S2095") // Caller will close the client
+    public static SlingClient newSlingClient() throws URISyntaxException, ClientException, TimeoutException, InterruptedException {
+        final SlingClient client = new SlingClient(new URI(System.getProperty("baseUrl")), "admin", "admin");
+
+        // client.waitExists() adds ".json" to the path, which is not desired, since that requests the Sling Default GET Servlet instead of Sling Starter HTML
+        new Polling(() -> client.doGet("/starter/index.html").getStatusLine().getStatusCode() == 200)
+                .poll(60_000, 500);
+
+        if (!bundleInstalledAndStarted) {
+            final OsgiConsoleClient osgiConsoleClient = client.adaptTo(OsgiConsoleClient.class);
+            osgiConsoleClient.waitInstallBundle(new File(AppConstants.BUNDLE_FILE), true, -1, 10_000, 500);
+            osgiConsoleClient.waitBundleStarted(AppConstants.BUNDLE_SYMBOLIC_NAME, 10_000, 500);
+            bundleInstalledAndStarted = true;
+        }
+        return client;
+    }
+}
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/Util.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/Util.java
new file mode 100644
index 0000000..960a2af
--- /dev/null
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/Util.java
@@ -0,0 +1,68 @@
+/*
+ * 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.adapter.annotations.util;
+
+import org.codehaus.jackson.JsonNode;
+import org.osgi.framework.Constants;
+import org.osgi.service.component.ComponentConstants;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class Util {
+    private static final Set<String> DYNAMIC_PROPERTIES = new HashSet<>(Arrays.asList(
+            ComponentConstants.COMPONENT_ID,
+            Constants.SERVICE_BUNDLEID
+    ));
+
+    public static Map<String, Object> getNonDynamicPropertiesForService(final JsonNode json) {
+        final JsonNode props = json.get("data").get(0).get("props");
+        final Map<String, Object> properties = new LinkedHashMap<>();
+        for (final JsonNode prop : props) {
+            final String name = prop.get("key").getTextValue();
+            if (!DYNAMIC_PROPERTIES.contains(name)) {
+                properties.put(name, getPropertyValue(prop.get("value")));
+            }
+        }
+        return properties;
+    }
+
+    private static Object getPropertyValue(final JsonNode value) {
+        if (value.isBoolean()) {
+            return value.getBooleanValue();
+        }
+        if (value.isNumber()) {
+            return value.getNumberValue();
+        }
+        if (value.isTextual()) {
+            return value.getTextValue();
+        }
+        if (value.isArray()) {
+            final List<String> items = new ArrayList<>();
+            for (final JsonNode item : value) {
+                items.add(item.getTextValue());
+            }
+            return items;
+        }
+        return null;
+    }
+}
diff --git a/src/it/annotations-it/src/test/provisioning/it-model.txt b/src/it/annotations-it/src/test/provisioning/it-model.txt
new file mode 100644
index 0000000..dd1379b
--- /dev/null
+++ b/src/it/annotations-it/src/test/provisioning/it-model.txt
@@ -0,0 +1,25 @@
+#
+#  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=adapter-annotations-it]
+
+# Dependencies
+[artifacts]
+    org.apache.sling/org.apache.sling.starter/11/slingstart
+    org.apache.sling/org.apache.sling.api/2.20.0
+    org.apache.sling/org.apache.sling.servlets.resolver/2.5.2
\ No newline at end of file
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 0000000..3404fda
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,59 @@
+<?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.
+-->
+
+<!--
+    As per https://maven.apache.org/plugins/maven-invoker-plugin/examples/fast-use.html
+    this lets invoked builds grab artifacts from the local repository instead of
+    downloading all of them.
+-->
+<settings>
+    <profiles>
+    <profile>
+        <id>it-repo</id>
+        <activation>
+        <activeByDefault>true</activeByDefault>
+        </activation>
+        <repositories>
+        <repository>
+            <id>local.central</id>
+            <url>@localRepositoryUrl@</url>
+            <releases>
+            <enabled>true</enabled>
+            </releases>
+            <snapshots>
+            <enabled>true</enabled>
+            </snapshots>
+        </repository>
+        </repositories>
+        <pluginRepositories>
+        <pluginRepository>
+            <id>local.central</id>
+            <url>@localRepositoryUrl@</url>
+            <releases>
+            <enabled>true</enabled>
+            </releases>
+            <snapshots>
+            <enabled>true</enabled>
+            </snapshots>
+        </pluginRepository>
+        </pluginRepositories>
+    </profile>
+    </profiles>
+</settings>
\ No newline at end of file