db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1172679 - in /db/jdo/trunk: ./ exectck/src/main/java/org/apache/jdo/exectck/ tck/src/conf/ tck/src/java/org/apache/jdo/tck/query/jdoql/methods/
Date Mon, 19 Sep 2011 16:09:38 GMT
Author: mbo
Date: Mon Sep 19 16:09:37 2011
New Revision: 1172679

URL: http://svn.apache.org/viewvc?rev=1172679&view=rev
Log:
JDO-658: Added query test cases for Enum.ordinal, Enum.toString, String.trim and changed the
DN dependencies to 3.0.1.

Added:
    db/jdo/trunk/tck/src/conf/jdoql1.conf
    db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodOrdinal.java
    db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodToString.java
Modified:
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java
    db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
    db/jdo/trunk/pom.xml
    db/jdo/trunk/tck/src/conf/configurations.list
    db/jdo/trunk/tck/src/conf/jdoql.conf
    db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java
    db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java

Modified: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java?rev=1172679&r1=1172678&r2=1172679&view=diff
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java (original)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java Mon Sep 19
16:09:37 2011
@@ -95,7 +95,7 @@ public class InstallSchema
      * 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-MRelation
 ships.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-MRelation
 ships.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;

Modified: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java?rev=1172679&r1=1172678&r2=1172679&view=diff
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java (original)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java Mon Sep 19 16:09:37
2011
@@ -115,7 +115,7 @@ public class RunTCK extends AbstractMojo
      * 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-MRelation
 ships.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-MRelation
 ships.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;

Modified: db/jdo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/pom.xml?rev=1172679&r1=1172678&r2=1172679&view=diff
==============================================================================
--- db/jdo/trunk/pom.xml (original)
+++ db/jdo/trunk/pom.xml Mon Sep 19 16:09:37 2011
@@ -92,27 +92,27 @@ Requests (JSR 12 and 243) under the ausp
       <dependency>
         <groupId>org.datanucleus</groupId>
         <artifactId>datanucleus-core</artifactId>
-        <version>3.0.0-release</version>
+        <version>3.0.1</version>
       </dependency>
       <dependency>
         <groupId>org.datanucleus</groupId>
         <artifactId>datanucleus-rdbms</artifactId>
-        <version>3.0.0-release</version>
+        <version>3.0.1</version>
       </dependency>
       <dependency>
         <groupId>org.datanucleus</groupId>
         <artifactId>datanucleus-enhancer</artifactId>
-        <version>3.0.0-m6</version>
+        <version>3.0.0-release</version>
       </dependency>
       <dependency>
         <groupId>org.datanucleus</groupId>
         <artifactId>datanucleus-api-jdo</artifactId>
-        <version>3.0.0-release</version>
+        <version>3.0.1</version>
       </dependency>
       <dependency>
         <groupId>org.datanucleus</groupId>
         <artifactId>datanucleus-api-jpa</artifactId>
-        <version>3.0.0-release</version>
+        <version>3.0.1</version>
       </dependency>
       <dependency>
         <groupId>org.springframework</groupId>

Modified: db/jdo/trunk/tck/src/conf/configurations.list
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/conf/configurations.list?rev=1172679&r1=1172678&r2=1172679&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/conf/configurations.list (original)
+++ db/jdo/trunk/tck/src/conf/configurations.list Mon Sep 19 16:09:37 2011
@@ -29,6 +29,7 @@ jdo.tck.cfglist = \
                  models1.conf \
                  query.conf \
                  jdoql.conf \
+                 jdoql1.conf \
                  transactions.conf \
                  companyNoRelationships.conf \
                  companyEmbedded.conf \

Modified: db/jdo/trunk/tck/src/conf/jdoql.conf
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/conf/jdoql.conf?rev=1172679&r1=1172678&r2=1172679&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/conf/jdoql.conf (original)
+++ db/jdo/trunk/tck/src/conf/jdoql.conf Mon Sep 19 16:09:37 2011
@@ -57,9 +57,11 @@ org.apache.jdo.tck.query.jdoql.keywords.
 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 \

Added: db/jdo/trunk/tck/src/conf/jdoql1.conf
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/conf/jdoql1.conf?rev=1172679&view=auto
==============================================================================
--- db/jdo/trunk/tck/src/conf/jdoql1.conf (added)
+++ db/jdo/trunk/tck/src/conf/jdoql1.conf Mon Sep 19 16:09:37 2011
@@ -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

Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodOrdinal.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodOrdinal.java?rev=1172679&view=auto
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodOrdinal.java
(added)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodOrdinal.java
Mon Sep 19 16:09:37 2011
@@ -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;
+
+/**
+ *<B>Title:</B> Supported Enum methods.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-47.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * New supported Enum methods:
+ * <ul>
+ * <li> ordinal()
+ * <li> toString()
+ * </ul>
+ */
+public class EnumMethodOrdinal extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-47 (EnumMethodOrdinal) failed: ";
+
+    /** */
+    private Object oidOfExpectedResult;
+
+    /**
+     * 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(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();
+        }
+    }
+}

Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodToString.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodToString.java?rev=1172679&view=auto
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodToString.java
(added)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/EnumMethodToString.java
Mon Sep 19 16:09:37 2011
@@ -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;
+
+/**
+ *<B>Title:</B> Supported Enum methods.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-47.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * New supported Enum methods:
+ * <ul>
+ * <li> ordinal()
+ * <li> toString()
+ * </ul>
+ */
+public class EnumMethodToString extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-47 (EnumMethodToString) failed: ";
+
+    /** */
+    private Object oidOfExpectedResult;
+
+    /**
+     * 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(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();
+        }
+    }
+}

Modified: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java?rev=1172679&r1=1172678&r2=1172679&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java
(original)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java
Mon Sep 19 16:09:37 2011
@@ -35,17 +35,12 @@ import org.apache.jdo.tck.util.BatchTest
  *<B>Assertion Description: </B>
  * New supported Date methods:
  * <ul>
- * <li> toLowerCase()
- * <li> toUpperCase()
- * <li> indexOf(String)
- * <li> indexOf(String, int)
- * <li> matches(String)
- * <li> substring(int)
- * <li> substring(int, int)
- * <li> startsWith(String)
- * <li> endsWith(String)
- * <li> startsWith(String, int)
- * <li> length()
+ * <li> getHour()
+ * <li> getMinutes()
+ * <li> getSeconds()
+ * <li> getDay()
+ * <li> getMonth()
+ * <li> getYear()
  * </ul>
  */
 public class SupportedDateMethods extends QueryTest {

Modified: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java?rev=1172679&r1=1172678&r2=1172679&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java
(original)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java
Mon Sep 19 16:09:37 2011
@@ -44,8 +44,10 @@ import org.apache.jdo.tck.util.BatchTest
  * <li> substring(int, int)
  * <li> startsWith(String)
  * <li> endsWith(String)
+ * <li> charAt(int)
  * <li> startsWith(String, int)
  * <li> length()
+ * <li> trim()
  * </ul>
  */
 public class SupportedStringMethods extends QueryTest {
@@ -219,7 +221,7 @@ public class SupportedStringMethods exte
                 /*INTO*/        null, 
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
-                /*WHERE*/       "firstname.startsWith('mp', 1)",
+                /*WHERE*/       "firstname.charAt(3) == '1'",
                 /*VARIABLES*/   null,
                 /*PARAMETERS*/  null,
                 /*IMPORTS*/     null,
@@ -233,7 +235,7 @@ public class SupportedStringMethods exte
                 /*INTO*/        null, 
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
-                /*WHERE*/       "firstname.length() == 9",
+                /*WHERE*/       "firstname.startsWith('mp', 1)",
                 /*VARIABLES*/   null,
                 /*PARAMETERS*/  null,
                 /*IMPORTS*/     null,
@@ -241,20 +243,34 @@ public class SupportedStringMethods exte
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
                 /*TO*/          null),
+       new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null, 
+                /*INTO*/        null, 
+                /*FROM*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "firstname.length() == 9",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null), 
         new QueryElementHolder(
                 /*UNIQUE*/      null,
                 /*RESULT*/      null, 
                 /*INTO*/        null, 
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
-                /*WHERE*/       "firstname.charAt(3) == '1'",
+                /*WHERE*/       "firstname.trim() == 'emp1First'",
                 /*VARIABLES*/   null,
                 /*PARAMETERS*/  null,
                 /*IMPORTS*/     null,
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null),
+                /*TO*/          null)
     };
 
     /** 
@@ -279,6 +295,8 @@ public class SupportedStringMethods exte
         getTransientCompanyModelInstancesAsList(new String[]{
         		"emp1", "emp2", "emp3", "emp4", "emp5"}),
         getTransientCompanyModelInstancesAsList(new String[]{
+        		"emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{
         		"emp1", "emp2", "emp3", "emp4", "emp5"}),
         getTransientCompanyModelInstancesAsList(new String[]{
         		"emp1", "emp2", "emp3", "emp4", "emp5"}),
@@ -369,6 +387,12 @@ public class SupportedStringMethods exte
         executeQuery(index);
     }
 
+    /** */
+    public void testTrim() {
+        int index = 14;
+        executeQuery(index);
+    }
+
     /**
      * @see JDO_Test#localSetUp()
      */



Mime
View raw message