incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r921504 - in /sling/trunk/contrib: launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/scala/ scripting/scala/samples/hello-world/src/main/scala/helloworld/ scripting/scala/script/src/main/scala/org/apache/slin...
Date Wed, 10 Mar 2010 18:44:42 GMT
Author: cziegeler
Date: Wed Mar 10 18:44:41 2010
New Revision: 921504

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

Modified:
    sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/scala/ScalaScriptingTest.java
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/scala/helloworld/htmlVars.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala

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=921504&r1=921503&r2=921504&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 18:44:41 2010
@@ -22,19 +22,19 @@ import org.apache.sling.commons.testing.
 
 public class ScalaScriptingTest extends HttpTestBase {
 
+    /**
+     * The first request on a fresh Sling instance always fails with
+     * javax.script.ScriptException: ERROR : error while loading ScriptHelper,
+     * class file 'org/apache/sling/scripting/core/ScriptHelper.class' is broken
+     * (class org.osgi.framework.BundleContext not found.)
+     *
+     * For the time being this is a known issue. Until this is fixed this test
+     * is here to catch this first request and make subsequent tests pass.
+     * @throws IOException
+     */
     public void testIgnore() throws IOException {
-        try {
-            String url = HTTP_BASE_URL + "/content/helloworld.html";
-            getContent(url, CONTENT_TYPE_HTML);
-        }
-        catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        catch (AssertionError e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+        String url = HTTP_BASE_URL + "/content/helloworld.html";
+        getContent(url, CONTENT_TYPE_HTML);
     }
 
     public void testHelloWorldApp() throws IOException {

Modified: sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/scala/helloworld/htmlVars.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/scala/helloworld/htmlVars.scala?rev=921504&r1=921503&r2=921504&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/scala/helloworld/htmlVars.scala
(original)
+++ sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/scala/helloworld/htmlVars.scala
Wed Mar 10 18:44:41 2010
@@ -18,5 +18,6 @@ package helloworld
 
 class htmlVars {
   val currentNode: javax.jcr.Node = null
+  val resource: org.apache.sling.api.adapter.Adaptable = null
 }
 

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala?rev=921504&r1=921503&r2=921504&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala
(original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala
Wed Mar 10 18:44:41 2010
@@ -129,6 +129,11 @@ class ScalaScriptEngine(factory: ScalaSc
           def write(b: Int) {
             writer.write(b)
           }
+          
+          @throws(classOf[IOException])
+          override def flush() {
+            writer.flush()
+          }
         }
         
         val inputStream = new InputStream {

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala?rev=921504&r1=921503&r2=921504&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala
(original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala
Wed Mar 10 18:44:41 2010
@@ -63,7 +63,7 @@ trait Bindings extends Map[String, AnyRe
     def getInterfacesUpTo(clazz: Class[_], bound: Class[_]) = {
       def getInterfacesUpTo(intfs: mutable.Set[Class[_]], clazz: Class[_], bound: Class[_]):
mutable.Set[Class[_]] = 
         if (clazz == bound) intfs
-        else getInterfacesUpTo(intfs ++ clazz.getInterfaces, clazz.getSuperclass, bound)
+        else getInterfacesUpTo(intfs ++ clazz.getInterfaces.filter(accessible(_)), clazz.getSuperclass,
bound)
       
       getInterfacesUpTo(mutable.Set.empty, clazz, bound)
     }
@@ -71,7 +71,7 @@ trait Bindings extends Map[String, AnyRe
     def accessible(clazz: Class[_]) = {
       try {
         Class.forName(clazz.getName)
-        true
+        (clazz.getModifiers & 1) == 1
       } 
       catch { case _ => false }
     }



Mime
View raw message