From 428704a23c662574563dd27f58f9c212bc40552e Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 20 Oct 2017 08:20:21 +0200 Subject: [PATCH] DATAJPA-1207 - Polishing. Use PersistenceUtil.isLoaded(entity, attributeName) to avoid potential early proxy resolution by using the getter. Also ignore the now (expected) failing tests in EclipseLink and add reference to open issue. Original Pull Request: #229 --- ...raphRepositoryMethodsIntegrationTests.java | 20 +++++++++++++------ ...raphRepositoryMethodsIntegrationTests.java | 10 ++++++++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/springframework/data/jpa/repository/EclipseLinkEntityGraphRepositoryMethodsIntegrationTests.java b/src/test/java/org/springframework/data/jpa/repository/EclipseLinkEntityGraphRepositoryMethodsIntegrationTests.java index 9211130f0..2c848366b 100644 --- a/src/test/java/org/springframework/data/jpa/repository/EclipseLinkEntityGraphRepositoryMethodsIntegrationTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/EclipseLinkEntityGraphRepositoryMethodsIntegrationTests.java @@ -27,27 +27,35 @@ import org.springframework.test.context.ContextConfiguration; public class EclipseLinkEntityGraphRepositoryMethodsIntegrationTests extends EntityGraphRepositoryMethodsIntegrationTests { - @Ignore + @Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627") @Test public void shouldRespectNamedEntitySubGraph() {} - @Ignore + @Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627") @Test public void shouldRespectMultipleSubGraphForSameAttributeWithDynamicFetchGraph() {} - @Ignore + @Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627") @Test public void shouldRespectDynamicFetchGraphForGetOneWithAttributeNamesById() {} - @Ignore + @Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627") + @Test + public void shouldRespectConfiguredJpaEntityGraphWithPaginationAndQueryDslPredicates() {} + + @Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627") + @Test + public void shouldRespectConfiguredJpaEntityGraphWithPaginationAndSpecification() {} + + @Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627") @Test public void shouldCreateDynamicGraphWithMultipleLevelsOfSubgraphs() {} - @Ignore + @Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627") @Test public void shouldRespectConfiguredJpaEntityGraphInFindOne() {} - @Ignore + @Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627") @Test public void shouldRespectInferFetchGraphFromMethodName() {} } diff --git a/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java b/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java index 7e41a96d6..2df5e4b2b 100644 --- a/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java @@ -96,6 +96,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { public void shouldRespectConfiguredJpaEntityGraph() { Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em)); + em.flush(); em.clear(); @@ -110,6 +111,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { public void shouldRespectConfiguredJpaEntityGraphInFindOne() { Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em)); + em.flush(); em.clear(); @@ -125,6 +127,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { public void shouldRespectInferFetchGraphFromMethodName() { Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em)); + em.flush(); em.clear(); @@ -140,6 +143,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { public void shouldRespectDynamicFetchGraphForGetOneWithAttributeNamesById() { Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em)); + em.flush(); em.clear(); @@ -165,6 +169,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { public void shouldRespectConfiguredJpaEntityGraphWithPaginationAndQueryDslPredicates() { Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em)); + em.flush(); em.clear(); @@ -172,7 +177,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { List result = page.getContent(); assertThat(result.size()).isEqualTo(3); - assertThat(util.isLoaded(result.get(0).getRoles())).isTrue(); + assertThat(util.isLoaded(result.get(0), "roles")).isTrue(); assertThat(result.get(0)).isEqualTo(tom); } @@ -180,6 +185,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { public void shouldRespectConfiguredJpaEntityGraphWithPaginationAndSpecification() { Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em)); + em.flush(); em.clear(); @@ -191,7 +197,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { List result = page.getContent(); assertThat(result.size()).isEqualTo(3); - assertThat(util.isLoaded(result.get(0).getRoles())).isTrue(); + assertThat(util.isLoaded(result.get(0), "roles")).isTrue(); assertThat(result.get(0)).isEqualTo(tom); }