A couple of thoughts on the testcases for Criteria : The JDBCListener included in CriteriaTest is set once in createNamedEMF(), as a result a single Listener is created which is then shared by each test method. This in itself wouldn't be a problem but the listener stores the executed SQL in an member variable which is then used in assert methods within the testcase. When the test runs in Eclipse or Maven each test method gets it's own copy of the member variable - but the listener logs to the first one.
So the first test compares two SQL strings, but each test after that compares two empty lists (verified by sysout.printlns and running in the Eclipse debugger). To resolve the problem we can make the SQL list static (ugly) or register a new listener (and a new EMF) in setUp(). In addition the tearDown method in CriteriaTest is intentionally left empty - so we're potentially leaking EMs and a single EMF. This leak would be worse if we create a separate EMF in setUp - we'll want to do some cleanup if we take the latter approach. I believe making this change will cause all the tests in TestSubqueries to fail and may affect other subclasses of TestCriteria. I'm not sure what the rationale was for making the tearDown method a no-op though - so I'm hesitant to go ahead and make a change. What's more interesting is that at least some of the tests (noticed in TestSubqueries and TestTypeSafeCriteria fail when executed in a normal build, but pass when executed individually (-Dtest=xxx). The errors look like this : java.lang.IllegalArgumentException: class org.apache.openjpa.persistence.criteria.Employee is not an entity at org.apache.openjpa.persistence.criteria.CriteriaQueryImpl.from(CriteriaQueryImpl.java:188) at org.apache.openjpa.persistence.criteria.TestTypesafeCriteria.testGeneralCaseExpression(TestTypesafeCriteria.java:422) Which makes little sense to me, might be a problem in my environment - I've only seen this behavior on 64 bit Linux. Anyone else seeing it on other platforms (ie Windows)? -mike On Thu, Jun 18, 2009 at 11:09 AM, Michael Dick <[email protected]>wrote: > Reverting that change didn't seem to do the trick for me. Will try to take > a closer look when I get some free cycles. > > -mike > > > On Thu, Jun 18, 2009 at 10:11 AM, Donald Woods <[email protected]> wrote: > >> No, I just excluded the criteria tests in o-p-j/pom.xml for now so I can >> continue my bean validation work - >> >> <exclude>org/apache/openjpa/persistence/criteria/*.java</exclude> >> >> >> -Donald >> >> >> >> Michael Dick wrote: >> >>> I've noticed that too. Unfortunately I was having permGenSize issues on >>> my >>> CI system around the same time as those changes were introduced. So it's >>> a >>> little muddy. >>> >>> Have you tried reverting rev 785431? I'll give that a quick try if you >>> haven't done so already.. >>> >>> -mike >>> >>> On Thu, Jun 18, 2009 at 8:14 AM, Donald Woods <[email protected]> wrote: >>> >>> No, it seems to be related to changes introduced by the criteria work in >>>> OPENJPA-1013... >>>> >>>> >>>> -Donald >>>> >>>> >>>> >>>> Craig L Russell wrote: >>>> >>>> Could it be related to the recent checkin that hard casts the JDBC >>>>> types >>>>> instead of using reflection? There are known incompatibilities between >>>>> JDBC3 >>>>> and JDBC4 that you might be running into. >>>>> >>>>> Craig >>>>> >>>>> On Jun 17, 2009, at 5:10 PM, Donald Woods wrote: >>>>> >>>>> Looked at some other builds and everything is passing on: >>>>> >>>>>> IBM SDK 5, IBM SDK 6 and Sun JDK 5 >>>>>> but fails on Sun JDK 6..... >>>>>> >>>>>> >>>>>> -Donald >>>>>> >>>>>> >>>>>> Donald Woods wrote: >>>>>> >>>>>> Is anyone else seeing new failures on trunk in the last day in o-p-j >>>>>>> like the following (used default Derby and Sun JDK6) - >>>>>>> Tests run: 1885, Failures: 24, Errors: 123, Skipped: 0 >>>>>>> Tests in error: >>>>>>> >>>>>>> testTypeExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testKeyExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testIndexExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testCaseExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testGroupByAndHaving(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSimpleCaseExpression1(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSimpleCaseExpression2(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testExplictRoot(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testImplicitRoot(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testEqualWithAttributeAndLiteral(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testEqualWithAttributeAndAttribute(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testProjection(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testAbsExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testAvgExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testInPredicate(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testInPredicateWithPath(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testBinaryPredicate(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testEqualWithAttributeAndUnaryExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testBetweenExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSimplePath(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSimpleLeftJoin(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testMultiLevelJoins(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testJoinsNotPresentInWhereClause(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testJoinedPathInProjection(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testIsEmptyExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testExpressionInProjection(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testIndexExpressionAndLietral(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testAggregateInProjection(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSizeExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testExpression1(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testExpression3(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testGeneralCaseExpression(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testLiterals(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testParameters1(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testParameters2(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testParameters3(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testParameters4(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testNewConstruct(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testConstructorInProjection(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSubqueries1(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSubqueries2(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSubqueries3(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSubqueries4(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testSubqueries5(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testOrdering1(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testOrdering2(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> >>>>>>> testOrdering3(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> >>>>>>> testOrdering4(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> >>>>>>> testOrdering5(org.apache.openjpa.persistence.criteria.TestTypesafeCriteria) >>>>>>> >>>>>>> testExist(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> testNotExist(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> testAny(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery01(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery02(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery03(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery04(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery05(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery06(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery07(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery09(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery11(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery12(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery14(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery15(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery16(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery17(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery18(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery19(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery20(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testSubquery23(org.apache.openjpa.persistence.criteria.TestSubqueries) >>>>>>> >>>>>>> testBetween(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testNothingUsingCriteria(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testNotBetween(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testInExpr(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testNotIn(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testLike1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testLike2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testLike3(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testLikeWithEscapeCharacter(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testNullExpression(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testNullExpr2UsingCriteria(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testIsEmptyExprUsingCriteria(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testConstructorExprUsingCriteria(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testConcatSubStringFunc1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testConcatSubStringFunc2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testConcatSubStringFunc3(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testConcatSubStringFunc4(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testConcatFunc(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTrimFunc1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTrimFunc2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testLowerFunc1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testLowerFunc2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testUpperFunc1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testUpperFunc2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testLengthFunc(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testArithmFunc1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testArithmFunc2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testArithmFunc3(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testArithmFunc4(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testGroupByHavingClause(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testOrderByClause(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testAVGAggregFunc(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testCOUNTAggregFunc(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testMAXAggregFunc(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testMINAggregFunc(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testSUMAggregFunc(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTypeExpression1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTypeExpression2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTypeExpression3(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTypeExpression4(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTypeExpression5(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTypeExpression6(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testTypeExpression9(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testCoalesceExpressions(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testNullIfExpressions(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testSimpleCaseExpression1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testSimpleCaseExpression2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testSimpleCaseExpression3(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testSimpleCaseExpression4(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testGeneralCaseExpression1(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testGeneralCaseExpression2(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testGeneralCaseExpression3(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> testGeneralCaseExpression4(org.apache.openjpa.persistence.criteria.TestTypeSafeCondExpression) >>>>>>> >>>>>>> >>>>>>> Craig L Russell >>>>> Architect, Sun Java Enterprise System http://db.apache.org/jdo >>>>> 408 276-5638 mailto:[email protected] >>>>> P.S. A good JDO? O, Gasp! >>>>> >>>>> >>>>> >>> >
