You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by br...@apache.org on 2005/10/28 11:40:31 UTC

svn commit: r329175 - in /incubator/jdo/trunk/tck20/test: conf/ java/org/apache/jdo/tck/query/jdoql/ testdata/org/apache/jdo/tck/pc/mylib/

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;
+
+/**
+ *<B>Title:</B> Character and String Literals.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-42.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * 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 <code>main</code> 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;
+
+/**
+ *<B>Title:</B> Identifiers Equal Field Names.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-43.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * 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 <code>main</code> 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;
+
+/**
+ *<B>Title:</B> Negative Range.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.8-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * 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 <code>main</code> 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;
+
+/**
+ *<B>Title:</B> Positive Range.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.8-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * 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 <code>main</code> 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;
+
+/**
+ *<B>Title:</B> Range as String.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.8-3.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * 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 <code>main</code> 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 @@
             <list>
                 <ref local="primitiveTypesPositive"/>
                 <ref local="primitiveTypesNegative"/>
+                <ref local="primitiveTypesCharacterStringLiterals"/>
             </list>
         </constructor-arg>
     </bean>
 
-    <bean id="primitiveTypesPositive" class="org.apache.jdo.tck.pc.mylib.PrimitiveTypes">
+    <bean id="primitiveTypesPositive" 
+        class="org.apache.jdo.tck.pc.mylib.PrimitiveTypes">
         <property name="id"><value>1</value></property>
         <property name="intNotNull"><value>4</value></property>
         <property name="intNull"><value>4</value></property>
@@ -25,7 +27,8 @@
         <property name="doubleNull"><value>4.0</value></property>
     </bean>
 
-    <bean id="primitiveTypesNegative" class="org.apache.jdo.tck.pc.mylib.PrimitiveTypes">
+    <bean id="primitiveTypesNegative" 
+        class="org.apache.jdo.tck.pc.mylib.PrimitiveTypes">
         <property name="id"><value>2</value></property>
         <property name="intNotNull"><value>-4</value></property>
         <property name="intNull"><value>-4</value></property>
@@ -37,5 +40,12 @@
         <property name="doubleNull"><value>-4.0</value></property>
     </bean>
 
-</beans>
+    <bean id="primitiveTypesCharacterStringLiterals" 
+        class="org.apache.jdo.tck.pc.mylib.PrimitiveTypes">
+        <property name="id"><value>3</value></property>
+        <property name="charNotNull"><value>O</value></property>
+        <property name="charNull"><value>O</value></property>
+        <property name="stringNull"><value>Even</value></property>
+    </bean>
 
+</beans>