db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1448414 [9/14] - in /db/torque/torque4/trunk/torque-runtime/src: main/java/org/apache/torque/ main/java/org/apache/torque/adapter/ main/java/org/apache/torque/criteria/ main/java/org/apache/torque/map/ main/java/org/apache/torque/oid/ main...
Date Wed, 20 Feb 2013 21:06:37 GMT
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/UniqueColumnList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java Wed Feb 20 21:06:35 2013
@@ -1,264 +1,264 @@
-package org.apache.torque.util.functions;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.lang.ObjectUtils;
-import org.apache.torque.Column;
-
-/**
- * A default framework that implements the core SQLFunction interface
- * requirements that can be used to build specific functions on.
- *
- * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
- * @version $Id$
- */
-public abstract class AbstractFunction implements SQLFunction
-{
-    /** The arguments being used by this function */
-    private List<Object> argumentList = new ArrayList<Object>();
-
-    /**
-     * Functions should only be created via the FunctionFactory class.
-     */
-    protected AbstractFunction()
-    {
-        super();
-    }
-
-    /**
-     * This should return the SQL string that can be used
-     * when constructing the query.  E.g. "AVG( table.column )" or
-     * CONCAT(table.column, " foobar");
-     *
-     * @return The SQL String.
-     */
-    public abstract String getSqlExpression();
-
-    /**
-     * Return all the parameters as an object array. This allow for
-     * processing of the parameters in their original format rather
-     * than just in String format.  E.g. a parameter might be specified
-     * as a Date object, or a Column object.
-     *
-     * @return Should return a valid Object array and not null.  E.g.
-     *  implementors should return new Object[0] if there are no parameters.
-     */
-    public Object[] getArguments()
-    {
-        Object[] args = getArgumentList().toArray();
-        if (args == null)
-        {
-            args = new Object[0];
-        }
-        return args;
-    }
-
-    /**
-     * Sets the function arguments.
-     *
-     * @param args the function arguments, not null.
-     */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public void setArguments(Object[] args)
-    {
-        this.argumentList = new ArrayList(Arrays.asList(args));
-    }
-
-    /**
-     * Returns the column to which this function is applied.
-     *
-     * @return the column, not null.
-     *
-     * @throws IllegalStateException if the column cannot be determined.
-     */
-    public Column getColumn()
-    {
-        for (Object argument : getArgumentList())
-        {
-            if (argument instanceof Column)
-            {
-                return (Column) argument;
-            }
-        }
-        throw new IllegalStateException(
-                "Column could not be determined from arguments "
-                    + getArgumentList());
-    }
-
-    /**
-     * Return the object representation of the function parameter
-     * at the specified index.  Will be null if parameter does not exist.
-     *
-     * @param index The 0 based index of the parameter to get.
-     * @return The parameter object.  Null if one does not
-     *         exist.
-     */
-    public Object getArgument(int index)
-    {
-        List<Object> argList = getArgumentList();
-        if (index >= argList.size())
-        {
-            return null;
-        }
-        return argList.get(index);
-    }
-
-    /**
-     * Add an argument to the function argument list
-     *
-     * @param arg The argument object.
-     */
-    protected void addArgument(Object arg)
-    {
-        getArgumentList().add(arg);
-    }
-
-    /**
-     * Set the full function argument list.
-     *
-     * @param args The new argument list
-     */
-    protected void setArgumentList(List<Object> args)
-    {
-        this.argumentList = args;
-    }
-
-    /**
-     * Get the full list of function arguments
-     *
-     * @return The argument list
-     */
-    protected List<Object> getArgumentList()
-    {
-        if (this.argumentList == null)
-        {
-            this.argumentList = new ArrayList<Object>();
-        }
-        return this.argumentList;
-    }
-
-    /**
-     * Returns the column name.
-     * This implementation always return null because we do not reference
-     * a real column.
-     *
-     * @return the column name, always null.
-     */
-    public String getColumnName()
-    {
-        return null;
-    }
-
-
-    /**
-     * Returns the name of the associated table
-     * (not prefixed by the schema name) from the function argument(s).
-     * In case that no unique table name can be determined, null is returned.
-     *
-     * @return the name of the table, may be null but not blank.
-     */
-    public String getTableName()
-    {
-        String tableName = null;
-        boolean columnFound = false;
-        for (Object argument : argumentList)
-        {
-            if (argument instanceof Column)
-            {
-                Column column = (Column) argument;
-                if (columnFound
-                    && !ObjectUtils.equals(tableName, column.getTableName()))
-                {
-                    // cannot determine unique table name, return null
-                    return null;
-                }
-                tableName = column.getTableName();
-                columnFound = true;
-            }
-        }
-        return tableName;
-    }
-
-    /**
-     * Returns the name of any fixed schema prefix for the column's table
-     * (if any) from the function argument(s).
-     * In case that no unique schema can be determined, null is returned.
-     *
-     * @return the schema name, or null if the schema is not known.
-     */
-    public String getSchemaName()
-    {
-        String schemaName = null;
-        boolean columnFound = false;
-        for (Object argument : argumentList)
-        {
-            if (argument instanceof Column)
-            {
-                Column column = (Column) argument;
-                if (columnFound
-                    && !ObjectUtils.equals(schemaName, column.getSchemaName()))
-                {
-                    // cannot determine unique schema name, return null
-                    return null;
-                }
-                schemaName = column.getSchemaName();
-                columnFound = true;
-            }
-        }
-        return schemaName;
-    }
-
-    /**
-     * Returns the table name prefixed with the schema name if it exists
-     * from the function argument(s).
-     * I.e. if a schema name exists, the result will be schemaName.tableName,
-     * and otherwise it will just be tableName.
-     * In case that no unique full table can be determined, null is returned.
-     *
-     * @return the fully qualified table name may be null but not blank.
-     */
-    public String getFullTableName()
-    {
-        String fullTableName = null;
-        boolean columnFound = false;
-        for (Object argument : argumentList)
-        {
-            if (argument instanceof Column)
-            {
-                Column column = (Column) argument;
-                if (columnFound
-                    && !ObjectUtils.equals(
-                            fullTableName,
-                            column.getFullTableName()))
-                {
-                    // cannot determine unique full table name, return null
-                    return null;
-                }
-                fullTableName = column.getFullTableName();
-                columnFound = true;
-            }
-        }
-        return fullTableName;
-    }
-}
+package org.apache.torque.util.functions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.torque.Column;
+
+/**
+ * A default framework that implements the core SQLFunction interface
+ * requirements that can be used to build specific functions on.
+ *
+ * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
+ * @version $Id$
+ */
+public abstract class AbstractFunction implements SQLFunction
+{
+    /** The arguments being used by this function */
+    private List<Object> argumentList = new ArrayList<Object>();
+
+    /**
+     * Functions should only be created via the FunctionFactory class.
+     */
+    protected AbstractFunction()
+    {
+        super();
+    }
+
+    /**
+     * This should return the SQL string that can be used
+     * when constructing the query.  E.g. "AVG( table.column )" or
+     * CONCAT(table.column, " foobar");
+     *
+     * @return The SQL String.
+     */
+    public abstract String getSqlExpression();
+
+    /**
+     * Return all the parameters as an object array. This allow for
+     * processing of the parameters in their original format rather
+     * than just in String format.  E.g. a parameter might be specified
+     * as a Date object, or a Column object.
+     *
+     * @return Should return a valid Object array and not null.  E.g.
+     *  implementors should return new Object[0] if there are no parameters.
+     */
+    public Object[] getArguments()
+    {
+        Object[] args = getArgumentList().toArray();
+        if (args == null)
+        {
+            args = new Object[0];
+        }
+        return args;
+    }
+
+    /**
+     * Sets the function arguments.
+     *
+     * @param args the function arguments, not null.
+     */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public void setArguments(Object[] args)
+    {
+        this.argumentList = new ArrayList(Arrays.asList(args));
+    }
+
+    /**
+     * Returns the column to which this function is applied.
+     *
+     * @return the column, not null.
+     *
+     * @throws IllegalStateException if the column cannot be determined.
+     */
+    public Column getColumn()
+    {
+        for (Object argument : getArgumentList())
+        {
+            if (argument instanceof Column)
+            {
+                return (Column) argument;
+            }
+        }
+        throw new IllegalStateException(
+                "Column could not be determined from arguments "
+                    + getArgumentList());
+    }
+
+    /**
+     * Return the object representation of the function parameter
+     * at the specified index.  Will be null if parameter does not exist.
+     *
+     * @param index The 0 based index of the parameter to get.
+     * @return The parameter object.  Null if one does not
+     *         exist.
+     */
+    public Object getArgument(int index)
+    {
+        List<Object> argList = getArgumentList();
+        if (index >= argList.size())
+        {
+            return null;
+        }
+        return argList.get(index);
+    }
+
+    /**
+     * Add an argument to the function argument list
+     *
+     * @param arg The argument object.
+     */
+    protected void addArgument(Object arg)
+    {
+        getArgumentList().add(arg);
+    }
+
+    /**
+     * Set the full function argument list.
+     *
+     * @param args The new argument list
+     */
+    protected void setArgumentList(List<Object> args)
+    {
+        this.argumentList = args;
+    }
+
+    /**
+     * Get the full list of function arguments
+     *
+     * @return The argument list
+     */
+    protected List<Object> getArgumentList()
+    {
+        if (this.argumentList == null)
+        {
+            this.argumentList = new ArrayList<Object>();
+        }
+        return this.argumentList;
+    }
+
+    /**
+     * Returns the column name.
+     * This implementation always return null because we do not reference
+     * a real column.
+     *
+     * @return the column name, always null.
+     */
+    public String getColumnName()
+    {
+        return null;
+    }
+
+
+    /**
+     * Returns the name of the associated table
+     * (not prefixed by the schema name) from the function argument(s).
+     * In case that no unique table name can be determined, null is returned.
+     *
+     * @return the name of the table, may be null but not blank.
+     */
+    public String getTableName()
+    {
+        String tableName = null;
+        boolean columnFound = false;
+        for (Object argument : argumentList)
+        {
+            if (argument instanceof Column)
+            {
+                Column column = (Column) argument;
+                if (columnFound
+                    && !ObjectUtils.equals(tableName, column.getTableName()))
+                {
+                    // cannot determine unique table name, return null
+                    return null;
+                }
+                tableName = column.getTableName();
+                columnFound = true;
+            }
+        }
+        return tableName;
+    }
+
+    /**
+     * Returns the name of any fixed schema prefix for the column's table
+     * (if any) from the function argument(s).
+     * In case that no unique schema can be determined, null is returned.
+     *
+     * @return the schema name, or null if the schema is not known.
+     */
+    public String getSchemaName()
+    {
+        String schemaName = null;
+        boolean columnFound = false;
+        for (Object argument : argumentList)
+        {
+            if (argument instanceof Column)
+            {
+                Column column = (Column) argument;
+                if (columnFound
+                    && !ObjectUtils.equals(schemaName, column.getSchemaName()))
+                {
+                    // cannot determine unique schema name, return null
+                    return null;
+                }
+                schemaName = column.getSchemaName();
+                columnFound = true;
+            }
+        }
+        return schemaName;
+    }
+
+    /**
+     * Returns the table name prefixed with the schema name if it exists
+     * from the function argument(s).
+     * I.e. if a schema name exists, the result will be schemaName.tableName,
+     * and otherwise it will just be tableName.
+     * In case that no unique full table can be determined, null is returned.
+     *
+     * @return the fully qualified table name may be null but not blank.
+     */
+    public String getFullTableName()
+    {
+        String fullTableName = null;
+        boolean columnFound = false;
+        for (Object argument : argumentList)
+        {
+            if (argument instanceof Column)
+            {
+                Column column = (Column) argument;
+                if (columnFound
+                    && !ObjectUtils.equals(
+                            fullTableName,
+                            column.getFullTableName()))
+                {
+                    // cannot determine unique full table name, return null
+                    return null;
+                }
+                fullTableName = column.getFullTableName();
+                columnFound = true;
+            }
+        }
+        return fullTableName;
+    }
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AggregateFunction.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AggregateFunction.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AggregateFunction.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AggregateFunction.java Wed Feb 20 21:06:35 2013
@@ -1,240 +1,240 @@
-package org.apache.torque.util.functions;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.torque.Column;
-
-/**
- * <p>A container for classes that will generate SQL for the SQL99 Standard
- * Aggregate functions. These can be used via the Criteria.addSelectColumn
- * method to produce SQL statements that can be called via the
- * BasePeerImpl.doSelect methods.</p>
- * <p>
- * Note database servers that use non-standard function names
- * can be supported by setting the function name in the constructor accordingly.
- * </p>
- * <p>
- * E.g., older MySQL servers use LEAST instead of MIN. This can be
- * supported by supplying "LEAST" as function name.</p>
- *
- * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
- * @version $Id$
- */
-public class AggregateFunction implements SQLFunction
-{
-    /** Should the column have DISTINCT added before it */
-    private boolean distinct;
-
-    /** The function to use */
-    private String function;
-
-    /** The column to apply the function to, not null. */
-    private Column column;
-
-    /**
-     * Constructor for aggregate functions.
-     *
-     * @param function the function name, not null or blank.
-     * @param column the column to apply the function to, not null.
-     * @param distinct whether to apply DISTINCT to the column.
-     */
-    protected AggregateFunction(
-            String function,
-            Column column,
-            boolean distinct)
-    {
-        if (StringUtils.isBlank(function))
-        {
-            throw new IllegalArgumentException(
-                    "function must not be null or blank");
-        }
-        this.function = function;
-        setColumn(column);
-        this.distinct = distinct;
-    }
-
-    /**
-     * Returns the column the function is applied to.
-     *
-     * @return the column, not null.
-     */
-    public Column getColumn()
-    {
-        return column;
-    }
-
-    /**
-     * Sets the column the function is applied to.
-     *
-     * @param column the column, not null.
-     */
-    public void setColumn(Column column)
-    {
-        if (column == null)
-        {
-            throw new IllegalArgumentException(
-                    "column must not be null");
-        }
-        this.column = column;
-    }
-
-    /**
-     * Should the column have DISTINCT added in front of it?
-     *
-     * @return True if DISTINCT is needed.
-     */
-    public boolean isDistinct()
-    {
-        return this.distinct;
-    }
-
-    /**
-     * Get the function name to use, e.g. AVG, MIN, LEAST.
-     *
-     * @return The function name.
-     */
-    protected String getFunction()
-    {
-        return this.function;
-    }
-
-    /**
-     * Set the function name to use, e.g. AVG, MIN, LEAST.
-     *
-     * @param function The function name to use, not null or blank.
-     *
-     * @throws UnsupportedOperationException if a subclass does not support
-     *         changing the function name; never thrown by this implementation.
-     */
-    public void setFunction(String function)
-    {
-        if (StringUtils.isBlank(function))
-        {
-            throw new IllegalArgumentException(
-                    "function must not be null or blank");
-        }
-        this.function = function;
-    }
-
-    /**
-     * Generate the SQL for this function.
-     *
-     * @throws IllegalStateException if the arguments are not set
-     */
-    public String getSqlExpression()
-    {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getFunction()).append("(");
-        if (isDistinct())
-        {
-            sb.append("DISTINCT ");
-        }
-        sb.append(column.getSqlExpression())
-              .append(")");
-        return sb.toString();
-    }
-
-    public Object getArgument(int i)
-    {
-        switch (i)
-        {
-        case 0:
-            return column;
-        case 1:
-            return distinct;
-        default:
-            return null;
-        }
-    }
-
-
-    public Object[] getArguments()
-    {
-        return new Object[] {column, distinct};
-    }
-
-    /**
-     * Assumes that there are one or two arguments being specified.  The
-     * first being a column identifier,
-     * and the second being an optional boolean indicating if DISTINCT
-     * needs to be added.
-     *
-     * @param args The column to apply the function to.
-     * @throws IllegalArgumentException If at least one argument has not
-     *                              been supplied or the second argument
-     *                              object is not Boolean.
-     */
-     public void setArguments(Object[] args)
-     {
-
-         if (args.length < 1)
-         {
-             throw new IllegalArgumentException(
-                   "There must be at least one argument object specified!");
-         }
-         if (args.length < 2)
-         {
-             this.distinct = false;
-         }
-         else
-         {
-             if (!(args[1] instanceof Boolean))
-             {
-                 throw new IllegalArgumentException(
-                        "Second argument object is not type Boolean!");
-             }
-             this.distinct = ((Boolean) args[1]).booleanValue();
-         }
-         if (!(args[0] instanceof Column))
-         {
-             throw new IllegalArgumentException(
-                    "First argument object is not type Column!");
-         }
-         this.column = (Column) args[0];
-     }
-
-     /**
-      * Returns the column name.
-      * This implementation always return null because we do not reference
-      * a real column.
-      *
-      * @return the column name, always null.
-      */
-     public String getColumnName()
-     {
-         return null;
-     }
-
-    public String getTableName()
-    {
-        return column.getTableName();
-    }
-
-    public String getSchemaName()
-    {
-        return column.getSchemaName();
-    }
-
-    public String getFullTableName()
-    {
-        return column.getFullTableName();
-    }
-}
+package org.apache.torque.util.functions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.torque.Column;
+
+/**
+ * <p>A container for classes that will generate SQL for the SQL99 Standard
+ * Aggregate functions. These can be used via the Criteria.addSelectColumn
+ * method to produce SQL statements that can be called via the
+ * BasePeerImpl.doSelect methods.</p>
+ * <p>
+ * Note database servers that use non-standard function names
+ * can be supported by setting the function name in the constructor accordingly.
+ * </p>
+ * <p>
+ * E.g., older MySQL servers use LEAST instead of MIN. This can be
+ * supported by supplying "LEAST" as function name.</p>
+ *
+ * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
+ * @version $Id$
+ */
+public class AggregateFunction implements SQLFunction
+{
+    /** Should the column have DISTINCT added before it */
+    private boolean distinct;
+
+    /** The function to use */
+    private String function;
+
+    /** The column to apply the function to, not null. */
+    private Column column;
+
+    /**
+     * Constructor for aggregate functions.
+     *
+     * @param function the function name, not null or blank.
+     * @param column the column to apply the function to, not null.
+     * @param distinct whether to apply DISTINCT to the column.
+     */
+    protected AggregateFunction(
+            String function,
+            Column column,
+            boolean distinct)
+    {
+        if (StringUtils.isBlank(function))
+        {
+            throw new IllegalArgumentException(
+                    "function must not be null or blank");
+        }
+        this.function = function;
+        setColumn(column);
+        this.distinct = distinct;
+    }
+
+    /**
+     * Returns the column the function is applied to.
+     *
+     * @return the column, not null.
+     */
+    public Column getColumn()
+    {
+        return column;
+    }
+
+    /**
+     * Sets the column the function is applied to.
+     *
+     * @param column the column, not null.
+     */
+    public void setColumn(Column column)
+    {
+        if (column == null)
+        {
+            throw new IllegalArgumentException(
+                    "column must not be null");
+        }
+        this.column = column;
+    }
+
+    /**
+     * Should the column have DISTINCT added in front of it?
+     *
+     * @return True if DISTINCT is needed.
+     */
+    public boolean isDistinct()
+    {
+        return this.distinct;
+    }
+
+    /**
+     * Get the function name to use, e.g. AVG, MIN, LEAST.
+     *
+     * @return The function name.
+     */
+    protected String getFunction()
+    {
+        return this.function;
+    }
+
+    /**
+     * Set the function name to use, e.g. AVG, MIN, LEAST.
+     *
+     * @param function The function name to use, not null or blank.
+     *
+     * @throws UnsupportedOperationException if a subclass does not support
+     *         changing the function name; never thrown by this implementation.
+     */
+    public void setFunction(String function)
+    {
+        if (StringUtils.isBlank(function))
+        {
+            throw new IllegalArgumentException(
+                    "function must not be null or blank");
+        }
+        this.function = function;
+    }
+
+    /**
+     * Generate the SQL for this function.
+     *
+     * @throws IllegalStateException if the arguments are not set
+     */
+    public String getSqlExpression()
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getFunction()).append("(");
+        if (isDistinct())
+        {
+            sb.append("DISTINCT ");
+        }
+        sb.append(column.getSqlExpression())
+              .append(")");
+        return sb.toString();
+    }
+
+    public Object getArgument(int i)
+    {
+        switch (i)
+        {
+        case 0:
+            return column;
+        case 1:
+            return distinct;
+        default:
+            return null;
+        }
+    }
+
+
+    public Object[] getArguments()
+    {
+        return new Object[] {column, distinct};
+    }
+
+    /**
+     * Assumes that there are one or two arguments being specified.  The
+     * first being a column identifier,
+     * and the second being an optional boolean indicating if DISTINCT
+     * needs to be added.
+     *
+     * @param args The column to apply the function to.
+     * @throws IllegalArgumentException If at least one argument has not
+     *                              been supplied or the second argument
+     *                              object is not Boolean.
+     */
+     public void setArguments(Object[] args)
+     {
+
+         if (args.length < 1)
+         {
+             throw new IllegalArgumentException(
+                   "There must be at least one argument object specified!");
+         }
+         if (args.length < 2)
+         {
+             this.distinct = false;
+         }
+         else
+         {
+             if (!(args[1] instanceof Boolean))
+             {
+                 throw new IllegalArgumentException(
+                        "Second argument object is not type Boolean!");
+             }
+             this.distinct = ((Boolean) args[1]).booleanValue();
+         }
+         if (!(args[0] instanceof Column))
+         {
+             throw new IllegalArgumentException(
+                    "First argument object is not type Column!");
+         }
+         this.column = (Column) args[0];
+     }
+
+     /**
+      * Returns the column name.
+      * This implementation always return null because we do not reference
+      * a real column.
+      *
+      * @return the column name, always null.
+      */
+     public String getColumnName()
+     {
+         return null;
+     }
+
+    public String getTableName()
+    {
+        return column.getTableName();
+    }
+
+    public String getSchemaName()
+    {
+        return column.getSchemaName();
+    }
+
+    public String getFullTableName()
+    {
+        return column.getFullTableName();
+    }
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AggregateFunction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Avg.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Count.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Max.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Min.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java Wed Feb 20 21:06:35 2013
@@ -1,72 +1,72 @@
-package org.apache.torque.util.functions;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.torque.Column;
-
-/**
- * Define the basic methods that classes that support SQL Functions
- * need to implement for Classes that use them.  This is intended to
- * allow code to be written before functions are fully integrated
- * with the DBAdaptors.  As well as allowing for functions to
- * expand as needed.
- *
- * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
- * @version $Id$
- */
-public interface SQLFunction extends Column
-{
-    /**
-     * Returns the function parameters at index i.
-     * Should be null if parameter does not exist.
-     *
-     * @param i The 0 based parameter to get.
-     * @return The parameter.  Null if one does not exist.
-     */
-    Object getArgument(int i);
-
-    /**
-     * Returns the column to which this function is applied.
-     *
-     * @return the column, not null.
-     *
-     * @throws IllegalStateException if the column cannot be determined.
-     */
-    Column getColumn();
-
-    /**
-     * Return all the parameters as an object array. This allow for
-     * processing of the parameters in their original format rather
-     * than just in String format.  E.g. a parameter might be specified
-     * as a Date object, or a Column object.
-     *
-     * @return Should return a valid Object array and not null.  E.g.
-     *  implementors should return new Object[0] if there are no parameters.
-     */
-    Object[] getArguments();
-
-    /**
-     * Sets the function specific arguments.  Note, this should generally
-     * only be called by FunctionFactory.
-     *
-     * @param args The function specific arguments.
-     */
-    void setArguments(Object[] args);
-}
+package org.apache.torque.util.functions;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.torque.Column;
+
+/**
+ * Define the basic methods that classes that support SQL Functions
+ * need to implement for Classes that use them.  This is intended to
+ * allow code to be written before functions are fully integrated
+ * with the DBAdaptors.  As well as allowing for functions to
+ * expand as needed.
+ *
+ * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
+ * @version $Id$
+ */
+public interface SQLFunction extends Column
+{
+    /**
+     * Returns the function parameters at index i.
+     * Should be null if parameter does not exist.
+     *
+     * @param i The 0 based parameter to get.
+     * @return The parameter.  Null if one does not exist.
+     */
+    Object getArgument(int i);
+
+    /**
+     * Returns the column to which this function is applied.
+     *
+     * @return the column, not null.
+     *
+     * @throws IllegalStateException if the column cannot be determined.
+     */
+    Column getColumn();
+
+    /**
+     * Return all the parameters as an object array. This allow for
+     * processing of the parameters in their original format rather
+     * than just in String format.  E.g. a parameter might be specified
+     * as a Date object, or a Column object.
+     *
+     * @return Should return a valid Object array and not null.  E.g.
+     *  implementors should return new Object[0] if there are no parameters.
+     */
+    Object[] getArguments();
+
+    /**
+     * Sets the function specific arguments.  Note, this should generally
+     * only be called by FunctionFactory.
+     *
+     * @param args The function specific arguments.
+     */
+    void setArguments(Object[] args);
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Sum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/package.html
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/package.html?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/package.html (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/package.html Wed Feb 20 21:06:35 2013
@@ -1,25 +1,25 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<html>
-  <head>
-  </head>
-  <body>
-    SQL function handling
-  </body>
-</html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html>
+  <head>
+  </head>
+  <body>
+    SQL function handling
+  </body>
+</html>

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java Wed Feb 20 21:06:35 2013
@@ -1,506 +1,506 @@
-package org.apache.torque;
-
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Test for the class ColumnImpl.
- *
- * @version $Id$
- */
-public class ColumnImplTest extends BaseTestCase
-{
-    public void testTableColumnConstructor()
-    {
-        ColumnImpl column = new ColumnImpl(
-                "tableName",
-                "columnName");
-        assertEquals(null, column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "tableName.columnName",
-                column.getSqlExpression());
-    }
-
-    public void testTableColumnConstructorWithSchemaInTable()
-    {
-        ColumnImpl column = new ColumnImpl(
-                "schemaName.tableName",
-                "columnName");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "schemaName.tableName.columnName",
-                column.getSqlExpression());
-    }
-
-    public void testTableColumnConstructorNullTableName()
-    {
-        try
-        {
-            new ColumnImpl(null, "columnName");
-            fail("Exception expected");
-        }
-        catch (NullPointerException e)
-        {
-            // expected
-        }
-    }
-
-    public void testTableColumnConstructorBlankTableName()
-    {
-        try
-        {
-            new ColumnImpl(" ", "columnName");
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testTableColumnConstructorNullColumnName()
-    {
-        try
-        {
-            new ColumnImpl("tableName", null);
-            fail("Exception expected");
-        }
-        catch (NullPointerException e)
-        {
-            // expected
-        }
-    }
-
-    public void testTableColumnConstructorBlankColumnName()
-    {
-        try
-        {
-            new ColumnImpl("tableName", " ");
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSchemaTableColumnConstructor()
-    {
-        ColumnImpl column = new ColumnImpl(
-                "schemaName",
-                "tableName",
-                "columnName");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "tableName.columnName",
-                column.getSqlExpression());
-    }
-
-    public void testSchemaTableColumnConstructorWithSchemaInConstructorAndTable()
-    {
-        ColumnImpl column = new ColumnImpl(
-                "schemaName",
-                "otherSchema.tableName",
-                "columnName");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "tableName.columnName",
-                column.getSqlExpression());
-    }
-
-    public void testSchemaTableColumnConstructorWithSchemaInTable()
-    {
-        ColumnImpl column = new ColumnImpl(
-                null,
-                "schemaName.tableName",
-                "columnName");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "tableName.columnName",
-                column.getSqlExpression());
-    }
-
-    public void testSchemaTableColumnConstructorNullSchemaName()
-    {
-        ColumnImpl column = new ColumnImpl(
-                null,
-                "tableName",
-                "columnName");
-        assertEquals(null, column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals("tableName.columnName", column.getSqlExpression());
-    }
-
-    public void testSchemaTableColumnConstructorNullTableName()
-    {
-        ColumnImpl column = new ColumnImpl("schemaName", null, "columnName");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals(null, column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals("columnName", column.getSqlExpression());
-    }
-
-    public void testSchemaTableColumnConstructorBlankSchemaName()
-    {
-        try
-        {
-            new ColumnImpl(" ", "tableName", "columnName");
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSchemaTableColumnConstructorBlankTableName()
-    {
-        try
-        {
-            new ColumnImpl("schemaName", " ", "columnName");
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSchemaTableColumnConstructorNullColumnName()
-    {
-        try
-        {
-            new ColumnImpl("schemaName", "tableName", null);
-            fail("Exception expected");
-        }
-        catch (NullPointerException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSchemaTableColumnConstructorBlankColumnName()
-    {
-        try
-        {
-            new ColumnImpl("schemaName", "tableName", " ");
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSqlExpressionConstructor()
-    {
-        ColumnImpl column = new ColumnImpl("schemaName.tableName.columnName");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals("tableName.columnName", column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorNull()
-    {
-        try
-        {
-            new ColumnImpl(null);
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSqlExpressionConstructorBlank()
-    {
-        try
-        {
-            new ColumnImpl("");
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSqlExpressionConstructorNoDot()
-    {
-        ColumnImpl column =  new ColumnImpl("columnName");
-        assertEquals(null, column.getSchemaName());
-        assertEquals(null, column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals("columnName", column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorAsterisk()
-    {
-        ColumnImpl column = new ColumnImpl("tableName.*");
-        assertEquals(null, column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals(null, column.getColumnName());
-        assertEquals("tableName.*", column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorAsteriskAndSchema()
-    {
-        ColumnImpl column = new ColumnImpl("schemaName.tableName.*");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals(null, column.getColumnName());
-        assertEquals("tableName.*", column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorBlankColumnName()
-    {
-        try
-        {
-            new ColumnImpl("tableName.");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSqlExpressionConstructorBlankTableName()
-    {
-        try
-        {
-            new ColumnImpl(".columnName");
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSqlExpressionConstructorCount()
-    {
-        ColumnImpl column
-                = new ColumnImpl("count(schemaName.tableName.columnName)");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "count(tableName.columnName)",
-                column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorSqlFunction()
-    {
-        ColumnImpl column = new ColumnImpl(
-                "function(1, schemaName.tableName.columnName ,2)");
-        assertEquals("schemaName", column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "function(1, tableName.columnName ,2)",
-                column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorComparisonAfter()
-    {
-        ColumnImpl column = new ColumnImpl("tableName.columnName < 10");
-        assertEquals(null, column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "tableName.columnName < 10",
-                column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorComparisonBefore()
-    {
-        ColumnImpl column = new ColumnImpl("10 < tableName.columnName");
-        assertEquals(null, column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "10 < tableName.columnName",
-                column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorInClause()
-    {
-        ColumnImpl column = new ColumnImpl("tableName.columnName in (1,2,3)");
-        assertEquals(null, column.getSchemaName());
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "tableName.columnName in (1,2,3)",
-                column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorSqlFunctionAsteriskColumnName()
-    {
-        ColumnImpl column = new ColumnImpl("count(tableName.*)");
-        assertEquals("tableName", column.getTableName());
-        assertEquals(null, column.getColumnName());
-        assertEquals("count(tableName.*)", column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorSqlFunctionAsteriskOnly()
-    {
-        ColumnImpl column = new ColumnImpl("count(*)");
-        assertEquals(null, column.getTableName());
-        assertEquals(null, column.getColumnName());
-        assertEquals("count(*)", column.getSqlExpression());
-    }
-
-    public void testSqlExpressionConstructorSqlFunctionEmptyTableName()
-    {
-        try
-        {
-            new ColumnImpl("count(.columnName)");
-            fail("Exception expected");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // expected
-        }
-    }
-
-    public void testSqlExpressionConstructorAlias()
-    {
-        ColumnImpl column = new ColumnImpl("tableName.columnName AS x");
-        assertEquals("tableName", column.getTableName());
-        assertEquals("columnName", column.getColumnName());
-        assertEquals(
-                "tableName.columnName AS x",
-                column.getSqlExpression());
-    }
-
-    public void testGetSqlExpressionNoSchema()
-    {
-        ColumnImpl column = new ColumnImpl(null, "tableName", "columnName");
-        assertEquals("tableName.columnName", column.getSqlExpression());
-    }
-
-    public void testGetSqlExpressionWithSchema()
-    {
-        ColumnImpl column
-                = new ColumnImpl("schemaName", "tableName", "columnName");
-        assertEquals(
-                "tableName.columnName",
-                column.getSqlExpression());
-    }
-
-    public void testEquals()
-    {
-        ColumnImpl column1 = new ColumnImpl(
-                "schemaName",
-                "tableName",
-                "columnName",
-                "tableName.columnName AS x");
-        ColumnImpl column2 = new ColumnImpl(
-                "schemaName",
-                "tableName",
-                "columnName",
-                "tableName.columnName AS x");
-        assertTrue(column1.equals(column2));
-    }
-
-    public void testEqualsSchemaTableColumnNull()
-    {
-        ColumnImpl column1 = new ColumnImpl(
-                null,
-                null,
-                null,
-                "*");
-        ColumnImpl column2 = new ColumnImpl(
-                null,
-                null,
-                null,
-                "*");
-        assertTrue(column1.equals(column2));
-    }
-
-    public void testEqualsWrongColumn()
-    {
-        ColumnImpl column1 = new ColumnImpl(
-                "schemaName",
-                "tableName",
-                "columnName1");
-        ColumnImpl column2 = new ColumnImpl(
-                "schemaName",
-                "tableName",
-                "columnName2");
-        assertFalse(column1.equals(column2));
-    }
-
-    public void testEqualsWrongTable()
-    {
-        ColumnImpl column1 = new ColumnImpl(
-                "schemaName",
-                "tableName1",
-                "columnName");
-        ColumnImpl column2 = new ColumnImpl(
-                "schemaName",
-                "tableName2",
-                "columnName");
-        assertFalse(column1.equals(column2));
-    }
-
-    public void testEqualsWrongSchema()
-    {
-        ColumnImpl column1 = new ColumnImpl(
-                "schemaName1",
-                "tableName",
-                "columnName");
-        ColumnImpl column2 = new ColumnImpl(
-                "schemaName2",
-                "tableName",
-                "columnName");
-        assertFalse(column1.equals(column2));
-    }
-
-    public void testEqualsWrongSqlExpression()
-    {
-        ColumnImpl column1 = new ColumnImpl("tableName.columnName AS x");
-        ColumnImpl column2 = new ColumnImpl("tableName.columnName AS y");
-        assertFalse(column1.equals(column2));
-    }
-
-    public void testToString()
-    {
-        ColumnImpl column = new ColumnImpl(
-                "schemaName1.tableName1.columnName1 AS x");
-        assertEquals("ColumnImpl [columnName=columnName1, tableName="
-                + "tableName1, schemaName=schemaName1, "
-                + "sqlExpression=tableName1.columnName1 AS x]",
-                column.toString());
-    }
-}
+package org.apache.torque;
+
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Test for the class ColumnImpl.
+ *
+ * @version $Id$
+ */
+public class ColumnImplTest extends BaseTestCase
+{
+    public void testTableColumnConstructor()
+    {
+        ColumnImpl column = new ColumnImpl(
+                "tableName",
+                "columnName");
+        assertEquals(null, column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "tableName.columnName",
+                column.getSqlExpression());
+    }
+
+    public void testTableColumnConstructorWithSchemaInTable()
+    {
+        ColumnImpl column = new ColumnImpl(
+                "schemaName.tableName",
+                "columnName");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "schemaName.tableName.columnName",
+                column.getSqlExpression());
+    }
+
+    public void testTableColumnConstructorNullTableName()
+    {
+        try
+        {
+            new ColumnImpl(null, "columnName");
+            fail("Exception expected");
+        }
+        catch (NullPointerException e)
+        {
+            // expected
+        }
+    }
+
+    public void testTableColumnConstructorBlankTableName()
+    {
+        try
+        {
+            new ColumnImpl(" ", "columnName");
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testTableColumnConstructorNullColumnName()
+    {
+        try
+        {
+            new ColumnImpl("tableName", null);
+            fail("Exception expected");
+        }
+        catch (NullPointerException e)
+        {
+            // expected
+        }
+    }
+
+    public void testTableColumnConstructorBlankColumnName()
+    {
+        try
+        {
+            new ColumnImpl("tableName", " ");
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSchemaTableColumnConstructor()
+    {
+        ColumnImpl column = new ColumnImpl(
+                "schemaName",
+                "tableName",
+                "columnName");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "tableName.columnName",
+                column.getSqlExpression());
+    }
+
+    public void testSchemaTableColumnConstructorWithSchemaInConstructorAndTable()
+    {
+        ColumnImpl column = new ColumnImpl(
+                "schemaName",
+                "otherSchema.tableName",
+                "columnName");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "tableName.columnName",
+                column.getSqlExpression());
+    }
+
+    public void testSchemaTableColumnConstructorWithSchemaInTable()
+    {
+        ColumnImpl column = new ColumnImpl(
+                null,
+                "schemaName.tableName",
+                "columnName");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "tableName.columnName",
+                column.getSqlExpression());
+    }
+
+    public void testSchemaTableColumnConstructorNullSchemaName()
+    {
+        ColumnImpl column = new ColumnImpl(
+                null,
+                "tableName",
+                "columnName");
+        assertEquals(null, column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals("tableName.columnName", column.getSqlExpression());
+    }
+
+    public void testSchemaTableColumnConstructorNullTableName()
+    {
+        ColumnImpl column = new ColumnImpl("schemaName", null, "columnName");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals(null, column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals("columnName", column.getSqlExpression());
+    }
+
+    public void testSchemaTableColumnConstructorBlankSchemaName()
+    {
+        try
+        {
+            new ColumnImpl(" ", "tableName", "columnName");
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSchemaTableColumnConstructorBlankTableName()
+    {
+        try
+        {
+            new ColumnImpl("schemaName", " ", "columnName");
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSchemaTableColumnConstructorNullColumnName()
+    {
+        try
+        {
+            new ColumnImpl("schemaName", "tableName", null);
+            fail("Exception expected");
+        }
+        catch (NullPointerException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSchemaTableColumnConstructorBlankColumnName()
+    {
+        try
+        {
+            new ColumnImpl("schemaName", "tableName", " ");
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSqlExpressionConstructor()
+    {
+        ColumnImpl column = new ColumnImpl("schemaName.tableName.columnName");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals("tableName.columnName", column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorNull()
+    {
+        try
+        {
+            new ColumnImpl(null);
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSqlExpressionConstructorBlank()
+    {
+        try
+        {
+            new ColumnImpl("");
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSqlExpressionConstructorNoDot()
+    {
+        ColumnImpl column =  new ColumnImpl("columnName");
+        assertEquals(null, column.getSchemaName());
+        assertEquals(null, column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals("columnName", column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorAsterisk()
+    {
+        ColumnImpl column = new ColumnImpl("tableName.*");
+        assertEquals(null, column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals(null, column.getColumnName());
+        assertEquals("tableName.*", column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorAsteriskAndSchema()
+    {
+        ColumnImpl column = new ColumnImpl("schemaName.tableName.*");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals(null, column.getColumnName());
+        assertEquals("tableName.*", column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorBlankColumnName()
+    {
+        try
+        {
+            new ColumnImpl("tableName.");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSqlExpressionConstructorBlankTableName()
+    {
+        try
+        {
+            new ColumnImpl(".columnName");
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSqlExpressionConstructorCount()
+    {
+        ColumnImpl column
+                = new ColumnImpl("count(schemaName.tableName.columnName)");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "count(tableName.columnName)",
+                column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorSqlFunction()
+    {
+        ColumnImpl column = new ColumnImpl(
+                "function(1, schemaName.tableName.columnName ,2)");
+        assertEquals("schemaName", column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "function(1, tableName.columnName ,2)",
+                column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorComparisonAfter()
+    {
+        ColumnImpl column = new ColumnImpl("tableName.columnName < 10");
+        assertEquals(null, column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "tableName.columnName < 10",
+                column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorComparisonBefore()
+    {
+        ColumnImpl column = new ColumnImpl("10 < tableName.columnName");
+        assertEquals(null, column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "10 < tableName.columnName",
+                column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorInClause()
+    {
+        ColumnImpl column = new ColumnImpl("tableName.columnName in (1,2,3)");
+        assertEquals(null, column.getSchemaName());
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "tableName.columnName in (1,2,3)",
+                column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorSqlFunctionAsteriskColumnName()
+    {
+        ColumnImpl column = new ColumnImpl("count(tableName.*)");
+        assertEquals("tableName", column.getTableName());
+        assertEquals(null, column.getColumnName());
+        assertEquals("count(tableName.*)", column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorSqlFunctionAsteriskOnly()
+    {
+        ColumnImpl column = new ColumnImpl("count(*)");
+        assertEquals(null, column.getTableName());
+        assertEquals(null, column.getColumnName());
+        assertEquals("count(*)", column.getSqlExpression());
+    }
+
+    public void testSqlExpressionConstructorSqlFunctionEmptyTableName()
+    {
+        try
+        {
+            new ColumnImpl("count(.columnName)");
+            fail("Exception expected");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // expected
+        }
+    }
+
+    public void testSqlExpressionConstructorAlias()
+    {
+        ColumnImpl column = new ColumnImpl("tableName.columnName AS x");
+        assertEquals("tableName", column.getTableName());
+        assertEquals("columnName", column.getColumnName());
+        assertEquals(
+                "tableName.columnName AS x",
+                column.getSqlExpression());
+    }
+
+    public void testGetSqlExpressionNoSchema()
+    {
+        ColumnImpl column = new ColumnImpl(null, "tableName", "columnName");
+        assertEquals("tableName.columnName", column.getSqlExpression());
+    }
+
+    public void testGetSqlExpressionWithSchema()
+    {
+        ColumnImpl column
+                = new ColumnImpl("schemaName", "tableName", "columnName");
+        assertEquals(
+                "tableName.columnName",
+                column.getSqlExpression());
+    }
+
+    public void testEquals()
+    {
+        ColumnImpl column1 = new ColumnImpl(
+                "schemaName",
+                "tableName",
+                "columnName",
+                "tableName.columnName AS x");
+        ColumnImpl column2 = new ColumnImpl(
+                "schemaName",
+                "tableName",
+                "columnName",
+                "tableName.columnName AS x");
+        assertTrue(column1.equals(column2));
+    }
+
+    public void testEqualsSchemaTableColumnNull()
+    {
+        ColumnImpl column1 = new ColumnImpl(
+                null,
+                null,
+                null,
+                "*");
+        ColumnImpl column2 = new ColumnImpl(
+                null,
+                null,
+                null,
+                "*");
+        assertTrue(column1.equals(column2));
+    }
+
+    public void testEqualsWrongColumn()
+    {
+        ColumnImpl column1 = new ColumnImpl(
+                "schemaName",
+                "tableName",
+                "columnName1");
+        ColumnImpl column2 = new ColumnImpl(
+                "schemaName",
+                "tableName",
+                "columnName2");
+        assertFalse(column1.equals(column2));
+    }
+
+    public void testEqualsWrongTable()
+    {
+        ColumnImpl column1 = new ColumnImpl(
+                "schemaName",
+                "tableName1",
+                "columnName");
+        ColumnImpl column2 = new ColumnImpl(
+                "schemaName",
+                "tableName2",
+                "columnName");
+        assertFalse(column1.equals(column2));
+    }
+
+    public void testEqualsWrongSchema()
+    {
+        ColumnImpl column1 = new ColumnImpl(
+                "schemaName1",
+                "tableName",
+                "columnName");
+        ColumnImpl column2 = new ColumnImpl(
+                "schemaName2",
+                "tableName",
+                "columnName");
+        assertFalse(column1.equals(column2));
+    }
+
+    public void testEqualsWrongSqlExpression()
+    {
+        ColumnImpl column1 = new ColumnImpl("tableName.columnName AS x");
+        ColumnImpl column2 = new ColumnImpl("tableName.columnName AS y");
+        assertFalse(column1.equals(column2));
+    }
+
+    public void testToString()
+    {
+        ColumnImpl column = new ColumnImpl(
+                "schemaName1.tableName1.columnName1 AS x");
+        assertEquals("ColumnImpl [columnName=columnName1, tableName="
+                + "tableName1, schemaName=schemaName1, "
+                + "sqlExpression=tableName1.columnName1 AS x]",
+                column.toString());
+    }
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueRuntimeExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java Wed Feb 20 21:06:35 2013
@@ -1,78 +1,78 @@
-package org.apache.torque.adapter;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-
-import org.apache.torque.sql.Query;
-import org.apache.torque.util.UniqueList;
-
-public class DBOracleTest extends TestCase
-{
-    /**
-     * Tests whether replacing the select columns in limit/offset
-     * treatment works (double column names must be aliased)
-     */
-    public void testSelectColumnsForLimitOffset()
-    {
-        UniqueList input = new UniqueList();
-        input.add("c1");
-        input.add("c2");
-        input.add("c1 a1");
-        input.add("c1 a2");
-        input.add("t.c1 a4");
-
-        // A list with no duplicates must remain unchanged
-        Query query = new Query();
-        query.getSelectClause().addAll(input);
-        new OracleAdapter().generateLimits(query, 0, 1);
-        assertEquals(input, query.getSelectClause());
-
-        // double column names must be aliased
-        query = new Query();
-        input.set(1, "t.c1");
-        query.getSelectClause().addAll(input);
-        new OracleAdapter().generateLimits(query, 0, 1);
-        UniqueList expected = new UniqueList(input);
-        expected.set(1, "t.c1 a0");
-        assertEquals(expected, query.getSelectClause());
-
-        // a column name which is the same as an alias name must be replaced
-        query = new Query();
-        input.set(1, "c2");
-        input.set(0, "t.a1");
-        query.getSelectClause().addAll(input);
-        new OracleAdapter().generateLimits(query, 0, 1);
-        expected = new UniqueList(input);
-        expected.set(0, "t.a1 a0");
-        assertEquals(query.getSelectClause(), expected);
-
-        // triple column names must be made unique
-        query = new Query();
-        input.set(1, "t2.a1");
-        query.getSelectClause().addAll(input);
-        new OracleAdapter().generateLimits(query, 0, 1);
-        expected = new UniqueList(input);
-        expected.set(0, "t.a1 a0");
-        expected.set(1, "t2.a1 a3");
-        assertEquals(expected, query.getSelectClause());
-    }
-
-}
+package org.apache.torque.adapter;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.torque.sql.Query;
+import org.apache.torque.util.UniqueList;
+
+public class DBOracleTest extends TestCase
+{
+    /**
+     * Tests whether replacing the select columns in limit/offset
+     * treatment works (double column names must be aliased)
+     */
+    public void testSelectColumnsForLimitOffset()
+    {
+        UniqueList input = new UniqueList();
+        input.add("c1");
+        input.add("c2");
+        input.add("c1 a1");
+        input.add("c1 a2");
+        input.add("t.c1 a4");
+
+        // A list with no duplicates must remain unchanged
+        Query query = new Query();
+        query.getSelectClause().addAll(input);
+        new OracleAdapter().generateLimits(query, 0, 1);
+        assertEquals(input, query.getSelectClause());
+
+        // double column names must be aliased
+        query = new Query();
+        input.set(1, "t.c1");
+        query.getSelectClause().addAll(input);
+        new OracleAdapter().generateLimits(query, 0, 1);
+        UniqueList expected = new UniqueList(input);
+        expected.set(1, "t.c1 a0");
+        assertEquals(expected, query.getSelectClause());
+
+        // a column name which is the same as an alias name must be replaced
+        query = new Query();
+        input.set(1, "c2");
+        input.set(0, "t.a1");
+        query.getSelectClause().addAll(input);
+        new OracleAdapter().generateLimits(query, 0, 1);
+        expected = new UniqueList(input);
+        expected.set(0, "t.a1 a0");
+        assertEquals(query.getSelectClause(), expected);
+
+        // triple column names must be made unique
+        query = new Query();
+        input.set(1, "t2.a1");
+        query.getSelectClause().addAll(input);
+        new OracleAdapter().generateLimits(query, 0, 1);
+        expected = new UniqueList(input);
+        expected.set(0, "t.a1 a0");
+        expected.set(1, "t2.a1 a3");
+        assertEquals(expected, query.getSelectClause());
+    }
+
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java Wed Feb 20 21:06:35 2013
@@ -1,79 +1,79 @@
-package org.apache.torque.avalon;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.fulcrum.testcontainer.BaseUnitTest;
-import org.apache.torque.BaseTestCase;
-
-/**
- * Basic testing of the Torque Avalon Component
- *
- * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
- * @version $Id$
- */
-public class AvalonTest extends BaseUnitTest
-{
-    private Torque torque = null;
-
-    /**
-     * Constructor for test.
-     *
-     * @param name The name of the test being executed
-     */
-    public AvalonTest(String name)
-    {
-        super(name);
-    }
-
-    @Override
-    public void setUp() throws Exception
-    {
-    }
-
-    /**
-     * Verifies that the container initialization and lookup works properly.
-     */
-    public void testAvalonTorqueNotInitialized() throws Exception
-    {
-        setConfigurationFileName("src/test/resources/TestComponentConfig.xml");
-        setRoleFileName("src/test/resources/TestRoleConfig.xml");
-        super.setUp();
-        torque = (Torque) this.resolve(Torque.class.getName());
-
-        assertTrue(torque.isInit());
-        assertTrue("Instances should be identical", torque == org.apache.torque.Torque.getInstance());
-    }
-
-    /**
-     * Verifies that the container initialization and lookup works properly.
-     */
-    public void testAvalonTorqueInitialized() throws Exception
-    {
-        org.apache.torque.Torque.setInstance(null);
-        org.apache.torque.Torque.init(BaseTestCase.CONFIG_FILE);
-        setConfigurationFileName("src/test/resources/TestComponentConfig.xml");
-        setRoleFileName("src/test/resources/TestRoleConfig.xml");
-        super.setUp();
-        torque = (Torque) this.resolve(Torque.class.getName());
-
-        assertTrue(torque.isInit());
-        assertTrue("Instances should be identical", torque == org.apache.torque.Torque.getInstance());
-    }
-}
+package org.apache.torque.avalon;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.fulcrum.testcontainer.BaseUnitTest;
+import org.apache.torque.BaseTestCase;
+
+/**
+ * Basic testing of the Torque Avalon Component
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id$
+ */
+public class AvalonTest extends BaseUnitTest
+{
+    private Torque torque = null;
+
+    /**
+     * Constructor for test.
+     *
+     * @param name The name of the test being executed
+     */
+    public AvalonTest(String name)
+    {
+        super(name);
+    }
+
+    @Override
+    public void setUp() throws Exception
+    {
+    }
+
+    /**
+     * Verifies that the container initialization and lookup works properly.
+     */
+    public void testAvalonTorqueNotInitialized() throws Exception
+    {
+        setConfigurationFileName("src/test/resources/TestComponentConfig.xml");
+        setRoleFileName("src/test/resources/TestRoleConfig.xml");
+        super.setUp();
+        torque = (Torque) this.resolve(Torque.class.getName());
+
+        assertTrue(torque.isInit());
+        assertTrue("Instances should be identical", torque == org.apache.torque.Torque.getInstance());
+    }
+
+    /**
+     * Verifies that the container initialization and lookup works properly.
+     */
+    public void testAvalonTorqueInitialized() throws Exception
+    {
+        org.apache.torque.Torque.setInstance(null);
+        org.apache.torque.Torque.init(BaseTestCase.CONFIG_FILE);
+        setConfigurationFileName("src/test/resources/TestComponentConfig.xml");
+        setRoleFileName("src/test/resources/TestRoleConfig.xml");
+        super.setUp();
+        torque = (Torque) this.resolve(Torque.class.getName());
+
+        assertTrue(torque.isInit());
+        assertTrue("Instances should be identical", torque == org.apache.torque.Torque.getInstance());
+    }
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message