incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r899629 - in /sling/trunk/launchpad: test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/ testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/
Date Fri, 15 Jan 2010 13:48:37 GMT
Author: bdelacretaz
Date: Fri Jan 15 13:48:36 2010
New Revision: 899629

URL: http://svn.apache.org/viewvc?rev=899629&view=rev
Log:
PathsServlet integration test added, uses sling.servlet.paths registration mechanism

Added:
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/PathsServlet.java
  (with props)
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/PathsServletTest.java
  (with props)
Modified:
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/ResolutionTestBase.java

Added: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/PathsServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/PathsServlet.java?rev=899629&view=auto
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/PathsServlet.java
(added)
+++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/PathsServlet.java
Fri Jan 15 13:48:36 2010
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.launchpad.testservices.servlets;
+
+/** Servlet that registers itself for specific paths
+ * 
+ *  @scr.component immediate="true" metatype="no"
+ *  @scr.service interface="javax.servlet.Servlet"
+ * 
+ *  @scr.property name="service.description" value="Paths Test Servlet"
+ *  @scr.property name="service.vendor" value="The Apache Software Foundation"
+ * 
+ *  @scr.property name="sling.servlet.paths" 
+ *                  values.0="/testing/PathsServlet/foo" 
+ *                  values.1="/testing/PathsServlet/bar/more/foo.html" 
+ * 
+ */
+public class PathsServlet extends TestServlet {
+}

Propchange: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/PathsServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/PathsServlet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/PathsServletTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/PathsServletTest.java?rev=899629&view=auto
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/PathsServletTest.java
(added)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/PathsServletTest.java
Fri Jan 15 13:48:36 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.launchpad.webapp.integrationtest.servlets.resolution;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.httpclient.methods.GetMethod;
+
+public class PathsServletTest extends ResolutionTestBase {
+
+    private final static String[] TEST_PATH = { 
+        "/testing/PathsServlet/foo",
+        "/testing/PathsServlet/bar/more/foo.html" 
+    };
+    
+    public void testGetCorrectPaths() throws Exception {
+        for (String path : TEST_PATH) {
+            assertServlet(getContent(HTTP_BASE_URL + path, CONTENT_TYPE_PLAIN),
+                    PATHS_SERVLET_SUFFIX);
+        }
+    }
+    
+    public void testSubpath() throws Exception {
+        final String extra = "/something";
+        for (String p : TEST_PATH) {
+            String path = p + extra;
+            GetMethod get = new GetMethod(HTTP_BASE_URL + path);
+            int status = httpClient.executeMethod(get);
+            assertFalse("Expected non-200 status for path " + path, HttpServletResponse.SC_OK
== status);
+        }
+    }
+}

Propchange: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/PathsServletTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/PathsServletTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/ResolutionTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/ResolutionTestBase.java?rev=899629&r1=899628&r2=899629&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/ResolutionTestBase.java
(original)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/ResolutionTestBase.java
Fri Jan 15 13:48:36 2010
@@ -40,6 +40,7 @@
   public static final String PREFIX_M1_SERVLET_SUFFIX = "testservices.servlets.PrefixServletMinusOne";
   public static final String PUT_SERVLET_SUFFIX = "testservices.servlets.PutMethodServlet";
   public static final String REQUEST_URI_OPTING_SERVLET_SUFFIX = "testservices.servlets.RequestUriOptingServlet";
+  public static final String PATHS_SERVLET_SUFFIX = "testservices.servlets.PathsServlet";
   
   protected TestNode testNodeNORT;
   protected TestNode testNodeRT;



Mime
View raw message