Author: fmeschbe
Date: Fri May 16 01:50:28 2008
New Revision: 656974
URL: http://svn.apache.org/viewvc?rev=656974&view=rev
Log:
SLING-457 Integration test cases
Added:
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/a-foo.html.jsp
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/b-b.jsp
Modified:
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java
Modified:
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java?rev=656974&r1=656973&r2=656974&view=diff
==============================================================================
---
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java
(original)
+++
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java
Fri May 16 01:50:28 2008
@@ -186,7 +186,7 @@
protected boolean slingServerReady() throws Exception {
// create a node on the server
final String time = String.valueOf(System.currentTimeMillis());
- final String url = HTTP_BASE_URL + "/WaitForSlingStartup_" + time;
+ final String url = HTTP_BASE_URL + "/WaitForSlingStartup/" + time;
// add some properties to the node
final Map<String,String> props = new HashMap<String,String>();
Added:
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java?rev=656974&view=auto
==============================================================================
---
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java
(added)
+++
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java
Fri May 16 01:50:28 2008
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.launchpad.webapp.integrationtest.issues;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.sling.api.SlingConstants;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.launchpad.webapp.integrationtest.HttpTestBase;
+import org.apache.sling.servlets.post.SlingPostConstants;
+
+public class SLING457Test extends HttpTestBase {
+
+ private String testRootUrl;
+
+ private String contentUrl;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ final String testRootPathBare = "/" + getClass().getSimpleName() + "/"
+ + System.currentTimeMillis();
+ final String testRootPath = HTTP_BASE_URL + testRootPathBare;
+
+ // the root for our tests
+ testRootUrl = testClient.createNode(testRootPath, null);
+
+ // create the Resource Type "a" location
+ String rtA = testRootPathBare + "/a";
+ testClient.createNode(HTTP_BASE_URL + rtA, null);
+
+ // create the Resource Type "b" location
+ String rtB = testRootPathBare + "/b";
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("sling:resourceSuperType", rtA);
+ testClient.createNode(HTTP_BASE_URL + rtB, props);
+
+ // create content node "x" of type rtB
+ String rtX = testRootPathBare + "/x";
+ props.clear();
+ props.put("sling:resourceType", rtB);
+ contentUrl = testClient.createNode(HTTP_BASE_URL + rtX, props);
+
+ // create content node "x/image" of type rtB
+ String rtXImage = rtX + "/image";
+ props.clear();
+ props.put("sling:resourceType", "nt:unstructured");
+ testClient.createNode(HTTP_BASE_URL + rtXImage, props);
+
+ uploadTestScript(rtA, "issues/sling457/a-foo.html.jsp",
"foo.html.jsp");
+ uploadTestScript(rtB, "issues/sling457/b-b.jsp", "b.jsp");
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ testClient.delete(testRootUrl);
+ super.tearDown();
+ }
+
+ public void testCallFooHtml() throws Exception {
+ String url = contentUrl + ".foo.html";
+ String content = getContent(url, CONTENT_TYPE_HTML);
+ assertTrue("Expected 'foo.html.jsp' in content",
+ content.indexOf("foo.html.jsp") >= 0);
+ }
+
+ public void testCallHtml() throws Exception {
+ String url = contentUrl + ".html";
+ String content = getContent(url, CONTENT_TYPE_HTML);
+ assertTrue("Expected 'foo.html.jsp' in content",
+ content.indexOf("foo.html.jsp") >= 0);
+ }
+}
Added:
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/a-foo.html.jsp
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/a-foo.html.jsp?rev=656974&view=auto
==============================================================================
---
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/a-foo.html.jsp
(added)
+++
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/a-foo.html.jsp
Fri May 16 01:50:28 2008
@@ -0,0 +1,21 @@
+<!--
+/*
+ * 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.
+-->
+<[EMAIL PROTECTED] session="false"%>
+foo.html.jsp
\ No newline at end of file
Added:
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/b-b.jsp
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/b-b.jsp?rev=656974&view=auto
==============================================================================
---
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/b-b.jsp
(added)
+++
incubator/sling/trunk/launchpad/webapp/src/test/resources/integration-test/issues/sling457/b-b.jsp
Fri May 16 01:50:28 2008
@@ -0,0 +1,27 @@
+<!--
+/*
+ * 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.
+-->
+<[EMAIL PROTECTED] session="false"%>
+<[EMAIL PROTECTED] import="org.apache.sling.api.SlingHttpServletRequest"%>
+<[EMAIL PROTECTED] prefix="sling"
uri="http://sling.apache.org/taglibs/sling/1.0"%>
+<%
+ SlingHttpServletRequest req = (SlingHttpServletRequest) request;
+ String resType = req.getResource().getResourceType();
+%>
+<sling:include path="./image.foo.html" resourceType="<%= resType %>" />
\ No newline at end of file