Index: tck/src/conf/jdoql.conf
===================================================================
--- tck/src/conf/jdoql.conf (revision 1806216)
+++ tck/src/conf/jdoql.conf (working copy)
@@ -64,6 +64,9 @@
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.SupportedLocalDateMethods \
+org.apache.jdo.tck.query.jdoql.methods.SupportedLocalDateTimeMethods \
+org.apache.jdo.tck.query.jdoql.methods.SupportedLocalTimeMethods \
org.apache.jdo.tck.query.jdoql.methods.SupportedTimeMethods \
org.apache.jdo.tck.query.jdoql.methods.SupportedJDOHelperMethods \
org.apache.jdo.tck.query.jdoql.methods.SupportedListMethods \
Index: tck/src/java/org/apache/jdo/tck/pc/query/LocalDateSample.java
===================================================================
--- tck/src/java/org/apache/jdo/tck/pc/query/LocalDateSample.java (nonexistent)
+++ tck/src/java/org/apache/jdo/tck/pc/query/LocalDateSample.java (working copy)
@@ -0,0 +1,70 @@
+/*
+ * 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.time.LocalDate;
+
+public class LocalDateSample implements Serializable {
+
+ private long id;
+ private LocalDate localDate;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public LocalDate getLocalDate() {
+ return localDate;
+ }
+
+ public void setLocalDate(LocalDate localDate) {
+ this.localDate = localDate;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + ((localDate == null) ? 0 : localDate.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;
+ LocalDateSample other = (LocalDateSample) obj;
+ if (id != other.id)
+ return false;
+ if (localDate == null) {
+ if (other.localDate != null)
+ return false;
+ } else if (!localDate.equals(other.localDate))
+ return false;
+ return true;
+ }
+}
Index: tck/src/java/org/apache/jdo/tck/pc/query/LocalDateTimeSample.java
===================================================================
--- tck/src/java/org/apache/jdo/tck/pc/query/LocalDateTimeSample.java (nonexistent)
+++ tck/src/java/org/apache/jdo/tck/pc/query/LocalDateTimeSample.java (working copy)
@@ -0,0 +1,70 @@
+/*
+ * 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.time.LocalDateTime;
+
+public class LocalDateTimeSample implements Serializable {
+
+ private long id;
+ private LocalDateTime localDateTime;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public LocalDateTime getLocalDateTime() {
+ return localDateTime;
+ }
+
+ public void setLocalDateTime(LocalDateTime localDateTime) {
+ this.localDateTime = localDateTime;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + ((localDateTime == null) ? 0 : localDateTime.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;
+ LocalDateTimeSample other = (LocalDateTimeSample) obj;
+ if (id != other.id)
+ return false;
+ if (localDateTime == null) {
+ if (other.localDateTime != null)
+ return false;
+ } else if (!localDateTime.equals(other.localDateTime))
+ return false;
+ return true;
+ }
+}
Index: tck/src/java/org/apache/jdo/tck/pc/query/LocalTimeSample.java
===================================================================
--- tck/src/java/org/apache/jdo/tck/pc/query/LocalTimeSample.java (nonexistent)
+++ tck/src/java/org/apache/jdo/tck/pc/query/LocalTimeSample.java (working copy)
@@ -0,0 +1,70 @@
+/*
+ * 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.time.LocalTime;
+
+public class LocalTimeSample implements Serializable {
+
+ private long id;
+ private LocalTime localTime;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public LocalTime getLocalTime() {
+ return localTime;
+ }
+
+ public void setLocalTime(LocalTime localTime) {
+ this.localTime = localTime;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + ((localTime == null) ? 0 : localTime.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;
+ LocalTimeSample other = (LocalTimeSample) obj;
+ if (id != other.id)
+ return false;
+ if (localTime == null) {
+ if (other.localTime != null)
+ return false;
+ } else if (!localTime.equals(other.localTime))
+ return false;
+ return true;
+ }
+}
Index: tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalDateMethods.java
===================================================================
--- tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalDateMethods.java (nonexistent)
+++ tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalDateMethods.java (working copy)
@@ -0,0 +1,168 @@
+/*
+ * 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 org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.query.LocalDateSample;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import java.time.LocalDate;
+import java.time.Month;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *Title: Supported LocalDate methods.
+ *
+ *Keywords: query
+ *
+ *Assertion ID: A14.6.2-60.
+ *
+ *Assertion Description:
+ * New supported LocalDate methods:
+ *
+ * - getDayOfMonth()
+ * - getMonthValue()
+ * - getYear()
+ *
+ */
+public class SupportedLocalDateMethods extends QueryTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A14.6.2-60 (SupportedLocalDateMethods) failed: ";
+
+ /** */
+ private Object oidOfLocalDate1;
+
+ /** */
+ private Object oidOfLocalDate2;
+
+ /**
+ * The 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(SupportedLocalDateMethods.class);
+ }
+
+ /** */
+ public void testDayOfMonth() {
+ final String filter = "localDate.getDayOfMonth() == 12";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateSample)pm.getObjectById(oidOfLocalDate1));
+
+ Query q = pm.newQuery(LocalDateSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testMonthValue() {
+ final String filter = "localDate.getMonthValue() == 8";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateSample)pm.getObjectById(oidOfLocalDate2));
+
+ Query q = pm.newQuery(LocalDateSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testYear() {
+ final String filter = "localDate.getYear() == 2017";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateSample)pm.getObjectById(oidOfLocalDate1));
+ expectedResult.add((LocalDateSample)pm.getObjectById(oidOfLocalDate2));
+
+ Query q = pm.newQuery(LocalDateSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /**
+ * @see JDO_Test#localSetUp()
+ */
+ protected void localSetUp() {
+ addTearDownClass(LocalDateSample.class);
+ insertLocalDateSampleData(getPM());
+ }
+
+ /** */
+ private void insertLocalDateSampleData(PersistenceManager pm) {
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+
+ LocalDateSample lds1 = new LocalDateSample();
+ lds1.setId(1);
+ LocalDate localDate1 = LocalDate.of(2017, Month.SEPTEMBER, 12);
+ lds1.setLocalDate(localDate1);
+ pm.makePersistent(lds1);
+
+ LocalDateSample lds2 = new LocalDateSample();
+ lds2.setId(2);
+ LocalDate localDate2 = LocalDate.of(2017, Month.AUGUST, 20);
+ lds2.setLocalDate(localDate2);
+ pm.makePersistent(lds2);
+
+ tx.commit();
+ oidOfLocalDate1 = pm.getObjectId(lds1);
+ oidOfLocalDate2 = pm.getObjectId(lds2);
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+}
Index: tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalDateTimeMethods.java
===================================================================
--- tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalDateTimeMethods.java (nonexistent)
+++ tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalDateTimeMethods.java (working copy)
@@ -0,0 +1,235 @@
+/*
+ * 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 org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.query.LocalDateTimeSample;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import java.time.LocalDateTime;
+import java.time.Month;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *Title: Supported LocalDateTime methods.
+ *
+ *Keywords: query
+ *
+ *Assertion ID: A14.6.2-60.
+ *
+ *Assertion Description:
+ * New supported LocalDateTime methods:
+ *
+ * - getDayOfMonth()
+ * - getMonthValue()
+ * - getYear()
+ * - getHour()
+ * - getMinute()
+ * - getSecond()
+ *
+ */
+public class SupportedLocalDateTimeMethods extends QueryTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A14.6.2-60 (SupportedLocalDateTimeMethods) failed: ";
+
+ /** */
+ private Object oidOfLocalDateTime1;
+
+ /** */
+ private Object oidOfLocalDateTime2;
+
+ /**
+ * The 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(SupportedLocalDateTimeMethods.class);
+ }
+
+ /** */
+ public void testDayOfMonth() {
+ final String filter = "localDateTime.getDayOfMonth() == 12";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateTimeSample)pm.getObjectById(oidOfLocalDateTime1));
+
+ Query q = pm.newQuery(LocalDateTimeSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testMonthValue() {
+ final String filter = "localDateTime.getMonthValue() == 8";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateTimeSample)pm.getObjectById(oidOfLocalDateTime2));
+
+ Query q = pm.newQuery(LocalDateTimeSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testYear() {
+ final String filter = "localDateTime.getYear() == 2017";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateTimeSample)pm.getObjectById(oidOfLocalDateTime1));
+ expectedResult.add((LocalDateTimeSample)pm.getObjectById(oidOfLocalDateTime2));
+
+ Query q = pm.newQuery(LocalDateTimeSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testHour() {
+ final String filter = "localDateTime.getHour() == 14";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateTimeSample)pm.getObjectById(oidOfLocalDateTime1));
+
+ Query q = pm.newQuery(LocalDateTimeSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testMinute() {
+ final String filter = "localDateTime.getMinute() == 22";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateTimeSample)pm.getObjectById(oidOfLocalDateTime2));
+
+ Query q = pm.newQuery(LocalDateTimeSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testSecond() {
+ final String filter = "localDateTime.getSecond() == 25";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList<>();
+ expectedResult.add((LocalDateTimeSample)pm.getObjectById(oidOfLocalDateTime1));
+
+ Query q = pm.newQuery(LocalDateTimeSample.class, filter);
+ List results = q.executeList();
+ 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(LocalDateTimeSample.class);
+ insertLocalDateTimeSampleData(getPM());
+ }
+
+ /** */
+ private void insertLocalDateTimeSampleData(PersistenceManager pm) {
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+
+ LocalDateTimeSample lds1 = new LocalDateTimeSample();
+ lds1.setId(1);
+ LocalDateTime localDateTime1 = LocalDateTime.of(2017, Month.SEPTEMBER, 12, 14, 10, 25);
+ lds1.setLocalDateTime(localDateTime1);
+ pm.makePersistent(lds1);
+
+ LocalDateTimeSample lds2 = new LocalDateTimeSample();
+ lds2.setId(2);
+ LocalDateTime localDateTime2 = LocalDateTime.of(2017, Month.AUGUST, 20, 9, 22, 12);
+ lds2.setLocalDateTime(localDateTime2);
+ pm.makePersistent(lds2);
+
+ tx.commit();
+ oidOfLocalDateTime1 = pm.getObjectId(lds1);
+ oidOfLocalDateTime2 = pm.getObjectId(lds2);
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+}
Index: tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalTimeMethods.java
===================================================================
--- tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalTimeMethods.java (nonexistent)
+++ tck/src/java/org/apache/jdo/tck/query/jdoql/methods/SupportedLocalTimeMethods.java (working copy)
@@ -0,0 +1,169 @@
+/*
+ * 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 org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.query.LocalTimeSample;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import java.time.LocalTime;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *Title: Supported LocalTime methods.
+ *
+ *Keywords: query
+ *
+ *Assertion ID: A14.6.2-60.
+ *
+ *Assertion Description:
+ * New supported LocalTime methods:
+ *
+ * - getHour()
+ * - getMinute()
+ * - getSecond()
+ *
+ */
+public class SupportedLocalTimeMethods extends QueryTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A14.6.2-60 (SupportedLocalTimeMethods) failed: ";
+
+ /** */
+ private Object oidOfLocalTime1;
+
+ /** */
+ private Object oidOfLocalTime2;
+
+ /**
+ * The 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(SupportedLocalTimeMethods.class);
+ }
+
+ /** */
+ public void testHour() {
+ final String filter = "localTime.getHour() == 14";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList();
+ expectedResult.add((LocalTimeSample)pm.getObjectById(oidOfLocalTime1));
+
+ Query q = pm.newQuery(LocalTimeSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testMinute() {
+ final String filter = "localTime.getMinute() == 22";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList();
+ expectedResult.add((LocalTimeSample)pm.getObjectById(oidOfLocalTime2));
+
+ Query q = pm.newQuery(LocalTimeSample.class, filter);
+ List results = q.executeList();
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, filter, results, expectedResult);
+ tx.commit();
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+
+ /** */
+ public void testSecond() {
+ final String filter = "localTime.getSecond() == 25";
+ PersistenceManager pm = getPM();
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+ List expectedResult = new ArrayList();
+ expectedResult.add((LocalTimeSample)pm.getObjectById(oidOfLocalTime1));
+
+ Query q = pm.newQuery(LocalTimeSample.class, filter);
+ List results = q.executeList();
+ 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(LocalTimeSample.class);
+ insertLocalTimeSampleData(getPM());
+ }
+
+ /** */
+ private void insertLocalTimeSampleData(PersistenceManager pm) {
+ Transaction tx = pm.currentTransaction();
+ try {
+ tx.begin();
+
+ LocalTimeSample lds1 = new LocalTimeSample();
+ lds1.setId(1);
+ LocalTime localTime1 = LocalTime.of(14, 10, 25);
+ lds1.setLocalTime(localTime1);
+ pm.makePersistent(lds1);
+
+ LocalTimeSample lds2 = new LocalTimeSample();
+ lds2.setId(2);
+ LocalTime localTime2 = LocalTime.of(9, 22, 12);
+ lds2.setLocalTime(localTime2);
+ pm.makePersistent(lds2);
+
+ tx.commit();
+ oidOfLocalTime1 = pm.getObjectId(lds1);
+ oidOfLocalTime2 = pm.getObjectId(lds2);
+ tx = null;
+ }
+ finally {
+ if ((tx != null) && tx.isActive())
+ tx.rollback();
+ }
+ }
+}
Index: tck/src/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo
===================================================================
--- tck/src/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo (revision 1806216)
+++ tck/src/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo (working copy)
@@ -37,8 +37,23 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: tck/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo
===================================================================
--- tck/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo (revision 1806216)
+++ tck/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo (working copy)
@@ -28,6 +28,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-standard.orm
===================================================================
--- tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-standard.orm (revision 1806216)
+++ tck/src/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-standard.orm (working copy)
@@ -40,9 +40,27 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: tck/src/sql/derby/applicationidentity/schema.sql
===================================================================
--- tck/src/sql/derby/applicationidentity/schema.sql (revision 1806216)
+++ tck/src/sql/derby/applicationidentity/schema.sql (working copy)
@@ -155,6 +155,24 @@
CONSTRAINT TIMESAMPLE_PK PRIMARY KEY (ID)
);
+CREATE TABLE LocalDateSample (
+ ID INTEGER NOT NULL,
+ LOCAL_DATE DATE,
+ CONSTRAINT LOCALDATESAMPLE_PK PRIMARY KEY (ID)
+);
+
+CREATE TABLE LocalDateTimeSample (
+ ID INTEGER NOT NULL,
+ LOCAL_DATE_TIME TIMESTAMP,
+ CONSTRAINT LOCALDATETIMESAMPLE_PK PRIMARY KEY (ID)
+);
+
+CREATE TABLE LocalTimeSample (
+ ID INTEGER NOT NULL,
+ LOCAL_TIME TIME,
+ CONSTRAINT LOCALTIMESAMPLE_PK PRIMARY KEY (ID)
+);
+
CREATE TABLE OptionalSample (
ID INTEGER NOT NULL,
OPTIONAL_PC INTEGER REFERENCES OptionalSample ON DELETE NO ACTION,
Index: tck/src/sql/derby/datastoreidentity/schema.sql
===================================================================
--- tck/src/sql/derby/datastoreidentity/schema.sql (revision 1806216)
+++ tck/src/sql/derby/datastoreidentity/schema.sql (working copy)
@@ -144,6 +144,27 @@
CONSTRAINT TIMESAMPLE_PK PRIMARY KEY (DATASTORE_IDENTITY)
);
+CREATE TABLE LocalDateSample (
+ DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+ ID INTEGER NOT NULL,
+ LOCAL_DATE DATE,
+ CONSTRAINT LOCALDATESAMPLE_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
+CREATE TABLE LocalDateTimeSample (
+ DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+ ID INTEGER NOT NULL,
+ LOCAL_DATE_TIME TIMESTAMP,
+ CONSTRAINT LOCALDATETIMESAMPLE_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
+CREATE TABLE LocalTimeSample (
+ DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+ ID INTEGER NOT NULL,
+ LOCAL_TIME TIME,
+ CONSTRAINT LOCALTIMESAMPLE_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
CREATE TABLE OptionalSample (
DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
ID INTEGER NOT NULL,