提交 2e620ecf 编写于 作者: T tombaeyens

ACT-267 merged juel module into engine

上级 502e0add
......@@ -289,7 +289,6 @@ JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787
<copy todir="${tomcat.home}/lib">
<fileset dir="${activiti.home}/examples/activiti-engine-examples/libs-runtime">
<include name="activiti-engine-${activiti.version}.jar"/>
<include name="activiti-juel-*.jar"/>
<include name="mybatis-*.jar"/>
<include name="juel*.jar" />
<include name="livetribe-jsr223*.jar" />
......
......@@ -19,10 +19,6 @@
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-juel</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
......
......@@ -12,10 +12,10 @@
*/
package org.activiti.engine.impl.el;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELResolver;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.javax.el.VariableMapper;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.VariableMapper;
/**
......
......@@ -15,7 +15,7 @@ package org.activiti.engine.impl.el;
import java.lang.reflect.Method;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.FunctionMapper;
/**
......
......@@ -15,9 +15,9 @@ package org.activiti.engine.impl.el;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.pvm.runtime.ExecutionImpl;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELResolver;
/**
......
......@@ -13,8 +13,8 @@
package org.activiti.engine.impl.el;
import org.activiti.el.juel.ExpressionFactoryImpl;
import org.activiti.javax.el.ExpressionFactory;
import org.activiti.engine.impl.javax.el.ExpressionFactory;
import org.activiti.engine.impl.juel.ExpressionFactoryImpl;
......
......@@ -12,18 +12,18 @@
*/
package org.activiti.engine.impl.el;
import org.activiti.el.juel.ExpressionFactoryImpl;
import org.activiti.engine.impl.javax.el.ArrayELResolver;
import org.activiti.engine.impl.javax.el.BeanELResolver;
import org.activiti.engine.impl.javax.el.CompositeELResolver;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.javax.el.ExpressionFactory;
import org.activiti.engine.impl.javax.el.ListELResolver;
import org.activiti.engine.impl.javax.el.MapELResolver;
import org.activiti.engine.impl.javax.el.ValueExpression;
import org.activiti.engine.impl.juel.ExpressionFactoryImpl;
import org.activiti.engine.impl.pvm.runtime.ExecutionImpl;
import org.activiti.engine.impl.runtime.ExecutionEntity;
import org.activiti.javax.el.ArrayELResolver;
import org.activiti.javax.el.BeanELResolver;
import org.activiti.javax.el.CompositeELResolver;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELResolver;
import org.activiti.javax.el.ExpressionFactory;
import org.activiti.javax.el.ListELResolver;
import org.activiti.javax.el.MapELResolver;
import org.activiti.javax.el.ValueExpression;
/**
......
......@@ -15,12 +15,12 @@ package org.activiti.engine.impl.el;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.MethodNotFoundException;
import org.activiti.engine.impl.javax.el.PropertyNotFoundException;
import org.activiti.engine.impl.javax.el.ValueExpression;
import org.activiti.engine.impl.pvm.runtime.ExecutionImpl;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.MethodNotFoundException;
import org.activiti.javax.el.PropertyNotFoundException;
import org.activiti.javax.el.ValueExpression;
/**
......
......@@ -12,11 +12,11 @@
*/
package org.activiti.engine.impl.el;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELResolver;
import org.activiti.javax.el.ExpressionFactory;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.javax.el.VariableMapper;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.javax.el.ExpressionFactory;
import org.activiti.engine.impl.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.VariableMapper;
/**
......
......@@ -12,9 +12,9 @@
*/
package org.activiti.engine.impl.form;
import org.activiti.el.juel.util.SimpleContext;
import org.activiti.engine.impl.javax.el.VariableMapper;
import org.activiti.engine.impl.juel.SimpleContext;
import org.activiti.engine.impl.task.TaskEntity;
import org.activiti.javax.el.VariableMapper;
......
......@@ -12,9 +12,9 @@
*/
package org.activiti.engine.impl.form;
import org.activiti.engine.impl.javax.el.ValueExpression;
import org.activiti.engine.impl.javax.el.VariableMapper;
import org.activiti.engine.impl.task.TaskEntity;
import org.activiti.javax.el.ValueExpression;
import org.activiti.javax.el.VariableMapper;
/**
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.beans.FeatureDescriptor;
import java.lang.reflect.Array;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.beans.FeatureDescriptor;
import java.beans.IntrospectionException;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.beans.FeatureDescriptor;
import java.util.ArrayList;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.util.HashMap;
import java.util.Locale;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.util.EventObject;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* The listener interface for receiving notification when an {@link ELContext} is created.
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* Represents any of the exception conditions that can arise during expression evaluation.
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.io.Serializable;
import java.util.Hashtable;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.io.BufferedReader;
import java.io.File;
......@@ -177,7 +177,7 @@ public abstract class ExpressionFactory {
}
if (className == null || className.trim().length() == 0) {
className = "org.activiti.el.juel.ExpressionFactoryImpl";
className = "org.activiti.engine.impl.juel.ExpressionFactoryImpl";
}
return newInstance(properties, className, classLoader);
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.lang.reflect.Method;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* An Expression that refers to a method on an object. The
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* Holds information about a method that a {@link MethodExpression} evaluated to.
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* Thrown when a method could not be found while evaluating a {@link MethodExpression}.
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* Thrown when a property could not be found while evaluating a {@link ValueExpression} or
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* Thrown when a property could not be written to while setting the value on a
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.beans.FeatureDescriptor;
import java.util.Enumeration;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* An Expression that can get or set a value. In previous incarnations of this API, expressions
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
import java.io.Serializable;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.javax.el;
package org.activiti.engine.impl.javax.el;
/**
* The interface to a map between EL variables and the EL expressions they are associated with.
......
......@@ -13,13 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.misc.BooleanOperations;
import org.activiti.el.juel.misc.NumberOperations;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public class AstBinary extends AstRightValue {
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public final class AstBoolean extends AstLiteral {
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
public class AstBracket extends AstProperty {
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
public class AstChoice extends AstRightValue {
......
......@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import java.util.List;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public class AstComposite extends AstRightValue {
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
public class AstDot extends AstProperty {
......
......@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.MethodInfo;
import org.activiti.javax.el.ValueReference;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.MethodInfo;
import org.activiti.engine.impl.javax.el.ValueReference;
public final class AstEval extends AstNode {
......
......@@ -13,17 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.el.juel.tree.FunctionNode;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
public class AstFunction extends AstRightValue implements FunctionNode {
......
......@@ -13,22 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.el.juel.tree.IdentifierNode;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.MethodInfo;
import org.activiti.javax.el.MethodNotFoundException;
import org.activiti.javax.el.PropertyNotFoundException;
import org.activiti.javax.el.ValueExpression;
import org.activiti.javax.el.ValueReference;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.MethodInfo;
import org.activiti.engine.impl.javax.el.MethodNotFoundException;
import org.activiti.engine.impl.javax.el.PropertyNotFoundException;
import org.activiti.engine.impl.javax.el.ValueExpression;
import org.activiti.engine.impl.javax.el.ValueReference;
public class AstIdentifier extends AstNode implements IdentifierNode {
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
public abstract class AstLiteral extends AstRightValue {
public final int getCardinality() {
......
......@@ -13,17 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.el.juel.tree.Node;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.MethodInfo;
import org.activiti.javax.el.MethodNotFoundException;
import org.activiti.javax.el.PropertyNotFoundException;
import org.activiti.javax.el.ValueReference;
package org.activiti.engine.impl.juel;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.MethodInfo;
import org.activiti.engine.impl.javax.el.MethodNotFoundException;
import org.activiti.engine.impl.javax.el.PropertyNotFoundException;
import org.activiti.engine.impl.javax.el.ValueReference;
public class AstMethod extends AstNode {
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public final class AstNested extends AstRightValue {
......
......@@ -13,11 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.el.juel.tree.ExpressionNode;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public abstract class AstNode implements ExpressionNode {
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public final class AstNull extends AstLiteral {
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public final class AstNumber extends AstLiteral {
......
......@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import java.util.List;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public class AstParameters extends AstRightValue {
......
......@@ -13,19 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.MethodInfo;
import org.activiti.javax.el.MethodNotFoundException;
import org.activiti.javax.el.PropertyNotFoundException;
import org.activiti.javax.el.ValueReference;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.MethodInfo;
import org.activiti.engine.impl.javax.el.MethodNotFoundException;
import org.activiti.engine.impl.javax.el.PropertyNotFoundException;
import org.activiti.engine.impl.javax.el.ValueReference;
public abstract class AstProperty extends AstNode {
......
......@@ -13,14 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.MethodInfo;
import org.activiti.javax.el.ValueReference;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.MethodInfo;
import org.activiti.engine.impl.javax.el.ValueReference;
/**
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELContext;
public final class AstString extends AstLiteral {
......
......@@ -13,14 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.MethodInfo;
import org.activiti.javax.el.ValueReference;
package org.activiti.engine.impl.juel;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.MethodInfo;
import org.activiti.engine.impl.javax.el.ValueReference;
public final class AstText extends AstNode {
......
......@@ -13,14 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl.ast;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.misc.BooleanOperations;
import org.activiti.el.juel.misc.NumberOperations;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
public class AstUnary extends AstRightValue {
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
import java.io.IOException;
import java.io.ObjectInputStream;
......@@ -22,13 +22,12 @@ import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.ValueExpression;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ValueExpression;
/**
* Bindings, usually created by a {@link org.activiti.el.juel.tree.Tree}.
* Bindings, usually created by a {@link org.activiti.engine.impl.juel.Tree}.
*
* @author Christoph Beck
*/
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.misc;
package org.activiti.engine.impl.juel;
import java.math.BigDecimal;
import java.math.BigInteger;
......@@ -22,7 +22,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELException;
public class BooleanOperations {
private final static Set<Class<? extends Number>> SIMPLE_INTEGER_TYPES = new HashSet<Class<? extends Number>>();
......
......@@ -13,23 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl;
package org.activiti.engine.impl.juel;
import java.io.PrintWriter;
import java.util.EnumSet;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.el.juel.tree.NodePrinter;
import org.activiti.el.juel.tree.Tree;
import org.activiti.el.juel.tree.TreeBuilder;
import org.activiti.el.juel.tree.TreeBuilderException;
import org.activiti.el.juel.tree.impl.Parser.ParseException;
import org.activiti.el.juel.tree.impl.Scanner.ScanException;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.ELResolver;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.javax.el.VariableMapper;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.VariableMapper;
import org.activiti.engine.impl.juel.Parser.ParseException;
import org.activiti.engine.impl.juel.Scanner.ScanException;
/**
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl;
package org.activiti.engine.impl.juel;
import java.util.Collections;
import java.util.LinkedHashMap;
......@@ -21,8 +21,6 @@ import java.util.Map;
import java.util.WeakHashMap;
import java.util.Map.Entry;
import org.activiti.el.juel.tree.Tree;
import org.activiti.el.juel.tree.TreeCache;
/**
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel;
package org.activiti.engine.impl.juel;
import java.io.File;
import java.io.FileInputStream;
......@@ -23,15 +23,10 @@ import java.lang.reflect.Constructor;
import java.util.EnumSet;
import java.util.Properties;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.el.juel.tree.TreeBuilder;
import org.activiti.el.juel.tree.TreeStore;
import org.activiti.el.juel.tree.impl.Builder;
import org.activiti.el.juel.tree.impl.Cache;
import org.activiti.el.juel.tree.impl.Builder.Feature;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.ExpressionFactory;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ExpressionFactory;
import org.activiti.engine.impl.juel.Builder.Feature;
/**
......@@ -75,7 +70,7 @@ import org.activiti.javax.el.ExpressionFactory;
*
* @author Christoph Beck
*/
public class ExpressionFactoryImpl extends org.activiti.javax.el.ExpressionFactory {
public class ExpressionFactoryImpl extends org.activiti.engine.impl.javax.el.ExpressionFactory {
/**
* A profile provides a default set of language features that will define the builder's
* behavior. A profile can be adjusted using the <code>javax.el.methodInvocations</code>,
......
......@@ -13,17 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.MethodInfo;
import org.activiti.javax.el.ValueReference;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.MethodInfo;
import org.activiti.engine.impl.javax.el.ValueReference;
/**
* Expression node interface. This interface provides all the methods needed for value expressions
* and method expressions.
*
* @see org.activiti.el.juel.tree.Tree
* @see org.activiti.engine.impl.juel.Tree
* @author Christoph Beck
*/
public interface ExpressionNode extends Node {
......@@ -78,7 +78,7 @@ public interface ExpressionNode extends Node {
/**
* Determine whether {@link #setValue(Bindings, ELContext, Object)} will throw a
* {@link org.activiti.javax.el.PropertyNotWritableException}.
* {@link org.activiti.engine.impl.javax.el.PropertyNotWritableException}.
*
* @param bindings
* bindings containing variables and functions
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
/**
* Function node interface.
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
/**
* Identifier node interface.
......
......@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.misc;
package org.activiti.engine.impl.juel;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public final class LocalMessages {
private static final String BUNDLE_NAME = "org.activiti.el.juel.misc.LocalStrings";
private static final String BUNDLE_NAME = "org.activiti.engine.impl.juel.misc.LocalStrings";
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
public static String get(String key, Object... args) {
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
/**
* Basic node interface.
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
import java.io.PrintWriter;
import java.util.Stack;
......
......@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.misc;
package org.activiti.engine.impl.juel;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELException;
/**
* Arithmetic Operations as specified in chapter 1.7.
......
......@@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
/**
......@@ -26,7 +24,7 @@ import org.activiti.javax.el.ELException;
*
* @author Christoph Beck
*/
public final class ObjectValueExpression extends org.activiti.javax.el.ValueExpression {
public final class ObjectValueExpression extends org.activiti.engine.impl.javax.el.ValueExpression {
private static final long serialVersionUID = 1L;
private final TypeConverter converter;
......
......@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl;
package org.activiti.engine.impl.juel;
import static org.activiti.el.juel.tree.impl.Builder.Feature.*;
import static org.activiti.el.juel.tree.impl.Scanner.Symbol.*;
import static org.activiti.engine.impl.juel.Builder.Feature.*;
import static org.activiti.engine.impl.juel.Scanner.Symbol.*;
import java.util.ArrayList;
import java.util.Collections;
......@@ -25,15 +25,10 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.tree.FunctionNode;
import org.activiti.el.juel.tree.IdentifierNode;
import org.activiti.el.juel.tree.Tree;
import org.activiti.el.juel.tree.impl.Builder.Feature;
import org.activiti.el.juel.tree.impl.Scanner.ScanException;
import org.activiti.el.juel.tree.impl.Scanner.Symbol;
import org.activiti.el.juel.tree.impl.Scanner.Token;
import org.activiti.el.juel.tree.impl.ast.*;
import org.activiti.engine.impl.juel.Builder.Feature;
import org.activiti.engine.impl.juel.Scanner.ScanException;
import org.activiti.engine.impl.juel.Scanner.Symbol;
import org.activiti.engine.impl.juel.Scanner.Token;
/**
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.util;
package org.activiti.engine.impl.juel;
import java.beans.FeatureDescriptor;
import java.util.Collections;
......@@ -21,10 +21,10 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELResolver;
import org.activiti.javax.el.PropertyNotFoundException;
import org.activiti.javax.el.PropertyNotWritableException;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.javax.el.PropertyNotFoundException;
import org.activiti.engine.impl.javax.el.PropertyNotWritableException;
/**
* Simple root property resolver implementation. This resolver handles root properties (i.e.
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree.impl;
package org.activiti.engine.impl.juel;
import java.util.HashMap;
import org.activiti.el.juel.misc.LocalMessages;
/**
......
......@@ -13,18 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.util;
package org.activiti.engine.impl.juel;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELResolver;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.javax.el.ValueExpression;
import org.activiti.javax.el.VariableMapper;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.ValueExpression;
import org.activiti.engine.impl.javax.el.VariableMapper;
/**
* Simple context implementation.
......
......@@ -13,19 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.util;
package org.activiti.engine.impl.juel;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
import org.activiti.javax.el.ArrayELResolver;
import org.activiti.javax.el.BeanELResolver;
import org.activiti.javax.el.CompositeELResolver;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELResolver;
import org.activiti.javax.el.ListELResolver;
import org.activiti.javax.el.MapELResolver;
import org.activiti.javax.el.ResourceBundleELResolver;
import org.activiti.engine.impl.javax.el.ArrayELResolver;
import org.activiti.engine.impl.javax.el.BeanELResolver;
import org.activiti.engine.impl.javax.el.CompositeELResolver;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.javax.el.ListELResolver;
import org.activiti.engine.impl.javax.el.MapELResolver;
import org.activiti.engine.impl.javax.el.ResourceBundleELResolver;
/**
* Simple resolver implementation. This resolver handles root properties (top-level identifiers).
......
......@@ -13,23 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
import java.lang.reflect.Method;
import java.util.Collection;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.javax.el.ValueExpression;
import org.activiti.javax.el.VariableMapper;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.ValueExpression;
import org.activiti.engine.impl.javax.el.VariableMapper;
/**
* Parsed expression, usually created by a {@link org.activiti.el.juel.tree.TreeBuilder}.
* Parsed expression, usually created by a {@link org.activiti.engine.impl.juel.TreeBuilder}.
* The {@link #bind(FunctionMapper, VariableMapper)} method is used to create
* {@link org.activiti.el.juel.tree.Bindings}, which are needed at evaluation time to
* {@link org.activiti.engine.impl.juel.Bindings}, which are needed at evaluation time to
* lookup functions and variables. The tree itself does not contain such information,
* because it would make the tree depend on the function/variable mapper supplied at
* parse time.
......
......@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
import java.io.Serializable;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELException;
/**
* Tree builder interface.
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELException;
/**
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
/**
* Tree cache interface.
......
......@@ -13,26 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel;
package org.activiti.engine.impl.juel;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.el.juel.tree.ExpressionNode;
import org.activiti.el.juel.tree.NodePrinter;
import org.activiti.el.juel.tree.Tree;
import org.activiti.el.juel.tree.TreeBuilder;
import org.activiti.el.juel.tree.TreeStore;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.javax.el.MethodInfo;
import org.activiti.javax.el.VariableMapper;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.MethodInfo;
import org.activiti.engine.impl.javax.el.VariableMapper;
/**
......@@ -43,7 +35,7 @@ import org.activiti.javax.el.VariableMapper;
*
* @author Christoph Beck
*/
public final class TreeMethodExpression extends org.activiti.javax.el.MethodExpression {
public final class TreeMethodExpression extends org.activiti.engine.impl.javax.el.MethodExpression {
private static final long serialVersionUID = 1L;
private final TreeBuilder builder;
......
......@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.tree;
package org.activiti.engine.impl.juel;
/**
* Tree store class.
* A tree store holds a {@link org.activiti.el.juel.tree.TreeBuilder} and a
* {@link org.activiti.el.juel.tree.TreeCache}, provided at construction time.
* A tree store holds a {@link org.activiti.engine.impl.juel.TreeBuilder} and a
* {@link org.activiti.engine.impl.juel.TreeCache}, provided at construction time.
* The <code>get(String)</code> method is then used to serve expression trees.
*
* @author Christoph Beck
......
......@@ -13,25 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel;
package org.activiti.engine.impl.juel;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.PrintWriter;
import org.activiti.el.juel.misc.LocalMessages;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.el.juel.tree.ExpressionNode;
import org.activiti.el.juel.tree.NodePrinter;
import org.activiti.el.juel.tree.Tree;
import org.activiti.el.juel.tree.TreeBuilder;
import org.activiti.el.juel.tree.TreeStore;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.javax.el.ValueReference;
import org.activiti.javax.el.VariableMapper;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.ValueReference;
import org.activiti.engine.impl.javax.el.VariableMapper;
/**
......@@ -43,7 +35,7 @@ import org.activiti.javax.el.VariableMapper;
*
* @author Christoph Beck
*/
public final class TreeValueExpression extends org.activiti.javax.el.ValueExpression {
public final class TreeValueExpression extends org.activiti.engine.impl.javax.el.ValueExpression {
private static final long serialVersionUID = 1L;
private final TreeBuilder builder;
......
......@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.misc;
package org.activiti.engine.impl.juel;
import java.io.Serializable;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELException;
public interface TypeConverter extends Serializable {
/**
......
......@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.el.juel.misc;
package org.activiti.engine.impl.juel;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.activiti.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELException;
/**
* Type Conversions as described in EL 2.1 specification (section 1.17).
......
......@@ -32,6 +32,7 @@ import org.activiti.engine.impl.db.PersistentObject;
import org.activiti.engine.impl.history.HistoricActivityInstanceEntity;
import org.activiti.engine.impl.history.HistoricProcessInstanceEntity;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl;
import org.activiti.engine.impl.pvm.PvmProcessDefinition;
import org.activiti.engine.impl.pvm.PvmProcessInstance;
......@@ -44,7 +45,6 @@ import org.activiti.engine.impl.variable.VariableDeclaration;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.runtime.Job;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.javax.el.ELContext;
/**
......
......@@ -28,23 +28,23 @@ import javax.script.ScriptEngineFactory;
import javax.script.ScriptException;
import javax.script.SimpleBindings;
import org.activiti.el.juel.util.SimpleResolver;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.impl.el.ExpressionFactoryResolver;
import org.activiti.engine.impl.javax.el.ArrayELResolver;
import org.activiti.engine.impl.javax.el.BeanELResolver;
import org.activiti.engine.impl.javax.el.CompositeELResolver;
import org.activiti.engine.impl.javax.el.ELContext;
import org.activiti.engine.impl.javax.el.ELException;
import org.activiti.engine.impl.javax.el.ELResolver;
import org.activiti.engine.impl.javax.el.ExpressionFactory;
import org.activiti.engine.impl.javax.el.FunctionMapper;
import org.activiti.engine.impl.javax.el.ListELResolver;
import org.activiti.engine.impl.javax.el.MapELResolver;
import org.activiti.engine.impl.javax.el.ResourceBundleELResolver;
import org.activiti.engine.impl.javax.el.ValueExpression;
import org.activiti.engine.impl.javax.el.VariableMapper;
import org.activiti.engine.impl.juel.SimpleResolver;
import org.activiti.engine.impl.util.ReflectUtil;
import org.activiti.javax.el.ArrayELResolver;
import org.activiti.javax.el.BeanELResolver;
import org.activiti.javax.el.CompositeELResolver;
import org.activiti.javax.el.ELContext;
import org.activiti.javax.el.ELException;
import org.activiti.javax.el.ELResolver;
import org.activiti.javax.el.ExpressionFactory;
import org.activiti.javax.el.FunctionMapper;
import org.activiti.javax.el.ListELResolver;
import org.activiti.javax.el.MapELResolver;
import org.activiti.javax.el.ResourceBundleELResolver;
import org.activiti.javax.el.ValueExpression;
import org.activiti.javax.el.VariableMapper;
/**
......
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.activiti</groupId>
<artifactId>activiti-juel</artifactId>
<parent>
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.0.rc1-SNAPSHOT</version>
</parent>
<name>Activiti - JUEL</name>
<description>Adapted version of JUEL without dependencies to javax.el</description>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<failIfNoTests>false</failIfNoTests>
<trimStackTrace>false</trimStackTrace>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<excludes>
<exclude>**/TestFactory.java</exclude>
<exclude>**/TestContext.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
package org.activiti.el.juel;
import junit.framework.Test;
import junit.framework.TestSuite;
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
public class AllSuites {
public static Test suite() {
TestSuite suite = new TestSuite("All the test suites...");
suite.addTest(org.activiti.el.juel.AllTests.suite());
suite.addTest(org.activiti.el.juel.misc.AllTests.suite());
suite.addTest(org.activiti.el.juel.tree.AllTests.suite());
suite.addTest(org.activiti.el.juel.tree.impl.AllTests.suite());
suite.addTest(org.activiti.el.juel.tree.impl.ast.AllTests.suite());
return suite;
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for de.odysseus.el");
//$JUnit-BEGIN$
suite.addTestSuite(ExpressionFactoryImplTest.class);
suite.addTestSuite(ObjectValueExpressionTest.class);
suite.addTestSuite(TreeMethodExpressionTest.class);
suite.addTestSuite(TreeValueExpressionTest.class);
//$JUnit-END$
return suite;
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel;
import org.activiti.el.juel.ExpressionFactoryImpl;
import org.activiti.el.juel.util.SimpleContext;
import org.activiti.el.juel.util.SimpleResolver;
public class ExpressionFactoryImplTest extends TestCase {
public static long bar() {
return 1;
}
private ExpressionFactoryImpl factory = new ExpressionFactoryImpl();
public void testCoerceToType() {
assertEquals("1", factory.coerceToType(1l, String.class));
}
public void testCreateTreeValueExpression() {
SimpleContext context = new SimpleContext(new SimpleResolver());
assertEquals(1l, factory.createValueExpression(context, "${1}", Object.class).getValue(context));
}
public void testCreateObjectValueExpression() {
SimpleContext context = new SimpleContext(new SimpleResolver());
assertEquals("1", factory.createValueExpression("1", Object.class).getValue(context));
}
public void testCreateMethodExpression() throws NoSuchMethodException {
SimpleContext context = new SimpleContext(new SimpleResolver());
context.getELResolver().setValue(context, null, "foo", this);
assertEquals(bar(), factory.createMethodExpression(context, "${foo.bar}", null, new Class[0]).invoke(context, null));
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel;
import org.activiti.el.juel.ObjectValueExpression;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.javax.el.ELException;
public class ObjectValueExpressionTest extends TestCase {
private TypeConverter converter = TypeConverter.DEFAULT;
public void testHashCode() {
assertEquals("foo".hashCode(), new ObjectValueExpression(converter, "foo", Object.class).hashCode());
}
public void testEqualsObject() {
assertTrue(new ObjectValueExpression(converter, "foo", Object.class).equals(new ObjectValueExpression(converter, "foo", Object.class)));
assertTrue(new ObjectValueExpression(converter, new String("foo"), Object.class).equals(new ObjectValueExpression(converter, "foo", Object.class)));
assertFalse(new ObjectValueExpression(converter, "foo", Object.class).equals(new ObjectValueExpression(converter, "bar", Object.class)));
}
public void testGetValue() {
assertEquals("foo", new ObjectValueExpression(converter, "foo", Object.class).getValue(null));
}
public void testGetExpressionString() {
assertNull(new ObjectValueExpression(converter, "foo", Object.class).getExpressionString());
}
public void testIsLiteralText() {
assertFalse(new ObjectValueExpression(converter, "foo", Object.class).isLiteralText());
}
public void testGetType() {
assertNull(new ObjectValueExpression(converter, "foo", Object.class).getType(null));
}
public void testIsReadOnly() {
assertTrue(new ObjectValueExpression(converter, "foo", Object.class).isReadOnly(null));
}
public void testSetValue() {
try {
new ObjectValueExpression(converter, "foo", Object.class).setValue(null, "bar");
fail();
} catch (ELException e) {}
}
public void testSerialize() throws Exception {
ObjectValueExpression expression = new ObjectValueExpression(converter, "foo", Object.class);
assertEquals(expression, deserialize(serialize(expression)));
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import org.activiti.el.juel.tree.Tree;
import org.activiti.el.juel.tree.impl.Builder;
public abstract class TestCase extends junit.framework.TestCase {
protected static final Builder BUILDER = new Builder(Builder.Feature.METHOD_INVOCATIONS);
protected static final Tree parse(String expression) {
return BUILDER.build(expression);
}
protected static byte[] serialize(Object value) throws Exception {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(bout);
out.writeObject(value);
out.close();
return bout.toByteArray();
}
protected static Object deserialize(byte[] bytes) throws Exception {
ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
ObjectInput in = new ObjectInputStream(bin);
return in.readObject();
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel;
import org.activiti.el.juel.TreeMethodExpression;
import org.activiti.el.juel.tree.TreeStore;
import org.activiti.el.juel.tree.impl.Builder;
import org.activiti.el.juel.util.SimpleContext;
import org.activiti.el.juel.util.SimpleResolver;
import org.activiti.javax.el.BeanELResolver;
import org.activiti.javax.el.MethodInfo;
public class TreeMethodExpressionTest extends TestCase {
public static int foo() {
return 0;
}
public static int bar() {
return 0;
}
SimpleContext context;
TreeStore store = new TreeStore(new Builder(), null);
@Override
protected void setUp() throws Exception {
context = new SimpleContext(new SimpleResolver(new BeanELResolver()));
context.getELResolver().setValue(context, null, "base", this);
}
public void testEqualsAndHashCode() {
TreeMethodExpression e1, e2;
e1 = new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]);
e2 = new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]);
assertEquals(e1, e2);
e1 = new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]);
e2 = new TreeMethodExpression(store, null, null, null, "${base.bar}", null, new Class[0]);
assertFalse(e1.equals(e2));
}
public void testGetExpressionString() {
assertEquals("${base.foo}", new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]).getExpressionString());
}
public void testIsLiteralText() {
assertFalse(new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]).isLiteralText());
assertTrue(new TreeMethodExpression(store, null, null, null, "base.foo", null, new Class[0]).isLiteralText());
}
public void testIsDeferred() {
assertFalse(new TreeMethodExpression(store, null, null, null, "foo", null, new Class[0]).isDeferred());
assertFalse(new TreeMethodExpression(store, null, null, null, "${foo}", null, new Class[0]).isDeferred());
assertTrue(new TreeMethodExpression(store, null, null, null, "#{foo}", null, new Class[0]).isDeferred());
}
public void testGetMethodInfo() {
TreeMethodExpression e = new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]);
MethodInfo info = e.getMethodInfo(context);
assertEquals("foo", info.getName());
assertEquals(0, info.getParamTypes().length);
assertEquals(int.class, info.getReturnType());
}
public void testInvoke() {
assertEquals(0, new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]).invoke(context, null));
}
public void testSerialize() throws Exception {
TreeMethodExpression expression = new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]);
assertEquals(expression, deserialize(serialize(expression)));
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel;
import org.activiti.el.juel.TreeValueExpression;
import org.activiti.el.juel.tree.TreeStore;
import org.activiti.el.juel.tree.impl.Builder;
import org.activiti.el.juel.util.SimpleContext;
import org.activiti.el.juel.util.SimpleResolver;
import org.activiti.javax.el.BeanELResolver;
import org.activiti.javax.el.PropertyNotFoundException;
public class TreeValueExpressionTest extends TestCase {
public static int foo() {
return 0;
}
public static int bar() {
return 0;
}
int foobar;
public void setFoobar(int value) {
foobar = value;
}
SimpleContext context;
TreeStore store = new TreeStore(new Builder(), null);
@Override
protected void setUp() throws Exception {
context = new SimpleContext(new SimpleResolver(new BeanELResolver()));
context.getELResolver().setValue(context, null, "base", this);
// variables var_long_1, var_long_2
context.setVariable("var_long_1", new TreeValueExpression(store, null, null, null, "${1}", long.class));
context.setVariable("var_long_2", new TreeValueExpression(store, null, null, null, "${1}", long.class));
// var_var_long_1 --> var_long_1, var_var_long_2 --> var_long_1
context.setVariable("var_var_long_1", new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_long_1}", long.class));
context.setVariable("var_var_long_2", new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_long_2}", long.class));
// functions ns:f0(), ns:f1()
context.setFunction("", "foo", getClass().getMethod("foo"));
context.setFunction("ns", "foo_1", getClass().getMethod("foo"));
context.setFunction("ns", "foo_2", getClass().getMethod("foo"));
context.setVariable("var_foo_1", new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${ns:foo_1()}", long.class));
context.setVariable("var_foo_2", new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${ns:foo_2()}", long.class));
context.setVariable("var_foobar", new TreeValueExpression(store, null, context.getVariableMapper(), null, "${base.foobar}", int.class));
context.getELResolver().setValue(context, null, "property_foo", "foo");
}
public void testEqualsAndHashCode() throws NoSuchMethodException {
TreeValueExpression e1, e2;
e1 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${1}", Object.class);
e2 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${1}", Object.class);
assertEquals(e1, e2);
assertEquals(e1.hashCode(), e2.hashCode());
e1 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_long_1}", Object.class);
e2 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_long_2}", Object.class);
assertEquals(e1, e2);
assertEquals(e1.hashCode(), e2.hashCode());
e1 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_var_long_1}", Object.class);
e2 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_var_long_2}", Object.class);
assertEquals(e1, e2);
assertEquals(e1.hashCode(), e2.hashCode());
e1 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_long_1}", Object.class);
context.getVariableMapper().setVariable("var_long_1", new TreeValueExpression(store, null, context.getVariableMapper(), null, "${-1}", Object.class));
e2 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_long_1}", Object.class);
assertFalse(e1.equals(e2));
e1 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_foo_1}", Object.class);
e2 = new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_foo_2}", Object.class);
assertEquals(e1, e2);
assertEquals(e1.hashCode(), e2.hashCode());
e2 = new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${ns:foo_1()}", Object.class);
e1 = new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${ns:foo_2()}", Object.class);
assertEquals(e1, e2);
assertEquals(e1.hashCode(), e2.hashCode());
e2 = new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${foo()}", Object.class);
e1 = new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${ns:foo_1()}", Object.class);
assertEquals(e1, e2);
assertEquals(e1.hashCode(), e2.hashCode());
e2 = new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${foo()}", Object.class);
context.setFunction("", "foo", getClass().getMethod("bar"));
e1 = new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${foo()}", Object.class);
assertFalse(e1.equals(e2));
e2 = new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${ns:foo_1()}", Object.class);
context.setFunction("ns", "foo_1", getClass().getMethod("bar"));
e1 = new TreeValueExpression(store, context.getFunctionMapper(), null, null, "${ns:foo_1()}", Object.class);
assertFalse(e1.equals(e2));
}
public void testGetExpressionString() {
assertEquals("foo", new TreeValueExpression(store, null, null, null, "foo", Object.class).getExpressionString());
}
public void testIsLiteralText() {
assertTrue(new TreeValueExpression(store, null, null, null, "foo", Object.class).isLiteralText());
assertFalse(new TreeValueExpression(store, null, null, null, "${foo}", Object.class).isLiteralText());
}
public void testIsDeferred() {
assertFalse(new TreeValueExpression(store, null, null, null, "foo", Object.class).isDeferred());
assertFalse(new TreeValueExpression(store, null, null, null, "${foo}", Object.class).isDeferred());
assertTrue(new TreeValueExpression(store, null, null, null, "#{foo}", Object.class).isDeferred());
}
public void testGetExpectedType() {
assertEquals(Object.class, new TreeValueExpression(store, null, null, null, "${foo}", Object.class).getExpectedType());
assertEquals(String.class, new TreeValueExpression(store, null, null, null, "${foo}", String.class).getExpectedType());
}
public void testGetType() {
assertFalse(new TreeValueExpression(store, null, null, null, "${property_foo}", Object.class).isReadOnly(context));
}
public void testIsReadOnly() {
assertFalse(new TreeValueExpression(store, null, null, null, "${property_foo}", Object.class).isReadOnly(context));
}
public void testSetValue() {
new TreeValueExpression(store, null, null, null, "${property_foo}", Object.class).setValue(context, "bar");
assertEquals("bar", new TreeValueExpression(store, null, null, null, "${property_foo}", Object.class).getValue(context));
// Test added for bug #2748538
new TreeValueExpression(store, null, context.getVariableMapper(), null, "${var_foobar}", Object.class).setValue(context, 123);
assertEquals(123, foobar);
try {
context.getELResolver().getValue(context, null, "var_foobar");
fail("Bug in AstIdentifierNode.setValue(...)");
} catch (PropertyNotFoundException e) {
// fine
}
}
public void testGetValue() {
assertEquals("foo", new TreeValueExpression(store, null, null, null, "${property_foo}", Object.class).getValue(context));
}
public void testSerialize() throws Exception {
TreeValueExpression expression = new TreeValueExpression(store, context.getFunctionMapper(), context.getVariableMapper(), null, "${var_long_1 + foo()}", Object.class);
assertEquals(expression, deserialize(serialize(expression)));
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel.misc;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for de.odysseus.el.lang");
//$JUnit-BEGIN$
suite.addTestSuite(NumberOperationsTest.class);
suite.addTestSuite(BooleanOperationsTest.class);
suite.addTestSuite(TypeConverterImplTest.class);
suite.addTestSuite(MessagesTest.class);
//$JUnit-END$
return suite;
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel.misc;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import org.activiti.el.juel.misc.BooleanOperations;
import org.activiti.el.juel.misc.TypeConverter;
import junit.framework.TestCase;
public class BooleanOperationsTest extends TestCase {
/**
* Test enum type
*/
static enum Foo { BAR, BAZ };
private TypeConverter converter = TypeConverter.DEFAULT;
/*
* Test method for 'de.odysseus.el.lang.BooleanOperations.lt(Object, Object)'
*/
public void testLt() {
assertFalse(BooleanOperations.lt(converter, Boolean.TRUE, Boolean.TRUE));
assertFalse(BooleanOperations.lt(converter, null, Boolean.TRUE));
assertFalse(BooleanOperations.lt(converter, Boolean.TRUE, null));
assertTrue(BooleanOperations.lt(converter, "1", new BigDecimal("2")));
assertFalse(BooleanOperations.lt(converter, new BigDecimal("1"), "1"));
assertFalse(BooleanOperations.lt(converter, new BigDecimal("2"), "1"));
assertTrue(BooleanOperations.lt(converter, "1", new Float("2")));
assertFalse(BooleanOperations.lt(converter, new Float("1"), "1"));
assertFalse(BooleanOperations.lt(converter, new Float("2"), "1"));
assertTrue(BooleanOperations.lt(converter, "1", new Double("2")));
assertFalse(BooleanOperations.lt(converter, new Double("1"), "1"));
assertFalse(BooleanOperations.lt(converter, new Double("2"), "1"));
assertTrue(BooleanOperations.lt(converter, "1", new BigInteger("2")));
assertFalse(BooleanOperations.lt(converter, new BigInteger("1"), "1"));
assertFalse(BooleanOperations.lt(converter, new BigInteger("2"), "1"));
assertTrue(BooleanOperations.lt(converter, "1", new Byte("2")));
assertFalse(BooleanOperations.lt(converter, new Byte("1"), "1"));
assertFalse(BooleanOperations.lt(converter, new Byte("2"), "1"));
assertTrue(BooleanOperations.lt(converter, "1", new Short("2")));
assertFalse(BooleanOperations.lt(converter, new Short("1"), "1"));
assertFalse(BooleanOperations.lt(converter, new Short("2"), "1"));
assertTrue(BooleanOperations.lt(converter, new Character('a'), new Character('b')));
assertFalse(BooleanOperations.lt(converter, new Character('a'), new Character('a')));
assertFalse(BooleanOperations.lt(converter, new Character('b'), new Character('a')));
assertTrue(BooleanOperations.lt(converter, "1", new Integer("2")));
assertFalse(BooleanOperations.lt(converter, new Integer("1"), "1"));
assertFalse(BooleanOperations.lt(converter, new Integer("2"), "1"));
assertTrue(BooleanOperations.lt(converter, "1", new Long("2")));
assertFalse(BooleanOperations.lt(converter, new Long("1"), "1"));
assertFalse(BooleanOperations.lt(converter, new Long("2"), "1"));
assertTrue(BooleanOperations.lt(converter, "a", "b"));
assertFalse(BooleanOperations.lt(converter, "a", "a"));
assertFalse(BooleanOperations.lt(converter, "b", "a"));
try {
BooleanOperations.lt(converter, getClass(), new Character('a'));
fail();
} catch (Exception e) {}
try {
BooleanOperations.lt(converter, new Character('a'), getClass());
fail();
} catch (Exception e) {}
try {
BooleanOperations.lt(converter, getClass(), new Long(0));
fail();
} catch (Exception e) {}
}
/*
* Test method for 'de.odysseus.el.lang.BooleanOperations.gt(Object, Object)'
*/
public void testGt() {
assertFalse(BooleanOperations.gt(converter, Boolean.TRUE, Boolean.TRUE));
assertFalse(BooleanOperations.gt(converter, null, Boolean.TRUE));
assertFalse(BooleanOperations.gt(converter, Boolean.TRUE, null));
assertFalse(BooleanOperations.gt(converter, "1", new BigDecimal("2")));
assertFalse(BooleanOperations.gt(converter, new BigDecimal("1"), "1"));
assertTrue(BooleanOperations.gt(converter, new BigDecimal("2"), "1"));
assertFalse(BooleanOperations.gt(converter, "1", new Float("2")));
assertFalse(BooleanOperations.gt(converter, new Float("1"), "1"));
assertTrue(BooleanOperations.gt(converter, new Float("2"), "1"));
assertFalse(BooleanOperations.gt(converter, "1", new Double("2")));
assertFalse(BooleanOperations.gt(converter, new Double("1"), "1"));
assertTrue(BooleanOperations.gt(converter, new Double("2"), "1"));
assertFalse(BooleanOperations.gt(converter, "1", new BigInteger("2")));
assertFalse(BooleanOperations.gt(converter, new BigInteger("1"), "1"));
assertTrue(BooleanOperations.gt(converter, new BigInteger("2"), "1"));
assertFalse(BooleanOperations.gt(converter, "1", new Byte("2")));
assertFalse(BooleanOperations.gt(converter, new Byte("1"), "1"));
assertTrue(BooleanOperations.gt(converter, new Byte("2"), "1"));
assertFalse(BooleanOperations.gt(converter, "1", new Short("2")));
assertFalse(BooleanOperations.gt(converter, new Short("1"), "1"));
assertTrue(BooleanOperations.gt(converter, new Short("2"), "1"));
assertFalse(BooleanOperations.gt(converter, new Character('a'), new Character('b')));
assertFalse(BooleanOperations.gt(converter, new Character('a'), new Character('a')));
assertTrue(BooleanOperations.gt(converter, new Character('b'), new Character('a')));
assertFalse(BooleanOperations.gt(converter, "1", new Integer("2")));
assertFalse(BooleanOperations.gt(converter, new Integer("1"), "1"));
assertTrue(BooleanOperations.gt(converter, new Integer("2"), "1"));
assertFalse(BooleanOperations.gt(converter, "1", new Long("2")));
assertFalse(BooleanOperations.gt(converter, new Long("1"), "1"));
assertTrue(BooleanOperations.gt(converter, new Long("2"), "1"));
assertFalse(BooleanOperations.gt(converter, "a", "b"));
assertFalse(BooleanOperations.gt(converter, "a", "a"));
assertTrue(BooleanOperations.gt(converter, "b", "a"));
try {
BooleanOperations.gt(converter, getClass(), new Character('a'));
fail();
} catch (Exception e) {}
try {
BooleanOperations.gt(converter, new Character('a'), getClass());
fail();
} catch (Exception e) {}
try {
BooleanOperations.gt(converter, getClass(), new Long(0));
fail();
} catch (Exception e) {}
}
/*
* Test method for 'de.odysseus.el.lang.BooleanOperations.ge(Object, Object)'
*/
public void testGe() {
assertTrue(BooleanOperations.ge(converter, Boolean.TRUE, Boolean.TRUE));
assertFalse(BooleanOperations.ge(converter, null, Boolean.TRUE));
assertFalse(BooleanOperations.ge(converter, Boolean.TRUE, null));
assertFalse(BooleanOperations.ge(converter, "1", new BigDecimal("2")));
assertTrue(BooleanOperations.ge(converter, new BigDecimal("1"), "1"));
assertTrue(BooleanOperations.ge(converter, new BigDecimal("2"), "1"));
assertFalse(BooleanOperations.ge(converter, "1", new Float("2")));
assertTrue(BooleanOperations.ge(converter, new Float("1"), "1"));
assertTrue(BooleanOperations.ge(converter, new Float("2"), "1"));
assertFalse(BooleanOperations.ge(converter, "1", new Double("2")));
assertTrue(BooleanOperations.ge(converter, new Double("1"), "1"));
assertTrue(BooleanOperations.ge(converter, new Double("2"), "1"));
assertFalse(BooleanOperations.ge(converter, "1", new BigInteger("2")));
assertTrue(BooleanOperations.ge(converter, new BigInteger("1"), "1"));
assertTrue(BooleanOperations.ge(converter, new BigInteger("2"), "1"));
assertFalse(BooleanOperations.ge(converter, "1", new Byte("2")));
assertTrue(BooleanOperations.ge(converter, new Byte("1"), "1"));
assertTrue(BooleanOperations.ge(converter, new Byte("2"), "1"));
assertFalse(BooleanOperations.ge(converter, "1", new Short("2")));
assertTrue(BooleanOperations.ge(converter, new Short("1"), "1"));
assertTrue(BooleanOperations.ge(converter, new Short("2"), "1"));
assertFalse(BooleanOperations.ge(converter, new Character('a'), new Character('b')));
assertTrue(BooleanOperations.ge(converter, new Character('a'), new Character('a')));
assertTrue(BooleanOperations.ge(converter, new Character('b'), new Character('a')));
assertFalse(BooleanOperations.ge(converter, "1", new Integer("2")));
assertTrue(BooleanOperations.ge(converter, new Integer("1"), "1"));
assertTrue(BooleanOperations.ge(converter, new Integer("2"), "1"));
assertFalse(BooleanOperations.ge(converter, "1", new Long("2")));
assertTrue(BooleanOperations.ge(converter, new Long("1"), "1"));
assertTrue(BooleanOperations.ge(converter, new Long("2"), "1"));
assertFalse(BooleanOperations.ge(converter, "a", "b"));
assertTrue(BooleanOperations.ge(converter, "a", "a"));
assertTrue(BooleanOperations.ge(converter, "b", "a"));
try {
BooleanOperations.ge(converter, getClass(), new Character('a'));
fail();
} catch (Exception e) {}
try {
BooleanOperations.ge(converter, new Character('a'), getClass());
fail();
} catch (Exception e) {}
try {
BooleanOperations.ge(converter, getClass(), new Long(0));
fail();
} catch (Exception e) {}
}
/*
* Test method for 'de.odysseus.el.lang.BooleanOperations.le(Object, Object)'
*/
public void testLe() {
assertTrue(BooleanOperations.le(converter, Boolean.TRUE, Boolean.TRUE));
assertFalse(BooleanOperations.le(converter, null, Boolean.TRUE));
assertFalse(BooleanOperations.le(converter, Boolean.TRUE, null));
assertTrue(BooleanOperations.le(converter, "1", new BigDecimal("2")));
assertTrue(BooleanOperations.le(converter, new BigDecimal("1"), "1"));
assertFalse(BooleanOperations.le(converter, new BigDecimal("2"), "1"));
assertTrue(BooleanOperations.le(converter, "1", new Float("2")));
assertTrue(BooleanOperations.le(converter, new Float("1"), "1"));
assertFalse(BooleanOperations.le(converter, new Float("2"), "1"));
assertTrue(BooleanOperations.le(converter, "1", new Double("2")));
assertTrue(BooleanOperations.le(converter, new Double("1"), "1"));
assertFalse(BooleanOperations.le(converter, new Double("2"), "1"));
assertTrue(BooleanOperations.le(converter, "1", new BigInteger("2")));
assertTrue(BooleanOperations.le(converter, new BigInteger("1"), "1"));
assertFalse(BooleanOperations.le(converter, new BigInteger("2"), "1"));
assertTrue(BooleanOperations.le(converter, "1", new Byte("2")));
assertTrue(BooleanOperations.le(converter, new Byte("1"), "1"));
assertFalse(BooleanOperations.le(converter, new Byte("2"), "1"));
assertTrue(BooleanOperations.le(converter, "1", new Short("2")));
assertTrue(BooleanOperations.le(converter, new Short("1"), "1"));
assertFalse(BooleanOperations.le(converter, new Short("2"), "1"));
assertTrue(BooleanOperations.le(converter, new Character('a'), new Character('b')));
assertTrue(BooleanOperations.le(converter, new Character('a'), new Character('a')));
assertFalse(BooleanOperations.le(converter, new Character('b'), new Character('a')));
assertTrue(BooleanOperations.le(converter, "1", new Integer("2")));
assertTrue(BooleanOperations.le(converter, new Integer("1"), "1"));
assertFalse(BooleanOperations.le(converter, new Integer("2"), "1"));
assertTrue(BooleanOperations.le(converter, "1", new Long("2")));
assertTrue(BooleanOperations.le(converter, new Long("1"), "1"));
assertFalse(BooleanOperations.le(converter, new Long("2"), "1"));
assertTrue(BooleanOperations.le(converter, "a", "b"));
assertTrue(BooleanOperations.le(converter, "a", "a"));
assertFalse(BooleanOperations.le(converter, "b", "a"));
try {
BooleanOperations.le(converter, getClass(), new Character('a'));
fail();
} catch (Exception e) {}
try {
BooleanOperations.le(converter, new Character('a'), getClass());
fail();
} catch (Exception e) {}
try {
BooleanOperations.le(converter, getClass(), new Long(0));
fail();
} catch (Exception e) {}
}
/*
* Test method for 'de.odysseus.el.lang.BooleanOperations.eq(Object, Object)'
*/
public void testEq() {
assertTrue(BooleanOperations.eq(converter, Boolean.TRUE, Boolean.TRUE));
assertFalse(BooleanOperations.eq(converter, null, Boolean.TRUE));
assertFalse(BooleanOperations.eq(converter, Boolean.TRUE, null));
assertFalse(BooleanOperations.eq(converter, "1", new BigDecimal("2")));
assertTrue(BooleanOperations.eq(converter, new BigDecimal("1"), "1"));
assertFalse(BooleanOperations.eq(converter, new BigDecimal("2"), "1"));
assertFalse(BooleanOperations.eq(converter, "1", new Float("2")));
assertTrue(BooleanOperations.eq(converter, new Float("1"), "1"));
assertFalse(BooleanOperations.eq(converter, new Float("2"), "1"));
assertFalse(BooleanOperations.eq(converter, "1", new Double("2")));
assertTrue(BooleanOperations.eq(converter, new Double("1"), "1"));
assertFalse(BooleanOperations.eq(converter, new Double("2"), "1"));
assertFalse(BooleanOperations.eq(converter, "1", new BigInteger("2")));
assertTrue(BooleanOperations.eq(converter, new BigInteger("1"), "1"));
assertFalse(BooleanOperations.eq(converter, new BigInteger("2"), "1"));
assertFalse(BooleanOperations.eq(converter, "1", new Byte("2")));
assertTrue(BooleanOperations.eq(converter, new Byte("1"), "1"));
assertFalse(BooleanOperations.eq(converter, new Byte("2"), "1"));
assertFalse(BooleanOperations.eq(converter, "1", new Short("2")));
assertTrue(BooleanOperations.eq(converter, new Short("1"), "1"));
assertFalse(BooleanOperations.eq(converter, new Short("2"), "1"));
assertFalse(BooleanOperations.eq(converter, new Character('a'), new Character('b')));
assertTrue(BooleanOperations.eq(converter, new Character('a'), new Character('a')));
assertFalse(BooleanOperations.eq(converter, new Character('b'), new Character('a')));
assertFalse(BooleanOperations.eq(converter, "1", new Integer("2")));
assertTrue(BooleanOperations.eq(converter, new Integer("1"), "1"));
assertFalse(BooleanOperations.eq(converter, new Integer("2"), "1"));
assertFalse(BooleanOperations.eq(converter, "1", new Long("2")));
assertTrue(BooleanOperations.eq(converter, new Long("1"), "1"));
assertFalse(BooleanOperations.eq(converter, new Long("2"), "1"));
assertFalse(BooleanOperations.eq(converter, new Boolean(false), new Boolean(true)));
assertTrue(BooleanOperations.eq(converter, new Boolean(true), new Boolean(true)));
assertTrue(BooleanOperations.eq(converter, new Boolean(false), new Boolean(false)));
assertTrue(BooleanOperations.eq(converter, Foo.BAR, "BAR"));
assertTrue(BooleanOperations.eq(converter, "BAR", Foo.BAR));
assertFalse(BooleanOperations.eq(converter, Foo.BAR, "BAZ"));
try {
BooleanOperations.eq(converter, Foo.BAR, "FOO"); // coercion fails
fail();
} catch (Exception e) {}
assertFalse(BooleanOperations.eq(converter, "a", "b"));
assertTrue(BooleanOperations.eq(converter, "a", "a"));
assertFalse(BooleanOperations.eq(converter, "b", "a"));
assertFalse(BooleanOperations.eq(converter, getClass(), new Character('a')));
assertFalse(BooleanOperations.eq(converter, new Character('a'), getClass()));
try {
BooleanOperations.eq(converter, getClass(), new Long(0)); // coercion fails
fail();
} catch (Exception e) {}
}
/*
* Test method for 'de.odysseus.el.lang.BooleanOperations.ne(Object, Object)'
*/
public void testNe() {
assertFalse(BooleanOperations.ne(converter, Boolean.TRUE, Boolean.TRUE));
assertTrue(BooleanOperations.ne(converter, null, Boolean.TRUE));
assertTrue(BooleanOperations.ne(converter, Boolean.TRUE, null));
assertTrue(BooleanOperations.ne(converter, "1", new BigDecimal("2")));
assertFalse(BooleanOperations.ne(converter, new BigDecimal("1"), "1"));
assertTrue(BooleanOperations.ne(converter, new BigDecimal("2"), "1"));
assertTrue(BooleanOperations.ne(converter, "1", new Float("2")));
assertFalse(BooleanOperations.ne(converter, new Float("1"), "1"));
assertTrue(BooleanOperations.ne(converter, new Float("2"), "1"));
assertTrue(BooleanOperations.ne(converter, "1", new Double("2")));
assertFalse(BooleanOperations.ne(converter, new Double("1"), "1"));
assertTrue(BooleanOperations.ne(converter, new Double("2"), "1"));
assertTrue(BooleanOperations.ne(converter, "1", new BigInteger("2")));
assertFalse(BooleanOperations.ne(converter, new BigInteger("1"), "1"));
assertTrue(BooleanOperations.ne(converter, new BigInteger("2"), "1"));
assertTrue(BooleanOperations.ne(converter, "1", new Byte("2")));
assertFalse(BooleanOperations.ne(converter, new Byte("1"), "1"));
assertTrue(BooleanOperations.ne(converter, new Byte("2"), "1"));
assertTrue(BooleanOperations.ne(converter, "1", new Short("2")));
assertFalse(BooleanOperations.ne(converter, new Short("1"), "1"));
assertTrue(BooleanOperations.ne(converter, new Short("2"), "1"));
assertTrue(BooleanOperations.ne(converter, new Character('a'), new Character('b')));
assertFalse(BooleanOperations.ne(converter, new Character('a'), new Character('a')));
assertTrue(BooleanOperations.ne(converter, new Character('b'), new Character('a')));
assertTrue(BooleanOperations.ne(converter, "1", new Integer("2")));
assertFalse(BooleanOperations.ne(converter, new Integer("1"), "1"));
assertTrue(BooleanOperations.ne(converter, new Integer("2"), "1"));
assertTrue(BooleanOperations.ne(converter, "1", new Long("2")));
assertFalse(BooleanOperations.ne(converter, new Long("1"), "1"));
assertTrue(BooleanOperations.ne(converter, new Long("2"), "1"));
assertTrue(BooleanOperations.ne(converter, new Boolean(false), new Boolean(true)));
assertFalse(BooleanOperations.ne(converter, new Boolean(true), new Boolean(true)));
assertFalse(BooleanOperations.ne(converter, new Boolean(false), new Boolean(false)));
assertFalse(BooleanOperations.ne(converter, Foo.BAR, "BAR"));
assertFalse(BooleanOperations.ne(converter, "BAR", Foo.BAR));
assertTrue(BooleanOperations.ne(converter, Foo.BAR, "BAZ"));
try {
BooleanOperations.ne(converter, Foo.BAR, "FOO"); // coercion fails
fail();
} catch (Exception e) {}
assertTrue(BooleanOperations.ne(converter, "a", "b"));
assertFalse(BooleanOperations.ne(converter, "a", "a"));
assertTrue(BooleanOperations.ne(converter, "b", "a"));
assertTrue(BooleanOperations.ne(converter, getClass(), new Character('a')));
assertTrue(BooleanOperations.ne(converter, new Character('a'), getClass()));
try {
BooleanOperations.ne(converter, getClass(), new Long(0)); // coercion fails
fail();
} catch (Exception e) {}
}
/*
* Test method for 'de.odysseus.el.lang.BooleanOperations.empty(Object)'
*/
public void testEmpty() {
assertTrue(BooleanOperations.empty(converter, null));
assertTrue(BooleanOperations.empty(converter, ""));
assertTrue(BooleanOperations.empty(converter, new Object[0]));
assertTrue(BooleanOperations.empty(converter, new HashMap<Object,Object>()));
assertTrue(BooleanOperations.empty(converter, new ArrayList<Object>()));
assertFalse(BooleanOperations.empty(converter, "foo"));
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel.misc;
import org.activiti.el.juel.misc.LocalMessages;
import junit.framework.TestCase;
public class MessagesTest extends TestCase {
/*
* Test method for 'de.odysseus.el.lang.Messages.get(String)'
*/
public void testGetString() {
assertTrue(LocalMessages.get("foo").matches(".*foo"));
}
/*
* Test method for 'de.odysseus.el.lang.Messages.get(String, Object)'
*/
public void testGetStringObject() {
assertTrue(LocalMessages.get("foo", "bar").matches(".*foo\\(bar\\)"));
}
/*
* Test method for 'de.odysseus.el.lang.Messages.get(String, Object, Object)'
*/
public void testGetStringObjectObject() {
assertTrue(LocalMessages.get("foo", "bar", "baz").matches(".*foo\\(bar,\\s*baz\\)"));
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel.misc;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.activiti.el.juel.misc.NumberOperations;
import org.activiti.el.juel.misc.TypeConverter;
import junit.framework.TestCase;
public class NumberOperationsTest extends TestCase {
private TypeConverter converter = TypeConverter.DEFAULT;
/*
* Test method for 'de.odysseus.el.lang.NumberOperations.add(Object, Object)'
*/
public void testAdd() {
assertEquals(new Long(0), NumberOperations.add(converter, null, null));
BigDecimal bd1 = new BigDecimal(1);
Integer i1 = new Integer(1);
Long l1 = new Long(1);
Float f1 = new Float(1);
Double d1 = new Double(1);
String e1 = "1e0";
String s1 = "1";
BigInteger bi1 = new BigInteger("1");
Long l2 = new Long(2);
BigDecimal bd2 = new BigDecimal(2);
Double d2 = new Double(2);
BigInteger bi2 = new BigInteger("2");
assertEquals(bd2, NumberOperations.add(converter, l1, bd1));
assertEquals(bd2, NumberOperations.add(converter, bd1, l1));
assertEquals(bd2, NumberOperations.add(converter, f1, bi1));
assertEquals(bd2, NumberOperations.add(converter, bi1, f1));
assertEquals(d2, NumberOperations.add(converter, f1, l1));
assertEquals(d2, NumberOperations.add(converter, l1, f1));
assertEquals(bd2, NumberOperations.add(converter, d1, bi1));
assertEquals(bd2, NumberOperations.add(converter, bi1, d1));
assertEquals(d2, NumberOperations.add(converter, d1, l1));
assertEquals(d2, NumberOperations.add(converter, l1, d1));
assertEquals(bd2, NumberOperations.add(converter, e1, bi1));
assertEquals(bd2, NumberOperations.add(converter, bi1, e1));
assertEquals(d2, NumberOperations.add(converter, e1, l1));
assertEquals(d2, NumberOperations.add(converter, l1, e1));
assertEquals(bi2, NumberOperations.add(converter, l1, bi1));
assertEquals(bi2, NumberOperations.add(converter, bi1, l1));
assertEquals(l2, NumberOperations.add(converter, i1, l1));
assertEquals(l2, NumberOperations.add(converter, l1, i1));
assertEquals(l2, NumberOperations.add(converter, i1, s1));
assertEquals(l2, NumberOperations.add(converter, s1, i1));
}
/*
* Test method for 'de.odysseus.el.lang.NumberOperations.sub(Object, Object)'
*/
public void testSub() {
assertEquals(new Long(0), NumberOperations.sub(converter, null, null));
BigDecimal bd1 = new BigDecimal(1);
Integer i1 = new Integer(1);
Long l1 = new Long(1);
Float f1 = new Float(1);
Double d1 = new Double(1);
String e1 = "1e0";
String s1 = "1";
BigInteger bi1 = new BigInteger("1");
Long l2 = new Long(0);
BigDecimal bd2 = new BigDecimal(0);
Double d2 = new Double(0);
BigInteger bi2 = new BigInteger("0");
assertEquals(bd2, NumberOperations.sub(converter, l1, bd1));
assertEquals(bd2, NumberOperations.sub(converter, bd1, l1));
assertEquals(bd2, NumberOperations.sub(converter, f1, bi1));
assertEquals(bd2, NumberOperations.sub(converter, bi1, f1));
assertEquals(d2, NumberOperations.sub(converter, f1, l1));
assertEquals(d2, NumberOperations.sub(converter, l1, f1));
assertEquals(bd2, NumberOperations.sub(converter, d1, bi1));
assertEquals(bd2, NumberOperations.sub(converter, bi1, d1));
assertEquals(d2, NumberOperations.sub(converter, d1, l1));
assertEquals(d2, NumberOperations.sub(converter, l1, d1));
assertEquals(bd2, NumberOperations.sub(converter, e1, bi1));
assertEquals(bd2, NumberOperations.sub(converter, bi1, e1));
assertEquals(d2, NumberOperations.sub(converter, e1, l1));
assertEquals(d2, NumberOperations.sub(converter, l1, e1));
assertEquals(bi2, NumberOperations.sub(converter, l1, bi1));
assertEquals(bi2, NumberOperations.sub(converter, bi1, l1));
assertEquals(l2, NumberOperations.sub(converter, i1, l1));
assertEquals(l2, NumberOperations.sub(converter, l1, i1));
assertEquals(l2, NumberOperations.sub(converter, i1, s1));
assertEquals(l2, NumberOperations.sub(converter, s1, i1));
}
/*
* Test method for 'de.odysseus.el.lang.NumberOperations.mul(Object, Object)'
*/
public void testMul() {
assertEquals(new Long(0), NumberOperations.mul(converter, null, null));
BigDecimal bd1 = new BigDecimal(1);
Integer i1 = new Integer(1);
Long l1 = new Long(1);
Float f1 = new Float(1);
Double d1 = new Double(1);
String e1 = "1e0";
String s1 = "1";
BigInteger bi1 = new BigInteger("1");
Long l2 = new Long(1);
BigDecimal bd2 = new BigDecimal(1);
Double d2 = new Double(1);
BigInteger bi2 = new BigInteger("1");
assertEquals(bd2, NumberOperations.mul(converter, l1, bd1));
assertEquals(bd2, NumberOperations.mul(converter, bd1, l1));
assertEquals(bd2, NumberOperations.mul(converter, f1, bi1));
assertEquals(bd2, NumberOperations.mul(converter, bi1, f1));
assertEquals(d2, NumberOperations.mul(converter, f1, l1));
assertEquals(d2, NumberOperations.mul(converter, l1, f1));
assertEquals(bd2, NumberOperations.mul(converter, d1, bi1));
assertEquals(bd2, NumberOperations.mul(converter, bi1, d1));
assertEquals(d2, NumberOperations.mul(converter, d1, l1));
assertEquals(d2, NumberOperations.mul(converter, l1, d1));
assertEquals(bd2, NumberOperations.mul(converter, e1, bi1));
assertEquals(bd2, NumberOperations.mul(converter, bi1, e1));
assertEquals(d2, NumberOperations.mul(converter, e1, l1));
assertEquals(d2, NumberOperations.mul(converter, l1, e1));
assertEquals(bi2, NumberOperations.mul(converter, l1, bi1));
assertEquals(bi2, NumberOperations.mul(converter, bi1, l1));
assertEquals(l2, NumberOperations.mul(converter, i1, l1));
assertEquals(l2, NumberOperations.mul(converter, l1, i1));
assertEquals(l2, NumberOperations.mul(converter, i1, s1));
assertEquals(l2, NumberOperations.mul(converter, s1, i1));
}
/*
* Test method for 'de.odysseus.el.lang.NumberOperations.div(Object, Object)'
*/
public void testDiv() {
assertEquals(new Long(0), NumberOperations.div(converter, null, null));
BigDecimal bd1 = new BigDecimal(1);
Integer i1 = new Integer(1);
Long l1 = new Long(1);
Float f1 = new Float(1);
Double d1 = new Double(1);
String e1 = "1e0";
String s1 = "1";
BigInteger bi1 = new BigInteger("1");
BigDecimal bd2 = new BigDecimal(1);
Double d2 = new Double(1);
assertEquals(bd2, NumberOperations.div(converter, l1, bd1));
assertEquals(bd2, NumberOperations.div(converter, bd1, l1));
assertEquals(bd2, NumberOperations.div(converter, f1, bi1));
assertEquals(bd2, NumberOperations.div(converter, bi1, f1));
assertEquals(d2, NumberOperations.div(converter, f1, l1));
assertEquals(d2, NumberOperations.div(converter, l1, f1));
assertEquals(d2, NumberOperations.div(converter, d1, l1));
assertEquals(d2, NumberOperations.div(converter, l1, d1));
assertEquals(d2, NumberOperations.div(converter, e1, l1));
assertEquals(d2, NumberOperations.div(converter, l1, e1));
assertEquals(d2, NumberOperations.div(converter, i1, l1));
assertEquals(d2, NumberOperations.div(converter, l1, i1));
assertEquals(d2, NumberOperations.div(converter, i1, s1));
assertEquals(d2, NumberOperations.div(converter, s1, i1));
}
/*
* Test method for 'de.odysseus.el.lang.NumberOperations.mod(Object, Object)'
*/
public void testMod() {
assertEquals(new Long(0), NumberOperations.mod(converter, null, null));
BigDecimal bd1 = new BigDecimal(1);
Integer i1 = new Integer(1);
Long l1 = new Long(1);
Float f1 = new Float(1);
Double d1 = new Double(1);
String e1 = "1e0";
String s1 = "1";
BigInteger bi1 = new BigInteger("1");
Long l2 = new Long(0);
Double d2 = new Double(0);
BigInteger bi2 = new BigInteger("0");
assertEquals(d2, NumberOperations.mod(converter, l1, bd1));
assertEquals(d2, NumberOperations.mod(converter, bd1, l1));
assertEquals(d2, NumberOperations.mod(converter, f1, bi1));
assertEquals(d2, NumberOperations.mod(converter, bi1, f1));
assertEquals(d2, NumberOperations.mod(converter, f1, l1));
assertEquals(d2, NumberOperations.mod(converter, l1, f1));
assertEquals(d2, NumberOperations.mod(converter, d1, l1));
assertEquals(d2, NumberOperations.mod(converter, l1, d1));
assertEquals(d2, NumberOperations.mod(converter, d1, bi1));
assertEquals(d2, NumberOperations.mod(converter, bi1, d1));
assertEquals(d2, NumberOperations.mod(converter, e1, bi1));
assertEquals(d2, NumberOperations.mod(converter, bi1, e1));
assertEquals(d2, NumberOperations.mod(converter, e1, l1));
assertEquals(d2, NumberOperations.mod(converter, l1, e1));
assertEquals(bi2, NumberOperations.mod(converter, l1, bi1));
assertEquals(bi2, NumberOperations.mod(converter, bi1, l1));
assertEquals(l2, NumberOperations.mod(converter, i1, l1));
assertEquals(l2, NumberOperations.mod(converter, l1, i1));
assertEquals(l2, NumberOperations.mod(converter, i1, s1));
assertEquals(l2, NumberOperations.mod(converter, s1, i1));
}
/*
* Test method for 'de.odysseus.el.lang.NumberOperations.neg(Object)'
*/
public void testNeg() {
assertEquals(new Long(0), NumberOperations.neg(converter, null));
BigDecimal bd1 = new BigDecimal(1);
Integer i1 = new Integer(1);
Long l1 = new Long(1);
Float f1 = new Float(1);
Double d1 = new Double(1);
String e1 = "1e0";
String s1 = "1";
BigInteger bi1 = new BigInteger("1");
BigDecimal bd2 = new BigDecimal(-1);
Integer i2 = new Integer(-1);
Long l2 = new Long(-1);
Float f2 = new Float(-1);
Double d2 = new Double(-1);
BigInteger bi2 = new BigInteger("-1");
assertEquals(bd2, NumberOperations.neg(converter, bd1));
assertEquals(bi2, NumberOperations.neg(converter, bi1));
assertEquals(d2, NumberOperations.neg(converter, e1));
assertEquals(l2, NumberOperations.neg(converter, s1));
assertEquals(i2, NumberOperations.neg(converter, i1));
assertEquals(l2, NumberOperations.neg(converter, l1));
assertEquals(d2, NumberOperations.neg(converter, d1));
assertEquals(f2, NumberOperations.neg(converter, f1));
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel.misc;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.beans.PropertyChangeListener;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import org.activiti.el.juel.misc.TypeConverterImpl;
import org.activiti.javax.el.ELException;
import junit.framework.TestCase;
/**
* JUnit test case for {@link org.activiti.el.juel.misc.TypeConverterImpl}.
*
* @author Christoph Beck
*/
public class TypeConverterImplTest extends TestCase {
/**
* Test property editor for date objects.
* Accepts integer strings as text input and uses them as time value in milliseconds.
*/
public static class DateEditor implements PropertyEditor {
private Date value;
public void addPropertyChangeListener(PropertyChangeListener listener) {}
public String getAsText() { return value == null ? null : "" + value.getTime(); }
public Component getCustomEditor() { return null; }
public String getJavaInitializationString() { return null; }
public String[] getTags() { return null; }
public Object getValue() { return value; }
public boolean isPaintable() { return false; }
public void paintValue(Graphics gfx, Rectangle box) {}
public void removePropertyChangeListener(PropertyChangeListener listener) {}
public void setAsText(String text) throws IllegalArgumentException { value = new Date(Long.parseLong(text)); }
public void setValue(Object value) { this.value = (Date)value; }
public boolean supportsCustomEditor() { return false; }
}
static {
PropertyEditorManager.registerEditor(Date.class, DateEditor.class);
}
/**
* Test enum type
*/
static enum Foo { BAR };
TypeConverterImpl converter = new TypeConverterImpl();
public void testToBoolean() {
assertFalse(converter.coerceToBoolean(null));
assertFalse(converter.coerceToBoolean(""));
assertTrue(converter.coerceToBoolean(Boolean.TRUE));
assertFalse(converter.coerceToBoolean(Boolean.FALSE));
assertTrue(converter.coerceToBoolean("true"));
assertFalse(converter.coerceToBoolean("false"));
assertFalse(converter.coerceToBoolean("yes")); // Boolean.valueOf(String) never throws an exception...
}
public void testToCharacter() {
assertEquals(Character.valueOf((char)0), converter.coerceToCharacter(null));
assertEquals(Character.valueOf((char)0), converter.coerceToCharacter(""));
Character c = Character.valueOf((char)99);
assertSame(c, converter.coerceToCharacter(c));
try {
converter.coerceToCharacter(Boolean.TRUE);
fail();
} catch (ELException e) {}
try {
converter.coerceToCharacter(Boolean.FALSE);
fail();
} catch (ELException e) {}
assertEquals(c, converter.coerceToCharacter(new Byte((byte)99)));
assertEquals(c, converter.coerceToCharacter(new Short((short)99)));
assertEquals(c, converter.coerceToCharacter(new Integer(99)));
assertEquals(c, converter.coerceToCharacter(new Long(99)));
assertEquals(c, converter.coerceToCharacter(new Float((float)99.5)));
assertEquals(c, converter.coerceToCharacter(new Double(99.5)));
assertEquals(c, converter.coerceToCharacter(new BigDecimal("99.5")));
assertEquals(c, converter.coerceToCharacter(new BigInteger("99")));
assertEquals(c, converter.coerceToCharacter("c#"));
try {
converter.coerceToCharacter(this);
fail();
} catch (ELException e) {}
}
public <T extends Number> void testToLong() {
Number zero = Long.valueOf(0l);
Number ninetynine = Long.valueOf(99l);
assertEquals(zero, converter.coerceToLong(null));
assertEquals(zero, converter.coerceToLong(""));
assertEquals(ninetynine, converter.coerceToLong(Character.valueOf('c')));
assertEquals(ninetynine, converter.coerceToLong(new Byte((byte)99)));
assertEquals(ninetynine, converter.coerceToLong(new Short((short)99)));
assertEquals(ninetynine, converter.coerceToLong(new Integer(99)));
assertEquals(ninetynine, converter.coerceToLong(new Long(99)));
assertEquals(ninetynine, converter.coerceToLong(new Float(99)));
assertEquals(ninetynine, converter.coerceToLong(new Double(99)));
assertEquals(ninetynine, converter.coerceToLong(new BigDecimal(99)));
assertEquals(ninetynine, converter.coerceToLong(new BigInteger("99")));
assertEquals(ninetynine, converter.coerceToLong(ninetynine.toString()));
try {
converter.coerceToLong("foo");
fail();
} catch (ELException e) {
}
}
public <T extends Number> void testToInteger() {
Number zero = Integer.valueOf(0);
Number ninetynine = Integer.valueOf(99);
assertEquals(zero, converter.coerceToInteger(null));
assertEquals(zero, converter.coerceToInteger(""));
assertEquals(ninetynine, converter.coerceToInteger(Character.valueOf('c')));
assertEquals(ninetynine, converter.coerceToInteger(new Byte((byte)99)));
assertEquals(ninetynine, converter.coerceToInteger(new Short((short)99)));
assertEquals(ninetynine, converter.coerceToInteger(new Integer(99)));
assertEquals(ninetynine, converter.coerceToInteger(new Long(99)));
assertEquals(ninetynine, converter.coerceToInteger(new Float(99)));
assertEquals(ninetynine, converter.coerceToInteger(new Double(99)));
assertEquals(ninetynine, converter.coerceToInteger(new BigDecimal(99)));
assertEquals(ninetynine, converter.coerceToInteger(new BigInteger("99")));
assertEquals(ninetynine, converter.coerceToInteger(ninetynine.toString()));
try {
converter.coerceToInteger("foo");
fail();
} catch (ELException e) {
}
}
public <T extends Number> void testToShort() {
Number zero = Short.valueOf((short)0);
Number ninetynine = Short.valueOf((short)99);
assertEquals(zero, converter.coerceToShort(null));
assertEquals(zero, converter.coerceToShort(""));
assertEquals(ninetynine, converter.coerceToShort(Character.valueOf('c')));
assertEquals(ninetynine, converter.coerceToShort(new Byte((byte)99)));
assertEquals(ninetynine, converter.coerceToShort(new Short((short)99)));
assertEquals(ninetynine, converter.coerceToShort(new Integer(99)));
assertEquals(ninetynine, converter.coerceToShort(new Long(99)));
assertEquals(ninetynine, converter.coerceToShort(new Float(99)));
assertEquals(ninetynine, converter.coerceToShort(new Double(99)));
assertEquals(ninetynine, converter.coerceToShort(new BigDecimal(99)));
assertEquals(ninetynine, converter.coerceToShort(new BigInteger("99")));
assertEquals(ninetynine, converter.coerceToShort(ninetynine.toString()));
try {
converter.coerceToShort("foo");
fail();
} catch (ELException e) {
}
}
public <T extends Number> void testToByte() {
Number zero = Byte.valueOf((byte)0);
Number ninetynine = Byte.valueOf((byte)99);
assertEquals(zero, converter.coerceToByte(null));
assertEquals(zero, converter.coerceToByte(""));
assertEquals(ninetynine, converter.coerceToByte(Character.valueOf('c')));
assertEquals(ninetynine, converter.coerceToByte(new Byte((byte)99)));
assertEquals(ninetynine, converter.coerceToByte(new Short((short)99)));
assertEquals(ninetynine, converter.coerceToByte(new Integer(99)));
assertEquals(ninetynine, converter.coerceToByte(new Long(99)));
assertEquals(ninetynine, converter.coerceToByte(new Float(99)));
assertEquals(ninetynine, converter.coerceToByte(new Double(99)));
assertEquals(ninetynine, converter.coerceToByte(new BigDecimal(99)));
assertEquals(ninetynine, converter.coerceToByte(new BigInteger("99")));
assertEquals(ninetynine, converter.coerceToByte(ninetynine.toString()));
try {
converter.coerceToByte("foo");
fail();
} catch (ELException e) {
}
}
public <T extends Number> void testToDouble() {
Number zero = Double.valueOf(0);
Number ninetynine = Double.valueOf(99);
assertEquals(zero, converter.coerceToDouble(null));
assertEquals(zero, converter.coerceToDouble(""));
assertEquals(ninetynine, converter.coerceToDouble(Character.valueOf('c')));
assertEquals(ninetynine, converter.coerceToDouble(new Byte((byte)99)));
assertEquals(ninetynine, converter.coerceToDouble(new Short((short)99)));
assertEquals(ninetynine, converter.coerceToDouble(new Integer(99)));
assertEquals(ninetynine, converter.coerceToDouble(new Long(99)));
assertEquals(ninetynine, converter.coerceToDouble(new Float(99)));
assertEquals(ninetynine, converter.coerceToDouble(new Double(99)));
assertEquals(ninetynine, converter.coerceToDouble(new BigDecimal(99)));
assertEquals(ninetynine, converter.coerceToDouble(new BigInteger("99")));
assertEquals(ninetynine, converter.coerceToDouble(ninetynine.toString()));
try {
converter.coerceToDouble("foo");
fail();
} catch (ELException e) {
}
}
public <T extends Number> void testToFloat() {
Number zero = Float.valueOf(0);
Number ninetynine = Float.valueOf(99);
assertEquals(zero, converter.coerceToFloat(null));
assertEquals(zero, converter.coerceToFloat(""));
assertEquals(ninetynine, converter.coerceToFloat(Character.valueOf('c')));
assertEquals(ninetynine, converter.coerceToFloat(new Byte((byte)99)));
assertEquals(ninetynine, converter.coerceToFloat(new Short((short)99)));
assertEquals(ninetynine, converter.coerceToFloat(new Integer(99)));
assertEquals(ninetynine, converter.coerceToFloat(new Long(99)));
assertEquals(ninetynine, converter.coerceToFloat(new Float(99)));
assertEquals(ninetynine, converter.coerceToFloat(new Double(99)));
assertEquals(ninetynine, converter.coerceToFloat(new BigDecimal(99)));
assertEquals(ninetynine, converter.coerceToFloat(new BigInteger("99")));
assertEquals(ninetynine, converter.coerceToFloat(ninetynine.toString()));
try {
converter.coerceToFloat("foo");
fail();
} catch (ELException e) {
}
}
public <T extends Number> void testToBigDecimal() {
Number zero = BigDecimal.valueOf(0);
Number ninetynine = BigDecimal.valueOf(99);
assertEquals(zero, converter.coerceToBigDecimal(null));
assertEquals(zero, converter.coerceToBigDecimal(""));
assertEquals(ninetynine, converter.coerceToBigDecimal(Character.valueOf('c')));
assertEquals(ninetynine, converter.coerceToBigDecimal(new Byte((byte)99)));
assertEquals(ninetynine, converter.coerceToBigDecimal(new Short((short)99)));
assertEquals(ninetynine, converter.coerceToBigDecimal(new Integer(99)));
assertEquals(ninetynine, converter.coerceToBigDecimal(new Long(99)));
assertEquals(ninetynine, converter.coerceToBigDecimal(new Float(99)));
assertEquals(ninetynine, converter.coerceToBigDecimal(new Double(99)));
assertEquals(ninetynine, converter.coerceToBigDecimal(new BigDecimal(99)));
assertEquals(ninetynine, converter.coerceToBigDecimal(new BigInteger("99")));
assertEquals(ninetynine, converter.coerceToBigDecimal(ninetynine.toString()));
try {
converter.coerceToBigDecimal("foo");
fail();
} catch (ELException e) {
}
}
public <T extends Number> void testToBigInteger() {
Number zero = BigInteger.valueOf(0);
Number ninetynine = BigInteger.valueOf(99);
assertEquals(zero, converter.coerceToBigInteger(null));
assertEquals(zero, converter.coerceToBigInteger(""));
assertEquals(ninetynine, converter.coerceToBigInteger(Character.valueOf('c')));
assertEquals(ninetynine, converter.coerceToBigInteger(new Byte((byte)99)));
assertEquals(ninetynine, converter.coerceToBigInteger(new Short((short)99)));
assertEquals(ninetynine, converter.coerceToBigInteger(new Integer(99)));
assertEquals(ninetynine, converter.coerceToBigInteger(new Long(99)));
assertEquals(ninetynine, converter.coerceToBigInteger(new Float(99)));
assertEquals(ninetynine, converter.coerceToBigInteger(new Double(99)));
assertEquals(ninetynine, converter.coerceToBigInteger(new BigDecimal(99)));
assertEquals(ninetynine, converter.coerceToBigInteger(new BigInteger("99")));
assertEquals(ninetynine, converter.coerceToBigInteger(ninetynine.toString()));
try {
converter.coerceToBigInteger("foo");
fail();
} catch (ELException e) {
}
}
public void testToString() {
assertSame("foo", converter.coerceToString("foo"));
assertEquals("", converter.coerceToString(null));
assertEquals(Foo.BAR.name(), converter.coerceToString(Foo.BAR));
Object value = new BigDecimal("99.345");
assertEquals(value.toString(), converter.coerceToString(value));
}
public void testToEnum() {
assertNull(converter.coerceToEnum(null, Foo.class));
assertSame(Foo.BAR, converter.coerceToEnum(Foo.BAR, Foo.class));
assertNull(converter.coerceToEnum("", Foo.class));
assertSame(Foo.BAR, converter.coerceToEnum("BAR", Foo.class));
}
public void testToType() {
assertEquals("foo", converter.coerceToType("foo", String.class));
assertEquals(new Long(0), converter.coerceToType("0", Long.class));
assertEquals(new Character('c'), converter.coerceToType("c", Character.class));
assertEquals(Boolean.TRUE, converter.coerceToType("true", Boolean.class));
assertEquals(Foo.BAR, converter.coerceToType("BAR", Foo.class));
// other types
assertNull(converter.coerceToType(null, Object.class));
Object value = new Date(0);
assertSame(value, converter.coerceToType(value, Object.class));
assertEquals(new Date(0), converter.coerceToType("0", Date.class));
assertNull(converter.coerceToType("", Date.class));
try {
converter.coerceToType("foo", Date.class);
fail();
} catch (Exception e) {}
assertNull(converter.coerceToType("", getClass()));
try {
converter.coerceToType("bar", getClass());
fail();
} catch (Exception e) {}
assertEquals(false, converter.coerceToType("false", boolean.class));
assertEquals((byte)0, converter.coerceToType("0", byte.class));
assertEquals((short)0, converter.coerceToType("0", short.class));
assertEquals(0, converter.coerceToType("0", int.class));
assertEquals((long)0, converter.coerceToType("0", long.class));
assertEquals((float)0, converter.coerceToType("0", float.class));
assertEquals((double)0, converter.coerceToType("0", double.class));
assertEquals('0', converter.coerceToType("0", char.class));
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel.tree;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for de.odysseus.el.tree");
//$JUnit-BEGIN$
suite.addTestSuite(BindingsTest.class);
suite.addTestSuite(NodePrinterTest.class);
suite.addTestSuite(TreeStoreTest.class);
suite.addTestSuite(TreeTest.class);
//$JUnit-END$
return suite;
}
}
/*
* Based on JUEL 2.2.1 code, 2006-2009 Odysseus Software GmbH
*
* Licensed 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.
*/
package org.activiti.el.juel.tree;
import java.lang.reflect.Method;
import org.activiti.el.juel.ObjectValueExpression;
import org.activiti.el.juel.TestCase;
import org.activiti.el.juel.misc.TypeConverter;
import org.activiti.el.juel.tree.Bindings;
import org.activiti.el.juel.tree.Tree;
import org.activiti.el.juel.util.SimpleContext;
import org.activiti.javax.el.ValueExpression;
public class BindingsTest extends TestCase {
public static int foo() {
return 0;
}
public static int bar(int i) {
return i;
}
private SimpleContext context;
@Override
protected void setUp() throws Exception {
context = new SimpleContext();
// function ns:f()
context.setFunction("ns", "f", BindingsTest.class.getMethod("foo"));
// function g()
context.setFunction("", "g", BindingsTest.class.getMethod("bar", new Class[]{int.class}));
// variable v
context.setVariable("v", new ObjectValueExpression(TypeConverter.DEFAULT, new Long(0), long.class));
}
public void testSerialize() throws Exception {
Bindings bindings = null;
bindings = new Bindings(null, null);
assertEquals(bindings, deserialize(serialize(bindings)));
bindings = parse("${ns:f()+v+g(1)+x}").bind(context.getFunctionMapper(), context.getVariableMapper());
assertEquals(bindings, deserialize(serialize(bindings)));
}
public void testEqualsAndHashcode() throws Exception {
Bindings bindings1 = null;
Bindings bindings2 = null;
bindings1 = new Bindings(null, null);
bindings2 = new Bindings(null, null);
assertEquals(bindings1, bindings2);
assertEquals(bindings1.hashCode(), bindings2.hashCode());
bindings1 = new Bindings(new Method[0], new ValueExpression[0]);
bindings2 = new Bindings(null, null);
assertEquals(bindings1, bindings2);
assertEquals(bindings1.hashCode(), bindings2.hashCode());
Tree tree = parse("${ns:f()+v+g(1)}+x");
bindings1 = tree.bind(context.getFunctionMapper(), context.getVariableMapper());
bindings2 = tree.bind(context.getFunctionMapper(), context.getVariableMapper());
assertEquals(bindings1, bindings2);
assertEquals(bindings1.hashCode(), bindings2.hashCode());
}
}
package org.activiti.el.juel.tree;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import org.activiti.el.juel.tree.NodePrinter;
import org.activiti.el.juel.tree.Tree;
import org.activiti.el.juel.tree.impl.Builder;
import org.activiti.el.juel.tree.impl.Builder.Feature;
import junit.framework.TestCase;
public class NodePrinterTest extends TestCase {
public void testDump() throws IOException {
Tree tree = new Builder(Feature.METHOD_INVOCATIONS).build("${foo.bar[baz] + foobar}");
StringWriter writer = new StringWriter();
NodePrinter.dump(new PrintWriter(writer), tree.getRoot());
String[] expected = {
"+- ${...}",
" |",
" +- '+'",
" |",
" +- [...]",
" | |",
" | +- . bar",
" | | |",
" | | +- foo",
" | |",
" | +- baz",
" |",
" +- foobar",
null
};
BufferedReader reader = new BufferedReader(new StringReader(writer.toString()));
for (String line : expected) {
assertEquals(line, reader.readLine());
}
}
}
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册