mirror of https://github.com/apache/openjpa.git
OPENJPA-854 remove hard coded trace levels from testcases
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@733054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0a20368e58
commit
f491d6e361
|
@ -20,8 +20,6 @@
|
||||||
package org.apache.openjpa.persistence.criteria;
|
package org.apache.openjpa.persistence.criteria;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import javax.persistence.DomainObject;
|
import javax.persistence.DomainObject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
@ -81,8 +79,7 @@ public class TestCriteria extends SingleEMFTestCase {
|
||||||
Photo.class,
|
Photo.class,
|
||||||
Student.class,
|
Student.class,
|
||||||
Transaction.class,
|
Transaction.class,
|
||||||
VideoStore.class,
|
VideoStore.class);
|
||||||
"openjpa.Log","SQL=TRACE, Query=TRACE");
|
|
||||||
emf = super.emf;
|
emf = super.emf;
|
||||||
}
|
}
|
||||||
qb = (QueryBuilderImpl)emf.getQueryBuilder();
|
qb = (QueryBuilderImpl)emf.getQueryBuilder();
|
||||||
|
@ -544,8 +541,8 @@ public class TestCriteria extends SingleEMFTestCase {
|
||||||
*/
|
*/
|
||||||
private void executeActually(String jpql, QueryDefinition q, Object...p) {
|
private void executeActually(String jpql, QueryDefinition q, Object...p) {
|
||||||
EntityManager em = emf.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
List criteriaResult = null;
|
List<?> criteriaResult = null;
|
||||||
List jpqlResult = null;
|
List<?> jpqlResult = null;
|
||||||
Throwable criteriaError = null;
|
Throwable criteriaError = null;
|
||||||
Throwable jpqlError = null;
|
Throwable jpqlError = null;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class TestStatistics extends SingleEMFTestCase {
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
super.setUp(CLEAR_TABLES, Customer.class, Order.class,
|
super.setUp(CLEAR_TABLES, Customer.class, Order.class,
|
||||||
"openjpa.DataCache", "true", "openjpa.RemoteCommitProvider",
|
"openjpa.DataCache", "true", "openjpa.RemoteCommitProvider",
|
||||||
"sjvm", "openjpa.Log", "DefaultLevel=WARN");
|
"sjvm");
|
||||||
startCaching(Customer.class);
|
startCaching(Customer.class);
|
||||||
startCaching(Order.class);
|
startCaching(Order.class);
|
||||||
assertTrue(((EntityManagerImpl) emf.createEntityManager()).getBroker()
|
assertTrue(((EntityManagerImpl) emf.createEntityManager()).getBroker()
|
||||||
|
@ -46,7 +46,7 @@ public class TestStatistics extends SingleEMFTestCase {
|
||||||
assertNotNull(stats);
|
assertNotNull(stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startCaching(Class cls) {
|
void startCaching(Class<?> cls) {
|
||||||
ClassMetaData meta = emf.getConfiguration()
|
ClassMetaData meta = emf.getConfiguration()
|
||||||
.getMetaDataRepositoryInstance().getMetaData(cls, null, true);
|
.getMetaDataRepositoryInstance().getMetaData(cls, null, true);
|
||||||
meta.setDataCacheName(DataCache.NAME_DEFAULT);
|
meta.setDataCacheName(DataCache.NAME_DEFAULT);
|
||||||
|
@ -56,7 +56,8 @@ public class TestStatistics extends SingleEMFTestCase {
|
||||||
* Tests that statistics captures correct data under perfect caching
|
* Tests that statistics captures correct data under perfect caching
|
||||||
* condition.
|
* condition.
|
||||||
*/
|
*/
|
||||||
public void testPerfectCache() {
|
@SuppressWarnings("unchecked")
|
||||||
|
public void testPerfectCache() {
|
||||||
print(stats);
|
print(stats);
|
||||||
// populate a bunch of customer and order
|
// populate a bunch of customer and order
|
||||||
int nCustomer = 20;
|
int nCustomer = 20;
|
||||||
|
|
|
@ -48,20 +48,20 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
||||||
*/
|
*/
|
||||||
public class TestTablePerClassInheritanceWithAbstractRoot extends
|
public class TestTablePerClassInheritanceWithAbstractRoot extends
|
||||||
SingleEMFTestCase {
|
SingleEMFTestCase {
|
||||||
Class[] UNJOINED_SUBCLASSES = {
|
Class<?>[] UNJOINED_SUBCLASSES = {
|
||||||
EnglishParagraph.class,
|
EnglishParagraph.class,
|
||||||
FrenchParagraph.class,
|
FrenchParagraph.class,
|
||||||
GermanParagraph.class};
|
GermanParagraph.class};
|
||||||
|
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
setUp(CLEAR_TABLES,
|
setUp(CLEAR_TABLES,
|
||||||
"openjpa.Log", "SQL=TRACE",
|
|
||||||
Translation.class, BaseEntity.class,
|
Translation.class, BaseEntity.class,
|
||||||
EnglishParagraph.class, FrenchParagraph.class,
|
EnglishParagraph.class, FrenchParagraph.class,
|
||||||
GermanParagraph.class, Translatable.class);
|
GermanParagraph.class, Translatable.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConsistency() {
|
@SuppressWarnings("unchecked")
|
||||||
|
public void testConsistency() {
|
||||||
OpenJPAEntityManager em = emf.createEntityManager();
|
OpenJPAEntityManager em = emf.createEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
/**
|
/**
|
||||||
|
@ -144,9 +144,9 @@ public class TestTablePerClassInheritanceWithAbstractRoot extends
|
||||||
* Count total number of instances of all the given classes by separate JPQL
|
* Count total number of instances of all the given classes by separate JPQL
|
||||||
* aggregate query. Useful when a base class has unjoined subclasses.
|
* aggregate query. Useful when a base class has unjoined subclasses.
|
||||||
*/
|
*/
|
||||||
public int count(Class... classes) {
|
public int count(Class<?>... classes) {
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (Class c:classes) {
|
for (Class<?> c:classes) {
|
||||||
total += count(c);
|
total += count(c);
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
|
|
|
@ -49,8 +49,8 @@ public class TestAutoIncrement extends SingleEMFTestCase {
|
||||||
if ("testAutoIncrementIdentityWithNamedSequence".equals(getName())) {
|
if ("testAutoIncrementIdentityWithNamedSequence".equals(getName())) {
|
||||||
super.setUp(CLEAR_TABLES, PObject.class,
|
super.setUp(CLEAR_TABLES, PObject.class,
|
||||||
"openjpa.jdbc.DBDictionary",
|
"openjpa.jdbc.DBDictionary",
|
||||||
"oracle(UseTriggersForAutoAssign=true,autoAssignSequenceName=autoIncrementSequence)",
|
"oracle(UseTriggersForAutoAssign=true," +
|
||||||
"openjpa.Log", "SQL=TRACE");
|
"autoAssignSequenceName=autoIncrementSequence)");
|
||||||
} else {
|
} else {
|
||||||
super.setUp(CLEAR_TABLES, PObjectNative.class,
|
super.setUp(CLEAR_TABLES, PObjectNative.class,
|
||||||
"openjpa.jdbc.DBDictionary",
|
"openjpa.jdbc.DBDictionary",
|
||||||
|
|
|
@ -47,8 +47,7 @@ public class TestNewEntityAsQueryParameter extends SingleEMFTestCase {
|
||||||
public static final int MEMBER_COUNT_TOTAL = 8;
|
public static final int MEMBER_COUNT_TOTAL = 8;
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp(CLEAR_TABLES, Osoba.class, Projekt.class,
|
super.setUp(CLEAR_TABLES, Osoba.class, Projekt.class);
|
||||||
"openjpa.Log", "SQL=TRACE");
|
|
||||||
createData();
|
createData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +109,8 @@ public class TestNewEntityAsQueryParameter extends SingleEMFTestCase {
|
||||||
queryWithParameter(em, projekt1, projekt2);
|
queryWithParameter(em, projekt1, projekt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryWithParameter(EntityManager em, Projekt projekt1, Projekt projekt2) {
|
@SuppressWarnings("unchecked")
|
||||||
|
void queryWithParameter(EntityManager em, Projekt projekt1, Projekt projekt2) {
|
||||||
String jpql = "SELECT DISTINCT o FROM Osoba o WHERE :projekt MEMBER OF o.projekty";
|
String jpql = "SELECT DISTINCT o FROM Osoba o WHERE :projekt MEMBER OF o.projekty";
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
Query query = em.createQuery(jpql);
|
Query query = em.createQuery(jpql);
|
||||||
|
|
Loading…
Reference in New Issue