Author: cziegeler
Date: Wed Mar 10 11:39:08 2010
New Revision: 921312

URL: http://svn.apache.org/viewvc?rev=921312&view=rev
Log:
SLING-1350 : Many test failures in contrib/launchpad/testing. Applied patch 
from Michael Dürig

Removed:
    
sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/scala/rendering-test.scs
Modified:
    sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml
    
sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/scala/ScalaScriptingTest.java

Modified: sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml?rev=921312&r1=921311&r2=921312&view=diff
==============================================================================
--- sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml (original)
+++ sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml Wed Mar 10 
11:39:08 2010
@@ -30,6 +30,16 @@
             <version>0.9.0-SNAPSHOT</version>
         </bundle>
         <bundle>
+            <groupId>org.apache.sling</groupId>
+            
<artifactId>org.apache.sling.scripting.scala.hello-world</artifactId>
+            <version>0.9.0-SNAPSHOT</version>
+        </bundle>
+        <bundle>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.scripting.scala.forum</artifactId>
+            <version>0.9.0-SNAPSHOT</version>
+        </bundle>
+        <bundle>
             <groupId>org.scala-lang-osgi</groupId>
             <artifactId>scala-library</artifactId>
             <version>2.7.7</version>

Modified: 
sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/scala/ScalaScriptingTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/scala/ScalaScriptingTest.java?rev=921312&r1=921311&r2=921312&view=diff
==============================================================================
--- 
sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/scala/ScalaScriptingTest.java
 (original)
+++ 
sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/scala/ScalaScriptingTest.java
 Wed Mar 10 11:39:08 2010
@@ -16,69 +16,43 @@
  */
 package org.apache.sling.launchpad.webapp.integrationtest.scala;
 
-import java.util.HashMap;
-import java.util.Map;
+import java.io.IOException;
 
 import org.apache.sling.commons.testing.integration.HttpTestBase;
-import org.apache.sling.servlets.post.SlingPostConstants;
 
 public class ScalaScriptingTest extends HttpTestBase {
-    private String testRootUrl;
-    private TestNode testNode;
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        final String testRootPath = HTTP_BASE_URL + "/" + 
getClass().getSimpleName() + "/" + System.currentTimeMillis();
-        testRootUrl = testClient.createNode(testRootPath + 
SlingPostConstants.DEFAULT_CREATE_SUFFIX, null);
-
-        Map<String, String> nodeProperties = new HashMap<String, String>();
-        nodeProperties.put("jcr:primaryType", "nt:folder");
-
-        // fixme: this is a workaround for the post servlet returning 200 
instead of 302
-        // if the path is /var/classes
-        nodeProperties.put(":redirect", "*.json");
-
-        testClient.createNode(HTTP_BASE_URL + "/var/classes", nodeProperties);
-        testNode = new TestNode(testRootPath + "/test", null);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        testClient.delete(testRootUrl);
-        super.tearDown();
-    }
-
-    public void testNoScript() throws Exception {
-        final String content = getContent(testNode.nodeUrl + ".txt", 
CONTENT_TYPE_PLAIN);
-        assertTrue(content.contains("PlainTextRendererServlet"));
-        assertTrue("Content contains " + testNode.testText + " (" + content + 
")", content.contains(testNode.testText));
-    }
-
-    public void testScala() throws Exception {
-        final String toDelete = uploadTestScript(testNode.scriptPath, 
"scala/rendering-test.scs", "html.scala");
+    public void testIgnore() throws IOException {
         try {
-            checkContent(testNode);
+            String url = HTTP_BASE_URL + "/content/helloworld.html";
+            getContent(url, CONTENT_TYPE_HTML);
         }
-        finally {
-            if(toDelete != null) {
-                testClient.delete(toDelete);
-            }
+        catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        catch (AssertionError e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
         }
     }
 
-    private void checkContent(TestNode node) throws Exception {
-        final String content = getContent(node.nodeUrl + ".html", 
CONTENT_TYPE_HTML);
-        assertTrue("Scala script executed as expected (" + content + ")", 
content.contains("<h1>Scala rendering result</h1>"));
-
-        final String [] expected = {
-                "using resource.adaptTo:" + node.testText,
-                "using currentNode:" + node.testText,
-        };
-        for(String exp : expected) {
-            assertTrue("Content contains " + exp + "(" + content + ")", 
content.contains(exp));
-        }
+    public void testHelloWorldApp() throws IOException {
+        String url = HTTP_BASE_URL + "/content/helloworld.html";
+        String content = getContent(url, CONTENT_TYPE_HTML);
+
+        assertTrue(content.contains("<h1>Hello World</h1>"));
+        assertTrue(content.contains("My path is /content/helloworld 
<br></br>"));
+    }
+
+    public void testForumApp() throws IOException {
+        String url = HTTP_BASE_URL + "/content/forum.html";
+        String content = getContent(url, CONTENT_TYPE_HTML);
+
+        assertTrue(content.contains("Welcome to the Scala for Sling forum"));
+        assertTrue(content.contains("(<a 
href=\"/content/forum/scala4sling.thread.html\">show thread</a>)"));
+        assertTrue(content.contains("(<a 
href=\"/content/forum/sling.thread.html\">show thread</a>)"));
+        assertTrue(content.contains("<img 
src=\"/content/forum/sling/logo/jcr:content\"></img>"));
     }
 
 }


Reply via email to