From 50df466dd4bce2a1137706750792065bdea4010b Mon Sep 17 00:00:00 2001 From: terli00 Date: Thu, 14 Mar 2024 10:34:57 +0100 Subject: [PATCH] Run stream tests between transaction --- core/src/test/java/com/kumuluz/ee/rest/test/QueriedTest.java | 2 ++ .../test/java/com/kumuluz/ee/rest/test/QueryStreamTest.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/com/kumuluz/ee/rest/test/QueriedTest.java b/core/src/test/java/com/kumuluz/ee/rest/test/QueriedTest.java index eb76a18..ca506d7 100644 --- a/core/src/test/java/com/kumuluz/ee/rest/test/QueriedTest.java +++ b/core/src/test/java/com/kumuluz/ee/rest/test/QueriedTest.java @@ -53,11 +53,13 @@ public void testQueriedAndPaginated() { q.setOffset(10); q.setLimit(limit); + em.getTransaction().begin(); Queried queried = JPAUtils.getQueried(em, User.class, q); Assert.assertNotNull(queried); Assert.assertEquals(Long.valueOf(100L), queried.getTotalCount()); Assert.assertEquals(limit, queried.stream().count()); + em.getTransaction().commit(); } @Test diff --git a/core/src/test/java/com/kumuluz/ee/rest/test/QueryStreamTest.java b/core/src/test/java/com/kumuluz/ee/rest/test/QueryStreamTest.java index cfc7aff..726626f 100644 --- a/core/src/test/java/com/kumuluz/ee/rest/test/QueryStreamTest.java +++ b/core/src/test/java/com/kumuluz/ee/rest/test/QueryStreamTest.java @@ -61,13 +61,14 @@ public void testStreamsObject() { public void testStreamCollect() { QueryParameters q = new QueryParameters(); + em.getTransaction().begin(); Stream users = JPAUtils.getEntityStream(em, User.class, q); int size = (int) users.count(); Assert.assertNotNull(users); Assert.assertEquals(100, size); - + em.getTransaction().commit(); } @Test @@ -85,7 +86,7 @@ public void testMultipleQuieries() { Assert.assertNotNull(users); Assert.assertEquals(100, size); Assert.assertEquals(totalCount.intValue(), size); - + em.getTransaction().commit(); } @Test(expected = IllegalStateException.class)