You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2012/05/12 08:52:23 UTC
svn commit: r1337453 [3/3] - in /commons/proper/jexl/trunk: ./
src/main/java/org/apache/commons/jexl3/
src/main/java/org/apache/commons/jexl3/internal/
src/main/java/org/apache/commons/jexl3/internal/introspection/
src/main/java/org/apache/commons/jexl...
Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/ScriptTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/ScriptTest.java?rev=1337453&r1=1337452&r2=1337453&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/ScriptTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/ScriptTest.java Sat May 12 06:52:21 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file 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.
@@ -16,11 +16,6 @@
*/
package org.apache.commons.jexl3;
-import org.apache.commons.jexl3.JexlExpression;
-import org.apache.commons.jexl3.JexlContext;
-import org.apache.commons.jexl3.MapContext;
-import org.apache.commons.jexl3.JexlScript;
-
import java.io.File;
import java.net.URL;
@@ -38,8 +33,8 @@ public class ScriptTest extends JexlTest
// does this is not known yet.
public static class Tester {
private String code;
- public String getCode () {
- return code;
+ public String getCode () {
+ return code;
}
public void setCode(String c) {
code = c;
@@ -61,10 +56,10 @@ public class ScriptTest extends JexlTest
JexlScript s = JEXL.createScript(code);
JexlContext jc = new MapContext();
jc.set("x", new Integer(1));
-
+
Object o = s.execute(jc);
assertEquals("Result is wrong", new Integer(10), o);
- assertEquals("getText is wrong", code, s.getText());
+ assertEquals("getText is wrong", code, s.getSourceText());
}
public void testScriptFromFile() throws Exception {
Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/examples/MethodPropertyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/examples/MethodPropertyTest.java?rev=1337453&r1=1337452&r2=1337453&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/examples/MethodPropertyTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/examples/MethodPropertyTest.java Sat May 12 06:52:21 2012
@@ -65,15 +65,15 @@ public class MethodPropertyTest extends
*/
e = jexl.createExpression("foo.convert(1)");
o = e.evaluate(jc);
- out.print("value of " + e.getExpression() + " is : ", o, foo.convert(1));
+ out.print("value of " + e.getParsedText() + " is : ", o, foo.convert(1));
e = jexl.createExpression("foo.convert(1+7)");
o = e.evaluate(jc);
- out.print("value of " + e.getExpression() + " is : ", o, foo.convert(1+7));
+ out.print("value of " + e.getParsedText() + " is : ", o, foo.convert(1+7));
e = jexl.createExpression("foo.convert(1+number)");
o = e.evaluate(jc);
- out.print("value of " + e.getExpression() + " is : ", o, foo.convert(1+number.intValue()));
+ out.print("value of " + e.getParsedText() + " is : ", o, foo.convert(1+number.intValue()));
/*
* access a property
Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/Util.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/Util.java?rev=1337453&r1=1337452&r2=1337453&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/Util.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/Util.java Sat May 12 06:52:21 2012
@@ -43,7 +43,7 @@ public class Util {
return;
}
Engine jdbg = new Engine();
- jdbg.parser.ALLOW_REGISTERS = true;
+ jdbg.parser.allowRegisters(true);
Debugger dbg = new Debugger();
// iterate over all expression in cache
Iterator<Map.Entry<String,ASTJexlScript>> inodes = jexl.cache.entrySet().iterator();
@@ -52,9 +52,9 @@ public class Util {
JexlNode node = entry.getValue();
// recreate expr string from AST
dbg.debug(node);
- String expressiondbg = dbg.data();
+ String expressiondbg = dbg.toString();
// recreate expr from string
- Script exprdbg = jdbg.createScript(expressiondbg);
+ Script exprdbg = (Script) jdbg.createScript(null, expressiondbg, null);
// make arg cause become the root cause
JexlNode root = exprdbg.script;
while (root.jjtGetParent() != null) {
Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/parser/ParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/parser/ParserTest.java?rev=1337453&r1=1337452&r2=1337453&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/parser/ParserTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/parser/ParserTest.java Sat May 12 06:52:21 2012
@@ -35,17 +35,17 @@ public class ParserTest extends TestCase
public void testParse1() throws Exception {
Parser parser = new Parser(new StringReader(";"));
- SimpleNode sn = parser.parse(new StringReader("foo = 1;"), null, null);
+ SimpleNode sn = parser.parse(null, new StringReader("foo = 1;"), null, false);
assertNotNull("parsed node is null", sn);
}
public void testParse2() throws Exception {
Parser parser = new Parser(new StringReader(";"));
- SimpleNode sn = parser.parse(new StringReader("foo = \"bar\";"), null, null);
+ SimpleNode sn = parser.parse(null, new StringReader("foo = \"bar\";"), null, false);
assertNotNull("parsed node is null", sn);
- sn = parser.parse(new StringReader("foo = 'bar';"), null, null);
+ sn = parser.parse(null, new StringReader("foo = 'bar';"), null, false);
assertNotNull("parsed node is null", sn);
}
Modified: commons/proper/jexl/trunk/src/test/scripts/test1.jexl
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/scripts/test1.jexl?rev=1337453&r1=1337452&r2=1337453&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/scripts/test1.jexl (original)
+++ commons/proper/jexl/trunk/src/test/scripts/test1.jexl Sat May 12 06:52:21 2012
@@ -5,17 +5,17 @@
* The ASF licenses this file 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.
*/
-
-// This tests for JEXL-47. AL header above tests for block comments.
+
+// This tests for JEXL-47. AL header above tests for block comments.
##
## This is a test script
@@ -30,4 +30,4 @@ result; // JEXL-44 should ignore "quotes
/*
Trailing comments are also ignored
-*/
\ No newline at end of file
+*/