cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r439970 - /incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_7_EntityRelationshipsTest.java
Date Mon, 04 Sep 2006 08:06:42 GMT
Author: aadamchik
Date: Mon Sep  4 01:06:41 2006
New Revision: 439970

URL: http://svn.apache.org/viewvc?view=rev&rev=439970
Log:
itests, chapter 2.1.7

Added:
    incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_7_EntityRelationshipsTest.java

Added: incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_7_EntityRelationshipsTest.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_7_EntityRelationshipsTest.java?view=auto&rev=439970
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_7_EntityRelationshipsTest.java
(added)
+++ incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/_2_1_7_EntityRelationshipsTest.java
Mon Sep  4 01:06:41 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.itest.entity;
+
+import org.apache.cayenne.jpa.itest.EntityManagerCase;
+import org.apache.cayenne.jpa.itest.ItestDBUtils;
+import org.apache.cayenne.jpa.itest1.entity.CollectionFieldPersistenceEntity;
+
+public class _2_1_7_EntityRelationshipsTest extends EntityManagerCase {
+
+    // TODO: andrus 8/10/2006 - fails because of pk handling issues
+    public void _testEmptyCollection() throws Exception {
+        ItestDBUtils.deleteAll("HelperEntity1");
+        ItestDBUtils.deleteAll("CollectionFieldPersistenceEntity");
+
+        ItestDBUtils.insert("CollectionFieldPersistenceEntity", new String[] {
+            "id"
+        }, new Object[] {
+            new Integer(5)
+        });
+
+        CollectionFieldPersistenceEntity o1 = getEntityManager().find(
+                CollectionFieldPersistenceEntity.class,
+                new Integer(5));
+        assertNotNull(o1);
+        assertNotNull(o1.getCollection());
+        assertTrue(o1.getCollection().isEmpty());
+    }
+
+    // TODO: andrus 8/10/2006 - fails because of pk handling issues
+    public void _testNonEmptyCollection() throws Exception {
+        ItestDBUtils.deleteAll("HelperEntity1");
+        ItestDBUtils.deleteAll("CollectionFieldPersistenceEntity");
+
+        ItestDBUtils.insert("CollectionFieldPersistenceEntity", new String[] {
+            "id"
+        }, new Object[] {
+            new Integer(5)
+        });
+
+        ItestDBUtils.insert("HelperEntity1", new String[] {
+                "id", "entity_id"
+        }, new Object[] {
+                new Integer(4), new Integer(5)
+        });
+
+        CollectionFieldPersistenceEntity o1 = getEntityManager().find(
+                CollectionFieldPersistenceEntity.class,
+                new Integer(5));
+        assertNotNull(o1);
+        assertNotNull(o1.getCollection());
+        assertFalse(o1.getCollection().isEmpty());
+    }
+}



Mime
View raw message