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 jn...@apache.org on 2007/12/22 19:34:03 UTC
svn commit: r606479 [27/30] - in /incubator/imperius/trunk/trunk: ./
modules/ modules/imperius-javaspl/ modules/imperius-javaspl/resources/
modules/imperius-javaspl/resources/samples/
modules/imperius-javaspl/resources/samples/computersystem/ modules/i...
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/StringExpressionTest.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/StringExpressionTest.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/StringExpressionTest.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/StringExpressionTest.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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());
+ }
+ }
+}
\ No newline at end of file
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/TestMain.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/TestMain.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/TestMain.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/TestMain.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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()
+ );
+ }
+
+}
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/UtilityTest.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/UtilityTest.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/UtilityTest.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/tests/UtilityTest.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,222 @@
+/*
+ * 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.ArrayList;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.impl.*;
+import org.apache.imperius.spl.parser.util.ExpressionUtility;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+
+
+
+public class UtilityTest extends TestCase {
+
+ static final String CMVC_ID_UtilityTest = "$Header: /cvsroot/cimsplpegasus/trunk/modules/imperius-splcore/src/com/ibm/ac/spl/tests/UtilityTest.java,v 1.2 2007/12/20 13:07:37 prabalig Exp $";
+ static final String VERSION_UtilityTest = "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 UtilityTest(String arg0) {
+ super(arg0);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(UtilityTest.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 {
+
+ }
+
+ public void testExpressionUtility() {
+ Byte o1 = new Byte((byte)8);
+ Byte o2 = new Byte((byte)9);
+
+ try {
+ assertTrue(ExpressionUtility.compare(o1, o2)==-1);
+ assertTrue(ExpressionUtility.minus(o2, o1).intValue()==(int)1);
+ assertTrue(ExpressionUtility.multiplication(o1, o2).intValue()==72);
+ assertTrue(ExpressionUtility.plus(o1, o2).intValue()==17);
+ assertTrue(ExpressionUtility.division(o2, o1).doubleValue()==(double)1.125);
+
+ String YEAR="1999";
+ String MONTH="06";
+ String DAY_OF_MONTH="23";
+ String HOUR_OF_DAY="11";
+ String MINUTE="34";
+ String SECOND="34";
+ String MILLISECOND="123456";
+ String sign="-";
+ String UTC="330";
+ String CIMDateString=YEAR+MONTH+DAY_OF_MONTH+HOUR_OF_DAY+MINUTE+SECOND+"."+MILLISECOND+sign+UTC;
+ //System.out.println("CIMDateString = "+CIMDateString);
+
+
+ String GMT = "GMT";
+ int UTC_MULTIPLIER = 60000;
+ int zoneOffsetMinutes=Integer.parseInt(UTC);
+ int zoneOffsetMilliseconds=zoneOffsetMinutes * UTC_MULTIPLIER;
+ Calendar cal = Calendar.getInstance (TimeZone.getTimeZone (GMT));
+
+// CIM date format yyyymmddHHMMSS.mmmmmmsUUU
+
+ cal.set(Calendar.YEAR, 1999);
+ cal.set(Calendar.MONTH, 06);
+ cal.set(Calendar.DAY_OF_MONTH, 23);
+ cal.set(Calendar.HOUR_OF_DAY,11);
+ cal.set(Calendar.MINUTE, 34);
+ cal.set(Calendar.SECOND, 34);
+
+ cal.set(Calendar.MILLISECOND, 123);
+
+ if(sign.equalsIgnoreCase("-")){
+ zoneOffsetMilliseconds=0-zoneOffsetMilliseconds;
+ }
+
+ cal.set(Calendar.ZONE_OFFSET, zoneOffsetMilliseconds);
+ //System.out.println("created calendar");
+ DateTimeConstant dtc=new DateTimeConstant(CIMDateString);
+ Calendar cal1= (Calendar)dtc.evaluate();
+ //System.out.println("cal1.getTimeInMillis() "+cal1.getTime()+" "+cal1.getTimeInMillis());
+
+ //System.out.println("cal.getTimeInMillis() "+cal.getTime()+" "+cal.getTimeInMillis());
+
+ // assertTrue(cal1.getTimeInMillis()==cal.getTimeInMillis());
+
+ } catch (SPLException e) {
+ fail("Received evaluation exception " + e.getMessage());
+ } catch (Exception e) {
+ fail("Received expression exception " + e.getMessage());
+ }
+ }
+
+ public void testTypeResolver() {
+ Byte o1 = new Byte((byte)8);
+ Float o2 = new Float((float)8.22);
+ Integer o3 = new Integer((int)8.22);
+ Long o4 = new Long((long)8.22);
+ Double o5 = new Double((double)8.22);
+ Number[] num={o1,o2,o3,o4,o5};
+ ByteConstant n1=new ByteConstant(o1.byteValue());
+ FloatConstant n2=new FloatConstant(o2.floatValue());
+ IntegerConstant n3=new IntegerConstant(o3.intValue());
+ LongConstant n4=new LongConstant(o4.longValue());
+ ArrayList passedParams=new ArrayList();
+ passedParams.add(n1);
+ passedParams.add(n2);
+ passedParams.add(n3);
+ passedParams.add(n4);
+ ArrayList formalParams=new ArrayList();
+ formalParams.add(new TypeInfo(TypeConstants.byteType));
+ formalParams.add(new TypeInfo(TypeConstants.floatType));
+ formalParams.add(new TypeInfo(TypeConstants.intType));
+ formalParams.add(new TypeInfo(TypeConstants.longType));
+
+
+
+
+ try {
+ TypeInfo flt = new TypeInfo(TypeConstants.floatType);
+ TypeInfo dbl = new TypeInfo(TypeConstants.doubleType);
+ TypeInfo intt = new TypeInfo(TypeConstants.intType);
+ TypeInfo lg = new TypeInfo(TypeConstants.longType);
+ TypeInfo str = new TypeInfo(TypeConstants.stringType);
+ TypeInfo bo = new TypeInfo(TypeConstants.booleanType);
+ TypeInfo cal = new TypeInfo(TypeConstants.dateTime);
+ TypeInfo bt = new TypeInfo(TypeConstants.byteType);
+
+ //System.out.println("TypeResolver.resolveType(flt, dbl).getType()="+TypeResolver.resolveType(flt, dbl).getType());
+ //System.out.println("TypeConstants.doubleType="+TypeConstants.doubleType);
+ assertTrue(TypeResolver.resolveType(flt, dbl).getType()==TypeConstants.doubleType);
+ assertTrue(TypeResolver.resolveType(num)==TypeConstants.doubleType);
+ assertTrue(TypeResolver.binaryNumericPromotionResolver(intt, lg).getType()==TypeConstants.longType);
+ assertFalse(TypeResolver.isTypeAssignableForEquality(bo, str));
+ assertFalse(TypeResolver.isTypeAssignableForRelation(bo, str));
+ assertFalse(TypeResolver.isNumeric(str));
+ assertTrue(TypeResolver.isString(str));
+ assertTrue(TypeResolver.isBoolean(bo));
+ assertTrue(TypeResolver.isCalendar(cal));
+ assertTrue(TypeResolver.validateActualParameterTypes(formalParams, passedParams));
+ assertTrue(TypeResolver.unaryNumericPromotionResolver(bt).getType()==TypeConstants.intType);
+
+
+ } catch (SPLException e) {
+ e.printStackTrace();
+ fail("Received evaluation exception " + e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Received expression exception " + e.getMessage());
+ }
+ }
+
+
+}
\ No newline at end of file
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/PropertiesLoader.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/PropertiesLoader.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/PropertiesLoader.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/PropertiesLoader.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,94 @@
+/*
+ * 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.util;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+
+public class PropertiesLoader
+{
+ private static String CLASSNAME = "PropertiesLoader";
+
+ private static Logger logger = Logger.getLogger(PropertiesLoader.class.getName());
+ private static Properties props = null;
+ private static String PROPERTIES_FILE = "customexpressions.properties";
+
+ private void _loadProperties()
+ {
+ logger.entering(CLASSNAME,"PropertiesLoader:_loadProperties");
+ props = new Properties();
+ try
+ {
+ SPLLogger.SPL_HOME = System.getProperty("user.dir");
+ if(logger.isLoggable(Level.FINE))
+ logger.fine("Trying to Load " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+ File propertiesFile = new File(SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+ if(!propertiesFile.exists())
+ {
+ FileWriter fstream = new FileWriter(SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+ BufferedWriter out = new BufferedWriter(fstream);
+ out.write("SPL_CUSTOM_EXPRESSIONS");
+ out.write("\n");
+ out.write("SPL_CUSTOM_ACTIONS");
+ out.write("\n");
+ //Close the output stream
+ out.close();
+
+ }
+ FileInputStream inputStream = new FileInputStream(propertiesFile);
+ props.load(inputStream);
+ if(logger.isLoggable(Level.FINE))
+ logger.fine("Loaded " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+ inputStream.close();
+ }
+ catch(FileNotFoundException fnfe)
+ {
+ logger.severe("File not found " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+ }
+ catch(IOException ioe)
+ {
+ logger.severe("IO Exception loading " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+ }
+
+ }
+
+ public Properties getProperties()
+ {
+ if(props == null)
+ {
+ _loadProperties();
+ }
+
+ return props;
+ }
+}
+
+
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLAuditLoggerClass.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLAuditLoggerClass.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLAuditLoggerClass.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLAuditLoggerClass.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,95 @@
+/*
+ * 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.util;
+
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class SPLAuditLoggerClass extends Logger
+{
+ private Logger internalLogger=null;
+
+ public SPLAuditLoggerClass(String name, String resourceBundleName)
+ {
+
+ super(name, resourceBundleName);
+ this.internalLogger=Logger.getLogger(name, resourceBundleName);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ synchronized public void addHandler(Handler handler)
+ {
+ this.internalLogger.addHandler(handler);
+ }
+
+ synchronized public void setLevel(Level level)
+ {
+ this.internalLogger.setLevel(level);
+ }
+
+ synchronized public boolean isLoggable(Level level)
+ {
+ return internalLogger.isLoggable(level);
+ }
+
+ synchronized public void fine(String msg)
+ {
+ String msgActual=Thread.currentThread().getName();
+ msgActual+=" "+msg;
+ this.internalLogger.fine(msgActual);
+
+ }
+
+ synchronized public void entering(String className, String msg)
+ {
+ String msgActual=Thread.currentThread().getName();
+ msgActual+=" "+msg;
+ this.internalLogger.entering(className, msgActual);
+
+ }
+
+ synchronized public void exiting(String className, String msg)
+ {
+ String msgActual=Thread.currentThread().getName();
+ msgActual+=" "+msg;
+ this.internalLogger.exiting(className, msgActual);
+
+ }
+
+ synchronized public void severe(String msg)
+ {
+ String msgActual=Thread.currentThread().getName();
+ msgActual+=" "+msg;
+ Logger.getAnonymousLogger();
+ this.internalLogger.severe(msgActual);
+
+ }
+
+ /* public static final Logger getLogger(String name)
+ {
+ return new SPLLoggerClass(name,null);
+ // TODO Auto-generated constructor stub
+ }*/
+
+
+}
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLLogger.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLLogger.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLLogger.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLLogger.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,140 @@
+/*
+ * 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.util;
+
+import java.io.IOException;
+import java.util.logging.FileHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+
+public class SPLLogger
+{
+
+ private static SPLLogger splLogger;
+
+ private static Logger logger = null;
+
+ private static Logger auditLogger = null;
+
+ public static boolean ENABLE_SPL_LOGGING = true;
+
+
+ public static String SPL_HOME = System.getProperty("user.dir");
+
+
+ public static String fileSeparator = "/";
+
+ /** A private Constructor prevents any other class from instantiating. */
+ private SPLLogger()
+ {
+ //super();
+ FileHandler handler;
+ FileHandler handler1;
+ System.identityHashCode(Thread.currentThread());
+ try
+ {
+ String userHome = System.getProperty("SPLHOME");
+ if(userHome != null)
+ {
+ SPL_HOME = userHome;
+ }
+ System.out.println("SPLHOME" + SPL_HOME);
+ logger = Logger.getLogger(SPLLogger.class.getName(),null);
+
+ auditLogger = Logger.getLogger("AuditLog",null);
+
+ String enableLogging = System.getProperty("ENABLE_SPL_LOGGING");
+ if(enableLogging != null)
+ {
+ if(enableLogging.equalsIgnoreCase("false"))
+ {
+ ENABLE_SPL_LOGGING = false;
+ }
+ }
+
+
+ if(!ENABLE_SPL_LOGGING)
+ {
+ logger.setLevel(Level.SEVERE);
+ auditLogger.setLevel(Level.ALL);
+ }
+ else
+ {
+ logger.setLevel(Level.ALL);
+ auditLogger.setLevel(Level.ALL);
+ }
+
+
+ handler = new FileHandler(SPL_HOME + fileSeparator + "SPL.log", false);
+ handler1 = new FileHandler(SPL_HOME + fileSeparator + "SPLAudit.log", true);
+ logger.addHandler(handler);
+ auditLogger.addHandler(handler1);
+
+ logger.setLevel(Level.ALL);
+ auditLogger.setLevel(Level.ALL);
+ SimpleFormatter formatter = new SimpleFormatter();
+
+ handler.setFormatter(formatter);
+ SimpleFormatter formatter1 = new SimpleFormatter();
+ handler1.setFormatter(formatter1);
+
+
+
+
+ }
+ catch (SecurityException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+
+ public static synchronized SPLLogger getSPLLogger()
+ {
+ if (splLogger == null)
+ {
+ splLogger = new SPLLogger();
+ }
+ return splLogger;
+ }
+
+ public Object clone() throws CloneNotSupportedException
+ {
+ throw new CloneNotSupportedException();
+ }
+
+ public synchronized Logger getLogger()
+ {
+
+ return logger;
+ }
+
+ public synchronized Logger getAuditLogger()
+ {
+
+ return auditLogger;
+ }
+
+}
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLLoggerClass.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLLoggerClass.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLLoggerClass.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/util/SPLLoggerClass.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,74 @@
+/*
+ * 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.util;
+
+import java.util.logging.Logger;
+
+public class SPLLoggerClass extends Logger
+{
+
+ public SPLLoggerClass(String name, String resourceBundleName)
+ {
+ super(name, resourceBundleName);
+ // TODO Auto-generated constructor stub
+ }
+
+
+
+ public void fine(String msg)
+ {
+ String msgActual=Thread.currentThread().getName();
+ msgActual+=" "+msg;
+ super.fine(msgActual);
+
+ }
+
+ public void entering(String className, String msg)
+ {
+ String msgActual=Thread.currentThread().getName();
+ msgActual+=" "+msg;
+ super.entering(className, msgActual);
+
+ }
+
+ public void exiting(String className, String msg)
+ {
+ String msgActual=Thread.currentThread().getName();
+ msgActual+=" "+msg;
+ super.exiting(className, msgActual);
+
+ }
+
+ public void severe(String msg)
+ {
+ String msgActual=Thread.currentThread().getName();
+ msgActual+=" "+msg;
+ super.severe(msgActual);
+
+ }
+
+ /* public static final Logger getLogger(String name)
+ {
+ return new SPLLoggerClass(name,null);
+ // TODO Auto-generated constructor stub
+ }*/
+
+}
Added: incubator/imperius/trunk/trunk/modules/pom.xml
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/pom.xml?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/pom.xml (added)
+++ incubator/imperius/trunk/trunk/modules/pom.xml Sat Dec 22 11:33:46 2007
@@ -0,0 +1,72 @@
+<!--
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * 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.
+ */ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>imperius</groupId>
+ <artifactId>build-all</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>Apache imperius</name>
+ <url>http://ws.apache.org/imperius</url>
+ <prerequisites>
+ <maven>2.0.4</maven>
+ </prerequisites>
+ <packaging>pom</packaging>
+
+ <properties>
+ <imperius-version>1.0.0-SNAPSHOT</imperius-version>
+ </properties>
+ <modules>
+ <module>imperius-splcore</module>
+ <module>imperius-javaspl</module>
+ </modules>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <sourceDirectory>src</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>resources</directory>
+ <targetPath>resources</targetPath>
+ </resource>
+ </resources>
+ </build>
+
+</project>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Added: incubator/imperius/trunk/trunk/site/broken-links.xml
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/site/broken-links.xml?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/site/broken-links.xml (added)
+++ incubator/imperius/trunk/trunk/site/broken-links.xml Sat Dec 22 11:33:46 2007
@@ -0,0 +1,2 @@
+<broken-links>
+</broken-links>
Added: incubator/imperius/trunk/trunk/site/community/bugs.html
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/site/community/bugs.html?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/site/community/bugs.html (added)
+++ incubator/imperius/trunk/trunk/site/community/bugs.html Sat Dec 22 11:33:46 2007
@@ -0,0 +1,172 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.8">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Apache Imperius - Change Requests and Bug Tracking</title>
+<link type="text/css" href="../skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="../skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="../skin/print.css" rel="stylesheet">
+<link type="text/css" href="../skin/profile.css" rel="stylesheet">
+<script src="../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="../">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+ |breadtrail
+ +-->
+<div class="breadtrail">
+<a href="http://www.apache.org/">Apache</a> > <a href="http://incubator.apache.org/">Incubators</a> > <a href="http://incubator.apache.org/imperius/">Imperius</a><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
+</div>
+<!--+
+ |header
+ +-->
+<div class="header">
+<!--+
+ |start group logo
+ +-->
+<div class="grouplogo">
+<a href="http://incubator.apache.org/"><img class="logoImage" alt="Apache Incubator" src="../images/apache-incubator-logo.png" title="Apache Incubator"></a>
+</div>
+<!--+
+ |end group logo
+ +-->
+<!--+
+ |start Project Logo
+ +-->
+<div class="projectlogo">
+<a href="http://incubator.apache.org/imperius"><img class="logoImage" alt="Imperius" src="../images/project-logo.png" title="Imperius Simple Policy Language"></a>
+</div>
+<!--+
+ |end Project Logo
+ +-->
+<!--+
+ |start Search
+ +-->
+<div class="searchbox">
+<form action="http://www.google.com/search" method="get" class="roundtopsmall">
+<input value="apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+ <input name="Search" value="Search" type="submit">
+</form>
+</div>
+<!--+
+ |end search
+ +-->
+<!--+
+ |start Tabs
+ +-->
+<ul id="tabs">
+<li>
+<a class="unselected" href="../index.html">Home</a>
+</li>
+<li>
+<a class="unselected" href="../download/download.html">Download</a>
+</li>
+</ul>
+<!--+
+ |end Tabs
+ +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+ |start Subtabs
+ +-->
+<div id="level2tabs"></div>
+<!--+
+ |end Endtabs
+ +-->
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+// --></script>
+</div>
+<!--+
+ |breadtrail
+ +-->
+<div class="breadtrail">
+
+
+ </div>
+<!--+
+ |start Menu, mainarea
+ +-->
+<!--+
+ |start Menu
+ +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', '../skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Community</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a href="../community/mail-lists.html" title="Mailing Lists">Mailing-Lists</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Found a Bug?</div>
+</div>
+<div class="menuitem">
+<a href="../community/contribute.html" title="contribute to Imperius">Source Code</a>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+ |alternative credits
+ +-->
+<div id="credit2"></div>
+</div>
+<!--+
+ |end Menu
+ +-->
+<!--+
+ |start content
+ +-->
+<div id="content">
+<h1>Apache Imperius - Change Requests and Bug Tracking</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#Apache+Imperius+-+Change+Requests+and+Bug+Tracking">Apache Imperius - Change Requests and Bug Tracking</a>
+</li>
+</ul>
+</div>
+
+<a name="N1000D"></a><a name="Apache+Imperius+-+Change+Requests+and+Bug+Tracking"></a>
+<h2 class="boxed">Apache Imperius - Change Requests and Bug Tracking</h2>
+<div class="section">
+<p>
+ Request for change including bug reports, ideas for new features, or enhancements to existing features -
+ are processed with <a href="http://issues.apache.org/jira/browse/imperius">JIRA </a>. If you aren't sure whether something is a bug,
+ please post a question to the mailing list.
+ </p>
+</div>
+
+</div>
+<!--+
+ |end content
+ +-->
+<div class="clearboth"> </div>
+</div>
+<div id="footer">
+<!--+
+ |start bottomstrip
+ +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+// --></script>
+</div>
+<div class="copyright">
+ Copyright ©
+ 2007 <a href="http://www.apache.org/">Apache Software Foundation.</a>
+</div>
+<!--+
+ |end bottomstrip
+ +-->
+</div>
+</body>
+</html>
Added: incubator/imperius/trunk/trunk/site/community/contribute.html
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/site/community/contribute.html?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/site/community/contribute.html (added)
+++ incubator/imperius/trunk/trunk/site/community/contribute.html Sat Dec 22 11:33:46 2007
@@ -0,0 +1,265 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.8">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Accessing and building Imperius source </title>
+<link type="text/css" href="../skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="../skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="../skin/print.css" rel="stylesheet">
+<link type="text/css" href="../skin/profile.css" rel="stylesheet">
+<script src="../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="../">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+ |breadtrail
+ +-->
+<div class="breadtrail">
+<a href="http://www.apache.org/">Apache</a> > <a href="http://incubator.apache.org/">Incubators</a> > <a href="http://incubator.apache.org/imperius/">Imperius</a><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
+</div>
+<!--+
+ |header
+ +-->
+<div class="header">
+<!--+
+ |start group logo
+ +-->
+<div class="grouplogo">
+<a href="http://incubator.apache.org/"><img class="logoImage" alt="Apache Incubator" src="../images/apache-incubator-logo.png" title="Apache Incubator"></a>
+</div>
+<!--+
+ |end group logo
+ +-->
+<!--+
+ |start Project Logo
+ +-->
+<div class="projectlogo">
+<a href="http://incubator.apache.org/imperius"><img class="logoImage" alt="Imperius" src="../images/project-logo.png" title="Imperius Simple Policy Language"></a>
+</div>
+<!--+
+ |end Project Logo
+ +-->
+<!--+
+ |start Search
+ +-->
+<div class="searchbox">
+<form action="http://www.google.com/search" method="get" class="roundtopsmall">
+<input value="apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+ <input name="Search" value="Search" type="submit">
+</form>
+</div>
+<!--+
+ |end search
+ +-->
+<!--+
+ |start Tabs
+ +-->
+<ul id="tabs">
+<li>
+<a class="unselected" href="../index.html">Home</a>
+</li>
+<li>
+<a class="unselected" href="../download/download.html">Download</a>
+</li>
+</ul>
+<!--+
+ |end Tabs
+ +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+ |start Subtabs
+ +-->
+<div id="level2tabs"></div>
+<!--+
+ |end Endtabs
+ +-->
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+// --></script>
+</div>
+<!--+
+ |breadtrail
+ +-->
+<div class="breadtrail">
+
+
+ </div>
+<!--+
+ |start Menu, mainarea
+ +-->
+<!--+
+ |start Menu
+ +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', '../skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Community</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a href="../community/mail-lists.html" title="Mailing Lists">Mailing-Lists</a>
+</div>
+<div class="menuitem">
+<a href="../community/bugs.html" title="Report Bug">Found a Bug?</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Source Code</div>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+ |alternative credits
+ +-->
+<div id="credit2"></div>
+</div>
+<!--+
+ |end Menu
+ +-->
+<!--+
+ |start content
+ +-->
+<div id="content">
+<h1>Accessing and building Imperius source </h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#getsrc">Getting the source</a>
+</li>
+<li>
+<a href="#bulid">Building the source</a>
+<ul class="minitoc">
+<li>
+<a href="#bulidjavaspl">Building Imperius with Java binding (JavaSPL)</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#eclipsedev">Developing with Eclipse</a>
+<ul class="minitoc">
+<li>
+<a href="#eclipsejavaspl"> Set up Eclipse for Imperius with Java binding (JavaSPL) </a>
+</li>
+</ul>
+</li>
+</ul>
+</div>
+
+<a name="N1000D"></a><a name="getsrc"></a>
+<h2 class="boxed">Getting the source</h2>
+<div class="section">
+<p>
+ Ther are three ways to access the source
+ </p>
+<ol>
+
+<li>
+
+<strong> Web Access: </strong> The code repository can be browsed <a href="http://svn.apache.org/viewvc/incubator/imperius/"> here </a>
+
+</li>
+
+<li>
+
+<strong> Anonymous SVN: </strong> SVN URL for anonymous users is http://svn.apache.org/repos/asf/incubator/imperius
+ Instructions for anonymous access are <a href="http://www.apache.org/dev/version-control.html#anon-svn"> here </a>.
+ </li>
+
+<li>
+
+<strong> Committer SVN: </strong> SVN URL for committers is https://svn.apache.org/repos/asf/incubator/imperius
+ Instructions for committer access are <a href="http://www.apache.org/dev/version-control.html#https-svn"> here </a>
+
+</li>
+
+</ol>
+</div>
+
+<a name="N10038"></a><a name="bulid"></a>
+<h2 class="boxed">Building the source</h2>
+<div class="section">
+<p> To build Imperius you must install <a href="http://maven.apache.org/">Apache Maven 2.0.4</a> , <a href="http://ant.apache.org">Apache Ant</a>,
+ <a href="http://java.sun.com/downloads">Java 142 </a> and <a href="http://subversion.tigris.org">Subversion client </a> on your system.
+ After the installation make sure that the mvn, ant, java and svn executables are in the search path (e.g. %PATH%).
+ Then follow the steps below to build the particular SPL binding you need.
+ </p>
+<a name="N10051"></a><a name="bulidjavaspl"></a>
+<h3 class="boxed">Building Imperius with Java binding (JavaSPL)</h3>
+<p>
+ Download the build file to a directory where you'd like to create the JavaSPL distribution and run <strong> ant </strong> from that directory.
+ Latest files from the Imperius repository will get downloaded automatically (subsequent runs of the build will use your local copy of the files).
+ The distrubtion binaries get generated under /dist.
+
+ </p>
+</div>
+
+<a name="N1005F"></a><a name="eclipsedev"></a>
+<h2 class="boxed">Developing with Eclipse</h2>
+<div class="section">
+<p>
+ To develop using eclipse download and install <a href="http://subclipse.tigris.org">Subclipse plugin </a> and <a href="http://www.antlr2.org">ANTLRv2.7.7 </a>.
+ </p>
+<p>
+ Then Select New > Project > SVN > Checkout Project from SVN. Next, create a new repository location using the anonymous SVN URL
+ (or Committer SVN URL) shown above.
+ </p>
+<p>
+ Next, follow the steps below to configure eclipse for the specific Imperius binding you need.
+ </p>
+<a name="N10076"></a><a name="eclipsejavaspl"></a>
+<h3 class="boxed"> Set up Eclipse for Imperius with Java binding (JavaSPL) </h3>
+<ol>
+
+<li> Explore to /trunk/modules and select <strong> imperius-splcore </strong> and <strong> imperius-javaspl </strong> modules. Click Next. </li>
+
+<li> Select the option to create a Java project for each directory (module) and click Finish. Subversion will now download the
+ code into the appropriate eclipse projects </li>
+
+<li> The projects will not compile as the required libraries are missing. To fix this
+ <ul>
+
+<li> Add the <strong> $ANTLR_HOME/lib/antlr.jar </strong> downloaded earlier to the classpath for <strong> imperius-splcore </strong> project </li>
+
+<li> Add <strong> imperius-splcore </strong> project as a dependency for <strong> imperius-javaspl </strong>
+</li>
+
+</ul>
+
+</li>
+
+<li> Make sure you refresh all projects to force a recompilation </li>
+
+</ol>
+</div>
+
+</div>
+<!--+
+ |end content
+ +-->
+<div class="clearboth"> </div>
+</div>
+<div id="footer">
+<!--+
+ |start bottomstrip
+ +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+// --></script>
+</div>
+<div class="copyright">
+ Copyright ©
+ 2007 <a href="http://www.apache.org/">Apache Software Foundation.</a>
+</div>
+<!--+
+ |end bottomstrip
+ +-->
+</div>
+</body>
+</html>