You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2008/02/12 19:51:59 UTC

svn commit: r627029 - in /incubator/sling/trunk/launchpad: launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/ launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/ launchpad-servlets/src/main/java/org/apache/sling/uj...

Author: cziegeler
Date: Tue Feb 12 10:51:56 2008
New Revision: 627029

URL: http://svn.apache.org/viewvc?rev=627029&view=rev
Log:
Clean up code.

Removed:
    incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/usling/renderers/
    incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/usling/servlets/
Modified:
    incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java
    incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/StreamRendererServlet.java
    incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/UjaxInfoServlet.java
    incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/NodeNameGenerator.java
    incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/RequestProperty.java
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JavascriptWrappersTest.java
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/SyntheticResourceTest.java
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java

Modified: incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonRendererServlet.java Tue Feb 12 10:51:56 2008
@@ -46,7 +46,7 @@
     private static final long serialVersionUID = 5577121546674133317L;
     private final String responseContentType;
     private final JsonItemWriter itemWriter;
-    
+
     /** Recursion level selector that means "all levels" */
     public static final String INFINITY = "infinity";
 
@@ -64,7 +64,7 @@
         if(r instanceof NonExistingResource) {
             throw new ResourceNotFoundException("No data to dump");
         }
-        
+
         /* TODO
         // Do we have a SyntheticResourceData?
         if(r.adaptTo(SyntheticResourceData.class) != null) {
@@ -72,7 +72,7 @@
             return;
         }
         */
-        
+
         // Do we have a Property?
         final Property p = r.adaptTo(Property.class);
         if(p!=null) {
@@ -85,7 +85,7 @@
             }
             return;
         }
-        
+
         // Do we have a Node?
         final Node n = r.adaptTo(Node.class);
         if(n == null) {
@@ -123,17 +123,11 @@
             reportException(re);
         }
     }
-    
-    /** Render a Property by dumping its String value */ 
+
+    /** Render a Property by dumping its String value */
     private void renderProperty(Property p, SlingHttpServletResponse resp) throws JSONException, RepositoryException, IOException {
         resp.setContentType(responseContentType);
         new JsonItemWriter(null).dump(p, resp.getWriter());
-    }
-
-    /** Render synthetic resources as empty JSON objects */
-    private void renderSyntheticResource(SlingHttpServletRequest req,SlingHttpServletResponse resp) throws IOException {
-        resp.setContentType(responseContentType);
-        resp.getOutputStream().write("{}".getBytes());
     }
 
     /**

Modified: incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/StreamRendererServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/StreamRendererServlet.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/StreamRendererServlet.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/StreamRendererServlet.java Tue Feb 12 10:51:56 2008
@@ -27,23 +27,16 @@
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceMetadata;
-import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class StreamRendererServlet extends PlainTextRendererServlet {
 
     private static final long serialVersionUID = -1L;
 
-    /** default log */
-    private final Logger log = LoggerFactory.getLogger(getClass());
-
     public StreamRendererServlet(String contentType, ServletConfig config)
             throws ServletException {
         super(contentType);
@@ -124,7 +117,7 @@
      * Returns <code>true</code> if the request has a
      * <code>If-Modified-Since</code> header whose date value is later than
      * the last modification time given as <code>modifTime</code>.
-     * 
+     *
      * @param request The <code>ComponentRequest</code> checked for the
      *            <code>If-Modified-Since</code> header.
      * @param modifTime The last modification time to compare the header to.

Modified: incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/UjaxInfoServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/UjaxInfoServlet.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/UjaxInfoServlet.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/UjaxInfoServlet.java Tue Feb 12 10:51:56 2008
@@ -19,7 +19,6 @@
 package org.apache.sling.launchpad.servlets;
 
 import java.io.IOException;
-import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.util.HashMap;
 import java.util.Map;
@@ -39,7 +38,7 @@
 public class UjaxInfoServlet extends SlingSafeMethodsServlet {
     /** Handle requests which start with this path */
     public static String PATH_PREFIX = "/ujax:";
-    
+
     @Override
     protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException,
             IOException {
@@ -58,7 +57,7 @@
             response.sendError(HttpServletResponse.SC_NOT_FOUND,request.getPathInfo());
             return;
         }
-        
+
         // render data in JSON format
         response.setContentType("application/json");
         response.setCharacterEncoding("UTF-8");

Modified: incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/NodeNameGenerator.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/NodeNameGenerator.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/NodeNameGenerator.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/NodeNameGenerator.java Tue Feb 12 10:51:56 2008
@@ -32,11 +32,11 @@
     public static final int DEFAULT_MAX_NAME_LENGTH = 20;
     private int maxLength = DEFAULT_MAX_NAME_LENGTH;
     private int counter;
-    
+
     public NodeNameGenerator() {
         this(null);
     }
-    
+
     public NodeNameGenerator(List<String> parameterNames) {
         if(parameterNames == null) {
             this.parameterNames = new LinkedList<String>();
@@ -49,9 +49,9 @@
         } else {
             this.parameterNames = parameterNames;
         }
-        
+
     }
-    
+
     /**
      * Get a "nice" node name, if possible, based on given request
      *
@@ -79,9 +79,8 @@
                         valueToUse = p.getString();
                         if(valueToUse != null && valueToUse.length() > 0) {
                             break;
-                        } else {
-                            valueToUse = null;
                         }
+                        valueToUse = null;
                     }
                 }
             }
@@ -99,7 +98,7 @@
         if(result.length() > maxLength) {
             result = result.substring(0,maxLength);
         }
-        
+
         return result;
     }
 

Modified: incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/RequestProperty.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/RequestProperty.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/RequestProperty.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/RequestProperty.java Tue Feb 12 10:51:56 2008
@@ -114,14 +114,13 @@
             // is missleading return type. but means that property should not
             // get auto-create values
             return true;
-        } else {
-            for (String s: sv) {
-                if (!s.equals("")) {
-                    return true;
-                }
+        }
+        for (String s: sv) {
+            if (!s.equals("")) {
+                return true;
             }
-            return false;
         }
+        return false;
     }
 
     /**
@@ -138,22 +137,21 @@
                 ret[i] = values[i].getString();
             }
             return ret;
-        } else {
-            String value = values[0].getString();
-            if (value.equals("")) {
-                if (defaultValues.length == 1) {
-                    String defValue = defaultValues[0].getString();
-                    if (defValue.equals(DEFAULT_IGNORE)) {
-                        // ignore means, do not create empty values
-                        return new String[0];
-                    } else if (defValue.equals(DEFAULT_NULL)) {
-                        // null means, remove property if exist
-                        return null;
-                    }
-                    value = defValue;
+        }
+        String value = values[0].getString();
+        if (value.equals("")) {
+            if (defaultValues.length == 1) {
+                String defValue = defaultValues[0].getString();
+                if (defValue.equals(DEFAULT_IGNORE)) {
+                    // ignore means, do not create empty values
+                    return new String[0];
+                } else if (defValue.equals(DEFAULT_NULL)) {
+                    // null means, remove property if exist
+                    return null;
                 }
+                value = defValue;
             }
-            return new String[]{value};
         }
+        return new String[]{value};
     }
 }

Modified: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/HttpTestBase.java Tue Feb 12 10:51:56 2008
@@ -23,11 +23,9 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import java.util.LinkedList;
 
 import junit.framework.TestCase;
 
@@ -50,25 +48,25 @@
 public class HttpTestBase extends TestCase {
     public static final String HTTP_BASE_URL = System.getProperty("launchpad.http.server.url");
     public static final String WEBDAV_BASE_URL = System.getProperty("launchpad.webdav.server.url");
-    
+
     /** base path for test files */
     public static final String TEST_PATH = "/launchpad-integration-tests";
-    
+
     public static final String CONTENT_TYPE_HTML = "text/html";
     public static final String CONTENT_TYPE_XML = "text/xml";
     public static final String CONTENT_TYPE_PLAIN = "text/plain";
     public static final String CONTENT_TYPE_JSON = "application/json";
     public static final String CONTENT_TYPE_JS = "application/x-javascript";
     public static final String CONTENT_TYPE_CSS = "text/css";
-    
+
     public static final String SLING_RESOURCE_TYPE = "sling:resourceType";
 
     protected UslingIntegrationTestClient testClient;
     protected HttpClient httpClient;
-    
+
     private static Boolean slingStartupOk;
 
-    /** Class that creates a test node under the given parentPath, and 
+    /** Class that creates a test node under the given parentPath, and
      *  stores useful values for testing. Created for JspScriptingTest,
      *  older test classes do not use it, but it might simplify them.
      */
@@ -77,7 +75,7 @@
         final String nodeUrl;
         final String resourceType;
         final String scriptPath;
-        
+
         TestNode(String parentPath, Map<String, String> properties) throws IOException {
             if(properties == null) {
                 properties = new HashMap<String, String>();
@@ -89,7 +87,7 @@
             scriptPath = "/apps/" + (resourceType == null ? "nt/unstructured" : resourceType);
             testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
         }
-        
+
         void delete() throws IOException {
             testClient.delete(nodeUrl);
         }
@@ -98,7 +96,7 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        
+
         // assume http and webdav are on the same host + port
         URL url = null;
         try {
@@ -107,7 +105,7 @@
             // MalformedURLException doesn't tell us the URL by default
             throw new IOException("MalformedURLException: " + HTTP_BASE_URL);
         }
-        
+
         // setup HTTP client, with authentication (using default Jackrabbit credentials)
         httpClient = new HttpClient();
         httpClient.getParams().setAuthenticationPreemptive(true);
@@ -115,10 +113,10 @@
         httpClient.getState().setCredentials(new AuthScope(url.getHost(), url.getPort(), AuthScope.ANY_REALM), defaultcreds);
 
         testClient = new UslingIntegrationTestClient(httpClient);
-        
+
         waitForSlingStartup();
     }
-    
+
     /** On the server side, initialization of Sling bundles is done
      *  asynchronously once the webapp is started. This method checks
      *  that everything's ready on the server side, by calling an URL
@@ -130,12 +128,11 @@
         if (slingStartupOk != null) {
             if(slingStartupOk) {
                 return;
-            } else {
-                fail("Sling services not available. Already checked in earlier tests.");
             }
+            fail("Sling services not available. Already checked in earlier tests.");
         }
         slingStartupOk = false;
-        
+
         System.err.println("Checking if the required Sling services are started...");
         System.err.println("(base URLs=" + HTTP_BASE_URL + " and " + WEBDAV_BASE_URL + ")");
 
@@ -230,24 +227,24 @@
             assertEquals(assertMessage, expectedStatusCode, status);
         }
     }
-    
-    /** Verify that given URL returns expectedStatusCode 
+
+    /** Verify that given URL returns expectedStatusCode
      * @throws IOException */
     protected void assertHttpStatus(String urlString, int expectedStatusCode) throws IOException {
         assertHttpStatus(urlString, expectedStatusCode, null);
     }
-    
+
     /** Execute a POST request and check status */
     protected void assertPostStatus(String url, int expectedStatusCode, List<NameValuePair> postParams, String assertMessage)
     throws IOException {
         final PostMethod post = new PostMethod(url);
         post.setFollowRedirects(false);
-        
+
         if(postParams!=null) {
             final NameValuePair [] nvp = {};
             post.setRequestBody(postParams.toArray(nvp));
         }
-        
+
         final int status = httpClient.executeMethod(post);
         if(assertMessage == null) {
             assertEquals(expectedStatusCode, status);
@@ -255,7 +252,7 @@
             assertEquals(assertMessage, expectedStatusCode, status);
         }
     }
-    
+
     /** retrieve the contents of given URL and assert its content type
      * @throws IOException
      * @throws HttpException */
@@ -270,12 +267,12 @@
             }
         } else if(h==null) {
             fail(
-                    "Expected Content-Type that starts with '" + expectedContentType 
+                    "Expected Content-Type that starts with '" + expectedContentType
                     +" but got no Content-Type header at " + url
             );
         } else {
             assertTrue(
-                "Expected Content-Type that starts with '" + expectedContentType 
+                "Expected Content-Type that starts with '" + expectedContentType
                 + "' for " + url + ", got '" + h.getValue() + "'",
                 h.getValue().startsWith(expectedContentType)
             );
@@ -304,8 +301,8 @@
     protected void assertJavascript(String expectedOutput, String jsonData, String code) throws IOException {
         assertJavascript(expectedOutput, jsonData, code, null);
     }
-    
-    /** Evaluate given code using given jsonData as the "data" object */ 
+
+    /** Evaluate given code using given jsonData as the "data" object */
     protected void assertJavascript(String expectedOutput, String jsonData, String code, String testInfo) throws IOException {
         // build the code, something like
         //  data = <jsonData> ;
@@ -314,22 +311,22 @@
         final Context rhinoContext = Context.enter();
         final ScriptableObject scope = rhinoContext.initStandardObjects();
 
-        // execute the script, out script variable maps to sw 
+        // execute the script, out script variable maps to sw
         final StringWriter sw = new StringWriter();
         final PrintWriter pw = new PrintWriter(sw, true);
         ScriptableObject.putProperty(scope, "out", Context.javaToJS(pw, scope));
         final int lineNumber = 1;
         final Object securityDomain = null;
-        rhinoContext.evaluateString(scope, jsCode, getClass().getSimpleName(), 
+        rhinoContext.evaluateString(scope, jsCode, getClass().getSimpleName(),
                 lineNumber, securityDomain);
-        
+
         // check script output
         pw.flush();
         final String result = sw.toString().trim();
         if(!result.equals(expectedOutput)) {
             fail(
-                    "Expected '" + expectedOutput 
-                    + "' but got '" + result 
+                    "Expected '" + expectedOutput
+                    + "' but got '" + result
                     + "' for script='" + jsCode + "'"
                     + (testInfo==null ? "" : ", test info=" + testInfo)
             );

Modified: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JavascriptWrappersTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JavascriptWrappersTest.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JavascriptWrappersTest.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JavascriptWrappersTest.java Tue Feb 12 10:51:56 2008
@@ -22,41 +22,41 @@
 
 /** Test Scriptable objects */
 public class JavascriptWrappersTest extends HttpTestBase {
+
     private TestNode testRootNode;
-    private String scriptPath;
     private String basePath;
-    
+
     private void createNodes(TestNode n, String prefix, int levels) throws Exception {
         String url = n.nodeUrl;
         while(levels >= 1) {
-            url += "/" + prefix + levels; 
+            url += "/" + prefix + levels;
             testClient.createNode(url, null);
             levels--;
         }
     }
-    
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        
+
         basePath = "/" + getClass().getSimpleName() + "_" + System.currentTimeMillis();
-        
+
         final Map<String, String> props = new HashMap<String, String>();
         props.put(SLING_RESOURCE_TYPE, getClass().getSimpleName());
         props.put("title", "testnode");
-        
+
         testRootNode = new TestNode(HTTP_BASE_URL + basePath, props);
         createNodes(testRootNode, "a", 3);
         createNodes(testRootNode, "b", 1);
         createNodes(testRootNode, "c", 2);
     }
-    
+
     public void testRecursiveDump() throws IOException {
         final String toDelete = uploadTestScript(testRootNode.scriptPath, "dump-resource.js", "html.js");
         try {
             final String content = getContent(testRootNode.nodeUrl + ".html", CONTENT_TYPE_HTML);
-            
-            final String expected = 
+
+            final String expected =
                 "1 " + basePath + "/testnode\n"
                 + "2 " + basePath + "/testnode/a3\n"
                 + "3 " + basePath + "/testnode/a3/a2\n"
@@ -69,6 +69,6 @@
         } finally {
             testClient.delete(toDelete);
         }
-        
+
     }
 }

Modified: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/SyntheticResourceTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/SyntheticResourceTest.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/SyntheticResourceTest.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/SyntheticResourceTest.java Tue Feb 12 10:51:56 2008
@@ -20,66 +20,66 @@
 
 import java.io.IOException;
 
-/** Test the SLING-129 {@link SyntheticResources}, by requesting
- *  non-existent Nodes that match the "configured" path
- *  patterns of the  {@link SyntheticResourceProvider}.
+
+/** Test the SLING-129 {@link org.apache.sling.api.resource.SyntheticResource}, by requesting
+ *  non-existent Nodes..
  */
 public class SyntheticResourceTest extends HttpTestBase {
 
     /** recurse random URLs under basePath, going nLevels deep,
      *  and check that we get the specified status for every URL
-     * @throws IOException 
-     */ 
+     * @throws IOException
+     */
     private void assertDeepGetStatus(String basePath, int nLevels, int expectedStatus, String urlSuffix) throws IOException {
         String path = basePath;
         for(int level=1; level <= nLevels; level++) {
-            final String url = HTTP_BASE_URL + path + urlSuffix; 
+            final String url = HTTP_BASE_URL + path + urlSuffix;
             assertHttpStatus(url, expectedStatus,"Unexpected status at URL=" + url);
             basePath += "/level_" + level + "_" + (int)(Math.random() * Integer.MAX_VALUE);
         }
     }
-    
+
     public void TODO_FAILS_testSearchSyntheticResource() throws IOException {
         // build a very random deep URL under /search and
         // verify that we get a 200 every time
         assertDeepGetStatus("/search",10,200,"");
     }
-    
+
     public void TODO_FAILS_testSearchSyntheticResourceHtml() throws IOException {
         // build a very random deep URL under /search and
         // verify that we get a 200 every time
         assertDeepGetStatus("/search",10,200,".html");
         assertDeepGetStatus("/search",10,200,".a4.print.html");
     }
-    
+
     public void TODO_FAILS_testSearchSyntheticResourceJson() throws IOException {
         // build a very random deep URL under /search and
         // verify that we get a 200 every time
         assertDeepGetStatus("/search",10,200,".json");
         assertDeepGetStatus("/search",10,200,".a4.print.json");
     }
-    
+
     public void TODO_FAILS_testSearchSyntheticResourceTxt() throws IOException {
         // build a very random deep URL under /search and
         // verify that we get a 200 every time
         assertDeepGetStatus("/search",10,200,".txt");
         assertDeepGetStatus("/search",10,200,".a4.print.txt");
     }
-    
+
     public void testNoSyntheticResourceTest() throws IOException {
-        // walk down a random path, verify that we 
+        // walk down a random path, verify that we
         // get 404s all the time
         final String basePath = "/" + getClass().getSimpleName() + "_" + System.currentTimeMillis() + "/" + (int)(Math.random() * Integer.MAX_VALUE);
         assertDeepGetStatus(basePath,10,404,"");
     }
-    
+
     public void TODO_FAILS_testSyntheticResourceWithJstTemplate() throws IOException {
         final String synthResourceUrl = HTTP_BASE_URL + "/search/something.SyntheticResourceTest.html";
         {
             final String content = getContent(synthResourceUrl, CONTENT_TYPE_HTML);
             assertFalse("Content must not include JST marker before test",content.contains("JST template"));
         }
-        
+
         //final String scriptPath = "/apps/" + SyntheticResource.DEFAULT_RESOURCE_TYPE + "/SyntheticResourceTest";
         final String scriptPath = "TODO";
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);

Modified: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java?rev=627029&r1=627028&r2=627029&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java Tue Feb 12 10:51:56 2008
@@ -20,9 +20,9 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.DeleteMethod;
@@ -36,15 +36,15 @@
 import org.apache.commons.httpclient.methods.multipart.StringPart;
 import org.apache.sling.launchpad.webapp.integrationtest.HttpTestBase;
 
-/** Client functions to interact with microsling in integration tests */ 
+/** Client functions to interact with microsling in integration tests */
 public class UslingIntegrationTestClient {
     private final HttpClient httpClient;
-    
+
     public UslingIntegrationTestClient(HttpClient client) {
         this.httpClient = client;
     }
-    
-    /** Upload a file to the microsling repository 
+
+    /** Upload a file to the microsling repository
      *  @return the HTTP status code
      */
     public int upload(String toUrl, InputStream is) throws IOException {
@@ -52,15 +52,15 @@
         put.setRequestEntity(new InputStreamRequestEntity(is));
         return httpClient.executeMethod(put);
     }
-    
-    /** Delete a file from the microsling repository 
+
+    /** Delete a file from the microsling repository
      *  @return the HTTP status code
      */
     public int delete(String url) throws IOException {
         final DeleteMethod delete = new DeleteMethod(url);
         return httpClient.executeMethod(delete);
     }
-    
+
     /** Create the given directory via WebDAV, if needed, under given URL */
     public void mkdir(String url) throws IOException {
         int status = 0;
@@ -72,14 +72,14 @@
             }
         }
     }
-    
-    /** Create the given directory via WebDAV, including parent directories */ 
+
+    /** Create the given directory via WebDAV, including parent directories */
     public void mkdirs(String baseUrl,String path) throws IOException {
         final String [] paths = path.split("/");
         if(baseUrl.endsWith("/")) {
             baseUrl = baseUrl.substring(0,baseUrl.length() - 1);
         }
-        
+
         String currentPath = baseUrl;
         for(String pathElement : paths) {
             if(pathElement.length() == 0) {
@@ -88,7 +88,7 @@
             currentPath += "/" + pathElement;
             mkdir(currentPath);
         }
-        
+
         final String url = baseUrl + path;
         final int status = httpClient.executeMethod(new GetMethod(url));
         if(status!=200) {
@@ -100,13 +100,13 @@
     public String createNode(String url, Map<String,String> nodeProperties) throws IOException {
         return createNode(url, nodeProperties, null, false);
     }
-    
+
     /** Create a node under given path, using a POST to microsling
      *  @param url under which node is created
-     *  @param multiPart if true, does a multipart POST 
-     *  @return the URL that microsling provides to display the node 
+     *  @param multiPart if true, does a multipart POST
+     *  @return the URL that microsling provides to display the node
      */
-    public String createNode(String url, Map<String,String> clientNodeProperties, Map<String,String> requestHeaders,boolean multiPart) 
+    public String createNode(String url, Map<String,String> clientNodeProperties, Map<String,String> requestHeaders,boolean multiPart)
     throws IOException {
         final PostMethod post = new PostMethod(url);
         post.setFollowRedirects(false);
@@ -118,7 +118,7 @@
         // add ujax specific properties
         nodeProperties.put("ujax:redirect", url);
         nodeProperties.put("ujax:displayExtension", "");
-        
+
         // take over any client provided properties
         if (clientNodeProperties != null) {
             nodeProperties.putAll(clientNodeProperties);
@@ -126,9 +126,9 @@
             // add fake property - otherwise the node is not created
             nodeProperties.put("jcr:created", "");
         }
-        
-        
-        if(nodeProperties != null && nodeProperties.size() > 0) {
+
+
+        if( nodeProperties.size() > 0) {
             if(multiPart) {
                 final List<Part> partList = new ArrayList<Part>();
                 for(Map.Entry<String,String> e : nodeProperties.entrySet()) {
@@ -144,13 +144,13 @@
                 }
             }
         }
-        
+
         if(requestHeaders != null) {
             for(Map.Entry<String,String> e : requestHeaders.entrySet()) {
                 post.addRequestHeader(e.getKey(), e.getValue());
             }
         }
-        
+
         final int status = httpClient.executeMethod(post);
         if(status!=302) {
             throw new IOException("Expected status code 302 for POST, got " + status + ", URL=" + url);
@@ -183,7 +183,7 @@
         post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
 
         final int status = httpClient.executeMethod(post);
-        if(status!=200) { // fmeschbe: The default ujax status is 200, not 302 
+        if(status!=200) { // fmeschbe: The default ujax status is 200, not 302
             throw new IOException("Expected status code 200 for POST, got " + status + ", URL=" + url);
         }
     }