From 5b536156091c505a90c0dc108da66aa0cd437ad0 Mon Sep 17 00:00:00 2001 From: Jeremy Bauer Date: Tue, 26 May 2009 18:29:29 +0000 Subject: [PATCH] OPENJPA-926 Modify XML-based explicit access tests to use build-time enhancement git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@778831 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/meta/AccessCode.java | 24 +++++-- .../apache/openjpa/meta/ClassMetaData.java | 10 +-- .../apache/openjpa/meta/TestAccessCode.java | 20 ++++-- .../persistence/access/TestDefaultAccess.java | 28 ++++---- .../access/xml/TestXMLExplicitAccess.java | 30 +++----- .../xml/XMLDefFieldMixedPropAccess2.java | 69 +++++++++++++++++++ .../xml/XMLDefPropMixedFieldAccess2.java | 69 +++++++++++++++++++ .../access/xml/XMLFieldAccess2.java | 69 +++++++++++++++++++ .../access/xml/XMLPropAccess2.java | 61 ++++++++++++++++ .../test/resources/META-INF/persistence.xml | 39 +++++++++++ .../access/access-def-field-orm.xml | 4 +- .../access/access-def-persistence.xml | 8 +-- .../access/access-def-prop-orm.xml | 4 +- .../persistence/access/access-persistence.xml | 2 +- .../access/access-pudef-field-orm.xml | 4 +- .../access/access-pudef-persistence.xml | 8 +-- .../access/access-pudef-prop-orm.xml | 4 +- .../PersistenceMetaDataDefaults.java | 2 +- 18 files changed, 387 insertions(+), 68 deletions(-) create mode 100644 openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java create mode 100644 openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java create mode 100644 openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java create mode 100644 openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java index 2f1f8ceb0..5fc5db28c 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AccessCode.java @@ -179,7 +179,8 @@ public class AccessCode { 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 @@ public class AccessCode { 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 @@ public class AccessCode { 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"; diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java index 8e24b63e1..aa064fd69 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java @@ -682,12 +682,12 @@ public class ClassMetaData 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 @@ public class ClassMetaData 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()); } } diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java b/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java index f042dc86b..d82afb27d 100644 --- a/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java +++ b/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java @@ -40,7 +40,8 @@ public class TestAccessCode extends TestCase { // 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 @@ public class TestAccessCode extends TestCase { // 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 class TestAccessCode extends TestCase { } 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) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java index 5e397666c..390b59546 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/TestDefaultAccess.java @@ -23,10 +23,10 @@ import javax.persistence.Query; 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 @@ public class TestDefaultAccess extends SingleEMFTestCase { } 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 @@ public class TestDefaultAccess extends SingleEMFTestCase { 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 @@ public class TestDefaultAccess extends SingleEMFTestCase { 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 @@ public class TestDefaultAccess extends SingleEMFTestCase { } 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 @@ public class TestDefaultAccess extends SingleEMFTestCase { 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 @@ public class TestDefaultAccess extends SingleEMFTestCase { 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"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java index a006e2679..ff76c8c74 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/TestXMLExplicitAccess.java @@ -26,29 +26,22 @@ import org.apache.openjpa.persistence.ArgumentException; 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 class TestXMLExplicitAccess extends PersistenceTestCase { 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 @@ public class TestXMLExplicitAccess extends PersistenceTestCase { OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence. - createEntityManagerFactory("Access-1", + createEntityManagerFactory("Access-XML", "org/apache/openjpa/persistence/access/" + "access-persistence.xml"); @@ -325,7 +318,7 @@ public class TestXMLExplicitAccess extends PersistenceTestCase { OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence. - createEntityManagerFactory("Access-1", + createEntityManagerFactory("Access-XML", "org/apache/openjpa/persistence/access/" + "access-persistence.xml"); @@ -785,5 +778,4 @@ public class TestXMLExplicitAccess extends PersistenceTestCase { em.close(); } - } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java new file mode 100644 index 000000000..ec0f7b30b --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefFieldMixedPropAccess2.java @@ -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; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java new file mode 100644 index 000000000..5f577c3dc --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLDefPropMixedFieldAccess2.java @@ -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; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java new file mode 100644 index 000000000..df90a2c0d --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLFieldAccess2.java @@ -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; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java new file mode 100644 index 000000000..888879d54 --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/xml/XMLPropAccess2.java @@ -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; + } +} diff --git a/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml b/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml index 10212b245..e1e3740ac 100644 --- a/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml +++ b/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml @@ -40,6 +40,11 @@ org/apache/openjpa/persistence/xml/orm.xml org/apache/openjpa/persistence/embed/embed-orm.xml + org/apache/openjpa/persistence/access/access-orm.xml + org/apache/openjpa/persistence/access/access-def-field-orm.xml + org/apache/openjpa/persistence/access/access-def-prop-orm.xml + org/apache/openjpa/persistence/access/access-pudef-field-orm.xml + org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml @@ -128,4 +133,38 @@ + + PU for access testing + + org/apache/openjpa/persistence/access/access-orm.xml + + org.apache.openjpa.persistence.access.xml.XMLAbstractMappedSuperField + org.apache.openjpa.persistence.access.xml.XMLAbstractMappedSuperProperty + org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess + org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess + org.apache.openjpa.persistence.access.xml.XMLEmbedFieldAccess + org.apache.openjpa.persistence.access.xml.XMLEmbedMixedAccess + org.apache.openjpa.persistence.access.xml.XMLEmbedPropAccess + org.apache.openjpa.persistence.access.xml.XMLFieldAccess + org.apache.openjpa.persistence.access.xml.XMLFieldEmbedEntity + org.apache.openjpa.persistence.access.xml.XMLFieldSub + org.apache.openjpa.persistence.access.xml.XMLFieldSub2 + org.apache.openjpa.persistence.access.xml.XMLFieldSub3 + org.apache.openjpa.persistence.access.xml.XMLMappedSuperField + org.apache.openjpa.persistence.access.xml.XMLMappedSuperProperty + org.apache.openjpa.persistence.access.xml.XMLMixedFieldSub + org.apache.openjpa.persistence.access.xml.XMLMixedMappedSuper + org.apache.openjpa.persistence.access.xml.XMLPropAccess + org.apache.openjpa.persistence.access.xml.XMLPropEmbedEntity + org.apache.openjpa.persistence.access.xml.XMLPropertySub + org.apache.openjpa.persistence.access.xml.XMLPropertySub2 + org.apache.openjpa.persistence.access.xml.XMLPropertySub3 + org.apache.openjpa.persistence.access.xml.XMLPropMixedEntity + org.apache.openjpa.persistence.access.xml.XMLSuperFieldEntity + org.apache.openjpa.persistence.access.xml.XMLSuperPropertyEntity + + + + diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml index 12e767546..50289af7e 100644 --- a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-field-orm.xml @@ -23,7 +23,7 @@ version="2.0"> FIELD + class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess2"> SELECT xfa FROM XMLFieldAccess2 xfa WHERE xfa.id = :id AND xfa.strField = :strVal @@ -39,7 +39,7 @@ + "org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2"> SELECT df FROM XMLDFMPA2 df WHERE df.id = :id AND df.stringField = :strVal diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml index 86208872c..63d7ca3fe 100644 --- a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-def-persistence.xml @@ -31,9 +31,9 @@ org/apache/openjpa/persistence/access/access-def-prop-orm.xml - org.apache.openjpa.persistence.access.xml.XMLPropAccess + org.apache.openjpa.persistence.access.xml.XMLPropAccess2 - org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess + org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2 org/apache/openjpa/persistence/access/access-def-field-orm.xml - org.apache.openjpa.persistence.access.xml.XMLFieldAccess + org.apache.openjpa.persistence.access.xml.XMLFieldAccess2 - org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess + org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2 PROPERTY + "org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2"> SELECT dp FROM XMLDPMFA2 dp WHERE dp.id = :id AND dp.strField = :strVal @@ -45,7 +45,7 @@ + class="org.apache.openjpa.persistence.access.xml.XMLPropAccess2"> SELECT xpa FROM XMLPropAccess2 xpa WHERE xpa.id = :id AND xpa.strProp = :strVal diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml index 46e71984b..f679bbb1f 100644 --- a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-persistence.xml @@ -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" > - + PU for access testing org.apache.openjpa.persistence.PersistenceProviderImpl diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml index e331f12b4..e4e924ad6 100644 --- a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-field-orm.xml @@ -27,7 +27,7 @@ + class="org.apache.openjpa.persistence.access.xml.XMLFieldAccess2"> SELECT xfa FROM XMLFieldAccess2 xfa WHERE xfa.id = :id AND xfa.strField = :strVal @@ -43,7 +43,7 @@ + "org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2"> SELECT df FROM XMLDFMPA2 df WHERE df.id = :id AND df.stringField = :strVal diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml index f5e4a30b9..430695071 100644 --- a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/access/access-pudef-persistence.xml @@ -31,9 +31,9 @@ org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml - org.apache.openjpa.persistence.access.xml.XMLPropAccess + org.apache.openjpa.persistence.access.xml.XMLPropAccess2 - org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess + org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2 org/apache/openjpa/persistence/access/access-pudef-field-orm.xml - org.apache.openjpa.persistence.access.xml.XMLFieldAccess + org.apache.openjpa.persistence.access.xml.XMLFieldAccess2 - org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess + org.apache.openjpa.persistence.access.xml.XMLDefFieldMixedPropAccess2 + "org.apache.openjpa.persistence.access.xml.XMLDefPropMixedFieldAccess2"> SELECT dp FROM XMLDPMFA2 dp WHERE dp.id = :id AND dp.strField = :strVal @@ -49,7 +49,7 @@ + class="org.apache.openjpa.persistence.access.xml.XMLPropAccess2"> SELECT xpa FROM XMLPropAccess2 xpa WHERE xpa.id = :id AND xpa.strProp = :strVal diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java index ff5d4ccfb..19d488a81 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java @@ -645,7 +645,7 @@ public class PersistenceMetaDataDefaults } } else { throw new InternalException(meta + " " + - AccessCode.toString(meta.getAccessType())); + AccessCode.toClassString(meta.getAccessType())); } }