[hibernate-commits] Hibernate SVN: r19460 - core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon May 10 20:41:09 EDT 2010


Author: gbadner
Date: 2010-05-10 20:41:09 -0400 (Mon, 10 May 2010)
New Revision: 19460

Added:
   core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set/MappingsNonLazy.hbm.xml
   core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set/PersistentSetNonLazyTest.java
Log:
HHH-3799 : Added test for PersistentSet does not honor hashcode/equals contract when loaded eagerly (forgotten files)

Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set/MappingsNonLazy.hbm.xml
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set/MappingsNonLazy.hbm.xml	                        (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set/MappingsNonLazy.hbm.xml	2010-05-11 00:41:09 UTC (rev 19460)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+  ~ Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+  ~
+  ~ This copyrighted material is made available to anyone wishing to use, modify,
+  ~ copy, or redistribute it subject to the terms and conditions of the GNU
+  ~ Lesser General Public License, v. 2.1. This program is distributed in the
+  ~ hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
+  ~ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details. You should have received a
+  ~ copy of the GNU Lesser General Public License, v.2.1 along with this
+  ~ distribution; if not, write to the Free Software Foundation, Inc.,
+  ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  ~
+  ~ Red Hat Author(s): Steve Ebersole
+  -->
+<hibernate-mapping package="org.hibernate.test.collection.set">
+
+    <class name="Parent">
+		<id name="name" column="NAME" type="string" />
+
+        <set name="children" inverse="true" cascade="all" lazy="false">
+            <key column="PARENT" />
+            <one-to-many class="Child" />
+        </set>
+	</class>
+
+    <class name="Child">
+        <id name="name" column="NAME" type="string"/>
+        <many-to-one name="parent" class="Parent" cascade="none" lazy="false" />
+        <property name="description" type="string"/>
+    </class>
+
+    <class name="Container">
+        <id name="id" type="long">
+            <generator class="increment"/>
+        </id>
+        <property name="name" column="NAME" type="string"/>
+        <set name="contents" table="CONTENTS" lazy="false">
+            <key column="CONTAINER_ID"/>
+            <composite-element class="Container$Content">
+                <property name="name" column="NAME" type="string"/>
+            </composite-element>
+        </set>
+    </class>
+
+</hibernate-mapping>

Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set/PersistentSetNonLazyTest.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set/PersistentSetNonLazyTest.java	                        (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/collection/set/PersistentSetNonLazyTest.java	2010-05-11 00:41:09 UTC (rev 19460)
@@ -0,0 +1,65 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ *
+ */
+package org.hibernate.test.collection.set;
+
+import java.util.HashSet;
+
+import junit.framework.Test;
+
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.collection.PersistentSet;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.stat.CollectionStatistics;
+
+/**
+ *
+ * @author Gail Badner
+ */
+public class PersistentSetNonLazyTest extends PersistentSetTest {
+	public PersistentSetNonLazyTest(String name) {
+		super( name );
+	}
+
+	public String[] getMappings() {
+		return new String[] { "collection/set/MappingsNonLazy.hbm.xml" };
+	}
+
+	public static Test suite() {
+		return new FunctionalTestClassTestSuite( PersistentSetNonLazyTest.class );
+	}
+
+	public void testLoadChildCheckParentContainsChildCache() {
+		reportSkip( "known to fail with non-lazy collection using query cache",
+				"support for non-lazy collections using query cache"
+		);
+	}
+
+	public void testLoadChildCheckParentContainsChildCacheFailureExpected() {
+		 super.testLoadChildCheckParentContainsChildCache();
+	}
+}
\ No newline at end of file



More information about the hibernate-commits mailing list