Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 5959 invoked from network); 28 Oct 2005 09:46:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Oct 2005 09:46:51 -0000 Received: (qmail 95721 invoked by uid 500); 28 Oct 2005 09:46:50 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Received: (qmail 95710 invoked by uid 99); 28 Oct 2005 09:46:50 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 28 Oct 2005 02:46:49 -0700 Received: (qmail 5731 invoked by uid 65534); 28 Oct 2005 09:46:29 -0000 Message-ID: <20051028094627.5539.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r329175 - in /incubator/jdo/trunk/tck20/test: conf/ java/org/apache/jdo/tck/query/jdoql/ testdata/org/apache/jdo/tck/pc/mylib/ Date: Fri, 28 Oct 2005 09:40:31 -0000 To: jdo-commits@db.apache.org From: brazil@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: brazil Date: Fri Oct 28 02:39:17 2005 New Revision: 329175 URL: http://svn.apache.org/viewcvs?rev=329175&view=rev Log: JDO-162: Implement new JDO 2 query tests cases concerning other language changes. Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java Modified: incubator/jdo/trunk/tck20/test/conf/alltests.conf incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml Modified: incubator/jdo/trunk/tck20/test/conf/alltests.conf URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/conf/alltests.conf?rev=329175&r1=329174&r2=329175&view=diff ============================================================================== --- incubator/jdo/trunk/tck20/test/conf/alltests.conf (original) +++ incubator/jdo/trunk/tck20/test/conf/alltests.conf Fri Oct 28 02:39:17 2005 @@ -282,12 +282,14 @@ org.apache.jdo.tck.query.api.SetterReplacePreviousValues \ org.apache.jdo.tck.query.jdoql.AssignmentPrePostIncrementDecrementNotSupported \ org.apache.jdo.tck.query.jdoql.Cast \ +org.apache.jdo.tck.query.jdoql.CharacterAndStringLiterals \ org.apache.jdo.tck.query.jdoql.ComparingCollectionFieldToNull \ org.apache.jdo.tck.query.jdoql.ComparingPersistentAndNonPersistentInstance \ org.apache.jdo.tck.query.jdoql.DenoteUniquenessInFilter \ org.apache.jdo.tck.query.jdoql.ExecuteQueryWhenPersistenceManagerIsClosed \ org.apache.jdo.tck.query.jdoql.ExecutingMultipleQueriesSimultaneouslyIsThreadSafe \ org.apache.jdo.tck.query.jdoql.ExecutingQueryWhenNoTransactionNoNontransactionalRead \ +org.apache.jdo.tck.query.jdoql.IdentifiersEqualFieldNames \ org.apache.jdo.tck.query.jdoql.IgnoreCacheFalse \ org.apache.jdo.tck.query.jdoql.MultipleActiveQueryInstanceInSamePersistenceManager \ org.apache.jdo.tck.query.jdoql.MultipleIdenticalImports \ @@ -295,13 +297,16 @@ org.apache.jdo.tck.query.jdoql.NavigationThroughACollectionField \ org.apache.jdo.tck.query.jdoql.NavigationThroughANullValuedField \ org.apache.jdo.tck.query.jdoql.NavigationThroughReferencesUsesDotOperator \ +org.apache.jdo.tck.query.jdoql.NegativeRange \ org.apache.jdo.tck.query.jdoql.NullCollectionsAndContainsMethod \ org.apache.jdo.tck.query.jdoql.NullCollectionsAndIsEmpty \ org.apache.jdo.tck.query.jdoql.OrderingSpecification \ org.apache.jdo.tck.query.jdoql.ParenthesesMarkOperatorPrecedence \ +org.apache.jdo.tck.query.jdoql.PositiveRange \ org.apache.jdo.tck.query.jdoql.QueryIsSerializable \ org.apache.jdo.tck.query.jdoql.QueryResultPassedToAnotherQuery \ org.apache.jdo.tck.query.jdoql.QueryWithNoFilter \ +org.apache.jdo.tck.query.jdoql.RangeAsString \ org.apache.jdo.tck.query.jdoql.RestoredSerializedQueryInstanceLosesAssociationWithPM \ org.apache.jdo.tck.query.jdoql.SeparateNamespaceForTypeNames \ org.apache.jdo.tck.query.jdoql.WhiteSpaceIsACharacterAndIgnored \ Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java?rev=329175&view=auto ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java Fri Oct 28 02:39:17 2005 @@ -0,0 +1,161 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed 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.jdo.tck.query.jdoql; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.MylibReader; +import org.apache.jdo.tck.pc.mylib.PrimitiveTypes; +import org.apache.jdo.tck.query.QueryElementHolder; +import org.apache.jdo.tck.query.QueryTest; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Character and String Literals. + *
+ *Keywords: query + *
+ *Assertion ID: A14.6.2-42. + *
+ *Assertion Description: + * There is no distinction made between character literals and + * String literals. Single character String literals can be used + * wherever character literals are permitted. + * String literals are allowed to be delimited by single quote marks + * or double quote marks. This allows String literal filters + * to use single quote marks instead of escaped double quote marks. + */ +public class CharacterAndStringLiterals extends QueryTest { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A14.6.2-42 (CharacterAndStringLiterals) failed: "; + + /** + * The array of invalid queries which may be executed as + * single string queries and as API queries. + */ + private static final QueryElementHolder[] INVALID_QUERIES = { + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ PrimitiveTypes.class, + /*EXCLUDE*/ null, + /*WHERE*/ "charNotNull == 'O.'", + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ null, + /*TO*/ null), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ PrimitiveTypes.class, + /*EXCLUDE*/ null, + /*WHERE*/ "charNotNull == \"O.\"", + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ null, + /*TO*/ null) + }; + + /** + * The array of valid queries which may be executed as + * single string queries and as API queries. + */ + private static final QueryElementHolder[] VALID_QUERIES = { + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ PrimitiveTypes.class, + /*EXCLUDE*/ null, + /*WHERE*/ "stringNull.startsWith('Even') || charNotNull == 'O'", + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ null, + /*TO*/ null), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ PrimitiveTypes.class, + /*EXCLUDE*/ null, + /*WHERE*/ "stringNull.startsWith(\"Even\") || charNotNull == \"O\"", + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ null, + /*TO*/ null) + }; + + /** The expected results of valid queries. */ + private static String[][] expectedResult = { + {"primitiveTypesCharacterStringLiterals"} + }; + + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(CharacterAndStringLiterals.class); + } + + /** */ + public void testPositive() { + if (isUnconstrainedVariablesSupported()) { + for (int i = 0; i < VALID_QUERIES.length; i++) { + Object[] expectedResultValues = + getMylibInstances(expectedResult[i]); + executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], + expectedResultValues); + executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], + expectedResultValues); + } + } + } + + /** */ + public void testNegative() { + for (int i = 0; i < INVALID_QUERIES.length; i++) { + compileAPIQuery(ASSERTION_FAILED, INVALID_QUERIES[i], false); + compileSingleStringQuery(ASSERTION_FAILED, INVALID_QUERIES[i], + false); + } + } + + /** + * @see JDO_Test#localSetUp() + */ + protected void localSetUp() { + loadMylib(getPM(), MYLIB_TESTDATA); + addTearDownClass(MylibReader.getTearDownClasses()); + } +} Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java?rev=329175&view=auto ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java Fri Oct 28 02:39:17 2005 @@ -0,0 +1,113 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed 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.jdo.tck.query.jdoql; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.company.CompanyModelReader; +import org.apache.jdo.tck.pc.company.Person; +import org.apache.jdo.tck.query.QueryElementHolder; +import org.apache.jdo.tck.query.QueryTest; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Identifiers Equal Field Names. + *
+ *Keywords: query + *
+ *Assertion ID: A14.6.2-43. + *
+ *Assertion Description: + * Identifiers that are persistent field names or + * public final static field names are required + * to be supported by JDO implementations. + */ +public class IdentifiersEqualFieldNames extends QueryTest { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A14.6.2-43 (IdentifiersEqualFieldNames) failed: "; + + /** + * The array of valid queries which may be executed as + * single string queries and as API queries. + */ + private static final QueryElementHolder[] VALID_QUERIES = { + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ "this.firstname == 'emp1First'", + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ null, + /*TO*/ null), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ "this.personid < Byte.MAX_VALUE", + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ null, + /*TO*/ null) + }; + + /** The expected results of valid queries. */ + private static String[][] expectedResult = { + {"emp1"}, + {"emp1", "emp2", "emp3", "emp4", "emp5"} + }; + + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(IdentifiersEqualFieldNames.class); + } + + /** */ + public void testPositive() { + for (int i = 0; i < VALID_QUERIES.length; i++) { + Object[] expectedResultValues = + getCompanyModelInstances(expectedResult[i]); + executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], + expectedResultValues); + executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], + expectedResultValues); + } + } + + /** + * @see JDO_Test#localSetUp() + */ + protected void localSetUp() { + loadCompanyModel(getPM(), COMPANY_TESTDATA); + addTearDownClass(CompanyModelReader.getTearDownClasses()); + } +} Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java?rev=329175&view=auto ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java Fri Oct 28 02:39:17 2005 @@ -0,0 +1,143 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed 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.jdo.tck.query.jdoql; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.company.CompanyModelReader; +import org.apache.jdo.tck.pc.company.Person; +import org.apache.jdo.tck.query.QueryElementHolder; +import org.apache.jdo.tck.query.QueryTest; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Negative Range. + *
+ *Keywords: query + *
+ *Assertion ID: A14.6.8-2. + *
+ *Assertion Description: + * If ((toExcl - fromIncl) <= 0) evaluates to true, if the result of the query + * execution is a List, the returned List contains no instances, + * and an Iterator obtained from the List returns false to hasNext(). + * If the result of the query execution is a single instance (setUnique(true)), + * it will have a value of null. + */ +public class NegativeRange extends QueryTest { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A14.6.8-2 (NegativeRange) failed: "; + + /** + * The array of valid queries which may be executed as + * single string queries and as API queries. + */ + private static final QueryElementHolder[] VALID_QUERIES = { + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ 4, + /*TO*/ 4), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ 4, + /*TO*/ 3), + new QueryElementHolder( + /*UNIQUE*/ Boolean.TRUE, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ 4, + /*TO*/ 4), + new QueryElementHolder( + /*UNIQUE*/ Boolean.TRUE, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ null, + /*FROM*/ 4, + /*TO*/ 3) + }; + + /** The expected results of valid queries. */ + private static String[][] expectedResult = { + {}, + {}, + {null}, + {null} + }; + + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(NegativeRange.class); + } + + /** */ + public void testPositive() { + 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]); + } + } + + /** + * @see JDO_Test#localSetUp() + */ + protected void localSetUp() { + loadCompanyModel(getPM(), COMPANY_TESTDATA); + addTearDownClass(CompanyModelReader.getTearDownClasses()); + } +} Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java?rev=329175&view=auto ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java Fri Oct 28 02:39:17 2005 @@ -0,0 +1,141 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed 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.jdo.tck.query.jdoql; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.company.CompanyModelReader; +import org.apache.jdo.tck.pc.company.Person; +import org.apache.jdo.tck.query.QueryElementHolder; +import org.apache.jdo.tck.query.QueryTest; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Positive Range. + *
+ *Keywords: query + *
+ *Assertion ID: A14.6.8-1. + *
+ *Assertion Description: + * setRange(long fromIncl, long toExcl) + */ +public class PositiveRange extends QueryTest { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A14.6.8-1 (PositiveRange) failed: "; + + /** + * The array of valid queries which may be executed as + * single string queries and as API queries. + */ + private static final QueryElementHolder[] VALID_QUERIES = { + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "personid ASCENDING", + /*FROM*/ 0, + /*TO*/ 5), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "personid ASCENDING", + /*FROM*/ 0, + /*TO*/ 4), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "personid ASCENDING", + /*FROM*/ 1, + /*TO*/ 5), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "personid ASCENDING", + /*FROM*/ 1, + /*TO*/ 4) + }; + + /** The expected results of valid queries. */ + private static String[][] expectedResult = { + {"emp1", "emp2", "emp3", "emp4", "emp5"}, + {"emp1", "emp2", "emp3", "emp4"}, + {"emp2", "emp3", "emp4", "emp5"}, + {"emp2", "emp3", "emp4"} + }; + + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(PositiveRange.class); + } + + /** */ + public void testPositive() { + for (int i = 0; i < VALID_QUERIES.length; i++) { + Object[] expectedResultValues = + getCompanyModelInstances(expectedResult[i]); + executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], + expectedResultValues); + executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], + expectedResultValues); + } + } + + /** + * @see JDO_Test#localSetUp() + */ + protected void localSetUp() { + loadCompanyModel(getPM(), COMPANY_TESTDATA); + addTearDownClass(CompanyModelReader.getTearDownClasses()); + } +} Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java?rev=329175&view=auto ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java Fri Oct 28 02:39:17 2005 @@ -0,0 +1,141 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed 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.jdo.tck.query.jdoql; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.company.CompanyModelReader; +import org.apache.jdo.tck.pc.company.Person; +import org.apache.jdo.tck.query.QueryElementHolder; +import org.apache.jdo.tck.query.QueryTest; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *Title: Range as String. + *
+ *Keywords: query + *
+ *Assertion ID: A14.6.8-3. + *
+ *Assertion Description: + * setRange(String range); + */ +public class RangeAsString extends QueryTest { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A14.6.8-3 (RangeAsString) failed: "; + + /** + * The array of valid queries which may be executed as + * single string queries and as API queries. + */ + private static final QueryElementHolder[] VALID_QUERIES = { + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "personid ASCENDING", + /*FROM*/ "0", + /*TO*/ "5"), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "personid ASCENDING", + /*FROM*/ "0", + /*TO*/ "4"), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "personid ASCENDING", + /*FROM*/ "1", + /*TO*/ "5"), + new QueryElementHolder( + /*UNIQUE*/ null, + /*RESULT*/ null, + /*INTO*/ null, + /*FROM*/ Person.class, + /*EXCLUDE*/ null, + /*WHERE*/ null, + /*VARIABLES*/ null, + /*PARAMETERS*/ null, + /*IMPORTS*/ null, + /*GROUP BY*/ null, + /*ORDER BY*/ "personid ASCENDING", + /*FROM*/ "1", + /*TO*/ "4") + }; + + /** The expected results of valid queries. */ + private static String[][] expectedResult = { + {"emp1", "emp2", "emp3", "emp4", "emp5"}, + {"emp1", "emp2", "emp3", "emp4"}, + {"emp2", "emp3", "emp4", "emp5"}, + {"emp2", "emp3", "emp4"} + }; + + /** + * The main is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(RangeAsString.class); + } + + /** */ + public void testPositive() { + for (int i = 0; i < VALID_QUERIES.length; i++) { + Object[] expectedResultValues = + getCompanyModelInstances(expectedResult[i]); + executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], + expectedResultValues); + executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], + expectedResultValues); + } + } + + /** + * @see JDO_Test#localSetUp() + */ + protected void localSetUp() { + loadCompanyModel(getPM(), COMPANY_TESTDATA); + addTearDownClass(CompanyModelReader.getTearDownClasses()); + } +} Modified: incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml?rev=329175&r1=329174&r2=329175&view=diff ============================================================================== --- incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml (original) +++ incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml Fri Oct 28 02:39:17 2005 @@ -9,11 +9,13 @@ + - + 1 4 4 @@ -25,7 +27,8 @@ 4.0 - + 2 -4 -4 @@ -37,5 +40,12 @@ -4.0 - + + 3 + O + O + Even + +