From mpoeschl@apache.org Fri Mar 21 17:31:10 2003 Return-Path: Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 26734 invoked by uid 500); 21 Mar 2003 17:31:10 -0000 Received: (qmail 26719 invoked from network); 21 Mar 2003 17:31:10 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 21 Mar 2003 17:31:10 -0000 Received: (qmail 28879 invoked by uid 1280); 21 Mar 2003 17:31:09 -0000 Date: 21 Mar 2003 17:31:09 -0000 Message-ID: <20030321173109.28878.qmail@icarus.apache.org> From: mpoeschl@apache.org To: db-torque-cvs@apache.org Subject: cvs commit: db-torque/src/generator/src/java/org/apache/torque/engine/database/transform XmlToData.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N mpoeschl 2003/03/21 09:31:09 Modified: src/java/org/apache/torque/util Query.java BasePeer.java src/java/org/apache/torque/om NumberKey.java src/generator/src/java/org/apache/torque/task TorqueSQLExec.java TorqueJDBCTransformTask.java src/java/org/apache/torque/map ColumnMap.java src/generator/src/java/org/apache/torque/engine/database/model ForeignKey.java src/rttest/org/apache/torque DataTest.java src/java/org/apache/torque/manager MethodResultCache.java src/test/org/apache/torque/util QueryTest.java src/test/org/apache/torque/om ComboKeyTest.java src/generator/src/java/org/apache/torque/engine/database/transform XmlToData.java Log: o cleanup imports o remove unused members o some oder fixes for errors reported by pmd Revision Changes Path 1.11 +2 -5 db-torque/src/java/org/apache/torque/util/Query.java Index: Query.java =================================================================== RCS file: /home/cvs/db-torque/src/java/org/apache/torque/util/Query.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Query.java 21 Mar 2003 16:28:15 -0000 1.10 +++ Query.java 21 Mar 2003 17:31:08 -0000 1.11 @@ -3,7 +3,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,12 +73,9 @@ private static final String FROM = " FROM "; private static final String WHERE = " WHERE "; private static final String AND = " AND "; - private static final String OR = " OR "; private static final String ORDER_BY = " ORDER BY "; private static final String GROUP_BY = " GROUP BY "; private static final String HAVING = " HAVING "; - private static final String IN = " IN "; - private static final String BETWEEN = " BETWEEN "; private static final String LIMIT = " LIMIT "; private static final String ROWCOUNT = " SET ROWCOUNT "; 1.62 +1 -9 db-torque/src/java/org/apache/torque/util/BasePeer.java Index: BasePeer.java =================================================================== RCS file: /home/cvs/db-torque/src/java/org/apache/torque/util/BasePeer.java,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- BasePeer.java 21 Mar 2003 08:36:23 -0000 1.61 +++ BasePeer.java 21 Mar 2003 17:31:08 -0000 1.62 @@ -684,12 +684,6 @@ IdGenerator keyGen = tableMap.getIdGenerator(); ColumnMap pk = getPrimaryKey(criteria); - // only get a new key value if you need to - // the reason is that a primary key might be defined - // but you are still going to set its value. for example: - // a join table where both keys are primary and you are - // setting both columns with your own values - boolean info = false; // pk will be null if there is no primary key defined for the table // we're inserting into. @@ -1034,7 +1028,6 @@ StringStack orderBy = criteria.getOrderByColumns(); StringStack groupBy = criteria.getGroupByColumns(); - boolean ignoreCase = criteria.isIgnoreCase(); StringStack select = criteria.getSelectColumns(); Hashtable aliases = criteria.getAsColumns(); StringStack modifiers = criteria.getSelectModifiers(); @@ -2300,7 +2293,6 @@ StringStack orderByClause = query.getOrderByClause(); StringStack orderBy = criteria.getOrderByColumns(); - boolean ignoreCase = criteria.isIgnoreCase(); StringStack select = criteria.getSelectColumns(); Hashtable aliases = criteria.getAsColumns(); StringStack modifiers = criteria.getSelectModifiers(); 1.16 +3 -3 db-torque/src/java/org/apache/torque/om/NumberKey.java Index: NumberKey.java =================================================================== RCS file: /home/cvs/db-torque/src/java/org/apache/torque/om/NumberKey.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- NumberKey.java 18 Jan 2003 14:51:34 -0000 1.15 +++ NumberKey.java 21 Mar 2003 17:31:08 -0000 1.16 @@ -3,7 +3,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -139,7 +139,7 @@ */ public NumberKey(int key) { - this.key = new BigDecimal(new Integer(key).toString()); + this.key = new BigDecimal(String.valueOf(key)); } /** 1.2 +2 -5 db-torque/src/generator/src/java/org/apache/torque/task/TorqueSQLExec.java Index: TorqueSQLExec.java =================================================================== RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/task/TorqueSQLExec.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TorqueSQLExec.java 10 Feb 2003 13:20:59 -0000 1.1 +++ TorqueSQLExec.java 21 Mar 2003 17:31:08 -0000 1.2 @@ -3,7 +3,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -144,9 +144,6 @@ /** SQL input command */ private String sqlCommand = ""; - - /** SQL transactions to perform */ - private List transactions = new ArrayList(); /** SQL Statement delimiter */ private String delimiter = ";"; 1.2 +3 -5 db-torque/src/generator/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java Index: TorqueJDBCTransformTask.java =================================================================== RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TorqueJDBCTransformTask.java 10 Feb 2003 13:20:59 -0000 1.1 +++ TorqueJDBCTransformTask.java 21 Mar 2003 17:31:08 -0000 1.2 @@ -3,7 +3,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -219,9 +219,7 @@ log("DB driver sucessfuly instantiated"); // Attemtp to connect to a database. - Connection con = DriverManager.getConnection(dbUrl, - dbUser, - dbPassword); + Connection con = DriverManager.getConnection(dbUrl, dbUser, dbPassword); log("DB connection established"); // Get the database Metadata. 1.7 +2 -9 db-torque/src/java/org/apache/torque/map/ColumnMap.java Index: ColumnMap.java =================================================================== RCS file: /home/cvs/db-torque/src/java/org/apache/torque/map/ColumnMap.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ColumnMap.java 26 Nov 2002 23:46:56 -0000 1.6 +++ ColumnMap.java 21 Mar 2003 17:31:08 -0000 1.7 @@ -259,14 +259,7 @@ */ public boolean isForeignKey() { - if (relatedTableName != null && relatedTableName.length() > 0) - { - return true; - } - else - { - return false; - } + return (relatedTableName != null && relatedTableName.length() > 0); } /** 1.3 +3 -3 db-torque/src/generator/src/java/org/apache/torque/engine/database/model/ForeignKey.java Index: ForeignKey.java =================================================================== RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/ForeignKey.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ForeignKey.java 18 Feb 2003 08:05:49 -0000 1.2 +++ ForeignKey.java 21 Mar 2003 17:31:08 -0000 1.3 @@ -3,7 +3,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -338,7 +338,7 @@ for (int i = 0; i < localColumns.size(); i++) { - h.put (foreignColumns.get(i), localColumns.get(i)); + h.put(foreignColumns.get(i), localColumns.get(i)); } return h; 1.6 +9 -8 db-torque/src/rttest/org/apache/torque/DataTest.java Index: DataTest.java =================================================================== RCS file: /home/cvs/db-torque/src/rttest/org/apache/torque/DataTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- DataTest.java 9 Jan 2003 17:46:22 -0000 1.5 +++ DataTest.java 21 Mar 2003 17:31:08 -0000 1.6 @@ -3,7 +3,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,7 +58,6 @@ import java.util.HashMap; import java.util.List; import java.util.Iterator; -import org.apache.torque.BaseTestCase; import org.apache.torque.test.Author; import org.apache.torque.test.Book; import org.apache.torque.test.BookPeer; @@ -145,7 +144,7 @@ public void testLimitOffset() { Map titleMap = new HashMap(); - for (int j=0; j. */ -import java.util.Map; -import java.util.HashMap; import java.io.Serializable; -import org.apache.jcs.access.GroupCacheAccess; -import org.apache.jcs.access.exception.CacheException; +import java.util.HashMap; +import java.util.Map; + import org.apache.commons.pool.ObjectPool; import org.apache.commons.pool.impl.StackObjectPool; + +import org.apache.jcs.access.GroupCacheAccess; +import org.apache.jcs.access.exception.CacheException; + import org.apache.log4j.Logger; import org.apache.torque.TorqueException; @@ -73,8 +76,6 @@ */ public class MethodResultCache { - private static final String keyClassName = - "org.apache.torque.manager.MethodCacheKey"; private ObjectPool pool; private GroupCacheAccess jcsCache; private boolean lockCache; 1.2 +2 -3 db-torque/src/test/org/apache/torque/util/QueryTest.java Index: QueryTest.java =================================================================== RCS file: /home/cvs/db-torque/src/test/org/apache/torque/util/QueryTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- QueryTest.java 21 Mar 2003 16:28:15 -0000 1.1 +++ QueryTest.java 21 Mar 2003 17:31:09 -0000 1.2 @@ -55,7 +55,7 @@ */ import junit.framework.TestCase; -import java.util.*; + import org.apache.commons.collections.StringStack; /** @@ -126,5 +126,4 @@ System.out.println(query.toString()); assertEquals(expected, query.toString()); } - } 1.3 +52 -19 db-torque/src/test/org/apache/torque/om/ComboKeyTest.java Index: ComboKeyTest.java =================================================================== RCS file: /home/cvs/db-torque/src/test/org/apache/torque/om/ComboKeyTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ComboKeyTest.java 12 Dec 2002 12:53:11 -0000 1.2 +++ ComboKeyTest.java 21 Mar 2003 17:31:09 -0000 1.3 @@ -3,7 +3,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,8 +77,6 @@ private java.util.Date now = new java.util.Date(); private ComboKey c3a = new ComboKey( new SimpleKey[]{new StringKey("key1"), null, new DateKey(now)}); - private ComboKey c3b = new ComboKey(new SimpleKey[]{ - new StringKey("key1"), null, new DateKey(now)}); private ComboKey c4a = new ComboKey( new SimpleKey[]{new StringKey("key1"), null, new NumberKey(123456)}); @@ -92,12 +90,19 @@ super(name); } - + /** + * + * @param args + */ public static void main(java.lang.String[] args) { junit.textui.TestRunner.run(suite()); } + /** + * + * @return Test + */ public static Test suite() { TestSuite suite = new TestSuite(ComboKeyTest.class); @@ -105,6 +110,10 @@ return suite; } + /** + * + * + */ public void testReflexive() { Assert.assertTrue(c1a.equals(c1a)); @@ -114,27 +123,38 @@ Assert.assertTrue(c3a.looseEquals(c3a)); } -// public void testReflexiveWithNullKeyValue() -// { -// Assert.assertTrue(c3a.equals(c3a)); -// } - + /** + * + * + */ public void testSymmetric() { Assert.assertTrue(c1a.equals(c1b)); Assert.assertTrue(c1b.equals(c1a)); } + /** + * + * + */ public void testNull() { Assert.assertTrue(!c1a.equals(null)); } + /** + * + * + */ public void testNotEqual() { Assert.assertTrue(!c1a.equals(c2a)); } + /** + * + * + */ public void testRoundTripWithStringKeys() { // two strings @@ -156,6 +176,10 @@ Assert.assertEquals(oldKey,newKey); } + /** + * + * + */ public void testRoundTripWithComplexKey() { // complex key @@ -169,14 +193,19 @@ { newKey = new ComboKey(stringValue); } - catch(Exception e) + catch (Exception e) { - fail("Exception " + e.getClass().getName() + " thrown on new ComboKey(" - + stringValue + "):" + e.getMessage()); + fail("Exception " + e.getClass().getName() + + " thrown on new ComboKey(" + + stringValue + "):" + e.getMessage()); } Assert.assertEquals(oldKey,newKey); } + /** + * + * + */ public void testRoundTripWithNullKey() { // with null key @@ -189,10 +218,11 @@ { newKey = new ComboKey(stringValue); } - catch(Exception e) + catch (Exception e) { - fail("Exception " + e.getClass().getName() + " thrown on new ComboKey(" - + stringValue + "):" + e.getMessage()); + fail("Exception " + e.getClass().getName() + + " thrown on new ComboKey(" + + stringValue + "):" + e.getMessage()); } // This currently has to use looseEquals as ComboKey.equals(Obj) // does not accept null key values (WHY!) @@ -200,7 +230,9 @@ } - /** Test of appendTo method, of class org.apache.torque.om.ComboKey. */ + /** + * Test of appendTo method, of class org.apache.torque.om.ComboKey. + */ public void testAppendTo() { StringBuffer sb = new StringBuffer(); @@ -208,10 +240,11 @@ Assert.assertEquals("Skey1:Skey2:", sb.toString()); } - /** Test of toString method, of class org.apache.torque.om.ComboKey. */ + /** + * Test of toString method, of class org.apache.torque.om.ComboKey. + */ public void testToString() { Assert.assertEquals("Skey1::N123456:", c4a.toString()); } } - 1.2 +2 -2 db-torque/src/generator/src/java/org/apache/torque/engine/database/transform/XmlToData.java Index: XmlToData.java =================================================================== RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/transform/XmlToData.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XmlToData.java 10 Feb 2003 13:20:59 -0000 1.1 +++ XmlToData.java 21 Mar 2003 17:31:09 -0000 1.2 @@ -3,7 +3,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without