Remove unused imports and correct javadocs.
git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk@733027 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
index 8f06986..95f6b92 100644
--- a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
+++ b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
@@ -23,12 +23,11 @@
import java.util.Map;
import java.util.Set;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.sling.commons.testing.integration.HttpTestBase;
import org.apache.sling.servlets.post.SlingPostConstants;
+
/** Test the {link ScriptHelper#include) functionality */
public class IncludeTest extends HttpTestBase {
@@ -41,32 +40,32 @@
private String nodeUrlE;
private String scriptPath;
private Set<String> toDelete = new HashSet<String>();
-
+
@Override
protected void setUp() throws Exception {
super.setUp();
-
+
// Create the test nodes under a path that's specific to this class to
// allow collisions
final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "/" + System.currentTimeMillis() + SlingPostConstants.DEFAULT_CREATE_SUFFIX;
final Map<String,String> props = new HashMap<String,String>();
-
+
// Create two test nodes and store their paths
testTextA = "Text A " + System.currentTimeMillis();
props.put("text", testTextA);
nodeUrlA = testClient.createNode(url, props);
-
+
// Node B stores the path of A, so that the test script can
// include A when rendering B
testTextB = "Text B " + System.currentTimeMillis();
props.put("text", testTextB);
props.put("pathToInclude", new URL(nodeUrlA).getPath());
nodeUrlB = testClient.createNode(url, props);
-
+
// Node E is like B but with an extension on the include path
props.put("pathToInclude", new URL(nodeUrlA).getPath() + ".html");
nodeUrlE = testClient.createNode(url, props);
-
+
// Node C is used for the infinite loop detection test
props.remove("pathToInclude");
props.put("testInfiniteLoop","true");
@@ -78,18 +77,18 @@
props.put("forceResourceType", forcedResourceType);
props.put("pathToInclude", new URL(nodeUrlA).getPath());
nodeUrlD = testClient.createNode(url, props);
-
+
// Script for forced resource type
scriptPath = "/apps/" + forcedResourceType;
testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
toDelete.add(uploadTestScript(scriptPath,"include-forced.esp","html.esp"));
-
+
// The main rendering script goes under /apps in the repository
scriptPath = "/apps/nt/unstructured";
testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
toDelete.add(uploadTestScript(scriptPath,"include-test.esp","html.esp"));
}
-
+
@Override
protected void tearDown() throws Exception {
super.tearDown();
@@ -112,7 +111,7 @@
assertTrue("Include has been used",content.contains("<p>Including"));
assertTrue("Text of node A is included (" + content + ")",content.contains(testTextA));
}
-
+
public void testWithIncludeAndExtension() throws IOException {
final String content = getContent(nodeUrlE + ".html", CONTENT_TYPE_HTML);
assertTrue("Content includes ESP marker",content.contains("ESP template"));
@@ -120,7 +119,7 @@
assertTrue("Include has been used",content.contains("<p>Including"));
assertTrue("Text of node A is included (" + content + ")",content.contains(testTextA));
}
-
+
public void testInfiniteLoopDetection() throws IOException {
// Node C has a property that causes an infinite include loop,
// Sling must indicate the problem in its response
@@ -129,13 +128,13 @@
final String content = get.getResponseBodyAsString();
assertTrue("Response contains infinite loop error message",
content.contains("InfiniteIncludeLoopException"));
-
+
// TODO: SLING-515, status is 500 when running the tests as part of the maven build
// but 200 if running tests against a separate instance started with mvn jetty:run
// final int status = get.getStatusCode();
// assertEquals("Status is 500 for infinite loop",HttpServletResponse.SC_INTERNAL_SERVER_ERROR, status);
}
-
+
public void testForcedResourceType() throws IOException {
final String content = getContent(nodeUrlD + ".html", CONTENT_TYPE_HTML);
assertTrue("Content includes ESP marker",content.contains("ESP template"));
diff --git a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java
index 16c0107..0946c6f 100644
--- a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java
+++ b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java
@@ -20,29 +20,28 @@
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.sling.commons.testing.integration.HttpTestBase;
public class SLING760Test extends HttpTestBase {
public static final String TEST_PATH = "/" + SLING760Test.class.getSimpleName();
-
+
/** Verify that all instances of our error message are escaped in response, which
* is generated by the default Sling error handler */
public void testEscapedErrorMessages() throws Exception {
final String [] mustContain = { "<characters/>", "filtered & escaped" };
final String [] mustNotContain = { "<characters/>", "filtered & escaped" };
-
+
final TestNode tn = new TestNode(HTTP_BASE_URL + TEST_PATH, null);
-
+
try {
uploadTestScript(tn.scriptPath, "issues/sling760/throw-with-markup.esp", "html.esp");
- final String content = getContent(tn.nodeUrl + ".html", CONTENT_TYPE_HTML,
+ final String content = getContent(tn.nodeUrl + ".html", CONTENT_TYPE_HTML,
null, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
+
for(String str : mustContain) {
assertTrue("Content must contain " + str + " (" + content + ")", content.contains(str));
}
-
+
for(String str : mustNotContain) {
assertFalse("Content must NOT contain " + str + " (" + content + ")", content.contains(str));
}
diff --git a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java
index 194600f..ac13581 100644
--- a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java
+++ b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java
@@ -17,15 +17,11 @@
package org.apache.sling.launchpad.webapp.integrationtest.servlets.post;
import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.JSONObject;
import org.apache.sling.commons.testing.integration.HttpTestBase;
+
public class PostServletNopTest extends HttpTestBase {
private static final String TEST_URL = HTTP_BASE_URL + "/"
@@ -34,30 +30,30 @@
public void testDefault() throws IOException {
post(TEST_URL, null, 200);
}
-
+
public void testStatus200() throws IOException {
post(TEST_URL, 200);
}
-
+
public void testStatus708() throws IOException {
post(TEST_URL, 708);
}
-
+
// request status <100, expect default 200
public void testStatus88() throws IOException {
post(TEST_URL, "88", 200);
}
-
+
// request status >999, expect default 200
public void testStatus1234() throws IOException {
post(TEST_URL, "1234", 200);
}
-
+
// request non-numeric status, expect default 200
public void testStatusNonNumeric() throws IOException {
post(TEST_URL, "nonumber", 200);
}
-
+
private void post(String url, int status) throws IOException {
post(url, String.valueOf(status), status);
}