db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject svn commit: r1185498 - in /db/jdo/trunk/tck/src: conf/ java/org/apache/jdo/tck/pc/query/ java/org/apache/jdo/tck/query/jdoql/methods/ jdo/applicationidentity/org/apache/jdo/tck/pc/query/ jdo/datastoreidentity/org/apache/jdo/tck/pc/query/ orm/applicatio...
Date Tue, 18 Oct 2011 06:39:14 GMT
Author: andyj
Date: Tue Oct 18 06:39:13 2011
New Revision: 1185498

URL: http://svn.apache.org/viewvc?rev=1185498&view=rev
Log:
JDO-658 Tests for Math.sin, Math.cos, Math.tan, Time.getHour, Time.getMinute, Time.getSecond

Added:
    db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/MathSample.java
    db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/TimeSample.java
    db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedTimeMethods.java
Modified:
    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/SupportedMathMethods.java
    db/jdo/trunk/tck/src/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo
    db/jdo/trunk/tck/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo
    db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-standard.orm
    db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-standard.orm
    db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql
    db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql

Modified: db/jdo/trunk/tck/src/conf/jdoql.conf
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/conf/jdoql.conf?rev=1185498&r1=1185497&r2=1185498&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/conf/jdoql.conf (original)
+++ db/jdo/trunk/tck/src/conf/jdoql.conf Tue Oct 18 06:39:13 2011
@@ -62,6 +62,7 @@ org.apache.jdo.tck.query.jdoql.methods.M
 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.SupportedTimeMethods \
 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/java/org/apache/jdo/tck/pc/query/MathSample.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/MathSample.java?rev=1185498&view=auto
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/MathSample.java (added)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/MathSample.java Tue Oct 18 06:39:13
2011
@@ -0,0 +1,73 @@
+/*
+ * 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.pc.query;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+public class MathSample implements Serializable {
+	long id;
+
+	/** Angle in radians. */
+	BigDecimal angle;
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public BigDecimal getAngle() {
+		return angle;
+	}
+
+	public void setAngle(BigDecimal angle) {
+		this.angle = angle;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((angle == null) ? 0 : angle.hashCode());
+		result = prime * result + (int) (id ^ (id >>> 32));
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		MathSample other = (MathSample) obj;
+		if (angle == null) {
+			if (other.angle != null)
+				return false;
+		} else if (!angle.equals(other.angle))
+			return false;
+		if (id != other.id)
+			return false;
+		return true;
+	}
+
+}

Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/TimeSample.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/TimeSample.java?rev=1185498&view=auto
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/TimeSample.java (added)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/pc/query/TimeSample.java Tue Oct 18 06:39:13
2011
@@ -0,0 +1,72 @@
+/*
+ * 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.pc.query;
+
+import java.io.Serializable;
+import java.sql.Time;
+
+public class TimeSample implements Serializable {
+	long id;
+
+	Time time;
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public Time getTime() {
+		return time;
+	}
+
+	public void setTime(Time time) {
+		this.time = time;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + (int) (id ^ (id >>> 32));
+		result = prime * result + ((time == null) ? 0 : time.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		TimeSample other = (TimeSample) obj;
+		if (id != other.id)
+			return false;
+		if (time == null) {
+			if (other.time != null)
+				return false;
+		} else if (!time.equals(other.time))
+			return false;
+		return true;
+	}
+
+}

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=1185498&r1=1185497&r2=1185498&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
Tue Oct 18 06:39:13 2011
@@ -19,7 +19,6 @@ package org.apache.jdo.tck.query.jdoql.m
 
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Department;
 import org.apache.jdo.tck.pc.company.Person;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
@@ -35,12 +34,9 @@ import org.apache.jdo.tck.util.BatchTest
  *<B>Assertion Description: </B>
  * New supported Date methods:
  * <ul>
- * <li> getHour()
- * <li> getMinutes()
- * <li> getSeconds()
- * <li> getDay()
- * <li> getMonth()
- * <li> getYear()
+ * <li>getDay()</li>
+ * <li>getMonth()</li>
+ * <li>getYear()</li>
  * </ul>
  */
 public class SupportedDateMethods extends QueryTest {

Modified: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java?rev=1185498&r1=1185497&r2=1185498&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java
(original)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java
Tue Oct 18 06:39:13 2011
@@ -17,9 +17,18 @@
 
 package org.apache.jdo.tck.query.jdoql.methods;
 
+import java.math.BigDecimal;
+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.mylib.MylibReader;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.pc.query.MathSample;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -34,8 +43,9 @@ import org.apache.jdo.tck.util.BatchTest
  *<B>Assertion Description: </B>
  * Supported Math methods:
  * <ul>
- * <li> Math.abs(numeric)
- * <li> Math.sqrt(numeric)
+ * <li>Math.abs(numeric)</li>
+ * <li>Math.sqrt(numeric)</li>
+ * <li>Math.sin(numeric)</li>
  * </ul>
  */
 public class SupportedMathMethods extends QueryTest {
@@ -240,6 +250,15 @@ public class SupportedMathMethods extend
                 /*TO*/          null),
     };
 
+    /** */
+    private Object oidOfMath1;
+
+    /** */
+    private Object oidOfMath2;
+
+    /** */
+    private Object oidOfMath3;
+
     /** 
      * The expected results of valid queries testing Math.abs.
      */
@@ -290,7 +309,7 @@ public class SupportedMathMethods extend
     public static void main(String[] args) {
         BatchTestRunner.run(SupportedMathMethods.class);
     }
-    
+
     /** */
     public void testAbs() {
         for (int i = 0; i < VALID_QUERIES_ABS.length; i++) {
@@ -300,7 +319,7 @@ public class SupportedMathMethods extend
                     expectedResultABS[i]);
         }
     }
-    
+
     /** */
     public void testSqrt() {
         for (int i = 0; i < VALID_QUERIES_SQRT.length; i++) {
@@ -311,12 +330,175 @@ public class SupportedMathMethods extend
         }
     }
 
+    /** 
+     * Tests for Math.sin()
+     */
+    @SuppressWarnings("unchecked")
+	public void testSin() {
+    	insertMathSampleData(getPM());
+
+        PersistenceManager pm  = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            String filter = "Math.sin(angle) < 0.02 && Math.sin(angle) > -0.02";
+            Collection expectedResult = new ArrayList();
+            expectedResult.add(pm.getObjectById(oidOfMath1));
+            expectedResult.add(pm.getObjectById(oidOfMath3));
+            Query q =  pm.newQuery();
+            q.setClass(MathSample.class);
+            q.setFilter(filter);
+            Collection results = (Collection)q.execute();
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+
+            filter = "Math.sin(angle) < 1.02 && Math.sin(angle) > 0.98";
+            expectedResult.clear();
+            expectedResult.add(pm.getObjectById(oidOfMath2));
+            q =  pm.newQuery();
+            q.setClass(MathSample.class);
+            q.setFilter(filter);
+            results = (Collection)q.execute();
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+
+            filter = "Math.sin(angle) < -0.98 && Math.sin(angle) > -1.02";
+            expectedResult.clear();
+            q =  pm.newQuery();
+            q.setClass(MathSample.class);
+            q.setFilter(filter);
+            results = (Collection)q.execute();
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+
+            tx.commit();
+            tx = null;
+        } 
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** 
+     * Tests for Math.cos()
+     */
+    @SuppressWarnings("unchecked")
+	public void testCos() {
+    	insertMathSampleData(getPM());
+
+        PersistenceManager pm  = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            String filter = "Math.cos(angle) < 0.02 && Math.cos(angle) > -0.02";
+            Collection expectedResult = new ArrayList();
+            expectedResult.add(pm.getObjectById(oidOfMath2));
+            Query q =  pm.newQuery();
+            q.setClass(MathSample.class);
+            q.setFilter(filter);
+            Collection results = (Collection)q.execute();
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+
+            filter = "Math.cos(angle) < -0.98 && Math.cos(angle) > -1.02";
+            expectedResult.clear();
+            expectedResult.add(pm.getObjectById(oidOfMath1));
+            q =  pm.newQuery();
+            q.setClass(MathSample.class);
+            q.setFilter(filter);
+            results = (Collection)q.execute();
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+
+            filter = "Math.cos(angle) < 1.02 && Math.cos(angle) > 0.98";
+            expectedResult.clear();
+            expectedResult.add(pm.getObjectById(oidOfMath3));
+            q =  pm.newQuery();
+            q.setClass(MathSample.class);
+            q.setFilter(filter);
+            results = (Collection)q.execute();
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+
+            tx.commit();
+            tx = null;
+        } 
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** 
+     * Tests for Math.tan()
+     */
+    @SuppressWarnings("unchecked")
+	public void testTan() {
+    	insertMathSampleData(getPM());
+
+        PersistenceManager pm  = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            String filter = "Math.tan(angle) < 0.02 && Math.tan(angle) > -0.02";
+            Collection expectedResult = new ArrayList();
+            expectedResult.add(pm.getObjectById(oidOfMath1));
+            expectedResult.add(pm.getObjectById(oidOfMath3));
+            Query q =  pm.newQuery();
+            q.setClass(MathSample.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(MylibReader.getTearDownClasses());
+        addTearDownClass(MathSample.class);
         loadAndPersistMylib(getPM());
     }
 
+    /** */
+	private void insertMathSampleData(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            // Sample 1 : angle=PI (180 degrees)
+            MathSample ms1 = new MathSample();
+            ms1.setId(1);
+            ms1.setAngle(new BigDecimal(Math.PI));
+            pm.makePersistent(ms1);
+
+            // Sample 2 : angle=PI/2 (90 degrees)
+            MathSample ms2 = new MathSample();
+            ms2.setId(2);
+            ms2.setAngle(new BigDecimal(Math.PI/2.0));
+            pm.makePersistent(ms2);
+
+            // Sample 3 : angle=0 (0 degrees)
+            MathSample ms3 = new MathSample();
+            ms3.setId(3);
+            ms3.setAngle(new BigDecimal(0));
+            pm.makePersistent(ms3);
+
+            tx.commit();
+            oidOfMath1 = pm.getObjectId(ms1);
+            oidOfMath2 = pm.getObjectId(ms2);
+            oidOfMath3 = pm.getObjectId(ms3);
+            tx = null;
+        } 
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
 }

Added: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedTimeMethods.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedTimeMethods.java?rev=1185498&view=auto
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedTimeMethods.java
(added)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedTimeMethods.java
Tue Oct 18 06:39:13 2011
@@ -0,0 +1,185 @@
+/*
+ * 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.sql.Time;
+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.query.TimeSample;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Supported Time methods.
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-47.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * New supported Time methods:
+ * <ul>
+ * <li>getHour()</li>
+ * <li>getMinute()</li>
+ * <li>getSecond()</li>
+ * </ul>
+ */
+public class SupportedTimeMethods extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-47 (SupportedTimeMethods) failed: ";
+
+    /** */
+    private Object oidOfTime1;
+
+    /** */
+    private Object oidOfTime2;
+
+    /**
+     * 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(SupportedTimeMethods.class);
+    }
+
+    /** */
+    @SuppressWarnings("unchecked")
+	public void testHour() {
+        final String filter = "time.getHour() == 10";
+        PersistenceManager pm  = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            Collection expectedResult = new ArrayList();
+            expectedResult.add(pm.getObjectById(oidOfTime1));
+
+            Query q =  pm.newQuery();
+            q.setClass(TimeSample.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();
+        }
+    }
+
+    /** */
+    @SuppressWarnings("unchecked")
+	public void testMinute() {
+        final String filter = "time.getMinute() == 15";
+        PersistenceManager pm  = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            Collection expectedResult = new ArrayList();
+            expectedResult.add(pm.getObjectById(oidOfTime2));
+
+            Query q =  pm.newQuery();
+            q.setClass(TimeSample.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();
+        }
+    }
+
+    /** */
+    @SuppressWarnings("unchecked")
+	public void testSecond() {
+        final String filter = "time.getSecond() == 45";
+        PersistenceManager pm  = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            Collection expectedResult = new ArrayList();
+            expectedResult.add(pm.getObjectById(oidOfTime2));
+
+            Query q =  pm.newQuery();
+            q.setClass(TimeSample.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(TimeSample.class);
+        insertTimeSampleData(getPM());
+    }
+
+    /** */
+    @SuppressWarnings("deprecation")
+	private void insertTimeSampleData(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            TimeSample ts1 = new TimeSample();
+            ts1.setId(1);
+            Time time = new Time(0);
+            time.setHours(10);
+            time.setMinutes(0);
+            time.setSeconds(0);
+            ts1.setTime(time);
+            pm.makePersistent(ts1);
+
+            TimeSample ts2 = new TimeSample();
+            ts2.setId(2);
+            Time time2 = new Time(0);
+            time2.setHours(16);
+            time2.setMinutes(15);
+            time2.setSeconds(45);
+            ts2.setTime(time2);
+            pm.makePersistent(ts2);
+            tx.commit();
+            oidOfTime1 = pm.getObjectId(ts1);
+            oidOfTime2 = pm.getObjectId(ts2);
+            tx = null;
+        } 
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Modified: db/jdo/trunk/tck/src/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo?rev=1185498&r1=1185497&r2=1185498&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo (original)
+++ db/jdo/trunk/tck/src/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo Tue
Oct 18 06:39:13 2011
@@ -32,6 +32,14 @@
       <field name="id" primary-key="true"/>
     </class>
 
+    <class name="TimeSample" identity-type="application">
+      <field name="id" primary-key="true"/>
+      <field name="time" persistence-modifier="persistent"/>
+    </class>
+
+    <class name="MathSample" identity-type="application">
+      <field name="id" primary-key="true"/>
+      <field name="angle" persistence-modifier="persistent"/>
+    </class>
   </package>
 </jdo>
-

Modified: db/jdo/trunk/tck/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo?rev=1185498&r1=1185497&r2=1185498&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo (original)
+++ db/jdo/trunk/tck/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo Tue
Oct 18 06:39:13 2011
@@ -21,7 +21,17 @@
 	http://java.sun.com/xml/ns/jdo/jdo_3_0.xsd">
   <package name="org.apache.jdo.tck.pc.query">
     <class name="JDOQLKeywordsAsFieldNames" identity-type="datastore"/>
+
     <class name="NoExtent" requires-extent="false" identity-type="datastore"/>
+
+    <class name="TimeSample">
+      <field name="time" persistence-modifier="persistent"/>
+    </class>
+
+    <class name="MathSample">
+      <field name="angle" persistence-modifier="persistent"/>
+    </class>
   </package>
+
 </jdo>
 

Modified: db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-standard.orm
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-standard.orm?rev=1185498&r1=1185497&r2=1185498&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-standard.orm
(original)
+++ db/jdo/trunk/tck/src/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-standard.orm
Tue Oct 18 06:39:13 2011
@@ -29,6 +29,17 @@
       <field name="id" column="ID"/>
     </class>
 
+    <class name="TimeSample" table="TimeSample">
+      <field name="id" column="ID"/>
+      <field name="time" column="TIME"/>
+    </class>
+
+    <class name="MathSample" table="MathSample">
+      <field name="id" column="ID"/>
+      <field name="angle">
+        <column name="ANGLE" precision="18" scale="8"/>
+      </field>
+    </class>
   </package>
 </orm>
 

Modified: db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-standard.orm
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-standard.orm?rev=1185498&r1=1185497&r2=1185498&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-standard.orm
(original)
+++ db/jdo/trunk/tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-standard.orm
Tue Oct 18 06:39:13 2011
@@ -16,24 +16,37 @@
   limitations under the License.
 -->
 <!--
-This file contains the schema information when an implementation
-has datastore identity.
+This file contains the schema information when an implementation has datastore identity.
 -->
 <orm xmlns="http://java.sun.com/xml/ns/jdo/orm"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/orm 
 	http://java.sun.com/xml/ns/jdo/orm_2_1.xsd">
-    <package name="org.apache.jdo.tck.pc.query">
+  <package name="org.apache.jdo.tck.pc.query">
 
-        <class name="JDOQLKeywordsAsFieldNames" table="JDOQLKeywordsAsFieldNames">
-            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
-            <field name="select" column="ID"/>
-        </class>
+    <class name="JDOQLKeywordsAsFieldNames" table="JDOQLKeywordsAsFieldNames">
+      <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+      <field name="select" column="ID"/>
+    </class>
 
-        <class name="NoExtent" table="NoExtent">
-            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
-            <field name="id" column="ID"/>
-        </class>
+    <class name="NoExtent" table="NoExtent">
+      <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+      <field name="id" column="ID"/>
+    </class>
+
+    <class name="TimeSample" table="TimeSample">
+      <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+      <field name="id" column="ID"/>
+      <field name="time" column="TIME"/>
+    </class>
+
+    <class name="MathSample" table="MathSample">
+      <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+      <field name="id" column="ID"/>
+      <field name="angle">
+        <column name="ANGLE" precision="18" scale="8"/>
+      </field>
+    </class>
 
     </package>
 </orm>

Modified: db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql?rev=1185498&r1=1185497&r2=1185498&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql (original)
+++ db/jdo/trunk/tck/src/sql/derby/applicationidentity/schema.sql Tue Oct 18 06:39:13 2011
@@ -135,6 +135,8 @@ CREATE TABLE PCClass (
 
 DROP TABLE JDOQLKeywordsAsFieldNames;
 DROP TABLE NoExtent;
+DROP TABLE TimeSample;
+DROP TABLE MathSample;
 
 CREATE TABLE JDOQLKeywordsAsFieldNames (
     ID VARCHAR(64) NOT NULL,
@@ -146,6 +148,18 @@ CREATE TABLE NoExtent (
     CONSTRAINT NOEXTENT_PK PRIMARY KEY (ID)
 );
 
+CREATE TABLE TimeSample (
+    ID INTEGER NOT NULL,
+    TIME TIME,
+    CONSTRAINT TIMESAMPLE_PK PRIMARY KEY (ID)
+);
+
+CREATE TABLE MathSample (
+    ID INTEGER NOT NULL,
+    ANGLE DECIMAL(18,8),
+    CONSTRAINT MATHSAMPLE_PK PRIMARY KEY (ID)
+);
+
 -------------------------
 -- singlefieldidentity
 -------------------------

Modified: db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql?rev=1185498&r1=1185497&r2=1185498&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql (original)
+++ db/jdo/trunk/tck/src/sql/derby/datastoreidentity/schema.sql Tue Oct 18 06:39:13 2011
@@ -121,6 +121,8 @@ CREATE TABLE PCClass (
 
 DROP TABLE JDOQLKeywordsAsFieldNames;
 DROP TABLE NoExtent;
+DROP TABLE TimeSample;
+DROP TABLE MathSample;
 
 CREATE TABLE JDOQLKeywordsAsFieldNames (
     DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
@@ -134,6 +136,20 @@ CREATE TABLE NoExtent (
     CONSTRAINT NOEXTENT_PK PRIMARY KEY (DATASTORE_IDENTITY)
 );
 
+CREATE TABLE TimeSample (
+    DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+    ID INTEGER NOT NULL,
+    TIME TIME,
+    CONSTRAINT TIMESAMPLE_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
+CREATE TABLE MathSample (
+    DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+    ID INTEGER NOT NULL,
+    ANGLE DECIMAL(18,8),
+    CONSTRAINT MATHSAMPLE_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
 -------------------------
 -- company
 -------------------------



Mime
View raw message