You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/05/25 17:12:30 UTC
svn commit: r948071 - in /jakarta/bsf/branches/bsf3.x:
bsf-api/src/test/java/org/apache/bsf/
bsf-api/src/test/java/org/apache/bsf/utils/ bsf-engines/ distribution/
testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/
testing/e4x/src/test/j...
Author: sebb
Date: Tue May 25 15:12:29 2010
New Revision: 948071
URL: http://svn.apache.org/viewvc?rev=948071&view=rev
Log:
Tab police.
Also trimmed trailing whitespace
Modified:
jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/FactoryTest.java
jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/ScriptEngineManagerTest.java
jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestCompiledScript.java
jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestScriptEngineFactory.java
jakarta/bsf/branches/bsf3.x/bsf-engines/build.xml
jakarta/bsf/branches/bsf3.x/bsf-engines/pom.xml
jakarta/bsf/branches/bsf3.x/distribution/build.xml
jakarta/bsf/branches/bsf3.x/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/E4xAxiomTestCase.java
jakarta/bsf/branches/bsf3.x/testing/e4x/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java
jakarta/bsf/branches/bsf3.x/testing/groovy-1.1/src/test/java/org/apache/bsf/testing/groovy/Groovy11Testcase.java
jakarta/bsf/branches/bsf3.x/testing/groovy/src/test/java/org/apache/bsf/testing/groovy/GroovyTestcase.java
jakarta/bsf/branches/bsf3.x/testing/javascript/src/test/java/org/apache/bsf/testing/javascript/JavaScriptTestcase.java
jakarta/bsf/branches/bsf3.x/testing/jexl/src/test/java/org/apache/bsf/testing/jexl/JexlTestCase.java
jakarta/bsf/branches/bsf3.x/testing/jruby-1.1.2/src/test/java/org/apache/bsf/testing/javascript/JRuby112Testcase.java
jakarta/bsf/branches/bsf3.x/testing/jruby-1.2.0/src/test/java/org/apache/bsf/testing/javascript/JRuby120Testcase.java
jakarta/bsf/branches/bsf3.x/testing/python/src/test/java/org/apache/bsf/testing/python/HelloTestCase.java
jakarta/bsf/branches/bsf3.x/testing/ruby/src/test/java/org/apache/bsf/testing/javascript/RubyTestcase.java
Modified: jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/FactoryTest.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/FactoryTest.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/FactoryTest.java (original)
+++ jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/FactoryTest.java Tue May 25 15:12:29 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.bsf;
@@ -29,8 +29,8 @@ import junit.framework.TestCase;
* also reports runtime details
*/
public class FactoryTest extends TestCase {
-
-
+
+
private void show(String key){
System.out.println(key+"="+System.getProperty(key));
}
@@ -56,9 +56,9 @@ public class FactoryTest extends TestCas
if (isBSFClass == null) {
System.out.println("ScriptEngineManager class - implementation unknown");
} else if (isBSFClass.booleanValue()) {
- System.out.println("ScriptEngineManager class is from Apache BSF");
+ System.out.println("ScriptEngineManager class is from Apache BSF");
} else {
- System.out.println("ScriptEngineManager class is not Apache BSF");
+ System.out.println("ScriptEngineManager class is not Apache BSF");
}
final int count = sem.getEngineFactories().size();
assertTrue("Must find some factories",count>0);
Modified: jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/ScriptEngineManagerTest.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/ScriptEngineManagerTest.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/ScriptEngineManagerTest.java (original)
+++ jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/ScriptEngineManagerTest.java Tue May 25 15:12:29 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.bsf;
@@ -33,34 +33,34 @@ import org.apache.bsf.utils.TestScriptEn
import org.apache.bsf.utils.TestScriptEngineFactory;
public class ScriptEngineManagerTest extends TestCase {
- private ScriptEngineManager mgr = null;
-
- public ScriptEngineManagerTest() {
- super("ScriptEngineManagerTest");
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- mgr = new ScriptEngineManager();
- }
-
- public void testScriptEngineManager() {
- assertNotNull(mgr);
- List facs = mgr.getEngineFactories();
- assertNotNull(facs);
- assertTrue(facs.size() > 0); // need at least one
- }
-
- public void testGetPut() {
- mgr.put("x", new Integer(1));
- Object retValue = mgr.get("x");
- assertEquals(new Integer(1), retValue);
- try {
+ private ScriptEngineManager mgr = null;
+
+ public ScriptEngineManagerTest() {
+ super("ScriptEngineManagerTest");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ mgr = new ScriptEngineManager();
+ }
+
+ public void testScriptEngineManager() {
+ assertNotNull(mgr);
+ List facs = mgr.getEngineFactories();
+ assertNotNull(facs);
+ assertTrue(facs.size() > 0); // need at least one
+ }
+
+ public void testGetPut() {
+ mgr.put("x", new Integer(1));
+ Object retValue = mgr.get("x");
+ assertEquals(new Integer(1), retValue);
+ try {
mgr.get(null);
fail("Expected NullPointerException");
} catch (NullPointerException e) {
}
- try {
+ try {
mgr.get("");
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
@@ -69,53 +69,53 @@ public class ScriptEngineManagerTest ext
assertNull(mgr.get("null_Key"));
mgr.put("null_Key", null);
assertNull(mgr.get("null_Key"));
- }
+ }
+
+ public void testGetEngineByExtension() {
+ ScriptEngine engine;
- public void testGetEngineByExtension() {
- ScriptEngine engine;
-
- engine = mgr.getEngineByExtension("tEst");
+ engine = mgr.getEngineByExtension("tEst");
assertNotNull(engine);
- assertTrue(engine instanceof TestScriptEngine);
-
- engine = mgr.getEngineByExtension("teSt");
+ assertTrue(engine instanceof TestScriptEngine);
+
+ engine = mgr.getEngineByExtension("teSt");
assertNotNull(engine);
- assertTrue(engine instanceof TestScriptEngine);
- }
+ assertTrue(engine instanceof TestScriptEngine);
+ }
- public void testGetEngineByMimeType() {
+ public void testGetEngineByMimeType() {
ScriptEngine engine;
engine = mgr.getEngineByMimeType("application/junit");
assertNotNull(engine);
assertTrue(engine instanceof TestScriptEngine);
- }
+ }
+
+ public void testGetEngineByName() {
+ ScriptEngine engine;
+
+ engine = mgr.getEngineByName("JUnit");
+ assertNotNull(engine);
+ assertTrue(engine instanceof TestScriptEngine);
+ }
+
+ public void testGetEngineFactories() {
+ boolean found = false;
+ List factories = mgr.getEngineFactories();
+
+ for(int i = 0; i < factories.size(); i++) {
+ if (factories.get(i) instanceof TestScriptEngineFactory) {
+ found = true;
+ break;
+ }
+ }
- public void testGetEngineByName() {
- ScriptEngine engine;
-
- engine = mgr.getEngineByName("JUnit");
- assertNotNull(engine);
- assertTrue(engine instanceof TestScriptEngine);
- }
-
- public void testGetEngineFactories() {
- boolean found = false;
- List factories = mgr.getEngineFactories();
-
- for(int i = 0; i < factories.size(); i++) {
- if (factories.get(i) instanceof TestScriptEngineFactory) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- fail("ScriptEngineManager.getEngineFactories(): " +
- "TestScriptEngineFactory is not present ..");
- }
- }
+ if (!found) {
+ fail("ScriptEngineManager.getEngineFactories(): " +
+ "TestScriptEngineFactory is not present ..");
+ }
+ }
- public void testRegisterEngineExtension() {
+ public void testRegisterEngineExtension() {
try {
mgr.registerEngineExtension(null, null);
fail("Expected NullPointerException");
@@ -138,9 +138,9 @@ public class ScriptEngineManagerTest ext
assertNull(mgr.getEngineByExtension("junit2")); // not yet defined
mgr.registerEngineExtension("junit2", new TestScriptEngineFactory());
assertNotNull(mgr.getEngineByExtension("junit2")); //now defined
- }
+ }
- public void testRegisterEngineName() {
+ public void testRegisterEngineName() {
try {
mgr.registerEngineName(null, null);
fail("Expected NullPointerException");
@@ -163,9 +163,9 @@ public class ScriptEngineManagerTest ext
assertNull(mgr.getEngineByName("junit2")); // not yet defined
mgr.registerEngineName("junit2", new TestScriptEngineFactory());
assertNotNull(mgr.getEngineByName("junit2")); //now defined
- }
+ }
- public void testRegisterEngineMimeType() {
+ public void testRegisterEngineMimeType() {
try {
mgr.registerEngineMimeType(null, null);
fail("Expected NullPointerException");
@@ -188,11 +188,11 @@ public class ScriptEngineManagerTest ext
assertNull(mgr.getEngineByMimeType("junit2")); // not yet defined
mgr.registerEngineMimeType("junit2", new TestScriptEngineFactory());
assertNotNull(mgr.getEngineByMimeType("junit2")); //now defined
- }
+ }
- public void testSetBindings() {
- assertNotNull(mgr.getBindings());
- try {
+ public void testSetBindings() {
+ assertNotNull(mgr.getBindings());
+ try {
mgr.setBindings(null);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
@@ -201,22 +201,22 @@ public class ScriptEngineManagerTest ext
assertNotSame(bindings, mgr.getBindings());
mgr.setBindings(bindings);
assertSame(bindings, mgr.getBindings());
- }
+ }
+
+ public void testEvalAndCompile() throws ScriptException{
+ ScriptEngine se = mgr.getEngineByName("JUnit");
+ assertNotNull(se);
+ se.put("key", "value");
+ assertEquals("value",se.eval("key"));
+ if (se instanceof Compilable){
+ Compilable co = (Compilable) se;
+ CompiledScript cs = co.compile("key");
+ assertNotNull(cs);
+ assertEquals("value",cs.eval());
+ assertEquals("value",cs.eval());
+ } else {
+ fail("Expected engine to implement Compilable");
+ }
+ }
- public void testEvalAndCompile() throws ScriptException{
- ScriptEngine se = mgr.getEngineByName("JUnit");
- assertNotNull(se);
- se.put("key", "value");
- assertEquals("value",se.eval("key"));
- if (se instanceof Compilable){
- Compilable co = (Compilable) se;
- CompiledScript cs = co.compile("key");
- assertNotNull(cs);
- assertEquals("value",cs.eval());
- assertEquals("value",cs.eval());
- } else {
- fail("Expected engine to implement Compilable");
- }
- }
-
}
Modified: jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestCompiledScript.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestCompiledScript.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestCompiledScript.java (original)
+++ jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestCompiledScript.java Tue May 25 15:12:29 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.bsf.utils;
@@ -30,7 +30,7 @@ public class TestCompiledScript extends
private final ScriptEngine engine;
private final String compiled;
-
+
public TestCompiledScript(TestScriptEngine testScriptEngine, String script) {
engine = testScriptEngine;
compiled = script;
Modified: jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestScriptEngineFactory.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestScriptEngineFactory.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestScriptEngineFactory.java (original)
+++ jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/utils/TestScriptEngineFactory.java Tue May 25 15:12:29 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.bsf.utils;
@@ -29,32 +29,32 @@ import javax.script.ScriptEngineFactory;
* Minimal ScriptEngineFactory for use in JUnit tests.
*/
public class TestScriptEngineFactory implements ScriptEngineFactory {
-
- public ScriptEngine getScriptEngine() {
- return new TestScriptEngine();
- }
-
- public String getEngineName() {
- return "TestScriptEngine";
- }
- public String getEngineVersion() {
- return "1.0";
- }
- public List getExtensions() {
- return Collections.unmodifiableList(Arrays.asList(new String[]{"tEst","teSt"}));
- }
- public String getLanguageName() {
- return "TestScript";
- }
- public String getLanguageVersion() {
- return "1.0";
- }
- public List getMimeTypes() {
- return Collections.unmodifiableList(Arrays.asList(new String[]{"application/junit"}));
- }
-
- public Object getParameter(String key) {
+
+ public ScriptEngine getScriptEngine() {
+ return new TestScriptEngine();
+ }
+
+ public String getEngineName() {
+ return "TestScriptEngine";
+ }
+ public String getEngineVersion() {
+ return "1.0";
+ }
+ public List getExtensions() {
+ return Collections.unmodifiableList(Arrays.asList(new String[]{"tEst","teSt"}));
+ }
+ public String getLanguageName() {
+ return "TestScript";
+ }
+ public String getLanguageVersion() {
+ return "1.0";
+ }
+ public List getMimeTypes() {
+ return Collections.unmodifiableList(Arrays.asList(new String[]{"application/junit"}));
+ }
+
+ public Object getParameter(String key) {
if (key == ScriptEngine.ENGINE) {
return getEngineName();
} else if (key == ScriptEngine.ENGINE_VERSION) {
@@ -66,10 +66,10 @@ public class TestScriptEngineFactory imp
} else if(key == ScriptEngine.ENGINE_VERSION) {
return getLanguageVersion();
} else if (key == "THREADING") {
- return "MULTITHREADED";
- }
+ return "MULTITHREADED";
+ }
return null;
- }
+ }
public String getMethodCallSyntax(String obj, String method, String[] args) {
// TODO Auto-generated method stub
Modified: jakarta/bsf/branches/bsf3.x/bsf-engines/build.xml
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/bsf-engines/build.xml?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/bsf-engines/build.xml (original)
+++ jakarta/bsf/branches/bsf3.x/bsf-engines/build.xml Tue May 25 15:12:29 2010
@@ -76,16 +76,16 @@
<jar destfile="${basedir}/target/bsf-engines.tmp.jar" basedir="${merged.engines.dir}">
</jar>
-
- <!-- Delete work directory -->
+
+ <!-- Delete work directory -->
<delete dir="${merged.engines.dir}" />
<!-- Use Retroweaver to convert all the classes to JDK 1.4 -->
<retroweaver inputjar="${basedir}/target/bsf-engines.tmp.jar" outputjar="${basedir}/target/bsf-engines-${bsf.version}.jar"/>
-
- <!-- Delete the temporary work file -->
- <delete file="${basedir}/target/bsf-engines.tmp.jar"/>
+
+ <!-- Delete the temporary work file -->
+ <delete file="${basedir}/target/bsf-engines.tmp.jar"/>
</target>
Modified: jakarta/bsf/branches/bsf3.x/bsf-engines/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/bsf-engines/pom.xml?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/bsf-engines/pom.xml (original)
+++ jakarta/bsf/branches/bsf3.x/bsf-engines/pom.xml Tue May 25 15:12:29 2010
@@ -7,15 +7,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
@@ -89,27 +89,27 @@
</executions>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.5</version>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
- <type>jar</type>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
+ <type>jar</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
Modified: jakarta/bsf/branches/bsf3.x/distribution/build.xml
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/distribution/build.xml?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/distribution/build.xml (original)
+++ jakarta/bsf/branches/bsf3.x/distribution/build.xml Tue May 25 15:12:29 2010
@@ -30,7 +30,7 @@
<unzip src="${basedir}/../bsf-utils/target/bsf-utils-${bsf.version}.jar" dest="${basedir}/target/bsf-all" overwrite="false"/>
<!-- Proper versions will be created in the META-INF directory -->
- <delete file="${basedir}/target/bsf-all/LICENSE"/>
+ <delete file="${basedir}/target/bsf-all/LICENSE"/>
<delete file="${basedir}/target/bsf-all/NOTICE"/>
<copy file="${basedir}/src/bin/LICENSE" tofile="${basedir}/target/bsf-all/META-INF/LICENSE" overwrite="true" />
@@ -40,18 +40,18 @@
<jar destfile="${basedir}/target/bsf-all-${bsf.version}.jar" basedir="${basedir}/target/bsf-all">
<manifest>
<attribute name="Main-Class" value="org.apache.bsf.Main"/>
- <attribute name="Extension-Name" value="org.apache.bsf"/>
- <attribute name="Implementation-Title" value="Apache BSF"/>
- <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
- <attribute name="Implementation-Vendor-Id" value="org.apache"/>
- <attribute name="Implementation-Version" value="${bsf.version}"/>
- <attribute name="X-Compile-Source-JDK" value="${maven.compile.source}"/>
- <attribute name="X-Compile-Target-JDK" value="${maven.compile.target}"/>
+ <attribute name="Extension-Name" value="org.apache.bsf"/>
+ <attribute name="Implementation-Title" value="Apache BSF"/>
+ <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
+ <attribute name="Implementation-Vendor-Id" value="org.apache"/>
+ <attribute name="Implementation-Version" value="${bsf.version}"/>
+ <attribute name="X-Compile-Source-JDK" value="${maven.compile.source}"/>
+ <attribute name="X-Compile-Target-JDK" value="${maven.compile.target}"/>
</manifest>
- </jar>
-
- <!-- Remove work directory -->
- <delete dir="${basedir}/target/bsf-all"/>
+ </jar>
+
+ <!-- Remove work directory -->
+ <delete dir="${basedir}/target/bsf-all"/>
<!-- these are required for the mvn install command to work correctly -->
<condition property="maven.suffix" value="">
Modified: jakarta/bsf/branches/bsf3.x/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/E4xAxiomTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/E4xAxiomTestCase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/E4xAxiomTestCase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/E4xAxiomTestCase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.e4x;
@@ -41,50 +41,50 @@ import org.apache.bsf.xml.XMLHelper;
*/
public class E4xAxiomTestCase extends TestCase {
- private XMLHelper xmlHelper;
- private ScriptEngine engine;
-
- public void testInvokeFunctionInXML() throws ScriptException, XMLStreamException, FactoryConfigurationError, NoSuchMethodException {
- engine.eval("function isXML(xml) { return typeof xml == 'xml'; }" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
-
- Object xmlIn = xmlHelper.toScriptXML(createOMElement("<a><b>petra</b></a>"));
-
- Object o = invocableScript.invokeFunction("isXML", new Object[]{xmlIn});
- assertTrue(o instanceof Boolean);
- assertTrue(((Boolean)o).booleanValue());
- }
-
- public void testInvokeFunctionOutXML() throws ScriptException, XMLStreamException, FactoryConfigurationError, NoSuchMethodException {
- engine.eval("function hello(xml) { return <foo>{xml.b}</foo>; }" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
-
- Object xmlIn = xmlHelper.toScriptXML(createOMElement("<a><b>petra</b></a>"));
-
- Object xmlOut = invocableScript.invokeFunction("hello", new Object[]{xmlIn});
- OMElement omOut = xmlHelper.toOMElement(xmlOut);
- assertEquals("<foo><b>petra</b></foo>", omOut.toString());
- }
+ private XMLHelper xmlHelper;
+ private ScriptEngine engine;
- public void testE4X() throws ScriptException, XMLStreamException, FactoryConfigurationError {
+ public void testInvokeFunctionInXML() throws ScriptException, XMLStreamException, FactoryConfigurationError, NoSuchMethodException {
+ engine.eval("function isXML(xml) { return typeof xml == 'xml'; }" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+
+ Object xmlIn = xmlHelper.toScriptXML(createOMElement("<a><b>petra</b></a>"));
+
+ Object o = invocableScript.invokeFunction("isXML", new Object[]{xmlIn});
+ assertTrue(o instanceof Boolean);
+ assertTrue(((Boolean)o).booleanValue());
+ }
+
+ public void testInvokeFunctionOutXML() throws ScriptException, XMLStreamException, FactoryConfigurationError, NoSuchMethodException {
+ engine.eval("function hello(xml) { return <foo>{xml.b}</foo>; }" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+
+ Object xmlIn = xmlHelper.toScriptXML(createOMElement("<a><b>petra</b></a>"));
+
+ Object xmlOut = invocableScript.invokeFunction("hello", new Object[]{xmlIn});
+ OMElement omOut = xmlHelper.toOMElement(xmlOut);
+ assertEquals("<foo><b>petra</b></foo>", omOut.toString());
+ }
+
+ public void testE4X() throws ScriptException, XMLStreamException, FactoryConfigurationError {
Object o = xmlHelper.toScriptXML(createOMElement("<a><b>petra</b></a>"));
OMElement om = xmlHelper.toOMElement(o);
assertEquals("<a><b>petra</b></a>", om.toString());
-
+
Bindings bindings = engine.createBindings();
bindings.put("o", o);
Object x = engine.eval("typeof o", bindings);
assertEquals("xml", x);
- }
-
- protected OMElement createOMElement(String s) throws XMLStreamException, FactoryConfigurationError {
- XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(s));
- StAXOMBuilder builder = new StAXOMBuilder(parser);
- OMElement om = builder.getDocumentElement();
- return om;
- }
+ }
+
+ protected OMElement createOMElement(String s) throws XMLStreamException, FactoryConfigurationError {
+ XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(s));
+ StAXOMBuilder builder = new StAXOMBuilder(parser);
+ OMElement om = builder.getDocumentElement();
+ return om;
+ }
protected void setUp() {
// The default Rhino implementation provided by Java 1.6 does not support E4X,
Modified: jakarta/bsf/branches/bsf3.x/testing/e4x/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/e4x/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/e4x/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/e4x/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.e4x;
@@ -41,29 +41,29 @@ import org.mozilla.javascript.ContextHel
* Tests a basic JavaScript/E4X invocation
*/
public class HelloTestCase extends TestCase {
-
-// private ScriptEngine engine;
-// private XMLHelper xmlHelper;
-
-// public void testInvokeFunction() throws ScriptException, XMLStreamException, FactoryConfigurationError {
-// engine.eval("function isXML(xml) { return typeof xml.b == xml; }" );
-// engine.eval("function hello(xml) { return <foo>{xml.b}</foo>; }" );
-// assertTrue(engine instanceof Invocable);
-// Invocable invocableScript = (Invocable) engine;
+
+// private ScriptEngine engine;
+// private XMLHelper xmlHelper;
+
+// public void testInvokeFunction() throws ScriptException, XMLStreamException, FactoryConfigurationError {
+// engine.eval("function isXML(xml) { return typeof xml.b == xml; }" );
+// engine.eval("function hello(xml) { return <foo>{xml.b}</foo>; }" );
+// assertTrue(engine instanceof Invocable);
+// Invocable invocableScript = (Invocable) engine;
//
-// Object xmlIn = xmlHelper.toScriptXML(createOm("<a><b>petra</b></a>"));
+// Object xmlIn = xmlHelper.toScriptXML(createOm("<a><b>petra</b></a>"));
//
-// Object o = invocableScript.invokeFunction("isXML", new Object[]{xmlIn});
-// assertTrue(o instanceof Boolean);
-// assertTrue(((Boolean)o).booleanValue());
+// Object o = invocableScript.invokeFunction("isXML", new Object[]{xmlIn});
+// assertTrue(o instanceof Boolean);
+// assertTrue(((Boolean)o).booleanValue());
//
-// Object xmlOut = invocableScript.invokeFunction("hello", new Object[]{xmlIn});
+// Object xmlOut = invocableScript.invokeFunction("hello", new Object[]{xmlIn});
//
-// OMElement omOut = xmlHelper.toOMElement(xmlOut);
-// assertEquals("<foo><b>petra</b></foo>", omOut.toString());
-// }
-
- public void testE4X() throws ScriptException, XMLStreamException, FactoryConfigurationError {
+// OMElement omOut = xmlHelper.toOMElement(xmlOut);
+// assertEquals("<foo><b>petra</b></foo>", omOut.toString());
+// }
+
+ public void testE4X() throws ScriptException, XMLStreamException, FactoryConfigurationError {
// The default Rhino implementation provided by Java 1.6 does not support E4X,
// so use the unique name supported by the 1.6R7 version factory.
ScriptEngine engine = new ScriptEngineManager().getEngineByName("rhino-nonjdk");
@@ -71,27 +71,27 @@ public class HelloTestCase extends TestC
Object o = convertor.toScriptXML(createOMElement("<a><b>petra</b></a>"));
OMElement om = convertor.toOMElement(o);
assertEquals("<a><b>petra</b></a>", om.toString());
-
+
Bindings bindings = engine.createBindings();
bindings.put("o", o);
Object x = engine.eval("typeof o", bindings);
assertEquals("xml", x);
- }
-
- protected OMElement createOMElement(String s) throws XMLStreamException, FactoryConfigurationError {
- XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(s));
- StAXOMBuilder builder = new StAXOMBuilder(parser);
- OMElement om = builder.getDocumentElement();
- return om;
- }
+ }
+
+ protected OMElement createOMElement(String s) throws XMLStreamException, FactoryConfigurationError {
+ XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(s));
+ StAXOMBuilder builder = new StAXOMBuilder(parser);
+ OMElement om = builder.getDocumentElement();
+ return om;
+ }
protected void setUp() {
-// ScriptEngineManager manager = new ScriptEngineManager();
-// engine = manager.getEngineByExtension("js");
-// xmlHelper = XMLHelper.getArgHelper(engine);
+// ScriptEngineManager manager = new ScriptEngineManager();
+// engine = manager.getEngineByExtension("js");
+// xmlHelper = XMLHelper.getArgHelper(engine);
Context cx = Context.enter();
try {
- ContextHelper.setTopCallScope(cx, cx.initStandardObjects());
+ ContextHelper.setTopCallScope(cx, cx.initStandardObjects());
} finally {
Context.exit();
}
Modified: jakarta/bsf/branches/bsf3.x/testing/groovy-1.1/src/test/java/org/apache/bsf/testing/groovy/Groovy11Testcase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/groovy-1.1/src/test/java/org/apache/bsf/testing/groovy/Groovy11Testcase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/groovy-1.1/src/test/java/org/apache/bsf/testing/groovy/Groovy11Testcase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/groovy-1.1/src/test/java/org/apache/bsf/testing/groovy/Groovy11Testcase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.groovy;
@@ -29,14 +29,14 @@ import junit.framework.TestCase;
* Simple hello testcase to verify basic Groovy functionality
*/
public class Groovy11Testcase extends TestCase {
-
- public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("groovy");
- engine.eval("def hello(name) { return 'Hello ' + name }" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
- assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
- }
+
+ public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("groovy");
+ engine.eval("def hello(name) { return 'Hello ' + name }" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+ assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
+ }
}
Modified: jakarta/bsf/branches/bsf3.x/testing/groovy/src/test/java/org/apache/bsf/testing/groovy/GroovyTestcase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/groovy/src/test/java/org/apache/bsf/testing/groovy/GroovyTestcase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/groovy/src/test/java/org/apache/bsf/testing/groovy/GroovyTestcase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/groovy/src/test/java/org/apache/bsf/testing/groovy/GroovyTestcase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.groovy;
@@ -29,14 +29,14 @@ import junit.framework.TestCase;
* Simple hello testcase to verify basic Groovy functionality
*/
public class GroovyTestcase extends TestCase {
-
- public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("groovy");
- engine.eval("def hello(name) { return 'Hello ' + name }" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
- assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
- }
+
+ public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("groovy");
+ engine.eval("def hello(name) { return 'Hello ' + name }" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+ assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
+ }
}
Modified: jakarta/bsf/branches/bsf3.x/testing/javascript/src/test/java/org/apache/bsf/testing/javascript/JavaScriptTestcase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/javascript/src/test/java/org/apache/bsf/testing/javascript/JavaScriptTestcase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/javascript/src/test/java/org/apache/bsf/testing/javascript/JavaScriptTestcase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/javascript/src/test/java/org/apache/bsf/testing/javascript/JavaScriptTestcase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.javascript;
@@ -27,32 +27,32 @@ import junit.framework.TestCase;
public class JavaScriptTestcase extends TestCase {
-
- public void testEval() throws ScriptException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("js");
- assertTrue(((Boolean)engine.eval("true;")).booleanValue());
- assertFalse(((Boolean)engine.eval("false;")).booleanValue());
- }
-
- public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("js");
- engine.eval("function hello(s) { return 'Hello ' + s; }" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
- assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
- }
-
- public void testInvokeMethod() throws ScriptException, NoSuchMethodException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("js");
- engine.eval("function hello(s) { return 'Hello ' + s; }" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
-
- Object thiz = engine.eval("this;");
- assertEquals("Hello petra", invocableScript.invokeMethod(thiz, "hello", new Object[]{"petra"}));
- }
+
+ public void testEval() throws ScriptException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("js");
+ assertTrue(((Boolean)engine.eval("true;")).booleanValue());
+ assertFalse(((Boolean)engine.eval("false;")).booleanValue());
+ }
+
+ public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("js");
+ engine.eval("function hello(s) { return 'Hello ' + s; }" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+ assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
+ }
+
+ public void testInvokeMethod() throws ScriptException, NoSuchMethodException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("js");
+ engine.eval("function hello(s) { return 'Hello ' + s; }" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+
+ Object thiz = engine.eval("this;");
+ assertEquals("Hello petra", invocableScript.invokeMethod(thiz, "hello", new Object[]{"petra"}));
+ }
}
Modified: jakarta/bsf/branches/bsf3.x/testing/jexl/src/test/java/org/apache/bsf/testing/jexl/JexlTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/jexl/src/test/java/org/apache/bsf/testing/jexl/JexlTestCase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/jexl/src/test/java/org/apache/bsf/testing/jexl/JexlTestCase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/jexl/src/test/java/org/apache/bsf/testing/jexl/JexlTestCase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.jexl;
@@ -30,12 +30,12 @@ import junit.framework.TestCase;
*/
public class JexlTestCase extends TestCase {
- public void testExpression() throws ScriptException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByName("jexl");
- assertNotNull("Should find an engine",engine);
+ public void testExpression() throws ScriptException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByName("jexl");
+ assertNotNull("Should find an engine",engine);
assertTrue("engine should be compilable",engine instanceof Compilable);
- assertEquals("Should be 579",new Integer(579),engine.eval("123+456;"));
- }
+ assertEquals("Should be 579",new Integer(579),engine.eval("123+456;"));
+ }
}
Modified: jakarta/bsf/branches/bsf3.x/testing/jruby-1.1.2/src/test/java/org/apache/bsf/testing/javascript/JRuby112Testcase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/jruby-1.1.2/src/test/java/org/apache/bsf/testing/javascript/JRuby112Testcase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/jruby-1.1.2/src/test/java/org/apache/bsf/testing/javascript/JRuby112Testcase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/jruby-1.1.2/src/test/java/org/apache/bsf/testing/javascript/JRuby112Testcase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.javascript;
@@ -27,32 +27,32 @@ import junit.framework.TestCase;
public class JRuby112Testcase extends TestCase {
-
-// public void testEval() throws ScriptException {
-// ScriptEngineManager manager = new ScriptEngineManager();
-// ScriptEngine engine = manager.getEngineByExtension("js");
-// assertTrue(((Boolean)engine.eval("true;")).booleanValue());
-// assertFalse(((Boolean)engine.eval("false;")).booleanValue());
-// }
-
- public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("rb");
- engine.eval("def hello(s)\n return \"Hello \" + s\nend" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
- assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
- }
-
-// public void testInvokeMethod() throws ScriptException {
-// ScriptEngineManager manager = new ScriptEngineManager();
-// ScriptEngine engine = manager.getEngineByExtension("js");
-// engine.eval("function hello(s) { return 'Hello ' + s; }" );
-// assertTrue(engine instanceof Invocable);
-// Invocable invocableScript = (Invocable) engine;
-//
-// Object thiz = engine.eval("this;");
-// assertEquals("Hello petra", invocableScript.invokeMethod(thiz, "hello", new Object[]{"petra"}));
-// }
+
+// public void testEval() throws ScriptException {
+// ScriptEngineManager manager = new ScriptEngineManager();
+// ScriptEngine engine = manager.getEngineByExtension("js");
+// assertTrue(((Boolean)engine.eval("true;")).booleanValue());
+// assertFalse(((Boolean)engine.eval("false;")).booleanValue());
+// }
+
+ public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("rb");
+ engine.eval("def hello(s)\n return \"Hello \" + s\nend" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+ assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
+ }
+
+// public void testInvokeMethod() throws ScriptException {
+// ScriptEngineManager manager = new ScriptEngineManager();
+// ScriptEngine engine = manager.getEngineByExtension("js");
+// engine.eval("function hello(s) { return 'Hello ' + s; }" );
+// assertTrue(engine instanceof Invocable);
+// Invocable invocableScript = (Invocable) engine;
+//
+// Object thiz = engine.eval("this;");
+// assertEquals("Hello petra", invocableScript.invokeMethod(thiz, "hello", new Object[]{"petra"}));
+// }
}
Modified: jakarta/bsf/branches/bsf3.x/testing/jruby-1.2.0/src/test/java/org/apache/bsf/testing/javascript/JRuby120Testcase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/jruby-1.2.0/src/test/java/org/apache/bsf/testing/javascript/JRuby120Testcase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/jruby-1.2.0/src/test/java/org/apache/bsf/testing/javascript/JRuby120Testcase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/jruby-1.2.0/src/test/java/org/apache/bsf/testing/javascript/JRuby120Testcase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.javascript;
@@ -27,32 +27,32 @@ import junit.framework.TestCase;
public class JRuby120Testcase extends TestCase {
-
-// public void testEval() throws ScriptException {
-// ScriptEngineManager manager = new ScriptEngineManager();
-// ScriptEngine engine = manager.getEngineByExtension("js");
-// assertTrue(((Boolean)engine.eval("true;")).booleanValue());
-// assertFalse(((Boolean)engine.eval("false;")).booleanValue());
-// }
-
- public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("rb");
- engine.eval("def hello(s)\n return \"Hello \" + s\nend" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
- assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
- }
-
-// public void testInvokeMethod() throws ScriptException {
-// ScriptEngineManager manager = new ScriptEngineManager();
-// ScriptEngine engine = manager.getEngineByExtension("js");
-// engine.eval("function hello(s) { return 'Hello ' + s; }" );
-// assertTrue(engine instanceof Invocable);
-// Invocable invocableScript = (Invocable) engine;
-//
-// Object thiz = engine.eval("this;");
-// assertEquals("Hello petra", invocableScript.invokeMethod(thiz, "hello", new Object[]{"petra"}));
-// }
+
+// public void testEval() throws ScriptException {
+// ScriptEngineManager manager = new ScriptEngineManager();
+// ScriptEngine engine = manager.getEngineByExtension("js");
+// assertTrue(((Boolean)engine.eval("true;")).booleanValue());
+// assertFalse(((Boolean)engine.eval("false;")).booleanValue());
+// }
+
+ public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("rb");
+ engine.eval("def hello(s)\n return \"Hello \" + s\nend" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+ assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
+ }
+
+// public void testInvokeMethod() throws ScriptException {
+// ScriptEngineManager manager = new ScriptEngineManager();
+// ScriptEngine engine = manager.getEngineByExtension("js");
+// engine.eval("function hello(s) { return 'Hello ' + s; }" );
+// assertTrue(engine instanceof Invocable);
+// Invocable invocableScript = (Invocable) engine;
+//
+// Object thiz = engine.eval("this;");
+// assertEquals("Hello petra", invocableScript.invokeMethod(thiz, "hello", new Object[]{"petra"}));
+// }
}
Modified: jakarta/bsf/branches/bsf3.x/testing/python/src/test/java/org/apache/bsf/testing/python/HelloTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/python/src/test/java/org/apache/bsf/testing/python/HelloTestCase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/python/src/test/java/org/apache/bsf/testing/python/HelloTestCase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/python/src/test/java/org/apache/bsf/testing/python/HelloTestCase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.python;
@@ -30,13 +30,13 @@ import junit.framework.TestCase;
*/
public class HelloTestCase extends TestCase {
- public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("py");
- engine.eval("def hello(name):\n return 'Hello ' + name");
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
- assertEquals("Hello Monty", invocableScript.invokeFunction("hello", new Object[] { "Monty" }));
- }
+ public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("py");
+ engine.eval("def hello(name):\n return 'Hello ' + name");
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+ assertEquals("Hello Monty", invocableScript.invokeFunction("hello", new Object[] { "Monty" }));
+ }
}
Modified: jakarta/bsf/branches/bsf3.x/testing/ruby/src/test/java/org/apache/bsf/testing/javascript/RubyTestcase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/branches/bsf3.x/testing/ruby/src/test/java/org/apache/bsf/testing/javascript/RubyTestcase.java?rev=948071&r1=948070&r2=948071&view=diff
==============================================================================
--- jakarta/bsf/branches/bsf3.x/testing/ruby/src/test/java/org/apache/bsf/testing/javascript/RubyTestcase.java (original)
+++ jakarta/bsf/branches/bsf3.x/testing/ruby/src/test/java/org/apache/bsf/testing/javascript/RubyTestcase.java Tue May 25 15:12:29 2010
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.bsf.testing.javascript;
@@ -27,33 +27,33 @@ import junit.framework.TestCase;
public class RubyTestcase extends TestCase {
-
-// public void testEval() throws ScriptException {
-// ScriptEngineManager manager = new ScriptEngineManager();
-// ScriptEngine engine = manager.getEngineByExtension("js");
-// assertTrue(((Boolean)engine.eval("true;")).booleanValue());
-// assertFalse(((Boolean)engine.eval("false;")).booleanValue());
-// }
-
- public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
- ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine engine = manager.getEngineByExtension("rb");
- assertNotNull("Engine should not be null",engine);
- engine.eval("def hello(s)\n return \"Hello \" + s\nend" );
- assertTrue(engine instanceof Invocable);
- Invocable invocableScript = (Invocable) engine;
- assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
- }
-
-// public void testInvokeMethod() throws ScriptException {
-// ScriptEngineManager manager = new ScriptEngineManager();
-// ScriptEngine engine = manager.getEngineByExtension("js");
-// engine.eval("function hello(s) { return 'Hello ' + s; }" );
-// assertTrue(engine instanceof Invocable);
-// Invocable invocableScript = (Invocable) engine;
-//
-// Object thiz = engine.eval("this;");
-// assertEquals("Hello petra", invocableScript.invokeMethod(thiz, "hello", new Object[]{"petra"}));
-// }
+
+// public void testEval() throws ScriptException {
+// ScriptEngineManager manager = new ScriptEngineManager();
+// ScriptEngine engine = manager.getEngineByExtension("js");
+// assertTrue(((Boolean)engine.eval("true;")).booleanValue());
+// assertFalse(((Boolean)engine.eval("false;")).booleanValue());
+// }
+
+ public void testInvokeFunction() throws ScriptException, NoSuchMethodException {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension("rb");
+ assertNotNull("Engine should not be null",engine);
+ engine.eval("def hello(s)\n return \"Hello \" + s\nend" );
+ assertTrue(engine instanceof Invocable);
+ Invocable invocableScript = (Invocable) engine;
+ assertEquals("Hello petra", invocableScript.invokeFunction("hello", new Object[]{"petra"}));
+ }
+
+// public void testInvokeMethod() throws ScriptException {
+// ScriptEngineManager manager = new ScriptEngineManager();
+// ScriptEngine engine = manager.getEngineByExtension("js");
+// engine.eval("function hello(s) { return 'Hello ' + s; }" );
+// assertTrue(engine instanceof Invocable);
+// Invocable invocableScript = (Invocable) engine;
+//
+// Object thiz = engine.eval("this;");
+// assertEquals("Hello petra", invocableScript.invokeMethod(thiz, "hello", new Object[]{"petra"}));
+// }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org