Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 91254 invoked from network); 22 May 2005 19:41:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 May 2005 19:41:29 -0000 Received: (qmail 72547 invoked by uid 500); 22 May 2005 19:41:28 -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 72463 invoked by uid 99); 22 May 2005 19:41:27 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sun, 22 May 2005 12:41:20 -0700 Received: (qmail 56880 invoked by uid 65534); 22 May 2005 18:41:08 -0000 Message-ID: <20050522184108.56879.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r171355 [28/31] - in /incubator/jdo/trunk/fostore20: ./ src/ src/conf/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/jdo/ src/java/org/apache/jdo/impl/ src/java/org/apache/jdo/impl/fostore/ test/ test/conf/ test/fsuid2/ test/fsuid2/org/ test/fsuid2/org/apache/ test/fsuid2/org/apache/jdo/ test/fsuid2/org/apache/jdo/pc/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/jdo/ test/java/org/apache/jdo/impl/ test/java/org/apache/jdo/impl/fostore/ test/java/org/apache/jdo/pc/ test/java/org/apache/jdo/pc/appid/ test/java/org/apache/jdo/pc/empdept/ test/java/org/apache/jdo/pc/serializable/ test/java/org/apache/jdo/pc/xempdept/ test/java/org/apache/jdo/test/ test/java/org/apache/jdo/test/query/ test/java/org/apache/jdo/test/util/ test/jdo/ test/jdo/org/ test/jdo/org/apache/ test/jdo/org/apache/jdo/ test/jdo/org/apache/jdo/pc/ test/jdo/org/apache/jdo/pc/appid/ test/jdo/org/apache/jdo/pc/empdept/ test/jdo/org/apache/jdo/pc/serializable/ test/jdo/org/apache/jdo/pc/xempdept/ Date: Sun, 22 May 2005 18:40:21 -0000 To: jdo-commits@db.apache.org From: mbo@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/query/Se= manticErrorTest.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/= org/apache/jdo/test/query/SemanticErrorTest.java?rev=3D171355&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/query/Seman= ticErrorTest.java (added) +++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/query/Seman= ticErrorTest.java Sun May 22 11:40:13 2005 @@ -0,0 +1,1363 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +/* + * SemanticErrorTest.java + * + * Created on April 6, 2000 + */ + +package org.apache.jdo.test.query; + +import java.util.Collection; +import java.util.ArrayList; +import java.util.Map; +import java.io.PrintStream; + +import javax.jdo.*; + +import org.apache.jdo.jdoql.JDOQueryException; +import org.apache.jdo.pc.xempdept.Department; +import org.apache.jdo.pc.xempdept.Employee; + +/**=20 + * + * @author Michael Bouschen + */ +public class SemanticErrorTest + extends NegativeTest +{ + public SemanticErrorTest(PersistenceManagerFactory pmf, PrintStream lo= g) + { + super(pmf, log); + } + + protected boolean isTestMethodName(String methodName) + { + return methodName.startsWith("semanticError"); + } + =20 + // =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D + // Test methods + // =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D + =20 + /** + * Testcase: semantic error undefined field + */ + public void semanticError001() + throws Exception + { + String expectedMsg =3D "setFilter column(6): Field 'michael' not d= efined for class 'org.apache.jdo.pc.xempdept.Employee'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("this.michael =3D=3D 0"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + /** + * Testcase: semantic error left hand side of dot does not define obje= ct + */ + public void semanticError002() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Expression of class t= ype expected."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid.unknownField =3D=3D 0"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: semantic error undefined expression + */ + public void semanticError003() + throws Exception + { + String expectedMsg =3D "setFilter column(8): Undefined expression = 'michael.field'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("michael.field =3D=3D 0"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid argument for logical operation & + */ + public void semanticError004() + throws Exception + { + String expectedMsg =3D "setFilter column(11): Invalid argument(s) = for '&'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("\"michael\" & true"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for logical operation | + */ + public void semanticError005() + throws Exception + { + String expectedMsg =3D "setFilter column(11): Invalid argument(s) = for '|'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("\"michael\" | true"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for conditional operation && + */ + public void semanticError006() + throws Exception + { + String expectedMsg =3D "setFilter column(11): Invalid argument(s) = for '&&'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("\"michael\" && false"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + /** + * Testcase: invalid argument for conditional operation || + */ + public void semanticError007() + throws Exception + { + String expectedMsg =3D "setFilter column(11): Invalid argument(s) = for '||'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("\"michael\" || false"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid argument for arithmetic operation + + */ + public void semanticError008() + throws Exception + { + String expectedMsg =3D "setFilter column(11): Invalid argument(s) = for '+'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("\"michael\" + 3"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for arithmetic operation - + */ + public void semanticError009() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Invalid argument(s) f= or '-'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("false - 6"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for arithmetic operation * + */ + public void semanticError010() + throws Exception + { + String expectedMsg =3D "setFilter column(6): Invalid argument(s) f= or '*'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("true * 5"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for arithmetic operation / + */ + public void semanticError011() + throws Exception + { + String expectedMsg =3D "setFilter column(5): Invalid argument(s) f= or '/'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("4.8 / \"michael\""); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for relational operation =3D=3D + */ + public void semanticError012() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Invalid argument(s) f= or '=3D=3D'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("false =3D=3D 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for relational operation !=3D + */ + public void semanticError013() + throws Exception + { + String expectedMsg =3D "setFilter column(5): Invalid argument(s) f= or '!=3D'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("1.0 !=3D \"michael\""); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for relational operation < + */ + public void semanticError014() + throws Exception + { + String expectedMsg =3D "setFilter column(11): Invalid argument(s) = for '<'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("\"michael\" < 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for relational operation <=3D + */ + public void semanticError015() + throws Exception + { + String expectedMsg =3D "setFilter column(3): Invalid argument(s) f= or '<=3D'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("1 <=3D \"michael\""); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for relational operation > + */ + public void semanticError016() + throws Exception + { + String expectedMsg =3D "setFilter column(11): Invalid argument(s) = for '>'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("\"michael\" > 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for relational operation >=3D + */ + public void semanticError017() + throws Exception + { + String expectedMsg =3D "setFilter column(5): Invalid argument(s) f= or '>=3D'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("2.0 >=3D \"michael\""); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for unary ! + */ + public void semanticError018() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Invalid argument(s) f= or '!'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("! 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for unary + + */ + public void semanticError019() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Invalid argument(s) f= or '+'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("+ false"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for unary - + */ + public void semanticError020() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Invalid argument(s) f= or '-'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("- \"michael\""); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for unary ~ + */ + public void semanticError021() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Invalid argument(s) f= or '~'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("~ true"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: invalid argument for < (type does not define order) + */ + public void semanticError022() + throws Exception + { + String expectedMsg =3D "setFilter column(6): Operand type 'boolean= ' of < is not sortable."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("true < false"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: multiple declaration of identifier + */ + /* + public void semanticError023() + throws Exception + { + String expectedMsg =3D "declareImports column(1): 'Employee' alrea= dy declared as type name."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import org.apache.jdo.pc.xempdept.Employ= ee;"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + */ + /** + * Testcase: multiple declaration of identifier + */ + public void semanticError024() + throws Exception + { + String expectedMsg =3D "declareParameters column(12): Multiple dec= laration of 'i'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("int i, int i"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: multiple declaration of identifier + */ + public void semanticError025() + throws Exception + { + String expectedMsg =3D "declareVariables column(5): Multiple decla= ration of 'i'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("int i"); + query.declareVariables("int i"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: unknown type in parameter declaration + */ + public void semanticError026() + throws Exception + { + String expectedMsg =3D "declareParameters column(1): Unknown type = 'Michael'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("Michael m"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: unknown type in variable declaration + */ + public void semanticError027() + throws Exception + { + String expectedMsg =3D "declareVariables column(1): Unknown type '= Michael'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareVariables("Michael m"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: unknown type in import declaration + */ + public void semanticError028() + throws Exception + { + String expectedMsg =3D "declareImports column(1): Unknown type 'Mi= chael'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import Michael"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: identifier used in parameter declaration does not define = type + */ + public void semanticError029() + throws Exception + { + String expectedMsg =3D "declareParameters column(12): Unknown type= 'index'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("int index, index i"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: too many actual parameters + */ + public void semanticError030() + throws Exception + { + String expectedMsg =3D "Wrong number of query parameter values."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid =3D=3D 1"); + query.compile(); + query.setCandidates(pm.getExtent(Employee.class, false)); + query.execute("InvalidParameterValue"); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: Unbound query parameter + */ + public void semanticError031() + throws Exception + { + String expectedMsg =3D "Unbound query parameter 'l'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("long l"); + query.setFilter("empid =3D=3D l"); + query.compile(); + query.setCandidates(pm.getExtent(Employee.class, false)); + query.execute(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: type of actual parameter is not compatible with type of f= ormal parameter + */ + public void semanticError032() + throws Exception + { + String expectedMsg =3D "Incompatible type of actual query paramete= r=2E Cannot convert 'java.lang.String' to 'long'"; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("long l"); + query.setFilter("empid =3D=3D l"); + query.compile(); + query.setCandidates(pm.getExtent(Employee.class, false)); + query.execute("InvalidParameterValue"); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: map binds undefined parameter + */ + public void semanticError033() + throws Exception + { + String expectedMsg =3D "Undefined query parameter 'param'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("long l"); + query.setFilter("empid =3D=3D l"); + query.compile(); + query.setCandidates(pm.getExtent(Employee.class, false)); + Map actualParams =3D new java.util.HashMap(); + actualParams.put("param", "InvalidParameterValue"); + query.executeWithMap(actualParams); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid field in ordering specification + */ + public void semanticError034() + throws Exception + { + String expectedMsg =3D "setOrdering column(1): Undefined identifie= r 'michael'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid > 2"); + query.setOrdering("michael ascending"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid field type in ordering specification + */ + public void semanticError035() + throws Exception + { + String expectedMsg =3D "setOrdering column(1): Type 'org.apache.jd= o=2Epc.xempdept.Department' of ordering expression is not sortable."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid > 2"); + query.setOrdering("department ascending"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid field type in ordering specification + */ + public void semanticError036() + throws Exception + { + String expectedMsg =3D "setOrdering column(1): Type 'java.util.Has= hSet' of ordering expression is not sortable."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Department.class); + query.setFilter("deptid > 2"); + query.setOrdering("employees descending"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid method call + */ + public void semanticError037() + throws Exception + { + String expectedMsg =3D "setFilter column(5): Invalid method call."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("this.getEmplId() =3D=3D 2"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: filter expression is not of type boolean + */ + public void semanticError038() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Boolean expression ex= pected, filter expression has type 'int'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("2"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: static reference to non static field + */ + public void semanticError039() + throws Exception + { + String expectedMsg =3D "setFilter column(10): Cannot make a static= reference to non-static variable 'empid' of class 'org.apache.jdo.pc.xempd= ept.Employee'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("Employee.empid =3D=3D 2"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: access of non public field of non persistence capable cla= ss + */ + /* + public void semanticError040() + throws Exception + { + String expectedMsg =3D "setFilter column(3): Cannot access non-pub= lic field 'elementCount' of non-persistence-capable class 'java.util.Vector= '=2E"; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import java.util.Vector"); + query.declareVariables("Vector v"); + query.setFilter("v.elementCount =3D=3D 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + */ + /** + * Testcase: access of non public static field + */ + /* + public void semanticError041() + throws Exception + { + String expectedMsg =3D "setFilter column(23): Cannot access non-pu= blic static field 'cache' of class 'java.text.Collator'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import java.text.Collator"); + query.setFilter("firstname =3D=3D Collator.cache"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + */ + /** + * Testcase: collection element type does not match variable type + * checks bug report 4367808 + */ + public void semanticError042() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Collection element ty= pe 'org.apache.jdo.pc.xempdept.Employee' and argument type 'org.apache.jdo.= pc.xempdept.Project' not compatible."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import org.apache.jdo.pc.xempdept.Projec= t"); + query.declareVariables("Project p"); + query.setFilter("team.contains(p) && p.projid =3D=3D 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: unsupported operation in ordering expression + */ + /* + public void semanticError043() + throws Exception + { + String expectedMsg =3D "setOrdering column(7): Unsupported express= ion '+' in ordering specification."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid > 2"); + query.setOrdering("empid + 1 ascending"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + */ + /** + * Testcase: isEmpty with arguments + */ + public void semanticError044() + throws Exception + { + String expectedMsg =3D "setFilter column(14): Wrong number of argu= ments."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("team.isEmpty(1)"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: contains with too manay arguments + */ + public void semanticError045() + throws Exception + { + String expectedMsg =3D "setFilter column(18): Wrong number of argu= ments."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareVariables("Employee e"); + query.setFilter("team.contains(e, 1)"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: contains without arguments + */ + public void semanticError046() + throws Exception + { + String expectedMsg =3D "setFilter column(6): Wrong number of argum= ents."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("team.contains()"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid string method call + * checks bug report 4469306 + */ + public void semanticError047() + throws Exception + { + String expectedMsg =3D "setFilter column(9): Invalid method call."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("lastname.endWith(\"en\")"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid string method call results in wrong error message + * checks bug report 4472057 + */ + public void semanticError048() + throws Exception + { + String expectedMsg =3D "setFilter column(9): Invalid method call."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("lastname.charAt(10)"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid int literal + * checks bug report 4818832 + */ + public void semanticError049() + throws Exception + { + String expectedMsg =3D "setFilter column(10): Invalid int literal = '12345678900'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid =3D=3D 12345678900"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: invalid long literal + * checks bug report 4818832 + */ + public void semanticError050() + throws Exception + { + String expectedMsg =3D "setFilter column(11): Invalid long literal= '-9223372036854775809L'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid =3D=3D -9223372036854775809L"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: access of non persistent field of persistence capable cla= ss + */ + /* TBD: need persistence capable class providing non persistent fields + public void semanticError0xx() + throws Exception + { + String expectedMsg =3D "setFilter column(10): cannot access non pe= rsistent field 'fieldName' of persistence capable class 'class'"; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + */ +} Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/query/Sy= ntaxErrorTest.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/= org/apache/jdo/test/query/SyntaxErrorTest.java?rev=3D171355&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/query/Synta= xErrorTest.java (added) +++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/test/query/Synta= xErrorTest.java Sun May 22 11:40:13 2005 @@ -0,0 +1,1336 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +/* + * SyntaxErrorTest.java + * + * Created on March 31, 2000 + */ + +package org.apache.jdo.test.query; + +import java.util.Collection; +import java.util.ArrayList; +import java.io.PrintStream; + +import javax.jdo.*; + +import org.apache.jdo.jdoql.JDOQueryException; +import org.apache.jdo.pc.xempdept.Employee; + +/**=20 + * + * @author Michael Bouschen + */ +public class SyntaxErrorTest + extends NegativeTest +{ + public SyntaxErrorTest(PersistenceManagerFactory pmf, PrintStream log) + { + super(pmf, log); + } + + protected boolean isTestMethodName(String methodName) + { + return methodName.startsWith("syntaxError"); + } + =20 + // =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D + // Test methods + // =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D + + /** + * Testcase: lexical error unknown character % + */ + public void syntaxError001() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Syntax error unexpect= ed char '%'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("%"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error empty char literal + */ + public void syntaxError002() + throws Exception + { + String expectedMsg =3D "setFilter column(2): Syntax error unexpect= ed char '''"; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("'' =3D=3D 'c'"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: lexical error missing closing parenthesis + */ + public void syntaxError003() + throws Exception + { + String expectedMsg =3D "setFilter column(12): Unexpected end of te= xt."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("(1 + 2 =3D=3D 3"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error missing closing double quote + */ + public void syntaxError004() + throws Exception + { + String expectedMsg =3D "setFilter column(22): Unexpected end of te= xt."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("firstname =3D=3D \"Michael"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error missing closing single quote + */ + public void syntaxError005() + throws Exception + { + String expectedMsg =3D "setFilter column(10): Syntax error expecte= d char ''', found ' '."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("'a' =3D=3D 'b "); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error invalid interger literal 12a2 + */ + public void syntaxError006() + throws Exception + { + String expectedMsg =3D "setFilter column(3): Syntax error unexpect= ed token 'a2'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("12a2"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error invalid octal literal 09 + */ + public void syntaxError007() + throws Exception + { + String expectedMsg =3D "setFilter column(2): Syntax error unexpect= ed token '9'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("09"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error invalid hex literal 0x9g + */ + public void syntaxError008() + throws Exception + { + String expectedMsg =3D "setFilter column(4): Syntax error unexpect= ed token 'g'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("0x9g"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error invalid float literal 1.23.45 + */ + public void syntaxError009() + throws Exception + { + String expectedMsg =3D "setFilter column(5): Syntax error unexpect= ed token '.45'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("1.23.45"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error invalid float literal suffix 1.23g + */ + public void syntaxError010() + throws Exception + { + String expectedMsg =3D "setFilter column(5): Syntax error unexpect= ed token 'g'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("1.23g"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: lexical error unknown keyword/identifier + */ + public void syntaxError011() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Undefined identifier = 'select'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("select"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: lexical error keyword in mixed case + */ + public void syntaxError012() + throws Exception + { + String expectedMsg =3D "declareImports column(1): Syntax error une= xpected token 'iMpOrT'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("iMpOrT org.apache.jdo.pc.xempdept.Depart= ment;"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing semicolon in import declaration + */ + public void syntaxError013() + throws Exception + { + String expectedMsg =3D "declareImports column(44): Syntax error un= expected token 'import'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import org.apache.jdo.pc.xempdept.Employ= ee import org.apache.jdo.pc.xempdept.Department"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing type specification in import declara= tion + */ + public void syntaxError014() + throws Exception + { + String expectedMsg =3D "declareImports column(7): Syntax error at = ';'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import;"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing comma in parameter declaration + */ + public void syntaxError015() + throws Exception + { + String expectedMsg =3D "declareParameters column(8): Syntax error = unexpected token 'int'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("long l int i"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing type specification in parameter decl= aration + */ + public void syntaxError016() + throws Exception + { + String expectedMsg =3D "declareParameters column(2): Unexpected en= d of text."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("l"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing name specification in parameter decl= aration + */ + public void syntaxError017() + throws Exception + { + String expectedMsg =3D "declareParameters column(4): Unexpected en= d of text."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("int"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing semicolon in variable declaration + */ + public void syntaxError018() + throws Exception + { + String expectedMsg =3D "declareVariables column(13): Syntax error = unexpected token 'Employee'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import org.apache.jdo.pc.xempdept.Employ= ee"); + query.declareVariables("Employee e1 Employee e2"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing type specification in variable decla= ration + */ + public void syntaxError019() + throws Exception + { + String expectedMsg =3D "declareVariables column(2): Unexpected end= of text."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import org.apache.jdo.pc.xempdept.Employ= ee"); + query.declareVariables("v"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing name specification in variable decla= ration + */ + public void syntaxError020() + throws Exception + { + String expectedMsg =3D "declareVariables column(9): Unexpected end= of text."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import org.apache.jdo.pc.xempdept.Employ= ee"); + query.declareVariables("Employee"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing comma in ordering specification + */ + public void syntaxError021() + throws Exception + { + String expectedMsg =3D "setOrdering column(18): Syntax error unexp= ected token 'firstname'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setOrdering("deptid ascending firstname descending"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing field specification in ordering spec= ification + */ + public void syntaxError022() + throws Exception + { + String expectedMsg =3D "setOrdering column(1): Syntax error unexpe= cted token 'ascending'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setOrdering("ascending"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing argument of unary operator + */ + public void syntaxError023() + throws Exception + { + String expectedMsg =3D "setFilter column(2): Unexpected end of tex= t=2E"; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("!"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + /** + * Testcase: syntax error missing argument of logical operator + */ + public void syntaxError024() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Unexpected end of tex= t=2E"; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("true &"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing argument of conditional operator + */ + public void syntaxError025() + throws Exception + { + String expectedMsg =3D "setFilter column(8): Unexpected end of tex= t=2E"; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("true ||"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing argument of relational operator + */ + public void syntaxError026() + throws Exception + { + String expectedMsg =3D "setFilter column(5): Unexpected end of tex= t=2E"; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("1 =3D=3D"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing argument of arithmetic operator + */ + public void syntaxError027() + throws Exception + { + String expectedMsg =3D "setFilter column(5): Syntax error unexpect= ed token '=3D=3D'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("1 + =3D=3D 3"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error missing field in navigation path + */ + public void syntaxError028() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Syntax error at '=3D= =3D'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("dept. =3D=3D 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple import keyword in import declaration + */ + public void syntaxError029() + throws Exception + { + String expectedMsg =3D "declareImports column(8): Syntax error at = 'import'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import import org.apache.jdo.pc.xempdept= .Employee"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: syntax error multiple type specification in import declar= ation + */ + public void syntaxError030() + throws Exception + { + String expectedMsg =3D "declareImports column(44): Syntax error un= expected token 'org'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import org.apache.jdo.pc.xempdept.Employ= ee org.apache.jdo.pc.xempdept.Employee"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple comma in parameter declaration + */ + public void syntaxError031() + throws Exception + { + String expectedMsg =3D "declareParameters column(8): Syntax error = at ','."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("int i, , long l"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + + /** + * Testcase: syntax error multiple type specification in parameter dec= laration + */ + public void syntaxError032() + throws Exception + { + String expectedMsg =3D "declareParameters column(5): Syntax error = at 'long'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("int long l"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + + /** + * Testcase: syntax error multiple name specification in parameter dec= laration + */ + public void syntaxError033() + throws Exception + { + String expectedMsg =3D "declareParameters column(7): Syntax error = unexpected token 'l'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareParameters("int i l"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + + /** + * Testcase: syntax error multiple semicolon in variable declaration + */ + public void syntaxError034() + throws Exception + { + String expectedMsg =3D "declareVariables column(16): Syntax error = at ';'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareImports("import org.apache.jdo.pc.xempdept.Depart= ment"); + query.declareVariables("Department d1; ;Department d2"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple type specification in variable decl= aration + */ + public void syntaxError035() + throws Exception + { + String expectedMsg =3D "declareVariables column(23): Syntax error = unexpected token 'd'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareVariables("Department Department d"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple name specification in variable decl= aration + */ + public void syntaxError036() + throws Exception + { + String expectedMsg =3D "declareVariables column(15): Syntax error = unexpected token 'd2'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.declareVariables("Department d1 d2"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple comma in ordering specification + */ + public void syntaxError037() + throws Exception + { + String expectedMsg =3D "setOrdering column(6): Syntax error unexpe= cted token ','."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setOrdering("empid, , firstname"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple field specification in ordering spe= cification + */ + public void syntaxError038() + throws Exception + { + String expectedMsg =3D "setOrdering column(7): Syntax error unexpe= cted token 'firstname'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setOrdering("empid firstname ascending"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple direction in ordering specification + */ + public void syntaxError039() + throws Exception + { + String expectedMsg =3D "setOrdering column(18): Syntax error unexp= ected token 'ascending'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setOrdering("empid descending ascending"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple arguments of unary operation + */ + public void syntaxError040() + throws Exception + { + String expectedMsg =3D "setFilter column(8): Syntax error unexpect= ed token 'false'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("! true false"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple arguments of logical operator + */ + public void syntaxError041() + throws Exception + { + String expectedMsg =3D "setFilter column(19): Syntax error unexpec= ted token 'false'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid =3D=3D 1 | true false"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple arguments of conditinal operator + */ + public void syntaxError042() + throws Exception + { + String expectedMsg =3D "setFilter column(20): Syntax error unexpec= ted token 'false'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid =3D=3D 1 && true false"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple arguments of relational operator + */ + public void syntaxError043() + throws Exception + { + String expectedMsg =3D "setFilter column(13): Syntax error unexpec= ted token '2'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid >=3D 1 2"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error multiple arguments of arithmetic operator + */ + public void syntaxError044() + throws Exception + { + String expectedMsg =3D "setFilter column(17): Syntax error unexpec= ted token '4'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid =3D=3D (1 + 3 4)"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error unexpected parenthesis + */ + public void syntaxError045() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Syntax error unexpect= ed token '('."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid ( empid"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + =20 + /** + * Testcase: syntax error unexpected identifier + */ + public void syntaxError046() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Syntax error unexpect= ed token 'empid'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid empid"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: syntax error invalid pre-increment operator + */ + public void syntaxError047() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Syntax error unexpect= ed token '++'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("++empid =3D=3D 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: syntax error invalid pre-decrement operator + */ + public void syntaxError048() + throws Exception + { + String expectedMsg =3D "setFilter column(1): Syntax error unexpect= ed token '--'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("--empid =3D=3D 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: syntax error invalid assignemnt operator=20 + */ + public void syntaxError049() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Syntax error unexpect= ed token '=3D'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid =3D 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: syntax error invalid compound assignment operator=20 + */ + public void syntaxError050() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Syntax error unexpect= ed token '+=3D'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid +=3D 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + + /** + * Testcase: syntax error invalid shift operator + */ + public void syntaxError051() + throws Exception + { + String expectedMsg =3D "setFilter column(7): Syntax error unexpect= ed token '<<'."; + Transaction tx =3D pm.currentTransaction(); + tx.begin(); + =20 + try + { + Query query =3D pm.newQuery(Employee.class); + query.setFilter("empid << 1"); + query.compile(); + checkMissingException(JDOQueryException.class, expectedMsg); + } + catch (JDOException ex) + { + checkJDOException(ex, JDOQueryException.class, expectedMsg); + } + =20 + tx.rollback(); + } + +}