openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1340808 - in /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa: jdbc/oracle/ persistence/distinctjoin/
Date Sun, 20 May 2012 19:26:21 GMT
Author: struberg
Date: Sun May 20 19:26:21 2012
New Revision: 1340808

URL: http://svn.apache.org/viewvc?rev=1340808&view=rev
Log:
OPENJPA-2179 improve test and move to general 

Sadly I experienced that this not only happens with Oracle
but also on hsqldb, mysql and most probably any other.

Added:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Course.java
  (contents, props changed)
      - copied, changed from r1339492, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Course.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Lecturer.java
  (contents, props changed)
      - copied, changed from r1339492, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Lecturer.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/LocalizedText.java
  (contents, props changed)
      - copied, changed from r1339492, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/SomeEmbeddable.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/TestDistinctJoin.java
  (contents, props changed)
      - copied, changed from r1339492, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/TestOracleDistinctJoin.java
Removed:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Course.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Lecturer.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/SomeEmbeddable.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/TestOracleDistinctJoin.java

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Course.java
(from r1339492, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Course.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Course.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Course.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Course.java&r1=1339492&r2=1340808&rev=1340808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Course.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Course.java
Sun May 20 19:26:21 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.openjpa.jdbc.oracle;
+package org.apache.openjpa.persistence.distinctjoin;
 
 import javax.persistence.AttributeOverride;
 import javax.persistence.AttributeOverrides;
@@ -59,9 +59,14 @@ public class Course implements Serializa
 
 
     @Embedded
-    @AttributeOverrides({@AttributeOverride(name = "valA", column = @Column(name = "objectiveDe")),
-                         @AttributeOverride(name = "valB", column = @Column(name = "objectiveEn"))})
-    private SomeEmbeddable anEmbeddable;
+    @AttributeOverrides({@AttributeOverride(name = "textDe", column = @Column(name = "objectiveDe")),
+                         @AttributeOverride(name = "textEn", column = @Column(name = "objectiveEn"))})
+    private LocalizedText objective;
+
+    @Embedded
+    @AttributeOverrides({@AttributeOverride(name = "textDe", column = @Column(name = "titleDe")),
+            @AttributeOverride(name = "textEn", column = @Column(name = "titleEn"))})
+    private LocalizedText title;
 
 
     @Lob
@@ -86,13 +91,20 @@ public class Course implements Serializa
         this.courseNumber = courseNumber;
     }
 
+    public LocalizedText getObjective() {
+        return objective;
+    }
+
+    public void setObjective(LocalizedText objective) {
+        this.objective = objective;
+    }
 
-    public SomeEmbeddable getAnEmbeddable() {
-        return anEmbeddable;
+    public LocalizedText getTitle() {
+        return title;
     }
 
-    public void setAnEmbeddable(SomeEmbeddable anEmbeddable) {
-        this.anEmbeddable = anEmbeddable;
+    public void setTitle(LocalizedText title) {
+        this.title = title;
     }
 
     public String getLobColumn() {

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Course.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Lecturer.java
(from r1339492, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Lecturer.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Lecturer.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Lecturer.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Lecturer.java&r1=1339492&r2=1340808&rev=1340808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/Lecturer.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Lecturer.java
Sun May 20 19:26:21 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.openjpa.jdbc.oracle;
+package org.apache.openjpa.persistence.distinctjoin;
 
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/Lecturer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/LocalizedText.java
(from r1339492, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/SomeEmbeddable.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/LocalizedText.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/LocalizedText.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/SomeEmbeddable.java&r1=1339492&r2=1340808&rev=1340808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/SomeEmbeddable.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/LocalizedText.java
Sun May 20 19:26:21 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.openjpa.jdbc.oracle;
+package org.apache.openjpa.persistence.distinctjoin;
 
 import javax.persistence.Embeddable;
 import javax.persistence.Lob;
@@ -27,26 +27,31 @@ import javax.persistence.Lob;
  * single sub selects for each Embedded field in Oracle.
  */
 @Embeddable
-public class SomeEmbeddable {
+public class LocalizedText {
     @Lob
-    String valA;
+    String textEn;
 
     @Lob
-    String valB;
+    String textDe;
 
-    public String getValA() {
-        return valA;
+    public LocalizedText() {
+        System.out.println("Just for having a debug breakpoint...");
     }
 
-    public void setValA(String valA) {
-        this.valA = valA;
+
+    public String getTextDe() {
+        return textDe;
+    }
+
+    public void setTextDe(String textDe) {
+        this.textDe = textDe;
     }
 
-    public String getValB() {
-        return valB;
+    public String getTextEn() {
+        return textEn;
     }
 
-    public void setValB(String valB) {
-        this.valB = valB;
+    public void setTextEn(String textEn) {
+        this.textEn = textEn;
     }
 }

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/LocalizedText.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/TestDistinctJoin.java
(from r1339492, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/TestOracleDistinctJoin.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/TestDistinctJoin.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/TestDistinctJoin.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/TestOracleDistinctJoin.java&r1=1339492&r2=1340808&rev=1340808&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/TestOracleDistinctJoin.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/TestDistinctJoin.java
Sun May 20 19:26:21 2012
@@ -16,20 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.openjpa.jdbc.oracle;
+package org.apache.openjpa.persistence.distinctjoin;
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityTransaction;
 import javax.persistence.Query;
-import javax.sql.DataSource;
-import java.sql.Connection;
 import java.sql.SQLException;
-import java.sql.Statement;
 import java.util.List;
 
-import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
-import org.apache.openjpa.jdbc.sql.DBDictionary;
-import org.apache.openjpa.jdbc.sql.OracleDictionary;
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase;
@@ -53,26 +47,16 @@ import org.apache.openjpa.persistence.te
  * Of course you need to set the correct IP address, username and password of your Oracle
server.
  * This also assumes that you have downloaded the oracle JDBC driver and locally installed
it to maven.
  */
-public class TestOracleDistinctJoin extends AbstractPersistenceTestCase {
+public class TestDistinctJoin extends AbstractPersistenceTestCase {
 
     private static String projectStr = "project";
 
     private Log log;
 
-    private boolean skipTest(DBDictionary dict) {
-        return !(dict instanceof OracleDictionary);
-    }
 
     public void setUp() throws SQLException {
         OpenJPAEntityManagerFactorySPI emf = createEMF();
 
-        JDBCConfiguration conf = ((JDBCConfiguration) emf.getConfiguration());
-        DBDictionary dict = conf.getDBDictionaryInstance();
-
-        if (skipTest(dict)) {
-            emf.close();
-            return;
-        }
         log = emf.getConfiguration().getLog("Tests");
 
         emf.close();
@@ -80,21 +64,13 @@ public class TestOracleDistinctJoin exte
 
     public void testJoinOnly() throws SQLException {
         OpenJPAEntityManagerFactorySPI emf =
-            createEMF(Course.class, Lecturer.class, SomeEmbeddable.class,
+            createEMF(Course.class, Lecturer.class, LocalizedText.class,
                 "openjpa.jdbc.SchemaFactory", "native",
                 "openjpa.jdbc.SynchronizeMappings",  "buildSchema(ForeignKeys=true)",
                 "openjpa.jdbc.QuerySQLCache", "false",
                 "openjpa.DataCache", "false" );
 
-        JDBCConfiguration conf = ((JDBCConfiguration) emf.getConfiguration());
-        DBDictionary dict = conf.getDBDictionaryInstance();
-
-        if (skipTest(dict)) {
-            emf.close();
-            return;
-        }
-
-        Long id = null;
+        Long id;
 
         {
             EntityManager em = emf.createEntityManager();
@@ -113,10 +89,16 @@ public class TestOracleDistinctJoin exte
             tran.begin();
 
             Course course = new Course();
-            SomeEmbeddable emb = new SomeEmbeddable();
-            emb.setValA("a");
-            emb.setValB("b");
-            course.setAnEmbeddable(emb);
+            LocalizedText objective = new LocalizedText();
+            objective.setTextDe("de-objective");
+            objective.setTextEn("en-objective");
+            course.setObjective(objective);
+
+            LocalizedText title = new LocalizedText();
+            title.setTextDe("title-de");
+            title.setTextEn("title-en");
+            course.setObjective(title);
+
             course.setLobColumn("oh this could be a very looooong text...");
             course.setCourseNumber("4711");
 

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/distinctjoin/TestDistinctJoin.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message