db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject svn commit: r314949 - in /incubator/jdo/trunk/tck20: ./ test/conf/ test/java/org/apache/jdo/tck/pc/query/ test/java/org/apache/jdo/tck/query/jdoql/keywords/ test/java/org/apache/jdo/tck/query/result/classes/ test/jdo/applicationidentity/org/apache/jdo/...
Date Wed, 12 Oct 2005 15:45:14 GMT
Author: brazil
Date: Wed Oct 12 08:44:50 2005
New Revision: 314949

URL: http://svn.apache.org/viewcvs?rev=314949&view=rev
Log:
JDO-157: Implement new JDO 2 query tests cases concerning keywords.

Added:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/query/
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/query/JDOQLKeywordsAsFieldNames.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UppercaseLowercase.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/classes/
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/classes/FullName.java
    incubator/jdo/trunk/tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/query/
    incubator/jdo/trunk/tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo
    incubator/jdo/trunk/tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/
    incubator/jdo/trunk/tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo
    incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/query/
    incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-derby.orm
    incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/query/
    incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-derby.orm
Modified:
    incubator/jdo/trunk/tck20/project.properties
    incubator/jdo/trunk/tck20/test/conf/alltests.conf
    incubator/jdo/trunk/tck20/test/sql/derby/applicationidentity/schema.sql
    incubator/jdo/trunk/tck20/test/sql/derby/datastoreidentity/schema.sql

Modified: incubator/jdo/trunk/tck20/project.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/project.properties?rev=314949&r1=314948&r2=314949&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/project.properties (original)
+++ incubator/jdo/trunk/tck20/project.properties Wed Oct 12 08:44:50 2005
@@ -173,6 +173,7 @@
     org/apache/jdo/tck/pc/mylib/PrimitiveTypes.java \
     org/apache/jdo/tck/pc/instancecallbacks/InstanceCallbackClass.java \
     org/apache/jdo/tck/pc/instancecallbacks/InstanceCallbackNonPersistFdsClass.java \
+    org/apache/jdo/tck/pc/query/JDOQLKeywordsAsFieldNames.java \
     org/apache/jdo/tck/pc/singlefieldidentity/PCPointSingleFieldPrimitivebyte.java \
     org/apache/jdo/tck/pc/singlefieldidentity/PCPointSingleFieldByte.java \
     org/apache/jdo/tck/pc/singlefieldidentity/PCPointSingleFieldPrimitivechar.java \
@@ -264,6 +265,7 @@
     org/apache/jdo/tck/pc/mylib/PrimitiveTypes.class \
     org/apache/jdo/tck/pc/instancecallbacks/InstanceCallbackClass.class \
     org/apache/jdo/tck/pc/instancecallbacks/InstanceCallbackNonPersistFdsClass.class \
+    org/apache/jdo/tck/pc/query/JDOQLKeywordsAsFieldNames.class \
     org/apache/jdo/tck/pc/singlefieldidentity/PCPointSingleFieldPrimitivebyte.class \
     org/apache/jdo/tck/pc/singlefieldidentity/PCPointSingleFieldByte.class \
     org/apache/jdo/tck/pc/singlefieldidentity/PCPointSingleFieldPrimitivechar.class \
@@ -361,5 +363,6 @@
     org/apache/jdo/tck/pc/instancecallbacks/package.jdo \
     org/apache/jdo/tck/pc/lifecycle/StateTransitionObj.jdo \
     org/apache/jdo/tck/pc/mylib/package.jdo \
+    org/apache/jdo/tck/pc/query/package.jdo \
     org/apache/jdo/tck/pc/singlefieldidentity/package.jdo \
     org/apache/jdo/tck/package.jdo

Modified: incubator/jdo/trunk/tck20/test/conf/alltests.conf
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/conf/alltests.conf?rev=314949&r1=314948&r2=314949&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/conf/alltests.conf (original)
+++ incubator/jdo/trunk/tck20/test/conf/alltests.conf Wed Oct 12 08:44:50 2005
@@ -297,7 +297,11 @@
 org.apache.jdo.tck.query.jdoql.RestoredSerializedQueryInstanceLosesAssociationWithPM \
 org.apache.jdo.tck.query.jdoql.SeparateNamespaceForTypeNames \
 org.apache.jdo.tck.query.jdoql.WhiteSpaceIsACharacterAndIgnored \
+org.apache.jdo.tck.query.jdoql.keywords.InvalidUseOfKeywords \
+org.apache.jdo.tck.query.jdoql.keywords.KeywordsAsFieldNames \
+org.apache.jdo.tck.query.jdoql.keywords.SingleString \
 org.apache.jdo.tck.query.jdoql.keywords.ThisIsReservedWordForElementOfCollection \
+org.apache.jdo.tck.query.jdoql.keywords.UppercaseLowercase \
 org.apache.jdo.tck.query.jdoql.keywords.UseOfThisToAcessHiddenField \
 org.apache.jdo.tck.query.jdoql.methods.MethodsAndObjectConstructionNotSupported \
 org.apache.jdo.tck.query.jdoql.methods.StartsWithAndEndsWith \

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/query/JDOQLKeywordsAsFieldNames.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/query/JDOQLKeywordsAsFieldNames.java?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/query/JDOQLKeywordsAsFieldNames.java
(added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/query/JDOQLKeywordsAsFieldNames.java
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,36 @@
+/*
+ * 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.pc.query;
+
+/**
+ * The PC class for testing JDOQL queries.
+ */
+public class JDOQLKeywordsAsFieldNames {
+    
+    /**
+     * The primary key field.
+     */
+    private String select;
+
+    public void setSelect(String select) {
+        this.select = select;
+    }
+
+    public String getSelect() {
+        return this.select;
+    }
+}

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java
(added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,109 @@
+/*
+ * 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.keywords;
+
+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> Invalid uses of keywords.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.4-6.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Keywords must not be used as package names, class names, 
+ * parameter names, or variable names in queries.
+ */
+public class InvalidUseOfKeywords extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.4-6 (InvalidUseOfKeywords) failed: ";
+    
+    /** The array of invalid single string queries. */
+    private static final String[] INVALID_SINGLE_STRING_QUERIES = {
+        "SELECT INTO range.PersonResult FROM org.apache.jdo.tck.pc.company.Person",
+        "SELECT INTO range FROM org.apache.jdo.tck.pc.company.Person",
+        "SELECT FROM select.Person",
+        "SELECT FROM select",
+        "SELECT FROM org.apache.jdo.tck.pc.company.Person PARAMETERS int this",
+        "SELECT FROM org.apache.jdo.tck.pc.company.Person VARIABLES long this"
+    };
+    
+    /** 
+     * 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*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "int this",
+                /*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*/       null,
+                /*VARIABLES*/   "long this",
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          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(InvalidUseOfKeywords.class);
+    }
+    
+    /** */
+    public void testNegative() {
+        for (int i = 0; i < INVALID_SINGLE_STRING_QUERIES.length; i++) {
+            compileSingleStringQuery(ASSERTION_FAILED, 
+                    INVALID_SINGLE_STRING_QUERIES[i], false);
+        }
+        
+        for (int i = 0; i < INVALID_QUERIES.length; i++) {
+            compileAPIQuery(ASSERTION_FAILED, INVALID_QUERIES[i], false);
+            compileSingleStringQuery(ASSERTION_FAILED, INVALID_QUERIES[i], 
+                    false);
+        }
+    }
+    
+}

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java
(added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,107 @@
+/*
+ * 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.keywords;
+
+import org.apache.jdo.tck.pc.query.JDOQLKeywordsAsFieldNames;
+import org.apache.jdo.tck.query.QueryElementHolder;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Keywords as field names.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.4-7.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Keywords are permitted as field names only 
+ * if they are on the right side of the "." in field access expressions.
+ */
+public class KeywordsAsFieldNames extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.4-7 (KeywordsAsFieldNames) 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*/      "select", 
+        /*INTO*/        null, 
+        /*FROM*/        JDOQLKeywordsAsFieldNames.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       null,
+        /*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*/      "this.select", 
+        /*INTO*/        null, 
+        /*FROM*/        JDOQLKeywordsAsFieldNames.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       null,
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          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(KeywordsAsFieldNames.class);
+    }
+    
+    /** */
+    public void testPositive() {
+        for (int i = 0; i < VALID_QUERIES.length; i++) {
+            compileAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], true);
+            compileSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], true);
+        }
+    }
+
+    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);
+        }
+    }
+}

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
(added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,107 @@
+/*
+ * 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.keywords;
+
+import java.math.BigDecimal;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.pc.company.FullTimeEmployee;
+import org.apache.jdo.tck.query.QueryElementHolder;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.query.result.classes.FullName;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Single string query.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.13-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * The String version of Query represents all query elements 
+ * using a single string. The string contains the following structure:
+ */
+public class SingleString extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.13-1 (SingleString) 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*/      Boolean.FALSE,
+        /*RESULT*/      "firstname AS firstName, lastname AS lastName",
+        /*INTO*/        FullName.class, 
+        /*FROM*/        FullTimeEmployee.class,
+        /*EXCLUDE*/     Boolean.TRUE,
+        /*WHERE*/       "salary > 1000 & projects.contains(project) & " +
+                        "project.budget > limit",
+        /*VARIABLES*/   "Project project",
+        /*PARAMETERS*/  "BigDecimal limit",
+        /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Project; " +
+                        "import java.math.BigDecimal",
+        /*GROUP BY*/    "firstname, lastname HAVING lastname.startsWith('emp')",
+        /*ORDER BY*/    "personid ASCENDING",
+        /*FROM*/        0,
+        /*TO*/          3)
+    };
+    
+    /** The expected results of valid queries. */
+    private static Object[][] expectedResult = {
+        {new FullName("emp1First", "emp1Last"), 
+         new FullName("emp2First", "emp2Last"),
+         new FullName("emp5First", "emp5Last")}
+    };
+            
+    /** Parameters of valid queries. */
+    private static Object[][] parameters = {
+        {new BigDecimal("2000")}
+    };
+            
+    /**
+     * 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(SingleString.class);
+    }
+    
+    /** */
+    public void testPositive() {
+        for (int i = 0; i < VALID_QUERIES.length; i++) {
+            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    parameters[i], expectedResult[i]);
+            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    parameters[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/keywords/UppercaseLowercase.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UppercaseLowercase.java?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UppercaseLowercase.java
(added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UppercaseLowercase.java
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,74 @@
+/*
+ * 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.keywords;
+
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Keywords in uppercase and lowercase.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.13-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Keywords, identified above in bold, are either all upper-case
+ * or all lower-case. Keywords cannot be mixed case.
+ */
+public class UppercaseLowercase extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.13-2 (UppercaseLowercase) failed: ";
+    
+    /** The array of valid single string queries. */
+    private static final String[] VALID_SINGLE_STRING_QUERIES = {
+        "SELECT FROM org.apache.jdo.tck.pc.company.Person",
+        "select from org.apache.jdo.tck.pc.company.Person",
+        "select FROM org.apache.jdo.tck.pc.company.Person",
+    };
+    
+    /** The array of invalid single string queries. */
+    private static final String[] INVALID_SINGLE_STRING_QUERIES = {
+        "SeLeCt FrOm org.apache.jdo.tck.pc.company.Person"
+    };
+    
+    /**
+     * 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(UppercaseLowercase.class);
+    }
+    
+    /** */
+    public void testPositive() {
+        for (int i = 0; i < VALID_SINGLE_STRING_QUERIES.length; i++) {
+            compileSingleStringQuery(ASSERTION_FAILED, 
+                    VALID_SINGLE_STRING_QUERIES[i], true);
+        }
+    }
+     
+    public void testNegitve() {
+        for (int i = 0; i < INVALID_SINGLE_STRING_QUERIES.length; i++) {
+            compileSingleStringQuery(ASSERTION_FAILED, 
+                    INVALID_SINGLE_STRING_QUERIES[i], false);
+        }
+    }
+}

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/classes/FullName.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/classes/FullName.java?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/classes/FullName.java
(added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/classes/FullName.java
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,128 @@
+/*
+ * 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.result.classes;
+
+/**
+ * JDOQL result class having bean properties <code>firstname</code>,
+ * <code>firstName</code>, <code>lastname</code>, and <code>lastName</code>.
+ * These properties are used by JDO query tests in result clauses.
+ * There are two different bean properties on each field,
+ * <code>firstname</code> and <code>lastname</code> 
+ * because some result clauses in JDO query tests specify
+ * those properties in <code>AS</code> clauses. 
+ */
+public class FullName {
+
+    private String firstName;
+    private String lastName;
+    
+    public FullName() {}
+    
+    public FullName(String firstName, String lastName) {
+        this.firstName = firstName;
+        this.lastName = lastName;
+    }
+    
+    /**
+     * @see Object#hashCode()
+     */
+    public int hashCode() {
+        int result = 0;
+        result += this.firstName != null ? this.firstName.hashCode() : 0;
+        result += this.lastName != null ? this.lastName.hashCode() : 0;
+        return result;
+    }
+    
+    /**
+     * @see Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object o) {
+        FullName other = (FullName) o;
+        if (this.firstName == null) {
+            return other.firstName == null;
+        }
+        if (this.lastName == null) {
+            return other.lastName == null;
+        }
+        return this.firstName.equals(other.firstName) &&
+               this.lastName.equals(other.lastName);
+    }
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString() {
+        return this.firstName + ' ' + this.lastName;
+    }
+    
+    /**
+     * @return Returns the firstName.
+     */
+    public String getFirstName() {
+        return firstName;
+    }
+    
+    /**
+     * @param firstName The firstName to set.
+     */
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+    
+    /**
+     * @return Returns the lastName.
+     */
+    public String getLastName() {
+        return lastName;
+    }
+    
+    /**
+     * @param lastName The lastName to set.
+     */
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    /**
+     * @return Returns the firstName.
+     */
+    public String getFirstname() {
+        return firstName;
+    }
+    
+    /**
+     * @param firstName The firstName to set.
+     */
+    public void setFirstname(String firstname) {
+        this.firstName = firstname;
+    }
+    
+    /**
+     * @return Returns the lastName.
+     */
+    public String getLastname() {
+        return lastName;
+    }
+    
+    /**
+     * @param lastName The lastName to set.
+     */
+    public void setLastname(String lastname) {
+        this.lastName = lastname;
+    }
+
+}

Added: incubator/jdo/trunk/tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo
(added)
+++ incubator/jdo/trunk/tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN"
"http://java.sun.com/dtd/jdo_2_0.dtd">
+
+<jdo>
+  <package name="org.apache.jdo.tck.pc.query">
+
+    <class name="JDOQLKeywordsAsFieldNames"
+           identity-type="application" objectid-class="javax.jdo.identity.StringIdentity">
+      <field name="select" primary-key="true"/>
+    </class>
+
+  </package>
+</jdo>
+

Added: incubator/jdo/trunk/tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo
(added)
+++ incubator/jdo/trunk/tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN"
"http://java.sun.com/dtd/jdo_2_0.dtd">
+
+<jdo>
+  <package name="org.apache.jdo.tck.pc.query">
+    <class name="JDOQLKeywordsAsFieldNames" identity-type="datastore"/>
+  </package>
+</jdo>
+

Added: incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-derby.orm
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-derby.orm?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-derby.orm
(added)
+++ incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-derby.orm
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE orm PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Mapping Metadata
2.0//EN" "http://java.sun.com/dtd/orm_2_0.dtd">
+<orm>
+  <package name="org.apache.jdo.tck.pc.query">
+
+    <class name="JDOQLKeywordsAsFieldNames" table="JDOQLKeywordsAsFieldNames">
+      <field name="select" column="ID" primary-key="true"/>
+    </class>
+
+  </package>
+</orm>
+

Added: incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-derby.orm
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-derby.orm?rev=314949&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-derby.orm
(added)
+++ incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-derby.orm
Wed Oct 12 08:44:50 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE orm PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Mapping Metadata
2.0//EN" "http://java.sun.com/dtd/orm_2_0.dtd">
+<!--
+This file contains the schema information when an implementation
+has datastore identity.
+-->
+<orm>
+    <package name="org.apache.jdo.tck.pc.query">
+
+        <class name="JDOQLKeywordsAsFieldNames" table="JDOQLKeywordsAsFieldNames">
+            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <field name="select" column="ID"/>
+        </class>
+
+    </package>
+</orm>

Modified: incubator/jdo/trunk/tck20/test/sql/derby/applicationidentity/schema.sql
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/sql/derby/applicationidentity/schema.sql?rev=314949&r1=314948&r2=314949&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/sql/derby/applicationidentity/schema.sql (original)
+++ incubator/jdo/trunk/tck20/test/sql/derby/applicationidentity/schema.sql Wed Oct 12 08:44:50
2005
@@ -62,6 +62,17 @@
 );
 
 -------------------------
+-- query
+-------------------------
+
+DROP TABLE JDOQLKeywordsAsFieldNames;
+
+CREATE TABLE JDOQLKeywordsAsFieldNames (
+    ID VARCHAR(64) NOT NULL,
+    CONSTRAINT KEYWORDS_PK PRIMARY KEY (ID)
+);
+
+-------------------------
 -- singlefieldidentity
 -------------------------
 

Modified: incubator/jdo/trunk/tck20/test/sql/derby/datastoreidentity/schema.sql
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/sql/derby/datastoreidentity/schema.sql?rev=314949&r1=314948&r2=314949&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/sql/derby/datastoreidentity/schema.sql (original)
+++ incubator/jdo/trunk/tck20/test/sql/derby/datastoreidentity/schema.sql Wed Oct 12 08:44:50
2005
@@ -66,6 +66,18 @@
 );
 
 -------------------------
+-- query
+-------------------------
+
+DROP TABLE JDOQLKeywordsAsFieldNames;
+
+CREATE TABLE JDOQLKeywordsAsFieldNames (
+    DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+    ID VARCHAR(64) NOT NULL,
+    CONSTRAINT KEYWORDS_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
+-------------------------
 -- company
 -------------------------
 



Mime
View raw message