incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r591074 - in /incubator/sling/trunk/microsling/microsling-core: ./ src/main/java/org/apache/sling/microsling/scripting/ src/main/java/org/apache/sling/microsling/scripting/engines/rhino/ src/test/java/org/apache/sling/microsling/integration...
Date Thu, 01 Nov 2007 16:35:06 GMT
Author: bdelacretaz
Date: Thu Nov  1 09:35:05 2007
New Revision: 591074

URL: http://svn.apache.org/viewvc?rev=591074&view=rev
Log:
SLING-92 - all tests pass except StreamServletTest

Modified:
    incubator/sling/trunk/microsling/microsling-core/pom.xml
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/RhinoJavasSriptEngine.java
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/ScriptableResource.java
    incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java
    incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/RenderingTestBase.java
    incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java
    incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.ftl
    incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.vlt

Modified: incubator/sling/trunk/microsling/microsling-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/pom.xml?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/pom.xml (original)
+++ incubator/sling/trunk/microsling/microsling-core/pom.xml Thu Nov  1 09:35:05 2007
@@ -222,11 +222,11 @@
                     -->
                     <property>
                       <name>microsling.http.server.url</name>
-                      <value>http://localhost:8080/microsling-1.0-incubator-SNAPSHOT/microsling</value>
+                      <value>http://localhost:8080/microsling-core-1.0-incubator-SNAPSHOT/microsling</value>
                     </property>
                     <property>
                       <name>microsling.webdav.server.url</name>
-                      <value>http://localhost:8080/microsling-1.0-incubator-SNAPSHOT/repository/default</value>
+                      <value>http://localhost:8080/microsling-core-1.0-incubator-SNAPSHOT/repository/default</value>
                     </property>
                   </systemProperties>
                 </configuration>

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
Thu Nov  1 09:35:05 2007
@@ -40,6 +40,7 @@
 import org.apache.sling.api.scripting.SlingScript;
 import org.apache.sling.api.scripting.SlingScriptEngine;
 import org.apache.sling.api.scripting.SlingScriptResolver;
+import org.apache.sling.microsling.scripting.engines.freemarker.FreemarkerScriptEngine;
 import org.apache.sling.microsling.scripting.engines.rhino.RhinoJavasSriptEngine;
 import org.apache.sling.microsling.scripting.engines.velocity.VelocityTemplatesScriptEngine;
 import org.apache.sling.microsling.scripting.helpers.ScriptFilenameBuilder;
@@ -79,6 +80,7 @@
         scriptEngines = new HashMap<String, SlingScriptEngine>();
         addScriptEngine(new RhinoJavasSriptEngine());
         addScriptEngine(new VelocityTemplatesScriptEngine());
+        addScriptEngine(new FreemarkerScriptEngine());
     }
 
     /**
@@ -102,6 +104,7 @@
             props.put(SlingScriptEngine.SLING, helper);
             props.put(SlingScriptEngine.RESOURCE, helper.getRequest().getResource());
             props.put(SlingScriptEngine.REQUEST, helper.getRequest());
+            props.put(SlingScriptEngine.RESOURCE, helper.getRequest().getResource());
             props.put(SlingScriptEngine.RESPONSE, helper.getResponse());
             props.put(SlingScriptEngine.OUT, helper.getResponse().getWriter());
             props.put(SlingScriptEngine.LOG, LoggerFactory.getLogger(script.getScriptPath()));

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/RhinoJavasSriptEngine.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/RhinoJavasSriptEngine.java?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/RhinoJavasSriptEngine.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/RhinoJavasSriptEngine.java
Thu Nov  1 09:35:05 2007
@@ -109,8 +109,7 @@
         if (entry instanceof Resource) {
             try {
                 ScriptableObject.defineClass(scope, ScriptableResource.class);
-                return context.newObject(scope, "Resource",
-                    new Object[] { entry });
+                return context.newObject(scope, "Resource",  new Object[] { entry });
             } catch (Exception e) {
                 return Context.javaToJS(entry, scope);
             }

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/ScriptableResource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/ScriptableResource.java?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/ScriptableResource.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/engines/rhino/ScriptableResource.java
Thu Nov  1 09:35:05 2007
@@ -51,7 +51,16 @@
         return resource.getRawData();
     }
 
+    /** alias for getRawData */
     public Object jsGet_item() {
+        if (resource.getRawData() instanceof Node) {
+            return new ScriptableNode((Node) resource.getRawData());
+        } else {
+            return Undefined.instance;
+        }
+    }
+    
+    public Object jsGet_rawData() {
         if (resource.getRawData() instanceof Node) {
             return new ScriptableNode((Node) resource.getRawData());
         } else if (resource.getRawData() != null) {

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java
Thu Nov  1 09:35:05 2007
@@ -44,9 +44,14 @@
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
     }
     
-    public void testWithoutScript() throws IOException {
-        final String content = getContent(displayUrl + ".html", CONTENT_TYPE_PLAIN);
-        assertTrue("Content includes default servlet marker",content.contains("dumped by
DefaultSlingServlet"));
+    public void testWithoutScriptTxt() throws IOException {
+        final String content = getContent(displayUrl + ".txt", CONTENT_TYPE_PLAIN);
+        assertTrue("Content includes PlainTextRendererServlet marker",content.contains("dumped
by PlainTextRendererServlet"));
+    }
+    
+    public void testWithoutScriptHtml() throws IOException {
+        final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML);
+        assertTrue("Content includes DefaultHtmlRendererServlet marker",content.contains("dumped
by DefaultHtmlRendererServlet"));
     }
     
     public void testEspHtml() throws IOException {

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/RenderingTestBase.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/RenderingTestBase.java?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/RenderingTestBase.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/RenderingTestBase.java
Thu Nov  1 09:35:05 2007
@@ -19,9 +19,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.methods.GetMethod;
-
 /** Base class for rendering tests
  */
 class RenderingTestBase extends MicroslingHttpTestBase {
@@ -36,13 +33,6 @@
         final String testFile = "/integration-test/" + localFilename;
         final InputStream data = getClass().getResourceAsStream(testFile);
         try {
-            System.out.println();
-            System.out.println();
-            System.out.println("Path " + testFile);
-            System.out.println("Loader " + getClass().getClassLoader());
-            System.out.println("Uploading " + data);
-            System.out.println();
-            System.out.println();
             testClient.upload(url, data);
         } finally {
             if(data!=null) {

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java
Thu Nov  1 09:35:05 2007
@@ -48,9 +48,14 @@
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
     }
     
-    public void testWithoutScript() throws IOException {
-        final String content = getContent(displayUrl + ".html", CONTENT_TYPE_PLAIN);
-        assertTrue("Content includes default servlet marker",content.contains("dumped by
DefaultSlingServlet"));
+    public void testWithoutScriptTxt() throws IOException {
+        final String content = getContent(displayUrl + ".txt", CONTENT_TYPE_PLAIN);
+        assertTrue("Content includes PlainTextRendererServlet marker",content.contains("dumped
by PlainTextRendererServlet"));
+    }
+    
+    public void testWithoutScriptHtml() throws IOException {
+        final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML);
+        assertTrue("Content includes DefaultHtmlRendererServlet marker",content.contains("dumped
by DefaultHtmlRendererServlet"));
     }
     
     public void testEspHtml() throws IOException {

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.ftl
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.ftl?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.ftl
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.ftl
Thu Nov  1 09:35:05 2007
@@ -2,6 +2,6 @@
 <html>
 	<body>
 		FreeMarker template
-		<p><span>${resource.getItem().getProperty("text").getString()}</span></p>
+		<p><span>${resource.getRawData().getProperty("text").getString()}</span></p>
 	</body>
 </html>

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.vlt
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.vlt?rev=591074&r1=591073&r2=591074&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.vlt
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/resources/integration-test/rendering-test.vlt
Thu Nov  1 09:35:05 2007
@@ -2,6 +2,6 @@
 <html>
 	<body>
 		Velocity template
-		<p><b>$resource.getItem().getProperty("text").getString()</b></p>
+		<p><b>$resource.getRawData().getProperty("text").getString()</b></p>
 	</body>
 </html>



Mime
View raw message