aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSabine Heider2013-02-14 06:59:08 (EST)
committertware2013-02-27 13:12:54 (EST)
commit98e20c53bc6c6eaedac04c7ead8b8696d13d0787 (patch)
treee42e5cca31f95ccfb5b1896c40149f55c543b937
parentf8f145e8418d5f3bb63de17c64104d711f98fe08 (diff)
downloadeclipselink.runtime-98e20c53bc6c6eaedac04c7ead8b8696d13d0787.zip
eclipselink.runtime-98e20c53bc6c6eaedac04c7ead8b8696d13d0787.tar.gz
eclipselink.runtime-98e20c53bc6c6eaedac04c7ead8b8696d13d0787.tar.bz2
Rewrite WDF test TestSequence.testAllocSize
The test org.eclipse.persistence.testing.tests.wdf.jpa1.generator.TestSequence.testAllocSize made incorrect assumptions on implementation details and therefore failed. This change changes the test implementation. The new test is no longer skipped on Oracle and MaxDB platforms. However, it is skipped when executed inside an application server. Signed-off-by: Sabine Heider <sabine.heider@sap.com>
-rw-r--r--jpa/eclipselink.jpa.wdf.test/resource/eclipselink-wdf-jpa1-model/persistence.xml15
-rw-r--r--jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/AbstractBaseTest.java2
-rw-r--r--jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/generator/TestSequence.java22
3 files changed, 34 insertions, 5 deletions
diff --git a/jpa/eclipselink.jpa.wdf.test/resource/eclipselink-wdf-jpa1-model/persistence.xml b/jpa/eclipselink.jpa.wdf.test/resource/eclipselink-wdf-jpa1-model/persistence.xml
index 2dc9308..31d8657 100644
--- a/jpa/eclipselink.jpa.wdf.test/resource/eclipselink-wdf-jpa1-model/persistence.xml
+++ b/jpa/eclipselink.jpa.wdf.test/resource/eclipselink-wdf-jpa1-model/persistence.xml
@@ -93,6 +93,21 @@
<property name="eclipselink.jdbc.batch-writing" value="JDBC"/>
</properties>
</persistence-unit>
+
+ <persistence-unit name="jpa1testmodel-2" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <non-jta-data-source>%%data-source-name%%</non-jta-data-source>
+ <class>org.eclipse.persistence.testing.models.wdf.jpa1.fancy.Animal</class>
+ <class>org.eclipse.persistence.testing.models.wdf.jpa1.fancy.Element</class>
+ <class>org.eclipse.persistence.testing.models.wdf.jpa1.fancy.Plant</class>
+
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
+ <properties>
+ <property name="eclipselink.target-database" value="%%database-platform%%"/>
+ </properties>
+ </persistence-unit>
+
<!--
<persistence-unit name="jpa1testmodel_jta">
<description>ATS Test Persistence Unit</description>
diff --git a/jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/AbstractBaseTest.java b/jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/AbstractBaseTest.java
index 1fe7ef2..f5ddac0 100644
--- a/jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/AbstractBaseTest.java
+++ b/jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/AbstractBaseTest.java
@@ -69,7 +69,7 @@ public abstract class AbstractBaseTest {
private final JPAEnvironment environment;
private final String puName;
private final static DataSource dataSource;
- private final static Map EMF_PROPERTIES;
+ protected final static Map EMF_PROPERTIES;
private static boolean seesJPA2 = (LockModeType.values().length > 2);
diff --git a/jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/generator/TestSequence.java b/jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/generator/TestSequence.java
index dc2e84d..73dcb4f 100644
--- a/jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/generator/TestSequence.java
+++ b/jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/generator/TestSequence.java
@@ -14,6 +14,9 @@
package org.eclipse.persistence.testing.tests.wdf.jpa1.generator;
import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Persistence;
import junit.framework.Assert;
@@ -76,18 +79,22 @@ public class TestSequence extends JPA1Base {
}
@Test
- @Skip(databases = {MySQLPlatform.class, SQLServerPlatform.class, DerbyPlatform.class})
- @ToBeInvestigated(databases = OraclePlatform.class, databaseNames = "org.eclipse.persistence.platform.database.MaxDBPlatform")
- // adjust test
+ @Skip(server=true, databases = {MySQLPlatform.class, SQLServerPlatform.class, DerbyPlatform.class})
public void testAllocSize() {
JPAEnvironment env = getEnvironment();
EntityManager em = env.getEntityManager();
+
+ EntityManagerFactory emf2 = Persistence.createEntityManagerFactory("jpa1testmodel-2", EMF_PROPERTIES);
+ EntityManager em2 = emf2.createEntityManager();
+
try {
em.getTransaction().begin();
+ em2.getTransaction().begin();
+
final Plant tree = new Plant("tree");
final Element water = new Element("water");
em.persist(tree); // id 1
- em.persist(water); // id 4
+ em2.persist(water); // id 4
Assert.assertEquals("wrong allocation", ((int) tree.getId() + 3), ((int) water.getId()));
final Plant flower = new Plant("flower");
final Plant grass = new Plant("grass");
@@ -97,11 +104,18 @@ public class TestSequence extends JPA1Base {
em.persist(bush); // id 7
Assert.assertEquals("wrong allocation", ((int) water.getId() + 3), ((int) bush.getId()));
em.getTransaction().commit();
+ em2.getTransaction().commit();
} finally {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
+ if (em2.getTransaction().isActive()) {
+ em2.getTransaction().rollback();
+ }
+ em2.close();
+ emf2.close();
}
}
+
}