[teiid-commits] teiid SVN: r1265 - in trunk/connectors/connector-jdbc/src: main/java/org/teiid/connector/jdbc/derby and 5 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Aug 19 17:08:01 EDT 2009


Author: shawkins
Date: 2009-08-19 17:08:00 -0400 (Wed, 19 Aug 2009)
New Revision: 1265

Added:
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LocateFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LocateFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/ModFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java
Removed:
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LOCATEFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LOCATEFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/MODFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestMODFunctionModifier.java
Modified:
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestLOCATEFunctionModifier.java
Log:
TEIID-754: LOCATE() function isn't being translated correctly by Oracle Connector

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -34,8 +34,8 @@
 import org.teiid.connector.api.TypeFacility;
 import org.teiid.connector.api.TypeFacility.RUNTIME_TYPES;
 import org.teiid.connector.jdbc.translator.AliasModifier;
-import org.teiid.connector.jdbc.translator.LOCATEFunctionModifier;
-import org.teiid.connector.jdbc.translator.MODFunctionModifier;
+import org.teiid.connector.jdbc.translator.LocateFunctionModifier;
+import org.teiid.connector.jdbc.translator.ModFunctionModifier;
 import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IExpression;
@@ -59,14 +59,14 @@
         registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$ 
-        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LOCATEFunctionModifier(getLanguageFactory(), "LOCATE")); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));
         registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$ 
 
         List<Class<?>> supportedModTypes = new ArrayList<Class<?>>(3);
         supportedModTypes.add(RUNTIME_TYPES.SHORT);
         supportedModTypes.add(RUNTIME_TYPES.INTEGER);
         supportedModTypes.add(RUNTIME_TYPES.LONG);
-        registerFunctionModifier(SourceSystemFunctions.MOD, new MODFunctionModifier(getLanguageFactory(), "MOD", supportedModTypes));  //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier(getLanguageFactory(), "MOD", supportedModTypes));  //$NON-NLS-1$
     }
 		
 	@SuppressWarnings("unchecked")

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -29,7 +29,6 @@
 import org.teiid.connector.jdbc.db2.DB2SQLTranslator;
 import org.teiid.connector.jdbc.oracle.LeftOrRightFunctionModifier;
 import org.teiid.connector.jdbc.translator.EscapeSyntaxModifier;
-import org.teiid.connector.jdbc.translator.LOCATEFunctionModifier;
 
 
 
@@ -47,7 +46,6 @@
         registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new EscapeSyntaxModifier()); 
         registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new EscapeSyntaxModifier()); 
         registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));
-        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LOCATEFunctionModifier(getLanguageFactory(), "LOCATE")); //$NON-NLS-1$
         
         //overrides of db2 functions
         registerFunctionModifier(SourceSystemFunctions.CONCAT, new EscapeSyntaxModifier()); 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -33,7 +33,7 @@
 import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.SourceSystemFunctions;
-import org.teiid.connector.jdbc.translator.LOCATEFunctionModifier;
+import org.teiid.connector.jdbc.translator.LocateFunctionModifier;
 import org.teiid.connector.jdbc.translator.Translator;
 
 
@@ -51,7 +51,7 @@
         registerFunctionModifier(SourceSystemFunctions.BITNOT, new BitFunctionModifier("~", getLanguageFactory())); //$NON-NLS-1$
         registerFunctionModifier(SourceSystemFunctions.BITOR, new BitFunctionModifier("|", getLanguageFactory())); //$NON-NLS-1$
         registerFunctionModifier(SourceSystemFunctions.BITXOR, new BitFunctionModifier("^", getLanguageFactory())); //$NON-NLS-1$
-        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LOCATEFunctionModifier(getLanguageFactory(), "LOCATE")); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));
     }  
 	
 	@Override

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -42,9 +42,8 @@
 import org.teiid.connector.jdbc.JDBCPlugin;
 import org.teiid.connector.jdbc.translator.AliasModifier;
 import org.teiid.connector.jdbc.translator.ExtractFunctionModifier;
-import org.teiid.connector.jdbc.translator.LOCATEFunctionModifier;
+import org.teiid.connector.jdbc.translator.LocateFunctionModifier;
 import org.teiid.connector.jdbc.translator.Translator;
-import org.teiid.connector.jdbc.translator.LOCATEFunctionModifier.ParameterOrder;
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IElement;
 import org.teiid.connector.language.IFunction;
@@ -98,7 +97,7 @@
         registerFunctionModifier(SourceSystemFunctions.QUARTER, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "Q"));//$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "D"));//$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "DDD"));//$NON-NLS-1$ 
-        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LOCATEFunctionModifier(getLanguageFactory(), "INSTR", ParameterOrder.SOURCE_SEARCH_INDEX)); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory(), "INSTR", true)); //$NON-NLS-1$
         registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr"));//$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));
         registerFunctionModifier(SourceSystemFunctions.RIGHT, new LeftOrRightFunctionModifier(getLanguageFactory()));

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LOCATEFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LOCATEFunctionModifier.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LOCATEFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.jdbc.postgresql;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.ILanguageFactory;
-
-public class LOCATEFunctionModifier extends org.teiid.connector.jdbc.translator.LOCATEFunctionModifier {
-	
-	public LOCATEFunctionModifier(ILanguageFactory factory) {
-		super(factory);
-	}
-
-	@Override
-	public List<?> translate(IFunction function) {
-		List<Object> parts = new ArrayList<Object>();
-		List<IExpression> params = function.getParameters();
-		parts.add("position("); //$NON-NLS-1$
-		parts.add(params.get(0));		
-		parts.add(" in "); //$NON-NLS-1$
-		if (params.size() == 3) {
-			parts.add(this.getLanguageFactory().createFunction("substr", params.subList(1, 3), TypeFacility.RUNTIME_TYPES.STRING)); //$NON-NLS-1$
-		} else {
-			parts.add(params.get(1));
-		}
-		parts.add(")"); //$NON-NLS-1$
-		return parts;
-	}
-	
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LocateFunctionModifier.java (from rev 1264, trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LOCATEFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LocateFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LocateFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.jdbc.postgresql;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IFunction;
+import org.teiid.connector.language.ILanguageFactory;
+
+public class LocateFunctionModifier extends org.teiid.connector.jdbc.translator.LocateFunctionModifier {
+	
+	public LocateFunctionModifier(ILanguageFactory factory) {
+		super(factory);
+	}
+
+	@Override
+	public List<?> translate(IFunction function) {
+		List<Object> parts = new ArrayList<Object>();
+		List<IExpression> params = function.getParameters();
+		parts.add("position("); //$NON-NLS-1$
+		parts.add(params.get(0));		
+		parts.add(" in "); //$NON-NLS-1$
+		if (params.size() == 3) {
+			parts.add(this.getLanguageFactory().createFunction("substr", params.subList(1, 3), TypeFacility.RUNTIME_TYPES.STRING)); //$NON-NLS-1$
+		} else {
+			parts.add(params.get(1));
+		}
+		parts.add(")"); //$NON-NLS-1$
+		return parts;
+	}
+	
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/LocateFunctionModifier.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -95,7 +95,7 @@
         registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.CONVERT, new PostgreSQLConvertModifier(getLanguageFactory())); 
         
-        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LOCATEFunctionModifier(getLanguageFactory()));
+        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));
     }    
     
     @Override

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LOCATEFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LOCATEFunctionModifier.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LOCATEFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -1,323 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.jdbc.translator;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
-import org.teiid.connector.jdbc.translator.FunctionModifier;
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.ILanguageFactory;
-import org.teiid.connector.language.ILiteral;
-import org.teiid.connector.language.ICompareCriteria.Operator;
-
-
-/**
- * A modifier class that can be used to translate the scalar function 
- * <code>locate(search_string, source_string)</code> and 
- * <code>locate(search_string, source_string, start_index)</code> to a function 
- * or expression that can be used at the data source.
- * <p>
- * If the default implementation is used, a function name of LOCATE will be used 
- * for the function name.
- * <p>
- * If the default implementation is used, the expression will not be modified if: 
- * <li><code>locate(search_string, source_string)</code> is used</li>
- * <li><code>locate(search_string, source_string, start_index)</code> is used 
- * and <code>start_index</code> is a literal integer greater then 0</li>
- * <li>the default function parameter order is used or unspecified</li>
- * <p>
- * If the default implementation is used, the expression will be modified if: 
- * <li><code>locate(search_string, source_string, start_index)</code> is used 
- * and <code>start_index</code> is a literal integer less then 1</li>  
- * <li><code>locate(search_string, source_string, start_index)</code> is used 
- * and <code>start_index</code> is not a literal integer</li> 
- * <li>the function parameter order is something other than the default</li>
- * <p>
- * If the default implementation is used and the expression is modified, it is 
- * modified to ensure that any literal integer value less than 1 is made equal 
- * to 1 and any non literal value is wrapped by a searched case expression 
- * to ensure that a value of less then 1 will be equal to 1 and the parameter 
- * order matches that of what the data source expects.
- * <p>
- * For example:
- * <li><code>locate('a', 'abcdef')</code> --> <code>LOCATE('a', 'abcdef')</code></li>
- * <li><code>locate('a', 'abcdef', 2)</code> --> <code>LOCATE('a', 'abcdef', 2)</code></li>
- * <li><code>locate('a', 'abcdef', 0)</code> --> <code>LOCATE('a', 'abcdef', 1)</code></li>
- * <li><code>locate('a', 'abcdef', intCol)</code> --> <code>LOCATE('a', 'abcdef', CASE WHEN intCol < 1 THEN 1 ELSE intCol END)</code></li>
- * 
- * @since 6.2
- */
-public class LOCATEFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
-
-	/**
-	 * An <code>enum</code> that defines the parameter orders that can be used 
-	 * with <code>LOCATEFunctionModifier</code>
-	 * 
-	 */
-	public static enum ParameterOrder {
-		/**
-		 * Indicates that the parameter order should be consistent with the 
-		 * built-in system function <code>LOCATE(searchStr, sourceStr, startIndex)</code>.
-		 */
-		DEFAULT,
-		
-		/**
-		 * Indicates that the parameter order should be changed from the default 
-		 * built-in system function <code>LOCATE(searchStr, sourceStr, startIndex)</code> 
-		 * to <code>LOCATE(sourceStr, searchStr, startIndex)</code>.
-		 */
-		SOURCE_SEARCH_INDEX,
-
-		/**
-		 * Indicates that the parameter order should be changed from the default 
-		 * built-in system function <code>LOCATE(searchStr, sourceStr, startIndex)</code> 
-		 * to <code>LOCATE(startIndex, sourceStr, searchStr)</code>.
-		 */
-		INDEX_SOURCE_SEARCH 
-
-	}
-	
-    private ILanguageFactory langFactory;
-    private String functionName = "LOCATE"; //$NON-NLS-1$
-    private ParameterOrder parameterOrder = ParameterOrder.DEFAULT;
-    private final Integer systemStringIndexBase = 1;
-    
-	/**
-	 * Constructs a {@link BasicFunctionModifier} object that can be used to 
-	 * translate the scalar function LOCATE() to a source specific scalar 
-	 * function or expression.
-	 * <p>
-	 * This constructor invokes {@link #LOCATEFunctionModifier(ILanguageFactory, String, ParameterOrder)}
-	 * passing it <code>langFactory</code>, <code>null</code>, <code>null</code>.
-	 * 
-	 * @param langFactory the language factory associated with translation
-	 */
-    public LOCATEFunctionModifier(ILanguageFactory langFactory) {
-    	this(langFactory, null, null);
-    }
-
-	/**
-	 * Constructs a {@link BasicFunctionModifier} object that can be used to 
-	 * translate the scalar function LOCATE() to a source specific scalar 
-	 * function or expression.
-	 * <p>
-	 * This constructor invokes {@link #LOCATEFunctionModifier(ILanguageFactory, String, ParameterOrder)}
-	 * passing it <code>langFactory</code>, <code>functionName</code>, 
-	 * <code>null</code>.
-	 * 
-	 * @param langFactory the language factory associated with translation
-	 * @param functionName the function name or alias to be used instead of LOCATE
-	 */
-    public LOCATEFunctionModifier(ILanguageFactory langFactory, final String functionName) {
-    	this(langFactory, functionName, null);
-    }
-
-	/**
-	 * Constructs a {@link BasicFunctionModifier} object that can be used to 
-	 * translate the scalar function LOCATE() to a source specific scalar 
-	 * function or expression.
-	 * <p>
-	 * <code>functionName</code> should represent the default function name or 
-	 * alias used by the data source.  If this value is <code>null</code> a 
-	 * default value will be used.
-	 * <p>
-	 * <code>paramOrder</code> should represent how the data source's version of
-	 * the LOCATE() function expects its parameters.  This value can be any 
-	 * supported value offered by {@link ParameterOrder}.  If this value is 
-	 * <code>null</code> a default value will be used.
-	 * <p> 
-	 * 
-	 * @param langFactory the language factory associated with translation
-	 * @param functionName the function name or alias to be used instead of 
-	 *        LOCATE, or <code>null</code> if the default should be used
-	 * @param paramOrder the order in which parameters should be translated, or 
-	 *        <code>null</code> if the default should be used
-	 */
-    public LOCATEFunctionModifier(ILanguageFactory langFactory, final String functionName, final ParameterOrder paramOrder) {
-    	if (functionName != null) this.functionName = functionName;
-        if (paramOrder != null) this.parameterOrder = paramOrder;
-        this.langFactory = langFactory;
-    }
-    
-	/**
-	 * Returns a version of <code>function</code> suitable for executing at the 
-	 * data source.
-	 * <p>
-	 * First, a default function name or the value specified during construction 
-	 * of <code>MODFunctionModifier</code> is set on <code>function</code>.
-	 * <p>
-	 * If <code>function</code> represents <code>LOCATE(searchStr, sourceStr, startIndex)</code>
-	 * and <code>startIndex</code> is a literal value, it is translated for 
-	 * consistency between the built-in system function 
-	 * <code>LOCATE(searchStr, sourceStr, startIndex)</code> and the sources 
-	 * implementation.  This is done by calling {@link #getStartIndexExpression(ILiteral)} 
-	 * and passing it the literal <code>startIndex</code> value.
-	 * <p>
-	 * If <code>function</code> represents <code>LOCATE(searchStr, sourceStr, startIndex)</code>
-	 * and <code>startIndex</code> is not a literal value, it is translated for 
-	 * consistency between the built-in system function 
-	 * <code>LOCATE(searchStr, sourceStr, startIndex)</code> and the sources 
-	 * implementation.  This is done by calling {@link #getStartIndexExpression(IExpression)} 
-	 * and passing it the non-literal <code>startIndex</code> value.
-	 * <p>
-	 * Finally, <code>function</code>'s parameters may be rearranged depending 
-	 * on the value specified by {@link ParameterOrder} during construction of 
-	 * <code>MODFunctionModifier</code>.
-	 * <p>
-	 * The translated <code>function</code> is then returned.
-	 * <p>
-	 * For example:
-	 * <ul>
-	 * <code>locate('a', 'abcdefg')  --->  LOCATE('a', 'abcdefg')</code><br />
-	 * <code>locate('a', 'abcdefg', 1)  --->  LOCATE('a', 'abcdefg', 1)</code><br />
-	 * <code>locate('a', 'abcdefg', 1)  --->  INSTR('abcdefg', 'a', 1)</code><br />
-	 * <code>locate('a', 'abcdefg', -5)  --->  INSTR('abcdefg', 'a', 1)</code><br />
-	 * <code>locate('a', 'abcdefg', 1)  --->  FINDSTR('a', 'abcdefg', 1)</code><br />
-	 * <code>locate('a', 'abcdefg', myCol)  --->  LOCATE('a', 'abcdefg', CASE WHEN myCol < 1 THEN 1 ELSE myCol END)</code>
-	 * </ul>
-	 * 
-	 * @param function the LOCATE function that may need to be modified
-	 */
-    public IExpression modify(IFunction function) {
-    	function.setName(this.functionName);
-        List<IExpression> args = function.getParameters();
-        IExpression searchStr = args.get(0);
-        IExpression sourceStr = args.get(1);
-        IExpression startIndex = (args.size() > 2 ? args.get(2) : null);
-
-        // if startIndex was given then we may need to do additional work
-        if (startIndex != null) {
-        	if (startIndex instanceof ILiteral) {
-        		startIndex = this.getStartIndexExpression((ILiteral)startIndex);
-        	} else {
-        		startIndex = this.getStartIndexExpression((IExpression)startIndex);
-        	}
-        }
-		switch (this.parameterOrder) {
-		case SOURCE_SEARCH_INDEX:
-			args.set(0, sourceStr);
-			args.set(1, searchStr);
-			if (startIndex != null) args.set(2, startIndex);
-			break;
-		case INDEX_SOURCE_SEARCH:
-			if (startIndex != null) args.set(0, startIndex);
-			args.set(1, sourceStr);
-			args.set(2, searchStr);
-			break;
-		case DEFAULT:
-			args.set(0, searchStr);
-			args.set(1, sourceStr);
-			if (startIndex != null) args.set(2, startIndex);
-			break;
-		}
-        return function;           
-    }
-
-	/**
-	 * Return an expression that represents <code>startIndex</code> rewritten to 
-	 * be consistent with the built-in system function's 
-	 * <code>LOCATE(searchStr, sourceStr, startIndex)</code> <code>startIndex</code>
-	 * parameter.
-	 * <p>
-	 * <code>startIndex</code> represents the unmodified parameter as passed to 
-	 * the <code>LOCATE(searchStr, sourceStr, startIndex)</code> function.  The 
-	 * returned value will represent a normalized version of the expression that 
-	 * is consistent to the built-in system function.  For example, a value for  
-	 * <code>startIndex</code> should not be less than <code>1</code>.  
-	 * <p>
-	 * If this method is not overriden, the result will be:
-	 * <p>
-	 * <ul>If <code>startIndex</code> is <code>null</code>, <code>startIndex</code></ul>
-	 * <ul>If <code>startIndex</code> is not <code>null</code> and its value is 
-	 * less than <code>1</code>, <code>1</code></ul>
-	 *   
-	 * @param startIndex an expression representing the <code>startIndex</code> 
-	 *        parameter used in <code>LOCATE(searchStr, sourceStr, startIndex)</code>
-	 * @return an expression that represents a normalized <code>startIndex</code>
-	 */
-    protected IExpression getStartIndexExpression(ILiteral startIndex) {
-    	if (startIndex.getValue() != null) {
-			if ((Integer)startIndex.getValue() < this.getSystemStringIndexBase()) {
-				startIndex.setValue(this.getSystemStringIndexBase());
-			}
-    	}
-    	return startIndex;
-    }
-
-	/**
-	 * Return an expression that represents <code>startIndex</code> rewritten to 
-	 * be consistent with the built-in system function's 
-	 * <code>LOCATE(searchStr, sourceStr, startIndex)</code> <code>startIndex</code>
-	 * parameter.
-	 * <p>
-	 * <code>startIndex</code> represents the unmodified parameter as passed to 
-	 * the <code>LOCATE(searchStr, sourceStr, startIndex)</code> function.  The 
-	 * returned value will represent a normalized version of the expression that 
-	 * is consistent to the built-in system function.  For example, a value for  
-	 * <code>startIndex</code> should not be less than <code>1</code>.  
-	 * <p>
-	 * If this method is not overriden, the result will be:
-	 * <p>
-	 * <ul><code>CASE WHEN &lt;startIndex&gt; &lt; 1; THEN 1; ELSE &lt;startIndex&gt; END</code></ul>
-	 * <p>
-	 * For the default searched case expression to work, the source must support 
-	 * searched case.
-	 *   
-	 * @param startIndex an expression representing the <code>startIndex</code> 
-	 *        parameter used in <code>LOCATE(searchStr, sourceStr, startIndex)</code>
-	 * @return an expression that represents a normalized <code>startIndex</code>
-	 */
-    protected IExpression getStartIndexExpression(IExpression startIndex) {
-    	ICompareCriteria[] whenExpr = {langFactory.createCompareCriteria(
-    			Operator.LT, 
-    			startIndex, 
-    			langFactory.createLiteral(this.getSystemStringIndexBase(), Integer.class)
-    		)};
-    	ILiteral[] thenExpr = {langFactory.createLiteral(this.getSystemStringIndexBase(), Integer.class)};
-    	return langFactory.createSearchedCaseExpression(Arrays.asList(whenExpr), Arrays.asList(thenExpr), startIndex, Integer.class);
-    }
-
-    /**
-     * Get the string index base used by built-in system functions.  The value  
-     * represents what is considered the first character of a string.
-     * 
-     * @return the data source's string index base
-     */
-    protected Integer getSystemStringIndexBase() {
-    	return this.systemStringIndexBase;
-    }
-    
-    /**
-     * Get the instance of {@link ILanguageFactory} set during construction.
-     * 
-     * @return the <code>ILanguageFactory</code> instance
-     */
-	protected ILanguageFactory getLanguageFactory() {
-		return this.langFactory;
-	}
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LocateFunctionModifier.java (from rev 1264, trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LOCATEFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LocateFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LocateFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.jdbc.translator;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.language.ICompareCriteria;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IFunction;
+import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.ICompareCriteria.Operator;
+
+
+/**
+ * A modifier class that can be used to translate the scalar function 
+ * <code>locate(search_string, source_string)</code> and 
+ * <code>locate(search_string, source_string, start_index)</code> to a function 
+ * or expression that can be used at the data source.
+ * <p>
+ * If the default implementation is used, a function name of LOCATE will be used 
+ * for the function name.
+ * <p>
+ * If the default implementation is used, the expression will not be modified if: 
+ * <li><code>locate(search_string, source_string)</code> is used</li>
+ * <li><code>locate(search_string, source_string, start_index)</code> is used 
+ * and <code>start_index</code> is a literal integer greater then 0</li>
+ * <li>the default function parameter order is used or unspecified</li>
+ * <p>
+ * If the default implementation is used, the expression will be modified if: 
+ * <li><code>locate(search_string, source_string, start_index)</code> is used 
+ * and <code>start_index</code> is a literal integer less then 1</li>  
+ * <li><code>locate(search_string, source_string, start_index)</code> is used 
+ * and <code>start_index</code> is not a literal integer</li> 
+ * <li>the function parameter order is something other than the default</li>
+ * <p>
+ * If the default implementation is used and the expression is modified, it is 
+ * modified to ensure that any literal integer value less than 1 is made equal 
+ * to 1 and any non literal value is wrapped by a searched case expression 
+ * to ensure that a value of less then 1 will be equal to 1 and the parameter 
+ * order matches that of what the data source expects.
+ * <p>
+ * For example:
+ * <li><code>locate('a', 'abcdef')</code> --> <code>LOCATE('a', 'abcdef')</code></li>
+ * <li><code>locate('a', 'abcdef', 2)</code> --> <code>LOCATE('a', 'abcdef', 2)</code></li>
+ * <li><code>locate('a', 'abcdef', 0)</code> --> <code>LOCATE('a', 'abcdef', 1)</code></li>
+ * <li><code>locate('a', 'abcdef', intCol)</code> --> <code>LOCATE('a', 'abcdef', CASE WHEN intCol < 1 THEN 1 ELSE intCol END)</code></li>
+ * 
+ * @since 6.2
+ */
+public class LocateFunctionModifier extends BasicFunctionModifier {
+
+	public static String LOCATE = "LOCATE"; //$NON-NLS-1$
+	
+    private ILanguageFactory langFactory;
+    private String functionName = LOCATE;
+    private boolean sourceStringFirst;
+    
+	/**
+	 * Constructs a {@link BasicFunctionModifier} object that can be used to 
+	 * translate the scalar function LOCATE() to a source specific scalar 
+	 * function or expression.
+	 * 
+	 * @param langFactory the language factory associated with translation
+	 */
+    public LocateFunctionModifier(ILanguageFactory langFactory) {
+    	this(langFactory, LOCATE, false);
+    }
+
+	/**
+	 * Constructs a {@link BasicFunctionModifier} object that can be used to 
+	 * translate the scalar function LOCATE() to a source specific scalar 
+	 * function or expression.
+	 * 
+	 * @param langFactory the language factory associated with translation
+	 * @param functionName the function name or alias to be used instead of LOCATE
+	 * @param sourceStringFirst
+	 */
+    public LocateFunctionModifier(ILanguageFactory langFactory, final String functionName, boolean sourceStringFirst) {
+    	this.langFactory = langFactory;
+    	this.functionName = functionName;
+    	this.sourceStringFirst = sourceStringFirst;
+    }
+
+	/**
+	 * Returns a version of <code>function</code> suitable for executing at the 
+	 * data source.
+	 * <p>
+	 * First, a default function name or the value specified during construction 
+	 * of <code>MODFunctionModifier</code> is set on <code>function</code>.
+	 * <p>
+	 * If <code>function</code> represents <code>LOCATE(searchStr, sourceStr, startIndex)</code>
+	 * and <code>startIndex</code> is a literal value, it is translated for 
+	 * consistency between the built-in system function 
+	 * <code>LOCATE(searchStr, sourceStr, startIndex)</code> and the sources 
+	 * implementation.  This is done by calling {@link #getStartIndexExpression(ILiteral)} 
+	 * and passing it the literal <code>startIndex</code> value.
+	 * <p>
+	 * If <code>function</code> represents <code>LOCATE(searchStr, sourceStr, startIndex)</code>
+	 * and <code>startIndex</code> is not a literal value, it is translated for 
+	 * consistency between the built-in system function 
+	 * <code>LOCATE(searchStr, sourceStr, startIndex)</code> and the sources 
+	 * implementation.  This is done by calling {@link #getStartIndexExpression(IExpression)} 
+	 * and passing it the non-literal <code>startIndex</code> value.
+	 * <p>
+	 * Finally, <code>function</code>'s parameters may be rearranged depending 
+	 * on the value specified by {@link ParameterOrder} during construction of 
+	 * <code>MODFunctionModifier</code>.
+	 * <p>
+	 * The translated <code>function</code> is then returned.
+	 * <p>
+	 * For example:
+	 * <ul>
+	 * <code>locate('a', 'abcdefg')  --->  LOCATE('a', 'abcdefg')</code><br />
+	 * <code>locate('a', 'abcdefg', 1)  --->  LOCATE('a', 'abcdefg', 1)</code><br />
+	 * <code>locate('a', 'abcdefg', 1)  --->  INSTR('abcdefg', 'a', 1)</code><br />
+	 * <code>locate('a', 'abcdefg', -5)  --->  INSTR('abcdefg', 'a', 1)</code><br />
+	 * <code>locate('a', 'abcdefg', 1)  --->  FINDSTR('a', 'abcdefg', 1)</code><br />
+	 * <code>locate('a', 'abcdefg', myCol)  --->  LOCATE('a', 'abcdefg', CASE WHEN myCol < 1 THEN 1 ELSE myCol END)</code>
+	 * </ul>
+	 * 
+	 * @param function the LOCATE function that may need to be modified
+	 */
+    public IExpression modify(IFunction function) {
+    	function.setName(this.functionName);
+        List<IExpression> args = function.getParameters();
+        IExpression searchStr = args.get(0);
+        IExpression sourceStr = args.get(1);
+
+        // if startIndex was given then we may need to do additional work
+        if (args.size() > 2) {
+        	args.set(2, ensurePositiveStartIndex(args.get(2)));
+        }
+        if (sourceStringFirst) {
+			args.set(0, sourceStr);
+			args.set(1, searchStr);
+        }
+        return function;
+    }
+
+	private IExpression ensurePositiveStartIndex(IExpression startIndex) {
+		if (startIndex instanceof ILiteral) {
+			ILiteral literal = (ILiteral)startIndex;  
+			if (literal.getValue() != null && ((Integer)literal.getValue() < 1)) {
+				literal.setValue(1);
+			}
+		} else {
+			ICompareCriteria[] whenExpr = {langFactory.createCompareCriteria(
+					Operator.LT, 
+					startIndex, 
+					langFactory.createLiteral(1, Integer.class)
+				)};
+			ILiteral[] thenExpr = {langFactory.createLiteral(1, Integer.class)};
+			startIndex = langFactory.createSearchedCaseExpression(Arrays.asList(whenExpr), Arrays.asList(thenExpr), startIndex, Integer.class);
+		}
+		return startIndex;
+	}
+	
+	/**
+     * Get the instance of {@link ILanguageFactory} set during construction.
+     * 
+     * @return the <code>ILanguageFactory</code> instance
+     */
+	protected ILanguageFactory getLanguageFactory() {
+		return this.langFactory;
+	}
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/LocateFunctionModifier.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/MODFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/MODFunctionModifier.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/MODFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -1,185 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.jdbc.translator;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.teiid.connector.api.TypeFacility.RUNTIME_TYPES;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.ILanguageFactory;
-
-/**
- * A modifier class that can be used to translate the scalar function 
- * <code>mod(x, y)</code> to a function or expression that can be used at the 
- * data source.
- * <p>
- * If the default implementation is used, a function name of MOD will be used 
- * for the alias name and the expression will be unmodified if the data type 
- * of the <code>x</code> parameter is one of {@link RUNTIME_TYPES#BYTE}, 
- * {@link RUNTIME_TYPES#SHORT}, {@link RUNTIME_TYPES#INTEGER}, or 
- * {@link RUNTIME_TYPES#LONG}.  If the data type is not one of these types, the
- * expression will be modified to return: <code>(x - (TRUNC((x / y), 0) * y))</code>
- * 
- * @since 6.2
- */
-public class MODFunctionModifier extends AliasModifier {
-
-	private static List<Class<?>> DEFAULT_TYPELIST = new ArrayList<Class<?>>(4);
-	static {
-		DEFAULT_TYPELIST.add(RUNTIME_TYPES.BYTE);
-		DEFAULT_TYPELIST.add(RUNTIME_TYPES.SHORT);
-		DEFAULT_TYPELIST.add(RUNTIME_TYPES.INTEGER);
-		DEFAULT_TYPELIST.add(RUNTIME_TYPES.LONG);
-	}
-	private static String DEFAULT_FUNCTIONNAME = "MOD"; //$NON-NLS-1$
-
-	private ILanguageFactory langFactory;
-	private List<Class<?>> supTypeList;
-    
-	/**
-	 * Constructs a {@link AliasModifier} object that can be used to translate 
-	 * the use of the scalar function MOD() to a source specific scalar function 
-	 * or expression.
-	 * <p>
-	 * This constructor invokes {@link #MODFunctionModifier(ILanguageFactory, String, List)}
-	 * passing it <code>langFactory</code>, {@link #DEFAULT_FUNCTIONNAME}, and 
-	 * {@link #DEFAULT_TYPELIST}.
-	 * 
-	 * @param langFactory the language factory associated with translation
-	 */
-    public MODFunctionModifier(ILanguageFactory langFactory) {
-    	this(langFactory, DEFAULT_FUNCTIONNAME, DEFAULT_TYPELIST);
-    }
-	
-    /**
-	 * Constructs a {@link AliasModifier} object that can be used to translate 
-	 * the use of the scalar function MOD() to a source specific scalar function 
-	 * or expression.
-	 * <p>
-	 * <code>functionName</code> is used to construct the parent {@link AliasModifier}
-	 * and should represent the default function name or alias used by the data 
-	 * source.
-	 * <p>
-	 * <code>supportedTypeList</code> should contain a list of <code>Class</code> 
-	 * objects that represent the data types that the data source can support  
-	 * with its implementation of the MOD() scalar function.  
-     * 
-     * @param langFactory the language factory associated with translation
-     * @param functionName the function name or alias that should be used 
-     *                     instead of MOD
-     * @param supportedTypeList a list of type classes that is supported by the 
-     *                          data source's MOD function
-     */
-    public MODFunctionModifier(ILanguageFactory langFactory, String functionName, List<Class<?>>supportedTypeList) {
-    	super(functionName);
-        this.langFactory = langFactory;
-        if ( supportedTypeList != null ) {
-        	this.supTypeList = supportedTypeList;
-        } else {
-        	this.supTypeList = MODFunctionModifier.DEFAULT_TYPELIST;
-        }
-    }
-	
-	/**
-	 * Returns a version of <code>function</code> suitable for executing at the 
-	 * data source.
-	 * <p>
-	 * If the data type of the parameters in <code>function</code> is in the 
-	 * list of supported data types, this method simply returns <code>super.modify(function)</code>.
-	 * <p>
-	 * If the data type of the parameters in <code>function</code are not in the 
-	 * list of supported data types, this method will return an expression that 
-	 * is valid at the data source and will yield the same result as the original 
-	 * MOD() scalar function.  To build the expression, a call is make to 
-	 * {@link #getQuotientExpression(IExpression)} and its result is multiplied 
-	 * by the second parameter of <code>function</code> and that result is then 
-	 * subtracted from the first parameter of <code>function</code>.
-	 * <p>
-	 * For example:
-	 * <code>mod(x, y)  --->  (x - (getQuotientExpression((x / y)) * y))</code>
-	 * 
-	 * @param function the MOD function that may need to be modified
-	 * @see org.teiid.connector.jdbc.translator.AliasModifier#modify(org.teiid.connector.language.IFunction)
-	 */
-	@Override
-	public IExpression modify(IFunction function) {
-		List<IExpression> expressions = function.getParameters();
-		IExpression dividend = expressions.get(0);
-		IExpression divisor = expressions.get(1);
-
-		// Check to see if parameters are supported by source MOD function
-		if (this.supTypeList.contains(dividend.getType())) {
-			return super.modify(function);
-		}
-
-		/* 
-		 * Parameters are not supported by source MOD function so modify 
-		 * MOD(<dividend>, <divisor>)  -->  (<dividend> - (<func_getQuotient((<dividend> / <divisor>))> * <divisor>))
-		 */
-		// -->   (<dividend> / <divisor>)
-		IFunction divide = langFactory.createFunction("/", Arrays.asList(dividend, divisor), dividend.getType()); //$NON-NLS-1$
-		// -->   <func_getQuotient(<divide>)>  -- i.e. TRUNC(<divide>, 0)
-		IFunction quotient = (IFunction) this.getQuotientExpression(divide);
-		// -->   (<quotient> * <divisor>)
-		List<IExpression> multiplyArgs = Arrays.asList(quotient, divisor);
-		IFunction multiply = langFactory.createFunction("*", multiplyArgs, divisor.getType()); //$NON-NLS-1$
-		// -->   (<dividend> - <multiply>)
-		List<IExpression> minusArgs = Arrays.asList(dividend, multiply);
-		return langFactory.createFunction("-", minusArgs, dividend.getType()); //$NON-NLS-1$
-	}
-
-	/**
-	 * Return an expression that will result in the quotient of </code>division</code>. 
-	 * Quotient should always be represented as an integer (no remainder).
-	 * <p>
-	 * <code>division</code> will represent simple division that may result in a
-	 * fraction.  <code>division</code> should be returned within a helper 
-	 * function or expression that will result in an integer return value (no 
-	 * decimal or fraction).
-	 * <p>
-	 * If this method is not overriden, the result will be:
-	 * <p>
-	 * <ul>TRUNC(<code>division</code>, 0)</ul>
-	 * <p>
-	 * For the default TRUNC() function to work, the source must support it.  
-	 * TRUNC was used instead of FLOOR because FLOOR rounds to the nearest
-	 * integer toward negative infinity.  This would result in incorrect values 
-	 * when performing MOD on negative float, double, etc. values.
-	 *   
-	 * @param division an expression representing simple division
-	 * @return an expression that will extract the quotient from the 
-	 *         <code>division</code> expression
-	 */
-	protected IExpression getQuotientExpression(IExpression division) {
-		// -->   TRUNC(<division>, 0)
-		return langFactory.createFunction("TRUNC", Arrays.asList(division, langFactory.createLiteral(0, RUNTIME_TYPES.SHORT)), division.getType()); //$NON-NLS-1$
-	}
-
-	protected ILanguageFactory getLanguageFactory() {
-		return this.langFactory;
-	}
-	
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/ModFunctionModifier.java (from rev 1264, trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/MODFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/ModFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/ModFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.jdbc.translator;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.api.TypeFacility.RUNTIME_TYPES;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IFunction;
+import org.teiid.connector.language.ILanguageFactory;
+
+/**
+ * A modifier class that can be used to translate the scalar function 
+ * <code>mod(x, y)</code> to a function or expression that can be used at the 
+ * data source.
+ * <p>
+ * If the default implementation is used, a function name of MOD will be used 
+ * for the alias name and the expression will be unmodified if the data type 
+ * of the <code>x</code> parameter is one of {@link RUNTIME_TYPES#BYTE}, 
+ * {@link RUNTIME_TYPES#SHORT}, {@link RUNTIME_TYPES#INTEGER}, or 
+ * {@link RUNTIME_TYPES#LONG}.  If the data type is not one of these types, the
+ * expression will be modified to return: <code>(x - (TRUNC((x / y), 0) * y))</code>
+ * 
+ * @since 6.2
+ */
+public class ModFunctionModifier extends AliasModifier {
+
+	private static List<Class<?>> DEFAULT_TYPELIST = new ArrayList<Class<?>>(4);
+	static {
+		DEFAULT_TYPELIST.add(RUNTIME_TYPES.BYTE);
+		DEFAULT_TYPELIST.add(RUNTIME_TYPES.SHORT);
+		DEFAULT_TYPELIST.add(RUNTIME_TYPES.INTEGER);
+		DEFAULT_TYPELIST.add(RUNTIME_TYPES.LONG);
+	}
+	private static String DEFAULT_FUNCTIONNAME = "MOD"; //$NON-NLS-1$
+
+	private ILanguageFactory langFactory;
+	private List<Class<?>> supTypeList;
+    
+	/**
+	 * Constructs a {@link AliasModifier} object that can be used to translate 
+	 * the use of the scalar function MOD() to a source specific scalar function 
+	 * or expression.
+	 * <p>
+	 * This constructor invokes {@link #MODFunctionModifier(ILanguageFactory, String, List)}
+	 * passing it <code>langFactory</code>, {@link #DEFAULT_FUNCTIONNAME}, and 
+	 * {@link #DEFAULT_TYPELIST}.
+	 * 
+	 * @param langFactory the language factory associated with translation
+	 */
+    public ModFunctionModifier(ILanguageFactory langFactory) {
+    	this(langFactory, DEFAULT_FUNCTIONNAME, DEFAULT_TYPELIST);
+    }
+	
+    /**
+	 * Constructs a {@link AliasModifier} object that can be used to translate 
+	 * the use of the scalar function MOD() to a source specific scalar function 
+	 * or expression.
+	 * <p>
+	 * <code>functionName</code> is used to construct the parent {@link AliasModifier}
+	 * and should represent the default function name or alias used by the data 
+	 * source.
+	 * <p>
+	 * <code>supportedTypeList</code> should contain a list of <code>Class</code> 
+	 * objects that represent the data types that the data source can support  
+	 * with its implementation of the MOD() scalar function.  
+     * 
+     * @param langFactory the language factory associated with translation
+     * @param functionName the function name or alias that should be used 
+     *                     instead of MOD
+     * @param supportedTypeList a list of type classes that is supported by the 
+     *                          data source's MOD function
+     */
+    public ModFunctionModifier(ILanguageFactory langFactory, String functionName, List<Class<?>>supportedTypeList) {
+    	super(functionName);
+        this.langFactory = langFactory;
+        if ( supportedTypeList != null ) {
+        	this.supTypeList = supportedTypeList;
+        } else {
+        	this.supTypeList = ModFunctionModifier.DEFAULT_TYPELIST;
+        }
+    }
+	
+	/**
+	 * Returns a version of <code>function</code> suitable for executing at the 
+	 * data source.
+	 * <p>
+	 * If the data type of the parameters in <code>function</code> is in the 
+	 * list of supported data types, this method simply returns <code>super.modify(function)</code>.
+	 * <p>
+	 * If the data type of the parameters in <code>function</code are not in the 
+	 * list of supported data types, this method will return an expression that 
+	 * is valid at the data source and will yield the same result as the original 
+	 * MOD() scalar function.  To build the expression, a call is make to 
+	 * {@link #getQuotientExpression(IExpression)} and its result is multiplied 
+	 * by the second parameter of <code>function</code> and that result is then 
+	 * subtracted from the first parameter of <code>function</code>.
+	 * <p>
+	 * For example:
+	 * <code>mod(x, y)  --->  (x - (getQuotientExpression((x / y)) * y))</code>
+	 * 
+	 * @param function the MOD function that may need to be modified
+	 * @see org.teiid.connector.jdbc.translator.AliasModifier#modify(org.teiid.connector.language.IFunction)
+	 */
+	@Override
+	public IExpression modify(IFunction function) {
+		List<IExpression> expressions = function.getParameters();
+		IExpression dividend = expressions.get(0);
+		IExpression divisor = expressions.get(1);
+
+		// Check to see if parameters are supported by source MOD function
+		if (this.supTypeList.contains(dividend.getType())) {
+			return super.modify(function);
+		}
+
+		/* 
+		 * Parameters are not supported by source MOD function so modify 
+		 * MOD(<dividend>, <divisor>)  -->  (<dividend> - (<func_getQuotient((<dividend> / <divisor>))> * <divisor>))
+		 */
+		// -->   (<dividend> / <divisor>)
+		IFunction divide = langFactory.createFunction("/", Arrays.asList(dividend, divisor), dividend.getType()); //$NON-NLS-1$
+		// -->   <func_getQuotient(<divide>)>  -- i.e. TRUNC(<divide>, 0)
+		IFunction quotient = (IFunction) this.getQuotientExpression(divide);
+		// -->   (<quotient> * <divisor>)
+		List<IExpression> multiplyArgs = Arrays.asList(quotient, divisor);
+		IFunction multiply = langFactory.createFunction("*", multiplyArgs, divisor.getType()); //$NON-NLS-1$
+		// -->   (<dividend> - <multiply>)
+		List<IExpression> minusArgs = Arrays.asList(dividend, multiply);
+		return langFactory.createFunction("-", minusArgs, dividend.getType()); //$NON-NLS-1$
+	}
+
+	/**
+	 * Return an expression that will result in the quotient of </code>division</code>. 
+	 * Quotient should always be represented as an integer (no remainder).
+	 * <p>
+	 * <code>division</code> will represent simple division that may result in a
+	 * fraction.  <code>division</code> should be returned within a helper 
+	 * function or expression that will result in an integer return value (no 
+	 * decimal or fraction).
+	 * <p>
+	 * If this method is not overriden, the result will be:
+	 * <p>
+	 * <ul>TRUNC(<code>division</code>, 0)</ul>
+	 * <p>
+	 * For the default TRUNC() function to work, the source must support it.  
+	 * TRUNC was used instead of FLOOR because FLOOR rounds to the nearest
+	 * integer toward negative infinity.  This would result in incorrect values 
+	 * when performing MOD on negative float, double, etc. values.
+	 *   
+	 * @param division an expression representing simple division
+	 * @return an expression that will extract the quotient from the 
+	 *         <code>division</code> expression
+	 */
+	protected IExpression getQuotientExpression(IExpression division) {
+		// -->   TRUNC(<division>, 0)
+		return langFactory.createFunction("TRUNC", Arrays.asList(division, langFactory.createLiteral(0, RUNTIME_TYPES.SHORT)), division.getType()); //$NON-NLS-1$
+	}
+
+	protected ILanguageFactory getLanguageFactory() {
+		return this.langFactory;
+	}
+	
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/ModFunctionModifier.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestLOCATEFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestLOCATEFunctionModifier.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestLOCATEFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -31,11 +31,9 @@
 import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.SourceSystemFunctions;
-import org.teiid.connector.jdbc.translator.LOCATEFunctionModifier.ParameterOrder;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
-import org.teiid.connector.language.ILiteral;
 
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
@@ -60,7 +58,7 @@
      * @throws Exception
      */
     public IExpression helpTestLocate(IExpression[] args, String expectedStr) throws Exception {
-    	return this.helpTestLocate(null, null, args, expectedStr);
+    	return this.helpTestLocate(LocateFunctionModifier.LOCATE, false, args, expectedStr);
     }
 
     /**
@@ -82,7 +80,7 @@
      * @return On success, the modified expression.
      * @throws Exception
      */
-    public IExpression helpTestLocate(final String locateFunctionName, final ParameterOrder parameterOrder, IExpression[] args, String expectedStr) throws Exception {
+    public IExpression helpTestLocate(final String locateFunctionName, final boolean parameterOrder, IExpression[] args, String expectedStr) throws Exception {
     	IExpression param1 = null;
     	IExpression param2 = null;
     	IExpression param3 = null;
@@ -106,7 +104,7 @@
 			public void initialize(ConnectorEnvironment env)
 					throws ConnectorException {
 				super.initialize(env);
-				registerFunctionModifier(SourceSystemFunctions.LOCATE, new LOCATEFunctionModifier(getLanguageFactory(), locateFunctionName, parameterOrder));
+				registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory(), locateFunctionName, parameterOrder));
 			}
     	};
     	
@@ -123,11 +121,11 @@
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str) using constants for both parameters 
      * returns LOCATE(search_str, source_str). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed without specifying a 
+     * {@link LocateFunctionModifier} will be constructed without specifying a 
      * function name or parameter order.
      * 
      * @throws Exception
@@ -142,11 +140,11 @@
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str) using constants for both parameters 
      * returns locate(search_str, source_str). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying a function  
+     * {@link LocateFunctionModifier} will be constructed specifying a function  
      * name of locate but no parameter order.
      * 
      * @throws Exception
@@ -157,15 +155,15 @@
                 LANG_FACTORY.createLiteral("abcdefg", String.class) //$NON-NLS-1$
         };
         // locate / default
-        helpTestLocate("locate", null, args, "locate('a', 'abcdefg')"); //$NON-NLS-1$ //$NON-NLS-2$
+        helpTestLocate("locate", false, args, "locate('a', 'abcdefg')"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str) using constants for both parameters 
      * returns INSTR(source_str, search_str). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying a function  
+     * {@link LocateFunctionModifier} will be constructed specifying a function  
      * name of INSTR and a parameter order of {@link ParameterOrder#SOURCE_SEARCH_INDEX}. 
      * 
      * @throws Exception
@@ -176,15 +174,15 @@
                 LANG_FACTORY.createLiteral("abcdefg", String.class) //$NON-NLS-1$
         };
         // INSTR / SOURCE_SEARCH_INDEX
-        helpTestLocate("INSTR", ParameterOrder.SOURCE_SEARCH_INDEX, args, "INSTR('abcdefg', 'a')"); //$NON-NLS-1$ //$NON-NLS-2$
+        helpTestLocate("INSTR", true, args, "INSTR('abcdefg', 'a')"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str) using constants for both parameters 
      * returns locate(search_str, source_str). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying a function  
+     * {@link LocateFunctionModifier} will be constructed specifying a function  
      * name of locate and a parameter order of {@link ParameterOrder#DEFAULT}.
      * 
      * @throws Exception
@@ -195,15 +193,15 @@
                 LANG_FACTORY.createLiteral("abcdefg", String.class) //$NON-NLS-1$
         };
         // locate / DEFAULT
-        helpTestLocate("locate", ParameterOrder.DEFAULT, args, "locate('a', 'abcdefg')"); //$NON-NLS-1$ //$NON-NLS-2$
+        helpTestLocate("locate", false, args, "locate('a', 'abcdefg')"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str, 1) using constants for all parameters 
      * returns INSTR(source_str, search_str, 1). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying a function  
+     * {@link LocateFunctionModifier} will be constructed specifying a function  
      * name of INSTR and a parameter order of {@link ParameterOrder#SOURCE_SEARCH_INDEX}.
      * 
      * @throws Exception
@@ -215,15 +213,15 @@
                 LANG_FACTORY.createLiteral(1, Integer.class)
         };
         // INSTR / SOURCE_SEARCH_INDEX
-        helpTestLocate("INSTR", ParameterOrder.SOURCE_SEARCH_INDEX, args, "INSTR('abcdefg', 'a', 1)"); //$NON-NLS-1$ //$NON-NLS-2$
+        helpTestLocate("INSTR", true, args, "INSTR('abcdefg', 'a', 1)"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str, 4) using constants for all parameters 
      * returns LOCATE(search_str, source_str, 5). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying no function  
+     * {@link LocateFunctionModifier} will be constructed specifying no function  
      * name or parameter order.
      * 
      * @throws Exception
@@ -235,15 +233,15 @@
                 LANG_FACTORY.createLiteral(4, Integer.class)
         };
         // default / default
-        helpTestLocate(null, null, args, "LOCATE('a', 'abcdefg', 4)"); //$NON-NLS-1$
+        helpTestLocate(args, "LOCATE('a', 'abcdefg', 4)"); //$NON-NLS-1$
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str, -5) using constants for all parameters 
      * returns LOCATE(search_str, source_str, 1). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying no function  
+     * {@link LocateFunctionModifier} will be constructed specifying no function  
      * name or parameter order.
      * 
      * @throws Exception
@@ -255,15 +253,15 @@
                 LANG_FACTORY.createLiteral(-5, Integer.class)
         };
         // default / default
-        helpTestLocate(null, null, args, "LOCATE('a', 'abcdefg', 1)"); //$NON-NLS-1$
+        helpTestLocate(args, "LOCATE('a', 'abcdefg', 1)"); //$NON-NLS-1$
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str, null) using constants for all parameters 
      * returns LOCATE(search_str, source_str, NULL). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying no function  
+     * {@link LocateFunctionModifier} will be constructed specifying no function  
      * name or parameter order.
      * 
      * @throws Exception
@@ -275,15 +273,15 @@
                 LANG_FACTORY.createLiteral(null, Integer.class)
         };
         // default / default
-        helpTestLocate(null, null, args, "LOCATE('a', 'abcdefg', NULL)"); //$NON-NLS-1$
+        helpTestLocate(args, "LOCATE('a', 'abcdefg', NULL)"); //$NON-NLS-1$
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str, e1) using an element for start index 
      * parameter returns INSTR(source_str, search_str, CASE WHEN e1 < 1 THEN 1 ELSE e1 END). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying a function  
+     * {@link LocateFunctionModifier} will be constructed specifying a function  
      * name of INSTR and a parameter order of {@link ParameterOrder#SOURCE_SEARCH_INDEX}.
      * 
      * @throws Exception
@@ -295,15 +293,15 @@
                 LANG_FACTORY.createElement("e1", null, null, Integer.class) //$NON-NLS-1$
         };
         // INSTR / SOURCE_SEARCH_INDEX
-        helpTestLocate("INSTR", ParameterOrder.SOURCE_SEARCH_INDEX, args, "INSTR('abcdefg', 'a', CASE WHEN e1 < 1 THEN 1 ELSE e1 END)"); //$NON-NLS-1$ //$NON-NLS-2$
+        helpTestLocate("INSTR", true, args, "INSTR('abcdefg', 'a', CASE WHEN e1 < 1 THEN 1 ELSE e1 END)"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
+     * Test {@link LocateFunctionModifier#modify(IFunction)} to validate a call 
      * to LOCATE(search_str, source_str, e1) using an element for start index 
      * parameter returns LOCATE(search_str, source_str, CASE WHEN e1 < 0 THEN 0 ELSE e1 END). 
      * <p>
-     * {@link LOCATEFunctionModifier} will be constructed specifying no function  
+     * {@link LocateFunctionModifier} will be constructed specifying no function  
      * name and no parameter order.
      * 
      * @throws Exception
@@ -315,99 +313,7 @@
                 LANG_FACTORY.createElement("e1", null, null, Integer.class) //$NON-NLS-1$
         };
         // default / default
-        helpTestLocate(null, null, args, "LOCATE('a', 'abcdefg', CASE WHEN e1 < 1 THEN 1 ELSE e1 END)"); //$NON-NLS-1$
+        helpTestLocate(args, "LOCATE('a', 'abcdefg', CASE WHEN e1 < 1 THEN 1 ELSE e1 END)"); //$NON-NLS-1$
     }
-
-    /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
-     * to LOCATE(search_str, source_str, e1) using an element for start index 
-     * parameter returns LOCATE(search_str, source_str, e1).
-     * <p> 
-     * {@link LOCATEFunctionModifier} will be constructed specifying no function  
-     * name, no parameter order, and no string index base.  The test explicitly 
-     * overrides {@link LOCATEFunctionModifier#getStartIndexExpression(IExpression)} 
-     * to produce output that does not use the searched case expression for the 
-     * element. 
-     * 
-     * @throws Exception
-     */
-    @Test public void testOverrideGetStartIndexExpression() throws Exception {
-    	final String expectedStr = "LOCATE('a', 'abcdefg', e1)"; //$NON-NLS-1$
-    	
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral("a", String.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral("abcdefg", String.class), //$NON-NLS-1$
-                LANG_FACTORY.createElement("e1", null, null, Integer.class) //$NON-NLS-1$
-        };
-    	IFunction func = LANG_FACTORY.createFunction(SourceSystemFunctions.LOCATE, args, Integer.class);
-
-    	final Translator trans = new Translator() {
-			@Override
-			public void initialize(ConnectorEnvironment env)
-					throws ConnectorException {
-				super.initialize(env);
-				registerFunctionModifier(SourceSystemFunctions.LOCATE, new LOCATEFunctionModifier(getLanguageFactory(), null, null) {
-					@Override
-					protected IExpression getStartIndexExpression(
-							IExpression startIndex) {
-				    	return startIndex;
-					}
-					
-				});
-			}
-    	};
-
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-
-        IExpression expr = trans.getFunctionModifiers().get(SourceSystemFunctions.LOCATE).modify(func);
-        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
-        sqlVisitor.append(expr);
-        assertEquals("Modified function does not match", expectedStr, sqlVisitor.toString()); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link LOCATEFunctionModifier#modify(IFunction)} to validate a call 
-     * to LOCATE(search_str, source_str, 1) using a literal for start index 
-     * parameter returns LOCATE(search_str, source_str, (1 + 1)).
-     * <p> 
-     * {@link LOCATEFunctionModifier} will be constructed specifying no function  
-     * name, no parameter order.  The test explicitly overrides {@link LOCATEFunctionModifier#getStartIndexExpression(ILiteral)} 
-     * to produce output that adds <code>1</code> to the literal. 
-     * 
-     * @throws Exception
-     */
-    @Test public void testOverrideGetStartIndexExpression2() throws Exception {
-    	final String expectedStr = "LOCATE('a', 'abcdefg', (1 + 1))"; //$NON-NLS-1$
-    	
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral("a", String.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral("abcdefg", String.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(1, Integer.class)
-        };
-    	IFunction func = LANG_FACTORY.createFunction(SourceSystemFunctions.LOCATE, args, Integer.class);
-
-    	final Translator trans = new Translator() {
-			@Override
-			public void initialize(ConnectorEnvironment env)
-					throws ConnectorException {
-				super.initialize(env);
-				registerFunctionModifier(SourceSystemFunctions.LOCATE, new LOCATEFunctionModifier(getLanguageFactory(), null, null) {
-					@Override
-					protected IExpression getStartIndexExpression(
-							ILiteral startIndex) {
-				    	return LANG_FACTORY.createFunction("+", Arrays.asList(startIndex, LANG_FACTORY.createLiteral(1, Integer.class)), Integer.class); //$NON-NLS-1$
-					}
-					
-				});
-			}
-    	};
-
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-
-        IExpression expr = trans.getFunctionModifiers().get(SourceSystemFunctions.LOCATE).modify(func);
-        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
-        sqlVisitor.append(expr);
-        assertEquals("Modified function does not match", expectedStr, sqlVisitor.toString()); //$NON-NLS-1$
-    }
     
 }

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestMODFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestMODFunctionModifier.java	2009-08-19 19:50:56 UTC (rev 1264)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestMODFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -1,1253 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.jdbc.translator;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.SourceSystemFunctions;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.ILanguageFactory;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-
-/**
- * Test <code>ModFunctionModifier</code> by invoking its methods with varying 
- * parameters to validate it performs as designed and expected. 
- */
-public class TestMODFunctionModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestModFunctionModifier.
-     * @param name
-     */
-    public TestMODFunctionModifier(String name) {
-        super(name);
-    }
-
-
-    /**
-     * Create an expression containing a MOD function using <code>args</code> 
-     * and pass it to the <code>Translator</code>'s MOD function modifier and 
-     * compare the resulting expression to <code>expectedStr</code>.
-     * 
-     * @param args An array of <code>IExpression</code>'s to use as the 
-     *             arguments to the MOD() function
-     * @param expectedStr A string representing the modified expression
-     * @return On success, the modified expression.
-     * @throws Exception
-     */
-    public IExpression helpTestMod(IExpression[] args, String expectedStr) throws Exception {
-    	return this.helpTestMod(null, null, args, expectedStr);
-    }
-
-    /**
-     * Create an expression containing a MOD function using a function name of 
-     * <code>modFunctionName</code> which supports types of <code>supportedTypes</code>
-     * and uses the arguments <code>args</code> and pass it to the 
-     * <code>Translator</code>'s MOD function modifier and compare the resulting 
-     * expression to <code>expectedStr</code>.
-     *
-     * @param modFunctionName the name to use for the function modifier
-     * @param supportedTypes a list of types that the mod function should support
-     * @param args an array of <code>IExpression</code>'s to use as the 
-     *             arguments to the MOD() function
-     * @param expectedStr A string representing the modified expression
-     * @return On success, the modified expression.
-     * @throws Exception
-     */
-    public IExpression helpTestMod(final String modFunctionName, final List<Class<?>> supportedTypes, IExpression[] args, String expectedStr) throws Exception {
-    	IExpression param1 = null;
-    	IExpression param2 = null;
-    	
-    	if (args.length < 2) {
-    		param2 = LANG_FACTORY.createLiteral(null, Short.class);
-    		if (args.length < 1) {
-        		param1 = LANG_FACTORY.createLiteral(null, Short.class);
-    		} else {
-    			param1 = args[0];
-    		}
-    	} else {
-    		param1 = args[0];
-    		param2 = args[1];
-    	}
-    	
-    	if ( !param1.getType().equals(param2.getType()) ) {
-    		if (param2.getType().equals(BigDecimal.class)) {
-    			param1.setType(param2.getType());
-    		} else if (param1.getType().equals(BigDecimal.class)) {
-    			param2.setType(param1.getType());
-    		} else if (param2.getType().equals(BigInteger.class)) {
-    			param1.setType(param2.getType());
-    		} else if (param1.getType().equals(BigInteger.class)) {
-    			param2.setType(param1.getType());
-    		} else if (param2.getType().equals(Float.class)) {
-    			param1.setType(param2.getType());
-    		} else if (param1.getType().equals(Float.class)) {
-    			param2.setType(param1.getType());
-    		} else if (param2.getType().equals(Long.class)) {
-    			param1.setType(param2.getType());
-    		} else if (param1.getType().equals(Long.class)) {
-    			param2.setType(param1.getType());
-    		} else if (param2.getType().equals(Integer.class)) {
-    			param1.setType(param2.getType());
-    		} else if (param1.getType().equals(Integer.class)) {
-    			param2.setType(param1.getType());
-    		} else if (param2.getType().equals(Short.class)) {
-    			param1.setType(param2.getType());
-    		} else if (param1.getType().equals(Short.class)) {
-    			param2.setType(param1.getType());
-    		} else {
-    			throw new IllegalArgumentException("Parameters must be of numeric types"); //$NON-NLS-1$
-    		}
-    	}
-
-    	IFunction func = LANG_FACTORY.createFunction(modFunctionName,
-            Arrays.asList(param1, param2), param1.getType());
-
-    	Translator trans = new Translator() {
-			@Override
-			public void initialize(ConnectorEnvironment env)
-					throws ConnectorException {
-				super.initialize(env);
-				if (modFunctionName == null) {
-					registerFunctionModifier(SourceSystemFunctions.MOD, new MODFunctionModifier(getLanguageFactory()));
-				} else {
-					registerFunctionModifier(SourceSystemFunctions.MOD, new MODFunctionModifier(getLanguageFactory(), modFunctionName, supportedTypes));
-				}
-			}
-    	};
-    	
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-
-        IExpression expr = trans.getFunctionModifiers().get(SourceSystemFunctions.MOD).modify(func);
-        
-        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
-        sqlVisitor.append(expr);  
-        
-        assertEquals("Modified function does not match", expectedStr, sqlVisitor.toString()); //$NON-NLS-1$
-        
-        return expr;
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Short} constants for both parameters returns MOD(x,y). 
-     * {@link MODFunctionModifier} will be constructed without specifying a 
-     * function name or a supported type list.
-     * 
-     * @throws Exception
-     */
-    public void testTwoShortConst() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
-            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
-        };
-        // default / default
-        helpTestMod(args, "MOD(10, 6)"); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Short} constants for both parameters returns MOD(x,y). 
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "MOD" but without a supported type list.
-     *  
-     * @throws Exception
-     */
-    public void testTwoShortConst2() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
-            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
-        };
-        // mod / default 
-        helpTestMod("MOD", null, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Short} constants for both parameters returns MOD(x,y). 
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "MOD" and a supported type list which contains {@link Short}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoShortConst3() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
-            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
-        };
-        // mod / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Short} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" and a supported type list which 
-     * does not contains {@link Short}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoShortConst4() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
-            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
-        };
-        // mod / Integer
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Integer.class);
-        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Short} constants for both parameters returns (x % y).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and no supported type list. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoShortConst5() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
-            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
-        };
-        // % / default 
-        helpTestMod("%", null, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Short} constants for both parameters returns (x % y).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and a supported type list which contains {@link Short}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoShortConst6() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
-            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
-        };
-        // % / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Short} constants for both parameters returns 
-     * (10 - (TRUNC((10 / 6), 0) * 6)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and a supported type list does not 
-     * contain {@link Short}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoShortConst7() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
-            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
-        };
-        // % / Integer
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Integer.class);
-        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Integer} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed without 
-     * specifying a function name or a supported type list.
-     * 
-     * @throws Exception
-     */
-    public void testTwoIntConst() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
-        };
-        // default / default
-        helpTestMod(args, "MOD(10, 6)"); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Integer} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed with a 
-     * function name of "MOD" but without a supported type list.
-     *  
-     * @throws Exception
-     */
-    public void testTwoIntConst2() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
-        };
-        // mod / default 
-        helpTestMod("MOD", null, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Integer} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed with a 
-     * function name of "MOD" and a supported type list which contains {@link Integer}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoIntConst3() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
-        };
-        // mod / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Integer.class);
-        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Integer} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" and a supported type list which 
-     * does not contain {@link Integer}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoIntConst4() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
-        };
-        // mod / Integer
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Integer} constants for both parameters returns (x % y).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and no supported type list. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoIntConst5() throws Exception {
-        IExpression[] args = new IExpression[] {
-        		LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
-        };
-        // % / default 
-        helpTestMod("%", null, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Integer} constants for both parameters returns (x % y).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and a supported type list which contains {@link Integer}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoIntConst6() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
-        };
-        // % / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Integer.class);
-        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Integer} constants for both parameters returns 
-     * (10 - (TRUNC((10 / 6), 0) * 6)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and a supported type list that 
-     * does not contain {@link Integer}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoIntConst7() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
-            LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
-        };
-        // % / Integer
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Long} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed without 
-     * specifying a function name or a supported type list.
-     * 
-     * @throws Exception
-     */
-    public void testTwoLongConst() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Long(10), Long.class),
-                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
-        };
-        // default / default
-        helpTestMod(args, "MOD(10, 6)"); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Long} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed with a 
-     * function name of "MOD" but without a supported type list.
-     *  
-     * @throws Exception
-     */
-    public void testTwoLongConst2() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Long(10), Long.class),
-                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
-        };
-        // mod / default 
-        helpTestMod("MOD", null, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Long} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed with a 
-     * function name of "MOD" and a supported type list which contains {@link Long}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoLongConst3() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Long(10), Long.class),
-                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
-        };
-        // mod / Long
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Long.class);
-        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Long} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" and a supported type list which 
-     * does not contain {@link Long}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoLongConst4() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Long(10), Long.class),
-                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
-        };
-        // mod / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Long} constants for both parameters returns (x % y).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and no supported type list. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoLongConst5() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Long(10), Long.class),
-                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
-        };
-        // % / default 
-        helpTestMod("%", null, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Long} constants for both parameters returns (x % y).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and a supported type list which contains {@link Long}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoLongConst6() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Long(10), Long.class),
-                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
-        };
-        // % / Long
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Long.class);
-        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Long} constants for both parameters returns 
-     * (10 - (TRUNC((10 / 6), 0) * 6)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and a supported type list that 
-     * does not contain {@link Long}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoLongConst7() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Long(10), Long.class),
-                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
-        };
-        // % / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Float} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed without specifying a function name or a supported type list.
-     * 
-     * @throws Exception
-     */
-    public void testTwoFloatConst() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Float(10), Float.class),
-                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
-        };
-        // default / default
-        helpTestMod(args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Float} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" but without a supported type 
-     * list.
-     *  
-     * @throws Exception
-     */
-    public void testTwoFloatConst2() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Float(10), Float.class),
-                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
-        };
-        // mod / default 
-        helpTestMod("MOD", null, args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Float} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed with a 
-     * function name of "MOD" and a supported type list which contains {@link Float}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoFloatConst3() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Float(10), Float.class),
-                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
-        };
-        // mod / Float
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Float.class);
-        helpTestMod("MOD", typeList, args, "MOD(10.0, 6.0)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link Float} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" and a supported type list which 
-     * does not contain {@link Float}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoFloatConst4() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Float(10), Float.class),
-                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
-        };
-        // mod / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("MOD", typeList, args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Float} constants for both parameters returns  
-     * (x - (TRUNC((x / y), 0) * x)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and no supported type list. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoFloatConst5() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Float(10), Float.class),
-                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
-        };
-        // % / default 
-        helpTestMod("%", null, args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Float} constants for both parameters returns (x % y).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and a supported type list which contains {@link Float}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoFloatConst6() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Float(10), Float.class),
-                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
-        };
-        // % / Float
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Float.class);
-        helpTestMod("%", typeList, args, "(10.0 % 6.0)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link Float} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * x)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and a supported type list that 
-     * does not contain {@link Float}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoFloatConst7() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Float(10), Float.class),
-                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
-        };
-        // % / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("%", typeList, args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link BigInteger} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed without specifying a function name or a supported type list.
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigIntConst() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
-        };
-        // default / default
-        helpTestMod(args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link BigInteger} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" but without a supported type 
-     * list.
-     *  
-     * @throws Exception
-     */
-    public void testTwoBigIntConst2() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
-        };
-        // mod / default 
-        helpTestMod("MOD", null, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link BigInteger} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed with a 
-     * function name of "MOD" and a supported type list which contains {@link BigInteger}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigIntConst3() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
-        };
-        // mod / BigInteger
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(BigInteger.class);
-        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link BigInteger} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" and a supported type list which 
-     * does not contain {@link BigInteger}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigIntConst4() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
-        };
-        // mod / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link BigInteger} constants for both parameters returns  
-     * (x - (TRUNC((x / y), 0) * x)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and no supported type list. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigIntConst5() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
-        };
-        // % / default 
-        helpTestMod("%", null, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link BigInteger} constants for both parameters returns 
-     * (x % y).  {@link MODFunctionModifier} will be constructed with a function 
-     * name of "%" and a supported type list which contains {@link BigInteger}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigIntConst6() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
-        };
-        // % / BigInteger
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(BigInteger.class);
-        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link BigInteger} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * x)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and a supported type list that 
-     * does not contain {@link BigInteger}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigIntConst7() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
-        };
-        // % / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link BigDecimal} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed without specifying a function name or a supported type list.
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigDecConst() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
-        };
-        // default / default
-        helpTestMod(args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link BigDecimal} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" but without a supported type 
-     * list.
-     *  
-     * @throws Exception
-     */
-    public void testTwoBigDecConst2() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
-        };
-        // mod / default 
-        helpTestMod("MOD", null, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link BigDecimal} constants for both parameters returns 
-     * MOD(x,y).  {@link MODFunctionModifier} will be constructed with a 
-     * function name of "MOD" and a supported type list which contains {@link BigDecimal}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigDecConst3() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
-        };
-        // mod / BigDecimal
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(BigDecimal.class);
-        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,y) using {@link BigDecimal} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * y)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" and a supported type list which 
-     * does not contain {@link BigDecimal}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigDecConst4() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
-        };
-        // mod / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link BigDecimal} constants for both parameters returns  
-     * (x - (TRUNC((x / y), 0) * x)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and no supported type list. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigDecConst5() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
-        };
-        // % / default 
-        helpTestMod("%", null, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link BigDecimal} constants for both parameters returns 
-     * (x % y).  {@link MODFunctionModifier} will be constructed with a function 
-     * name of "%" and a supported type list which contains {@link BigDecimal}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigDecConst6() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
-        };
-        // % / BigDecimal
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(BigDecimal.class);
-        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * x % y using {@link BigDecimal} constants for both parameters returns 
-     * (x - (TRUNC((x / y), 0) * x)).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and a supported type list that 
-     * does not contain {@link BigDecimal}. 
-     * 
-     * @throws Exception
-     */
-    public void testTwoBigDecConst7() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
-        };
-        // % / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant 
-     * for parameters returns MOD(e1,y).  {@link MODFunctionModifier} will be 
-     * constructed without specifying a function name or a supported type list.
-     * 
-     * @throws Exception
-     */
-    public void testOneIntElemOneIntConst() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
-        };
-        // default / default
-        helpTestMod(args, "MOD(e1, 6)"); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant 
-     * for parameters returns MOD(e1,y).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" but without a supported type 
-     * list.
-     *  
-     * @throws Exception
-     */
-    public void testOneIntElemOneIntConst2() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
-        };
-        // mod / default 
-        helpTestMod("MOD", null, args, "MOD(e1, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant 
-     * for parameters returns MOD(e1,y).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "MOD" and a supported type list which 
-     * contains {@link Integer}. 
-     * 
-     * @throws Exception
-     */
-    public void testOneIntElemOneIntConst3() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
-        };
-        // mod / Integer
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Integer.class);
-        helpTestMod("MOD", typeList, args, "MOD(e1, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant 
-     * for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "MOD" and a supported type list which does not contain {@link Integer}. 
-     * 
-     * @throws Exception
-     */
-    public void testOneIntElemOneIntConst4() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
-        };
-        // mod / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("MOD", typeList, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * e1 % y using a {@link Integer} element and a {@link Integer} constant for 
-     * parameters returns (e1 % y).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and no supported type list. 
-     * 
-     * @throws Exception
-     */
-    public void testOneIntElemOneIntConst5() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
-        };
-        // % / default 
-        helpTestMod("%", null, args, "(e1 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * e1 % y using a {@link Integer} element and a {@link Integer} constant for 
-     * parameters returns (e1 % y).  {@link MODFunctionModifier} will be 
-     * constructed with a function name of "%" and a supported type list which 
-     * contains {@link Integer}. 
-     * 
-     * @throws Exception
-     */
-    public void testOneIntElemOneIntConst6() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
-        };
-        // % / Integer
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Integer.class);
-        helpTestMod("%", typeList, args, "(e1 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * e1 % y using a {@link Integer} element and a {@link Integer} constant for 
-     * parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and a supported type list that does not contain {@link Integer}. 
-     * 
-     * @throws Exception
-     */
-    public void testOneIntElemOneIntConst7() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
-        };
-        // % / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("%", typeList, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(e1,y) using a {@link BigDecimal} element and a {@link BigDecimal} 
-     * constant for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
-     * {@link MODFunctionModifier} will be constructed without specifying a 
-     * function name or a supported type list.
-     * 
-     * @throws Exception
-     */
-    public void testOneBigDecElemOneBigDecConst() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
-        };
-        // default / default
-        helpTestMod(args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(e1,y) using a {@link BigDecimal} element and a {@link BigDecimal} 
-     * constant for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "MOD" but without a supported type list.
-     *  
-     * @throws Exception
-     */
-    public void testOneBigDecElemOneBigDecConst2() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
-        };
-        // mod / default 
-        helpTestMod("MOD", null, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(e1,y) using a {@link BigDecimal} element and a {@link BigDecimal} 
-     * constant for parameters returns MOD(e1,y).  {@link MODFunctionModifier} 
-     * will be constructed with a function name of "MOD" and a supported type 
-     * list which contains {@link BigDecimal}. 
-     * 
-     * @throws Exception
-     */
-    public void testOneBigDecElemOneBigDecConst3() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
-        };
-        // mod / Integer
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(BigDecimal.class);
-        helpTestMod("MOD", typeList, args, "MOD(e1, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(e1,y) using a {@link BigDecimal} element and a {@link BigDecimal} 
-     * constant for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "MOD" and a supported type list which does not contain {@link BigDecimal}. 
-     * 
-     * @throws Exception
-     */
-    public void testOneBigDecElemOneBigDecConst4() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
-        };
-        // mod / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("MOD", typeList, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * e1 % y using a {@link BigDecimal} element and a {@link BigDecimal} 
-     * constant for parameters returns (e1 % y).  {@link MODFunctionModifier} 
-     * will be constructed with a function name of "%" and no supported type 
-     * list. 
-     * 
-     * @throws Exception
-     */
-    public void testOneBigDecElemOneBigDecConst5() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
-        };
-        // % / default 
-        helpTestMod("%", null, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * e1 % y using a {@link BigDecimal} element and a {@link BigDecimal} 
-     * constant for parameters returns (e1 % y).  {@link MODFunctionModifier} 
-     * will be constructed with a function name of "%" and a supported type list 
-     * which contains {@link BigDecimal}. 
-     * 
-     * @throws Exception
-     */
-    public void testOneBigDecElemOneBigDecConst6() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
-        };
-        // % / BigDecimal
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(BigDecimal.class);
-        helpTestMod("%", typeList, args, "(e1 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * e1 % y using a {@link BigDecimal} element and a {@link BigDecimal} 
-     * constant for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
-     * {@link MODFunctionModifier} will be constructed with a function name of 
-     * "%" and a supported type list that does not contain {@link BigDecimal}. 
-     * 
-     * @throws Exception
-     */
-    public void testOneBigDecElemOneBigDecConst7() throws Exception {
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
-                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
-        };
-        // % / Short
-        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
-        typeList.add(Short.class);
-        helpTestMod("%", typeList, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Test {@link MODFunctionModifier#modify(IFunction)} to validate a call to 
-     * MOD(x,e1) using a {@link Float} literal and a {@link Float} element for 
-     * parameters returns (x - (floor((x / e1)) * e1)).  {@link MODFunctionModifier} 
-     * will be constructed with a function name of "MOD" and no supported type 
-     * list.  The test explicitly overrides 
-     * {@link MODFunctionModifier#getQuotientExpression(IExpression)} to produce 
-     * output that uses the floor(z) function. 
-     * 
-     * @throws Exception
-     */
-    public void testOverrideGetQuotient() throws Exception {
-    	final Class<?> dataType = Float.class;
-    	final String modFunctionName = "MOD"; //$NON-NLS-1$
-    	final String expectedStr = "(1000.23 - (floor((1000.23 / e1)) * e1))"; //$NON-NLS-1$
-    	
-        IExpression[] args = new IExpression[] {
-                LANG_FACTORY.createLiteral(new Float(1000.23), dataType),
-                LANG_FACTORY.createElement("e1", null, null, dataType), //$NON-NLS-1$
-        };
-    	IFunction func = LANG_FACTORY.createFunction(modFunctionName, args, dataType);
-
-    	final Translator trans = new Translator() {
-			@Override
-			public void initialize(ConnectorEnvironment env)
-					throws ConnectorException {
-				super.initialize(env);
-				registerFunctionModifier(SourceSystemFunctions.MOD, new MODFunctionModifier(getLanguageFactory(), modFunctionName, null) {
-					@Override
-					protected IExpression getQuotientExpression(
-							IExpression division) {
-						return getLanguageFactory().createFunction("floor", Arrays.asList(division), division.getType()); //$NON-NLS-1$
-					}
-					
-				});
-			}
-    	};
-
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-
-        IExpression expr = trans.getFunctionModifiers().get(SourceSystemFunctions.MOD).modify(func);
-        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
-        sqlVisitor.append(expr);  
-        assertEquals("Modified function does not match", expectedStr, sqlVisitor.toString()); //$NON-NLS-1$
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java (from rev 1264, trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestMODFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java	2009-08-19 21:08:00 UTC (rev 1265)
@@ -0,0 +1,1253 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.jdbc.translator;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IFunction;
+import org.teiid.connector.language.ILanguageFactory;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+
+/**
+ * Test <code>ModFunctionModifier</code> by invoking its methods with varying 
+ * parameters to validate it performs as designed and expected. 
+ */
+public class TestModFunctionModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestModFunctionModifier.
+     * @param name
+     */
+    public TestModFunctionModifier(String name) {
+        super(name);
+    }
+
+
+    /**
+     * Create an expression containing a MOD function using <code>args</code> 
+     * and pass it to the <code>Translator</code>'s MOD function modifier and 
+     * compare the resulting expression to <code>expectedStr</code>.
+     * 
+     * @param args An array of <code>IExpression</code>'s to use as the 
+     *             arguments to the MOD() function
+     * @param expectedStr A string representing the modified expression
+     * @return On success, the modified expression.
+     * @throws Exception
+     */
+    public IExpression helpTestMod(IExpression[] args, String expectedStr) throws Exception {
+    	return this.helpTestMod(null, null, args, expectedStr);
+    }
+
+    /**
+     * Create an expression containing a MOD function using a function name of 
+     * <code>modFunctionName</code> which supports types of <code>supportedTypes</code>
+     * and uses the arguments <code>args</code> and pass it to the 
+     * <code>Translator</code>'s MOD function modifier and compare the resulting 
+     * expression to <code>expectedStr</code>.
+     *
+     * @param modFunctionName the name to use for the function modifier
+     * @param supportedTypes a list of types that the mod function should support
+     * @param args an array of <code>IExpression</code>'s to use as the 
+     *             arguments to the MOD() function
+     * @param expectedStr A string representing the modified expression
+     * @return On success, the modified expression.
+     * @throws Exception
+     */
+    public IExpression helpTestMod(final String modFunctionName, final List<Class<?>> supportedTypes, IExpression[] args, String expectedStr) throws Exception {
+    	IExpression param1 = null;
+    	IExpression param2 = null;
+    	
+    	if (args.length < 2) {
+    		param2 = LANG_FACTORY.createLiteral(null, Short.class);
+    		if (args.length < 1) {
+        		param1 = LANG_FACTORY.createLiteral(null, Short.class);
+    		} else {
+    			param1 = args[0];
+    		}
+    	} else {
+    		param1 = args[0];
+    		param2 = args[1];
+    	}
+    	
+    	if ( !param1.getType().equals(param2.getType()) ) {
+    		if (param2.getType().equals(BigDecimal.class)) {
+    			param1.setType(param2.getType());
+    		} else if (param1.getType().equals(BigDecimal.class)) {
+    			param2.setType(param1.getType());
+    		} else if (param2.getType().equals(BigInteger.class)) {
+    			param1.setType(param2.getType());
+    		} else if (param1.getType().equals(BigInteger.class)) {
+    			param2.setType(param1.getType());
+    		} else if (param2.getType().equals(Float.class)) {
+    			param1.setType(param2.getType());
+    		} else if (param1.getType().equals(Float.class)) {
+    			param2.setType(param1.getType());
+    		} else if (param2.getType().equals(Long.class)) {
+    			param1.setType(param2.getType());
+    		} else if (param1.getType().equals(Long.class)) {
+    			param2.setType(param1.getType());
+    		} else if (param2.getType().equals(Integer.class)) {
+    			param1.setType(param2.getType());
+    		} else if (param1.getType().equals(Integer.class)) {
+    			param2.setType(param1.getType());
+    		} else if (param2.getType().equals(Short.class)) {
+    			param1.setType(param2.getType());
+    		} else if (param1.getType().equals(Short.class)) {
+    			param2.setType(param1.getType());
+    		} else {
+    			throw new IllegalArgumentException("Parameters must be of numeric types"); //$NON-NLS-1$
+    		}
+    	}
+
+    	IFunction func = LANG_FACTORY.createFunction(modFunctionName,
+            Arrays.asList(param1, param2), param1.getType());
+
+    	Translator trans = new Translator() {
+			@Override
+			public void initialize(ConnectorEnvironment env)
+					throws ConnectorException {
+				super.initialize(env);
+				if (modFunctionName == null) {
+					registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier(getLanguageFactory()));
+				} else {
+					registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier(getLanguageFactory(), modFunctionName, supportedTypes));
+				}
+			}
+    	};
+    	
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+
+        IExpression expr = trans.getFunctionModifiers().get(SourceSystemFunctions.MOD).modify(func);
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        
+        assertEquals("Modified function does not match", expectedStr, sqlVisitor.toString()); //$NON-NLS-1$
+        
+        return expr;
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Short} constants for both parameters returns MOD(x,y). 
+     * {@link ModFunctionModifier} will be constructed without specifying a 
+     * function name or a supported type list.
+     * 
+     * @throws Exception
+     */
+    public void testTwoShortConst() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
+            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
+        };
+        // default / default
+        helpTestMod(args, "MOD(10, 6)"); //$NON-NLS-1$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Short} constants for both parameters returns MOD(x,y). 
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "MOD" but without a supported type list.
+     *  
+     * @throws Exception
+     */
+    public void testTwoShortConst2() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
+            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
+        };
+        // mod / default 
+        helpTestMod("MOD", null, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Short} constants for both parameters returns MOD(x,y). 
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "MOD" and a supported type list which contains {@link Short}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoShortConst3() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
+            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
+        };
+        // mod / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Short} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" and a supported type list which 
+     * does not contains {@link Short}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoShortConst4() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
+            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
+        };
+        // mod / Integer
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Integer.class);
+        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Short} constants for both parameters returns (x % y).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and no supported type list. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoShortConst5() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
+            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
+        };
+        // % / default 
+        helpTestMod("%", null, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Short} constants for both parameters returns (x % y).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and a supported type list which contains {@link Short}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoShortConst6() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
+            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
+        };
+        // % / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Short} constants for both parameters returns 
+     * (10 - (TRUNC((10 / 6), 0) * 6)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and a supported type list does not 
+     * contain {@link Short}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoShortConst7() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(new Short((short) 10), Short.class),
+            LANG_FACTORY.createLiteral(new Short((short) 6), Short.class)           
+        };
+        // % / Integer
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Integer.class);
+        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Integer} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed without 
+     * specifying a function name or a supported type list.
+     * 
+     * @throws Exception
+     */
+    public void testTwoIntConst() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
+        };
+        // default / default
+        helpTestMod(args, "MOD(10, 6)"); //$NON-NLS-1$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Integer} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed with a 
+     * function name of "MOD" but without a supported type list.
+     *  
+     * @throws Exception
+     */
+    public void testTwoIntConst2() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
+        };
+        // mod / default 
+        helpTestMod("MOD", null, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Integer} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed with a 
+     * function name of "MOD" and a supported type list which contains {@link Integer}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoIntConst3() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
+        };
+        // mod / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Integer.class);
+        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Integer} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" and a supported type list which 
+     * does not contain {@link Integer}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoIntConst4() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
+        };
+        // mod / Integer
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Integer} constants for both parameters returns (x % y).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and no supported type list. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoIntConst5() throws Exception {
+        IExpression[] args = new IExpression[] {
+        		LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
+        };
+        // % / default 
+        helpTestMod("%", null, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Integer} constants for both parameters returns (x % y).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and a supported type list which contains {@link Integer}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoIntConst6() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
+        };
+        // % / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Integer.class);
+        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Integer} constants for both parameters returns 
+     * (10 - (TRUNC((10 / 6), 0) * 6)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and a supported type list that 
+     * does not contain {@link Integer}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoIntConst7() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(new Integer(10), Integer.class),
+            LANG_FACTORY.createLiteral(new Integer(6), Integer.class)           
+        };
+        // % / Integer
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Long} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed without 
+     * specifying a function name or a supported type list.
+     * 
+     * @throws Exception
+     */
+    public void testTwoLongConst() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Long(10), Long.class),
+                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
+        };
+        // default / default
+        helpTestMod(args, "MOD(10, 6)"); //$NON-NLS-1$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Long} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed with a 
+     * function name of "MOD" but without a supported type list.
+     *  
+     * @throws Exception
+     */
+    public void testTwoLongConst2() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Long(10), Long.class),
+                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
+        };
+        // mod / default 
+        helpTestMod("MOD", null, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Long} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed with a 
+     * function name of "MOD" and a supported type list which contains {@link Long}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoLongConst3() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Long(10), Long.class),
+                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
+        };
+        // mod / Long
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Long.class);
+        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Long} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" and a supported type list which 
+     * does not contain {@link Long}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoLongConst4() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Long(10), Long.class),
+                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
+        };
+        // mod / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Long} constants for both parameters returns (x % y).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and no supported type list. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoLongConst5() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Long(10), Long.class),
+                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
+        };
+        // % / default 
+        helpTestMod("%", null, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Long} constants for both parameters returns (x % y).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and a supported type list which contains {@link Long}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoLongConst6() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Long(10), Long.class),
+                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
+        };
+        // % / Long
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Long.class);
+        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Long} constants for both parameters returns 
+     * (10 - (TRUNC((10 / 6), 0) * 6)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and a supported type list that 
+     * does not contain {@link Long}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoLongConst7() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Long(10), Long.class),
+                LANG_FACTORY.createLiteral(new Long(6), Long.class)           
+        };
+        // % / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Float} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed without specifying a function name or a supported type list.
+     * 
+     * @throws Exception
+     */
+    public void testTwoFloatConst() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Float(10), Float.class),
+                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
+        };
+        // default / default
+        helpTestMod(args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Float} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" but without a supported type 
+     * list.
+     *  
+     * @throws Exception
+     */
+    public void testTwoFloatConst2() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Float(10), Float.class),
+                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
+        };
+        // mod / default 
+        helpTestMod("MOD", null, args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Float} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed with a 
+     * function name of "MOD" and a supported type list which contains {@link Float}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoFloatConst3() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Float(10), Float.class),
+                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
+        };
+        // mod / Float
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Float.class);
+        helpTestMod("MOD", typeList, args, "MOD(10.0, 6.0)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link Float} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" and a supported type list which 
+     * does not contain {@link Float}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoFloatConst4() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Float(10), Float.class),
+                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
+        };
+        // mod / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("MOD", typeList, args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Float} constants for both parameters returns  
+     * (x - (TRUNC((x / y), 0) * x)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and no supported type list. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoFloatConst5() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Float(10), Float.class),
+                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
+        };
+        // % / default 
+        helpTestMod("%", null, args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Float} constants for both parameters returns (x % y).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and a supported type list which contains {@link Float}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoFloatConst6() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Float(10), Float.class),
+                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
+        };
+        // % / Float
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Float.class);
+        helpTestMod("%", typeList, args, "(10.0 % 6.0)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link Float} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * x)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and a supported type list that 
+     * does not contain {@link Float}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoFloatConst7() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Float(10), Float.class),
+                LANG_FACTORY.createLiteral(new Float(6), Float.class)           
+        };
+        // % / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("%", typeList, args, "(10.0 - (TRUNC((10.0 / 6.0), 0) * 6.0))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link BigInteger} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed without specifying a function name or a supported type list.
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigIntConst() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
+        };
+        // default / default
+        helpTestMod(args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link BigInteger} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" but without a supported type 
+     * list.
+     *  
+     * @throws Exception
+     */
+    public void testTwoBigIntConst2() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
+        };
+        // mod / default 
+        helpTestMod("MOD", null, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link BigInteger} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed with a 
+     * function name of "MOD" and a supported type list which contains {@link BigInteger}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigIntConst3() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
+        };
+        // mod / BigInteger
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(BigInteger.class);
+        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link BigInteger} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" and a supported type list which 
+     * does not contain {@link BigInteger}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigIntConst4() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
+        };
+        // mod / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link BigInteger} constants for both parameters returns  
+     * (x - (TRUNC((x / y), 0) * x)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and no supported type list. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigIntConst5() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
+        };
+        // % / default 
+        helpTestMod("%", null, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link BigInteger} constants for both parameters returns 
+     * (x % y).  {@link ModFunctionModifier} will be constructed with a function 
+     * name of "%" and a supported type list which contains {@link BigInteger}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigIntConst6() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
+        };
+        // % / BigInteger
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(BigInteger.class);
+        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link BigInteger} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * x)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and a supported type list that 
+     * does not contain {@link BigInteger}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigIntConst7() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigInteger("10"), BigInteger.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigInteger("6"), BigInteger.class) //$NON-NLS-1$
+        };
+        // % / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link BigDecimal} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed without specifying a function name or a supported type list.
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigDecConst() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
+        };
+        // default / default
+        helpTestMod(args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link BigDecimal} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" but without a supported type 
+     * list.
+     *  
+     * @throws Exception
+     */
+    public void testTwoBigDecConst2() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
+        };
+        // mod / default 
+        helpTestMod("MOD", null, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link BigDecimal} constants for both parameters returns 
+     * MOD(x,y).  {@link ModFunctionModifier} will be constructed with a 
+     * function name of "MOD" and a supported type list which contains {@link BigDecimal}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigDecConst3() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
+        };
+        // mod / BigDecimal
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(BigDecimal.class);
+        helpTestMod("MOD", typeList, args, "MOD(10, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,y) using {@link BigDecimal} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * y)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" and a supported type list which 
+     * does not contain {@link BigDecimal}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigDecConst4() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
+        };
+        // mod / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("MOD", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link BigDecimal} constants for both parameters returns  
+     * (x - (TRUNC((x / y), 0) * x)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and no supported type list. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigDecConst5() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
+        };
+        // % / default 
+        helpTestMod("%", null, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link BigDecimal} constants for both parameters returns 
+     * (x % y).  {@link ModFunctionModifier} will be constructed with a function 
+     * name of "%" and a supported type list which contains {@link BigDecimal}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigDecConst6() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
+        };
+        // % / BigDecimal
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(BigDecimal.class);
+        helpTestMod("%", typeList, args, "(10 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * x % y using {@link BigDecimal} constants for both parameters returns 
+     * (x - (TRUNC((x / y), 0) * x)).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and a supported type list that 
+     * does not contain {@link BigDecimal}. 
+     * 
+     * @throws Exception
+     */
+    public void testTwoBigDecConst7() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) //$NON-NLS-1$
+        };
+        // % / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("%", typeList, args, "(10 - (TRUNC((10 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant 
+     * for parameters returns MOD(e1,y).  {@link ModFunctionModifier} will be 
+     * constructed without specifying a function name or a supported type list.
+     * 
+     * @throws Exception
+     */
+    public void testOneIntElemOneIntConst() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
+        };
+        // default / default
+        helpTestMod(args, "MOD(e1, 6)"); //$NON-NLS-1$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant 
+     * for parameters returns MOD(e1,y).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" but without a supported type 
+     * list.
+     *  
+     * @throws Exception
+     */
+    public void testOneIntElemOneIntConst2() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
+        };
+        // mod / default 
+        helpTestMod("MOD", null, args, "MOD(e1, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant 
+     * for parameters returns MOD(e1,y).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "MOD" and a supported type list which 
+     * contains {@link Integer}. 
+     * 
+     * @throws Exception
+     */
+    public void testOneIntElemOneIntConst3() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
+        };
+        // mod / Integer
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Integer.class);
+        helpTestMod("MOD", typeList, args, "MOD(e1, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant 
+     * for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "MOD" and a supported type list which does not contain {@link Integer}. 
+     * 
+     * @throws Exception
+     */
+    public void testOneIntElemOneIntConst4() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
+        };
+        // mod / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("MOD", typeList, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * e1 % y using a {@link Integer} element and a {@link Integer} constant for 
+     * parameters returns (e1 % y).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and no supported type list. 
+     * 
+     * @throws Exception
+     */
+    public void testOneIntElemOneIntConst5() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
+        };
+        // % / default 
+        helpTestMod("%", null, args, "(e1 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * e1 % y using a {@link Integer} element and a {@link Integer} constant for 
+     * parameters returns (e1 % y).  {@link ModFunctionModifier} will be 
+     * constructed with a function name of "%" and a supported type list which 
+     * contains {@link Integer}. 
+     * 
+     * @throws Exception
+     */
+    public void testOneIntElemOneIntConst6() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
+        };
+        // % / Integer
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Integer.class);
+        helpTestMod("%", typeList, args, "(e1 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * e1 % y using a {@link Integer} element and a {@link Integer} constant for 
+     * parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and a supported type list that does not contain {@link Integer}. 
+     * 
+     * @throws Exception
+     */
+    public void testOneIntElemOneIntConst7() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new Integer(6), Integer.class)
+        };
+        // % / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("%", typeList, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(e1,y) using a {@link BigDecimal} element and a {@link BigDecimal} 
+     * constant for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
+     * {@link ModFunctionModifier} will be constructed without specifying a 
+     * function name or a supported type list.
+     * 
+     * @throws Exception
+     */
+    public void testOneBigDecElemOneBigDecConst() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
+        };
+        // default / default
+        helpTestMod(args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(e1,y) using a {@link BigDecimal} element and a {@link BigDecimal} 
+     * constant for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "MOD" but without a supported type list.
+     *  
+     * @throws Exception
+     */
+    public void testOneBigDecElemOneBigDecConst2() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
+        };
+        // mod / default 
+        helpTestMod("MOD", null, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(e1,y) using a {@link BigDecimal} element and a {@link BigDecimal} 
+     * constant for parameters returns MOD(e1,y).  {@link ModFunctionModifier} 
+     * will be constructed with a function name of "MOD" and a supported type 
+     * list which contains {@link BigDecimal}. 
+     * 
+     * @throws Exception
+     */
+    public void testOneBigDecElemOneBigDecConst3() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
+        };
+        // mod / Integer
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(BigDecimal.class);
+        helpTestMod("MOD", typeList, args, "MOD(e1, 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(e1,y) using a {@link BigDecimal} element and a {@link BigDecimal} 
+     * constant for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "MOD" and a supported type list which does not contain {@link BigDecimal}. 
+     * 
+     * @throws Exception
+     */
+    public void testOneBigDecElemOneBigDecConst4() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
+        };
+        // mod / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("MOD", typeList, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * e1 % y using a {@link BigDecimal} element and a {@link BigDecimal} 
+     * constant for parameters returns (e1 % y).  {@link ModFunctionModifier} 
+     * will be constructed with a function name of "%" and no supported type 
+     * list. 
+     * 
+     * @throws Exception
+     */
+    public void testOneBigDecElemOneBigDecConst5() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
+        };
+        // % / default 
+        helpTestMod("%", null, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * e1 % y using a {@link BigDecimal} element and a {@link BigDecimal} 
+     * constant for parameters returns (e1 % y).  {@link ModFunctionModifier} 
+     * will be constructed with a function name of "%" and a supported type list 
+     * which contains {@link BigDecimal}. 
+     * 
+     * @throws Exception
+     */
+    public void testOneBigDecElemOneBigDecConst6() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
+        };
+        // % / BigDecimal
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(BigDecimal.class);
+        helpTestMod("%", typeList, args, "(e1 % 6)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * e1 % y using a {@link BigDecimal} element and a {@link BigDecimal} 
+     * constant for parameters returns (e1 - (TRUNC((e1 / y), 0) * y)).  
+     * {@link ModFunctionModifier} will be constructed with a function name of 
+     * "%" and a supported type list that does not contain {@link BigDecimal}. 
+     * 
+     * @throws Exception
+     */
+    public void testOneBigDecElemOneBigDecConst7() throws Exception {
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createElement("e1", null, null, BigDecimal.class), //$NON-NLS-1$
+                LANG_FACTORY.createLiteral(new BigDecimal(6), BigDecimal.class)
+        };
+        // % / Short
+        List<Class<?>> typeList = new ArrayList<Class<?>>(1);
+        typeList.add(Short.class);
+        helpTestMod("%", typeList, args, "(e1 - (TRUNC((e1 / 6), 0) * 6))"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Test {@link ModFunctionModifier#modify(IFunction)} to validate a call to 
+     * MOD(x,e1) using a {@link Float} literal and a {@link Float} element for 
+     * parameters returns (x - (floor((x / e1)) * e1)).  {@link ModFunctionModifier} 
+     * will be constructed with a function name of "MOD" and no supported type 
+     * list.  The test explicitly overrides 
+     * {@link ModFunctionModifier#getQuotientExpression(IExpression)} to produce 
+     * output that uses the floor(z) function. 
+     * 
+     * @throws Exception
+     */
+    public void testOverrideGetQuotient() throws Exception {
+    	final Class<?> dataType = Float.class;
+    	final String modFunctionName = "MOD"; //$NON-NLS-1$
+    	final String expectedStr = "(1000.23 - (floor((1000.23 / e1)) * e1))"; //$NON-NLS-1$
+    	
+        IExpression[] args = new IExpression[] {
+                LANG_FACTORY.createLiteral(new Float(1000.23), dataType),
+                LANG_FACTORY.createElement("e1", null, null, dataType), //$NON-NLS-1$
+        };
+    	IFunction func = LANG_FACTORY.createFunction(modFunctionName, args, dataType);
+
+    	final Translator trans = new Translator() {
+			@Override
+			public void initialize(ConnectorEnvironment env)
+					throws ConnectorException {
+				super.initialize(env);
+				registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier(getLanguageFactory(), modFunctionName, null) {
+					@Override
+					protected IExpression getQuotientExpression(
+							IExpression division) {
+						return getLanguageFactory().createFunction("floor", Arrays.asList(division), division.getType()); //$NON-NLS-1$
+					}
+					
+				});
+			}
+    	};
+
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+
+        IExpression expr = trans.getFunctionModifiers().get(SourceSystemFunctions.MOD).modify(func);
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        assertEquals("Modified function does not match", expectedStr, sqlVisitor.toString()); //$NON-NLS-1$
+    }
+}


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the teiid-commits mailing list