cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r439638 - in /incubator/cayenne/main/trunk/integration-test/jpa-unit1/src: main/java/org/apache/cayenne/jpa/itest1/entity/ main/resources/META-INF/ test/java/org/apache/cayenne/jpa/itest/entity/ test/resources/
Date Sat, 02 Sep 2006 19:16:30 GMT
Author: aadamchik
Date: Sat Sep  2 12:16:29 2006
New Revision: 439638

URL: http://svn.apache.org/viewvc?rev=439638&view=rev
Log:
all itests for non-relational java types pass

Added:
    incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsWrapperEntity.java
Modified:
    incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsPrimitiveEntity.java
    incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/resources/META-INF/persistence.xml
    incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_6_MappingDefaultsNonRelationshipTest.java
    incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/resources/unit1-schema-hsqldb.sql

Modified: incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsPrimitiveEntity.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsPrimitiveEntity.java?rev=439638&r1=439637&r2=439638&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsPrimitiveEntity.java
(original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsPrimitiveEntity.java
Sat Sep  2 12:16:29 2006
@@ -36,43 +36,6 @@
     protected float primitiveFloat;
     protected double primitiveDouble;
 
-    protected Boolean booleanWrapper;
-    protected Byte byteWrapper;
-    protected Short shortWrapper;
-    protected Integer intWrapper;
-    protected Character charWrapper;
-    protected Long longWrapper;
-    protected Float floatWrapper;
-    protected Double doubleWrapper;
-
-    public void setBooleanWrapper(Boolean booleanWrapper) {
-        this.booleanWrapper = booleanWrapper;
-    }
-
-    public void setByteWrapper(Byte byteWrapper) {
-        this.byteWrapper = byteWrapper;
-    }
-
-    public void setCharWrapper(Character charWrapper) {
-        this.charWrapper = charWrapper;
-    }
-
-    public void setDoubleWrapper(Double doubleWrapper) {
-        this.doubleWrapper = doubleWrapper;
-    }
-
-    public void setFloatWrapper(Float floatWrapper) {
-        this.floatWrapper = floatWrapper;
-    }
-
-    public void setIntWrapper(Integer intWrapper) {
-        this.intWrapper = intWrapper;
-    }
-
-    public void setLongWrapper(Long longWrapper) {
-        this.longWrapper = longWrapper;
-    }
-
     public void setPrimitiveBoolean(boolean primitiveBoolean) {
         this.primitiveBoolean = primitiveBoolean;
     }
@@ -103,10 +66,6 @@
 
     public void setPrimitiveShort(short primitiveShort) {
         this.primitiveShort = primitiveShort;
-    }
-
-    public void setShortWrapper(Short shortWrapper) {
-        this.shortWrapper = shortWrapper;
     }
 
 }

Added: incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsWrapperEntity.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsWrapperEntity.java?rev=439638&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsWrapperEntity.java
(added)
+++ incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyDefaultsWrapperEntity.java
Sat Sep  2 12:16:29 2006
@@ -0,0 +1,70 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+package org.apache.cayenne.jpa.itest1.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class PropertyDefaultsWrapperEntity {
+
+    @Id
+    protected int id;
+
+    protected Boolean booleanWrapper;
+    protected Byte byteWrapper;
+    protected Short shortWrapper;
+    protected Integer intWrapper;
+    protected Character charWrapper;
+    protected Long longWrapper;
+    protected Float floatWrapper;
+    protected Double doubleWrapper;
+
+    public void setBooleanWrapper(Boolean booleanWrapper) {
+        this.booleanWrapper = booleanWrapper;
+    }
+
+    public void setByteWrapper(Byte byteWrapper) {
+        this.byteWrapper = byteWrapper;
+    }
+
+    public void setCharWrapper(Character charWrapper) {
+        this.charWrapper = charWrapper;
+    }
+
+    public void setDoubleWrapper(Double doubleWrapper) {
+        this.doubleWrapper = doubleWrapper;
+    }
+
+    public void setFloatWrapper(Float floatWrapper) {
+        this.floatWrapper = floatWrapper;
+    }
+
+    public void setIntWrapper(Integer intWrapper) {
+        this.intWrapper = intWrapper;
+    }
+
+    public void setLongWrapper(Long longWrapper) {
+        this.longWrapper = longWrapper;
+    }
+
+    public void setShortWrapper(Short shortWrapper) {
+        this.shortWrapper = shortWrapper;
+    }
+}

Modified: incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/resources/META-INF/persistence.xml?rev=439638&r1=439637&r2=439638&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/resources/META-INF/persistence.xml
(original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/main/resources/META-INF/persistence.xml
Sat Sep  2 12:16:29 2006
@@ -35,6 +35,7 @@
 		<class>org.apache.cayenne.jpa.itest1.entity.EmbeddedEntity</class>
 		<class>org.apache.cayenne.jpa.itest1.entity.EmbeddedImpliedEntity</class>
 		<class>org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsPrimitiveEntity</class>
+		<class>org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsWrapperEntity</class>
 		<class>org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsDatesEntity</class>
 		<class>org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsOtherEntity</class>
 		<class>org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsInvalidEntity</class>

Modified: incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_6_MappingDefaultsNonRelationshipTest.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_6_MappingDefaultsNonRelationshipTest.java?rev=439638&r1=439637&r2=439638&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_6_MappingDefaultsNonRelationshipTest.java
(original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_6_MappingDefaultsNonRelationshipTest.java
Sat Sep  2 12:16:29 2006
@@ -35,6 +35,7 @@
 import org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsDatesEntity;
 import org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsOtherEntity;
 import org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsPrimitiveEntity;
+import org.apache.cayenne.jpa.itest1.entity.PropertyDefaultsWrapperEntity;
 import org.apache.cayenne.jpa.itest1.entity.SerializableType;
 
 public class _2_1_6_MappingDefaultsNonRelationshipTest extends EntityManagerCase {
@@ -51,39 +52,64 @@
         getEntityManager().persist(o1);
         getEntityManager().getTransaction().commit();
 
-        assertEquals("p1", ItestDBUtils.getObject(
-                "EmbeddedImpliedEntity",
-                "property1"));
+        assertEquals("p1", ItestDBUtils.getObject("EmbeddedImpliedEntity", "property1"));
     }
 
-    // TODO: andrus 8/10/2006 - fails
-    public void _testPrimitiveDefaults() throws Exception {
+    public void testPrimitiveWrapperDefaults() throws Exception {
+        ItestDBUtils.deleteAll("PropertyDefaultsWrapperEntity");
+
+        PropertyDefaultsWrapperEntity o1 = new PropertyDefaultsWrapperEntity();
+
+        o1.setBooleanWrapper(Boolean.TRUE);
+        o1.setByteWrapper(new Byte("3"));
+        o1.setShortWrapper(new Short("2"));
+        o1.setIntWrapper(new Integer("4"));
+        o1.setCharWrapper(new Character('a'));
+        o1.setLongWrapper(new Long(1234567890l));
+        o1.setFloatWrapper(new Float("5.5"));
+        o1.setDoubleWrapper(new Double("6.5"));
+
+        getEntityManager().persist(o1);
+        getEntityManager().getTransaction().commit();
+
+        assertTrue(ItestDBUtils.getBoolean(
+                "PropertyDefaultsWrapperEntity",
+                "booleanWrapper"));
+        assertEquals(2, ItestDBUtils.getInt(
+                "PropertyDefaultsWrapperEntity",
+                "shortWrapper"));
+        assertEquals(3, ItestDBUtils.getInt(
+                "PropertyDefaultsWrapperEntity",
+                "byteWrapper"));
+        assertEquals(4, ItestDBUtils
+                .getInt("PropertyDefaultsWrapperEntity", "intWrapper"));
+        assertEquals("a", ItestDBUtils.getObject(
+                "PropertyDefaultsWrapperEntity",
+                "charWrapper"));
+        assertEquals(1234567890l, ItestDBUtils.getLong(
+                "PropertyDefaultsWrapperEntity",
+                "longWrapper"));
+        assertEquals(5.5d, ItestDBUtils.getDouble(
+                "PropertyDefaultsWrapperEntity",
+                "floatWrapper"));
+        assertEquals(6.5d, ItestDBUtils.getDouble(
+                "PropertyDefaultsWrapperEntity",
+                "doubleWrapper"));
+    }
+
+    public void testPrimitiveDefaults() throws Exception {
         ItestDBUtils.deleteAll("PropertyDefaultsPrimitiveEntity");
 
         PropertyDefaultsPrimitiveEntity o1 = new PropertyDefaultsPrimitiveEntity();
         o1.setPrimitiveBoolean(true);
-        o1.setBooleanWrapper(Boolean.TRUE);
 
         o1.setPrimitiveByte((byte) 3);
-        o1.setByteWrapper(new Byte("3"));
-
         o1.setPrimitiveShort((short) 2);
-        o1.setShortWrapper(new Short("2"));
-
         o1.setPrimitiveInt(4);
-        o1.setIntWrapper(new Integer("4"));
-
         o1.setPrimitiveChar('a');
-        o1.setCharWrapper(new Character('a'));
-
         o1.setPrimitiveLong(1234567890l);
-        o1.setLongWrapper(new Long(1234567890l));
-
         o1.setPrimitiveFloat(5.5f);
-        o1.setFloatWrapper(new Float("5.5"));
-
         o1.setPrimitiveDouble(6.5d);
-        o1.setDoubleWrapper(new Double("6.5"));
 
         getEntityManager().persist(o1);
         getEntityManager().getTransaction().commit();
@@ -91,58 +117,27 @@
         assertTrue(ItestDBUtils.getBoolean(
                 "PropertyDefaultsPrimitiveEntity",
                 "primitiveBoolean"));
-        assertTrue(ItestDBUtils.getBoolean(
-                "PropertyDefaultsPrimitiveEntity",
-                "booleanWrapper"));
-
         assertEquals(2, ItestDBUtils.getInt(
                 "PropertyDefaultsPrimitiveEntity",
                 "primitiveShort"));
-        assertEquals(2, ItestDBUtils.getInt(
-                "PropertyDefaultsPrimitiveEntity",
-                "shortWrapper"));
-
         assertEquals(3, ItestDBUtils.getInt(
                 "PropertyDefaultsPrimitiveEntity",
                 "primitiveByte"));
-        assertEquals(3, ItestDBUtils.getInt(
-                "PropertyDefaultsPrimitiveEntity",
-                "byteWrapper"));
-
         assertEquals(4, ItestDBUtils.getInt(
                 "PropertyDefaultsPrimitiveEntity",
                 "primitiveInt"));
-        assertEquals(4, ItestDBUtils.getInt(
-                "PropertyDefaultsPrimitiveEntity",
-                "intWrapper"));
-
         assertEquals("a", ItestDBUtils.getObject(
                 "PropertyDefaultsPrimitiveEntity",
                 "primitiveChar"));
-        assertEquals("a", ItestDBUtils.getObject(
-                "PropertyDefaultsPrimitiveEntity",
-                "charWrapper"));
-
         assertEquals(1234567890l, ItestDBUtils.getLong(
                 "PropertyDefaultsPrimitiveEntity",
                 "primitiveLong"));
-        assertEquals(1234567890l, ItestDBUtils.getLong(
-                "PropertyDefaultsPrimitiveEntity",
-                "longWrapper"));
-
         assertEquals(5.5d, ItestDBUtils.getDouble(
                 "PropertyDefaultsPrimitiveEntity",
                 "primitiveFloat"));
-        assertEquals(5.5d, ItestDBUtils.getDouble(
-                "PropertyDefaultsPrimitiveEntity",
-                "doubleFloat"));
-
         assertEquals(6.5d, ItestDBUtils.getDouble(
                 "PropertyDefaultsPrimitiveEntity",
                 "primitiveDouble"));
-        assertEquals(6.5d, ItestDBUtils.getDouble(
-                "PropertyDefaultsPrimitiveEntity",
-                "doubleWrapper"));
     }
 
     public void testDatesDefaults() throws Exception {
@@ -187,7 +182,6 @@
                 "sqlTimestamp"));
     }
 
-    // TODO: andrus 8/10/2006 - fails
     public void testOtherDefaults() throws Exception {
         ItestDBUtils.deleteAll("PropertyDefaultsOtherEntity");
 

Modified: incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/resources/unit1-schema-hsqldb.sql
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/resources/unit1-schema-hsqldb.sql?rev=439638&r1=439637&r2=439638&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/resources/unit1-schema-hsqldb.sql
(original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/resources/unit1-schema-hsqldb.sql
Sat Sep  2 12:16:29 2006
@@ -10,6 +10,7 @@
 insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('EmbeddedEntity', 1);
 insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('EmbeddedImpliedEntity', 1);
 insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PropertyDefaultsPrimitiveEntity',
1);
+insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PropertyDefaultsWrapperEntity',
1);
 insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PropertyDefaultsDatesEntity',
1);
 insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PropertyDefaultsOtherEntity',
1);
 
@@ -26,6 +27,7 @@
 create table EmbeddedIdEntity (id1 int not null, id2 int not null, property1 VARCHAR(100),
primary key(id1, id2));
 create table EmbeddedEntity (id int not null, property1 VARCHAR(100), primary key(id));
 create table EmbeddedImpliedEntity (id int not null, property1 VARCHAR(100), primary key(id));
-create table PropertyDefaultsPrimitiveEntity (id INT not null, primitiveBoolean BOOLEAN,
primitiveByte TINYINT, primitiveShort SMALLINT, primitiveChar CHAR(1), primitiveLong BIGINT,
primitiveFloat FLOAT, primitiveDouble DOUBLE, booleanWrapper BOOLEAN, byteWrapper TINYINT,
shortWrapper SMALLINT, charWrapper CHAR(1), longWrapper BIGINT, floatWrapper FLOAT, doubleWrapper
DOUBLE, primary key(id));
+create table PropertyDefaultsPrimitiveEntity (id INT not null, primitiveBoolean BOOLEAN,
primitiveByte TINYINT, primitiveShort SMALLINT, primitiveChar CHAR(1), primitiveInt INT, primitiveLong
BIGINT, primitiveFloat FLOAT, primitiveDouble DOUBLE, primary key(id));
+create table PropertyDefaultsWrapperEntity (id INT not null,  booleanWrapper BOOLEAN, byteWrapper
TINYINT, shortWrapper SMALLINT, intWrapper INT, charWrapper CHAR(1), longWrapper BIGINT, floatWrapper
FLOAT, doubleWrapper DOUBLE, primary key(id));
 create table PropertyDefaultsDatesEntity (id int not null, utilDate TIMESTAMP, calendar TIMESTAMP,
sqlDate DATE, sqlTime TIME, sqlTimestamp TIMESTAMP, primary key(id));
 create table PropertyDefaultsOtherEntity (id int not null, string VARCHAR(100), bigInt BIGINT,
bigDecimal NUMERIC, byteArray VARBINARY(100), byteWrapperArray VARBINARY(100), charArray VARCHAR(100),
charWrapperArray VARCHAR(100), enumType INT, serializableType VARBINARY(200), primary key(id));



Mime
View raw message