You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2006/11/30 12:40:16 UTC
svn commit: r480893 - in
/incubator/cayenne/main/trunk/integration-test/jpa-chapter9: .classpath
src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_18_BasicAnnotationTest.java
src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_8_IdAnnotationTest.java
Author: aadamchik
Date: Thu Nov 30 03:40:13 2006
New Revision: 480893
URL: http://svn.apache.org/viewvc?view=rev&rev=480893
Log:
CAY-713: Improved Meaningful PK support
(CAY-713 accomplished
+ switching JPA enhancer to the new generic pojo enhancement code
+ uncommenting a number of JPA relationship itests that work now with the new enhancer)
Modified:
incubator/cayenne/main/trunk/integration-test/jpa-chapter9/.classpath
incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_18_BasicAnnotationTest.java
incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_8_IdAnnotationTest.java
Modified: incubator/cayenne/main/trunk/integration-test/jpa-chapter9/.classpath
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-chapter9/.classpath?view=diff&rev=480893&r1=480892&r2=480893
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-chapter9/.classpath (original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-chapter9/.classpath Thu Nov 30 03:40:13 2006
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
- <classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
+ <classpathentry kind="src" path="src/test/java"/>
<classpathentry excluding="**" output="src/main/resources" kind="src" path="src/main/resources"/>
<classpathentry excluding="**" output="src/test/resources" kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Modified: incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_18_BasicAnnotationTest.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_18_BasicAnnotationTest.java?view=diff&rev=480893&r1=480892&r2=480893
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_18_BasicAnnotationTest.java (original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_18_BasicAnnotationTest.java Thu Nov 30 03:40:13 2006
@@ -64,7 +64,7 @@
});
BasicEntity o1 = getEntityManager().find(BasicEntity.class, 3);
- // application may or may not support lazy loading, but when the procerty is
+ // application may or may not support lazy loading, but when the property is
// accessed via getter, it must get resolved one way or another...
assertEquals("c", o1.getBasicLazy());
}
Modified: incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_8_IdAnnotationTest.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_8_IdAnnotationTest.java?view=diff&rev=480893&r1=480892&r2=480893
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_8_IdAnnotationTest.java (original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-chapter9/src/test/java/org/apache/cayenne/jpa/itest/ch9/_9_1_8_IdAnnotationTest.java Thu Nov 30 03:40:13 2006
@@ -24,62 +24,74 @@
public class _9_1_8_IdAnnotationTest extends EntityManagerCase {
- // needed, since all real tests are disabled
- public void testDummy() {
+ public void testUserProvidedId() throws Exception {
+ getDbHelper().deleteAll("IdEntity");
- }
+ IdEntity o1 = new IdEntity();
+ o1.setIdValue(15);
- // TODO: andrus, 9/10/2006 - fails
- public void _testUserProvidedId() throws Exception {
- getDbHelper().deleteAll("IdEntity");
+ getEntityManager().persist(o1);
+ getEntityManager().getTransaction().commit();
- IdEntity o1 = new IdEntity();
- o1.setIdValue(15);
+ assertEquals(15, getDbHelper().getInt("IdEntity", "id"));
+ assertEquals(15, o1.getIdValue());
+ }
- getEntityManager().persist(o1);
- getEntityManager().getTransaction().commit();
+ public void testGeneratedId() throws Exception {
+ getDbHelper().deleteAll("IdEntity");
- assertEquals(15, getDbHelper().getInt("IdEntity", "id"));
- assertEquals(15, o1.getIdValue());
- }
+ IdEntity o1 = new IdEntity();
- // TODO: andrus, 9/10/2006 - fails
- public void _testGeneratedId() throws Exception {
- getDbHelper().deleteAll("IdEntity");
+ getEntityManager().persist(o1);
+ getEntityManager().getTransaction().commit();
- IdEntity o1 = new IdEntity();
+ assertTrue(getDbHelper().getInt("IdEntity", "id") > 0);
+ assertTrue(o1.getIdValue() > 0);
+ }
- getEntityManager().persist(o1);
- getEntityManager().getTransaction().commit();
+ public void testUserProvidedIdColumnAnnotation() throws Exception {
+ getDbHelper().deleteAll("IdColumnEntity");
- assertTrue(getDbHelper().getInt("IdEntity", "id") > 0);
- assertTrue(o1.getIdValue() > 0);
- }
+ IdColumnEntity o1 = new IdColumnEntity();
+ o1.setIdValue(15);
- // TODO: andrus, 9/10/2006 - fails
- public void _testUserProvidedIdColumnAnnotation() throws Exception {
- getDbHelper().deleteAll("IdColumnEntity");
+ getEntityManager().persist(o1);
+ getEntityManager().getTransaction().commit();
- IdColumnEntity o1 = new IdColumnEntity();
- o1.setIdValue(15);
+ assertEquals(15, getDbHelper().getInt("IdColumnEntity", "idcolumn"));
+ assertEquals(15, o1.getIdValue());
+ }
- getEntityManager().persist(o1);
- getEntityManager().getTransaction().commit();
+ public void testGeneratedIdColumnAnnotation() throws Exception {
+ getDbHelper().deleteAll("IdColumnEntity");
- assertEquals(15, getDbHelper().getInt("IdColumnEntity", "idcolumn"));
- assertEquals(15, o1.getIdValue());
- }
+ IdColumnEntity o1 = new IdColumnEntity();
- // TODO: andrus, 9/10/2006 - fails
- public void _testGeneratedIdColumnAnnotation() throws Exception {
- getDbHelper().deleteAll("IdColumnEntity");
+ getEntityManager().persist(o1);
+ getEntityManager().getTransaction().commit();
- IdColumnEntity o1 = new IdColumnEntity();
+ assertTrue(getDbHelper().getInt("IdColumnEntity", "idcolumn") > 0);
+ assertTrue(o1.getIdValue() > 0);
+ }
- getEntityManager().persist(o1);
- getEntityManager().getTransaction().commit();
+ public void testFind() throws Exception {
+ getDbHelper().deleteAll("IdEntity");
- assertTrue(getDbHelper().getInt("IdColumnEntity", "idcolumn") > 0);
- assertTrue(o1.getIdValue() > 0);
- }
+ getDbHelper().insert("IdEntity", new String[] {
+ "id",
+ }, new Object[] {
+ 25
+ });
+
+ assertNull(getEntityManager().find(IdEntity.class, new Integer(14)));
+
+ IdEntity o1 = (IdEntity) getEntityManager().find(IdEntity.class, new Integer(25));
+ assertNotNull(o1);
+ assertEquals(25, o1.getIdValue());
+
+ assertNull(getEntityManager().find(IdEntity.class, new Integer(16)));
+
+ IdEntity o2 = (IdEntity) getEntityManager().find(IdEntity.class, new Integer(25));
+ assertSame(o1, o2);
+ }
}