Index: tck/src/java/org/apache/jdo/tck/query/delete/DeletePersistentAll.java =================================================================== --- tck/src/java/org/apache/jdo/tck/query/delete/DeletePersistentAll.java (revision 1626900) +++ tck/src/java/org/apache/jdo/tck/query/delete/DeletePersistentAll.java (working copy) @@ -97,13 +97,13 @@ /** */ public void testNoParametersAPI() { deletePersistentAllByAPIQuery(ASSERTION_FAILED, - VALID_QUERIES[0], null, 10); + VALID_QUERIES[0], null, 11); } /** */ public void testNoParametersSingleString() { deletePersistentAllBySingleStringQuery(ASSERTION_FAILED, - VALID_QUERIES[0], null, 10); + VALID_QUERIES[0], null, 11); } /** */ Index: tck/src/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java =================================================================== --- tck/src/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java (revision 1626900) +++ tck/src/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java (working copy) @@ -27,8 +27,11 @@ import javax.jdo.Transaction; import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.company.CompanyModelReader; +import org.apache.jdo.tck.pc.company.DentalInsurance; import org.apache.jdo.tck.pc.fieldtypes.AllTypes; import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.query.QueryElementHolder; import org.apache.jdo.tck.query.QueryTest; import org.apache.jdo.tck.util.BatchTestRunner; @@ -58,6 +61,54 @@ private static final String ASSERTION_FAILED = "Assertion A14.6.6-1 (OrderingSpecification) failed: "; + /** + * The array of valid queries which may be executed as + * single string queries and as API queries. + */ + private static final QueryElementHolder[] VALID_QUERIES = { + // nulls first + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ DentalInsurance.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "this.lifetimeOrthoBenefit ascending nulls first", + /*FROM*/ null, + /*TO*/ null), + // nulls last + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ DentalInsurance.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "this.lifetimeOrthoBenefit ascending nulls last", + /*FROM*/ null, + /*TO*/ null) + }; + + /** + * The expected results of valid queries. + */ + private Object[] expectedResult = { + // isEmpty + getTransientCompanyModelInstancesAsList(new String[]{ + "dentalIns99", "dentalIns1", "dentalIns2", "dentalIns3", "dentalIns4", "dentalIns5"}), + getTransientCompanyModelInstancesAsList(new String[]{ + "dentalIns1", "dentalIns2", "dentalIns3", "dentalIns4", "dentalIns5", "dentalIns99"}) + }; + /** * The main is called when the class * is directly executed from the command line. @@ -68,6 +119,14 @@ } /** */ + public void testPositiveCompanyQueries() { + for (int i = 0; i < VALID_QUERIES.length; i++) { + executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], expectedResult[i]); + executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], expectedResult[i]); + } + } + + /** */ public void testPositive() { PersistenceManager pm = getPM(); @@ -194,5 +253,7 @@ protected void localSetUp() { addTearDownClass(PCPoint.class); loadAndPersistPCPoints(getPM()); + addTearDownClass(CompanyModelReader.getTearDownClasses()); + loadAndPersistCompanyModel(getPM()); } } Index: tck/src/java/org/apache/jdo/tck/query/result/AggregateResult.java =================================================================== --- tck/src/java/org/apache/jdo/tck/query/result/AggregateResult.java (revision 1626900) +++ tck/src/java/org/apache/jdo/tck/query/result/AggregateResult.java (working copy) @@ -562,7 +562,7 @@ // AVG(double) new Double(25000.0), // AVG(BigDecimal) - new Double("99.999"), + new Double("99.997"), // AVG(lifetimeOrthoBenefit) null, // AVG(((FullTimeEmployee)manager).salary) Index: tck/src/java/org/apache/jdo/tck/query/result/DefaultUnique.java =================================================================== --- tck/src/java/org/apache/jdo/tck/query/result/DefaultUnique.java (revision 1626900) +++ tck/src/java/org/apache/jdo/tck/query/result/DefaultUnique.java (working copy) @@ -161,7 +161,7 @@ /*INTO*/ null, /*FROM*/ DentalInsurance.class, /*EXCLUDE*/ null, - /*WHERE*/ null, + /*WHERE*/ "employee != null", /*VARIABLES*/ null, /*PARAMETERS*/ null, /*IMPORTS*/ null, @@ -175,7 +175,7 @@ /*INTO*/ null, /*FROM*/ DentalInsurance.class, /*EXCLUDE*/ null, - /*WHERE*/ null, + /*WHERE*/ "employee != null", /*VARIABLES*/ null, /*PARAMETERS*/ null, /*IMPORTS*/ null, @@ -189,7 +189,7 @@ /*INTO*/ null, /*FROM*/ DentalInsurance.class, /*EXCLUDE*/ null, - /*WHERE*/ null, + /*WHERE*/ "employee != null", /*VARIABLES*/ null, /*PARAMETERS*/ null, /*IMPORTS*/ null, @@ -203,7 +203,7 @@ /*INTO*/ null, /*FROM*/ DentalInsurance.class, /*EXCLUDE*/ null, - /*WHERE*/ null, + /*WHERE*/ "employee != null", /*VARIABLES*/ null, /*PARAMETERS*/ null, /*IMPORTS*/ null, @@ -221,16 +221,16 @@ "emp1", "emp2", "emp3", "emp4", "emp5"}), // results for aggregate queries new Long(5), - new Double("99.999"), + new Double("99.997"), new BigDecimal("2000.99"), new BigDecimal("2500000.99"), new BigDecimal("2552001.98"), // results for aggregate queries with grouping Arrays.asList(new Object[]{new Long(3), new Long(2)}), - Arrays.asList(new Object[]{new Double("99.999"), new Double("99.999")}), - Arrays.asList(new Object[]{new BigDecimal("99.999"), new BigDecimal("99.999")}), - Arrays.asList(new Object[]{new BigDecimal("99.999"), new BigDecimal("99.999")}), - Arrays.asList(new Object[]{new BigDecimal("299.997"), new BigDecimal("199.998")}) + Arrays.asList(new Object[]{new Double("99.996"), new Double("99.9985")}), + Arrays.asList(new Object[]{new BigDecimal("99.995"), new BigDecimal("99.998")}), + Arrays.asList(new Object[]{new BigDecimal("99.997"), new BigDecimal("99.999")}), + Arrays.asList(new Object[]{new BigDecimal("299.988"), new BigDecimal("199.997")}) }; /** Index: tck/src/testdata/org/apache/jdo/tck/pc/company/companyForQueryTests.xml =================================================================== --- tck/src/testdata/org/apache/jdo/tck/pc/company/companyForQueryTests.xml (revision 1626900) +++ tck/src/testdata/org/apache/jdo/tck/pc/company/companyForQueryTests.xml (working copy) @@ -24,6 +24,7 @@ + @@ -346,28 +347,28 @@ 11 Carrier1 - 99.999 + 99.995 12 Carrier2 - 99.999 + 99.996 13 Carrier3 - 99.999 + 99.997 14 Carrier4 - 99.999 + 99.998 @@ -378,6 +379,12 @@ + + 99 + Carrier99 + + + 1 orange