Repository navigation
[OPENJPA-3028] Oracle unit tests and test profiles #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+187
−85
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3b725ec
[OPENJPA-3028] Load COALESCE, CASE and NULLIF of a java.sql.Date or T…
rzo1 f5652b9
[OPENJPA-3028] Do not use a BIGINT column definition in TestBulkDelet…
rzo1 d5275f8
[OPENJPA-3028] Compare the Oracle result of NULLIF on a date as a date
rzo1 b7e9e3a
[OPENJPA-3028] Do not batch the statements counted in TestDeleteOrder…
rzo1 1a6e5d2
[OPENJPA-3028] Run the test-oracle-docker profile on Oracle Database …
rzo1 372cef3
[OPENJPA-3028] Use the ojdbc11 driver from Maven Central in the test-…
rzo1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...a/org/apache/openjpa/persistence/jpql/expressions/TestTemporalConditionalExpressions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.openjpa.persistence.jpql.expressions; | ||
|
|
||
| import java.sql.Date; | ||
| import java.sql.Time; | ||
| import java.util.List; | ||
|
|
||
| import jakarta.persistence.EntityManager; | ||
|
|
||
| import org.apache.openjpa.persistence.simple.AllFieldTypes; | ||
| import org.apache.openjpa.persistence.test.SingleEMFTestCase; | ||
|
|
||
| /** | ||
| * COALESCE and CASE over a java.sql.Date or java.sql.Time field return a value of the type of the field, also | ||
| * when the driver returns another type for the column, such as the Timestamp the Oracle driver returns for the | ||
| * DATE column of such a field. | ||
| */ | ||
| public class TestTemporalConditionalExpressions extends SingleEMFTestCase { | ||
|
|
||
| private static final Date DATE = Date.valueOf("2021-01-03"); | ||
| private static final Time TIME = Time.valueOf("10:20:30"); | ||
|
|
||
| @Override | ||
| public void setUp() { | ||
| setUp(AllFieldTypes.class, CLEAR_TABLES); | ||
| try (EntityManager em = emf.createEntityManager()) { | ||
| em.getTransaction().begin(); | ||
| AllFieldTypes e = new AllFieldTypes(); | ||
| e.setSqlDateField(DATE); | ||
| e.setSqlTimeField(TIME); | ||
| em.persist(e); | ||
| em.getTransaction().commit(); | ||
| } | ||
| } | ||
|
|
||
| public void testDate() { | ||
| assertResult(DATE, "SELECT COALESCE(e.sqlDateField, e.sqlDateField) FROM AllFieldTypes e"); | ||
| assertResult(DATE, "SELECT CASE WHEN e.intField = 0 THEN e.sqlDateField ELSE e.sqlDateField END " | ||
| + "FROM AllFieldTypes e"); | ||
| } | ||
|
|
||
| public void testTime() { | ||
| assertResult(TIME, "SELECT COALESCE(e.sqlTimeField, e.sqlTimeField) FROM AllFieldTypes e"); | ||
| assertResult(TIME, "SELECT CASE WHEN e.intField = 0 THEN e.sqlTimeField ELSE e.sqlTimeField END " | ||
| + "FROM AllFieldTypes e"); | ||
| } | ||
|
|
||
| private void assertResult(Object expected, String jpql) { | ||
| try (EntityManager em = emf.createEntityManager()) { | ||
| List<?> result = em.createQuery(jpql).getResultList(); | ||
| assertEquals(jpql, 1, result.size()); | ||
| assertEquals(jpql, expected.getClass(), result.get(0).getClass()); | ||
| assertEquals(jpql, expected.toString(), result.get(0).toString()); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.