This is an automated email from the ASF dual-hosted git repository.
bdelacretaz pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations-it.git
The following commit(s) were added to refs/heads/master by this push:
new 3cec5d9 SLING-9930 - deprecate this module
3cec5d9 is described below
commit 3cec5d9b50ec347f96dacab72c4a55076b7c8784
Author: Bertrand Delacretaz <[email protected]>
AuthorDate: Wed Nov 25 14:49:21 2020 +0100
SLING-9930 - deprecate this module
---
.asf.yaml | 3 +-
Jenkinsfile | 20 --
README.md | 10 +-
bnd.bnd | 6 -
pom.xml | 222 ---------------------
.../annotations/services/PathBoundService.java | 25 ---
.../services/PathBoundStrictAllOptionsService.java | 30 ---
.../services/PathBoundStrictJustPathService.java | 25 ---
.../testservletfilters/SimpleServletFilter.java | 63 ------
.../BaseResourceTypeBoundServletWithSelectors.java | 45 -----
.../InheritingResourceTypeBoundServlet.java | 45 -----
.../annotations/testservlets/PathBoundServlet.java | 53 -----
.../testservlets/PathBoundServletWithPrefix.java | 45 -----
.../testservlets/ResourceTypeBoundServlet.java | 48 -----
.../ResourceTypeBoundServletWithExtension.java | 48 -----
.../ResourceTypeBoundServletWithMethods.java | 53 -----
.../ResourceTypeBoundServletWithPrefix.java | 50 -----
.../ResourceTypeBoundServletWithSelectors.java | 48 -----
.../SLING-CONTENT/content/servlettest.json | 3 -
.../baseResourceTypeBoundServletWithSelectors.json | 4 -
.../inheritingResourceTypeBoundServlet.json | 4 -
.../servlettest/resourceTypeBoundServlet.json | 4 -
.../resourceTypeBoundServletWithExtension.json | 4 -
.../resourceTypeBoundServletWithMethods.json | 4 -
.../resourceTypeBoundServletWithPrefix.json | 4 -
.../resourceTypeBoundServletWithSelectors.json | 4 -
.../servlets/annotations/ServicePropertiesIT.java | 116 -----------
.../annotations/ServletRegistrationIT.java | 115 -----------
.../sling/servlets/annotations/TestSupport.java | 69 -------
src/test/provisioning/it-model.txt | 25 ---
30 files changed, 8 insertions(+), 1187 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index 13edb4d..3bbfff8 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -1,8 +1,9 @@
github:
- description: "Apache Sling Servlet Annotations Integration Tests"
+ description: "Apache Sling Servlet Annotations Integration Tests
(deprecated)"
homepage: "https://sling.apache.org/"
labels:
- sling
- java
- annotations
- servlets
+ - deprecated
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index f582519..0000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * 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.
- */
-
-slingOsgiBundleBuild()
diff --git a/README.md b/README.md
index 910d7b2..0743f71 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,11 @@
[](https://sling.apache.org)
- [](https://ci-builds.apache.org/job/Sling/job/modules/job/sling-org-apache-sling-servlets-annotations-it/job/master/) [](https://ci-builds.apache.org/job/Sling/job/mo
[...]
-
-# Apache Sling Servlets Annotations IT
+# Apache Sling Servlets Annotations IT (deprecated)
This module is part of the [Apache Sling](https://sling.apache.org) project.
-Integration tests for OSGi DS 1.4 [component property type
annotations](https://github.com/apache/sling-org-apache-sling-servlets-annotations)
for Sling servlets and filters
+It is now deprecated, the integration tests have been moved inside the
+[sling-servlets-annotations](https://github.com/apache/sling-org-apache-sling-servlets-annotations)
+module.
+
+This modules's code has been saved to the `maintenance` branch before
deprecation.
diff --git a/bnd.bnd b/bnd.bnd
deleted file mode 100644
index 539b4ad..0000000
--- a/bnd.bnd
+++ /dev/null
@@ -1,6 +0,0 @@
-Sling-Initial-Content:
SLING-CONTENT/content/servlettest;overwrite:=true;path:=/content/servlettest
-
-# This simulates using the right version of the servlets resolver bundle,
-# for the SlingServletPathsStrict annotation
-Provide-Capability:\
-
osgi.extender;osgi.extender="org.apache.sling.servlets.resolver";version:Version="1.1"
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index ece21f7..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,222 +0,0 @@
-<?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/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.sling</groupId>
- <artifactId>sling</artifactId>
- <version>33</version>
- <relativePath/>
- </parent>
-
- <artifactId>org.apache.sling.servlets.annotations.it</artifactId>
- <version>1.0.0-SNAPSHOT</version>
-
- <name>Apache Sling Servlets Annotations IT</name>
- <description>
- Integration tests for OSGi DS 1.4 component property type annotations
for Sling servlets and filters
- </description>
-
- <scm>
-
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations-it.git</connection>
-
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations-it.git</developerConnection>
-
<url>https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-servlets-annotations-it.git</url>
- <tag>HEAD</tag>
- </scm>
-
- <!-- compile with java 7 -->
- <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>
- </properties>
-
- <build>
- <plugins>
- <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>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <!-- dependency under test -->
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.servlets.annotations</artifactId>
- <version>1.2.5-SNAPSHOT</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>
- <version>2.20.0</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>
- <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>
- <!-- for https://issues.apache.org/jira/browse/SLING-7680 -->
- <version>1.2.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.testing.rules</artifactId>
- <version>1.0.8</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>
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundService.java
b/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundService.java
deleted file mode 100644
index 3e37c06..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.servlets.annotations.services;
-
-import org.apache.sling.servlets.annotations.SlingServletPaths;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Object.class)
-@SlingServletPaths("PathBoundServicePath")
-public class PathBoundService {
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundStrictAllOptionsService.java
b/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundStrictAllOptionsService.java
deleted file mode 100644
index 93aa9c6..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundStrictAllOptionsService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.servlets.annotations.services;
-
-import org.apache.sling.servlets.annotations.SlingServletPathsStrict;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Object.class)
-@SlingServletPathsStrict(
- paths = {"P1","P2"},
- selectors = { "S1", "S2"},
- extensions = { "E1", "E2"},
- methods = { "M1", "M2"}
-)
-public class PathBoundStrictAllOptionsService {
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundStrictJustPathService.java
b/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundStrictJustPathService.java
deleted file mode 100644
index c32f5ca..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/services/PathBoundStrictJustPathService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.servlets.annotations.services;
-
-import org.apache.sling.servlets.annotations.SlingServletPathsStrict;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Object.class)
-@SlingServletPathsStrict(paths = "JustThePath")
-public class PathBoundStrictJustPathService {
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservletfilters/SimpleServletFilter.java
b/src/main/java/org/apache/sling/servlets/annotations/testservletfilters/SimpleServletFilter.java
deleted file mode 100644
index b7c653a..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservletfilters/SimpleServletFilter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.servlets.annotations.testservletfilters;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.servlets.annotations.SlingServletFilter;
-import org.apache.sling.servlets.annotations.SlingServletFilterScope;
-import org.osgi.service.component.annotations.Component;
-
-@Component
-@SlingServletFilter(scope=SlingServletFilterScope.REQUEST)
-public class SimpleServletFilter implements Filter {
-
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
- }
-
- @Override
- public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
- chain.doFilter(request, response);
- if ((request instanceof SlingHttpServletRequest) && (response
instanceof SlingHttpServletResponse)) {
- afterDoFilter((SlingHttpServletRequest) request,
(SlingHttpServletResponse) response, chain);
- } else {
- throw new ServletException("Not a Sling HTTP request/response");
- }
- }
-
- private void afterDoFilter(SlingHttpServletRequest request,
SlingHttpServletResponse response, FilterChain chain) {
- if (request.getRequestURI().endsWith("simplefilter")) {
- // increase status by 1
- response.setStatus(response.getStatus()+1);
- }
- }
-
- @Override
- public void destroy() {
- }
-
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/BaseResourceTypeBoundServletWithSelectors.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/BaseResourceTypeBoundServletWithSelectors.java
deleted file mode 100644
index 331360b..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/BaseResourceTypeBoundServletWithSelectors.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
-import org.osgi.service.component.annotations.Component;
-
-@Component(
- service = Servlet.class
-)
-@SlingServletResourceTypes(
- resourceTypes =
"sling/testservlets/BaseResourceTypeBoundServletWithSelectors",
- selectors = {"sel1", "sel2"}
-)
-public class BaseResourceTypeBoundServletWithSelectors extends
SlingSafeMethodsServlet {
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) {
- response.setStatus(610);
- }
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/InheritingResourceTypeBoundServlet.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/InheritingResourceTypeBoundServlet.java
deleted file mode 100644
index 93e69f7..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/InheritingResourceTypeBoundServlet.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
-import org.osgi.service.component.annotations.Component;
-
-@Component(
- service = Servlet.class
-)
-@SlingServletResourceTypes(
- resourceTypes =
"sling/testservlets/InheritingResourceTypeBoundServlet",
- resourceSuperType =
"sling/testservlets/BaseResourceTypeBoundServletWithSelectors"
-)
-public class InheritingResourceTypeBoundServlet extends
SlingSafeMethodsServlet {
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(620);
- }
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/PathBoundServlet.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/PathBoundServlet.java
deleted file mode 100644
index baf7e28..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/PathBoundServlet.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletPaths;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Servlet.class)
-@SlingServletPaths("/bin/PathBoundServlet")
-public class PathBoundServlet extends SlingAllMethodsServlet {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(555);
- }
-
- @Override
- protected void doPost(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(556);
- }
-
- @Override
- protected void doPut(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(557);
- }
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/PathBoundServletWithPrefix.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/PathBoundServletWithPrefix.java
deleted file mode 100644
index 91d5b23..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/PathBoundServletWithPrefix.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletPaths;
-import org.apache.sling.servlets.annotations.SlingServletPrefix;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Servlet.class)
-@SlingServletPrefix("/bin/")
-@SlingServletPaths("PathBoundServletWithPrefix")
-public class PathBoundServletWithPrefix extends SlingSafeMethodsServlet {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(610);
- }
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServlet.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServlet.java
deleted file mode 100644
index f6774b5..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServlet.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Servlet.class)
-@SlingServletResourceTypes(resourceTypes="/apps/sling/testservlets/ResourceTypeBoundServlet")
-public class ResourceTypeBoundServlet extends SlingAllMethodsServlet {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(560);
- }
-
- @Override
- protected void doPost(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(561);
- }
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithExtension.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithExtension.java
deleted file mode 100644
index 2efc6fe..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithExtension.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Servlet.class)
-@SlingServletResourceTypes(resourceTypes="/apps/sling/testservlets/ResourceTypeBoundServletWithExtension",
extensions= {"ext1", "ext2"}, methods= {"PUT", "GET"})
-public class ResourceTypeBoundServletWithExtension extends
SlingAllMethodsServlet {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(570);
- }
-
- @Override
- protected void doPut(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(571);
- }
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithMethods.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithMethods.java
deleted file mode 100644
index 7cb5d5e..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithMethods.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Servlet.class)
-@SlingServletResourceTypes(resourceTypes="/apps/sling/testservlets/ResourceTypeBoundServletWithMethods",
methods= {"PUT", "POST"})
-public class ResourceTypeBoundServletWithMethods extends
SlingAllMethodsServlet {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(580);
- }
-
- @Override
- protected void doPut(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(581);
- }
-
- @Override
- protected void doPost(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(582);
- }
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithPrefix.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithPrefix.java
deleted file mode 100644
index fe57258..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithPrefix.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletPrefix;
-import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Servlet.class)
-@SlingServletPrefix("/apps/sling/testservlets/")
-@SlingServletResourceTypes(resourceTypes="ResourceTypeBoundServletWithPrefix")
-public class ResourceTypeBoundServletWithPrefix extends SlingAllMethodsServlet
{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(590);
- }
-
- @Override
- protected void doPut(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(591);
- }
-}
diff --git
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithSelectors.java
b/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithSelectors.java
deleted file mode 100644
index 74d3051..0000000
---
a/src/main/java/org/apache/sling/servlets/annotations/testservlets/ResourceTypeBoundServletWithSelectors.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.servlets.annotations.testservlets;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
-import org.osgi.service.component.annotations.Component;
-
-@Component(service=Servlet.class)
-@SlingServletResourceTypes(resourceTypes="/apps/sling/testservlets/ResourceTypeBoundServletWithSelectors",
selectors= {"selector1.selector2", "selector3"})
-public class ResourceTypeBoundServletWithSelectors extends
SlingAllMethodsServlet {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(600);
- }
-
- @Override
- protected void doPut(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
- response.setStatus(601);
- }
-}
diff --git a/src/main/resources/SLING-CONTENT/content/servlettest.json
b/src/main/resources/SLING-CONTENT/content/servlettest.json
deleted file mode 100644
index 225e5ce..0000000
--- a/src/main/resources/SLING-CONTENT/content/servlettest.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "jcr:primaryType" : "sling:Folder"
-}
diff --git
a/src/main/resources/SLING-CONTENT/content/servlettest/baseResourceTypeBoundServletWithSelectors.json
b/src/main/resources/SLING-CONTENT/content/servlettest/baseResourceTypeBoundServletWithSelectors.json
deleted file mode 100644
index 777b7ff..0000000
---
a/src/main/resources/SLING-CONTENT/content/servlettest/baseResourceTypeBoundServletWithSelectors.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"sling/testservlets/BaseResourceTypeBoundServletWithSelectors"
-}
diff --git
a/src/main/resources/SLING-CONTENT/content/servlettest/inheritingResourceTypeBoundServlet.json
b/src/main/resources/SLING-CONTENT/content/servlettest/inheritingResourceTypeBoundServlet.json
deleted file mode 100644
index 7ed030d..0000000
---
a/src/main/resources/SLING-CONTENT/content/servlettest/inheritingResourceTypeBoundServlet.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"sling/testservlets/InheritingResourceTypeBoundServlet"
-}
diff --git
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServlet.json
b/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServlet.json
deleted file mode 100644
index 49c8187..0000000
---
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServlet.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"/apps/sling/testservlets/ResourceTypeBoundServlet"
-}
diff --git
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithExtension.json
b/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithExtension.json
deleted file mode 100644
index 98562bb..0000000
---
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithExtension.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"/apps/sling/testservlets/ResourceTypeBoundServletWithExtension"
-}
diff --git
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithMethods.json
b/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithMethods.json
deleted file mode 100644
index 2d7bf22..0000000
---
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithMethods.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"/apps/sling/testservlets/ResourceTypeBoundServletWithMethods"
-}
diff --git
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithPrefix.json
b/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithPrefix.json
deleted file mode 100644
index d77f7ed..0000000
---
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithPrefix.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"/apps/sling/testservlets/ResourceTypeBoundServletWithPrefix"
-}
diff --git
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithSelectors.json
b/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithSelectors.json
deleted file mode 100644
index 9853c98..0000000
---
a/src/main/resources/SLING-CONTENT/content/servlettest/resourceTypeBoundServletWithSelectors.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"/apps/sling/testservlets/ResourceTypeBoundServletWithSelectors"
-}
diff --git
a/src/test/java/org/apache/sling/servlets/annotations/ServicePropertiesIT.java
b/src/test/java/org/apache/sling/servlets/annotations/ServicePropertiesIT.java
deleted file mode 100644
index 4ddbb31..0000000
---
a/src/test/java/org/apache/sling/servlets/annotations/ServicePropertiesIT.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.servlets.annotations;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.sling.servlets.annotations.services.PathBoundService;
-import
org.apache.sling.servlets.annotations.services.PathBoundStrictAllOptionsService;
-import
org.apache.sling.servlets.annotations.services.PathBoundStrictJustPathService;
-import org.apache.sling.testing.clients.ClientException;
-import org.apache.sling.testing.clients.util.JsonUtils;
-import org.codehaus.jackson.JsonNode;
-import org.junit.Test;
-
-/** Assuming servlet selection is tested in the servlets resolver module,
- * it's good enough to verify that the expected OSGi service properties
- * are set by our annotations - this is what this class does for some of
- * our test services.
- */
-public class ServicePropertiesIT extends TestSupport {
-
- private static String componentPath(Object nameOrId) {
- return "/system/console/components/" + nameOrId + ".json";
- }
-
- /** Getting service properties is not directly supported by the
OsgiConsoleClient */
- private List<String> getServiceProperties(String serviceName) throws
ClientException {
- // Need to get the component ID first, then its details
- final List<String> result = new ArrayList<>();
- final JsonNode idInfo =
JsonUtils.getJsonNodeFromString(CLIENT.doGet(componentPath(serviceName)).getContent());
- final String id = idInfo.get("data").get(0).get("id").getTextValue();
- assertTrue("Expecting non-null component ID", !id.equals("null"));
- final JsonNode details =
JsonUtils.getJsonNodeFromString(CLIENT.doGet(componentPath(id)).getContent());
- final JsonNode data = details.get("data").get(0);
- final JsonNode props = data.get("props");
- for(JsonNode prop : props) {
- if("Properties".equals(prop.get("key").getTextValue())) {
- for(JsonNode value : prop.get("value")) {
- result.add(value.getTextValue().replaceAll(" ",
"").trim());
- }
- }
- }
- return result;
- }
-
- private void assertProperty(List<String> props, String key, String value) {
- final String pattern = key + "=" + value;
- assertTrue(
- "Expecting " + pattern + " in " + props,
- props.stream().anyMatch(line -> line.equals(pattern))
- );
- }
-
- private void assertAbsentProperties(List<String> props, String ... keys) {
- for(String key : keys) {
- assertFalse(
- "Expecting " + key + " to be absent in " + props,
- props.stream().anyMatch(line -> line.startsWith(key))
- );
- }
- }
-
- @Test
- public void testPathBoundService() throws ClientException {
- final List<String> props =
getServiceProperties(PathBoundService.class.getName());
- assertProperty(props, "sling.servlet.paths", "[PathBoundServicePath]");
- assertAbsentProperties(
- props,
- "sling.servlet.extensions",
- "sling.servlet.selectors",
- "sling.servlet.methods",
- "sling.servlet.paths.strict"
- );
- }
-
- @Test
- public void testPathBoundStrictAllOptionsService() throws ClientException {
- final List<String> props =
getServiceProperties(PathBoundStrictAllOptionsService.class.getName());
- assertProperty(props, "sling.servlet.paths.strict", "true");
- assertProperty(props, "sling.servlet.paths", "[P1,P2]");
- assertProperty(props, "sling.servlet.extensions", "[E1,E2]");
- assertProperty(props, "sling.servlet.selectors", "[S1,S2]");
- assertProperty(props, "sling.servlet.methods", "[M1,M2]");
- }
-
- @Test
- public void testPathBoundStrictJustPathService() throws ClientException {
- final List<String> props =
getServiceProperties(PathBoundStrictJustPathService.class.getName());
- assertProperty(props, "sling.servlet.paths.strict", "true");
- assertProperty(props, "sling.servlet.paths", "[JustThePath]");
- assertAbsentProperties(
- props,
- "sling.servlet.extensions",
- "sling.servlet.selectors",
- "sling.servlet.methods"
- );
- }
-}
diff --git
a/src/test/java/org/apache/sling/servlets/annotations/ServletRegistrationIT.java
b/src/test/java/org/apache/sling/servlets/annotations/ServletRegistrationIT.java
deleted file mode 100644
index 297f599..0000000
---
a/src/test/java/org/apache/sling/servlets/annotations/ServletRegistrationIT.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.servlets.annotations;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Collections;
-
-import org.apache.http.entity.StringEntity;
-import org.apache.sling.testing.clients.ClientException;
-import org.junit.Test;
-
-/** Verify servlet selection based on our annotations. This duplicates
- * some of the servlet resolver tests, see also {@link ServicePropertiesIT}
- * for another testing method.
- */
-public class ServletRegistrationIT extends TestSupport {
-
- @Test
- public void testPathBoundServlet() throws ClientException,
UnsupportedEncodingException {
- CLIENT.doGet("/bin/PathBoundServlet", 555);
- CLIENT.doGet("/bin/PathBoundServlet.with.some.selector.and.extension",
555);
-
CLIENT.doGet("/bin/PathBoundServlet.with.some.selector.and.extension/suffix",
555);
- // other methods should work as well
- CLIENT.doPut("/bin/PathBoundServlet", new StringEntity("some text"),
Collections.emptyList(), 557);
- }
-
- @Test
- public void testPathBoundServletWithFilter() throws ClientException {
- CLIENT.doGet("/bin/PathBoundServlet.html/simplefilter", 556);
-
CLIENT.doGet("/bin/PathBoundServlet.with.some.selector.and.extension/simplefilter",
556);
- }
-
- @Test
- public void testPathBoundServletWithPrefix() throws ClientException {
- CLIENT.doGet("/bin/PathBoundServletWithPrefix", 610);
-
CLIENT.doGet("/bin/PathBoundServletWithPrefix.with.some.selector.and.extension",
610);
- }
-
- @Test
- public void testResourceTypeBoundServlet() throws ClientException,
UnsupportedEncodingException {
- CLIENT.doGet("/content/servlettest/resourceTypeBoundServlet", 560);
- CLIENT.doGet("/content/servlettest/resourceTypeBoundServlet.html",
560);
- CLIENT.doGet("/content/servlettest/resourceTypeBoundServlet.json",
560);
- // only GET and HEAD are supposed to be working
- CLIENT.doPut("/content/servlettest/resourceTypeBoundServlet.json", new
StringEntity("some text"), Collections.emptyList(), 201);
- }
-
- @Test
- public void testResourceTypeBoundServletWithPrefix() throws
ClientException, UnsupportedEncodingException {
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithPrefix", 590);
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithPrefix.html",
590);
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithPrefix.json",
590);
- // only GET and HEAD are supposed to be working
-
CLIENT.doPut("/content/servlettest/resourceTypeBoundServletWithPrefix.json",
new StringEntity("some text"), Collections.emptyList(), 201);
- }
-
- @Test
- public void testResourceTypeBoundServletWithExtension() throws
ClientException, UnsupportedEncodingException {
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithExtension",
403); // without extension is a index listing, which is forbidden by default
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithExtension.html",
200); // DEFAULT GET Servlet
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithExtension.ext1",
570);
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithExtension.ext2",
570);
-
CLIENT.doPut("/content/servlettest/resourceTypeBoundServletWithExtension.ext2",
new StringEntity("some text"), Collections.emptyList(), 571);
- // extension is considered for all methods!
-
CLIENT.doPut("/content/servlettest/resourceTypeBoundServletWithExtension.someotherext",
new StringEntity("some text"), Collections.emptyList(), 201); // DEFAULT
servlet
- }
-
- @Test
- public void testResourceTypeBoundServletWithSelectors() throws
ClientException, UnsupportedEncodingException {
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithSelectors.someext",
404);
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithSelectors.selector1.someext",
404);
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithSelectors.selector3.someext",
600);
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithSelectors.selector1.selector2.someext",
600);
- // some non-registered selector as first selector
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithSelectors.someotherselector.selector1.selector2.someext",
404);
- // some non-registered selector as last selector
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithSelectors.selector1.selector2.someotherselector.someext",
600);
- // only GET and HEAD are supposed to be working
-
CLIENT.doPut("/content/servlettest/resourceTypeBoundServletWithSelectors.selector3.someext",
new StringEntity("some text"), Collections.emptyList(), 201);
- }
-
- @Test
- public void testResourceTypeBoundServletWithMethods() throws
ClientException, UnsupportedEncodingException {
-
CLIENT.doGet("/content/servlettest/resourceTypeBoundServletWithMethods.someext",
404); // DEFAULT Get not triggered due to weird extension
-
CLIENT.doPut("/content/servlettest/resourceTypeBoundServletWithMethods.someext",
new StringEntity("some text"), Collections.emptyList(), 581);
-
CLIENT.doPost("/content/servlettest/resourceTypeBoundServletWithMethods.someext",
new StringEntity("some text"), Collections.emptyList(), 582);
- }
-
- @Test
- public void testInheritingServlets() throws ClientException {
-
CLIENT.doGet("/content/servlettest/baseResourceTypeBoundServletWithSelectors",
403); // no selectors passed
-
CLIENT.doGet("/content/servlettest/baseResourceTypeBoundServletWithSelectors.someext",
404); // no selectors passed
-
CLIENT.doGet("/content/servlettest/baseResourceTypeBoundServletWithSelectors.sel1.someext",
610); // matches
-
CLIENT.doGet("/content/servlettest/baseResourceTypeBoundServletWithSelectors.sel2.someext",
610); // matches
-
CLIENT.doGet("/content/servlettest/inheritingResourceTypeBoundServlet", 620);
// matches
-
CLIENT.doGet("/content/servlettest/inheritingResourceTypeBoundServlet.someext",
620); // matches
-
CLIENT.doGet("/content/servlettest/inheritingResourceTypeBoundServlet.sel.someext",
620); // matches
-
CLIENT.doGet("/content/servlettest/inheritingResourceTypeBoundServlet.sel1.someext",
610); // delegated to Base
-
CLIENT.doGet("/content/servlettest/inheritingResourceTypeBoundServlet.sel2.someext",
610); // delegated to Base
- }
-}
\ No newline at end of file
diff --git
a/src/test/java/org/apache/sling/servlets/annotations/TestSupport.java
b/src/test/java/org/apache/sling/servlets/annotations/TestSupport.java
deleted file mode 100644
index 6973804..0000000
--- a/src/test/java/org/apache/sling/servlets/annotations/TestSupport.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.servlets.annotations;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.sling.testing.clients.ClientException;
-import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
-import org.junit.BeforeClass;
-
-public class TestSupport {
-
- static OsgiConsoleClient CLIENT;
-
- private static final String BUNDLE_SYMBOLICNAME =
"org.apache.sling.servlets.annotations.it";
- private static final long BUNDLE_START_TIMEOUT =
TimeUnit.SECONDS.toMillis(10);
- private static final long SERVICE_START_TIMEOUT =
TimeUnit.SECONDS.toMillis(60);
-
- @BeforeClass
- public static synchronized void setupOnce() throws ClientException,
InterruptedException, TimeoutException, URISyntaxException {
- if(CLIENT != null) {
- return;
- }
-
- String baseUrl = System.getProperty("baseUrl");
- if (baseUrl == null) {
- throw new IllegalArgumentException("IT must be started with
environment variable 'baseUrl' set");
- }
- URI url = new URI(baseUrl);
- CLIENT = new OsgiConsoleClient(url, "admin", "admin");
-
- String bundleFile = System.getProperty("bundleFile");
- if (bundleFile == null) {
- throw new IllegalArgumentException("IT must be started with
environment variable 'bundleFile' set");
- }
- // deploy bundle to server
- File file = new File(bundleFile);
- if (!file.exists()) {
- throw new IllegalArgumentException("Test bundle file in " + file +
" does not exist!");
- }
- // wait until the server is fully started
- CLIENT.waitExists("/starter/index.html", SERVICE_START_TIMEOUT, 500);
-
- CLIENT.waitInstallBundle(file, true, -1, BUNDLE_START_TIMEOUT, 500);
-
- // the following method somehow fails sometimes
- CLIENT.waitServiceRegistered("javax.servlet.Servlet",
BUNDLE_SYMBOLICNAME, SERVICE_START_TIMEOUT, 500);
-
CLIENT.waitComponentRegistered("org.apache.sling.servlets.annotations.testservlets.PathBoundServlet",
SERVICE_START_TIMEOUT, 500);
-
CLIENT.waitComponentRegistered("org.apache.sling.servlets.annotations.testservletfilters.SimpleServletFilter",
SERVICE_START_TIMEOUT, 500);
- }
-}
diff --git a/src/test/provisioning/it-model.txt
b/src/test/provisioning/it-model.txt
deleted file mode 100644
index dd483f2..0000000
--- a/src/test/provisioning/it-model.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# 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=servlet-annotations-it]
-
-# Dependencies
-[artifacts]
- org.apache.sling/org.apache.sling.starter/11/slingstart
- org.apache.sling/org.apache.sling.api
- org.apache.sling/org.apache.sling.servlets.resolver