Index: tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodToString.java
===================================================================
--- tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodToString.java (revision 0)
+++ tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodToString.java (revision 0)
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.methods;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfSimpleEnum;
+import org.apache.jdo.tck.pc.fieldtypes.SimpleEnum;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *Title: Supported Enum methods.
+ *
+ *Keywords: query
+ *
+ *Assertion ID: A14.6.2-47.
+ *
+ *Assertion Description:
+ * New supported Enum methods:
+ *
main is called when the class
+ * is directly executed from the command line.
+ * @param args The arguments passed to the program.
+ */
+ public static void main(String[] args) {
+ BatchTestRunner.run(EnumMethodToString.class);
+ }
+
+ /** */
+ public void testToString() {
+ final String filter = "SimpleEnum0.toString() == 'CA'";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ Collection expectedResult = new ArrayList();
+ expectedResult.add(pm.getObjectById(oidOfExpectedResult));
+
+ Query q = pm.newQuery();
+ q.setClass(FieldsOfSimpleEnum.class);
+ q.setFilter(filter);
+ Collection results = (Collection)q.execute();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /**
+ * @see JDO_Test#localSetUp()
+ */
+ protected void localSetUp() {
+ addTearDownClass(FieldsOfSimpleEnum.class);
+ insertFieldsOfSimpleEnums(getPM());
+ }
+
+ /** */
+ private void insertFieldsOfSimpleEnums(PersistenceManager pm) {
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ FieldsOfSimpleEnum f1 = new FieldsOfSimpleEnum();
+ f1.set(0, SimpleEnum.CA);
+ f1.identifier = 1;
+ pm.makePersistent(f1);
+ FieldsOfSimpleEnum f2 = new FieldsOfSimpleEnum();
+ f2.set(0, SimpleEnum.HI);
+ f2.identifier = 2;
+ pm.makePersistent(f2);
+ FieldsOfSimpleEnum f3 = new FieldsOfSimpleEnum();
+ f3.set(0, SimpleEnum.DC);
+ f3.identifier = 3;
+ pm.makePersistent(f3);
+ oidOfExpectedResult = pm.getObjectId(f1);
+ tx.commit();
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+}
Index: tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java
===================================================================
--- tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java (revision 1170788)
+++ tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java (working copy)
@@ -44,8 +44,10 @@
* main is called when the class
+ * is directly executed from the command line.
+ * @param args The arguments passed to the program.
+ */
+ public static void main(String[] args) {
+ BatchTestRunner.run(EnumMethodOrdinal.class);
+ }
+
+ /** */
+ public void testOrdinal() {
+ final String filter = "SimpleEnum0.ordinal() == 5";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ Collection expectedResult = new ArrayList();
+ expectedResult.add(pm.getObjectById(oidOfExpectedResult));
+
+ Query q = pm.newQuery();
+ q.setClass(FieldsOfSimpleEnum.class);
+ q.setFilter(filter);
+ Collection results = (Collection)q.execute();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /**
+ * @see JDO_Test#localSetUp()
+ */
+ protected void localSetUp() {
+ addTearDownClass(FieldsOfSimpleEnum.class);
+ insertFieldsOfSimpleEnums(getPM());
+ }
+
+ /** */
+ private void insertFieldsOfSimpleEnums(PersistenceManager pm) {
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ FieldsOfSimpleEnum f1 = new FieldsOfSimpleEnum();
+ f1.set(0, SimpleEnum.CA);
+ f1.identifier = 1;
+ pm.makePersistent(f1);
+ FieldsOfSimpleEnum f2 = new FieldsOfSimpleEnum();
+ f2.set(0, SimpleEnum.HI);
+ f2.identifier = 2;
+ pm.makePersistent(f2);
+ FieldsOfSimpleEnum f3 = new FieldsOfSimpleEnum();
+ f3.set(0, SimpleEnum.DC);
+ f3.identifier = 3;
+ pm.makePersistent(f3);
+ oidOfExpectedResult = pm.getObjectId(f1);
+ tx.commit();
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+}
Index: tck/src/conf/jdoql.conf
===================================================================
--- tck/src/conf/jdoql.conf (revision 1170788)
+++ tck/src/conf/jdoql.conf (working copy)
@@ -57,9 +57,11 @@
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.EnumMethodToString \
org.apache.jdo.tck.query.jdoql.methods.MethodsAndObjectConstructionNotSupported \
org.apache.jdo.tck.query.jdoql.methods.StartsWithAndEndsWith \
org.apache.jdo.tck.query.jdoql.methods.SupportedCollectionMethods \
+org.apache.jdo.tck.query.jdoql.methods.SupportedDateMethods \
org.apache.jdo.tck.query.jdoql.methods.SupportedJDOHelperMethods \
org.apache.jdo.tck.query.jdoql.methods.SupportedListMethods \
org.apache.jdo.tck.query.jdoql.methods.SupportedMapMethods \
Index: tck/src/conf/jdoql1.conf
===================================================================
--- tck/src/conf/jdoql1.conf (revision 0)
+++ tck/src/conf/jdoql1.conf (revision 0)
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+jdo.tck.description = Special jdoql test with mapping 1 which maps Enums to integer columns
+jdo.tck.mapping.companyfactory =
+jdo.tck.testdata =
+jdo.tck.standarddata =
+jdo.tck.mapping = 1
+jdo.tck.requiredOptions =
+jdo.tck.classes = \
+org.apache.jdo.tck.query.jdoql.methods.EnumMethodOrdinal
Index: tck/src/conf/configurations.list
===================================================================
--- tck/src/conf/configurations.list (revision 1170788)
+++ tck/src/conf/configurations.list (working copy)
@@ -29,6 +29,7 @@
models1.conf \
query.conf \
jdoql.conf \
+ jdoql1.conf \
transactions.conf \
companyNoRelationships.conf \
companyEmbedded.conf \
Index: exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
===================================================================
--- exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java (revision 1169876)
+++ exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java (working copy)
@@ -115,7 +115,7 @@
* List of configuration files, each describing a test configuration.
* Allows command line override of configured cfgs value.
* @parameter expression="${jdo.tck.cfglist}"
- * default-value="company1-1Relationships.conf company1-MRelationships.conf companyAnnotated1-1RelationshipsFCPM.conf companyAnnotated1-MRelationshipsFCPM.conf companyAnnotatedAllRelationshipsFCConcrete.conf companyAnnotatedAllRelationshipsFCPM.conf companyAnnotatedAllRelationshipsJPAConcrete.conf companyAnnotatedAllRelationshipsJPAPM.conf companyAnnotatedAllRelationshipsPCConcrete.conf companyAnnotatedAllRelationshipsPCPM.conf companyAnnotatedAllRelationshipsPIPM.conf companyAnnotatedEmbeddedFCPM.conf companyAnnotatedEmbeddedJPAConcrete.conf companyAnnotatedEmbeddedJPAPM.conf companyAnnotatedM-MRelationshipsFCConcrete.conf companyAnnotatedM-MRelationshipsFCPM.conf companyAnnotatedNoRelationshipsFCConcrete.conf companyAnnotatedNoRelationshipsFCPM.conf companyAnnotatedNoRelationshipsPCConcrete.conf companyAnnotatedNoRelationshipsPCPM.conf companyAnnotatedNoRelationshipsPIPM.conf companyEmbedded.conf companyListWithoutJoin.conf companyMapWithoutJoin.conf companyM-MRelationships.conf companyNoRelationships.conf companyOverrideAnnotatedAllRelationshipsFCPM.conf companyPMClass.conf companyPMInterface.conf compoundIdentity.conf detach.conf enhancement.conf extents.conf fetchgroup.conf fetchplan.conf inheritance1.conf inheritance2.conf inheritance3.conf inheritance4.conf instancecallbacks.conf jdohelper.conf jdoql.conf lifecycle.conf models1.conf models.conf pm.conf pmf.conf query.conf relationshipAllRelationships.conf relationshipNoRelationships.conf runonce.conf schemaAttributeClass.conf schemaAttributeOrm.conf schemaAttributePackage.conf security.conf transactions.conf"
+ * default-value="company1-1Relationships.conf company1-MRelationships.conf companyAnnotated1-1RelationshipsFCPM.conf companyAnnotated1-MRelationshipsFCPM.conf companyAnnotatedAllRelationshipsFCConcrete.conf companyAnnotatedAllRelationshipsFCPM.conf companyAnnotatedAllRelationshipsJPAConcrete.conf companyAnnotatedAllRelationshipsJPAPM.conf companyAnnotatedAllRelationshipsPCConcrete.conf companyAnnotatedAllRelationshipsPCPM.conf companyAnnotatedAllRelationshipsPIPM.conf companyAnnotatedEmbeddedFCPM.conf companyAnnotatedEmbeddedJPAConcrete.conf companyAnnotatedEmbeddedJPAPM.conf companyAnnotatedM-MRelationshipsFCConcrete.conf companyAnnotatedM-MRelationshipsFCPM.conf companyAnnotatedNoRelationshipsFCConcrete.conf companyAnnotatedNoRelationshipsFCPM.conf companyAnnotatedNoRelationshipsPCConcrete.conf companyAnnotatedNoRelationshipsPCPM.conf companyAnnotatedNoRelationshipsPIPM.conf companyEmbedded.conf companyListWithoutJoin.conf companyMapWithoutJoin.conf companyM-MRelationships.conf companyNoRelationships.conf companyOverrideAnnotatedAllRelationshipsFCPM.conf companyPMClass.conf companyPMInterface.conf compoundIdentity.conf detach.conf enhancement.conf extents.conf fetchgroup.conf fetchplan.conf inheritance1.conf inheritance2.conf inheritance3.conf inheritance4.conf instancecallbacks.conf jdohelper.conf jdoql.conf jdoql1.conf lifecycle.conf models1.conf models.conf pm.conf pmf.conf query.conf relationshipAllRelationships.conf relationshipNoRelationships.conf runonce.conf schemaAttributeClass.conf schemaAttributeOrm.conf schemaAttributePackage.conf security.conf transactions.conf"
* @optional
*/
private String cfgList;
Index: exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java
===================================================================
--- exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java (revision 1169876)
+++ exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java (working copy)
@@ -95,7 +95,7 @@
* List of configuration files, each describing a test configuration.
* Allows command line override of configured cfgs value.
* @parameter expression="${jdo.tck.cfglist}
- * default-value="company1-1Relationships.conf company1-MRelationships.conf companyAnnotated1-1RelationshipsFCPM.conf companyAnnotated1-MRelationshipsFCPM.conf companyAnnotatedAllRelationshipsFCConcrete.conf companyAnnotatedAllRelationshipsFCPM.conf companyAnnotatedAllRelationshipsJPAConcrete.conf companyAnnotatedAllRelationshipsJPAPM.conf companyAnnotatedAllRelationshipsPCConcrete.conf companyAnnotatedAllRelationshipsPCPM.conf companyAnnotatedAllRelationshipsPIPM.conf companyAnnotatedEmbeddedFCPM.conf companyAnnotatedEmbeddedJPAConcrete.conf companyAnnotatedEmbeddedJPAPM.conf companyAnnotatedM-MRelationshipsFCConcrete.conf companyAnnotatedM-MRelationshipsFCPM.conf companyAnnotatedNoRelationshipsFCConcrete.conf companyAnnotatedNoRelationshipsFCPM.conf companyAnnotatedNoRelationshipsPCConcrete.conf companyAnnotatedNoRelationshipsPCPM.conf companyAnnotatedNoRelationshipsPIPM.conf companyEmbedded.conf companyListWithoutJoin.conf companyMapWithoutJoin.conf companyM-MRelationships.conf companyNoRelationships.conf companyOverrideAnnotatedAllRelationshipsFCPM.conf companyPMClass.conf companyPMInterface.conf compoundIdentity.conf detach.conf enhancement.conf extents.conf fetchgroup.conf fetchplan.conf inheritance1.conf inheritance2.conf inheritance3.conf inheritance4.conf instancecallbacks.conf jdohelper.conf jdoql.conf lifecycle.conf models1.conf models.conf pm.conf pmf.conf query.conf relationshipAllRelationships.conf relationshipNoRelationships.conf runonce.conf schemaAttributeClass.conf schemaAttributeOrm.conf schemaAttributePackage.conf security.conf transactions.conf"
+ * default-value="company1-1Relationships.conf company1-MRelationships.conf companyAnnotated1-1RelationshipsFCPM.conf companyAnnotated1-MRelationshipsFCPM.conf companyAnnotatedAllRelationshipsFCConcrete.conf companyAnnotatedAllRelationshipsFCPM.conf companyAnnotatedAllRelationshipsJPAConcrete.conf companyAnnotatedAllRelationshipsJPAPM.conf companyAnnotatedAllRelationshipsPCConcrete.conf companyAnnotatedAllRelationshipsPCPM.conf companyAnnotatedAllRelationshipsPIPM.conf companyAnnotatedEmbeddedFCPM.conf companyAnnotatedEmbeddedJPAConcrete.conf companyAnnotatedEmbeddedJPAPM.conf companyAnnotatedM-MRelationshipsFCConcrete.conf companyAnnotatedM-MRelationshipsFCPM.conf companyAnnotatedNoRelationshipsFCConcrete.conf companyAnnotatedNoRelationshipsFCPM.conf companyAnnotatedNoRelationshipsPCConcrete.conf companyAnnotatedNoRelationshipsPCPM.conf companyAnnotatedNoRelationshipsPIPM.conf companyEmbedded.conf companyListWithoutJoin.conf companyMapWithoutJoin.conf companyM-MRelationships.conf companyNoRelationships.conf companyOverrideAnnotatedAllRelationshipsFCPM.conf companyPMClass.conf companyPMInterface.conf compoundIdentity.conf detach.conf enhancement.conf extents.conf fetchgroup.conf fetchplan.conf inheritance1.conf inheritance2.conf inheritance3.conf inheritance4.conf instancecallbacks.conf jdohelper.conf jdoql.conf jdoql1.conf lifecycle.conf models1.conf models.conf pm.conf pmf.conf query.conf relationshipAllRelationships.conf relationshipNoRelationships.conf runonce.conf schemaAttributeClass.conf schemaAttributeOrm.conf schemaAttributePackage.conf security.conf transactions.conf"
* @optional
*/
private String cfgList;
Index: pom.xml
===================================================================
--- pom.xml (revision 1169876)
+++ pom.xml (working copy)
@@ -92,27 +92,27 @@