Author: cziegeler
Date: Fri Jan 9 05:11:00 2009
New Revision: 733027
URL: http://svn.apache.org/viewvc?rev=733027&view=rev
Log:
Remove unused imports and correct javadocs.
Modified:
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverPlugin.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/MapEntry.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/SlingScriptEngineManager.java
incubator/sling/trunk/scripting/freemarker/src/main/java/org/apache/sling/scripting/freemarker/wrapper/PropertyModel.java
incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/helper/SlingRhinoDebugger.java
incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java
incubator/sling/trunk/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/ScriptEngineHelper.java
incubator/sling/trunk/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/helper/ResourceCollector.java
incubator/sling/trunk/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/helper/ResourceCollectorGetServletsTest.java
Modified:
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverPlugin.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverPlugin.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverPlugin.java
(original)
+++
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverPlugin.java
Fri Jan 9 05:11:00 2009
@@ -31,7 +31,6 @@
import org.apache.felix.webconsole.AbstractWebConsolePlugin;
import org.apache.felix.webconsole.WebConsoleConstants;
-import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.jcr.resource.internal.helper.MapEntries;
import org.apache.sling.jcr.resource.internal.helper.MapEntry;
@@ -205,7 +204,7 @@
String test = request.getParameter(ATTR_TEST);
if (test != null && test.length() > 0) {
-
+
// set test value for the re-rendering of the form
request.setAttribute(ATTR_TEST, test);
@@ -229,7 +228,7 @@
// set the result to render the result
request.setAttribute(ATTR_RESULT, result.toString());
-
+
} catch (Throwable t) {
// TOOD: log
} finally {
Modified:
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/MapEntry.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/MapEntry.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/MapEntry.java
(original)
+++
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/MapEntry.java
Fri Jan 9 05:11:00 2009
@@ -34,8 +34,8 @@
* The <code>MapEntry</code> class represents a mapping entry in the mapping
* configuration tree at <code>/etc/map</code>.
* <p>
- *
- * @see http://cwiki.apache.org/SLING/flexible-resource-resolution.html
+ *
+ * @see "http://cwiki.apache.org/SLING/flexible-resource-resolution.html"
*/
public class MapEntry implements Comparable<MapEntry> {
@@ -63,7 +63,7 @@
/**
* Returns a string used for matching map entries against the given request
* or URI parts.
- *
+ *
* @param scheme The URI scheme
* @param host The host name
* @param port The port number. If this is negative, the default value used
@@ -187,7 +187,7 @@
if (!url.startsWith("^")) {
url = "^".concat(url);
}
-
+
this.urlPattern = Pattern.compile(url);
this.redirect = redirect;
this.status = status;
Modified:
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
(original)
+++
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
Fri Jan 9 05:11:00 2009
@@ -20,7 +20,6 @@
import javax.jcr.Node;
import javax.jcr.RepositoryException;
-import javax.servlet.http.HttpServletRequest;
import org.apache.sling.api.SlingException;
import org.apache.sling.api.resource.Resource;
@@ -37,7 +36,7 @@
final static String SLASH_STAR = "/*";
public final static String DEFAULT_RESOURCE_TYPE =
"sling:syntheticStarResource";
-
+
private static final String UNSET_RESOURCE_SUPER_TYPE = "<unset>";
private String resourceSuperType;
@@ -85,7 +84,7 @@
resourceType = DEFAULT_RESOURCE_TYPE;
}
setResourceType(resourceType);
-
+
resourceSuperType = UNSET_RESOURCE_SUPER_TYPE;
}
Modified:
incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
(original)
+++
incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Fri Jan 9 05:11:00 2009
@@ -27,7 +27,6 @@
import javax.jcr.NamespaceRegistry;
import javax.jcr.Node;
-import javax.jcr.RepositoryException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.http.Cookie;
@@ -45,6 +44,7 @@
import org.apache.sling.jcr.resource.internal.helper.Mapping;
import org.apache.sling.jcr.resource.internal.helper.starresource.StarResource;
+
public class JcrResourceResolverTest extends RepositoryTestBase {
private String rootPath;
@@ -219,35 +219,35 @@
}
public void testSlingFolder() throws Exception {
-
+
// create a folder
String folderPath = "folder";
Node folder = rootNode.addNode(folderPath, "sling:Folder");
rootNode.save();
-
+
// test default child node type
Node child = folder.addNode("child0");
folder.save();
assertEquals("sling:Folder", child.getPrimaryNodeType().getName());
-
+
// test explicit sling:Folder child
child = folder.addNode("child1", "sling:Folder");
folder.save();
assertEquals("sling:Folder", child.getPrimaryNodeType().getName());
-
+
// test explicit nt:folder child
child = folder.addNode("child2", "nt:folder");
folder.save();
assertEquals("nt:folder", child.getPrimaryNodeType().getName());
-
+
// test any child node -- use nt:unstructured here
child = folder.addNode("child3", "nt:unstructured");
folder.save();
assertEquals("nt:unstructured", child.getPrimaryNodeType().getName());
}
-
+
//---------- internal
-
+
private void testStarResourceHelper(final String path, final String
method) {
final Resource res = resResolver.resolve(new
ResourceResolverTestRequest(path, method));
assertNotNull(res);
Modified:
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
(original)
+++
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
Fri Jan 9 05:11:00 2009
@@ -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"));
Modified:
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java
(original)
+++
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING760Test.java
Fri Jan 9 05:11:00 2009
@@ -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));
}
Modified:
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java
(original)
+++
incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletNopTest.java
Fri Jan 9 05:11:00 2009
@@ -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);
}
Modified:
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java
(original)
+++
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java
Fri Jan 9 05:11:00 2009
@@ -57,7 +57,6 @@
import org.apache.sling.api.SlingException;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.request.RequestProgressTracker;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceMetadata;
import org.apache.sling.api.scripting.ScriptEvaluationException;
@@ -153,7 +152,7 @@
ctx.getErrorWriter().flush();
return result;
-
+
} catch (IOException ioe) {
throw new ScriptEvaluationException(scriptName, ioe.getMessage(),
ioe);
@@ -162,7 +161,7 @@
Throwable cause = (se.getCause() == null) ? se : se.getCause();
throw new ScriptEvaluationException(scriptName, se.getMessage(),
cause);
-
+
} finally {
// dispose of the SlingScriptHelper
if ( bindings != null ) {
@@ -171,7 +170,7 @@
helper.dispose();
}
}
-
+
// close the script reader (SLING-380)
if (reader != null) {
try {
@@ -229,14 +228,14 @@
// log in the request progress tracker
logScriptError(request, see);
-
+
throw see;
-
+
} catch (Exception e) {
-
+
// log in the request progress tracker
logScriptError(request, e);
-
+
throw new SlingException("Cannot get DefaultSlingScript: "
+ e.getMessage(), e);
}
@@ -434,7 +433,7 @@
bindings.put(RESPONSE, sling.getResponse());
bindings.put(RESOURCE, sling.getRequest().getResource());
bindings.put(OUT, sling.getResponse().getWriter());
-
+
// set the current node if the resource is node based
Node node = sling.getRequest().getResource().adaptTo(Node.class);
if (node != null) {
Modified:
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/SlingScriptEngineManager.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/SlingScriptEngineManager.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/SlingScriptEngineManager.java
(original)
+++
incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/SlingScriptEngineManager.java
Fri Jan 9 05:11:00 2009
@@ -19,24 +19,20 @@
package org.apache.sling.scripting.core.impl.helper;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;
+
public class SlingScriptEngineManager extends ScriptEngineManager {
private final List<ScriptEngineFactory> factories = new
ArrayList<ScriptEngineFactory>();
-
+
public SlingScriptEngineManager(ClassLoader classLoader) {
super(classLoader);
}
-
+
public SlingScriptEngineManager() {
super();
}
@@ -45,7 +41,7 @@
public List<ScriptEngineFactory> getEngineFactories() {
@SuppressWarnings("unchecked")
List<ScriptEngineFactory> baseFactories = super.getEngineFactories();
-
+
List<ScriptEngineFactory> result = new
ArrayList<ScriptEngineFactory>();
result.addAll(factories);
result.addAll(baseFactories);
Modified:
incubator/sling/trunk/scripting/freemarker/src/main/java/org/apache/sling/scripting/freemarker/wrapper/PropertyModel.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/freemarker/src/main/java/org/apache/sling/scripting/freemarker/wrapper/PropertyModel.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/scripting/freemarker/src/main/java/org/apache/sling/scripting/freemarker/wrapper/PropertyModel.java
(original)
+++
incubator/sling/trunk/scripting/freemarker/src/main/java/org/apache/sling/scripting/freemarker/wrapper/PropertyModel.java
Fri Jan 9 05:11:00 2009
@@ -16,13 +16,12 @@
*/
package org.apache.sling.scripting.freemarker.wrapper;
-import freemarker.template.TemplateModel;
-import freemarker.template.TemplateScalarModel;
-import freemarker.template.TemplateModelException;
-
import javax.jcr.Property;
import javax.jcr.RepositoryException;
+import freemarker.template.TemplateModelException;
+import freemarker.template.TemplateScalarModel;
+
/**
* A wrapper for JCR properties to support freemarker scripting.
*/
Modified:
incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/helper/SlingRhinoDebugger.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/helper/SlingRhinoDebugger.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/helper/SlingRhinoDebugger.java
(original)
+++
incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/helper/SlingRhinoDebugger.java
Fri Jan 9 05:11:00 2009
@@ -16,9 +16,6 @@
*/
package org.apache.sling.scripting.javascript.helper;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowStateListener;
-
import org.mozilla.javascript.ContextFactory;
import org.mozilla.javascript.tools.debugger.Dim;
import org.mozilla.javascript.tools.debugger.SwingGui;
Modified:
incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java
(original)
+++
incubator/sling/trunk/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java
Fri Jan 9 05:11:00 2009
@@ -18,7 +18,6 @@
import java.io.Reader;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
@@ -30,7 +29,6 @@
import org.apache.sling.api.scripting.SlingBindings;
import org.apache.sling.api.scripting.SlingScriptHelper;
import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
-import org.apache.sling.scripting.javascript.helper.SlingWrapFactory;
import org.apache.sling.scripting.javascript.io.EspReader;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ImporterTopLevel;
Modified:
incubator/sling/trunk/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/ScriptEngineHelper.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/ScriptEngineHelper.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/ScriptEngineHelper.java
(original)
+++
incubator/sling/trunk/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/ScriptEngineHelper.java
Fri Jan 9 05:11:00 2009
@@ -34,7 +34,6 @@
import javax.script.SimpleBindings;
import javax.script.SimpleScriptContext;
-import org.apache.sling.commons.testing.osgi.MockBundle;
import org.apache.sling.commons.testing.osgi.MockComponentContext;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScriptableObject;
@@ -50,6 +49,7 @@
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
+
/** Helpers to run javascript code fragments in tests */
public class ScriptEngineHelper {
private static ScriptEngine engine;
@@ -119,36 +119,36 @@
}
private static class RhinoMockComponentContext extends
MockComponentContext {
-
+
private RhinoMockComponentContext() {
super(null, null);
}
-
+
@Override
public BundleContext getBundleContext() {
return new BundleContext() {
public void addBundleListener(BundleListener arg0) {
// TODO Auto-generated method stub
-
+
}
public void addFrameworkListener(
FrameworkListener arg0) {
// TODO Auto-generated method stub
-
+
}
public void addServiceListener(ServiceListener arg0) {
// TODO Auto-generated method stub
-
+
}
public void addServiceListener(
ServiceListener arg0, String arg1)
throws InvalidSyntaxException {
// TODO Auto-generated method stub
-
+
}
public Filter createFilter(String arg0)
@@ -233,19 +233,19 @@
public void removeBundleListener(BundleListener arg0) {
// TODO Auto-generated method stub
-
+
}
public void removeFrameworkListener(
FrameworkListener arg0) {
// TODO Auto-generated method stub
-
+
}
public void removeServiceListener(
ServiceListener arg0) {
// TODO Auto-generated method stub
-
+
}
public boolean ungetService(ServiceReference arg0) {
Modified:
incubator/sling/trunk/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/helper/ResourceCollector.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/helper/ResourceCollector.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/helper/ResourceCollector.java
(original)
+++
incubator/sling/trunk/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/helper/ResourceCollector.java
Fri Jan 9 05:11:00 2009
@@ -30,7 +30,6 @@
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.api.resource.SyntheticResource;
-import org.apache.sling.api.servlets.HttpConstants;
import
org.apache.sling.servlets.resolver.resource.ServletResourceProviderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,7 +84,7 @@
* and request extension into account for finding servlet resources.
* Otherwise an instance of this class itself is returned which just takes
* the resource type and request method name into account.
- *
+ *
* @param request The <code>SlingHttpServletRequest</code> for which to
* return a <code>ResourceCollector</code>.
* @return The <code>ResourceCollector</code> to find servlets and scripts
@@ -98,7 +97,7 @@
/**
* Creates a <code>ResourceCollector</code> finding servlets and scripts
* for the given <code>methodName</code>.
- *
+ *
* @param methodName The <code>methodName</code> used to find scripts for.
* This must not be <code>null</code>.
* @param baseResourceType The basic resource type to use as a final
@@ -120,7 +119,7 @@
/**
* Creates a <code>ResourceCollector</code> finding servlets and scripts
* for the given <code>methodName</code>.
- *
+ *
* @param methodName The <code>methodName</code> used to find scripts for.
* This must not be <code>null</code>.
* @param baseResourceType The basic resource type to use as a final
@@ -232,7 +231,7 @@
WeightedResource.WEIGHT_NONE);
continue;
}
-
+
if (scriptName.equals(methodName)) {
addWeightedResource(resources, child, selIdx,
WeightedResource.WEIGHT_NONE);
@@ -262,7 +261,7 @@
* Creates a {...@link WeightedResource} and adds it to the set of
resources.
* The number of resources already present in the set is used as the
ordinal
* number for the newly created resource.
- *
+ *
* @param resources The set of resource to which the
* {...@link WeightedResource} is added.
* @param resource The <code>Resource</code> on which the
@@ -285,7 +284,7 @@
* <code>base</code> resource. If no resource exists at the given path -
* absolute or relative to the base resource - a
* <code>SyntheticResource</code> is returned.
- *
+ *
* @param resolver The <code>ResourceResolver</code> used to access the
* resource.
* @param base The (optional) base resource. This may be <code>null</code>
Modified:
incubator/sling/trunk/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/helper/ResourceCollectorGetServletsTest.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/helper/ResourceCollectorGetServletsTest.java?rev=733027&r1=733026&r2=733027&view=diff
==============================================================================
---
incubator/sling/trunk/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/helper/ResourceCollectorGetServletsTest.java
(original)
+++
incubator/sling/trunk/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/helper/ResourceCollectorGetServletsTest.java
Fri Jan 9 05:11:00 2009
@@ -26,19 +26,18 @@
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.commons.testing.sling.MockResource;
-import org.apache.sling.servlets.resolver.helper.ResourceCollector;
public class ResourceCollectorGetServletsTest extends HelperTestBase {
private String label;
-
+
@Override
protected void setUp() throws Exception {
super.setUp();
-
+
label = ResourceUtil.getName(resourceTypePath);
}
-
+
public void testGetServlets0() {
String[] names = { "/" + label + ".esp", // 0
"/GET.esp", // 1
@@ -51,13 +50,13 @@
"/print", // resource to enable walking the tree
"/print", // resource to enable walking the tree
};
-
+
int[] baseIdxs = { 0, 1, 1, 0, 0, 1, 0, 1, 0, 1 };
int[] indices = { 7, 5, 6, 4, 2, 3, 0, 1 };
-
+
effectiveTest(names, baseIdxs, indices);
}
-
+
public void testGetServlets1() {
String[] names = { "/" + label + ".esp", // 0
"/GET.esp", // 1
@@ -70,13 +69,13 @@
"/print", // resource to enable walking the tree
"/print", // resource to enable walking the tree
};
-
+
int[] baseIdxs = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
int[] indices = { 7, 6, 3, 2, 0, 1 };
-
+
effectiveTest(names, baseIdxs, indices);
}
-
+
public void testGetServlets2() {
String[] names = { "/" + label + ".esp", // 0
"/GET.esp", // 1
@@ -90,13 +89,13 @@
"/print", // resource to enable walking the tree
"/print", // resource to enable walking the tree
};
-
+
int[] baseIdxs = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
int[] indices = { 8, 7, 2, 3, 0, 1 };
-
+
effectiveTest(names, baseIdxs, indices);
}
-
+
public void testGetServlets3() {
String[] names = { ".servlet", // 0
"/" + label + ".esp", // 1
@@ -111,13 +110,13 @@
"/print", // resource to enable walking the tree
"/print", // resource to enable walking the tree
};
-
+
int[] baseIdxs = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
int[] indices = { 9, 8, 3, 4, 1, 2, 0 };
-
+
effectiveTest(names, baseIdxs, indices);
}
-
+
public void testGetServlets4() {
String[] names = { ".servlet", // 0
"/" + label + ".esp", // 1
@@ -133,19 +132,18 @@
"/print", // resource to enable walking the tree
"/print", // resource to enable walking the tree
};
-
+
int[] baseIdxs = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1 };
int[] indices = { 10, 9, 3, 4, 1, 2, 0 };
-
+
effectiveTest(names, baseIdxs, indices);
}
-
+
protected void effectiveTest(String[] names, int[] baseIdxs, int[]
indices) {
String[] base = { "/apps/" + resourceTypePath,
"/libs/" + resourceTypePath };
- @SuppressWarnings("unchecked")
Map<String, String> pathMap = new HashMap<String, String>();
for (int i=0; i < names.length; i++) {
@@ -155,7 +153,7 @@
createScriptResource(path, "nt:file");
pathMap.put(name, path);
}
-
+
ResourceCollector lu = ResourceCollector.create(request);
Collection<Resource> res = lu.getServlets(request.getResource());
Iterator<Resource> rIter = res.iterator();