You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by al...@apache.org on 2012/05/25 22:28:44 UTC
svn commit: r1342803 - in
/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence:
jdbc/ jdbc/common/apps/ jdbc/kernel/ simple/
Author: allee8285
Date: Fri May 25 20:28:43 2012
New Revision: 1342803
URL: http://svn.apache.org/viewvc?rev=1342803&view=rev
Log:
OPENJPA-2095 - JUnit 4 treats Test*.class as test case. Otherwise the following exception will be observed.
java.lang.IllegalArgumentException: Test class can only have one constructor
at org.junit.runners.model.TestClass.<init>(TestClass.java:32)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:54)
Rename entity classes prefix Test* to avoid the problem.
Added:
openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/EntityWithFailedExternalizer.java
- copied, changed from r1342348, openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/TestItemWithFailedExternalizer.java
openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/EntityWithTimestampPK.java
- copied, changed from r1342348, openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityWithTimestampPK.java
Removed:
openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/TestItemWithFailedExternalizer.java
openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityWithTimestampPK.java
Modified:
openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestTimestampPKDeletion.java
openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestBatchFlushWithMetadataException.java
Modified: openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestTimestampPKDeletion.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestTimestampPKDeletion.java?rev=1342803&r1=1342802&r2=1342803&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestTimestampPKDeletion.java (original)
+++ openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestTimestampPKDeletion.java Fri May 25 20:28:43 2012
@@ -24,17 +24,17 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.Query;
-import org.apache.openjpa.persistence.simple.TestEntityWithTimestampPK;
+import org.apache.openjpa.persistence.simple.EntityWithTimestampPK;
import org.apache.openjpa.persistence.test.SQLListenerTestCase;
public class TestTimestampPKDeletion extends SQLListenerTestCase {
public void setUp() {
- setUp(TestEntityWithTimestampPK.class);
+ setUp(EntityWithTimestampPK.class);
}
public void testTimestampPKDeletion() {
- TestEntityWithTimestampPK testEntity = new TestEntityWithTimestampPK("test");
+ EntityWithTimestampPK testEntity = new EntityWithTimestampPK("test");
EntityManager em = emf.createEntityManager();
@@ -46,10 +46,10 @@ public class TestTimestampPKDeletion ext
em = emf.createEntityManager();
final EntityTransaction tx = em.getTransaction();
tx.begin();
- final Query q = em.createQuery("SELECT testEntity FROM TestEntityWithTimestampPK testEntity ");
+ final Query q = em.createQuery("SELECT testEntity FROM EntityWithTimestampPK testEntity ");
- final List<TestEntityWithTimestampPK> testEntities = q.getResultList();
- for (TestEntityWithTimestampPK t : testEntities) {
+ final List<EntityWithTimestampPK> testEntities = q.getResultList();
+ for (EntityWithTimestampPK t : testEntities) {
em.remove(t);
}
tx.commit();
Copied: openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/EntityWithFailedExternalizer.java (from r1342348, openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/TestItemWithFailedExternalizer.java)
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/EntityWithFailedExternalizer.java?p2=openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/EntityWithFailedExternalizer.java&p1=openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/TestItemWithFailedExternalizer.java&r1=1342348&r2=1342803&rev=1342803&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/TestItemWithFailedExternalizer.java (original)
+++ openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/EntityWithFailedExternalizer.java Fri May 25 20:28:43 2012
@@ -23,11 +23,9 @@ import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.PersistenceException;
-import javax.persistence.Table;
@Entity
-@Table(name="TestItemWithFailedExternalizer")
-public class TestItemWithFailedExternalizer implements Serializable {
+public class EntityWithFailedExternalizer implements Serializable {
private static final long serialVersionUID = 1L;
@@ -73,11 +71,11 @@ public class TestItemWithFailedExternali
}
}
- public TestItemWithFailedExternalizer() {
+ public EntityWithFailedExternalizer() {
super();
}
- public TestItemWithFailedExternalizer(int iref, String name, String data) {
+ public EntityWithFailedExternalizer(int iref, String name, String data) {
super();
this.iref = iref;
this.name = name;
Modified: openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestBatchFlushWithMetadataException.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestBatchFlushWithMetadataException.java?rev=1342803&r1=1342802&r2=1342803&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestBatchFlushWithMetadataException.java (original)
+++ openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestBatchFlushWithMetadataException.java Fri May 25 20:28:43 2012
@@ -24,7 +24,7 @@ import javax.persistence.EntityTransacti
import org.apache.openjpa.persistence.PersistenceException;
import org.apache.openjpa.persistence.RollbackException;
-import org.apache.openjpa.persistence.jdbc.common.apps.TestItemWithFailedExternalizer;
+import org.apache.openjpa.persistence.jdbc.common.apps.EntityWithFailedExternalizer;
import org.apache.openjpa.persistence.test.SQLListenerTestCase;
/*
@@ -35,7 +35,7 @@ public class TestBatchFlushWithMetadataE
@Override
public void setUp() throws Exception {
- setUp(DROP_TABLES, TestItemWithFailedExternalizer.class);
+ setUp(DROP_TABLES, EntityWithFailedExternalizer.class);
}
public void testCreate(){
@@ -43,10 +43,10 @@ public class TestBatchFlushWithMetadataE
EntityTransaction tx = em.getTransaction();
tx.begin();
- TestItemWithFailedExternalizer item1 = new TestItemWithFailedExternalizer(1001, "MyName1", "description1");
- TestItemWithFailedExternalizer item2 = new TestItemWithFailedExternalizer(1002, "MyName2", "description2");
+ EntityWithFailedExternalizer item1 = new EntityWithFailedExternalizer(1001, "MyName1", "description1");
+ EntityWithFailedExternalizer item2 = new EntityWithFailedExternalizer(1002, "MyName2", "description2");
item1.getExt().throwEx=true;
- TestItemWithFailedExternalizer item3 = new TestItemWithFailedExternalizer(1003, "MyName3", "description3");
+ EntityWithFailedExternalizer item3 = new EntityWithFailedExternalizer(1003, "MyName3", "description3");
em.persist(item1);
em.persist(item2);
Copied: openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/EntityWithTimestampPK.java (from r1342348, openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityWithTimestampPK.java)
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/EntityWithTimestampPK.java?p2=openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/EntityWithTimestampPK.java&p1=openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityWithTimestampPK.java&r1=1342348&r2=1342803&rev=1342803&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityWithTimestampPK.java (original)
+++ openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/EntityWithTimestampPK.java Fri May 25 20:28:43 2012
@@ -25,7 +25,7 @@ import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
-public class TestEntityWithTimestampPK {
+public class EntityWithTimestampPK {
@Id
private Timestamp idTsp;
@@ -36,13 +36,13 @@ public class TestEntityWithTimestampPK {
return idTsp;
}
- public TestEntityWithTimestampPK(String desc) {
+ public EntityWithTimestampPK(String desc) {
super();
this.idTsp = new Timestamp((new Date()).getTime());
this.description = desc;
}
- public TestEntityWithTimestampPK(){
+ public EntityWithTimestampPK(){
}