incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r964326 - in /sling/trunk: bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/ bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/ bundles/servlets/get/src/test/java/org/apache/sling...
Date Thu, 15 Jul 2010 07:23:31 GMT
Author: cziegeler
Date: Thu Jul 15 07:23:31 2010
New Revision: 964326

URL: http://svn.apache.org/viewvc?rev=964326&view=rev
Log:
Code cleanup and implement new methods of resource resolver.

Modified:
    sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
    sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java
    sling/trunk/bundles/servlets/get/src/test/java/org/apache/sling/servlets/get/impl/MockResourceResolver.java
    sling/trunk/contrib/extensions/i18n/src/test/java/org/apache/sling/i18n/impl/JcrResourceBundleTest.java
    sling/trunk/installer/jcr/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/impl/MiscUtil.java

Modified: sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java?rev=964326&r1=964325&r2=964326&view=diff
==============================================================================
--- sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
(original)
+++ sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
Thu Jul 15 07:23:31 2010
@@ -18,8 +18,6 @@ package org.apache.sling.commons.testing
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
@@ -43,8 +41,6 @@ import org.apache.commons.httpclient.aut
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.sling.commons.testing.util.JavascriptEngine;
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.ScriptableObject;
 
 /** Base class for HTTP-based Sling Launchpad integration tests */
 public class HttpTestBase extends TestCase {
@@ -62,10 +58,10 @@ public class HttpTestBase extends TestCa
     public static final String CONTENT_TYPE_CSS = "text/css";
 
     public static final String SLING_RESOURCE_TYPE = "sling:resourceType";
-    
+
     public static final String SLING_POST_SERVLET_CREATE_SUFFIX = "/";
 	public static final String DEFAULT_EXT = ".txt";
-	
+
 	public static final String EXECUTE_RESOURCE_TYPE = "SlingTesting" + HttpTestBase.class.getSimpleName();
 	private static int executeCounter;
 
@@ -75,15 +71,15 @@ public class HttpTestBase extends TestCa
     protected HttpClient httpClient;
 
     private static Boolean slingStartupOk;
-    
+
     /** Means "don't care about Content-Type" in getContent(...) methods */
     public static final String CONTENT_TYPE_DONTCARE = "*";
 
     /** URLs stored here are deleted in tearDown */
     protected final List<String> urlsToDelete = new LinkedList<String>();
-    
+
     /** Need to execute javascript code */
-    private final JavascriptEngine javascriptEngine = new JavascriptEngine(); 
+    private final JavascriptEngine javascriptEngine = new JavascriptEngine();
 
     /** Class that creates a test node under the given parentPath, and
      *  stores useful values for testing. Created for JspScriptingTest,
@@ -305,9 +301,9 @@ public class HttpTestBase extends TestCa
     protected String getContent(String url, String expectedContentType, List<NameValuePair>
params) throws IOException {
         return getContent(url, expectedContentType, params, HttpServletResponse.SC_OK);
     }
-    
+
     /** retrieve the contents of given URL and assert its content type
-     * @param expectedContentType use CONTENT_TYPE_DONTCARE if must not be checked 
+     * @param expectedContentType use CONTENT_TYPE_DONTCARE if must not be checked
      * @throws IOException
      * @throws HttpException */
     protected String getContent(String url, String expectedContentType, List<NameValuePair>
params, int expectedStatusCode) throws IOException {
@@ -359,15 +355,15 @@ public class HttpTestBase extends TestCa
         }
         return url;
     }
-    
+
     /** Upload script, execute with no parameters and return content */
     protected String executeScript(String localFilename) throws Exception {
         return executeScript(localFilename, null);
     }
-    
+
     /** Upload script, execute with given parameters (optional) and return content */
     protected String executeScript(String localFilename, List<NameValuePair> params)
throws Exception {
-        
+
         // Use unique resource type
         int counter = 0;
         synchronized (getClass()) {
@@ -376,13 +372,13 @@ public class HttpTestBase extends TestCa
         final String resourceType = EXECUTE_RESOURCE_TYPE + counter;
         final String scriptPath = "/apps/" + resourceType;
         testClient.mkdirs(WEBDAV_BASE_URL , scriptPath);
-        
+
         final int pos = localFilename.lastIndexOf(".");
         if(pos < 1) {
             throw new IllegalArgumentException("localFilename must have extension (" + localFilename
+ ")");
         }
         final String ext = localFilename.substring(pos + 1);
-        final List<String> toDelete = new LinkedList<String>(); 
+        final List<String> toDelete = new LinkedList<String>();
         try {
             toDelete.add(uploadTestScript(scriptPath, localFilename, "txt." + ext));
             final Map<String, String> props = new HashMap<String, String>();

Modified: sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java?rev=964326&r1=964325&r2=964326&view=diff
==============================================================================
--- sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java
(original)
+++ sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java
Thu Jul 15 07:23:31 2010
@@ -163,4 +163,12 @@ public class MockResourceResolver implem
     public void close() {
         // nothing to do
     }
+
+    public String getUserID() {
+        return null;
+    }
+
+    public boolean isLive() {
+        return true;
+    }
 }

Modified: sling/trunk/bundles/servlets/get/src/test/java/org/apache/sling/servlets/get/impl/MockResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/get/src/test/java/org/apache/sling/servlets/get/impl/MockResourceResolver.java?rev=964326&r1=964325&r2=964326&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/get/src/test/java/org/apache/sling/servlets/get/impl/MockResourceResolver.java
(original)
+++ sling/trunk/bundles/servlets/get/src/test/java/org/apache/sling/servlets/get/impl/MockResourceResolver.java
Thu Jul 15 07:23:31 2010
@@ -84,4 +84,12 @@ public class MockResourceResolver implem
     public void close() {
         // nothing to do
     }
+
+    public String getUserID() {
+        return null;
+    }
+
+    public boolean isLive() {
+        return true;
+    }
 }

Modified: sling/trunk/contrib/extensions/i18n/src/test/java/org/apache/sling/i18n/impl/JcrResourceBundleTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/i18n/src/test/java/org/apache/sling/i18n/impl/JcrResourceBundleTest.java?rev=964326&r1=964325&r2=964326&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/i18n/src/test/java/org/apache/sling/i18n/impl/JcrResourceBundleTest.java
(original)
+++ sling/trunk/contrib/extensions/i18n/src/test/java/org/apache/sling/i18n/impl/JcrResourceBundleTest.java
Thu Jul 15 07:23:31 2010
@@ -162,6 +162,14 @@ public class JcrResourceBundleTest exten
             public void close() {
                 // nothing to do
             }
+
+            public String getUserID() {
+                return null;
+            }
+
+            public boolean isLive() {
+                return true;
+            }
         };
 
         createTestContent();

Modified: sling/trunk/installer/jcr/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/impl/MiscUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/jcr/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/impl/MiscUtil.java?rev=964326&r1=964325&r2=964326&view=diff
==============================================================================
--- sling/trunk/installer/jcr/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/impl/MiscUtil.java
(original)
+++ sling/trunk/installer/jcr/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/impl/MiscUtil.java
Thu Jul 15 07:23:31 2010
@@ -105,6 +105,10 @@ class MiscUtil {
         public String getUserID() {
             return null;
         }
+
+        public boolean isLive() {
+            return true;
+        }
     }
 
     /** Set a non-public Field */



Mime
View raw message