Return-Path: X-Original-To: apmail-db-torque-dev-archive@www.apache.org Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D9D3FE482 for ; Tue, 22 Jan 2013 07:52:03 +0000 (UTC) Received: (qmail 98803 invoked by uid 500); 22 Jan 2013 07:52:03 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 98671 invoked by uid 500); 22 Jan 2013 07:52:01 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 98591 invoked by uid 500); 22 Jan 2013 07:51:58 -0000 Received: (qmail 98403 invoked by uid 99); 22 Jan 2013 07:51:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Jan 2013 07:51:56 +0000 X-ASF-Spam-Status: No, hits=-1999.0 required=5.0 tests=ALL_TRUSTED,FRT_ADOBE2 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Jan 2013 07:51:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 722812388847; Tue, 22 Jan 2013 07:51:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1436782 [1/2] - in /db/torque/torque4/trunk/torque-test: ./ src/main/schema/ src/test/java/org/apache/torque/ src/test/java/org/apache/torque/datatypes/ src/test/java/org/apache/torque/generated/dataobject/ src/test/java/org/apache/torque/... Date: Tue, 22 Jan 2013 07:51:32 -0000 To: torque-commits@db.apache.org From: tfischer@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130122075133.722812388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tfischer Date: Tue Jan 22 07:51:31 2013 New Revision: 1436782 URL: http://svn.apache.org/viewvc?rev=1436782&view=rev Log: TORQUE-251 fix SQL errors in the test project - remove unused test tables - use naming schema for similar tables - test on update and on delete clauses Modified: db/torque/torque4/trunk/torque-test/pom.xml db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/SaveTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DateTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/JoinTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/map/DatabaseMapTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/om/OMByNameMethodsTest.java Modified: db/torque/torque4/trunk/torque-test/pom.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/pom.xml?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/pom.xml (original) +++ db/torque/torque4/trunk/torque-test/pom.xml Tue Jan 22 07:51:31 2013 @@ -118,6 +118,9 @@ + + + @@ -359,6 +362,9 @@ *idtable-init.sql + + included-*-idtable-init.sql + @@ -400,9 +406,13 @@ torque.configuration.file src/test/profile/${torque.test.profileDirectory}/Torque.properties + + derby.stream.error.file + target/derby.log + - + org.apache.maven.plugins @@ -473,6 +483,9 @@ derbyEmbedded native bookstore + + + VARCHAR org.apache.derby.jdbc.EmbeddedDriver derby jdbc:derby:target/bookstore;create=true @@ -519,6 +532,9 @@ hsqldb idbroker torque_schema + onUpdate="cascade" + onUpdate="setnull" + BIT org.hsqldb.jdbcDriver hsqldb jdbc:hsqldb:target/sqltest;shutdown=true @@ -566,6 +582,9 @@ hsqldb idbroker torque_schema + onUpdate="cascade" + onUpdate="setnull" + BIT org.hsqldb.jdbcDriver hsqldb jdbc:hsqldb:torque-test/target/sqltest;shutdown=true @@ -608,6 +627,9 @@ derby native bookstore + onUpdate="cascade" + onUpdate="setnull" + BIT org.apache.derby.jdbc.ClientDriver derby jdbc:derby://localhost:1527/bookstore;create=true @@ -650,6 +672,9 @@ mysql native bookstore + onUpdate="cascade" + onUpdate="setnull" + BIT org.gjt.mm.mysql.Driver mysql jdbc:mysql://localhost:3306/bookstore @@ -692,6 +717,9 @@ mssql native torque_schema + onUpdate="cascade" + onUpdate="setnull" + BIT net.sourceforge.jtds.jdbc.Driver mssql jdbc:jtds:sqlserver://localhost:1433/torque @@ -734,6 +762,9 @@ oracle native torque + onUpdate="cascade" + onUpdate="setnull" + BIT oracle.jdbc.driver.OracleDriver oracle jdbc:oracle:thin:@localhost:1521:XE @@ -776,6 +807,9 @@ postgresql idbroker bookstore + onUpdate="cascade" + onUpdate="setnull" + BIT org.postgresql.Driver postgresql jdbc:postgresql://localhost:5432/bookstore @@ -818,6 +852,9 @@ tv idbroker bookstore + onUpdate="cascade" + onUpdate="setnull" + BIT org.gjt.mm.mysql.Driver mysql jdbc:mysql://gatekeeper.home.lan:3306/bookstore @@ -857,6 +894,9 @@ derbyEmbedded native bookstore + onUpdate="cascade" + onUpdate="setnull" + VARCHAR org.apache.derby.jdbc.EmbeddedDriver derby jdbc:derby:torque-test/target/bookstore;create=true Modified: db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml (original) +++ db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml Tue Jan 22 07:51:31 2013 @@ -85,207 +85,6 @@ - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - -
- - - - -
- Modified: db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml (original) +++ db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml Tue Jan 22 07:51:31 2013 @@ -19,7 +19,7 @@ --> - Modified: db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml (original) +++ db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml Tue Jan 22 07:51:31 2013 @@ -34,6 +34,9 @@ + + + - +
@@ -76,7 +81,9 @@ - + @@ -97,6 +104,9 @@ + + + - +
@@ -155,6 +167,44 @@
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+ + + + + + + +
Modified: db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml (original) +++ db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml Tue Jan 22 07:51:31 2013 @@ -32,25 +32,15 @@ - - - -
+ - - +
+
- - - - - -
- - - +
+
@@ -59,23 +49,6 @@ - - -
- - - -
- - - -
- - - - -
- Modified: db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml (original) +++ db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml Tue Jan 22 07:51:31 2013 @@ -17,53 +17,22 @@ specific language governing permissions and limitations under the License. --> - + + package="ignored" + xmlns="http://db.apache.org/torque/4.0/templates/database"> - -
- - -
- - - - - - - - -
- - - - + + + @@ -73,7 +42,7 @@
- +
@@ -86,7 +55,7 @@
- +
@@ -101,40 +70,6 @@ - - - - - - - - - - - -
- - - - - -
- - - - -
- - - - - - - - - -
@@ -151,274 +86,26 @@ - - - - - - - - - -
- - - - - - -
- - - - - - - - - - -
- - - - -
- - - - -
- - - - - - + + + + + - - - - +
- - - + + +
- - - - -
- - - - - - - -
- - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - +
+ + + @@ -426,15 +113,24 @@ Column.getJavaObject() not implimented f
- - - - +
+ + + + +
+ + + + +
Modified: db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml (original) +++ db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml Tue Jan 22 07:51:31 2013 @@ -26,51 +26,198 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database http://db.apache.org/torque/4.0/templates/database.xsd"> - - - -
- - - - -
- - - - -
- - - - - - - -
- - - - - - + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + + + + +
+ + + + + +
+ + + + + + +
+ + + + + +
+ + + + + + + +
+ + + Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java Tue Jan 22 07:51:31 2013 @@ -43,37 +43,38 @@ import org.apache.torque.om.mapper.Recor import org.apache.torque.test.InheritanceClassnameTestChild1; import org.apache.torque.test.InheritanceClassnameTestChild2; import org.apache.torque.test.dbobject.Author; -import org.apache.torque.test.dbobject.BlobTest; +import org.apache.torque.test.dbobject.BigintType; +import org.apache.torque.test.dbobject.BlobType; import org.apache.torque.test.dbobject.Book; -import org.apache.torque.test.dbobject.ClobTest; +import org.apache.torque.test.dbobject.ClobType; +import org.apache.torque.test.dbobject.CompPkContainsFk; import org.apache.torque.test.dbobject.IfcTable; -import org.apache.torque.test.dbobject.IfcTable2; import org.apache.torque.test.dbobject.InheritanceChildB; import org.apache.torque.test.dbobject.InheritanceChildC; import org.apache.torque.test.dbobject.InheritanceChildD; import org.apache.torque.test.dbobject.InheritanceClassnameTest; import org.apache.torque.test.dbobject.InheritanceTest; -import org.apache.torque.test.dbobject.IntegerPk; -import org.apache.torque.test.dbobject.LargePk; +import org.apache.torque.test.dbobject.IntegerType; +import org.apache.torque.test.dbobject.LocalIfcTable; import org.apache.torque.test.dbobject.LocalTestInterface; import org.apache.torque.test.dbobject.MultiPk; -import org.apache.torque.test.dbobject.MultiPkForeignKey; import org.apache.torque.test.dbobject.Nopk; -import org.apache.torque.test.dbobject.NullValueTable; +import org.apache.torque.test.dbobject.OIntegerPk; +import org.apache.torque.test.dbobject.VarcharType; import org.apache.torque.test.peer.AuthorPeer; -import org.apache.torque.test.peer.BlobTestPeer; +import org.apache.torque.test.peer.BigintTypePeer; +import org.apache.torque.test.peer.BlobTypePeer; import org.apache.torque.test.peer.BookPeer; -import org.apache.torque.test.peer.ClobTestPeer; -import org.apache.torque.test.peer.IfcTable2Peer; +import org.apache.torque.test.peer.ClobTypePeer; +import org.apache.torque.test.peer.CompPkContainsFkPeer; import org.apache.torque.test.peer.IfcTablePeer; import org.apache.torque.test.peer.InheritanceClassnameTestPeer; import org.apache.torque.test.peer.InheritanceTestPeer; -import org.apache.torque.test.peer.IntegerPkPeer; -import org.apache.torque.test.peer.LargePkPeer; -import org.apache.torque.test.peer.MultiPkForeignKeyPeer; +import org.apache.torque.test.peer.IntegerTypePeer; +import org.apache.torque.test.peer.LocalIfcTablePeer; import org.apache.torque.test.peer.MultiPkPeer; import org.apache.torque.test.peer.NopkPeer; -import org.apache.torque.test.peer.NullValueTablePeer; +import org.apache.torque.test.peer.VarcharTypePeer; import org.apache.torque.test.recordmapper.AuthorRecordMapper; import org.apache.torque.test.recordmapper.BookRecordMapper; import org.apache.torque.util.BasePeer; @@ -260,81 +261,51 @@ public class DataTest extends BaseDataba public void testNullSelects() throws Exception { // clean table - Criteria criteria = new Criteria(); - criteria.where( - NullValueTablePeer.NULL_VALUE_TABLE_ID, - -1, - Criteria.NOT_EQUAL); - NullValueTablePeer.doDelete(criteria); + VarcharTypePeer.doDelete(new Criteria()); + IntegerTypePeer.doDelete(new Criteria()); // add test data - NullValueTable nvt = new NullValueTable(); - nvt.setText1("text"); - nvt.setNumberObj1(new Integer(1)); - nvt.save(); - nvt = new NullValueTable(); - nvt.setText2("text"); - nvt.save(); + VarcharType varcharType = new VarcharType(); + varcharType.setId("text2"); + varcharType.setVarcharValue("text2"); + varcharType.save(); + varcharType = new VarcharType(); + varcharType.setId("text"); + varcharType.save(); + + IntegerType integerTypeNotNull = new IntegerType(); + integerTypeNotNull.setIntegerObjectValue(1); + integerTypeNotNull.save(); + IntegerType integerTypeNull = new IntegerType(); + integerTypeNull.save(); - // do check for comparison NOT_EQUAL and value null - criteria = new Criteria(); - criteria.where( - NullValueTablePeer.TEXT1, - (Integer)null, - Criteria.NOT_EQUAL); - criteria.and(NullValueTablePeer.NUMBER_OBJ1, - (Integer)null, - Criteria.NOT_EQUAL); - List result = NullValueTablePeer.doSelect(criteria); - assertEquals("testNullSelects()" - + "Result size should be 1 but is " - + result.size(), - 1, - result.size()); - nvt = result.get(0); - assertEquals("testNullSelects()" - + "Text1 should be \"text\" but is" - + nvt.getText1(), - nvt.getText1(), - "text"); - - // do check for comparison EQUAL and value null - criteria = new Criteria(); - criteria.where( - NullValueTablePeer.TEXT1, - (Integer)null, - Criteria.EQUAL); - criteria.and(NullValueTablePeer.NUMBER_OBJ1, - (Integer)null, - Criteria.EQUAL); - result = NullValueTablePeer.doSelect(criteria); - assertEquals("testNullSelects()" - + "Result size should be 1 but is " - + result.size(), - 1, - result.size()); - nvt = result.get(0); - assertEquals("testNullSelects()" - + "Text2 should be \"text\" but is" - + nvt.getText2(), - nvt.getText2(), - "text"); - } - - /** - * tests whether null values can be processed successfully by datadump - * For this, a row containing null values is inserted here, - * the actual test is done later - * @throws Exception if inserting the test data fails - */ - public void testDataDump() throws Exception - { - NullValueTable nvt = new NullValueTable(); - nvt.setNumber1(1); - nvt.setNumber3(3); - nvt.setText1("text"); - nvt.setNumberObj1(new Integer(1)); - nvt.save(); + // check for comparison NOT_EQUAL and value null + Criteria criteria = new Criteria(); + criteria.where(VarcharTypePeer.ID, null, Criteria.NOT_EQUAL) + .and(VarcharTypePeer.VARCHAR_VALUE, null, Criteria.NOT_EQUAL); + List varcharResult = VarcharTypePeer.doSelect(criteria); + assertEquals(1, varcharResult.size()); + assertEquals("text2", varcharResult.get(0).getId()); + + criteria = new Criteria(); + criteria.where(IntegerTypePeer.ID, null, Criteria.NOT_EQUAL) + .and(IntegerTypePeer.INTEGER_OBJECT_VALUE, null, Criteria.NOT_EQUAL); + List integerResult = IntegerTypePeer.doSelect(criteria); + assertEquals(1, integerResult.size()); + assertEquals(integerTypeNotNull.getId(), integerResult.get(0).getId()); + + // check for comparison EQUAL and value null + criteria = new Criteria(); + criteria.where(VarcharTypePeer.VARCHAR_VALUE, null, Criteria.EQUAL); + varcharResult = VarcharTypePeer.doSelect(criteria); + assertEquals(1, varcharResult.size()); + assertEquals("text", varcharResult.get(0).getId()); + + criteria = new Criteria(); + criteria.where(IntegerTypePeer.INTEGER_OBJECT_VALUE, null, Criteria.EQUAL); + integerResult = IntegerTypePeer.doSelect(criteria); + assertEquals(1, integerResult.size()); + assertEquals(integerTypeNull.getId(), integerResult.get(0).getId()); } /** @@ -924,29 +895,17 @@ public class DataTest extends BaseDataba */ public void testLargePk() throws Exception { - // clean LargePk table - Criteria criteria = new Criteria(); - criteria.where( - LargePkPeer.ID, - (Long) null, - Criteria.NOT_EQUAL); - LargePkPeer.doDelete(criteria); + BigintTypePeer.doDelete(new Criteria()); long longId = 8771507845873286l; - LargePk largePk = new LargePk(); - largePk.setId(longId); - largePk.setName("testLargePk"); - largePk.save(); - - List largePkList = LargePkPeer.doSelect(new Criteria()); - LargePk readLargePk = largePkList.get(0); - assertTrue("the inserted Id, " + largePk.getId() - + " , and the read id, " + readLargePk.getId() - + " , should be equal", - readLargePk.getId() == largePk.getId()); - assertTrue("the inserted Id, " + largePk.getId() - + " , should be equal to " + longId, - longId == largePk.getId()); + BigintType bigintType = new BigintType(); + bigintType.setId(longId); + bigintType.save(); + + List bigintTypeList = BigintTypePeer.doSelect(new Criteria()); + BigintType readBigintType = bigintTypeList.get(0); + assertEquals(bigintType.getId(), readBigintType.getId()); + assertEquals(longId, readBigintType.getId()); } /** @@ -1004,21 +963,21 @@ public class DataTest extends BaseDataba */ public void testMultiplePrimaryForeignKey() throws Exception { - // clean IntegerPk and MultiPkForeignKey table - Criteria criteria = new Criteria(); - criteria.where(MultiPkForeignKeyPeer.ID, (Integer) null, Criteria.NOT_EQUAL); - MultiPkForeignKeyPeer.doDelete(criteria); - criteria = new Criteria(); - criteria.where(IntegerPkPeer.ID, (Integer) null, Criteria.NOT_EQUAL); - IntegerPkPeer.doDelete(criteria); + ForeignKeySchemaData.clearTablesInDatabase(); - IntegerPk integerPk = new IntegerPk(); - integerPk.save(); - MultiPkForeignKey multiPkForeignKey = new MultiPkForeignKey(); - multiPkForeignKey.setId(10); - multiPkForeignKey.setIntegerPk(integerPk); - multiPkForeignKey.save(); - integerPk.save(); + OIntegerPk oIntegerPk = new OIntegerPk(); + oIntegerPk.save(); + CompPkContainsFk compPkContainsFk = new CompPkContainsFk(); + compPkContainsFk.setId1(oIntegerPk.getId()); + compPkContainsFk.setId2("test"); + compPkContainsFk.save(); + + List selectedList + = CompPkContainsFkPeer.doSelect(new Criteria()); + assertEquals(1, selectedList.size()); + CompPkContainsFk selected = selectedList.get(0); + assertEquals(oIntegerPk.getId(), selected.getId1()); + assertEquals("test", selected.getId2()); } /** @@ -1044,19 +1003,11 @@ public class DataTest extends BaseDataba */ public void testBlobs() throws Exception { - // clean BlobTest table - { - Criteria criteria = new Criteria(); - criteria.where( - BlobTestPeer.ID, - (Long) null, - Criteria.NOT_EQUAL); - BlobTestPeer.doDelete(criteria); - } + BlobTypePeer.doDelete(new Criteria()); - // create a new BlobTest Object with large blob and clob values + // create a new BlobType Object with large blob values // and save it - BlobTest blobTest = new BlobTest(); + BlobType blobType = new BlobType(); { int length = 100000; byte[] bytes = new byte[length]; @@ -1064,29 +1015,27 @@ public class DataTest extends BaseDataba { bytes[i] = new Integer(i % 256).byteValue(); } - blobTest.setBlobValue(bytes); + blobType.setBlobValue(bytes); } - blobTest.save(); + blobType.save(); - // read the BlobTests from the database + // read the BlobTypes from the database // and check the values against the original values - List blobTestList = BlobTestPeer.doSelect(new Criteria()); - assertTrue("blobTestList should contain 1 object but contains " - + blobTestList.size(), - blobTestList.size() == 1); + List blobTypeList = BlobTypePeer.doSelect(new Criteria()); + assertEquals(1, blobTypeList.size()); - BlobTest readBlobTest = blobTestList.get(0); + BlobType readBlobType = blobTypeList.get(0); assertTrue("read and written blobs should be equal. " + "Size of read blob is" - + readBlobTest.getBlobValue().length + + readBlobType.getBlobValue().length + " size of written blob is " - + blobTest.getBlobValue().length, + + blobType.getBlobValue().length, Arrays.equals( - blobTest.getBlobValue(), - readBlobTest.getBlobValue())); + blobType.getBlobValue(), + readBlobType.getBlobValue())); // test updating - blobTest = readBlobTest; + blobType = readBlobType; { int length = 200000; byte[] bytes = new byte[length]; @@ -1097,26 +1046,24 @@ public class DataTest extends BaseDataba bytes[i] = new Integer(i % 256).byteValue(); chars.append(charTemplate.charAt(i % charTemplate.length())); } - blobTest.setBlobValue(bytes); + blobType.setBlobValue(bytes); } - blobTest.save(); + blobType.save(); - // read the BlobTests from the database + // read the BlobTypes from the database // and check the values against the updated values - blobTestList = BlobTestPeer.doSelect(new Criteria()); - assertTrue("blobTestList should contain 1 object but contains " - + blobTestList.size(), - blobTestList.size() == 1); + blobTypeList = BlobTypePeer.doSelect(new Criteria()); + assertEquals(1, blobTypeList.size()); - readBlobTest = blobTestList.get(0); + readBlobType = blobTypeList.get(0); assertTrue("read and written blobs should be equal. " + "Size of read blob is" - + readBlobTest.getBlobValue().length + + readBlobType.getBlobValue().length + " size of written blob is " - + blobTest.getBlobValue().length, + + blobType.getBlobValue().length, Arrays.equals( - blobTest.getBlobValue(), - readBlobTest.getBlobValue())); + blobType.getBlobValue(), + readBlobType.getBlobValue())); } @@ -1126,67 +1073,53 @@ public class DataTest extends BaseDataba */ public void testClobs() throws Exception { - // clean ClobTest table - { - Criteria criteria = new Criteria(); - criteria.where( - ClobTestPeer.ID, - (Long) null, - Criteria.NOT_EQUAL); - ClobTestPeer.doDelete(criteria); - } + ClobTypePeer.doDelete(new Criteria()); - // create a new ClobTest Object with a large clob value + // create a new ClobType Object with a large clob value // and save it - ClobTest clobTest = new ClobTest(); + ClobType clobType = new ClobType(); { - int length = 10000; + int length = 40000; StringBuffer chars = new StringBuffer(); String charTemplate = "1234567890abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < length; ++i) { chars.append(charTemplate.charAt(i % charTemplate.length())); } - clobTest.setClobValue(chars.toString()); + clobType.setClobValue(chars.toString()); } - clobTest.save(); + clobType.save(); - // read the ClobTests from the database + // read the ClobTypes from the database // and check the values against the original values - List clobTestList = ClobTestPeer.doSelect(new Criteria()); - assertTrue("clobTestList should contain 1 object but contains " - + clobTestList.size(), - clobTestList.size() == 1); - - ClobTest readClobTest = clobTestList.get(0); - assertTrue("read and written clobs should be equal", - clobTest.getClobValue().equals(readClobTest.getClobValue())); + List clobTypeList = ClobTypePeer.doSelect(new Criteria()); + assertEquals(1, clobTypeList.size()); + + ClobType readClobType = clobTypeList.get(0); + assertEquals(clobType.getClobValue(), readClobType.getClobValue()); // Test updating - clobTest = readClobTest; + clobType = readClobType; { - int length = 20000; + int length = 50000; StringBuffer chars = new StringBuffer(); String charTemplate = "0987654321abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < length; ++i) { chars.append(charTemplate.charAt(i % charTemplate.length())); } - clobTest.setClobValue(chars.toString()); + clobType.setClobValue(chars.toString()); } - clobTest.save(); + clobType.save(); - // read the ClobTests from the database + // read the ClobTypes from the database // and check the values against the original values - clobTestList = ClobTestPeer.doSelect(new Criteria()); - assertTrue("clobTestList should contain 1 object but contains " - + clobTestList.size(), - clobTestList.size() == 1); - - readClobTest = clobTestList.get(0); - assertTrue("read and written clobs should be equal", - clobTest.getClobValue().equals(readClobTest.getClobValue())); + clobTypeList = ClobTypePeer.doSelect(new Criteria()); + assertEquals(1, clobTypeList.size()); + + readClobType = clobTypeList.get(0); + assertEquals(clobType.getClobValue(), readClobType.getClobValue()); } /** @@ -1246,18 +1179,18 @@ public class DataTest extends BaseDataba ifcTable instanceof TestInterface); } - IfcTable2 ifc2 = new IfcTable2(); + LocalIfcTable localIfc = new LocalIfcTable(); - assertTrue("IfcTable2 should be an instance of LocalTestInterface", - ifc2 instanceof LocalTestInterface); + assertTrue("LocalIfcTable should be an instance of LocalTestInterface", + localIfc instanceof LocalTestInterface); - List results2 = IfcTable2Peer.doSelect(new Criteria()); + List results2 = LocalIfcTablePeer.doSelect(new Criteria()); - for (IfcTable2 ifcTable2 : results2) + for (LocalIfcTable readLocalIfcTable : results2) { assertTrue("IfcTable2Peer.doSelect should return" + " instances of LocalTestInterface", - ifcTable2 instanceof LocalTestInterface); + readLocalIfcTable instanceof LocalTestInterface); } } @@ -1280,16 +1213,16 @@ public class DataTest extends BaseDataba // create & save test data InheritanceTest inheritanceTest = new InheritanceTest(); - inheritanceTest.setPayloadParent("payload Parent 1"); + inheritanceTest.setPayload("payload1"); inheritanceTest.save(); InheritanceChildB inheritanceChildB = new InheritanceChildB(); - inheritanceChildB.setPayloadParent("payload Parent 2"); + inheritanceChildB.setPayload("payload 2"); inheritanceChildB.save(); InheritanceChildC inheritanceChildC = new InheritanceChildC(); - inheritanceChildC.setPayloadParent("payload Parent 3"); + inheritanceChildC.setPayload("payload 3"); inheritanceChildC.save(); InheritanceChildD inheritanceChildD = new InheritanceChildD(); - inheritanceChildD.setPayloadParent("payload Parent 4"); + inheritanceChildD.setPayload("payload 4"); inheritanceChildD.save(); // Check that all objects are saved into the InheritanceTest table Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java Tue Jan 22 07:51:31 2013 @@ -44,6 +44,8 @@ import org.apache.torque.test.peer.CompI import org.apache.torque.test.peer.CompNonpkFkPeer; import org.apache.torque.test.peer.CompPkContainsFkPeer; import org.apache.torque.test.peer.CompPkOtherFkPeer; +import org.apache.torque.test.peer.MultiRefPeer; +import org.apache.torque.test.peer.MultiRefSameTablePeer; import org.apache.torque.test.peer.NonPkOIntegerFkPeer; import org.apache.torque.test.peer.NonPkPIntegerFkPeer; import org.apache.torque.test.peer.NullableOIntegerFkPeer; @@ -710,6 +712,8 @@ public class ForeignKeySchemaData */ public static void clearTablesInDatabase() throws TorqueException { + MultiRefSameTablePeer.doDelete(new Criteria()); + MultiRefPeer.doDelete(new Criteria()); NullablePIntegerFkPeer.doDelete(new Criteria()); RequiredPIntegerFkPeer.doDelete(new Criteria()); NonPkPIntegerFkPeer.doDelete(new Criteria()); Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java Tue Jan 22 07:51:31 2013 @@ -111,14 +111,7 @@ public class InitShutdownTest extends Te private void checkTorqueInitialisationWithOIntegerPk() throws TorqueException { - Criteria criteria = new Criteria(); - NullableOIntegerFkPeer.doDelete(criteria); - criteria = new Criteria(); - RequiredOIntegerFkPeer.doDelete(criteria); - criteria = new Criteria(); - NonPkOIntegerFkPeer.doDelete(criteria); - criteria = new Criteria(); - OIntegerPkPeer.doDelete(criteria); + ForeignKeySchemaData.clearTablesInDatabase(); OIntegerPk oIntegerPk = new OIntegerPk(); oIntegerPk.setName("shutdownName"); @@ -137,15 +130,6 @@ public class InitShutdownTest extends Te private void checkTorqueInitialisationWithPIntegerPk() throws TorqueException { - Criteria criteria = new Criteria(); - NullablePIntegerFkPeer.doDelete(criteria); - criteria = new Criteria(); - RequiredPIntegerFkPeer.doDelete(criteria); - criteria = new Criteria(); - NonPkPIntegerFkPeer.doDelete(criteria); - criteria = new Criteria(); - PIntegerPkPeer.doDelete(criteria); - ForeignKeySchemaData.clearTablesInDatabase(); PIntegerPk pIntegerPk = new PIntegerPk(); pIntegerPk.setName("shutdownName"); Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java?rev=1436782&r1=1436781&r2=1436782&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java Tue Jan 22 07:51:31 2013 @@ -11,9 +11,9 @@ import org.apache.torque.adapter.OracleA import org.apache.torque.criteria.Criteria; import org.apache.torque.om.StringKey; import org.apache.torque.test.dbobject.BitCompositePk; -import org.apache.torque.test.dbobject.BitValue; +import org.apache.torque.test.dbobject.BitType; import org.apache.torque.test.peer.BitCompositePkPeer; -import org.apache.torque.test.peer.BitValuePeer; +import org.apache.torque.test.peer.BitTypePeer; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -59,9 +59,9 @@ public class BitTest extends BaseDatabas List bitCompositePks = BitCompositePkPeer.doSelect(new Criteria()); assertEquals(3, bitCompositePks.size()); - List bitValues - = BitValuePeer.doSelect(new Criteria()); - assertEquals(2, bitValues.size()); + List bitTypes + = BitTypePeer.doSelect(new Criteria()); + assertEquals(2, bitTypes.size()); } /** @@ -143,13 +143,14 @@ public class BitTest extends BaseDatabas fillTables(); // read data - BitValue bitValue = BitValuePeer.retrieveByPK(new StringKey("t1")); + BitType bitType = BitTypePeer.doSelectSingleRecord( + new Criteria().where(BitTypePeer.ID, "t1")); assertTrue("BIT should be true but is: " - + bitValue.getBitValue(), bitValue.getBitValue()); + + bitType.getBitValue(), bitType.getBitValue()); - bitValue = BitValuePeer.retrieveByPK(new StringKey("f1")); + bitType = BitTypePeer.retrieveByPK(new StringKey("f1")); assertFalse("BIT should be false but is: " - + bitValue.getBitValue(), bitValue.getBitValue()); + + bitType.getBitValue(), bitType.getBitValue()); } /** @@ -166,17 +167,13 @@ public class BitTest extends BaseDatabas } // query data Criteria criteria = new Criteria() - .where(BitValuePeer.BIT_VALUE, new Boolean(true)); - List bitValueList = BitValuePeer.doSelect(criteria); - assertTrue("Should have read 1 dataset " - + "but read " + bitValueList.size(), - bitValueList.size() == 1); - BitValue bitValue = bitValueList.get(0); + .where(BitTypePeer.BIT_VALUE, new Boolean(true)); + List bitTypeList = BitTypePeer.doSelect(criteria); + assertEquals(1, bitTypeList.size()); + BitType bitType = bitTypeList.get(0); // use trim() for testkey because some databases will return the // testkey filled up with blanks, as it is defined as char(10) - assertTrue("Primary key of data set should be t1 but is " - + bitValue.getId(), - "t1".equals(bitValue.getId())); + assertEquals("t1", bitType.getId()); } /** @@ -192,12 +189,12 @@ public class BitTest extends BaseDatabas return; } Criteria criteria = new Criteria().where( - BitValuePeer.BIT_VALUE, new Boolean(false)); - List bitValueList = BitValuePeer.doSelect(criteria); + BitTypePeer.BIT_VALUE, new Boolean(false)); + List bitTypeList = BitTypePeer.doSelect(criteria); assertTrue("Should have read 1 dataset " - + "but read " + bitValueList.size(), - bitValueList.size() == 1); - BitValue bitValue = bitValueList.get(0); + + "but read " + bitTypeList.size(), + bitTypeList.size() == 1); + BitType bitValue = bitTypeList.get(0); assertTrue("Primary key of data set should be f1 but is " + bitValue.getId(), "f1".equals(bitValue.getId())); @@ -229,7 +226,7 @@ public class BitTest extends BaseDatabas private void fillTables() throws TorqueException { BitCompositePkPeer.doDelete(new Criteria()); - BitValuePeer.doDelete(new Criteria()); + BitTypePeer.doDelete(new Criteria()); BitCompositePk bitCompositePk = new BitCompositePk(); bitCompositePk.setPk1("false value"); @@ -249,14 +246,14 @@ public class BitTest extends BaseDatabas bitCompositePk.setPayload("payload"); bitCompositePk.save(); - BitValue bitValue = new BitValue(); - bitValue.setId("t1"); - bitValue.setBitValue(true); - bitValue.save(); - - bitValue = new BitValue(); - bitValue.setId("f1"); - bitValue.setBitValue(false); - bitValue.save(); + BitType bitType = new BitType(); + bitType.setId("t1"); + bitType.setBitValue(true); + bitType.save(); + + bitType = new BitType(); + bitType.setId("f1"); + bitType.setBitValue(false); + bitType.save(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org