You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by mi...@apache.org on 2009/03/23 00:45:35 UTC
svn commit: r757280 [13/23] - in /openjpa/branches/1.0.x:
openjpa-examples/src/main/java/hellojpa/
openjpa-examples/src/main/java/relations/
openjpa-jdbc-5/src/main/java/org/apache/openjpa/jdbc/meta/strats/
openjpa-jdbc/src/main/java/org/apache/openjpa...
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java Sun Mar 22 23:45:15 2009
@@ -1,596 +1,596 @@
-/*
- * 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.enhance;
-
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ByteArrayInputStream;
-import java.util.List;
-import java.util.Collections;
-import java.lang.reflect.Field;
-
-import org.apache.openjpa.persistence.test.SingleEMFTestCase;
-import org.apache.openjpa.persistence.OpenJPAEntityManager;
-import org.apache.openjpa.persistence.JPAFacadeHelper;
-import org.apache.openjpa.kernel.OpenJPAStateManager;
-import org.apache.openjpa.meta.ClassMetaData;
-import org.apache.openjpa.util.ImplHelper;
-import org.apache.openjpa.event.AbstractLifecycleListener;
-import org.apache.openjpa.event.LifecycleEvent;
-
-public abstract class AbstractUnenhancedClassTest
- extends SingleEMFTestCase {
-
- // ##### To do:
- // - clearing in pnew property-access without redefinition
- // - figure out how to auto-test the redefinition code, either in Java 5
- // or in Java 6
- // - run CTS in the following combinations:
- // * Java 6
- // * Java 5 with javaagent
- // * Java 5 without javaagent
-
- public void setUp() {
- setUp(getUnenhancedClass(), getUnenhancedSubclass(), CLEAR_TABLES);
- // trigger class redefinition
- emf.createEntityManager().close();
- }
-
- protected abstract Class<? extends UnenhancedType> getUnenhancedClass();
-
- protected abstract UnenhancedType newUnenhancedInstance();
-
- protected abstract Class<? extends UnenhancedSubtype> getUnenhancedSubclass();
-
- protected abstract UnenhancedSubtype newUnenhancedSubclassInstance();
-
- private UnenhancedType newInstance(boolean sub) {
- return sub ? newUnenhancedSubclassInstance()
- : newUnenhancedInstance();
- }
-
- public void testMetaData() {
- ClassMetaData meta = JPAFacadeHelper.getMetaData(emf,
- getUnenhancedClass());
- assertEquals(ClassRedefiner.canRedefineClasses(),
- meta.isIntercepting());
- }
-
- public void testImplHelperCalls() {
- assertTrue(ImplHelper.isManagedType(null, getUnenhancedClass()));
-
- UnenhancedType un = newUnenhancedInstance();
- assertFalse(un instanceof PersistenceCapable);
- PersistenceCapable pc = ImplHelper.toPersistenceCapable(un,
- emf.getConfiguration());
- assertNotNull(pc);
- assertTrue(ImplHelper.isManageable(un));
- }
-
- public void testBasicPersistenceCapableBehavior() {
- UnenhancedType un = newUnenhancedInstance();
- un.setStringField("bar");
- PersistenceCapable pc = ImplHelper.toPersistenceCapable(un,
- emf.getConfiguration());
- assertFalse(pc.pcIsDeleted());
- assertFalse(pc.pcIsDirty());
- assertFalse(pc.pcIsNew());
- assertFalse(pc.pcIsPersistent());
- assertFalse(pc.pcIsTransactional());
- }
-
- public void testPCRegistry() {
- assertTrue(PCRegistry.isRegistered(getUnenhancedClass()));
- PersistenceCapable pc = PCRegistry.newInstance(
- getUnenhancedClass(), null, false);
- assertNotNull(pc);
- }
-
- public void testClearingOnSubtypeInstance() {
- // the boolean at the end of newInstance will cause clear to be invoked
- UnenhancedType un = (UnenhancedType)
- PCRegistry.newInstance(getUnenhancedClass(), null, true);
- assertEquals(null, un.getStringField());
- }
-
- public void testGetObjectIdOnOpenJPAType() {
- getObjectIdHelper(true, false);
- }
-
- public void testGetObjectIdOnOpenJPATypeSubclass() {
- getObjectIdHelper(false, false);
- }
-
- public void testGetObjectIdOnUserDefined() {
- getObjectIdHelper(true, true);
- }
-
- public void testGetObjectIdOnUserDefinedSubclass() {
- getObjectIdHelper(false, true);
- }
-
- private void getObjectIdHelper(boolean sub, boolean userDefined) {
- OpenJPAEntityManager em = emf.createEntityManager();
- em.getTransaction().begin();
- UnenhancedType un = newInstance(sub);
- em.persist(un);
- em.getTransaction().commit();
-
- if (!userDefined) {
- em.close();
- em = emf.createEntityManager();
- un = em.find(getUnenhancedClass(), un.getId());
- }
-
- assertNotNull(em.getObjectId(un));
- }
-
- public void testOperationsOnUserDefined() {
- opsHelper(false, true);
- }
-
- public void testSubclassOperationsOnUserDefined() {
- opsHelper(true, true);
- }
-
- public void testOperationsOnOpenJPADefined() {
- opsHelper(false, false);
- }
-
- public void testSubclassOperationsOnOpenJPADefined() {
- opsHelper(true, false);
- }
-
- private void opsHelper(boolean sub, boolean userDefined) {
- OpenJPAEntityManager em = null;
- try {
- UnenhancedType un = newInstance(sub);
- em = emf.createEntityManager();
-
- em.getTransaction().begin();
- em.persist(un);
- un.setStringField("bar");
- assertEquals("bar", un.getStringField());
- assertPersistenceContext(em, un, true, true, sub);
- em.flush();
- assertPersistenceContext(em, un, true, true, sub);
- assertTrue(un.getId() != 0);
- UnenhancedType un2 = em.find(getUnenhancedClass(), un.getId());
- assertSame(un, un2);
- em.getTransaction().commit();
- assertPersistenceContext(em, un, false, false, sub);
- un2 = em.find(getUnenhancedClass(), un.getId());
- assertSame(un, un2);
-
- if (!userDefined) {
- em.close();
- em = emf.createEntityManager();
- }
-
- un = em.find(getUnenhancedClass(), un.getId());
- assertNotNull(un);
- if (!userDefined)
- assertTrue(un instanceof PersistenceCapable);
- assertEquals("bar", un.getStringField());
- em.getTransaction().begin();
- un.setStringField("baz");
- assertPersistenceContext(em, un, true, true, sub);
- assertEquals("baz", un.getStringField());
-
- if (sub)
- ((UnenhancedSubtype) un).setIntField(17);
-
- assertTrue(em.isDirty(un));
-
- em.getTransaction().commit();
-
- // make sure that the values are still up-to-date after
- // the commit happens
- assertEquals("baz", un.getStringField());
-
- em.close();
-
- em = emf.createEntityManager();
- un = em.find(getUnenhancedClass(), un.getId());
- assertNotNull(un);
- assertTrue(un instanceof PersistenceCapable);
- assertEquals("baz", un.getStringField());
- if (sub)
- assertEquals(17, ((UnenhancedSubtype) un).getIntField());
- em.close();
- } finally {
- if (em != null && em.getTransaction().isActive())
- em.getTransaction().rollback();
- if (em != null && em.isOpen())
- em.close();
- }
- }
-
- private void assertPersistenceContext(OpenJPAEntityManager em,
- UnenhancedType un, boolean transactional, boolean dirty, boolean sub) {
- assertEquals(transactional, em.getTransactionalObjects().contains(un));
- assertEquals(dirty, em.getDirtyObjects().contains(un));
- if (dirty) {
- Class cls = sub ? getUnenhancedSubclass() : getUnenhancedClass();
- assertTrue(em.getUpdatedClasses().contains(cls)
- || em.getPersistedClasses().contains(cls));
- }
- }
-
- public void testRelations() {
- OpenJPAEntityManager em = emf.createEntityManager();
- em.getTransaction().begin();
- UnenhancedSubtype un = newUnenhancedSubclassInstance();
- em.persist(un);
- un.setStringField("aoeu");
- UnenhancedSubtype related = newUnenhancedSubclassInstance();
- un.setRelated(related);
- related.setStringField("snth");
- em.getTransaction().commit();
- em.close();
-
- em = emf.createEntityManager();
- un = (UnenhancedSubtype) em.find(getUnenhancedClass(), un.getId());
- assertEquals("aoeu", un.getStringField());
- assertNotNull(un.getRelated());
- assertEquals("snth", un.getRelated().getStringField());
- em.close();
- }
-
- public void testEnhancer() throws IOException {
- List<Class> subs = ManagedClassSubclasser.prepareUnenhancedClasses(
- emf.getConfiguration(),
- Collections.singleton(getUnenhancedClass()), null);
- Class sub = subs.get(0);
- assertNotNull(sub);
- assertEquals("org.apache.openjpa.enhance."
- + getUnenhancedClass().getName().replace('.', '$') + "$pcsubclass",
- sub.getName());
- assertTrue(PersistenceCapable.class.isAssignableFrom(sub));
- assertTrue(getUnenhancedClass().isAssignableFrom(sub));
- }
-
- public void testPCSubclassName() {
- assertEquals("org.apache.openjpa.enhance."
- + getUnenhancedClass().getName().replace('.', '$') + "$pcsubclass",
- PCEnhancer.toPCSubclassName(getUnenhancedClass()));
- }
-
- public void testEvictionInUserCreatedInstance()
- throws NoSuchFieldException, IllegalAccessException {
- evictionHelper(true);
- }
-
- public void testEvictionInOpenJPACreatedInstance()
- throws NoSuchFieldException, IllegalAccessException {
- evictionHelper(false);
- }
-
- private void evictionHelper(boolean userDefined)
- throws NoSuchFieldException, IllegalAccessException {
- OpenJPAEntityManager em = emf.createEntityManager();
- UnenhancedType un = newUnenhancedInstance();
- em.getTransaction().begin();
- em.persist(un);
- em.getTransaction().commit();
-
- if (!userDefined) {
- em.close();
- em = emf.createEntityManager();
- un = em.find(getUnenhancedClass(), un.getId());
- assertTrue(getUnenhancedClass() != un.getClass());
- }
-
- em.evict(un);
- OpenJPAStateManager sm = (OpenJPAStateManager)
- ImplHelper.toPersistenceCapable(un, null).pcGetStateManager();
-
- // we only expect lazy loading to work when we can redefine classes
- // or when accessing a property-access record that OpenJPA created.
- if (ClassRedefiner.canRedefineClasses()
- || (!userDefined && sm.getMetaData().getAccessType()
- != ClassMetaData.ACCESS_FIELD)) {
-
- assertFalse(sm.getLoaded()
- .get(sm.getMetaData().getField("stringField").getIndex()));
-
- // make sure that the value was cleared...
- Field field = getUnenhancedClass().getDeclaredField(
- isFieldAccessTest() ? "stringField" : "sf");
- field.setAccessible(true);
- assertEquals(null, field.get(un));
-
- // ... and that it gets reloaded properly
- assertEquals("foo", un.getStringField());
- assertTrue(sm.getLoaded()
- .get(sm.getMetaData().getField("stringField").getIndex()));
- } else {
- // unredefined properties with user-defined instance, or any
- // unredefined field access
- assertTrue(sm.getLoaded()
- .get(sm.getMetaData().getField("stringField").getIndex()));
-
- // make sure that the value was not cleared
- Field field = getUnenhancedClass().getDeclaredField(
- isFieldAccessTest() ? "stringField" : "sf");
- field.setAccessible(true);
- assertEquals("foo", field.get(un));
- }
-
- em.close();
- }
-
- protected abstract boolean isFieldAccessTest();
-
- public void testLazyLoading()
- throws NoSuchFieldException, IllegalAccessException {
- OpenJPAEntityManager em = emf.createEntityManager();
- UnenhancedType un = newUnenhancedInstance();
- em.getTransaction().begin();
- em.persist(un);
- em.getTransaction().commit();
- em.close();
-
- em = emf.createEntityManager();
- un = em.find(getUnenhancedClass(), un.getId());
- assertTrue(getUnenhancedClass() != un.getClass());
- OpenJPAStateManager sm = (OpenJPAStateManager)
- ImplHelper.toPersistenceCapable(un, null).pcGetStateManager();
-
- // we only expect lazy loading to work when we can redefine classes
- // or when accessing a property-access record that OpenJPA created.
- if (ClassRedefiner.canRedefineClasses()
- || (sm.getMetaData().getAccessType() != ClassMetaData.ACCESS_FIELD))
- {
- assertFalse(sm.getLoaded()
- .get(sm.getMetaData().getField("lazyField").getIndex()));
-
- // make sure that the value was cleared
- Field field = getUnenhancedClass().getDeclaredField("lazyField");
- field.setAccessible(true);
- assertEquals(null, field.get(un));
- } else {
- // unredefined field access
- assertTrue(sm.getLoaded()
- .get(sm.getMetaData().getField("lazyField").getIndex()));
-
- // make sure that the value was loaded already
- Field field = getUnenhancedClass().getDeclaredField("lazyField");
- field.setAccessible(true);
- assertEquals("lazy", field.get(un));
- }
-
- // make sure that the value is available, one way or another
- assertEquals("lazy", un.getLazyField());
- assertTrue(sm.getLoaded()
- .get(sm.getMetaData().getField("lazyField").getIndex()));
-
- em.close();
- }
-
- public void testSerializationOfUserDefinedInstance()
- throws IOException, ClassNotFoundException {
- serializationHelper(true, false);
- }
-
- public void testSerializationOfUserDefinedSubclassInstance()
- throws IOException, ClassNotFoundException {
- serializationHelper(true, true);
- }
-
- public void testSerializationOfOpenJPADefinedInstance()
- throws IOException, ClassNotFoundException {
- serializationHelper(false, false);
- }
-
- public void testSerializationOfOpenJPADefinedSubclassInstance()
- throws IOException, ClassNotFoundException {
- serializationHelper(false, true);
- }
-
- private void serializationHelper(boolean userDefined, boolean sub)
- throws IOException, ClassNotFoundException {
- OpenJPAEntityManager em = emf.createEntityManager();
- UnenhancedType un = newInstance(sub);
- em.getTransaction().begin();
- em.persist(un);
-
- if (sub) {
- UnenhancedType related = newInstance(false);
- related.setStringField("related");
- ((UnenhancedSubtype) un).setRelated(related);
- }
-
- em.getTransaction().commit();
-
- if (!userDefined) {
- em.close();
- em = emf.createEntityManager();
- }
-
- un = em.find(getUnenhancedClass(), un.getId());
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ObjectOutputStream oout = new ObjectOutputStream(out);
- oout.writeObject(un);
- oout.flush();
- byte[] bytes = out.toByteArray();
-
- ObjectInputStream oin = new ObjectInputStream(
- new ByteArrayInputStream(bytes));
- UnenhancedType deserialized = (UnenhancedType) oin.readObject();
-
- copiedInstanceHelper(sub, em, un, deserialized, false);
- em.close();
- }
-
- public void testCloningOfUserDefinedInstance()
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- cloneHelper(true, false);
- }
-
- public void testCloningOfUserDefinedSubclassInstance()
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- cloneHelper(true, true);
- }
-
- public void testCloningOfOpenJPADefinedInstance()
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- cloneHelper(false, false);
- }
-
- public void testCloningOfOpenJPADefinedSubclassInstance()
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- cloneHelper(false, true);
- }
-
- private void cloneHelper(boolean userDefined, boolean sub)
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- OpenJPAEntityManager em = emf.createEntityManager();
- UnenhancedType un = newInstance(sub);
- em.getTransaction().begin();
- em.persist(un);
-
- if (sub) {
- UnenhancedType related = newInstance(false);
- related.setStringField("related");
- ((UnenhancedSubtype) un).setRelated(related);
- }
-
- em.getTransaction().commit();
-
- if (!userDefined) {
- em.close();
- em = emf.createEntityManager();
- }
-
- un = em.find(getUnenhancedClass(), un.getId());
- UnenhancedType cloned = (UnenhancedType) un.clone();
-
- copiedInstanceHelper(sub, em, un, cloned, true);
- em.close();
- }
-
- private void copiedInstanceHelper(boolean sub, OpenJPAEntityManager em,
- UnenhancedType un, UnenhancedType copy, boolean viaClone) {
- assertNotSame(un, copy);
- if (!viaClone)
- assertEquals(sub ? getUnenhancedSubclass() : getUnenhancedClass(),
- copy.getClass());
- assertEquals(un.getId(), copy.getId());
- assertEquals(un.getStringField(), copy.getStringField());
- if (sub) {
- assertEquals(
- ((UnenhancedSubtype) un).getIntField(),
- ((UnenhancedSubtype) copy).getIntField());
- assertNotSame(
- ((UnenhancedSubtype) un).getRelated(),
- ((UnenhancedSubtype) copy).getRelated());
- assertEquals(
- ((UnenhancedSubtype) un).getRelated().getId(),
- ((UnenhancedSubtype) copy).getRelated().getId());
- }
-
- assertFalse(em.isDetached(un));
- assertTrue(em.isDetached(copy));
- copy.setStringField("offline update");
-
- em.getTransaction().begin();
- assertSame(un, em.merge(copy));
- assertTrue(em.isDirty(un));
- assertEquals("offline update", un.getStringField());
- em.getTransaction().commit();
- }
-
- public void testListenersOnUserDefinedInstance()
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- listenerHelper(true, false);
- }
-
- public void testListenersOnUserDefinedSubclassInstance()
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- listenerHelper(true, true);
- }
-
- public void testListenersOnOpenJPADefinedInstance()
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- listenerHelper(false, false);
- }
-
- public void testListenersOnOpenJPADefinedSubclassInstance()
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- listenerHelper(false, true);
- }
-
- private void listenerHelper(boolean userDefined, boolean sub)
- throws IOException, ClassNotFoundException, CloneNotSupportedException {
- ListenerImpl listener = new ListenerImpl();
- emf.addLifecycleListener(listener, (Class[]) null);
- OpenJPAEntityManager em = emf.createEntityManager();
- UnenhancedType un = newInstance(sub);
- em.getTransaction().begin();
- em.persist(un);
- em.getTransaction().commit();
-
- if (!userDefined) {
- em.close();
- em = emf.createEntityManager();
- }
-
- listener.invoked = false;
-
- un = em.find(getUnenhancedClass(), un.getId());
- em.getTransaction().begin();
- un.setStringField("updated");
- em.getTransaction().commit();
- assertTrue(listener.invoked);
- em.close();
-
- assertEquals("updated", listener.stringField);
- }
-
- public void testGetMetaDataOfSubtype() {
- ClassMetaData meta = JPAFacadeHelper.getMetaData(emf,
- getUnenhancedClass());
- List<Class> subs = ManagedClassSubclasser.prepareUnenhancedClasses(
- emf.getConfiguration(),
- Collections.singleton(getUnenhancedClass()), null);
- assertSame(meta, JPAFacadeHelper.getMetaData(emf, subs.get(0)));
-
- meta = JPAFacadeHelper.getMetaData(emf, getUnenhancedSubclass());
- subs = ManagedClassSubclasser.prepareUnenhancedClasses(
- emf.getConfiguration(),
- Collections.singleton(getUnenhancedSubclass()), null);
- assertSame(meta, JPAFacadeHelper.getMetaData(emf, subs.get(0)));
- }
-
- private class ListenerImpl
- extends AbstractLifecycleListener {
-
- String stringField;
- boolean invoked;
-
- @Override
- public void afterStore(LifecycleEvent event) {
- invoked = true;
- stringField = ((UnenhancedType) event.getSource()).getStringField();
- }
- }
+/*
+ * 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.enhance;
+
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ByteArrayInputStream;
+import java.util.List;
+import java.util.Collections;
+import java.lang.reflect.Field;
+
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
+import org.apache.openjpa.kernel.OpenJPAStateManager;
+import org.apache.openjpa.meta.ClassMetaData;
+import org.apache.openjpa.util.ImplHelper;
+import org.apache.openjpa.event.AbstractLifecycleListener;
+import org.apache.openjpa.event.LifecycleEvent;
+
+public abstract class AbstractUnenhancedClassTest
+ extends SingleEMFTestCase {
+
+ // ##### To do:
+ // - clearing in pnew property-access without redefinition
+ // - figure out how to auto-test the redefinition code, either in Java 5
+ // or in Java 6
+ // - run CTS in the following combinations:
+ // * Java 6
+ // * Java 5 with javaagent
+ // * Java 5 without javaagent
+
+ public void setUp() {
+ setUp(getUnenhancedClass(), getUnenhancedSubclass(), CLEAR_TABLES);
+ // trigger class redefinition
+ emf.createEntityManager().close();
+ }
+
+ protected abstract Class<? extends UnenhancedType> getUnenhancedClass();
+
+ protected abstract UnenhancedType newUnenhancedInstance();
+
+ protected abstract Class<? extends UnenhancedSubtype> getUnenhancedSubclass();
+
+ protected abstract UnenhancedSubtype newUnenhancedSubclassInstance();
+
+ private UnenhancedType newInstance(boolean sub) {
+ return sub ? newUnenhancedSubclassInstance()
+ : newUnenhancedInstance();
+ }
+
+ public void testMetaData() {
+ ClassMetaData meta = JPAFacadeHelper.getMetaData(emf,
+ getUnenhancedClass());
+ assertEquals(ClassRedefiner.canRedefineClasses(),
+ meta.isIntercepting());
+ }
+
+ public void testImplHelperCalls() {
+ assertTrue(ImplHelper.isManagedType(null, getUnenhancedClass()));
+
+ UnenhancedType un = newUnenhancedInstance();
+ assertFalse(un instanceof PersistenceCapable);
+ PersistenceCapable pc = ImplHelper.toPersistenceCapable(un,
+ emf.getConfiguration());
+ assertNotNull(pc);
+ assertTrue(ImplHelper.isManageable(un));
+ }
+
+ public void testBasicPersistenceCapableBehavior() {
+ UnenhancedType un = newUnenhancedInstance();
+ un.setStringField("bar");
+ PersistenceCapable pc = ImplHelper.toPersistenceCapable(un,
+ emf.getConfiguration());
+ assertFalse(pc.pcIsDeleted());
+ assertFalse(pc.pcIsDirty());
+ assertFalse(pc.pcIsNew());
+ assertFalse(pc.pcIsPersistent());
+ assertFalse(pc.pcIsTransactional());
+ }
+
+ public void testPCRegistry() {
+ assertTrue(PCRegistry.isRegistered(getUnenhancedClass()));
+ PersistenceCapable pc = PCRegistry.newInstance(
+ getUnenhancedClass(), null, false);
+ assertNotNull(pc);
+ }
+
+ public void testClearingOnSubtypeInstance() {
+ // the boolean at the end of newInstance will cause clear to be invoked
+ UnenhancedType un = (UnenhancedType)
+ PCRegistry.newInstance(getUnenhancedClass(), null, true);
+ assertEquals(null, un.getStringField());
+ }
+
+ public void testGetObjectIdOnOpenJPAType() {
+ getObjectIdHelper(true, false);
+ }
+
+ public void testGetObjectIdOnOpenJPATypeSubclass() {
+ getObjectIdHelper(false, false);
+ }
+
+ public void testGetObjectIdOnUserDefined() {
+ getObjectIdHelper(true, true);
+ }
+
+ public void testGetObjectIdOnUserDefinedSubclass() {
+ getObjectIdHelper(false, true);
+ }
+
+ private void getObjectIdHelper(boolean sub, boolean userDefined) {
+ OpenJPAEntityManager em = emf.createEntityManager();
+ em.getTransaction().begin();
+ UnenhancedType un = newInstance(sub);
+ em.persist(un);
+ em.getTransaction().commit();
+
+ if (!userDefined) {
+ em.close();
+ em = emf.createEntityManager();
+ un = em.find(getUnenhancedClass(), un.getId());
+ }
+
+ assertNotNull(em.getObjectId(un));
+ }
+
+ public void testOperationsOnUserDefined() {
+ opsHelper(false, true);
+ }
+
+ public void testSubclassOperationsOnUserDefined() {
+ opsHelper(true, true);
+ }
+
+ public void testOperationsOnOpenJPADefined() {
+ opsHelper(false, false);
+ }
+
+ public void testSubclassOperationsOnOpenJPADefined() {
+ opsHelper(true, false);
+ }
+
+ private void opsHelper(boolean sub, boolean userDefined) {
+ OpenJPAEntityManager em = null;
+ try {
+ UnenhancedType un = newInstance(sub);
+ em = emf.createEntityManager();
+
+ em.getTransaction().begin();
+ em.persist(un);
+ un.setStringField("bar");
+ assertEquals("bar", un.getStringField());
+ assertPersistenceContext(em, un, true, true, sub);
+ em.flush();
+ assertPersistenceContext(em, un, true, true, sub);
+ assertTrue(un.getId() != 0);
+ UnenhancedType un2 = em.find(getUnenhancedClass(), un.getId());
+ assertSame(un, un2);
+ em.getTransaction().commit();
+ assertPersistenceContext(em, un, false, false, sub);
+ un2 = em.find(getUnenhancedClass(), un.getId());
+ assertSame(un, un2);
+
+ if (!userDefined) {
+ em.close();
+ em = emf.createEntityManager();
+ }
+
+ un = em.find(getUnenhancedClass(), un.getId());
+ assertNotNull(un);
+ if (!userDefined)
+ assertTrue(un instanceof PersistenceCapable);
+ assertEquals("bar", un.getStringField());
+ em.getTransaction().begin();
+ un.setStringField("baz");
+ assertPersistenceContext(em, un, true, true, sub);
+ assertEquals("baz", un.getStringField());
+
+ if (sub)
+ ((UnenhancedSubtype) un).setIntField(17);
+
+ assertTrue(em.isDirty(un));
+
+ em.getTransaction().commit();
+
+ // make sure that the values are still up-to-date after
+ // the commit happens
+ assertEquals("baz", un.getStringField());
+
+ em.close();
+
+ em = emf.createEntityManager();
+ un = em.find(getUnenhancedClass(), un.getId());
+ assertNotNull(un);
+ assertTrue(un instanceof PersistenceCapable);
+ assertEquals("baz", un.getStringField());
+ if (sub)
+ assertEquals(17, ((UnenhancedSubtype) un).getIntField());
+ em.close();
+ } finally {
+ if (em != null && em.getTransaction().isActive())
+ em.getTransaction().rollback();
+ if (em != null && em.isOpen())
+ em.close();
+ }
+ }
+
+ private void assertPersistenceContext(OpenJPAEntityManager em,
+ UnenhancedType un, boolean transactional, boolean dirty, boolean sub) {
+ assertEquals(transactional, em.getTransactionalObjects().contains(un));
+ assertEquals(dirty, em.getDirtyObjects().contains(un));
+ if (dirty) {
+ Class cls = sub ? getUnenhancedSubclass() : getUnenhancedClass();
+ assertTrue(em.getUpdatedClasses().contains(cls)
+ || em.getPersistedClasses().contains(cls));
+ }
+ }
+
+ public void testRelations() {
+ OpenJPAEntityManager em = emf.createEntityManager();
+ em.getTransaction().begin();
+ UnenhancedSubtype un = newUnenhancedSubclassInstance();
+ em.persist(un);
+ un.setStringField("aoeu");
+ UnenhancedSubtype related = newUnenhancedSubclassInstance();
+ un.setRelated(related);
+ related.setStringField("snth");
+ em.getTransaction().commit();
+ em.close();
+
+ em = emf.createEntityManager();
+ un = (UnenhancedSubtype) em.find(getUnenhancedClass(), un.getId());
+ assertEquals("aoeu", un.getStringField());
+ assertNotNull(un.getRelated());
+ assertEquals("snth", un.getRelated().getStringField());
+ em.close();
+ }
+
+ public void testEnhancer() throws IOException {
+ List<Class> subs = ManagedClassSubclasser.prepareUnenhancedClasses(
+ emf.getConfiguration(),
+ Collections.singleton(getUnenhancedClass()), null);
+ Class sub = subs.get(0);
+ assertNotNull(sub);
+ assertEquals("org.apache.openjpa.enhance."
+ + getUnenhancedClass().getName().replace('.', '$') + "$pcsubclass",
+ sub.getName());
+ assertTrue(PersistenceCapable.class.isAssignableFrom(sub));
+ assertTrue(getUnenhancedClass().isAssignableFrom(sub));
+ }
+
+ public void testPCSubclassName() {
+ assertEquals("org.apache.openjpa.enhance."
+ + getUnenhancedClass().getName().replace('.', '$') + "$pcsubclass",
+ PCEnhancer.toPCSubclassName(getUnenhancedClass()));
+ }
+
+ public void testEvictionInUserCreatedInstance()
+ throws NoSuchFieldException, IllegalAccessException {
+ evictionHelper(true);
+ }
+
+ public void testEvictionInOpenJPACreatedInstance()
+ throws NoSuchFieldException, IllegalAccessException {
+ evictionHelper(false);
+ }
+
+ private void evictionHelper(boolean userDefined)
+ throws NoSuchFieldException, IllegalAccessException {
+ OpenJPAEntityManager em = emf.createEntityManager();
+ UnenhancedType un = newUnenhancedInstance();
+ em.getTransaction().begin();
+ em.persist(un);
+ em.getTransaction().commit();
+
+ if (!userDefined) {
+ em.close();
+ em = emf.createEntityManager();
+ un = em.find(getUnenhancedClass(), un.getId());
+ assertTrue(getUnenhancedClass() != un.getClass());
+ }
+
+ em.evict(un);
+ OpenJPAStateManager sm = (OpenJPAStateManager)
+ ImplHelper.toPersistenceCapable(un, null).pcGetStateManager();
+
+ // we only expect lazy loading to work when we can redefine classes
+ // or when accessing a property-access record that OpenJPA created.
+ if (ClassRedefiner.canRedefineClasses()
+ || (!userDefined && sm.getMetaData().getAccessType()
+ != ClassMetaData.ACCESS_FIELD)) {
+
+ assertFalse(sm.getLoaded()
+ .get(sm.getMetaData().getField("stringField").getIndex()));
+
+ // make sure that the value was cleared...
+ Field field = getUnenhancedClass().getDeclaredField(
+ isFieldAccessTest() ? "stringField" : "sf");
+ field.setAccessible(true);
+ assertEquals(null, field.get(un));
+
+ // ... and that it gets reloaded properly
+ assertEquals("foo", un.getStringField());
+ assertTrue(sm.getLoaded()
+ .get(sm.getMetaData().getField("stringField").getIndex()));
+ } else {
+ // unredefined properties with user-defined instance, or any
+ // unredefined field access
+ assertTrue(sm.getLoaded()
+ .get(sm.getMetaData().getField("stringField").getIndex()));
+
+ // make sure that the value was not cleared
+ Field field = getUnenhancedClass().getDeclaredField(
+ isFieldAccessTest() ? "stringField" : "sf");
+ field.setAccessible(true);
+ assertEquals("foo", field.get(un));
+ }
+
+ em.close();
+ }
+
+ protected abstract boolean isFieldAccessTest();
+
+ public void testLazyLoading()
+ throws NoSuchFieldException, IllegalAccessException {
+ OpenJPAEntityManager em = emf.createEntityManager();
+ UnenhancedType un = newUnenhancedInstance();
+ em.getTransaction().begin();
+ em.persist(un);
+ em.getTransaction().commit();
+ em.close();
+
+ em = emf.createEntityManager();
+ un = em.find(getUnenhancedClass(), un.getId());
+ assertTrue(getUnenhancedClass() != un.getClass());
+ OpenJPAStateManager sm = (OpenJPAStateManager)
+ ImplHelper.toPersistenceCapable(un, null).pcGetStateManager();
+
+ // we only expect lazy loading to work when we can redefine classes
+ // or when accessing a property-access record that OpenJPA created.
+ if (ClassRedefiner.canRedefineClasses()
+ || (sm.getMetaData().getAccessType() != ClassMetaData.ACCESS_FIELD))
+ {
+ assertFalse(sm.getLoaded()
+ .get(sm.getMetaData().getField("lazyField").getIndex()));
+
+ // make sure that the value was cleared
+ Field field = getUnenhancedClass().getDeclaredField("lazyField");
+ field.setAccessible(true);
+ assertEquals(null, field.get(un));
+ } else {
+ // unredefined field access
+ assertTrue(sm.getLoaded()
+ .get(sm.getMetaData().getField("lazyField").getIndex()));
+
+ // make sure that the value was loaded already
+ Field field = getUnenhancedClass().getDeclaredField("lazyField");
+ field.setAccessible(true);
+ assertEquals("lazy", field.get(un));
+ }
+
+ // make sure that the value is available, one way or another
+ assertEquals("lazy", un.getLazyField());
+ assertTrue(sm.getLoaded()
+ .get(sm.getMetaData().getField("lazyField").getIndex()));
+
+ em.close();
+ }
+
+ public void testSerializationOfUserDefinedInstance()
+ throws IOException, ClassNotFoundException {
+ serializationHelper(true, false);
+ }
+
+ public void testSerializationOfUserDefinedSubclassInstance()
+ throws IOException, ClassNotFoundException {
+ serializationHelper(true, true);
+ }
+
+ public void testSerializationOfOpenJPADefinedInstance()
+ throws IOException, ClassNotFoundException {
+ serializationHelper(false, false);
+ }
+
+ public void testSerializationOfOpenJPADefinedSubclassInstance()
+ throws IOException, ClassNotFoundException {
+ serializationHelper(false, true);
+ }
+
+ private void serializationHelper(boolean userDefined, boolean sub)
+ throws IOException, ClassNotFoundException {
+ OpenJPAEntityManager em = emf.createEntityManager();
+ UnenhancedType un = newInstance(sub);
+ em.getTransaction().begin();
+ em.persist(un);
+
+ if (sub) {
+ UnenhancedType related = newInstance(false);
+ related.setStringField("related");
+ ((UnenhancedSubtype) un).setRelated(related);
+ }
+
+ em.getTransaction().commit();
+
+ if (!userDefined) {
+ em.close();
+ em = emf.createEntityManager();
+ }
+
+ un = em.find(getUnenhancedClass(), un.getId());
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream oout = new ObjectOutputStream(out);
+ oout.writeObject(un);
+ oout.flush();
+ byte[] bytes = out.toByteArray();
+
+ ObjectInputStream oin = new ObjectInputStream(
+ new ByteArrayInputStream(bytes));
+ UnenhancedType deserialized = (UnenhancedType) oin.readObject();
+
+ copiedInstanceHelper(sub, em, un, deserialized, false);
+ em.close();
+ }
+
+ public void testCloningOfUserDefinedInstance()
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ cloneHelper(true, false);
+ }
+
+ public void testCloningOfUserDefinedSubclassInstance()
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ cloneHelper(true, true);
+ }
+
+ public void testCloningOfOpenJPADefinedInstance()
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ cloneHelper(false, false);
+ }
+
+ public void testCloningOfOpenJPADefinedSubclassInstance()
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ cloneHelper(false, true);
+ }
+
+ private void cloneHelper(boolean userDefined, boolean sub)
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ OpenJPAEntityManager em = emf.createEntityManager();
+ UnenhancedType un = newInstance(sub);
+ em.getTransaction().begin();
+ em.persist(un);
+
+ if (sub) {
+ UnenhancedType related = newInstance(false);
+ related.setStringField("related");
+ ((UnenhancedSubtype) un).setRelated(related);
+ }
+
+ em.getTransaction().commit();
+
+ if (!userDefined) {
+ em.close();
+ em = emf.createEntityManager();
+ }
+
+ un = em.find(getUnenhancedClass(), un.getId());
+ UnenhancedType cloned = (UnenhancedType) un.clone();
+
+ copiedInstanceHelper(sub, em, un, cloned, true);
+ em.close();
+ }
+
+ private void copiedInstanceHelper(boolean sub, OpenJPAEntityManager em,
+ UnenhancedType un, UnenhancedType copy, boolean viaClone) {
+ assertNotSame(un, copy);
+ if (!viaClone)
+ assertEquals(sub ? getUnenhancedSubclass() : getUnenhancedClass(),
+ copy.getClass());
+ assertEquals(un.getId(), copy.getId());
+ assertEquals(un.getStringField(), copy.getStringField());
+ if (sub) {
+ assertEquals(
+ ((UnenhancedSubtype) un).getIntField(),
+ ((UnenhancedSubtype) copy).getIntField());
+ assertNotSame(
+ ((UnenhancedSubtype) un).getRelated(),
+ ((UnenhancedSubtype) copy).getRelated());
+ assertEquals(
+ ((UnenhancedSubtype) un).getRelated().getId(),
+ ((UnenhancedSubtype) copy).getRelated().getId());
+ }
+
+ assertFalse(em.isDetached(un));
+ assertTrue(em.isDetached(copy));
+ copy.setStringField("offline update");
+
+ em.getTransaction().begin();
+ assertSame(un, em.merge(copy));
+ assertTrue(em.isDirty(un));
+ assertEquals("offline update", un.getStringField());
+ em.getTransaction().commit();
+ }
+
+ public void testListenersOnUserDefinedInstance()
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ listenerHelper(true, false);
+ }
+
+ public void testListenersOnUserDefinedSubclassInstance()
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ listenerHelper(true, true);
+ }
+
+ public void testListenersOnOpenJPADefinedInstance()
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ listenerHelper(false, false);
+ }
+
+ public void testListenersOnOpenJPADefinedSubclassInstance()
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ listenerHelper(false, true);
+ }
+
+ private void listenerHelper(boolean userDefined, boolean sub)
+ throws IOException, ClassNotFoundException, CloneNotSupportedException {
+ ListenerImpl listener = new ListenerImpl();
+ emf.addLifecycleListener(listener, (Class[]) null);
+ OpenJPAEntityManager em = emf.createEntityManager();
+ UnenhancedType un = newInstance(sub);
+ em.getTransaction().begin();
+ em.persist(un);
+ em.getTransaction().commit();
+
+ if (!userDefined) {
+ em.close();
+ em = emf.createEntityManager();
+ }
+
+ listener.invoked = false;
+
+ un = em.find(getUnenhancedClass(), un.getId());
+ em.getTransaction().begin();
+ un.setStringField("updated");
+ em.getTransaction().commit();
+ assertTrue(listener.invoked);
+ em.close();
+
+ assertEquals("updated", listener.stringField);
+ }
+
+ public void testGetMetaDataOfSubtype() {
+ ClassMetaData meta = JPAFacadeHelper.getMetaData(emf,
+ getUnenhancedClass());
+ List<Class> subs = ManagedClassSubclasser.prepareUnenhancedClasses(
+ emf.getConfiguration(),
+ Collections.singleton(getUnenhancedClass()), null);
+ assertSame(meta, JPAFacadeHelper.getMetaData(emf, subs.get(0)));
+
+ meta = JPAFacadeHelper.getMetaData(emf, getUnenhancedSubclass());
+ subs = ManagedClassSubclasser.prepareUnenhancedClasses(
+ emf.getConfiguration(),
+ Collections.singleton(getUnenhancedSubclass()), null);
+ assertSame(meta, JPAFacadeHelper.getMetaData(emf, subs.get(0)));
+ }
+
+ private class ListenerImpl
+ extends AbstractLifecycleListener {
+
+ String stringField;
+ boolean invoked;
+
+ @Override
+ public void afterStore(LifecycleEvent event) {
+ invoked = true;
+ stringField = ((UnenhancedType) event.getSource()).getStringField();
+ }
+ }
}
\ No newline at end of file
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/AbstractUnenhancedClassTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestDataCachingAndUnenhancedPropertyAccess.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestDataCachingAndUnenhancedPropertyAccess.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestDataCachingAndUnenhancedPropertyAccess.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestDataCachingAndUnenhancedPropertyAccess.java Sun Mar 22 23:45:15 2009
@@ -1,55 +1,55 @@
-/*
- * 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.enhance;
-
-import java.util.List;
-import javax.persistence.EntityManager;
-
-import org.apache.openjpa.persistence.OpenJPAEntityManager;
-import org.apache.openjpa.persistence.test.SingleEMFTestCase;
-
-public class TestDataCachingAndUnenhancedPropertyAccess
- extends SingleEMFTestCase {
-
- @Override
- public void setUp() {
- setUp(UnenhancedIdentityIdPropertyAccess.class, CLEAR_TABLES,
- "openjpa.DataCache", "true",
- "openjpa.RemoteCommitProvider", "sjvm");
- }
-
- public void testSimpleDataCacheOperation() {
- EntityManager em = emf.createEntityManager();
- em.getTransaction().begin();
- em.persist(new UnenhancedIdentityIdPropertyAccess());
- em.getTransaction().commit();
- em.close();
- }
-
- public void testAccessIdBeforeCommit() {
- OpenJPAEntityManager em = emf.createEntityManager();
- em.getTransaction().begin();
- UnenhancedIdentityIdPropertyAccess o =
- new UnenhancedIdentityIdPropertyAccess();
- em.persist(o);
- em.getObjectId(o);
- em.getTransaction().commit();
- em.close();
- }
+/*
+ * 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.enhance;
+
+import java.util.List;
+import javax.persistence.EntityManager;
+
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+public class TestDataCachingAndUnenhancedPropertyAccess
+ extends SingleEMFTestCase {
+
+ @Override
+ public void setUp() {
+ setUp(UnenhancedIdentityIdPropertyAccess.class, CLEAR_TABLES,
+ "openjpa.DataCache", "true",
+ "openjpa.RemoteCommitProvider", "sjvm");
+ }
+
+ public void testSimpleDataCacheOperation() {
+ EntityManager em = emf.createEntityManager();
+ em.getTransaction().begin();
+ em.persist(new UnenhancedIdentityIdPropertyAccess());
+ em.getTransaction().commit();
+ em.close();
+ }
+
+ public void testAccessIdBeforeCommit() {
+ OpenJPAEntityManager em = emf.createEntityManager();
+ em.getTransaction().begin();
+ UnenhancedIdentityIdPropertyAccess o =
+ new UnenhancedIdentityIdPropertyAccess();
+ em.persist(o);
+ em.getObjectId(o);
+ em.getTransaction().commit();
+ em.close();
+ }
}
\ No newline at end of file
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestDataCachingAndUnenhancedPropertyAccess.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementConfiguration.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementConfiguration.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementConfiguration.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementConfiguration.java Sun Mar 22 23:45:15 2009
@@ -1,45 +1,45 @@
-/*
- * 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.enhance;
-
-import javax.persistence.EntityManager;
-
-import org.apache.openjpa.persistence.test.SingleEMFTestCase;
-import org.apache.openjpa.util.ImplHelper;
-
-public class TestEnhancementConfiguration
- extends SingleEMFTestCase {
-
- public void testEnhancementConfiguration() {
- try {
- emf = createEMF(
- "openjpa.RuntimeUnenhancedClasses", "unsupported",
- UnenhancedFieldAccess.class, CLEAR_TABLES);
- assertFalse(ImplHelper.isManagedType(emf.getConfiguration(),
- UnenhancedFieldAccess.class));
- emf.createEntityManager().close();
- fail("should not be possible to fully-initialize a system " +
- "that depends on unenhanced types but disables runtime" +
- "redefinition.");
- } catch (Exception e) {
- assertTrue(e.getMessage().contains(
- "This configuration disallows runtime optimization"));
- }
- }
+/*
+ * 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.enhance;
+
+import javax.persistence.EntityManager;
+
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+import org.apache.openjpa.util.ImplHelper;
+
+public class TestEnhancementConfiguration
+ extends SingleEMFTestCase {
+
+ public void testEnhancementConfiguration() {
+ try {
+ emf = createEMF(
+ "openjpa.RuntimeUnenhancedClasses", "unsupported",
+ UnenhancedFieldAccess.class, CLEAR_TABLES);
+ assertFalse(ImplHelper.isManagedType(emf.getConfiguration(),
+ UnenhancedFieldAccess.class));
+ emf.createEntityManager().close();
+ fail("should not be possible to fully-initialize a system " +
+ "that depends on unenhanced types but disables runtime" +
+ "redefinition.");
+ } catch (Exception e) {
+ assertTrue(e.getMessage().contains(
+ "This configuration disallows runtime optimization"));
+ }
+ }
}
\ No newline at end of file
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestEnhancementConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestPCEnhancerFindField.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestPCEnhancerFindField.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestPCEnhancerFindField.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestPCEnhancerFindField.java Sun Mar 22 23:45:15 2009
@@ -1,46 +1,46 @@
-/*
- * 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.enhance;
-
-import junit.framework.TestCase;
-import serp.bytecode.BCClass;
-import serp.bytecode.BCField;
-import serp.bytecode.BCMethod;
-import serp.bytecode.Project;
-
-public class TestPCEnhancerFindField
- extends TestCase {
-
- private String field;
-
- public String myMethod() {
- if (Math.abs(1) == 1)
- return field;
- else
- return field;
- }
-
- public void testPCEnhancerFindField() {
- Project proj = new Project();
- BCClass bc = proj.loadClass(getClass());
- BCMethod meth = bc.getMethods("myMethod")[0];
- BCField field = PCEnhancer.getReturnedField(meth);
- assertEquals("field", field.getName());
- }
-}
+/*
+ * 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.enhance;
+
+import junit.framework.TestCase;
+import serp.bytecode.BCClass;
+import serp.bytecode.BCField;
+import serp.bytecode.BCMethod;
+import serp.bytecode.Project;
+
+public class TestPCEnhancerFindField
+ extends TestCase {
+
+ private String field;
+
+ public String myMethod() {
+ if (Math.abs(1) == 1)
+ return field;
+ else
+ return field;
+ }
+
+ public void testPCEnhancerFindField() {
+ Project proj = new Project();
+ BCClass bc = proj.loadClass(getClass());
+ BCMethod meth = bc.getMethods("myMethod")[0];
+ BCField field = PCEnhancer.getReturnedField(meth);
+ assertEquals("field", field.getName());
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestPCEnhancerFindField.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestRelationToUnlistedClass.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestRelationToUnlistedClass.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestRelationToUnlistedClass.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestRelationToUnlistedClass.java Sun Mar 22 23:45:15 2009
@@ -1,38 +1,38 @@
-/*
- * 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.enhance;
-
-import org.apache.openjpa.persistence.test.SingleEMFTestCase;
-
-public class TestRelationToUnlistedClass
- extends SingleEMFTestCase {
-
- public void setUp() {
- setUp(UnenhancedUnlistedReferer.class, CLEAR_TABLES);
- }
-
- public void testRelationToUnlistedClass() {
- try {
- emf.createEntityManager().close();
- fail("should not be able to initialize system");
- } catch (Exception e) {
- assertTrue(e.getMessage().startsWith("One or more of the types"));
- }
- }
+/*
+ * 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.enhance;
+
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+public class TestRelationToUnlistedClass
+ extends SingleEMFTestCase {
+
+ public void setUp() {
+ setUp(UnenhancedUnlistedReferer.class, CLEAR_TABLES);
+ }
+
+ public void testRelationToUnlistedClass() {
+ try {
+ emf.createEntityManager().close();
+ fail("should not be able to initialize system");
+ } catch (Exception e) {
+ assertTrue(e.getMessage().startsWith("One or more of the types"));
+ }
+ }
}
\ No newline at end of file
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestRelationToUnlistedClass.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPK.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPK.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPK.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPK.java Sun Mar 22 23:45:15 2009
@@ -1,75 +1,75 @@
-/*
- * 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.enhance;
-
-import org.apache.openjpa.persistence.test.SingleEMTestCase;
-
-public class TestUnenhancedCompoundPK
- extends SingleEMTestCase {
-
- public void setUp() {
- setUp(UnenhancedCompoundPKFieldAccess.class,
- UnenhancedCompoundPKPropertyAccess.class, CLEAR_TABLES);
- }
-
- public void testCompoundPKFieldAccessUserDefined() {
- UnenhancedCompoundPKFieldAccess un
- = new UnenhancedCompoundPKFieldAccess(17, 31);
- UnenhancedCompoundPKFieldAccess.PK oid
- = new UnenhancedCompoundPKFieldAccess.PK(17, 31);
- compoundPKHelper(un, oid, true);
- }
-
- public void testCompoundPKFieldAccessOpenJPADefined() {
- UnenhancedCompoundPKFieldAccess un
- = new UnenhancedCompoundPKFieldAccess(17, 31);
- UnenhancedCompoundPKFieldAccess.PK oid
- = new UnenhancedCompoundPKFieldAccess.PK(17, 31);
- compoundPKHelper(un, oid, false);
- }
-
- public void testCompoundPKPropertyAccessUserDefined() {
- UnenhancedCompoundPKPropertyAccess un
- = new UnenhancedCompoundPKPropertyAccess(17, 31);
- UnenhancedCompoundPKPropertyAccess.PK oid
- = new UnenhancedCompoundPKPropertyAccess.PK(17, 31);
- compoundPKHelper(un, oid, true);
- }
-
- public void testCompoundPKPropertyAccessOpenJPADefined() {
- UnenhancedCompoundPKPropertyAccess un
- = new UnenhancedCompoundPKPropertyAccess(17, 31);
- UnenhancedCompoundPKPropertyAccess.PK oid
- = new UnenhancedCompoundPKPropertyAccess.PK(17, 31);
- compoundPKHelper(un, oid, false);
- }
-
- private void compoundPKHelper(Object o, Object oid, boolean userDefined) {
- em.getTransaction().begin();
- em.persist(o);
- em.getTransaction().commit();
-
- if (!userDefined) {
- em.close();
- em = emf.createEntityManager();
- }
-
- em.find(o.getClass(), oid);
- }
+/*
+ * 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.enhance;
+
+import org.apache.openjpa.persistence.test.SingleEMTestCase;
+
+public class TestUnenhancedCompoundPK
+ extends SingleEMTestCase {
+
+ public void setUp() {
+ setUp(UnenhancedCompoundPKFieldAccess.class,
+ UnenhancedCompoundPKPropertyAccess.class, CLEAR_TABLES);
+ }
+
+ public void testCompoundPKFieldAccessUserDefined() {
+ UnenhancedCompoundPKFieldAccess un
+ = new UnenhancedCompoundPKFieldAccess(17, 31);
+ UnenhancedCompoundPKFieldAccess.PK oid
+ = new UnenhancedCompoundPKFieldAccess.PK(17, 31);
+ compoundPKHelper(un, oid, true);
+ }
+
+ public void testCompoundPKFieldAccessOpenJPADefined() {
+ UnenhancedCompoundPKFieldAccess un
+ = new UnenhancedCompoundPKFieldAccess(17, 31);
+ UnenhancedCompoundPKFieldAccess.PK oid
+ = new UnenhancedCompoundPKFieldAccess.PK(17, 31);
+ compoundPKHelper(un, oid, false);
+ }
+
+ public void testCompoundPKPropertyAccessUserDefined() {
+ UnenhancedCompoundPKPropertyAccess un
+ = new UnenhancedCompoundPKPropertyAccess(17, 31);
+ UnenhancedCompoundPKPropertyAccess.PK oid
+ = new UnenhancedCompoundPKPropertyAccess.PK(17, 31);
+ compoundPKHelper(un, oid, true);
+ }
+
+ public void testCompoundPKPropertyAccessOpenJPADefined() {
+ UnenhancedCompoundPKPropertyAccess un
+ = new UnenhancedCompoundPKPropertyAccess(17, 31);
+ UnenhancedCompoundPKPropertyAccess.PK oid
+ = new UnenhancedCompoundPKPropertyAccess.PK(17, 31);
+ compoundPKHelper(un, oid, false);
+ }
+
+ private void compoundPKHelper(Object o, Object oid, boolean userDefined) {
+ em.getTransaction().begin();
+ em.persist(o);
+ em.getTransaction().commit();
+
+ if (!userDefined) {
+ em.close();
+ em = emf.createEntityManager();
+ }
+
+ em.find(o.getClass(), oid);
+ }
}
\ No newline at end of file
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPK.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPKSubclass.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPKSubclass.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPKSubclass.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPKSubclass.java Sun Mar 22 23:45:15 2009
@@ -1,57 +1,57 @@
-/**
- *
- * 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.enhance;
-
-import org.apache.openjpa.persistence.test.SingleEMTestCase;
-
-public class TestUnenhancedCompoundPKSubclass extends SingleEMTestCase {
-
- public void setUp() {
- setUp(UnenhancedCompoundPKFieldAccessSuperclass.class,
- UnenhancedCompoundPKFieldAccessSubclass.class, CLEAR_TABLES);
- }
-
- public void testCompoundPKFieldAccessUserDefined() {
- UnenhancedCompoundPKFieldAccessSuperclass un =
- new UnenhancedCompoundPKFieldAccessSubclass(17, 31);
- UnenhancedCompoundPKFieldAccessSuperclass.PK oid =
- new UnenhancedCompoundPKFieldAccessSuperclass.PK(17, 31);
- compoundPKHelper(un, oid, true);
- }
-
- public void testCompoundPKFieldAccessOpenJPADefined() {
- UnenhancedCompoundPKFieldAccessSuperclass un =
- new UnenhancedCompoundPKFieldAccessSubclass(17, 31);
- UnenhancedCompoundPKFieldAccessSuperclass.PK oid =
- new UnenhancedCompoundPKFieldAccessSuperclass.PK(17, 31);
- compoundPKHelper(un, oid, false);
- }
-
- private void compoundPKHelper(Object o, Object oid, boolean userDefined) {
- em.getTransaction().begin();
- em.persist(o);
- em.getTransaction().commit();
-
- if (!userDefined) {
- em.close();
- em = emf.createEntityManager();
- }
-
- em.find(o.getClass(), oid);
- }
-}
+/**
+ *
+ * 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.enhance;
+
+import org.apache.openjpa.persistence.test.SingleEMTestCase;
+
+public class TestUnenhancedCompoundPKSubclass extends SingleEMTestCase {
+
+ public void setUp() {
+ setUp(UnenhancedCompoundPKFieldAccessSuperclass.class,
+ UnenhancedCompoundPKFieldAccessSubclass.class, CLEAR_TABLES);
+ }
+
+ public void testCompoundPKFieldAccessUserDefined() {
+ UnenhancedCompoundPKFieldAccessSuperclass un =
+ new UnenhancedCompoundPKFieldAccessSubclass(17, 31);
+ UnenhancedCompoundPKFieldAccessSuperclass.PK oid =
+ new UnenhancedCompoundPKFieldAccessSuperclass.PK(17, 31);
+ compoundPKHelper(un, oid, true);
+ }
+
+ public void testCompoundPKFieldAccessOpenJPADefined() {
+ UnenhancedCompoundPKFieldAccessSuperclass un =
+ new UnenhancedCompoundPKFieldAccessSubclass(17, 31);
+ UnenhancedCompoundPKFieldAccessSuperclass.PK oid =
+ new UnenhancedCompoundPKFieldAccessSuperclass.PK(17, 31);
+ compoundPKHelper(un, oid, false);
+ }
+
+ private void compoundPKHelper(Object o, Object oid, boolean userDefined) {
+ em.getTransaction().begin();
+ em.persist(o);
+ em.getTransaction().commit();
+
+ if (!userDefined) {
+ em.close();
+ em = emf.createEntityManager();
+ }
+
+ em.find(o.getClass(), oid);
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedCompoundPKSubclass.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccess.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccess.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccess.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccess.java Sun Mar 22 23:45:15 2009
@@ -1,43 +1,43 @@
-/*
- * 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.enhance;
-
-public class TestUnenhancedFieldAccess
- extends AbstractUnenhancedClassTest {
-
- protected Class<? extends UnenhancedType> getUnenhancedClass() {
- return UnenhancedFieldAccess.class;
- }
-
- protected UnenhancedType newUnenhancedInstance() {
- return new UnenhancedFieldAccess();
- }
-
- protected Class<? extends UnenhancedSubtype> getUnenhancedSubclass() {
- return UnenhancedFieldAccessSubclass.class;
- }
-
- protected UnenhancedSubtype newUnenhancedSubclassInstance() {
- return new UnenhancedFieldAccessSubclass();
- }
-
- protected boolean isFieldAccessTest() {
- return true;
- }
-}
+/*
+ * 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.enhance;
+
+public class TestUnenhancedFieldAccess
+ extends AbstractUnenhancedClassTest {
+
+ protected Class<? extends UnenhancedType> getUnenhancedClass() {
+ return UnenhancedFieldAccess.class;
+ }
+
+ protected UnenhancedType newUnenhancedInstance() {
+ return new UnenhancedFieldAccess();
+ }
+
+ protected Class<? extends UnenhancedSubtype> getUnenhancedSubclass() {
+ return UnenhancedFieldAccessSubclass.class;
+ }
+
+ protected UnenhancedSubtype newUnenhancedSubclassInstance() {
+ return new UnenhancedFieldAccessSubclass();
+ }
+
+ protected boolean isFieldAccessTest() {
+ return true;
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccess.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccessPrimitiveWrapper.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccessPrimitiveWrapper.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccessPrimitiveWrapper.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccessPrimitiveWrapper.java Sun Mar 22 23:45:15 2009
@@ -1,42 +1,42 @@
-/**
- *
- * 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.enhance;
-
-public class TestUnenhancedFieldAccessPrimitiveWrapper
- extends AbstractUnenhancedClassTest {
-
- protected Class<? extends UnenhancedType> getUnenhancedClass() {
- return UnenhancedFieldAccessPrimitiveWrapper.class;
- }
-
- protected UnenhancedType newUnenhancedInstance() {
- return new UnenhancedFieldAccessPrimitiveWrapper();
- }
-
- protected Class<? extends UnenhancedSubtype> getUnenhancedSubclass() {
- return UnenhancedFieldAccessPrimitiveWrapperSubclass.class;
- }
-
- protected UnenhancedSubtype newUnenhancedSubclassInstance() {
- return new UnenhancedFieldAccessPrimitiveWrapperSubclass();
- }
-
- protected boolean isFieldAccessTest() {
- return true;
- }
-}
+/**
+ *
+ * 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.enhance;
+
+public class TestUnenhancedFieldAccessPrimitiveWrapper
+ extends AbstractUnenhancedClassTest {
+
+ protected Class<? extends UnenhancedType> getUnenhancedClass() {
+ return UnenhancedFieldAccessPrimitiveWrapper.class;
+ }
+
+ protected UnenhancedType newUnenhancedInstance() {
+ return new UnenhancedFieldAccessPrimitiveWrapper();
+ }
+
+ protected Class<? extends UnenhancedSubtype> getUnenhancedSubclass() {
+ return UnenhancedFieldAccessPrimitiveWrapperSubclass.class;
+ }
+
+ protected UnenhancedSubtype newUnenhancedSubclassInstance() {
+ return new UnenhancedFieldAccessPrimitiveWrapperSubclass();
+ }
+
+ protected boolean isFieldAccessTest() {
+ return true;
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedFieldAccessPrimitiveWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedPropertyAccess.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedPropertyAccess.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedPropertyAccess.java (original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedPropertyAccess.java Sun Mar 22 23:45:15 2009
@@ -1,43 +1,43 @@
-/*
- * 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.enhance;
-
-public class TestUnenhancedPropertyAccess
- extends AbstractUnenhancedClassTest {
-
- protected Class<? extends UnenhancedType> getUnenhancedClass() {
- return UnenhancedPropertyAccess.class;
- }
-
- protected UnenhancedType newUnenhancedInstance() {
- return new UnenhancedPropertyAccess();
- }
-
- protected Class<? extends UnenhancedSubtype> getUnenhancedSubclass() {
- return UnenhancedPropertyAccessSubclass.class;
- }
-
- protected UnenhancedSubtype newUnenhancedSubclassInstance() {
- return new UnenhancedPropertyAccessSubclass();
- }
-
- protected boolean isFieldAccessTest() {
- return false;
- }
+/*
+ * 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.enhance;
+
+public class TestUnenhancedPropertyAccess
+ extends AbstractUnenhancedClassTest {
+
+ protected Class<? extends UnenhancedType> getUnenhancedClass() {
+ return UnenhancedPropertyAccess.class;
+ }
+
+ protected UnenhancedType newUnenhancedInstance() {
+ return new UnenhancedPropertyAccess();
+ }
+
+ protected Class<? extends UnenhancedSubtype> getUnenhancedSubclass() {
+ return UnenhancedPropertyAccessSubclass.class;
+ }
+
+ protected UnenhancedSubtype newUnenhancedSubclassInstance() {
+ return new UnenhancedPropertyAccessSubclass();
+ }
+
+ protected boolean isFieldAccessTest() {
+ return false;
+ }
}
\ No newline at end of file
Propchange: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/TestUnenhancedPropertyAccess.java
------------------------------------------------------------------------------
svn:eol-style = native