openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r778831 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/meta/ openjpa-kernel/src/test/java/org/apache/openjpa/meta/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/ openjpa-persistence-jdbc/...
Date Tue, 26 May 2009 18:29:30 GMT
Author: jrbauer
Date: Tue May 26 18:29:29 2009
New Revision: 778831

URL: http://svn.apache.org/viewvc?rev=778831&view=rev
Log:
OPENJPA-926 Modify XML-based explicit access tests to use build-time enhancement

Added:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java
  (with props)
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java
  (with props)
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java
  (with props)
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java
  (with props)
Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
    openjpa/trunk/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-prop-orm.xml
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java Tue
May 26 18:29:29 2009
@@ -179,7 +179,8 @@
 			return mergeFieldCode(cCode, fCode);
 		} catch (IllegalStateException e) {
             throw new UserException(_loc.get("access-illegal-merge",
-                fmd.getFullName(false), toString(fCode), toString(cCode)));
+                fmd.getFullName(false), toFieldString(fCode), 
+                toClassString(cCode)));
 		}
 	}
 	
@@ -209,7 +210,7 @@
 					return cCode;
 				else
                     throw new IllegalStateException("Can not merge field " +
-                    toString(fCode) + " to class " + toString(cCode));
+                    toFieldString(fCode) + " to class " + toClassString(cCode));
 			}
 		}
 		return cCode;
@@ -228,9 +229,22 @@
 			return FIELD;
 		return UNKNOWN;
 	}
-	
-	public static String toString(int code) {
-		if (!isValidClassCode(code) || !isValidFieldCode(code))
+
+    public static String toFieldString(int code) {
+        if (!isValidFieldCode(code))
+            return "invalid code " + code;
+        if (code == UNKNOWN)
+            return "unknown access";
+        if (code == EMPTY)
+            return "empty access";
+        return (isMixed(code) ? "mixed " : "") 
+            + (isExplicit(code) ? "explicit " : "implicit ") 
+            + (isField(code) ? "field" : "property")
+            + " access";
+    }
+
+	public static String toClassString(int code) {
+		if (!isValidClassCode(code))
 			return "invalid code " + code;
 		if (code == UNKNOWN)
 			return "unknown access";

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
Tue May 26 18:29:29 2009
@@ -682,12 +682,12 @@
     		return;
     	if (!AccessCode.isValidClassCode(type)) {
             throw new IllegalArgumentException(_loc.get("access-type-invalid", 
-    		    this, AccessCode.toString(type)).getMessage());
+    		    this, AccessCode.toClassString(type)).getMessage());
     	}
     	if (_accessType != AccessCode.UNKNOWN) { // changing access type
     	    _repos.getLog().warn(_loc.get("access-type-change", 
-    		    this, AccessCode.toString(type), 
-    		    AccessCode.toString(_accessType)).getMessage());
+    		    this, AccessCode.toClassString(type), 
+    		    AccessCode.toClassString(_accessType)).getMessage());
     	}
         _accessType = type;
     }
@@ -2143,8 +2143,8 @@
         	int supCode = sup.getAccessType();
         	if (!AccessCode.isCompatibleSuper(_accessType, supCode))
              throw new MetaDataException(_loc.get("access-inconsistent-inherit",
-             new Object[]{this, AccessCode.toString(_accessType), 
-                          sup, AccessCode.toString(supCode)}).toString());
+             new Object[]{this, AccessCode.toClassString(_accessType), 
+                          sup, AccessCode.toClassString(supCode)}).toString());
         }
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java
Tue May 26 18:29:29 2009
@@ -40,7 +40,8 @@
         
         // All odd codes other than 1 are invalid
         for (int i = 3; i < 32; i += 2)
-            assertFalse("Not a valid Class Code: " + AccessCode.toString(i), 
+            assertFalse("Not a valid Class Code: " + 
+                AccessCode.toClassString(i), 
                 AccessCode.isValidClassCode(i));
     }
     
@@ -59,7 +60,8 @@
         
         // any even code with MIXED bit set is invalid
         for (int i = MIXED; i < 32; i += 2) {
-            assertFalse("Not a valid field code: " + AccessCode.toString(i), 
+            assertFalse("Not a valid field code: " + 
+                AccessCode.toFieldString(i), 
                 AccessCode.isValidFieldCode(i));
         }
     }
@@ -145,27 +147,31 @@
     }
     
     public void testToString() {
-        assertEquals("explicit property access", AccessCode.toString(12));
+        assertEquals("explicit property access", AccessCode.toClassString(12));
     }
     
     void isValidClassCode(boolean flag, int v, int valid) {
         assertEquals(v, valid);
         if (flag)
             assertTrue("Invalid Class Code: " + 
-            AccessCode.toString(valid), AccessCode.isValidClassCode(valid));
+            AccessCode.toClassString(valid), 
+            AccessCode.isValidClassCode(valid));
         else
             assertFalse("Wrong Valid Class Code: " + 
-            AccessCode.toString(valid), AccessCode.isValidClassCode(valid));
+            AccessCode.toClassString(valid), 
+            AccessCode.isValidClassCode(valid));
     }
     
     void isValidFieldCode(boolean flag, int v, int valid) {
         assertEquals(v, valid);
         if (flag)
             assertTrue("Invalid Field Code: " + 
-            AccessCode.toString(valid), AccessCode.isValidFieldCode(valid));
+            AccessCode.toFieldString(valid), 
+            AccessCode.isValidFieldCode(valid));
         else
             assertFalse("Wrong Field Class Code: " + 
-            AccessCode.toString(valid), AccessCode.isValidFieldCode(valid));
+            AccessCode.toFieldString(valid), 
+            AccessCode.isValidFieldCode(valid));
     }
     
     void isProperty(boolean flag, int v, int valid) {

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java
Tue May 26 18:29:29 2009
@@ -23,10 +23,10 @@
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
-import org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess;
-import org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess;
-import org.apache.openjpa.persistence.access.xml.XMLFieldAccess;
-import org.apache.openjpa.persistence.access.xml.XMLPropAccess;
+import org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2;
+import org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2;
+import org.apache.openjpa.persistence.access.xml.XMLFieldAccess2;
+import org.apache.openjpa.persistence.access.xml.XMLPropAccess2;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
 public class TestDefaultAccess extends SingleEMFTestCase {
@@ -101,7 +101,7 @@
     }
     
     private void verifyDefaultFieldAccess(OpenJPAEntityManagerSPI em) {
-        XMLFieldAccess fa = new XMLFieldAccess();
+        XMLFieldAccess2 fa = new XMLFieldAccess2();
         // Set the persistent field through a misnamed setter         
         fa.setStringField("XMLFieldAccess2");
         
@@ -116,10 +116,10 @@
         Query qry = em.createNamedQuery("XMLFieldAccess2.query");
         qry.setParameter("id", fa.getId());
         qry.setParameter("strVal", "XMLFieldAccess2");
-        XMLFieldAccess fa2 = (XMLFieldAccess)qry.getSingleResult();
+        XMLFieldAccess2 fa2 = (XMLFieldAccess2)qry.getSingleResult();
         assertEquals(fa.getId(), fa2.getId());
 
-        XMLDefFieldMixedPropAccess dfmpa = new XMLDefFieldMixedPropAccess();
+        XMLDefFieldMixedPropAccess2 dfmpa = new XMLDefFieldMixedPropAccess2();
         // Call non-PC setter
         dfmpa.setStrField("NonPCSetter");
         // Call setter with property access
@@ -136,8 +136,8 @@
         qry = em.createNamedQuery("XMLDFMPA2.query");
         qry.setParameter("id", dfmpa.getId());
         qry.setParameter("strVal", "XMLDFMPA2");
-        XMLDefFieldMixedPropAccess dfmpa2 = 
-            (XMLDefFieldMixedPropAccess)qry.getSingleResult();
+        XMLDefFieldMixedPropAccess2 dfmpa2 = 
+            (XMLDefFieldMixedPropAccess2)qry.getSingleResult();
         assertEquals(dfmpa, dfmpa2);
         assertEquals(dfmpa2.getStringField(), "XMLDFMPA2");
 
@@ -154,7 +154,7 @@
     }
 
     private void verifyDefaultPropertyAccess(OpenJPAEntityManagerSPI em) {
-        XMLPropAccess pa = new XMLPropAccess();
+        XMLPropAccess2 pa = new XMLPropAccess2();
         // Set the persistent field through a mis-named setter         
         pa.setStrProp("PropertyAccess");
         
@@ -169,10 +169,10 @@
         Query qry = em.createNamedQuery("XMLPropAccess2.query");
         qry.setParameter("id", pa.getId());
         qry.setParameter("strVal", "PropertyAccess");
-        XMLPropAccess pa2 = (XMLPropAccess)qry.getSingleResult();
+        XMLPropAccess2 pa2 = (XMLPropAccess2)qry.getSingleResult();
         assertEquals(pa, pa2);
 
-        XMLDefPropMixedFieldAccess dpmfa = new XMLDefPropMixedFieldAccess();
+        XMLDefPropMixedFieldAccess2 dpmfa = new XMLDefPropMixedFieldAccess2();
         // Call setter with underlying field access
         dpmfa.setStrProp("XMLDPMFA2");
         
@@ -187,8 +187,8 @@
         qry = em.createNamedQuery("XMLDPMFA2.query");
         qry.setParameter("id", dpmfa.getId());
         qry.setParameter("strVal", "XMLDPMFA2");
-        XMLDefPropMixedFieldAccess dpmfa2 = 
-            (XMLDefPropMixedFieldAccess)qry.getSingleResult();
+        XMLDefPropMixedFieldAccess2 dpmfa2 = 
+            (XMLDefPropMixedFieldAccess2)qry.getSingleResult();
         assertEquals(dpmfa, dpmfa2);
         assertEquals(dpmfa2.getStrProp(), "XMLDPMFA2");
 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java
Tue May 26 18:29:29 2009
@@ -26,29 +26,22 @@
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
-import org.apache.openjpa.persistence.access.EmbedMixedAccess;
-import org.apache.openjpa.persistence.access.PropMixedEntity;
 import org.apache.openjpa.persistence.test.AllowFailure;
-import org.apache.openjpa.persistence.test.PersistenceTestCase;
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
-public class TestXMLExplicitAccess extends PersistenceTestCase {
-    
-    private OpenJPAEntityManagerFactorySPI emf = null;
-    
+public class TestXMLExplicitAccess extends SingleEMFTestCase {
+        
     public void setUp() throws Exception {
         super.setUp();
-        emf = (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
-            createEntityManagerFactory("Access-1",
-            "org/apache/openjpa/persistence/access/" +
-            "access-persistence.xml");
     }
     
     public void tearDown() throws Exception {
         super.tearDown();
-        if (emf != null) {
-            clear(emf);
-            emf.close();
-        }
+    }
+    
+    @Override
+    protected String getPersistenceUnitName() {
+        return "Access-1";
     }
     /**
      * Validates the use of field level access on an
@@ -212,7 +205,7 @@
     public void testAbstractMappedSuperField() {
         OpenJPAEntityManagerFactorySPI emf = 
             (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
-            createEntityManagerFactory("Access-1",
+            createEntityManagerFactory("Access-XML",
             "org/apache/openjpa/persistence/access/" +
             "access-persistence.xml");
 
@@ -268,7 +261,7 @@
 
         OpenJPAEntityManagerFactorySPI emf = 
             (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
-            createEntityManagerFactory("Access-1",
+            createEntityManagerFactory("Access-XML",
             "org/apache/openjpa/persistence/access/" +
             "access-persistence.xml");
 
@@ -325,7 +318,7 @@
         
         OpenJPAEntityManagerFactorySPI emf = 
             (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
-            createEntityManagerFactory("Access-1",
+            createEntityManagerFactory("Access-XML",
             "org/apache/openjpa/persistence/access/" +
             "access-persistence.xml");
 
@@ -785,5 +778,4 @@
 
         em.close();
     }
-
 }

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java?rev=778831&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java
Tue May 26 18:29:29 2009
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence.access.xml;
+
+public class XMLDefFieldMixedPropAccess2 {
+
+    private int id;
+
+    private int version;
+    
+    private String strField;
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    public int getVersion() {
+        return version;
+    }
+
+    public void setStringField(String val) {
+        strField = val;
+    }
+
+    public String getStringField() {
+        return strField;
+    }  
+    
+    public boolean equals(Object obj) {
+        if (obj instanceof XMLDefFieldMixedPropAccess2) {
+            XMLDefFieldMixedPropAccess2 fa = (XMLDefFieldMixedPropAccess2)obj;
+            return id == fa.getId() &&
+                getStringField().equals(fa.getStringField());
+        }
+        return false;
+    }
+
+    public void setStrField(String strField) {
+        this.strField = strField;
+    }
+
+    public String getStrField() {
+        return strField;
+    }
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java?rev=778831&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java
Tue May 26 18:29:29 2009
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence.access.xml;
+
+public class XMLDefPropMixedFieldAccess2 {
+
+    private int id;
+
+    private int version;
+    
+    private String strField;
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    public int getVersion() {
+        return version;
+    }
+
+    public void setStrProp(String var) {
+        this.setStrField(var);
+    }
+
+    public String getStrProp() {
+        return getStrField();
+    }   
+    
+    public boolean equals(Object obj) {
+        if (obj instanceof XMLDefPropMixedFieldAccess2) {
+            XMLDefPropMixedFieldAccess2 dpmfa = (XMLDefPropMixedFieldAccess2)obj;
+            return getId() == dpmfa.getId() &&
+                getStrField().equals(dpmfa.getStrProp());
+        }
+        return false;
+    }
+
+    public void setStrField(String strField) {
+        this.strField = strField;
+    }
+
+    public String getStrField() {
+        return strField;
+    }
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java?rev=778831&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java
Tue May 26 18:29:29 2009
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence.access.xml;
+
+public class XMLFieldAccess2 {
+
+    private int id;
+
+    private int version;
+    
+    private String strField;
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    public int getVersion() {
+        return version;
+    }
+
+    public void setStringField(String val) {
+        this.setStrField(val);
+    }
+
+    public String getStringField() {
+        return getStrField();
+    }  
+    
+    public boolean equals(Object obj) {
+        if (obj instanceof XMLFieldAccess2) {
+            XMLFieldAccess2 fa = (XMLFieldAccess2)obj;
+            return id == fa.getId() &&
+              getStrField().equals(fa.getStringField());
+        }
+        return false;
+    }
+
+    public void setStrField(String strField) {
+        this.strField = strField;
+    }
+
+    public String getStrField() {
+        return strField;
+    }
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java?rev=778831&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java
Tue May 26 18:29:29 2009
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence.access.xml;
+
+public class XMLPropAccess2 {
+
+    private int id;
+
+    private int version;
+    
+    private String strField;
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    public int getVersion() {
+        return version;
+    }
+
+    public void setStrProp(String var) {
+        this.strField = var;
+    }
+
+    public String getStrProp() {
+        return strField;
+    } 
+    
+    public boolean equals(Object obj) {
+        if (obj instanceof XMLPropAccess2) {
+            XMLPropAccess2 pa = (XMLPropAccess2)obj;
+            return getId() == pa.getId() &&
+                getStrProp().equals(pa.getStrProp());
+        }
+        return false;
+    }
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml Tue
May 26 18:29:29 2009
@@ -40,6 +40,11 @@
         </description>
         <mapping-file>org/apache/openjpa/persistence/xml/orm.xml</mapping-file>
         <mapping-file>org/apache/openjpa/persistence/embed/embed-orm.xml</mapping-file>
+        <mapping-file>org/apache/openjpa/persistence/access/access-orm.xml</mapping-file>
+        <mapping-file>org/apache/openjpa/persistence/access/access-def-field-orm.xml</mapping-file>
+        <mapping-file>org/apache/openjpa/persistence/access/access-def-prop-orm.xml</mapping-file>
+        <mapping-file>org/apache/openjpa/persistence/access/access-pudef-field-orm.xml</mapping-file>
+        <mapping-file>org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml</mapping-file>
         <properties>
             <property name="openjpa.jdbc.SynchronizeMappings"
                 value="buildSchema(ForeignKeys=true)"/>
@@ -128,4 +133,38 @@
         </properties>
     </persistence-unit>
 
+    <persistence-unit name="Access-1" transaction-type="RESOURCE_LOCAL">
+        <description>PU for access testing</description>
+        <mapping-file>
+            org/apache/openjpa/persistence/access/access-orm.xml
+        </mapping-file>
+        <class>org.apache.openjpa.persistence.access.xml.XMLAbstractMappedSuperField</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLAbstractMappedSuperProperty</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLEmbedFieldAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLEmbedMixedAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLEmbedPropAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLFieldEmbedEntity</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLFieldSub</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLFieldSub2</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLFieldSub3</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLMappedSuperField</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLMappedSuperProperty</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLMixedFieldSub</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLMixedMappedSuper</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLPropAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLPropEmbedEntity</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLPropertySub</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLPropertySub2</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLPropertySub3</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLPropMixedEntity</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLSuperFieldEntity</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLSuperPropertyEntity</class>
+        <properties>
+            <property name="openjpa.jdbc.SynchronizeMappings" 
+                value="buildSchema"/> 
+        </properties>
+    </persistence-unit>
 </persistence>

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml
Tue May 26 18:29:29 2009
@@ -23,7 +23,7 @@
     version="2.0">
     <access>FIELD</access>
     <entity name="XMLFieldAccess2" 
-            class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess"> 
+            class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess2"> 
         <named-query name="XMLFieldAccess2.query">
             <query>SELECT xfa FROM XMLFieldAccess2 xfa WHERE 
             xfa.id = :id AND xfa.strField = :strVal
@@ -39,7 +39,7 @@
     </entity>
     <entity name="XMLDFMPA2"
         class=
-        "org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess">
+        "org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2">
         <named-query name="XMLDFMPA2.query">
             <query>SELECT df FROM XMLDFMPA2 df WHERE 
             df.id = :id AND df.stringField = :strVal

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml
Tue May 26 18:29:29 2009
@@ -31,9 +31,9 @@
         <mapping-file>
             org/apache/openjpa/persistence/access/access-def-prop-orm.xml
         </mapping-file>
-        <class>org.apache.openjpa.persistence.access.xml.XMLPropAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLPropAccess2</class>
         <class>
-            org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess
+            org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2
         </class>
         <properties>
             <property name="openjpa.jdbc.SynchronizeMappings" 
@@ -49,9 +49,9 @@
         <mapping-file>
             org/apache/openjpa/persistence/access/access-def-field-orm.xml
         </mapping-file>
-        <class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess2</class>
         <class>
-            org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess
+            org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2
         </class>
         <properties>
             <property name="openjpa.jdbc.SynchronizeMappings" 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-prop-orm.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-prop-orm.xml?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-prop-orm.xml
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-prop-orm.xml
Tue May 26 18:29:29 2009
@@ -24,7 +24,7 @@
     <access>PROPERTY</access>
     <entity name="XMLDPMFA2"
         class=
-        "org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess">
+        "org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2">
         <named-query name="XMLDPMFA2.query">
             <query>SELECT dp FROM XMLDPMFA2 dp WHERE 
             dp.id = :id AND dp.strField = :strVal
@@ -45,7 +45,7 @@
         </attributes>
     </entity>
     <entity name="XMLPropAccess2" 
-            class="org.apache.openjpa.persistence.access.xml.XMLPropAccess">
+            class="org.apache.openjpa.persistence.access.xml.XMLPropAccess2">
         <named-query name="XMLPropAccess2.query">
             <query>SELECT xpa FROM XMLPropAccess2 xpa WHERE 
             xpa.id = :id AND xpa.strProp = :strVal

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml
Tue May 26 18:29:29 2009
@@ -23,7 +23,7 @@
     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
         http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
     version="2.0" >
-    <persistence-unit name="Access-1" transaction-type="RESOURCE_LOCAL">
+    <persistence-unit name="Access-XML" transaction-type="RESOURCE_LOCAL">
         <description>PU for access testing</description>
         <provider>
             org.apache.openjpa.persistence.PersistenceProviderImpl

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml
Tue May 26 18:29:29 2009
@@ -27,7 +27,7 @@
         </persistence-unit-defaults>
     </persistence-unit-metadata>
     <entity name="XMLFieldAccess2" 
-            class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess"> 
+            class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess2"> 
         <named-query name="XMLFieldAccess2.query">
             <query>SELECT xfa FROM XMLFieldAccess2 xfa WHERE 
             xfa.id = :id AND xfa.strField = :strVal
@@ -43,7 +43,7 @@
     </entity>
     <entity name="XMLDFMPA2"
         class=
-        "org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess">
+        "org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2">
         <named-query name="XMLDFMPA2.query">
             <query>SELECT df FROM XMLDFMPA2 df WHERE 
             df.id = :id AND df.stringField = :strVal

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml
Tue May 26 18:29:29 2009
@@ -31,9 +31,9 @@
         <mapping-file>
             org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml
         </mapping-file>
-        <class>org.apache.openjpa.persistence.access.xml.XMLPropAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLPropAccess2</class>
         <class>
-            org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess
+            org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2
         </class>
         <properties>
             <property name="openjpa.jdbc.SynchronizeMappings" 
@@ -49,9 +49,9 @@
         <mapping-file>
             org/apache/openjpa/persistence/access/access-pudef-field-orm.xml
         </mapping-file>
-        <class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess</class>
+        <class>org.apache.openjpa.persistence.access.xml.XMLFieldAccess2</class>
         <class>
-            org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess
+            org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2
         </class>
         <properties>
             <property name="openjpa.jdbc.SynchronizeMappings" 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml
Tue May 26 18:29:29 2009
@@ -28,7 +28,7 @@
     </persistence-unit-metadata>
     <entity name="XMLDPMFA2"
         class=
-        "org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess">
+        "org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2">
         <named-query name="XMLDPMFA2.query">
             <query>SELECT dp FROM XMLDPMFA2 dp WHERE 
             dp.id = :id AND dp.strField = :strVal
@@ -49,7 +49,7 @@
         </attributes>
     </entity>
     <entity name="XMLPropAccess2" 
-            class="org.apache.openjpa.persistence.access.xml.XMLPropAccess">
+            class="org.apache.openjpa.persistence.access.xml.XMLPropAccess2">
         <named-query name="XMLPropAccess2.query">
             <query>SELECT xpa FROM XMLPropAccess2 xpa WHERE 
             xpa.id = :id AND xpa.strProp = :strVal

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java?rev=778831&r1=778830&r2=778831&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
Tue May 26 18:29:29 2009
@@ -645,7 +645,7 @@
         	}
         } else {
         	throw new InternalException(meta + " " + 
-        		AccessCode.toString(meta.getAccessType()));
+        		AccessCode.toClassString(meta.getAccessType()));
         }
     }
     



Mime
View raw message