You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by st...@apache.org on 2019/01/15 08:25:04 UTC

[openjpa] branch master updated: force cleaning of the table to have re-runnable tests

This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git


The following commit(s) were added to refs/heads/master by this push:
     new 03ebe4f  force cleaning of the table to have re-runnable tests
03ebe4f is described below

commit 03ebe4fdd0865a6ce7007a6ac9cf4eb189c722e2
Author: Mark Struberg <st...@apache.org>
AuthorDate: Tue Jan 15 09:24:19 2019 +0100

    force cleaning of the table to have re-runnable tests
---
 .../java/org/apache/openjpa/example/gallery/TestJPAValidation.java | 7 ++++++-
 .../image-gallery/src/test/resources/META-INF/persistence.xml      | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/TestJPAValidation.java b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/TestJPAValidation.java
index caaa261..735f38e 100644
--- a/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/TestJPAValidation.java
+++ b/openjpa-examples/image-gallery/src/test/java/org/apache/openjpa/example/gallery/TestJPAValidation.java
@@ -29,13 +29,18 @@ import javax.validation.ConstraintViolationException;
 
 import org.apache.openjpa.example.gallery.model.Image;
 import org.apache.openjpa.example.gallery.model.Location;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+public class TestJPAValidation {
 
-public class TestJPAValidation extends junit.framework.TestCase {
 
     /**
      * Shows usage of BV constraints with JPA at pre-update, pre-remove,
      * and pre-persist lifecycle events.
      */
+    @Test
     public void testValidation() {
         EntityManagerFactory emf =
             Persistence.createEntityManagerFactory("BeanValidation");
diff --git a/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml b/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml
index 2684c3a..b13b10b 100644
--- a/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml
+++ b/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml
@@ -43,7 +43,8 @@
           <property name="openjpa.ConnectionURL"
               value="jdbc:derby:target/database/ImageDB;create=true" />
             -->
-          <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+            <!-- we synchronise the table schema and delete their table contents for repeatable tests -->
+          <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true,SchemaAction='add,deleteTableContents')"/>
           <property name="openjpa.DynamicEnhancementAgent" value="false"/>
 
           <property name="javax.persistence.validation.group.pre-persist"