-
Notifications
You must be signed in to change notification settings - Fork 604
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
Recreate test for 30444 #30595
base: integration
Are you sure you want to change the base?
Recreate test for 30444 #30595
Conversation
#build (view Open Liberty Personal Build - ✅ completed successfully!) Note: Target locations of links might be accessible only to IBM employees. |
Code analysis and actionsDO NOT DELETE THIS COMMENT.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these tests. Please continue to work to get them closer to the scenario in #30444 that is failing on Oracle. If, after that, the error still does not reproduce, then work with Kyle on figuring out whether any differences in the Oracle version used might be the cause. If not that, then it will be necessary to look into whether preceding tests might contribute to the issue.
...pa_32_fat/test-applications/jakartadata/src/io/openliberty/jpa/data/tests/models/CityId.java
Show resolved
Hide resolved
...pa_32_fat/test-applications/jakartadata/src/io/openliberty/jpa/data/tests/models/CityId.java
Show resolved
Hide resolved
deleteAllEntities(City.class); | ||
// Setup test data | ||
City city1 = City.of("Prague", "Bohemia", 121878,Set.of(55901, 55902, 55903, 55904, 55906)); | ||
City city2 = City.of("Brno", "Moravia", 209352,Set.of(14601, 14602, 14603, 14604, 14606)); | ||
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | ||
|
||
// Persist the cities | ||
tx.begin(); | ||
em.persist(city1); | ||
em.persist(city2); | ||
em.persist(city3); | ||
tx.commit(); | ||
|
||
// Execute the JPQL query | ||
List<City> results; | ||
tx.begin(); | ||
try { | ||
results = em.createQuery("SELECT c FROM City c", City.class) | ||
.getResultList(); | ||
tx.commit(); | ||
} catch (Exception e) { | ||
tx.rollback(); | ||
throw e; | ||
} | ||
|
||
// Verify the results | ||
assertEquals(3, results.size()); | ||
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Prague"))); | ||
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Brno"))); | ||
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Ostrava"))); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, although a slightly different scenario and not properly indented
deleteAllEntities(City.class); | |
// Setup test data | |
City city1 = City.of("Prague", "Bohemia", 121878,Set.of(55901, 55902, 55903, 55904, 55906)); | |
City city2 = City.of("Brno", "Moravia", 209352,Set.of(14601, 14602, 14603, 14604, 14606)); | |
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | |
// Persist the cities | |
tx.begin(); | |
em.persist(city1); | |
em.persist(city2); | |
em.persist(city3); | |
tx.commit(); | |
// Execute the JPQL query | |
List<City> results; | |
tx.begin(); | |
try { | |
results = em.createQuery("SELECT c FROM City c", City.class) | |
.getResultList(); | |
tx.commit(); | |
} catch (Exception e) { | |
tx.rollback(); | |
throw e; | |
} | |
// Verify the results | |
assertEquals(3, results.size()); | |
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Prague"))); | |
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Brno"))); | |
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Ostrava"))); | |
} | |
deleteAllEntities(City.class); | |
// Set up test data | |
City city1 = City.of("Prague", "Bohemia", 121878,Set.of(55901, 55902, 55903, 55904, 55906)); | |
City city2 = City.of("Brno", "Moravia", 209352,Set.of(14601, 14602, 14603, 14604, 14606)); | |
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | |
// Persist the cities | |
tx.begin(); | |
em.persist(city1); | |
em.persist(city2); | |
em.persist(city3); | |
tx.commit(); | |
// Execute the JPQL query | |
List<City> results; | |
tx.begin(); | |
try { | |
results = em.createQuery("SELECT c FROM City c", City.class) | |
.getResultList(); | |
tx.commit(); | |
} catch (Exception e) { | |
tx.rollback(); | |
throw e; | |
} | |
// Verify the results | |
assertEquals(3, results.size()); | |
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Prague"))); | |
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Brno"))); | |
assertTrue(results.stream().anyMatch(c -> c.getName().equals("Ostrava"))); | |
} |
@Test | ||
//Reference issue https://github.com/OpenLiberty/open-liberty/issues/30444 | ||
public void testSelectCity_30444() throws Exception { | ||
deleteAllEntities(City.class); | ||
// Setup test data | ||
City city1 = City.of("Prague", "Bohemia", 1384732, Set.of(55901, 55902, 55903, 55904, 55906)); | ||
City city2 = City.of("Brno", "Moravia", 209352, Set.of(14601, 14602, 14603, 14604, 14606)); | ||
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | ||
|
||
// Persist the cities | ||
tx.begin(); | ||
em.persist(city1); | ||
em.persist(city2); | ||
em.persist(city3); | ||
tx.commit(); | ||
|
||
// Execute the JPQL query | ||
List<String> results; | ||
tx.begin(); | ||
try { | ||
results = em.createQuery("SELECT name FROM City WHERE name = :name ORDER BY population DESC", String.class) | ||
.setParameter("name", "Prague") | ||
.getResultList(); | ||
tx.commit(); | ||
} catch (Exception e) { | ||
tx.rollback(); | ||
throw e; | ||
} | ||
|
||
// Verify the results | ||
assertEquals(1, results.size()); | ||
assertEquals("Prague", results.get(0)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, although a slightly different scenario and not properly indented
@Test | |
//Reference issue https://github.com/OpenLiberty/open-liberty/issues/30444 | |
public void testSelectCity_30444() throws Exception { | |
deleteAllEntities(City.class); | |
// Setup test data | |
City city1 = City.of("Prague", "Bohemia", 1384732, Set.of(55901, 55902, 55903, 55904, 55906)); | |
City city2 = City.of("Brno", "Moravia", 209352, Set.of(14601, 14602, 14603, 14604, 14606)); | |
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | |
// Persist the cities | |
tx.begin(); | |
em.persist(city1); | |
em.persist(city2); | |
em.persist(city3); | |
tx.commit(); | |
// Execute the JPQL query | |
List<String> results; | |
tx.begin(); | |
try { | |
results = em.createQuery("SELECT name FROM City WHERE name = :name ORDER BY population DESC", String.class) | |
.setParameter("name", "Prague") | |
.getResultList(); | |
tx.commit(); | |
} catch (Exception e) { | |
tx.rollback(); | |
throw e; | |
} | |
// Verify the results | |
assertEquals(1, results.size()); | |
assertEquals("Prague", results.get(0)); | |
} | |
@Test | |
//Reference issue https://github.com/OpenLiberty/open-liberty/issues/30444 | |
public void testSelectCity_30444() throws Exception { | |
deleteAllEntities(City.class); | |
// Set up test data | |
City city1 = City.of("Prague", "Bohemia", 1384732, Set.of(55901, 55902, 55903, 55904, 55906)); | |
City city2 = City.of("Brno", "Moravia", 209352, Set.of(14601, 14602, 14603, 14604, 14606)); | |
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | |
// Persist the cities | |
tx.begin(); | |
em.persist(city1); | |
em.persist(city2); | |
em.persist(city3); | |
tx.commit(); | |
// Execute the JPQL query | |
List<String> results; | |
tx.begin(); | |
try { | |
results = em.createQuery("SELECT name FROM City WHERE name = :name ORDER BY population DESC", String.class) | |
.setParameter("name", "Prague") | |
.getResultList(); | |
tx.commit(); | |
} catch (Exception e) { | |
tx.rollback(); | |
throw e; | |
} | |
// Verify the results | |
assertEquals(1, results.size()); | |
assertEquals("Prague", results.get(0)); | |
} |
@Test | ||
//Reference issue https://github.com/OpenLiberty/open-liberty/issues/30444 | ||
public void testSelectKeys_30444() throws Exception { | ||
deleteAllEntities(City.class); | ||
// Setup test data | ||
City city1 = City.of("Prague", "Bohemia", 1384732, Set.of(55901, 55902, 55903, 55904, 55906)); | ||
City city2 = City.of("Brno", "Moravia", 209352, Set.of(14601, 14602, 14603, 14604, 14606)); | ||
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | ||
|
||
// Persist the cities | ||
tx.begin(); | ||
em.persist(city1); | ||
em.persist(city2); | ||
em.persist(city3); | ||
tx.commit(); | ||
|
||
// Execute the JPQL query | ||
List<CityId> results; | ||
tx.begin(); | ||
try { | ||
results = em.createQuery( | ||
"SELECT new io.openliberty.jpa.data.tests.models.CityId(c.name, c.stateName) FROM City c WHERE c.stateName = :stateName ORDER BY c.population DESC", | ||
CityId.class) | ||
.setParameter("stateName", "Bohemia") | ||
.getResultList(); | ||
tx.commit(); | ||
} catch (Exception e) { | ||
tx.rollback(); | ||
throw e; | ||
} | ||
|
||
// Verify the results | ||
assertEquals(1, results.size()); | ||
assertEquals("Prague", results.get(0).getName()); | ||
assertEquals("Bohemia", results.get(0).getStateName()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, although a slightly different scenario and not properly indented. This one seems to be the closest to the failing Jakarta Data test, although still has some differences such as ordering on the population attribute rather than the name attribute which is a component of the IdClass.
@Test | |
//Reference issue https://github.com/OpenLiberty/open-liberty/issues/30444 | |
public void testSelectKeys_30444() throws Exception { | |
deleteAllEntities(City.class); | |
// Setup test data | |
City city1 = City.of("Prague", "Bohemia", 1384732, Set.of(55901, 55902, 55903, 55904, 55906)); | |
City city2 = City.of("Brno", "Moravia", 209352, Set.of(14601, 14602, 14603, 14604, 14606)); | |
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | |
// Persist the cities | |
tx.begin(); | |
em.persist(city1); | |
em.persist(city2); | |
em.persist(city3); | |
tx.commit(); | |
// Execute the JPQL query | |
List<CityId> results; | |
tx.begin(); | |
try { | |
results = em.createQuery( | |
"SELECT new io.openliberty.jpa.data.tests.models.CityId(c.name, c.stateName) FROM City c WHERE c.stateName = :stateName ORDER BY c.population DESC", | |
CityId.class) | |
.setParameter("stateName", "Bohemia") | |
.getResultList(); | |
tx.commit(); | |
} catch (Exception e) { | |
tx.rollback(); | |
throw e; | |
} | |
// Verify the results | |
assertEquals(1, results.size()); | |
assertEquals("Prague", results.get(0).getName()); | |
assertEquals("Bohemia", results.get(0).getStateName()); | |
} | |
@Test | |
//Reference issue https://github.com/OpenLiberty/open-liberty/issues/30444 | |
public void testSelectKeys_30444() throws Exception { | |
deleteAllEntities(City.class); | |
// Set up test data | |
City city1 = City.of("Prague", "Bohemia", 1384732, Set.of(55901, 55902, 55903, 55904, 55906)); | |
City city2 = City.of("Brno", "Moravia", 209352, Set.of(14601, 14602, 14603, 14604, 14606)); | |
City city3 = City.of("Ostrava", "Silesia", 23456,Set.of(55906, 55907, 55908, 14604, 55902)); | |
// Persist the cities | |
tx.begin(); | |
em.persist(city1); | |
em.persist(city2); | |
em.persist(city3); | |
tx.commit(); | |
// Execute the JPQL query | |
List<CityId> results; | |
tx.begin(); | |
try { | |
results = em.createQuery( | |
"SELECT new io.openliberty.jpa.data.tests.models.CityId(c.name, c.stateName) FROM City c WHERE c.stateName = :stateName ORDER BY c.population DESC", | |
CityId.class) | |
.setParameter("stateName", "Bohemia") | |
.getResultList(); | |
tx.commit(); | |
} catch (Exception e) { | |
tx.rollback(); | |
throw e; | |
} | |
// Verify the results | |
assertEquals(1, results.size()); | |
assertEquals("Prague", results.get(0).getName()); | |
assertEquals("Bohemia", results.get(0).getStateName()); | |
} |
release bug
label if applicable: https://github.com/OpenLiberty/open-liberty/wiki/Open-Liberty-Conventions).This PR tried to recreate the issue JPQL query for all entities in descending order returns no results on Oracle #30444 .