mirror of https://github.com/apache/openjpa.git
Enable some of the new tests.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@628233 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4ab1384b43
commit
7d44e7a355
|
@ -1278,13 +1278,14 @@ public class MetaDataRepository
|
|||
Class cls;
|
||||
for (Iterator itr = names.iterator(); itr.hasNext();) {
|
||||
cls = classForName((String) itr.next(), clsLoader);
|
||||
if (cls != null)
|
||||
if (cls != null) {
|
||||
classes.add(cls);
|
||||
|
||||
// if the class is an interface, load its metadata to kick
|
||||
// off the impl generator
|
||||
if (cls.isInterface())
|
||||
getMetaData(cls, clsLoader, false);
|
||||
// if the class is an interface, load its metadata to kick
|
||||
// off the impl generator
|
||||
if (cls.isInterface())
|
||||
getMetaData(cls, clsLoader, false);
|
||||
}
|
||||
}
|
||||
return classes;
|
||||
}
|
||||
|
|
|
@ -326,26 +326,14 @@
|
|||
<exclude>org/apache/openjpa/**/*.*.class</exclude>
|
||||
|
||||
<!-- exclude new tests that aren't passing yet -->
|
||||
<exclude>org/apache/openjpa/persistence/jpql/clauses/TestEJBQueryInterface.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBEmbedded.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestAdvAnnot.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestAdvAnnot.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestAnnotationBasics.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestDDCallbackMethods.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestEmbeddableSuperclass.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestEmbeddedId.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestEntityListenerAnnot.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestEntityOrderBy.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestEnumerated.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestFlatInheritance.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestGenerators.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestJoinedInheritance.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestManyToMany.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestMapKey.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestOneToMany.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestOneToOne.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestPropertyAccess.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestSerializedLobs.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestTablePerClassInheritance.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/annotations/TestVersion.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/cache/TestQueryCache.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/conf/TestKodoConfiguration.java</exclude>
|
||||
|
@ -401,10 +389,8 @@
|
|||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestEJBByteArray.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestEJBColumnIOMappings.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestEJBConstantJoinOnSameRefTable.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestEJBCustomMapping.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestEJBDateVersion.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestEJBEager.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestEJBInverseOneToOne.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestEJBOuterJoinValues.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestIntermediate.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/meta/TestIrregularJoins.java</exclude>
|
||||
|
@ -432,7 +418,6 @@
|
|||
<exclude>org/apache/openjpa/persistence/jdbc/query/TestSQLQueries.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/query/TestStringFunctions.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/schema/TestClassDBSequenceFactory.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/schema/TestClassSequenceFactory.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/schema/TestDBSequenceFactory.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/schema/TestDynamicSchemaFactory.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/schema/TestJDBCListener.java</exclude>
|
||||
|
@ -445,13 +430,7 @@
|
|||
<exclude>org/apache/openjpa/persistence/jdbc/schema/TestXMLSchemaParser.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jdbc/schema/TestXMLSchemaSerializer.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jpql/clauses/TestBulkUpdate.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jpql/clauses/TestEJBClauses.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jpql/clauses/TestEJBDeleteUpdateImpl.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jpql/clauses/TestEJBPolymorphicQuery.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jpql/clauses/TestEJBQueryInterface.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jpql/functions/TestEJBQLFunction.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/jpql/joins/TestEJBJoins.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/Test2EJBConcurrency.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestAbstractMappedAppIdSuper.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestArrayValues2.java</exclude>
|
||||
|
@ -464,11 +443,9 @@
|
|||
<exclude>org/apache/openjpa/persistence/kernel/TestDateQueries.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestDependentFields2.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestDetachedStateManager.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBEmbedded.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBEntityManager.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBGetObjectByIdValue.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBIncrementalFlushes.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBInterfaces.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBLobs.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBLocales.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestEJBManagedInverses.java</exclude>
|
||||
|
@ -525,7 +502,6 @@
|
|||
<exclude>org/apache/openjpa/persistence/kernel/TestStateManagerImplData.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestStaticInnerClasses.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestStoreBlob.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/kernel/TestTransition2.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/meta/TestClassMetaData.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/meta/TestExternalValues.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/meta/TestFieldDeclarationOrder.java</exclude>
|
||||
|
@ -535,18 +511,9 @@
|
|||
<exclude>org/apache/openjpa/persistence/meta/TestSequenceAssigned.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/meta/TestValueStrategies.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/meta/TestXMLPersistenceMetaDataSerializer.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestAccessPathsOfSubqueries.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestComplexQueries.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestEJBDeleteUpdateImpl.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestEJBPolymorphicQuery.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestEJBQueryInterface.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestJPAQuerySubclassFunc.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestMathQueries.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestNamedQueries.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestQueryExpressionSplit.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestQueryResults.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestQuotedNumbersInFilters2.java</exclude>
|
||||
<exclude>org/apache/openjpa/persistence/query/TestSimple.java</exclude>
|
||||
</excludes>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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.annotations;
|
||||
|
||||
import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
|
||||
|
||||
public abstract class AnnotationTestCase extends AbstractTestCase {
|
||||
|
||||
public AnnotationTestCase(String name, String s) {
|
||||
super(name, s);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String computePersistenceXmlResource(String s) {
|
||||
if (s.startsWith("annotation"))
|
||||
return "org/apache/openjpa/persistence/annotations/common/apps/" +
|
||||
"annotApp/annotype/META-INF/persistence.xml";
|
||||
else if (s.startsWith("dd"))
|
||||
return "org/apache/openjpa/persistence/annotations/common/apps/" +
|
||||
"annotApp/ddtype/META-INF/persistence.xml";
|
||||
else
|
||||
return super.computePersistenceXmlResource(s);
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.
|
|||
import org.apache.openjpa.persistence.common.utils.*;
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||
|
||||
public class TestAdvAnnot extends AbstractTestCase
|
||||
public class TestAdvAnnot extends AnnotationTestCase
|
||||
{
|
||||
public TestAdvAnnot(String name)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
|
||||
import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.*;
|
||||
|
||||
public class TestAnnotationBasics extends AbstractTestCase {
|
||||
public class TestAnnotationBasics extends AnnotationTestCase {
|
||||
|
||||
public TestAnnotationBasics(String name)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
import org.apache.openjpa.persistence.annotations.common.apps.annotApp.ddtype.*;
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||
|
||||
public class TestDDCallbackMethods extends AbstractTestCase
|
||||
public class TestDDCallbackMethods extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestDDCallbackMethods(String name)
|
||||
|
|
|
@ -40,7 +40,7 @@ import junit.framework.*;
|
|||
*
|
||||
* @author Steve Kim
|
||||
*/
|
||||
public class TestEJBEmbedded extends AbstractTestCase
|
||||
public class TestEJBEmbedded extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestEJBEmbedded(String name)
|
||||
|
|
|
@ -38,7 +38,7 @@ import junit.framework.*;
|
|||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
public class TestEmbeddableSuperclass extends AbstractTestCase
|
||||
public class TestEmbeddableSuperclass extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestEmbeddableSuperclass(String name)
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
public class TestEmbeddedId extends AbstractTestCase
|
||||
public class TestEmbeddedId extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestEmbeddedId(String name)
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.*;
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||
|
||||
public class TestEntityListenerAnnot extends AbstractTestCase
|
||||
public class TestEntityListenerAnnot extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestEntityListenerAnnot(String name)
|
||||
|
|
|
@ -34,7 +34,7 @@ import junit.framework.*;
|
|||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
public class TestEntityOrderBy extends AbstractTestCase
|
||||
public class TestEntityOrderBy extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestEntityOrderBy(String name)
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.
|
|||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
public class TestEnumerated extends AbstractTestCase
|
||||
public class TestEnumerated extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestEnumerated(String name)
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
|||
*
|
||||
* @author Steve Kim
|
||||
*/
|
||||
public class TestFlatInheritance extends AbstractTestCase
|
||||
public class TestFlatInheritance extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestFlatInheritance(String name)
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
|||
*
|
||||
* @author Steve Kim
|
||||
*/
|
||||
public class TestGenerators extends AbstractTestCase
|
||||
public class TestGenerators extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestGenerators(String name)
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
|||
*
|
||||
* @author Steve Kim
|
||||
*/
|
||||
public class TestJoinedInheritance extends AbstractTestCase
|
||||
public class TestJoinedInheritance extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestJoinedInheritance(String name)
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
|||
*
|
||||
* @author Steve Kim
|
||||
*/
|
||||
public class TestManyToMany extends AbstractTestCase
|
||||
public class TestManyToMany extends AnnotationTestCase
|
||||
{
|
||||
public TestManyToMany(String name)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
public class TestMapKey extends AbstractTestCase
|
||||
public class TestMapKey extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestMapKey(String name)
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
*
|
||||
* @author Steve Kim
|
||||
*/
|
||||
public class TestOneToMany extends AbstractTestCase
|
||||
public class TestOneToMany extends AnnotationTestCase
|
||||
{
|
||||
public TestOneToMany(String name)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
|||
*
|
||||
* @author Steve Kim
|
||||
*/
|
||||
public class TestOneToOne extends AbstractTestCase
|
||||
public class TestOneToOne extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestOneToOne(String name)
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
|
||||
|
||||
|
||||
public class TestPropertyAccess extends AbstractTestCase
|
||||
public class TestPropertyAccess extends AnnotationTestCase
|
||||
{
|
||||
public TestPropertyAccess(String name)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
*
|
||||
* @author Steve Kim
|
||||
*/
|
||||
public class TestSerializedLobs extends AbstractTestCase
|
||||
public class TestSerializedLobs extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestSerializedLobs(String name)
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.openjpa.persistence.common.utils.*;
|
|||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
public class TestTablePerClassInheritance extends AbstractTestCase
|
||||
public class TestTablePerClassInheritance extends AnnotationTestCase
|
||||
{
|
||||
|
||||
public TestTablePerClassInheritance(String name)
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.openjpa.persistence.OpenJPAPersistence;
|
|||
|
||||
@author Steve Kim
|
||||
*/
|
||||
public class TestVersion extends AbstractTestCase
|
||||
public class TestVersion extends AnnotationTestCase
|
||||
{
|
||||
private Object oid;
|
||||
|
||||
|
|
|
@ -66,8 +66,10 @@ import java.io.ObjectInputStream;
|
|||
import java.io.StringWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.PrintStream;
|
||||
import java.net.URL;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.management.IntrospectionException;
|
||||
|
||||
import org.apache.regexp.RESyntaxException;
|
||||
|
@ -81,12 +83,16 @@ import org.apache.openjpa.persistence.OpenJPAPersistence;
|
|||
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
||||
import org.apache.openjpa.kernel.OpenJPAStateManager;
|
||||
import org.apache.openjpa.kernel.BrokerFactory;
|
||||
import org.apache.openjpa.kernel.Broker;
|
||||
import org.apache.openjpa.kernel.jpql.JPQLParser;
|
||||
import org.apache.openjpa.lib.log.Log;
|
||||
import org.apache.openjpa.meta.ClassMetaData;
|
||||
|
||||
public abstract class AbstractTestCase extends PersistenceTestCase {
|
||||
|
||||
private String persistenceXmlResource;
|
||||
private Map<Map,OpenJPAEntityManagerFactory> emfs =
|
||||
new HashMap<Map,OpenJPAEntityManagerFactory>();
|
||||
private OpenJPAEntityManager currentEntityManager;
|
||||
|
||||
protected enum Platform {
|
||||
EMPRESS,
|
||||
HYPERSONIC,
|
||||
|
@ -107,6 +113,21 @@ public abstract class AbstractTestCase extends PersistenceTestCase {
|
|||
|
||||
public AbstractTestCase(String name, String s) {
|
||||
setName(name);
|
||||
persistenceXmlResource = computePersistenceXmlResource(s);
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
try {
|
||||
super.tearDown();
|
||||
} finally {
|
||||
for (EntityManagerFactory emf : emfs.values()) {
|
||||
try {
|
||||
closeEMF(emf);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractTestCase() {
|
||||
|
@ -116,28 +137,33 @@ public abstract class AbstractTestCase extends PersistenceTestCase {
|
|||
setName(name);
|
||||
}
|
||||
|
||||
protected String computePersistenceXmlResource(String s) {
|
||||
String resourceName = getClass().getPackage().getName()
|
||||
.replaceAll("\\.", "/");
|
||||
resourceName += "/common/apps/META-INF/persistence.xml";
|
||||
URL resource = getClass().getClassLoader().getResource(resourceName);
|
||||
if (resource != null)
|
||||
return resourceName;
|
||||
return defaultPersistenceXmlResource();
|
||||
}
|
||||
|
||||
protected String defaultPersistenceXmlResource() {
|
||||
return "org/apache/openjpa/persistence/" +
|
||||
"common/apps/META-INF/persistence.xml";
|
||||
}
|
||||
|
||||
protected OpenJPAStateManager getStateManager(Object obj,
|
||||
EntityManager pm) {
|
||||
throw new UnsupportedOperationException();
|
||||
EntityManager em) {
|
||||
return JPAFacadeHelper.toBroker(em).getStateManager(obj);
|
||||
}
|
||||
|
||||
protected int deleteAll(Class type, EntityManager em) {
|
||||
final boolean useDeleteByQuery = true;
|
||||
|
||||
if (useDeleteByQuery) {
|
||||
Broker broker = JPAFacadeHelper.toBroker(em);
|
||||
org.apache.openjpa.kernel.Query query = broker.newQuery(
|
||||
JPQLParser.LANG_JPQL, type, "");
|
||||
query.setCandidateType(type, true);
|
||||
return (int) query.deleteAll();
|
||||
} else {
|
||||
List list = OpenJPAPersistence.cast(em).createExtent(type, true)
|
||||
.list();
|
||||
int size = list.size();
|
||||
for (Object o : list)
|
||||
em.remove(o);
|
||||
return size;
|
||||
}
|
||||
ClassMetaData meta = JPAFacadeHelper.getMetaData(em, type);
|
||||
if (meta != null)
|
||||
return em.createQuery("delete from " + meta.getTypeAlias())
|
||||
.executeUpdate();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int deleteAll(Class... types) {
|
||||
|
@ -152,6 +178,8 @@ public abstract class AbstractTestCase extends PersistenceTestCase {
|
|||
}
|
||||
|
||||
protected OpenJPAEntityManagerFactory getEmf(Map map) {
|
||||
if (map == null)
|
||||
map = new HashMap();
|
||||
Collection keys = new ArrayList();
|
||||
for (Object key : map.keySet())
|
||||
if (key.toString().startsWith("kodo"))
|
||||
|
@ -159,12 +187,28 @@ public abstract class AbstractTestCase extends PersistenceTestCase {
|
|||
if (keys.size() > 0)
|
||||
throw new IllegalArgumentException(
|
||||
"kodo-prefixed properties must be converted to openjpa. " +
|
||||
"Properties: " + keys);
|
||||
throw new UnsupportedOperationException();
|
||||
"Properties: " + keys);
|
||||
|
||||
addProperties(map);
|
||||
|
||||
OpenJPAEntityManagerFactory emf = emfs.get(map);
|
||||
if (emf == null) {
|
||||
emf = OpenJPAPersistence.createEntityManagerFactory(
|
||||
"TestConv", persistenceXmlResource, map);
|
||||
emfs.put(map, emf);
|
||||
}
|
||||
return emf;
|
||||
}
|
||||
|
||||
protected void addProperties(Map map) {
|
||||
if (!map.containsKey("openjpa.jdbc.SynchronizeMappings"))
|
||||
map.put("openjpa.jdbc.SynchronizeMappings",
|
||||
"buildSchema(ForeignKeys=true)");
|
||||
}
|
||||
|
||||
protected OpenJPAEntityManagerFactory getEmf() {
|
||||
throw new UnsupportedOperationException();
|
||||
Map m = new HashMap();
|
||||
return getEmf(m);
|
||||
}
|
||||
|
||||
protected BrokerFactory getBrokerFactory() {
|
||||
|
@ -182,7 +226,9 @@ public abstract class AbstractTestCase extends PersistenceTestCase {
|
|||
}
|
||||
|
||||
protected OpenJPAEntityManager currentEntityManager() {
|
||||
throw new UnsupportedOperationException();
|
||||
if (currentEntityManager == null || !currentEntityManager.isOpen())
|
||||
currentEntityManager = getEmf().createEntityManager();
|
||||
return currentEntityManager;
|
||||
}
|
||||
|
||||
protected void startTx(EntityManager em) {
|
||||
|
@ -209,6 +255,8 @@ public abstract class AbstractTestCase extends PersistenceTestCase {
|
|||
protected void endEm(EntityManager em) {
|
||||
if (em.isOpen())
|
||||
em.close();
|
||||
if (em == currentEntityManager)
|
||||
currentEntityManager = null;
|
||||
}
|
||||
|
||||
protected Object getStackTrace(Throwable t) {
|
||||
|
@ -216,7 +264,7 @@ public abstract class AbstractTestCase extends PersistenceTestCase {
|
|||
}
|
||||
|
||||
protected OpenJPAConfiguration getConfiguration() {
|
||||
throw new UnsupportedOperationException();
|
||||
return getEmf().getConfiguration();
|
||||
}
|
||||
|
||||
protected Platform getCurrentPlatform() {
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Base
|
||||
implements Comparable {
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class BaseSub1
|
||||
extends Base {
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class BaseSub1Sub1
|
||||
extends BaseSub1 {
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class BaseSub1Sub2
|
||||
extends BaseSub1 {
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class BaseSub2
|
||||
extends Base {
|
||||
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type used in testing the mappingtool's buildSchema action.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class BuildSchemaPC {
|
||||
|
||||
private String stringField = null;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type using a byte[] for a primary key field. Used in
|
||||
|
@ -26,6 +27,7 @@ import java.util.*;
|
|||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class ByteArrayPKPC {
|
||||
|
||||
private byte[] pk = null;
|
||||
|
|
|
@ -18,12 +18,15 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type using a byte[] for a primary key field. Used in
|
||||
* {@link TestByteArrayAppId}.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class ByteArrayPKPC2
|
||||
extends ByteArrayPKPC {
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class ConstantJoinPC {
|
||||
|
||||
private int pk1;
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class ConstantJoinPC2
|
||||
extends ConstantJoinPC {
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class ConstantJoinPC3
|
||||
extends ConstantJoinPC {
|
||||
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type used in testing.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class DFGTest {
|
||||
|
||||
private int dfgField;
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.lang.annotation.Annotation;
|
|||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class DataStoreTripsPC {
|
||||
|
||||
private int intField;
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Class that uses eager outer joins for its collection fields.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class EagerOuterJoinPC {
|
||||
|
||||
private String name = null;
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Helper class in eager to-many join testing.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class EagerOuterJoinPC2 {
|
||||
|
||||
private String name = null;
|
||||
|
|
|
@ -34,7 +34,7 @@ public class HelperPC2
|
|||
@Column(name="strngfld", length=50)
|
||||
private String stringField;
|
||||
|
||||
@Id
|
||||
@Id @GeneratedValue
|
||||
private int id;
|
||||
|
||||
@OneToOne(cascade={CascadeType.PERSIST, CascadeType.REMOVE})
|
||||
|
|
|
@ -20,8 +20,9 @@ package org.apache.openjpa.persistence.jdbc.common.apps;
|
|||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public abstract class HorizA
|
||||
implements Serializable {
|
||||
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizAppInterVerticalA
|
||||
implements HorizInterA {
|
||||
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizAppInterVerticalB
|
||||
extends HorizAppInterVerticalA
|
||||
implements HorizInterB {
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizAppInterVerticalC
|
||||
extends HorizAppInterVerticalB
|
||||
implements HorizInterC {
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizAppInterVerticalD
|
||||
extends HorizAppInterVerticalB
|
||||
implements HorizInterD {
|
||||
|
|
|
@ -21,9 +21,11 @@ package org.apache.openjpa.persistence.jdbc.common.apps;
|
|||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
import serp.util.*;
|
||||
|
||||
@Entity
|
||||
public class HorizAppMultiA
|
||||
implements HorizAppA {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizAppMultiB
|
||||
extends HorizAppMultiA
|
||||
implements HorizAppB {
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizAppMultiC
|
||||
extends HorizAppMultiA
|
||||
implements HorizAppC {
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizAppMultiD
|
||||
extends HorizAppMultiA
|
||||
implements HorizAppD {
|
||||
|
|
|
@ -21,9 +21,11 @@ package org.apache.openjpa.persistence.jdbc.common.apps;
|
|||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
import serp.util.*;
|
||||
|
||||
@Entity
|
||||
public class HorizAppSingleA
|
||||
implements HorizAppA {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizAppSingleB
|
||||
extends HorizAppSingleA
|
||||
implements HorizAppB {
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizAppSingleC
|
||||
extends HorizAppSingleA
|
||||
implements HorizAppC {
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizAppSingleD
|
||||
extends HorizAppSingleA
|
||||
implements HorizAppD {
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizB
|
||||
extends HorizA {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public abstract class HorizC
|
||||
extends HorizA {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizD
|
||||
extends HorizC {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizE
|
||||
extends HorizC {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizF
|
||||
extends HorizE {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizG
|
||||
extends HorizE {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizH
|
||||
extends HorizG {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizI
|
||||
extends HorizG {
|
||||
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizInterFlatA
|
||||
implements HorizInterA {
|
||||
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizInterFlatB
|
||||
extends HorizInterFlatA
|
||||
implements HorizInterB {
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizInterFlatC
|
||||
extends HorizInterFlatB
|
||||
implements HorizInterC {
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizInterFlatD
|
||||
extends HorizInterFlatB
|
||||
implements HorizInterD {
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizInterVerticalA
|
||||
implements HorizInterA {
|
||||
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizInterVerticalB
|
||||
extends HorizInterVerticalA
|
||||
implements HorizInterB {
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizInterVerticalC
|
||||
extends HorizInterVerticalB
|
||||
implements HorizInterC {
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Interface for intermediate horizontal mappings with flat mappings.
|
||||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizInterVerticalD
|
||||
extends HorizInterVerticalB
|
||||
implements HorizInterD {
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizJ
|
||||
extends HorizD {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizK
|
||||
extends HorizJ {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizL
|
||||
extends HorizJ {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizM
|
||||
extends HorizL {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizN
|
||||
extends HorizM {
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
||||
@Entity
|
||||
public class HorizO
|
||||
extends HorizN {
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.openjpa.persistence.jdbc.common.apps;
|
|||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
import org.apache.commons.collections.*;
|
||||
|
||||
|
@ -30,6 +31,7 @@ import org.apache.commons.collections.*;
|
|||
*
|
||||
* @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
|
||||
*/
|
||||
@Entity
|
||||
public class HorizRelation
|
||||
implements Serializable {
|
||||
///////////////////////
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class InverseKeyMapPC
|
||||
implements MappedByMapPC {
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class JoinSubclassBase
|
||||
implements Comparable {
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class JoinSubclassBaseSubFlat
|
||||
extends JoinSubclassBaseSubVert {
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class JoinSubclassBaseSubVert
|
||||
extends JoinSubclassBase {
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class JoinTableMapPC
|
||||
implements MappedByMapPC {
|
||||
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type with a compound primary key and LRS fields.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class LRSCompoundPC
|
||||
implements LRSPCIntf {
|
||||
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import java.util.*;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type with LRS fields.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class LRSPC
|
||||
implements LRSPCIntf {
|
||||
|
||||
|
|
|
@ -18,9 +18,12 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Used in testing; should be enhanced.
|
||||
*/
|
||||
@Entity
|
||||
public class LocatorTestObject {
|
||||
|
||||
private byte[] bytes;
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class LockGroupSubclass
|
||||
extends HorizB {
|
||||
|
||||
|
|
|
@ -20,13 +20,14 @@ package org.apache.openjpa.persistence.jdbc.common.apps;
|
|||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type used for testing.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class MappingTest1
|
||||
{
|
||||
private int value = 0;
|
||||
|
|
|
@ -28,6 +28,7 @@ import javax.persistence.*;
|
|||
* @author Abe White
|
||||
*/
|
||||
|
||||
@Entity
|
||||
public class MappingTest2
|
||||
{
|
||||
private int pk1 = 0;
|
||||
|
|
|
@ -18,12 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type used in testing.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class MappingTest3
|
||||
extends MappingTest1
|
||||
{
|
||||
|
|
|
@ -18,12 +18,15 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type used in testing.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
|
||||
public class MappingTest4
|
||||
extends MappingTest3
|
||||
{
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.jdbc.common.apps;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* <p>Persistent type used in testing.</p>
|
||||
*
|
||||
* @author Abe White
|
||||
*/
|
||||
@Entity
|
||||
public class MappingTest5
|
||||
extends MappingTest2 {
|
||||
|
||||
|
|
|
@ -69,6 +69,12 @@ public class BaseJDBCTest extends org.apache.openjpa.persistence.common.utils.Ab
|
|||
super(name, "jdbccactusapp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String defaultPersistenceXmlResource() {
|
||||
return "org/apache/openjpa/persistence/jdbc/common" +
|
||||
"/apps/META-INF/persistence.xml";
|
||||
}
|
||||
|
||||
protected OpenJPAEntityManager getPM() {
|
||||
return (OpenJPAEntityManager)currentEntityManager();
|
||||
}
|
||||
|
@ -136,10 +142,6 @@ public class BaseJDBCTest extends org.apache.openjpa.persistence.common.utils.Ab
|
|||
return id;
|
||||
}
|
||||
|
||||
protected OpenJPAStateManager getStateManager(Object obj,OpenJPAEntityManager pm) {
|
||||
return getStateManager(obj,pm);
|
||||
}
|
||||
|
||||
protected Properties getProperties() {
|
||||
return getProperties(null);
|
||||
}
|
||||
|
|
|
@ -76,10 +76,10 @@ public class TestEagerDistinct extends org.apache.openjpa.persistence.jdbc.kerne
|
|||
pc2.getHelperCollection().add(new HelperPC());
|
||||
|
||||
OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
|
||||
startTx(pm);;
|
||||
startTx(pm);
|
||||
pm.persist(pc1);
|
||||
pm.persist(pc2);
|
||||
endTx(pm);;
|
||||
endTx(pm);
|
||||
|
||||
// to make sure subclasses are selected, etc
|
||||
//FIXME jthomas
|
||||
|
|
|
@ -23,6 +23,7 @@ import javax.persistence.EntityManager;
|
|||
|
||||
import org.apache.openjpa.persistence.common.apps.*;
|
||||
import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
|
||||
import org.apache.openjpa.persistence.InvalidStateException;
|
||||
|
||||
public class TestEJBQLCondExpression extends AbstractTestCase {
|
||||
|
||||
|
@ -281,7 +282,7 @@ public class TestEJBQLCondExpression extends AbstractTestCase {
|
|||
EntityManager em = currentEntityManager();
|
||||
|
||||
String query =
|
||||
"SELECT NEW persistence.common.apps.MaleUser(c.name, c.computerName, c.address, c.age, c.userid)" +
|
||||
"SELECT NEW org.apache.openjpa.persistence.common.apps.MaleUser(c.name, c.computerName, c.address, c.age, c.userid)" +
|
||||
" FROM CompUser c WHERE c.name = 'Seetha'";
|
||||
|
||||
MaleUser male = (MaleUser) em.createQuery(query).getSingleResult();
|
||||
|
|
|
@ -55,11 +55,11 @@ public abstract class BaseQueryTest extends org.apache.openjpa.persistence.commo
|
|||
super(name, "querycactusapp");
|
||||
}
|
||||
|
||||
protected OpenJPAEntityManager getPM() {
|
||||
protected OpenJPAEntityManager getEM() {
|
||||
return (OpenJPAEntityManager) currentEntityManager();
|
||||
}
|
||||
|
||||
protected OpenJPAEntityManager getPM(boolean optimistic,
|
||||
protected OpenJPAEntityManager getEM(boolean optimistic,
|
||||
boolean retainValues) {
|
||||
OpenJPAEntityManager em =
|
||||
(OpenJPAEntityManager) currentEntityManager();
|
||||
|
|
|
@ -289,134 +289,4 @@ public class TestComplexQueries extends BaseQueryTest {
|
|||
"f.stringF = \'testfXXX\'",
|
||||
ComplexG.class);
|
||||
}
|
||||
|
||||
public void testRelationsIgnoreCache() {
|
||||
try {
|
||||
relationsIgnoreCacheTest();
|
||||
} catch (AssertionFailedError afe) {
|
||||
bug(631, afe, "IgnoreCache=false queries do not detect "
|
||||
+ "all relationship changed");
|
||||
}
|
||||
}
|
||||
|
||||
public void relationsIgnoreCacheTest() {
|
||||
OpenJPAEntityManager pm;
|
||||
ComplexC c = new ComplexC();
|
||||
ComplexB b = new ComplexB();
|
||||
ComplexA a = new ComplexA();
|
||||
|
||||
c.setB(b);
|
||||
b.setA(a);
|
||||
|
||||
a.setStringA("Foo");
|
||||
pm = getPM();
|
||||
startTx(pm);
|
||||
pm.persist(c);
|
||||
endTx(pm);
|
||||
|
||||
assertSize(1,
|
||||
getPM().createNativeQuery("b.a.stringA = \'Foo\'", ComplexC.class));
|
||||
assertSize(0, getPM().createNativeQuery("b.a.stringA = \'FooX\'",
|
||||
ComplexC.class));
|
||||
|
||||
pm = getPM();
|
||||
startTx(pm);
|
||||
ComplexA pca = (ComplexA) pm.createExtent(ComplexA.class, false)
|
||||
.iterator().next();
|
||||
ComplexB pcb = (ComplexB) pm.createExtent(ComplexB.class, false)
|
||||
.iterator().next();
|
||||
ComplexC pcc = (ComplexC) pm.createExtent(ComplexC.class, false)
|
||||
.iterator().next();
|
||||
|
||||
pcc.getB().getA().setStringA("Foo2"); // change the value for
|
||||
|
||||
final OpenJPAQuery q;
|
||||
|
||||
q = pm.createNativeQuery("b.a.stringA = \'Foo\'", ComplexC.class);
|
||||
//FIXME jthomas
|
||||
//q.setIgnoreCache(true);
|
||||
assertEquals(1, q.getMaxResults());
|
||||
|
||||
//FIXME jthomas
|
||||
//q.setIgnoreCache(false);
|
||||
assertEquals(0, q.getMaxResults());
|
||||
|
||||
// now see if the ignore cache change picks up the current object
|
||||
//FIXME jthomas
|
||||
//q.setFilter("b.a.stringA = \'Foo2\'");
|
||||
//q.setIgnoreCache(false);
|
||||
assertEquals(1, q.getMaxResults());
|
||||
|
||||
/*
|
||||
Query query = pm.newQuery (C.class, "b.a = param");
|
||||
query.declareParameters ("A param");
|
||||
|
||||
query.setIgnoreCache (true);
|
||||
assertSize (1, query.execute (pca));
|
||||
|
||||
query.setIgnoreCache (false);
|
||||
assertSize (1, query.execute (pca));
|
||||
|
||||
// now change the instance of b.a and see if we fail (as expected)
|
||||
pcb.setA (new A ());
|
||||
|
||||
query.setIgnoreCache (true);
|
||||
assertSize (1, query.execute (pca));
|
||||
|
||||
query.setIgnoreCache (false);
|
||||
// the bug is that the following line will fail: 1 object is returned
|
||||
assertSize (0, query.execute (pca));
|
||||
*/
|
||||
|
||||
final OpenJPAQuery q2;
|
||||
|
||||
q2 = pm.createNativeQuery("b.a = param", ComplexC.class);
|
||||
//FIXME jthomas
|
||||
/*
|
||||
q2.declareParameters("ComplexA param");
|
||||
|
||||
q2.setIgnoreCache(true);
|
||||
assertSize(1, q2.execute(pca));
|
||||
|
||||
q2.setIgnoreCache(false);
|
||||
assertSize(1, q2.execute(pca));
|
||||
|
||||
// now change the instance of b.a to null and see if we fail
|
||||
pcb.setA(null);
|
||||
q2.setIgnoreCache(true);
|
||||
assertSize(1, q2.execute(pca));
|
||||
q2.setIgnoreCache(false);
|
||||
assertSize(0, q2.execute(pca));
|
||||
|
||||
int fbq = ((FetchPlan) q2.getFetchPlan()).
|
||||
getFlushBeforeQueries();
|
||||
boolean isFlushing =
|
||||
fbq = FetchPlanImpl.FLUSH_TRUEOR
|
||||
(fbq = FetchPlanImpl.FLUSH_WITH_CONNECTION AND
|
||||
KodoJDOHelper.toBroker(pm).hasConnection());
|
||||
|
||||
// now change the instance of b.a and see if we fail (as expected)
|
||||
pcb.setA(new ComplexA());
|
||||
q2.setIgnoreCache(true);
|
||||
if (isFlushing)
|
||||
assertSize(0, q2.execute(pca)); // we've already flushed earlier
|
||||
else
|
||||
assertSize(1, q2.execute(pca));
|
||||
q2.setIgnoreCache(false);
|
||||
assertSize(0, q2.execute(pca));
|
||||
|
||||
// now change the instance of b.a back to the orig value
|
||||
pcb.setA(pca);
|
||||
q2.setIgnoreCache(true);
|
||||
if (isFlushing)
|
||||
assertSize(0, q2.execute(pca)); // we've already flushed earlier
|
||||
else
|
||||
assertSize(1, q2.execute(pca));
|
||||
q2.setIgnoreCache(false);
|
||||
assertSize(1, q2.execute(pca));
|
||||
|
||||
endTx(pm);
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class TestJPAQuerySubclassFunc extends BaseQueryTest {
|
|||
public void setUp() {
|
||||
deleteAll(RuntimeTest1.class);
|
||||
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
startTx(pm);
|
||||
|
||||
pm.persist(new RuntimeTest1("TestQueryResults1", 10));
|
||||
|
@ -51,7 +51,7 @@ public class TestJPAQuerySubclassFunc extends BaseQueryTest {
|
|||
}
|
||||
|
||||
public void testSubClassIsTrueFunction() {
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
startTx(pm);
|
||||
|
||||
OpenJPAQuery query =
|
||||
|
@ -70,7 +70,7 @@ public class TestJPAQuerySubclassFunc extends BaseQueryTest {
|
|||
}
|
||||
|
||||
public void testSubClassIsFalseFunction() {
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
startTx(pm);
|
||||
|
||||
OpenJPAQuery query =
|
||||
|
|
|
@ -46,7 +46,7 @@ public class TestMathQueries extends BaseQueryTest {
|
|||
|
||||
public void setUp() {
|
||||
deleteAll(QueryTest1.class);
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
startTx(pm);
|
||||
|
||||
for (int i = 0; i <= 100; i++) {
|
||||
|
@ -69,9 +69,9 @@ public class TestMathQueries extends BaseQueryTest {
|
|||
try {
|
||||
|
||||
OpenJPAQuery q1, q2;
|
||||
q1 = getPM().createQuery(
|
||||
q1 = getEM().createQuery(
|
||||
"SELECT q FROM QueryTest1 q WHERE q.numb * q.numb = 25");
|
||||
q2 = getPM().createQuery(
|
||||
q2 = getEM().createQuery(
|
||||
"SELECT q FROM QueryTest1 q WHERE q.numb * q.numb > 25");
|
||||
|
||||
assertSize(95, q2.getResultList());
|
||||
|
|
|
@ -50,7 +50,7 @@ public class TestNamedQueries extends BaseQueryTest {
|
|||
public void setUp() {
|
||||
deleteAll(QueryTest1.class);
|
||||
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
startTx(pm);
|
||||
QueryTest1 pc = null;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
@ -66,7 +66,7 @@ public class TestNamedQueries extends BaseQueryTest {
|
|||
}
|
||||
|
||||
public void testNamedClassQuery() {
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
|
||||
OpenJPAQuery query = pm.createQuery("SELECT o FROM QueryTest1 o");
|
||||
query.setResultClass(QueryTest1.class);
|
||||
|
@ -93,7 +93,7 @@ public class TestNamedQueries extends BaseQueryTest {
|
|||
}
|
||||
|
||||
public void testNamespace() {
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
OpenJPAQuery query = (OpenJPAQuery) pm.createNamedQuery("named");
|
||||
assertEquals("SELECT o FROM QueryTest1 o", query.getQueryString());
|
||||
query.closeAll();
|
||||
|
@ -102,7 +102,7 @@ public class TestNamedQueries extends BaseQueryTest {
|
|||
|
||||
public void testSystemJDOQL() {
|
||||
// make sure local query metadata is parsed
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
|
||||
OpenJPAQuery query = (OpenJPAQuery) pm.createNamedQuery("named");
|
||||
assertEquals("SELECT o FROM QueryTest1 o", query.getQueryString());
|
||||
|
|
|
@ -48,7 +48,7 @@ public class TestQueryExpressionSplit extends BaseQueryTest {
|
|||
assertEquals(new String[]{ "foo() bar(boo)" },
|
||||
Filters.splitExpressions("foo() bar(boo)", ',', 3));
|
||||
assertEquals(new String[]{ "foo() bar(boo)", "biz()", "baz(boo)" },
|
||||
Filters.splitExpressions("foo() bar(boo), bizbaz(boo)",
|
||||
Filters.splitExpressions("foo() bar(boo), biz(), baz(boo)",
|
||||
',', 3));
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class TestQuotedNumbersInFilters2 extends BaseQueryTest {
|
|||
|
||||
public void setUp() {
|
||||
deleteAll(RuntimeTest1.class);
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
startTx(pm);
|
||||
pm.persist(new RuntimeTest1("foo", 3));
|
||||
pm.persist(new RuntimeTest1("bar", 15));
|
||||
|
@ -140,7 +140,7 @@ public class TestQuotedNumbersInFilters2 extends BaseQueryTest {
|
|||
* queries.
|
||||
*/
|
||||
private long helper(String filter, boolean shouldFail) {
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
OpenJPAEntityManager pm = getEM();
|
||||
|
||||
OpenJPAQuery q =
|
||||
pm.createQuery("SELECT r FROM RuntimeTest1 r WHERE r." + filter);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue