You are viewing a plain text version of this content. The canonical link for it is here.
Posted to imperius-commits@incubator.apache.org by ke...@apache.org on 2008/01/11 18:57:14 UTC

svn commit: r611261 [41/43] - in /incubator/imperius/trunk: ./ imperius-javaspl/ imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/ imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/ imperius-splcore/src...

Propchange: incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/NumericExpressionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/StringExpressionTest.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/StringExpressionTest.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/StringExpressionTest.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/StringExpressionTest.java Fri Jan 11 10:56:30 2008
@@ -1,1113 +1,1113 @@
-/*
- * 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.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-
-
-package org.apache.imperius.spl.tests;
-
-import java.util.Vector;
-
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.impl.BooleanConstant;
-import org.apache.imperius.spl.parser.expressions.impl.Concatenate;
-import org.apache.imperius.spl.parser.expressions.impl.Contains;
-import org.apache.imperius.spl.parser.expressions.impl.EndsWith;
-import org.apache.imperius.spl.parser.expressions.impl.IntegerConstant;
-import org.apache.imperius.spl.parser.expressions.impl.LeftSubstring;
-import org.apache.imperius.spl.parser.expressions.impl.MiddleSubstring;
-import org.apache.imperius.spl.parser.expressions.impl.ReplaceSubstring;
-import org.apache.imperius.spl.parser.expressions.impl.RightSubstring;
-import org.apache.imperius.spl.parser.expressions.impl.StartsWith;
-import org.apache.imperius.spl.parser.expressions.impl.StringConstant;
-import org.apache.imperius.spl.parser.expressions.impl.StringLength;
-import org.apache.imperius.spl.parser.expressions.impl.ToLower;
-import org.apache.imperius.spl.parser.expressions.impl.ToString;
-import org.apache.imperius.spl.parser.expressions.impl.ToUpper;
-import org.apache.imperius.spl.parser.expressions.impl.Word;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-
-
-
-
-
-public class StringExpressionTest extends TestCase {
-
-	static final String CMVC_ID_StringExpressionTest = "$Header: /cvsroot/cimsplpegasus/trunk/modules/imperius-splcore/src/com/ibm/ac/spl/tests/StringExpressionTest.java,v 1.2 2007/12/20 13:07:37 prabalig Exp $";
-	static final String VERSION_StringExpressionTest = "File version $Revision: 1.2 $, last changed $Date: 2007/12/20 13:07:37 $";
-//	private static Logger logger = SPLLogger.getCIMSPLLogger().getLogger();
-	
-	
-	static Expression propertySensor1 =null;
-	//new ConstantExpression("propertySensor1");
-	static Expression propertySensor2 =null;
-	//new PropertySensor("propertySensor2");
-	static  Expression propertySensor3 =null;
-	//new PropertySensor("propertySensor3");
-	static  Expression propertySensor4 =null;
-	//new PropertySensor("propertySensor4");
-	static  Expression propertySensor5 =null;
-	//new PropertySensor("propertySensor5");
-	static  Expression propertySensor6 =null;
-	//new PropertySensor("propertySensor6");
-	static  Expression propertySensor7 =null;
-	//new PropertySensor("propertySensor7");
-	static  Expression propertySensor8 =null;
-	//new PropertySensor("propertySensor8");
-	static  Expression propertySensor9 =null;
-	//new PropertySensor("propertySensor9");
-	static  Expression propertySensor10 =null;
-	//new PropertySensor("propertySensor10");
-
-	public StringExpressionTest(String arg0) {
-		super(arg0);
-	}
-
-	public static Test suite() {
-		TestSuite suite = new TestSuite(StringExpressionTest.class);
-		TestSetup wrapper = new TestSetup(suite) {
-
-			protected void setUp() throws Exception {
-				oneTimeSetUp();
-			}
-
-			protected void tearDown() throws Exception {
-				oneTimeTearDown();
-			}
-		};
-		return wrapper;
-	}
-
-	public static void main(String[] args) {
-		junit.textui.TestRunner.run(suite());
-	}
-
-	protected static void oneTimeSetUp() throws Exception {
-	}
-
-	protected static void oneTimeTearDown() throws Exception {
-
-	}
-
-	/*
-	 * This will test MiddleSubstring Expression
-	 */
-	public void testMiddleSubstring() {
-		String string = "\"AutonomicComputing\"";
-		StringConstant lr = new StringConstant("\"LeftToRight\"");
-		StringConstant rl = new StringConstant("\"RightToLeft\"");
-		IntegerConstant ic4 = new IntegerConstant(4);
-		IntegerConstant ic5 = new IntegerConstant(5);
-		//HashMap map = new HashMap();
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			Expression exp;
-			v.add(new StringConstant(string));
-			v.add(ic4);
-			v.add(ic5);
-			v.add(lr);
-			Expression esnnl = new MiddleSubstring(v,true);
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(ic4);
-			v.add(ic5);
-			v.add(rl);
-			Expression esnnr = new MiddleSubstring(v,true);
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(ic5);
-			v.add(lr);
-			Expression essnl = new MiddleSubstring(v,true);
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(ic5);
-			v.add(rl);
-			Expression essnr = new MiddleSubstring(v,true);
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(ic4);
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			Expression esnsl = new MiddleSubstring(v,true);
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(ic4);
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			Expression esnsr = new MiddleSubstring(v,true);
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"on\""));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			Expression esssl = new MiddleSubstring(v,true);
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"on\""));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			Expression esssr = new MiddleSubstring(v,true);
-
-			assertTrue(((String) esnnl.evaluate()).equals("nomic"));
-			assertTrue(((String) esnnr.evaluate()).equals("ing"));
-			assertTrue(((String) essnl.evaluate()).equals("icCom"));
-			assertTrue(((String) essnr.evaluate()).equals("putin"));
-			assertTrue(((String) esnsl.evaluate()).equals("n"));
-			assertTrue(((String) esnsr.evaluate()).equals("pu"));
-			assertTrue(((String) esssl.evaluate()).equals(""));
-			assertTrue(((String) esssr.evaluate()).equals("Aut"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(4));
-			v.add(new IntegerConstant(5));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("nomic"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(4));
-			v.add(new IntegerConstant(5));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("ing"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(4));
-			v.add(new IntegerConstant(-1));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("o"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(8));
-			v.add(new IntegerConstant(-1));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("o"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(-1));
-			v.add(new IntegerConstant(5));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("g"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(-1));
-			v.add(new IntegerConstant(5));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("tonom"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(-1));
-			v.add(new IntegerConstant(-1));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("n"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(-1));
-			v.add(new IntegerConstant(-1));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("u"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(19));
-			v.add(new IntegerConstant(5));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(19));
-			v.add(new IntegerConstant(5));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("Auton"));
-			//////////////////////////////////////////////////////
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new IntegerConstant(5));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("icCom"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new IntegerConstant(5));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("putin"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new IntegerConstant(18));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("icComputing"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new IntegerConstant(18));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("puting"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new IntegerConstant(-1));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("n"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new IntegerConstant(-1));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("C"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new IntegerConstant(5));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new IntegerConstant(5));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new IntegerConstant(-1));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new IntegerConstant(-1));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new IntegerConstant(20));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new IntegerConstant(20));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-			///////////////////////////////////////////////
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(4));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("n"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(4));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("pu"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(7));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("icC"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(7));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(-1));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("g"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(-1));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(-1));
-			v.add(new StringConstant("\"bz\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("g"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(-1));
-			v.add(new StringConstant("\"bz\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(4));
-			v.add(new StringConstant("\"bz\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(
-					((String) exp.evaluate()).equals("nomicComputing"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(4));
-			v.add(new StringConstant("\"bz\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(20));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(20));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(20));
-			v.add(new StringConstant("\"bz\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new IntegerConstant(20));
-			v.add(new StringConstant("\"bz\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-			/////////////////////////////////////
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("icC"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("icC"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new StringConstant("\"bz\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("icComputing"));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new StringConstant("\"bz\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals("AutonomicC"));
-
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new StringConstant("\"bz\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"bz\""));
-			v.add(new StringConstant("\"bz\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new StringConstant("\"icC\""));
-			v.add(lr);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(new StringConstant("\"icC\""));
-			v.add(rl);
-			exp = new MiddleSubstring(v,true);
-			assertTrue(((String) exp.evaluate()).equals(""));
-
-
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test RightSubstring Expression
-	 */
-	public void testRightSubstring() {
-		String string = "\"AutonomicComputing\"";
-		StringConstant lr = new StringConstant("\"LeftToRight\"");
-		StringConstant rl = new StringConstant("\"RightToLeft\"");
-		IntegerConstant icmin1 = new IntegerConstant(-1);
-
-		IntegerConstant ic4 = new IntegerConstant(4);
-//		IntegerConstant ic5 = new IntegerConstant(5);
-		//HashMap map = new HashMap();
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(string));
-			v.add(ic4);
-			v.add(lr);
-			Expression esnl = new RightSubstring(v,true);
-			// Examples: RightSubstring("AutonomicComputing", 4, LeftToRight) = "ting".
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(icmin1);
-			v.add(lr);
-			Expression esnlmin1 = new RightSubstring(v,true);
-			// Examples: RightSubstring("AutonomicComputing", -1, LeftToRight) = "AutonomicComputing".
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(ic4);
-			v.add(rl);
-			Expression esnr = new RightSubstring(v,true);
-			// RightSubstring("AutonomicComputing", 4, RightToLeft) = "nomicComputing".<p>
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(icmin1);
-			v.add(rl);
-			Expression esnrmin1 = new RightSubstring(v,true);
-			// Examples: RightSubstring("AutonomicComputing", -1, RightToLeft) = "".
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			Expression essl = new RightSubstring(v,true);
-			// Examples: RightSubstring("AutonomicComputing", "om", LeftToRight)="icComputing" 
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"jj\""));
-			v.add(lr);
-			Expression esslne = new RightSubstring(v,true);
-			// Examples: RightSubstring("AutonomicComputing", "jj", LeftToRight)="" 
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			Expression essr = new RightSubstring(v,true);
-			// RightSubstring("AutonomicComputing", "om", RightToLeft)="puting".
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"jj\""));
-			v.add(rl);
-			Expression essrne = new RightSubstring(v,true);
-			// RightSubstring("AutonomicComputing", "jj", RightToLeft)="".
-
-			assertTrue(((String) esnl.evaluate()).equals("ting"));
-			assertTrue(
-					((String) esnlmin1.evaluate()).equals(
-					"AutonomicComputing"));
-			assertTrue(
-					((String) esnr.evaluate()).equals("nomicComputing"));
-			assertTrue(((String) esnrmin1.evaluate()).equals(""));
-			assertTrue(((String) essl.evaluate()).equals("icComputing"));
-			assertTrue(((String) esslne.evaluate()).equals(""));
-			assertTrue(((String) essr.evaluate()).equals("puting"));
-			assertTrue(((String) essrne.evaluate()).equals(""));
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test LeftSubstring Expression
-	 */
-	public void testLeftSubstring() {
-		String string = "\"AutonomicComputing\"";
-		StringConstant lr = new StringConstant("\"LeftToRight\"");
-		StringConstant rl = new StringConstant("\"RightToLeft\"");
-		IntegerConstant ic4 = new IntegerConstant(4);
-//		IntegerConstant ic5 = new IntegerConstant(5);
-		//HashMap map = new HashMap();
-		//SensorLookup lookup = new SensorLookupImpl(map);
-		IntegerConstant icmin1 = new IntegerConstant(-1);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(string));
-			v.add(ic4);
-			v.add(lr);
-			Expression esnl = new LeftSubstring(v,true);
-			// Examples: LeftSubstring("AutonomicComputing", 4, LeftToRight) = "Auto".
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(icmin1);
-			v.add(lr);
-			Expression esnlmin1 = new LeftSubstring(v,true);
-			// Examples: LeftSubstring("AutonomicComputing", -1, LeftToRight) = "AutonomicComputing".
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(ic4);
-			v.add(rl);
-			Expression esnr = new LeftSubstring(v,true);
-			// LeftSubstring("AutonomicComputing", 4, RightToLeft) = "AutonomicCompu".
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(icmin1);
-			v.add(rl);
-			Expression esnrmin1 = new LeftSubstring(v,true);
-			// Examples: LeftSubstring("AutonomicComputing", -1, RightToLeft) = "".
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(lr);
-			Expression essl = new LeftSubstring(v,true);
-			// Examples: LeftSubstring("AutonomicComputing", "om", LeftToRight)="Auton" 
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"\""));
-			v.add(lr);
-			Expression esslempty = new LeftSubstring(v,true);
-			// Examples: LeftSubstring("AutonomicComputing", "", LeftToRight)="" 
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"om\""));
-			v.add(rl);
-			Expression essr = new LeftSubstring(v,true);
-			// LeftSubstring("AutonomicComputing", "om", RightToLeft)="AutonomicC"
-
-			v.clear();
-			v.add(new StringConstant(string));
-			v.add(new StringConstant("\"\""));
-			v.add(lr);
-			Expression essrempty = new LeftSubstring(v,true);
-			// Examples: LeftSubstring("AutonomicComputing", "", RightToLeft)="" 
-
-			assertTrue(((String) esnl.evaluate()).equals("Auto"));
-			assertTrue(
-					((String) esnlmin1.evaluate()).equals(
-					"AutonomicComputing"));
-			assertTrue(
-					((String) esnr.evaluate()).equals("AutonomicCompu"));
-			assertTrue(((String) esnrmin1.evaluate()).equals(""));
-			assertTrue(((String) essl.evaluate()).equals("Auton"));
-			assertTrue(((String) esslempty.evaluate()).equals(""));
-			assertTrue(((String) essr.evaluate()).equals("AutonomicC"));
-			assertTrue(((String) essrempty.evaluate()).equals(""));
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test StringLength Expression
-	 */
-	public void testStringLength() {
-		String s1 = "\"AutonomicComputing\"";
-		String s2 = "\"StringLength\"";
-		String s3 = "\"PMAC1.2\"";
-
-		//HashMap map = new HashMap();
-		propertySensor1=new StringConstant(s1);
-		propertySensor2=new StringConstant(s2);
-		propertySensor3=new StringConstant(s3);
-
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(s1));
-			Expression e1 = new StringLength(v,true);
-
-			v.clear();
-			v.add(new StringConstant(s2));
-			Expression e2 = new StringLength(v,true);
-
-			v.clear();
-			v.add(new StringConstant(s3));
-			Expression e3 = new StringLength(v,true);
-
-			v.clear();
-			v.add(propertySensor1);
-			Expression eps1 = new StringLength(v,true);
-
-			v.clear();
-			v.add(propertySensor2);
-			Expression eps2 = new StringLength(v,true);
-
-			v.clear();
-			v.add(propertySensor3);
-			Expression eps3 = new StringLength(v,true);
-			s1 = s1.substring(1, s1.length()-1);
-			s2 = s2.substring(1, s2.length()-1);
-			s3 = s3.substring(1, s3.length()-1);
-
-			assertTrue(
-					new Integer(s1.length()).compareTo(e1.evaluate()) == 0);
-			assertTrue(
-					new Integer(s2.length()).compareTo(e2.evaluate()) == 0);
-			assertTrue(
-					new Integer(s3.length()).compareTo(e3.evaluate()) == 0);
-			assertTrue(
-					new Integer(s1.length()).compareTo(eps1.evaluate()) == 0);
-			assertTrue(
-					new Integer(s2.length()).compareTo(eps2.evaluate()) == 0);
-			assertTrue(
-					new Integer(s3.length()).compareTo(eps3.evaluate()) == 0);
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test ReplaceSubstring Expression
-	 */
-	public void testReplaceSubstring() {
-		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse.\"";
-		String s2 = "\"This\"";
-		String s3 = "\"That\"";
-		String s4 = "\"ThatIsADogThatIsAPenThatIsATelevisionSetThatIsAHouse.\"";
-
-		//HashMap map = new HashMap();
-		propertySensor1=new StringConstant(s1);
-		propertySensor2=new StringConstant(s2);
-		propertySensor3=new StringConstant(s3);
-
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(s1));
-			v.add(new StringConstant(s2));
-			v.add(new StringConstant(s3));
-			Expression e1 = new ReplaceSubstring(v,true);
-
-			v.clear();
-			v.add(propertySensor1);
-			v.add(propertySensor2);
-			v.add(propertySensor3);
-			Expression eps1 = new ReplaceSubstring(v,true);
-			s4 = s4.substring(1, s4.length()-1);
-			assertTrue(s4.compareTo(e1.evaluate()) == 0);
-			assertTrue(s4.compareTo(eps1.evaluate()) == 0);
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test StartsWith Expression
-	 */
-	public void testStartsWith() {
-		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse.\"";
-		String s2 = "\"This\"";
-
-		//HashMap map = new HashMap();
-		propertySensor1=new StringConstant(s1);
-		propertySensor2=new StringConstant(s2);
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(s1));
-			v.add(new StringConstant(s2));
-			Expression e1 = new StartsWith(v,true);
-
-			v.clear();
-			v.add(propertySensor1);
-			v.add(propertySensor2);
-			Expression eps1 = new StartsWith(v,true);
-
-			assertTrue(((Boolean) (e1.evaluate())).booleanValue());
-			assertTrue(((Boolean) (eps1.evaluate())).booleanValue());
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test Ends Expression
-	 */
-	public void testEndsWith() {
-		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse.\"";
-		String s2 = "\"ThisIsAHouse.\"";
-
-		//HashMap map = new HashMap();
-		propertySensor1=new StringConstant(s1);
-		propertySensor2=new StringConstant(s2);
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(s1));
-			v.add(new StringConstant(s2));
-			Expression e1 = new EndsWith(v,true);
-
-			v.clear();
-			v.add(propertySensor1);
-			v.add(propertySensor2);
-			Expression eps1 = new EndsWith(v,true);
-
-			assertTrue(((Boolean) (e1.evaluate())).booleanValue());
-			assertTrue(((Boolean) (eps1.evaluate())).booleanValue());
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test Concatenate Expression
-	 */
-	public void testConcatenate() {
-		String s1 = "\"ThisIsADog\"";
-		String s2 = "\"ThisIsAPen\"";
-		//String s3 = "ThisIsATelevisionSet";
-		//String s4 = "ThisIsAHouse.";
-
-		//HashMap map = new HashMap();
-		propertySensor1=new StringConstant(s1);
-		propertySensor2=new StringConstant(s2);
-		
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(s1));
-			v.add(new StringConstant(s2));
-			
-			Expression e1 = new Concatenate(v,true);
-
-			v.clear();
-			v.add(propertySensor1);
-			v.add(propertySensor2);
-			
-			Expression eps1 = new Concatenate(v,true);
-			s1 = s1.substring(1, s1.length()-1);
-			s2 = s2.substring(1, s2.length()-1);
-			assertTrue(e1.evaluate().equals(s1 + s2));
-			assertTrue(eps1.evaluate().equals(s1 + s2));
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test Word Expression
-	 */
-	public void testWord() {
-		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse\"";
-		String s2 = "\"This\"";
-		int n = 3;
-
-		//HashMap map = new HashMap();
-		propertySensor1=new StringConstant(s1);
-		propertySensor2=new StringConstant(s2);
-		propertySensor3=new IntegerConstant(1);
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(s1));
-			v.add(new StringConstant(s2));
-			v.add(new IntegerConstant(n));
-			Expression e1 = new Word(v,true);
-
-			v.clear();
-			v.add(propertySensor1);
-			v.add(propertySensor2);
-			v.add(propertySensor3);
-			Expression eps1 = new Word(v,true);
-
-			assertTrue(
-					(e1.evaluate()).equals(
-					"ThisIsADogThisIsAPenThisIsATelevisionSet"));
-			assertTrue((eps1.evaluate()).equals("ThisIsADog"));
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-
-	/*
-	 * This will test Contains Expression
-	 */
-	public void testContains() {
-		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse\"";
-		String s2 = "\"ThisIsAPen\"";
-
-		//HashMap map = new HashMap();
-		propertySensor1=new StringConstant(s1);
-		propertySensor2=new StringConstant(s2);
-		//SensorLookup lookup = new SensorLookupImpl(map);
-
-		try {
-			Vector v = new Vector();
-			v.add(new StringConstant(s1));
-			v.add(new StringConstant(s2));
-			Expression e1 = new Contains(v,true);
-
-			v.clear();
-			v.add(propertySensor1);
-			v.add(propertySensor2);
-			Expression eps1 = new Contains(v,true);
-
-			assertTrue(((Boolean) (e1.evaluate())).booleanValue());
-			assertTrue(((Boolean) (eps1.evaluate())).booleanValue());
-		} catch (SPLException e) {
-			fail("Received evaluation exception " + e.getMessage());
-		} catch (Exception e) {
-			fail("Received expression exception " + e.getMessage());
-		}
-	}
-	
-	   public void testToLower() {
-	    	String s1 = "\"HELLO\"";
-	        String s2 = "\"HellO\"";
-	        String s3 = "hello";
-
-	        //HashMap map = new HashMap();
-	        propertySensor1=new StringConstant(s1.toString());
-	        propertySensor2=new StringConstant(s2.toString());
-	        
-	        try {
-	            Vector v = new Vector();
-	            v.add(propertySensor1);
-	            Expression es1 = new ToLower(v,true);
-
-	            v.clear();
-	            v.add(propertySensor2);
-	            Expression es2 = new ToLower(v,true);
-
-	            
-	            
-	            String x=(String)es1.evaluate();
-	            assertTrue(x.equals(s3));
-	            x=(String)es2.evaluate();
-	            assertTrue(x.equals(s3));
-	                    
-	            
-	        } catch (SPLException e) {
-	            fail("Received evaluation exception " + e.getMessage());
-	        } catch (Exception e) {
-	            fail("Received expression exception " + e.getMessage());
-	        }
-	    }
-	   
-	   public void testToUpper() {
-	    	String s1 = "\"hello\"";
-	        String s2 = "\"HellO\"";
-	        String s3 = "HELLO";
-
-	        //HashMap map = new HashMap();
-	        propertySensor1=new StringConstant(s1.toString());
-	        propertySensor2=new StringConstant(s2.toString());
-	        
-	        try {
-	            Vector v = new Vector();
-	            v.add(propertySensor1);
-	            Expression es1 = new ToUpper(v,true);
-
-	            v.clear();
-	            v.add(propertySensor2);
-	            Expression es2 = new ToUpper(v,true);
-
-	            
-	            
-	            String x=(String)es1.evaluate();
-	            assertTrue(x.equals(s3));
-	            x=(String)es2.evaluate();
-	            assertTrue(x.equals(s3));
-	                    
-	            
-	        } catch (SPLException e) {
-	            fail("Received evaluation exception " + e.getMessage());
-	        } catch (Exception e) {
-	            fail("Received expression exception " + e.getMessage());
-	        }
-	    }
-	   
-	   public void testToString() {
-	    	propertySensor1=new IntegerConstant(845);
-	        propertySensor2=new BooleanConstant(true);
-	        
-	        try {
-	            Vector v = new Vector();
-	            v.add(propertySensor1);
-	            Expression es1 = new ToString(v,true);
-
-	            v.clear();
-	            v.add(propertySensor2);
-	            Expression es2 = new ToString(v,true);
-
-	            
-	            
-	            String x=(String)es1.evaluate();
-	            assertTrue(x.equals("845"));
-	            x=(String)es2.evaluate();
-	            assertTrue(x.equals("true"));
-	                    
-	            
-	        } catch (SPLException e) {
-	            fail("Received evaluation exception " + e.getMessage());
-	        } catch (Exception e) {
-	            fail("Received expression exception " + e.getMessage());
-	        }
-	    }
+/*
+ * 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.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+
+
+package org.apache.imperius.spl.tests;
+
+import java.util.Vector;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.impl.BooleanConstant;
+import org.apache.imperius.spl.parser.expressions.impl.Concatenate;
+import org.apache.imperius.spl.parser.expressions.impl.Contains;
+import org.apache.imperius.spl.parser.expressions.impl.EndsWith;
+import org.apache.imperius.spl.parser.expressions.impl.IntegerConstant;
+import org.apache.imperius.spl.parser.expressions.impl.LeftSubstring;
+import org.apache.imperius.spl.parser.expressions.impl.MiddleSubstring;
+import org.apache.imperius.spl.parser.expressions.impl.ReplaceSubstring;
+import org.apache.imperius.spl.parser.expressions.impl.RightSubstring;
+import org.apache.imperius.spl.parser.expressions.impl.StartsWith;
+import org.apache.imperius.spl.parser.expressions.impl.StringConstant;
+import org.apache.imperius.spl.parser.expressions.impl.StringLength;
+import org.apache.imperius.spl.parser.expressions.impl.ToLower;
+import org.apache.imperius.spl.parser.expressions.impl.ToString;
+import org.apache.imperius.spl.parser.expressions.impl.ToUpper;
+import org.apache.imperius.spl.parser.expressions.impl.Word;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+
+
+
+
+public class StringExpressionTest extends TestCase {
+
+	static final String CMVC_ID_StringExpressionTest = "$Header: /cvsroot/cimsplpegasus/trunk/modules/imperius-splcore/src/com/ibm/ac/spl/tests/StringExpressionTest.java,v 1.2 2007/12/20 13:07:37 prabalig Exp $";
+	static final String VERSION_StringExpressionTest = "File version $Revision: 1.2 $, last changed $Date: 2007/12/20 13:07:37 $";
+//	private static Logger logger = SPLLogger.getCIMSPLLogger().getLogger();
+	
+	
+	static Expression propertySensor1 =null;
+	//new ConstantExpression("propertySensor1");
+	static Expression propertySensor2 =null;
+	//new PropertySensor("propertySensor2");
+	static  Expression propertySensor3 =null;
+	//new PropertySensor("propertySensor3");
+	static  Expression propertySensor4 =null;
+	//new PropertySensor("propertySensor4");
+	static  Expression propertySensor5 =null;
+	//new PropertySensor("propertySensor5");
+	static  Expression propertySensor6 =null;
+	//new PropertySensor("propertySensor6");
+	static  Expression propertySensor7 =null;
+	//new PropertySensor("propertySensor7");
+	static  Expression propertySensor8 =null;
+	//new PropertySensor("propertySensor8");
+	static  Expression propertySensor9 =null;
+	//new PropertySensor("propertySensor9");
+	static  Expression propertySensor10 =null;
+	//new PropertySensor("propertySensor10");
+
+	public StringExpressionTest(String arg0) {
+		super(arg0);
+	}
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(StringExpressionTest.class);
+		TestSetup wrapper = new TestSetup(suite) {
+
+			protected void setUp() throws Exception {
+				oneTimeSetUp();
+			}
+
+			protected void tearDown() throws Exception {
+				oneTimeTearDown();
+			}
+		};
+		return wrapper;
+	}
+
+	public static void main(String[] args) {
+		junit.textui.TestRunner.run(suite());
+	}
+
+	protected static void oneTimeSetUp() throws Exception {
+	}
+
+	protected static void oneTimeTearDown() throws Exception {
+
+	}
+
+	/*
+	 * This will test MiddleSubstring Expression
+	 */
+	public void testMiddleSubstring() {
+		String string = "\"AutonomicComputing\"";
+		StringConstant lr = new StringConstant("\"LeftToRight\"");
+		StringConstant rl = new StringConstant("\"RightToLeft\"");
+		IntegerConstant ic4 = new IntegerConstant(4);
+		IntegerConstant ic5 = new IntegerConstant(5);
+		//HashMap map = new HashMap();
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			Expression exp;
+			v.add(new StringConstant(string));
+			v.add(ic4);
+			v.add(ic5);
+			v.add(lr);
+			Expression esnnl = new MiddleSubstring(v,true);
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(ic4);
+			v.add(ic5);
+			v.add(rl);
+			Expression esnnr = new MiddleSubstring(v,true);
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(ic5);
+			v.add(lr);
+			Expression essnl = new MiddleSubstring(v,true);
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(ic5);
+			v.add(rl);
+			Expression essnr = new MiddleSubstring(v,true);
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(ic4);
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			Expression esnsl = new MiddleSubstring(v,true);
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(ic4);
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			Expression esnsr = new MiddleSubstring(v,true);
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"on\""));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			Expression esssl = new MiddleSubstring(v,true);
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"on\""));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			Expression esssr = new MiddleSubstring(v,true);
+
+			assertTrue(((String) esnnl.evaluate()).equals("nomic"));
+			assertTrue(((String) esnnr.evaluate()).equals("ing"));
+			assertTrue(((String) essnl.evaluate()).equals("icCom"));
+			assertTrue(((String) essnr.evaluate()).equals("putin"));
+			assertTrue(((String) esnsl.evaluate()).equals("n"));
+			assertTrue(((String) esnsr.evaluate()).equals("pu"));
+			assertTrue(((String) esssl.evaluate()).equals(""));
+			assertTrue(((String) esssr.evaluate()).equals("Aut"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(4));
+			v.add(new IntegerConstant(5));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("nomic"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(4));
+			v.add(new IntegerConstant(5));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("ing"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(4));
+			v.add(new IntegerConstant(-1));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("o"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(8));
+			v.add(new IntegerConstant(-1));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("o"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(-1));
+			v.add(new IntegerConstant(5));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("g"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(-1));
+			v.add(new IntegerConstant(5));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("tonom"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(-1));
+			v.add(new IntegerConstant(-1));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("n"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(-1));
+			v.add(new IntegerConstant(-1));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("u"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(19));
+			v.add(new IntegerConstant(5));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(19));
+			v.add(new IntegerConstant(5));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("Auton"));
+			//////////////////////////////////////////////////////
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new IntegerConstant(5));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("icCom"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new IntegerConstant(5));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("putin"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new IntegerConstant(18));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("icComputing"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new IntegerConstant(18));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("puting"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new IntegerConstant(-1));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("n"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new IntegerConstant(-1));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("C"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new IntegerConstant(5));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new IntegerConstant(5));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new IntegerConstant(-1));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new IntegerConstant(-1));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new IntegerConstant(20));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new IntegerConstant(20));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+			///////////////////////////////////////////////
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(4));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("n"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(4));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("pu"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(7));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("icC"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(7));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(-1));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("g"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(-1));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(-1));
+			v.add(new StringConstant("\"bz\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("g"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(-1));
+			v.add(new StringConstant("\"bz\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(4));
+			v.add(new StringConstant("\"bz\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(
+					((String) exp.evaluate()).equals("nomicComputing"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(4));
+			v.add(new StringConstant("\"bz\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(20));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(20));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(20));
+			v.add(new StringConstant("\"bz\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new IntegerConstant(20));
+			v.add(new StringConstant("\"bz\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+			/////////////////////////////////////
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("icC"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("icC"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new StringConstant("\"bz\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("icComputing"));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new StringConstant("\"bz\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals("AutonomicC"));
+
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new StringConstant("\"bz\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"bz\""));
+			v.add(new StringConstant("\"bz\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new StringConstant("\"icC\""));
+			v.add(lr);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(new StringConstant("\"icC\""));
+			v.add(rl);
+			exp = new MiddleSubstring(v,true);
+			assertTrue(((String) exp.evaluate()).equals(""));
+
+
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test RightSubstring Expression
+	 */
+	public void testRightSubstring() {
+		String string = "\"AutonomicComputing\"";
+		StringConstant lr = new StringConstant("\"LeftToRight\"");
+		StringConstant rl = new StringConstant("\"RightToLeft\"");
+		IntegerConstant icmin1 = new IntegerConstant(-1);
+
+		IntegerConstant ic4 = new IntegerConstant(4);
+//		IntegerConstant ic5 = new IntegerConstant(5);
+		//HashMap map = new HashMap();
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(string));
+			v.add(ic4);
+			v.add(lr);
+			Expression esnl = new RightSubstring(v,true);
+			// Examples: RightSubstring("AutonomicComputing", 4, LeftToRight) = "ting".
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(icmin1);
+			v.add(lr);
+			Expression esnlmin1 = new RightSubstring(v,true);
+			// Examples: RightSubstring("AutonomicComputing", -1, LeftToRight) = "AutonomicComputing".
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(ic4);
+			v.add(rl);
+			Expression esnr = new RightSubstring(v,true);
+			// RightSubstring("AutonomicComputing", 4, RightToLeft) = "nomicComputing".<p>
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(icmin1);
+			v.add(rl);
+			Expression esnrmin1 = new RightSubstring(v,true);
+			// Examples: RightSubstring("AutonomicComputing", -1, RightToLeft) = "".
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			Expression essl = new RightSubstring(v,true);
+			// Examples: RightSubstring("AutonomicComputing", "om", LeftToRight)="icComputing" 
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"jj\""));
+			v.add(lr);
+			Expression esslne = new RightSubstring(v,true);
+			// Examples: RightSubstring("AutonomicComputing", "jj", LeftToRight)="" 
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			Expression essr = new RightSubstring(v,true);
+			// RightSubstring("AutonomicComputing", "om", RightToLeft)="puting".
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"jj\""));
+			v.add(rl);
+			Expression essrne = new RightSubstring(v,true);
+			// RightSubstring("AutonomicComputing", "jj", RightToLeft)="".
+
+			assertTrue(((String) esnl.evaluate()).equals("ting"));
+			assertTrue(
+					((String) esnlmin1.evaluate()).equals(
+					"AutonomicComputing"));
+			assertTrue(
+					((String) esnr.evaluate()).equals("nomicComputing"));
+			assertTrue(((String) esnrmin1.evaluate()).equals(""));
+			assertTrue(((String) essl.evaluate()).equals("icComputing"));
+			assertTrue(((String) esslne.evaluate()).equals(""));
+			assertTrue(((String) essr.evaluate()).equals("puting"));
+			assertTrue(((String) essrne.evaluate()).equals(""));
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test LeftSubstring Expression
+	 */
+	public void testLeftSubstring() {
+		String string = "\"AutonomicComputing\"";
+		StringConstant lr = new StringConstant("\"LeftToRight\"");
+		StringConstant rl = new StringConstant("\"RightToLeft\"");
+		IntegerConstant ic4 = new IntegerConstant(4);
+//		IntegerConstant ic5 = new IntegerConstant(5);
+		//HashMap map = new HashMap();
+		//SensorLookup lookup = new SensorLookupImpl(map);
+		IntegerConstant icmin1 = new IntegerConstant(-1);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(string));
+			v.add(ic4);
+			v.add(lr);
+			Expression esnl = new LeftSubstring(v,true);
+			// Examples: LeftSubstring("AutonomicComputing", 4, LeftToRight) = "Auto".
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(icmin1);
+			v.add(lr);
+			Expression esnlmin1 = new LeftSubstring(v,true);
+			// Examples: LeftSubstring("AutonomicComputing", -1, LeftToRight) = "AutonomicComputing".
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(ic4);
+			v.add(rl);
+			Expression esnr = new LeftSubstring(v,true);
+			// LeftSubstring("AutonomicComputing", 4, RightToLeft) = "AutonomicCompu".
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(icmin1);
+			v.add(rl);
+			Expression esnrmin1 = new LeftSubstring(v,true);
+			// Examples: LeftSubstring("AutonomicComputing", -1, RightToLeft) = "".
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(lr);
+			Expression essl = new LeftSubstring(v,true);
+			// Examples: LeftSubstring("AutonomicComputing", "om", LeftToRight)="Auton" 
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"\""));
+			v.add(lr);
+			Expression esslempty = new LeftSubstring(v,true);
+			// Examples: LeftSubstring("AutonomicComputing", "", LeftToRight)="" 
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"om\""));
+			v.add(rl);
+			Expression essr = new LeftSubstring(v,true);
+			// LeftSubstring("AutonomicComputing", "om", RightToLeft)="AutonomicC"
+
+			v.clear();
+			v.add(new StringConstant(string));
+			v.add(new StringConstant("\"\""));
+			v.add(lr);
+			Expression essrempty = new LeftSubstring(v,true);
+			// Examples: LeftSubstring("AutonomicComputing", "", RightToLeft)="" 
+
+			assertTrue(((String) esnl.evaluate()).equals("Auto"));
+			assertTrue(
+					((String) esnlmin1.evaluate()).equals(
+					"AutonomicComputing"));
+			assertTrue(
+					((String) esnr.evaluate()).equals("AutonomicCompu"));
+			assertTrue(((String) esnrmin1.evaluate()).equals(""));
+			assertTrue(((String) essl.evaluate()).equals("Auton"));
+			assertTrue(((String) esslempty.evaluate()).equals(""));
+			assertTrue(((String) essr.evaluate()).equals("AutonomicC"));
+			assertTrue(((String) essrempty.evaluate()).equals(""));
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test StringLength Expression
+	 */
+	public void testStringLength() {
+		String s1 = "\"AutonomicComputing\"";
+		String s2 = "\"StringLength\"";
+		String s3 = "\"PMAC1.2\"";
+
+		//HashMap map = new HashMap();
+		propertySensor1=new StringConstant(s1);
+		propertySensor2=new StringConstant(s2);
+		propertySensor3=new StringConstant(s3);
+
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(s1));
+			Expression e1 = new StringLength(v,true);
+
+			v.clear();
+			v.add(new StringConstant(s2));
+			Expression e2 = new StringLength(v,true);
+
+			v.clear();
+			v.add(new StringConstant(s3));
+			Expression e3 = new StringLength(v,true);
+
+			v.clear();
+			v.add(propertySensor1);
+			Expression eps1 = new StringLength(v,true);
+
+			v.clear();
+			v.add(propertySensor2);
+			Expression eps2 = new StringLength(v,true);
+
+			v.clear();
+			v.add(propertySensor3);
+			Expression eps3 = new StringLength(v,true);
+			s1 = s1.substring(1, s1.length()-1);
+			s2 = s2.substring(1, s2.length()-1);
+			s3 = s3.substring(1, s3.length()-1);
+
+			assertTrue(
+					new Integer(s1.length()).compareTo(e1.evaluate()) == 0);
+			assertTrue(
+					new Integer(s2.length()).compareTo(e2.evaluate()) == 0);
+			assertTrue(
+					new Integer(s3.length()).compareTo(e3.evaluate()) == 0);
+			assertTrue(
+					new Integer(s1.length()).compareTo(eps1.evaluate()) == 0);
+			assertTrue(
+					new Integer(s2.length()).compareTo(eps2.evaluate()) == 0);
+			assertTrue(
+					new Integer(s3.length()).compareTo(eps3.evaluate()) == 0);
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test ReplaceSubstring Expression
+	 */
+	public void testReplaceSubstring() {
+		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse.\"";
+		String s2 = "\"This\"";
+		String s3 = "\"That\"";
+		String s4 = "\"ThatIsADogThatIsAPenThatIsATelevisionSetThatIsAHouse.\"";
+
+		//HashMap map = new HashMap();
+		propertySensor1=new StringConstant(s1);
+		propertySensor2=new StringConstant(s2);
+		propertySensor3=new StringConstant(s3);
+
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(s1));
+			v.add(new StringConstant(s2));
+			v.add(new StringConstant(s3));
+			Expression e1 = new ReplaceSubstring(v,true);
+
+			v.clear();
+			v.add(propertySensor1);
+			v.add(propertySensor2);
+			v.add(propertySensor3);
+			Expression eps1 = new ReplaceSubstring(v,true);
+			s4 = s4.substring(1, s4.length()-1);
+			assertTrue(s4.compareTo(e1.evaluate()) == 0);
+			assertTrue(s4.compareTo(eps1.evaluate()) == 0);
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test StartsWith Expression
+	 */
+	public void testStartsWith() {
+		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse.\"";
+		String s2 = "\"This\"";
+
+		//HashMap map = new HashMap();
+		propertySensor1=new StringConstant(s1);
+		propertySensor2=new StringConstant(s2);
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(s1));
+			v.add(new StringConstant(s2));
+			Expression e1 = new StartsWith(v,true);
+
+			v.clear();
+			v.add(propertySensor1);
+			v.add(propertySensor2);
+			Expression eps1 = new StartsWith(v,true);
+
+			assertTrue(((Boolean) (e1.evaluate())).booleanValue());
+			assertTrue(((Boolean) (eps1.evaluate())).booleanValue());
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test Ends Expression
+	 */
+	public void testEndsWith() {
+		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse.\"";
+		String s2 = "\"ThisIsAHouse.\"";
+
+		//HashMap map = new HashMap();
+		propertySensor1=new StringConstant(s1);
+		propertySensor2=new StringConstant(s2);
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(s1));
+			v.add(new StringConstant(s2));
+			Expression e1 = new EndsWith(v,true);
+
+			v.clear();
+			v.add(propertySensor1);
+			v.add(propertySensor2);
+			Expression eps1 = new EndsWith(v,true);
+
+			assertTrue(((Boolean) (e1.evaluate())).booleanValue());
+			assertTrue(((Boolean) (eps1.evaluate())).booleanValue());
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test Concatenate Expression
+	 */
+	public void testConcatenate() {
+		String s1 = "\"ThisIsADog\"";
+		String s2 = "\"ThisIsAPen\"";
+		//String s3 = "ThisIsATelevisionSet";
+		//String s4 = "ThisIsAHouse.";
+
+		//HashMap map = new HashMap();
+		propertySensor1=new StringConstant(s1);
+		propertySensor2=new StringConstant(s2);
+		
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(s1));
+			v.add(new StringConstant(s2));
+			
+			Expression e1 = new Concatenate(v,true);
+
+			v.clear();
+			v.add(propertySensor1);
+			v.add(propertySensor2);
+			
+			Expression eps1 = new Concatenate(v,true);
+			s1 = s1.substring(1, s1.length()-1);
+			s2 = s2.substring(1, s2.length()-1);
+			assertTrue(e1.evaluate().equals(s1 + s2));
+			assertTrue(eps1.evaluate().equals(s1 + s2));
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test Word Expression
+	 */
+	public void testWord() {
+		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse\"";
+		String s2 = "\"This\"";
+		int n = 3;
+
+		//HashMap map = new HashMap();
+		propertySensor1=new StringConstant(s1);
+		propertySensor2=new StringConstant(s2);
+		propertySensor3=new IntegerConstant(1);
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(s1));
+			v.add(new StringConstant(s2));
+			v.add(new IntegerConstant(n));
+			Expression e1 = new Word(v,true);
+
+			v.clear();
+			v.add(propertySensor1);
+			v.add(propertySensor2);
+			v.add(propertySensor3);
+			Expression eps1 = new Word(v,true);
+
+			assertTrue(
+					(e1.evaluate()).equals(
+					"ThisIsADogThisIsAPenThisIsATelevisionSet"));
+			assertTrue((eps1.evaluate()).equals("ThisIsADog"));
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+
+	/*
+	 * This will test Contains Expression
+	 */
+	public void testContains() {
+		String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse\"";
+		String s2 = "\"ThisIsAPen\"";
+
+		//HashMap map = new HashMap();
+		propertySensor1=new StringConstant(s1);
+		propertySensor2=new StringConstant(s2);
+		//SensorLookup lookup = new SensorLookupImpl(map);
+
+		try {
+			Vector v = new Vector();
+			v.add(new StringConstant(s1));
+			v.add(new StringConstant(s2));
+			Expression e1 = new Contains(v,true);
+
+			v.clear();
+			v.add(propertySensor1);
+			v.add(propertySensor2);
+			Expression eps1 = new Contains(v,true);
+
+			assertTrue(((Boolean) (e1.evaluate())).booleanValue());
+			assertTrue(((Boolean) (eps1.evaluate())).booleanValue());
+		} catch (SPLException e) {
+			fail("Received evaluation exception " + e.getMessage());
+		} catch (Exception e) {
+			fail("Received expression exception " + e.getMessage());
+		}
+	}
+	
+	   public void testToLower() {
+	    	String s1 = "\"HELLO\"";
+	        String s2 = "\"HellO\"";
+	        String s3 = "hello";
+
+	        //HashMap map = new HashMap();
+	        propertySensor1=new StringConstant(s1.toString());
+	        propertySensor2=new StringConstant(s2.toString());
+	        
+	        try {
+	            Vector v = new Vector();
+	            v.add(propertySensor1);
+	            Expression es1 = new ToLower(v,true);
+
+	            v.clear();
+	            v.add(propertySensor2);
+	            Expression es2 = new ToLower(v,true);
+
+	            
+	            
+	            String x=(String)es1.evaluate();
+	            assertTrue(x.equals(s3));
+	            x=(String)es2.evaluate();
+	            assertTrue(x.equals(s3));
+	                    
+	            
+	        } catch (SPLException e) {
+	            fail("Received evaluation exception " + e.getMessage());
+	        } catch (Exception e) {
+	            fail("Received expression exception " + e.getMessage());
+	        }
+	    }
+	   
+	   public void testToUpper() {
+	    	String s1 = "\"hello\"";
+	        String s2 = "\"HellO\"";
+	        String s3 = "HELLO";
+
+	        //HashMap map = new HashMap();
+	        propertySensor1=new StringConstant(s1.toString());
+	        propertySensor2=new StringConstant(s2.toString());
+	        
+	        try {
+	            Vector v = new Vector();
+	            v.add(propertySensor1);
+	            Expression es1 = new ToUpper(v,true);
+
+	            v.clear();
+	            v.add(propertySensor2);
+	            Expression es2 = new ToUpper(v,true);
+
+	            
+	            
+	            String x=(String)es1.evaluate();
+	            assertTrue(x.equals(s3));
+	            x=(String)es2.evaluate();
+	            assertTrue(x.equals(s3));
+	                    
+	            
+	        } catch (SPLException e) {
+	            fail("Received evaluation exception " + e.getMessage());
+	        } catch (Exception e) {
+	            fail("Received expression exception " + e.getMessage());
+	        }
+	    }
+	   
+	   public void testToString() {
+	    	propertySensor1=new IntegerConstant(845);
+	        propertySensor2=new BooleanConstant(true);
+	        
+	        try {
+	            Vector v = new Vector();
+	            v.add(propertySensor1);
+	            Expression es1 = new ToString(v,true);
+
+	            v.clear();
+	            v.add(propertySensor2);
+	            Expression es2 = new ToString(v,true);
+
+	            
+	            
+	            String x=(String)es1.evaluate();
+	            assertTrue(x.equals("845"));
+	            x=(String)es2.evaluate();
+	            assertTrue(x.equals("true"));
+	                    
+	            
+	        } catch (SPLException e) {
+	            fail("Received evaluation exception " + e.getMessage());
+	        } catch (Exception e) {
+	            fail("Received expression exception " + e.getMessage());
+	        }
+	    }
 }

Propchange: incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/StringExpressionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/TestMain.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/TestMain.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/TestMain.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/TestMain.java Fri Jan 11 10:56:30 2008
@@ -1,70 +1,70 @@
-/*
- * 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.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-
-package org.apache.imperius.spl.tests;
-
-import java.util.Enumeration;
-import java.util.logging.Logger;
-
-import org.apache.imperius.util.SPLLogger;
-
-import junit.framework.TestFailure;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-public class TestMain {
-	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-	
-
-	/**
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		TestSuite testsuite=new TestSuite();
-		//testsuite.addTestSuite(AbsTests.class);
-		//testsuite.addTestSuite(AdditionTests.class);
-		//testsuite.addTestSuite(AssignmentExpressionTests.class);
-		testsuite.addTestSuite(BooleanExpressionTest.class);
-		testsuite.addTestSuite(StringExpressionTest.class);
-		testsuite.addTestSuite(NumericExpressionTest.class);
-		testsuite.addTestSuite(NewExpressionTest.class);
-		testsuite.addTestSuite(CollectionExpressionsTest.class);
-		testsuite.addTestSuite(UtilityTest.class);
-		
-		TestResult result=new TestResult();
-		testsuite.run(result);
-		Enumeration enm=result.errors();
-		while(enm.hasMoreElements()){
-			TestFailure ob=(TestFailure)enm.nextElement();
-			System.out.println("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
-			logger.severe("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
-		}
-		Enumeration enm1=result.failures();
-		while(enm1.hasMoreElements()){
-			TestFailure ob=(TestFailure)enm1.nextElement();
-			System.out.println("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
-			logger.severe("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
-		}
-		
-		System.out.println("result errorCount "+result.errorCount()+ " result failureCount "+ result.failureCount()+ " result status "+result.wasSuccessful()+ result.errors()
-				);
-	}
-
-}
+/*
+ * 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.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.tests;
+
+import java.util.Enumeration;
+import java.util.logging.Logger;
+
+import org.apache.imperius.util.SPLLogger;
+
+import junit.framework.TestFailure;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+public class TestMain {
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+	
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		TestSuite testsuite=new TestSuite();
+		//testsuite.addTestSuite(AbsTests.class);
+		//testsuite.addTestSuite(AdditionTests.class);
+		//testsuite.addTestSuite(AssignmentExpressionTests.class);
+		testsuite.addTestSuite(BooleanExpressionTest.class);
+		testsuite.addTestSuite(StringExpressionTest.class);
+		testsuite.addTestSuite(NumericExpressionTest.class);
+		testsuite.addTestSuite(NewExpressionTest.class);
+		testsuite.addTestSuite(CollectionExpressionsTest.class);
+		testsuite.addTestSuite(UtilityTest.class);
+		
+		TestResult result=new TestResult();
+		testsuite.run(result);
+		Enumeration enm=result.errors();
+		while(enm.hasMoreElements()){
+			TestFailure ob=(TestFailure)enm.nextElement();
+			System.out.println("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
+			logger.severe("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
+		}
+		Enumeration enm1=result.failures();
+		while(enm1.hasMoreElements()){
+			TestFailure ob=(TestFailure)enm1.nextElement();
+			System.out.println("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
+			logger.severe("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
+		}
+		
+		System.out.println("result errorCount "+result.errorCount()+ " result failureCount "+ result.failureCount()+ " result status "+result.wasSuccessful()+ result.errors()
+				);
+	}
+
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/TestMain.java
------------------------------------------------------------------------------
    svn:eol-style = native