OPENJPA-947. Reduce testcase logging

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@755580 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2009-03-18 12:37:31 +00:00
parent ed8ec02432
commit 1d94611932
22 changed files with 34 additions and 102 deletions

View File

@ -600,6 +600,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>
<!-- TestPMMemory creates heapdumps etc and there's no real asserts within the test. -->
<exclude>org/apache/openjpa/persistence/kernel/TestPMMemory.java</exclude>
</excludes>
<systemProperties>

View File

@ -159,7 +159,6 @@ public class TestBadJdbcUrl extends TestCase {
assertNotNull(actual);
Class actualType = actual.getClass();
if (!targetType.isAssignableFrom(actualType)) {
actual.printStackTrace();
fail(targetType.getName() + " is not assignable from "
+ actualType.getName());
}
@ -178,7 +177,6 @@ public class TestBadJdbcUrl extends TestCase {
nested = next;
}
}
actual.printStackTrace();
fail("No nested type " + nestedTargetType + " in " + actual);
}
}

View File

@ -50,8 +50,7 @@ public class TestSpecificationConfiguration extends SingleEMFTestCase {
}
public void testLowerVersionCanBeSet() {
super.setUp("openjpa.Specification", "JPA 1.0",
"openjpa.Log", "DefaultLevel=WARN");
super.setUp("openjpa.Specification", "JPA 1.0");
Specification spec = getSpecifcation();
assertNotNull(spec);
@ -69,8 +68,7 @@ public class TestSpecificationConfiguration extends SingleEMFTestCase {
}
public void testDifferentSpecCanBeSet() {
super.setUp("openjpa.Specification", "jdo 3.0",
"openjpa.Log", "DefaultLevel=WARN");
super.setUp("openjpa.Specification", "jdo 3.0");
}
public void testSpecCanBeSetToNullString() {

View File

@ -225,7 +225,6 @@ public class TestOpenJPAConfiguration
config.setConnectionFactoryMode("aoeu");
fail("setting the ConnectionFactoryMode to aoeu should fail");
} catch (RuntimeException re) {
re.printStackTrace();
// as expected ... make sure the exception suggests the
// valid names in the message.
assertTrue(-1 != re.getMessage().indexOf("managed"));

View File

@ -572,11 +572,6 @@ public class TestCriteria extends SingleEMFTestCase {
+ "JPQL [" + jpql + "]\r\n"
+ "error : " + jpqlError.getMessage());
} else {
System.err.println("WARN: Both JPQL and QueryDefinition are invalid"
+ "\r\nJPQL " + jpql + "\r\n"
+ "error :" + jpqlError.getMessage() + "\r\n"
+ "Criteria " + qb.toJPQL(q) + "\r\n"
+ "error : " + criteriaError.getMessage());
compareLiterally(jpql, q);
}
}

View File

@ -58,7 +58,6 @@ public class TestStatistics extends SingleEMFTestCase {
*/
@SuppressWarnings("unchecked")
public void testPerfectCache() {
print(stats);
// populate a bunch of customer and order
int nCustomer = 20;
int nOrder = 10;
@ -102,12 +101,7 @@ public class TestStatistics extends SingleEMFTestCase {
}
void print(CacheStatistics stats) {
System.err
.print("r:" + stats.getTotalReadCount() + " w:"
+ stats.getTotalWriteCount() + " h:"
+ stats.getTotalHitCount());
System.err.println(" since last reset r:" + stats.getReadCount()
+ " w:" + stats.getWriteCount() + " h:" + stats.getHitCount());
// TODO log instead of printing to stderr.
}
}

View File

@ -1148,7 +1148,6 @@ public class TestEmbeddable extends SingleEMFTestCase {
}
public void createItem3(EntityManager em, int id) {
System.out.println("In CreateItem3, id = " + id);
Item3 item = new Item3();
item.setId(id);
for (int i = 0; i < numImagesPerItem; i++) {

View File

@ -696,8 +696,6 @@ public class TestEmbeddableXml extends SingleEMFTestCase {
createOrphanRemoval();
EntityManager em = emf.createEntityManager();
CustomerXml c = em.find(CustomerXml.class, 1);
System.err.println("C name = " + c.getName());
System.err.println("size before = " + c.getOrders().size());
c.setOrders(null);
em.getTransaction().begin();
em.persist(c);

View File

@ -125,10 +125,6 @@ public class RemoteEventBase extends AbstractTestCase {
for (Iterator iter = listener2.added.iterator(); iter.hasNext();) {
Id roid = Id.newInstance(RuntimeTest1.class, oid);
Id it = (Id) iter.next();
System.out.println("===ROID: " + roid.getId() + " +++== ITER: " +
it.getId() + " Content: " + listener2.added + "ROID Cont: " +
roid);
System.out.println("Result of COMP " + it.equals(roid));
//FixMe --det. why it.equals(roid) fails when the are actually equal
if (it.toString().equals(roid.toString())) {
pass = true;
@ -162,10 +158,6 @@ public class RemoteEventBase extends AbstractTestCase {
pass = false;
for (Iterator iter = listener2.updated.iterator(); iter.hasNext();) {
Id it = (Id) iter.next();
System.out.println("===ROID: " + roid.getId() + "+++== ITER: " +
it.getId() + "Content: " + listener2.added);
System.out.println("Result of COMP " + it.equals(roid));
if (it.toString().equals(roid.toString())) {
pass = true;
break;
@ -198,10 +190,6 @@ public class RemoteEventBase extends AbstractTestCase {
pass = false;
for (Iterator iter = listener2.deleted.iterator(); iter.hasNext();) {
Id it = (Id) iter.next();
System.out.println("===ROID: " + roid.getId() + "+++== ITER: " +
it.getId() + "Content: " + listener2.added);
System.out.println("Result of COMP " + it.equals(roid));
if (it.toString().equals(roid.toString())) {
pass = true;
break;

View File

@ -52,8 +52,7 @@ public class TestAutoIncrement extends SingleEMFTestCase {
} else {
super.setUp(CLEAR_TABLES, PObjectNative.class,
"openjpa.jdbc.DBDictionary",
"oracle(UseTriggersForAutoAssign=true)",
"openjpa.Log", "SQL=TRACE");
"oracle(UseTriggersForAutoAssign=true)");
}
}

View File

@ -41,6 +41,7 @@ public class TestQueryParameterBinding extends SingleEMFTestCase {
private static double DBL_VALUE = 3.0;
private EntityManager em;
@Override
public void setUp() throws Exception {
super.setUp(CLEAR_TABLES, Binder.class);

View File

@ -67,25 +67,13 @@ public class TestFinderCache extends SQLListenerTestCase {
}
public void testFinder() {
int N = 200;
emf = createEMF("openjpa.jdbc.FinderCache", "false");
run(1, Book.class, BOOK_IDS); // for warmup
assertNull(getCache());
long without = run(N, Book.class, BOOK_IDS);
emf = createEMF("openjpa.jdbc.FinderCache", "true");
assertNotNull(getCache());
long with = run(N, Book.class, BOOK_IDS);
getCache().getStatistics().dump(System.out);
long pct = (without-with)*100/without;
System.err.println(BOOK_IDS.length*N + " find");
System.err.println("with " + with);
System.err.println("without " + without);
System.err.println("delta " + (pct > 0 ? "+" : "") + pct + "%");
}
public void testSQLEventListener() {

View File

@ -292,7 +292,6 @@ public class TestPreparedQueryCache extends SQLListenerTestCase {
}
QueryStatistics stats = getCache().getStatistics();
stats.dump(System.out);
assertEquals(N1, stats.getExecutionCount(jpql1));
assertEquals(N2, stats.getExecutionCount(jpql2));
@ -339,8 +338,6 @@ public class TestPreparedQueryCache extends SQLListenerTestCase {
q2.getResultList();
}
stats.dump(System.out);
assertEquals(N11, stats.getExecutionCount(jpql1));
assertEquals(N21, stats.getExecutionCount(jpql2));
assertEquals(N11+N21, stats.getExecutionCount());
@ -464,21 +461,10 @@ public class TestPreparedQueryCache extends SQLListenerTestCase {
long delta = (without == 0) ? 0 : (without - with) * 100 / without;
String sql = getSQL(realJPQL);
log("Execution time in nanos for " + SAMPLE_SIZE
+ " query execution with and without SQL cache:" + with + " "
+ without + " (" + delta + "%)");
log("JPQL: " + realJPQL);
log("SQL : " + sql);
if (delta < 0) {
if (FAIL_ON_PERF_DEGRADE)
assertFalse("change in execution time = " + delta + "%",
delta < 0);
else
log("*** WARN: Perforamce regression with cache." +
" Execution time degrades by " + delta + "%");
} else {
log("change in execution time = +" + delta + "%");
}
}
@ -495,7 +481,6 @@ public class TestPreparedQueryCache extends SQLListenerTestCase {
*/
long run(String jpql, Object[] params, boolean useCache, int N,
boolean isNamedQuery, int expectedCount, boolean checkHits) {
trace("Executing " + N + " times " + (useCache ? " with " : "without") + " cache");
List<Long> stats = new ArrayList<Long>();
sql.clear();
for (int i = 0; i < N; i++) {
@ -559,15 +544,6 @@ public class TestPreparedQueryCache extends SQLListenerTestCase {
return "'"+s+"'";
}
void log(String s) {
System.err.println(s);
}
void trace(String s) {
if (Boolean.getBoolean("trace"))
System.err.println(s);
}
void walk(List list) {
Iterator i = list.iterator();
while (i.hasNext())

View File

@ -43,8 +43,7 @@ public class TestEJBNullValues extends AbstractTestCase {
fail("Null value allowed");
}
catch (Exception jfe) {
System.out
.println("Exception expected...Null value not allowed...");
// Exception expected...Null value not allowed...
}
endEm(pm);
}

View File

@ -38,8 +38,6 @@ public class TestPojoWithoutAnnotationsCannotBePersisted
}
public void setUp() {
System.out.println("Running test " + this.getName() + " of " +
this.getClass().getSimpleName());
pojo = new UnAnnotPojo();
pojo.setName("failure");
pojo.setNum(0);

View File

@ -43,8 +43,7 @@ public abstract class AbstractNullityTestCase extends SingleEMFTestCase {
fail();
} catch (Exception e) {
if (!expected.isAssignableFrom(e.getClass())) {
e.printStackTrace();
fail("Expected " + expected.getName());
fail("Expected " + expected.getName() + " receieved " + e);
}
}
}
@ -56,11 +55,7 @@ public abstract class AbstractNullityTestCase extends SingleEMFTestCase {
em.persist(pc);
else
em.merge(pc);
try {
em.getTransaction().commit();
} catch (RuntimeException e) {
e.printStackTrace();
fail();
}
em.getTransaction().commit();
}
}

View File

@ -44,7 +44,6 @@ public class TestChainEntities extends SingleEMFTestCase {
aid = a.getId ();
em.getTransaction ().commit ();
em.close ();
System.out.println ("ChainEntityA id = " + aid);
}
public void testChainEntities () {

View File

@ -35,14 +35,12 @@ public class LibServiceImpl implements LibService {
private void closeEM(EntityManager em) {
if (em != null && em.isOpen()) {
System.out.println("Closing EM: " + em);
em.close();
}
}
private EntityManager openEM() {
EntityManager em = txEMF.getTransactionalEntityManager();
System.out.println("Opening EM: " + em);
return em;
}

View File

@ -81,7 +81,6 @@ public class TestLibService extends SingleEMFTestCase
"unexpected number of subjects for the book " + qTitle, 2,
subjects.size());
} catch (Exception e) {
e.printStackTrace();
fail("Unable to findBookByTitle");
}
}
@ -98,7 +97,6 @@ public class TestLibService extends SingleEMFTestCase
assertEquals("the borrower found is not " + bName, bName,
harry.getName());
} catch (Exception e) {
e.printStackTrace();
fail("Unable to find borrower by name");
}
}

View File

@ -47,6 +47,8 @@ import org.apache.openjpa.meta.ClassMetaData;
import org.apache.openjpa.persistence.JPAFacadeHelper;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import sun.security.action.GetLongAction;
/**
* Base test class providing persistence utilities.
*
@ -508,9 +510,6 @@ public abstract class PersistenceTestCase
// swallow;
}
}
System.err.println("WARN: " + getClass().getName() + " not run " +
"in the current platform because none of the specified " +
" driver(s) " + Arrays.toString(drivers) + " can be loaded");
}
return false;
}

View File

@ -34,11 +34,11 @@
<version>2.0.0-SNAPSHOT</version>
</parent>
<properties>
<test.jvm.arguments>-Xmx500m</test.jvm.arguments>
<openjpa.loglevel>INFO</openjpa.loglevel>
<!-- to set debug arguments, you might set the following at the command line:
-Dsurefire.jvm.args="-Xmx500m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"
-Dtest.jvm.args="-Xmx500m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"
-->
<surefire.jvm.args>-Xmx500m</surefire.jvm.args>
</properties>
<dependencies>
<dependency>
@ -147,6 +147,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${test.jvm.arguments}</argLine>
<systemProperties>
<property>
<name>openjpa.Log</name>
<value>DefaultLevel=${openjpa.loglevel}</value>
</property>
<property>
<name>derby.stream.error.file</name>
<value>target/derby.log</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -23,9 +23,6 @@
<class>org.apache.openjpa.slice.Person</class>
<class>org.apache.openjpa.slice.Address</class>
<class>org.apache.openjpa.slice.Country</class>
<properties>
<property name="openjpa.Log" value="DefaultLevel=WARN, Enhance=TRACE"/>
</properties>
</persistence-unit>
@ -42,7 +39,6 @@
<property name="openjpa.slice.DistributionPolicy" value="org.apache.openjpa.slice.policy.UserDistributionPolicy"/>
<property name="openjpa.slice.ThreadingPolicy" value="fixed"/>
<property name="openjpa.Log" value="DefaultLevel=INFO, Enhance=TRACE, SQL=TRACE"/>
<property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="openjpa.ConnectionUserName" value=""/>
<property name="openjpa.ConnectionPassword" value=""/>
@ -70,7 +66,6 @@
<property name="openjpa.slice.Two.ConnectionURL" value="jdbc:derby:target/database/openjpa-slice2;create=true"/>
<property name="openjpa.Multithreaded" value="false"/>
<property name="openjpa.Log" value="DefaultLevel=INFO, Enhance=TRACE, SQL=TRACE"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="refresh"/>
<property name="openjpa.jdbc.MappingDefaults" value="DefaultMissingInfo=true"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>
@ -100,7 +95,6 @@
<property name="openjpa.Connection2URL" value="jdbc:derby:target/database/openjpa-slice1;create=true"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
<property name="openjpa.QueryCompilationCache" value="false"/>
<property name="openjpa.Log" value="DefaultLevel=WARN, Enhance=TRACE, SQL=TRACE"/>
<property name="openjpa.jdbc.MappingDefaults" value="DefaultMissingInfo=true"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>
</properties>
@ -123,7 +117,6 @@
<property name="openjpa.Connection2URL" value="jdbc:derby:target/database/openjpa-slice1;create=true"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
<property name="openjpa.Log" value="DefaultLevel=WARN, Enhance=TRACE, SQL=TRACE"/>
<property name="openjpa.jdbc.MappingDefaults" value="DefaultMissingInfo=true"/>
</properties>
</persistence-unit>
@ -144,7 +137,6 @@
<property name="openjpa.slice.Two.ConnectionURL" value="jdbc:mysql://localhost/slice2"/>
<property name="openjpa.Multithreaded" value="false"/>
<property name="openjpa.Log" value="DefaultLevel=INFO, Enhance=TRACE, SQL=TRACE"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="refresh"/>
<property name="openjpa.jdbc.MappingDefaults" value="DefaultMissingInfo=true"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>