openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1224892 - in /openjpa/trunk/openjpa-tools/openjpa-maven-plugin: ./ src/it/default_settings/src/main/java/org/apache/openjpa/tools/maven/testentity/ src/it/default_settings/src/test/java/org/apache/openjpa/tools/maven/test/ src/it/default_s...
Date Tue, 27 Dec 2011 10:59:45 GMT
Author: struberg
Date: Tue Dec 27 10:59:45 2011
New Revision: 1224892

URL: http://svn.apache.org/viewvc?rev=1224892&view=rev
Log:
OPENJPA-2100 fix filterPersistenceCapable 

Fixing a bug which got introduced in r1091279 and caused entities
which contained enums to be broken.

Modified:
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/java/org/apache/openjpa/tools/maven/test/ItDefaultSettingsTest.java
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/resources/reference_schema.orig_xml
    openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/AbstractOpenJpaMappingToolMojo.java

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml?rev=1224892&r1=1224891&r2=1224892&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/pom.xml Tue Dec 27 10:59:45 2011
@@ -116,6 +116,10 @@
             <artifactId>geronimo-validation_1.0_spec</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.bval</groupId>
+            <artifactId>org.apache.bval.bundle</artifactId>
+        </dependency>
+        <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
             <version>1.2.14</version>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java?rev=1224892&r1=1224891&r2=1224892&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
(original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
Tue Dec 27 10:59:45 2011
@@ -20,42 +20,60 @@ package org.apache.openjpa.tools.maven.t
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.Enumerated;
+import javax.persistence.EnumType;
 
 
 @Entity
 public class TestEntity {
 
-  @Id
-  private int xint1;
+    @Id
+    private int xint1;
 
-  private String string1;
+    private String string1;
 
-  protected TestEntity() {
-  }
+    public enum SampleEnum {
+        Option1, Option2, Option3
+    }
 
-  public TestEntity(int int1, String string1) {
-    this.xint1 = int1;
-    this.string1 = string1;
-  }
-
-  public int getInt1() {
-    return xint1;
-  }
-
-  public void setInt1(int int1) {
-    this.xint1 = int1;
-  }
-
-  public String getString1() {
-    return string1;
-  }
-
-  public void setString1(String string1) {
-    this.string1 = string1;
-  }
-
-  public String toString()  {
-    return xint1 + ":" + string1;
-  }
+    @Enumerated(EnumType.STRING)
+    private SampleEnum myEnum;
+
+
+    protected TestEntity() {
+    }
+
+    public TestEntity(int int1, String string1) {
+        this.xint1 = int1;
+        this.string1 = string1;
+    }
+
+    public int getInt1() {
+        return xint1;
+    }
+
+    public void setInt1(int int1) {
+        this.xint1 = int1;
+    }
+
+    public String getString1() {
+        return string1;
+    }
+
+    public void setString1(String string1) {
+        this.string1 = string1;
+    }
+
+    public String toString()  {
+        return xint1 + ":" + string1;
+    }
+
+    public SampleEnum getMyEnum() {
+        return myEnum;
+    }
+
+    public void setMyEnum(SampleEnum myEnum) {
+        this.myEnum = myEnum;
+    }
 
 }

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/java/org/apache/openjpa/tools/maven/test/ItDefaultSettingsTest.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/java/org/apache/openjpa/tools/maven/test/ItDefaultSettingsTest.java?rev=1224892&r1=1224891&r2=1224892&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/java/org/apache/openjpa/tools/maven/test/ItDefaultSettingsTest.java
(original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/java/org/apache/openjpa/tools/maven/test/ItDefaultSettingsTest.java
Tue Dec 27 10:59:45 2011
@@ -43,7 +43,8 @@ public class ItDefaultSettingsTest exten
     private final static String SQL_FILE = "database.sql";
     
     /** if the SQL generation has been successful, the following result should be in the
SQL file */
-    private final static String VALID_SQL = "CREATE TABLE TestEntity (xint1 INTEGER NOT NULL,
string1 VARCHAR(255), PRIMARY KEY (xint1));";
+    private final static String VALID_SQL = "CREATE TABLE TestEntity (xint1 INTEGER NOT NULL,
myEnum VARCHAR(20), "
+                                            + "string1 VARCHAR(255), PRIMARY KEY (xint1));";
     
     private final static String TEST_ENTITY_CLASS = "org.apache.openjpa.tools.maven.testentity.TestEntity";
 

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/resources/reference_schema.orig_xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/resources/reference_schema.orig_xml?rev=1224892&r1=1224891&r2=1224892&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/resources/reference_schema.orig_xml
(original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/it/default_settings/src/test/resources/reference_schema.orig_xml
Tue Dec 27 10:59:45 2011
@@ -4,7 +4,8 @@
         <table name="TestEntity">
             <pk column="xint1"/>
             <column name="xint1" type="integer" not-null="true"/>
+            <column name="myEnum" type="varchar" size="20"/>
             <column name="string1" type="varchar" size="255"/>
         </table>
     </schema>
-</schemas>
\ No newline at end of file
+</schemas>

Modified: openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/AbstractOpenJpaMappingToolMojo.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/AbstractOpenJpaMappingToolMojo.java?rev=1224892&r1=1224891&r2=1224892&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/AbstractOpenJpaMappingToolMojo.java
(original)
+++ openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/AbstractOpenJpaMappingToolMojo.java
Tue Dec 27 10:59:45 2011
@@ -22,6 +22,7 @@ package org.apache.openjpa.tools.maven;
 import java.io.File;
 import java.io.IOException;
 import java.sql.SQLException;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.persistence.Entity;
@@ -130,8 +131,11 @@ public abstract class AbstractOpenJpaMap
         MetaDataRepository repo = conf.newMetaDataRepositoryInstance();
         ClassArgParser cap = repo.getMetaDataFactory().newClassArgParser();
 
-        for(File classPath : files) { 
-            Class<?>[] classes = cap.parseTypes(classPath.getAbsolutePath());
+        Iterator<File> fileIt = files.iterator();
+        while (fileIt.hasNext()) {
+            File classPath = fileIt.next();
+
+            Class[] classes = cap.parseTypes(classPath.getAbsolutePath());
 
             if (classes == null) {
                 getLog().info("Found no classes for " + classPath.getAbsolutePath());
@@ -146,6 +150,7 @@ public abstract class AbstractOpenJpaMap
                                 + PersistenceCapable.class.getName());
                     } else {
                         getLog().debug("Removing non-entity class " + classPath);
+                        fileIt.remove();
                     }
                 }
             }



Mime
View raw message