From 265209a22cbab4ba5f3c2097fef746fe648aa07d Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 9 Jan 2025 14:35:49 +0100 Subject: [PATCH] Remove OpenJPA leftovers. Remove unused tests, simplify findAllById(Iterable) implementation. Closes #3741 --- pom.xml | 1 - spring-data-jpa/pom.xml | 1 - .../support/SimpleJpaRepository.java | 58 +++---------- .../EclipseLinkMetamodelIntegrationTests.java | 2 +- .../OpenJpaMetamodelIntegrationTests.java | 42 --------- ...raphRepositoryMethodsIntegrationTests.java | 24 ----- .../OpenJpaNamespaceUserRepositoryTests.java | 87 ------------------- ...enJpaParentRepositoryIntegrationTests.java | 27 ------ ...itoryWithCompositeKeyIntegrationTests.java | 33 ------- ...penJpaStoredProcedureIntegrationTests.java | 35 -------- .../OpenJpaUserRepositoryFinderTests.java | 33 ------- .../SimpleJpaParameterBindingTests.java | 4 +- .../jpa/repository/UserRepositoryTests.java | 7 -- .../query/OpenJpaJpa21UtilsTests.java | 26 ------ ...meterMetadataProviderIntegrationTests.java | 27 ------ .../OpenJpaQueryUtilsIntegrationTests.java | 26 ------ .../jpa/repository/sample/UserRepository.java | 7 -- .../support/OpenJpaJpaRepositoryTests.java | 33 ------- ...odelEntityInformationIntegrationTests.java | 62 ------------- .../support/OpenJpaProxyIdAccessorTests.java | 32 ------- .../test/resources/META-INF/persistence.xml | 18 ---- .../src/test/resources/openjpa.xml | 25 ------ 22 files changed, 14 insertions(+), 596 deletions(-) delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/OpenJpaMetamodelIntegrationTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaEntityGraphRepositoryMethodsIntegrationTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserRepositoryTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaParentRepositoryIntegrationTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaRepositoryWithCompositeKeyIntegrationTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaStoredProcedureIntegrationTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaUserRepositoryFinderTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaJpa21UtilsTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaParameterMetadataProviderIntegrationTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaQueryUtilsIntegrationTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaJpaRepositoryTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaMetamodelEntityInformationIntegrationTests.java delete mode 100644 spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaProxyIdAccessorTests.java delete mode 100644 spring-data-jpa/src/test/resources/openjpa.xml diff --git a/pom.xml b/pom.xml index fd3739c6ec..0bc3b84ef3 100755 --- a/pom.xml +++ b/pom.xml @@ -195,7 +195,6 @@ **/*UnitTests.java - **/OpenJpa* **/EclipseLink* **/MySql* **/Postgres* diff --git a/spring-data-jpa/pom.xml b/spring-data-jpa/pom.xml index fcdd23640d..abac3419f4 100644 --- a/spring-data-jpa/pom.xml +++ b/spring-data-jpa/pom.xml @@ -289,7 +289,6 @@ **/*UnitTests.java - **/OpenJpa* **/EclipseLink* **/MySql* **/Postgres* diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java index 9c41c6fb1b..a6060c06b1 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java @@ -19,20 +19,17 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.LockModeType; -import jakarta.persistence.Parameter; import jakarta.persistence.Query; import jakarta.persistence.TypedQuery; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaDelete; import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.CriteriaUpdate; -import jakarta.persistence.criteria.ParameterExpression; import jakarta.persistence.criteria.Path; import jakarta.persistence.criteria.Predicate; import jakarta.persistence.criteria.Root; import jakarta.persistence.criteria.Selection; -import java.io.Serial; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -260,7 +257,7 @@ public void deleteAllByIdInBatch(Iterable ids) { /* * Some JPA providers require {@code ids} to be a {@link Collection} so we must convert if it's not already. */ - Collection idCollection = toCollection(ids); + Collection idCollection = toCollection(ids); query.setParameter("ids", idCollection); applyQueryHints(query); @@ -424,10 +421,14 @@ public List findAllById(Iterable ids) { Collection idCollection = toCollection(ids); - ByIdsSpecification specification = new ByIdsSpecification<>(entityInformation); - TypedQuery query = getQuery(specification, Sort.unsorted()); + TypedQuery query = getQuery((root, q, criteriaBuilder) -> { - return query.setParameter(specification.parameter, idCollection).getResultList(); + Path path = root.get(entityInformation.getIdAttribute()); + return path.in(idCollection); + + }, Sort.unsorted()); + + return query.getResultList(); } @Override @@ -1062,37 +1063,6 @@ private static long executeCountQuery(TypedQuery query) { return total; } - /** - * Specification that gives access to the {@link Parameter} instance used to bind the ids for - * {@link SimpleJpaRepository#findAllById(Iterable)}. Workaround for OpenJPA not binding collections to in-clauses - * correctly when using by-name binding. - * - * @author Oliver Gierke - * @see OPENJPA-2018 - */ - @SuppressWarnings("rawtypes") - private static final class ByIdsSpecification implements Specification { - - private static final @Serial long serialVersionUID = 1L; - - private final JpaEntityInformation entityInformation; - - @Nullable ParameterExpression> parameter; - - ByIdsSpecification(JpaEntityInformation entityInformation) { - this.entityInformation = entityInformation; - } - - @Override - @SuppressWarnings("unchecked") - public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { - - Path path = root.get(entityInformation.getIdAttribute()); - parameter = (ParameterExpression>) (ParameterExpression) cb.parameter(Collection.class); - return path.in(parameter); - } - } - /** * {@link Specification} that gives access to the {@link Predicate} instance representing the values contained in the * {@link Example}. @@ -1101,12 +1071,8 @@ public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuild * @author Christoph Strobl * @since 1.10 */ - private static class ExampleSpecification implements Specification { - - private static final @Serial long serialVersionUID = 1L; - - private final Example example; - private final EscapeCharacter escapeCharacter; + private record ExampleSpecification(Example example, + EscapeCharacter escapeCharacter) implements Specification { /** * Creates new {@link ExampleSpecification}. @@ -1114,13 +1080,11 @@ private static class ExampleSpecification implements Specification { * @param example the example to base the specification of. Must not be {@literal null}. * @param escapeCharacter the escape character to use for like expressions. Must not be {@literal null}. */ - ExampleSpecification(Example example, EscapeCharacter escapeCharacter) { + private ExampleSpecification { Assert.notNull(example, EXAMPLE_MUST_NOT_BE_NULL); Assert.notNull(escapeCharacter, "EscapeCharacter must not be null"); - this.example = example; - this.escapeCharacter = escapeCharacter; } @Override diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/EclipseLinkMetamodelIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/EclipseLinkMetamodelIntegrationTests.java index e3cf795046..d62094bbf8 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/EclipseLinkMetamodelIntegrationTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/EclipseLinkMetamodelIntegrationTests.java @@ -20,7 +20,7 @@ import org.springframework.test.context.ContextConfiguration; /** - * Metamodel tests using OpenJPA. + * Metamodel tests using Eclipselink. * * @author Oliver Gierke */ diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/OpenJpaMetamodelIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/OpenJpaMetamodelIntegrationTests.java deleted file mode 100644 index 16983f0f88..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/infrastructure/OpenJpaMetamodelIntegrationTests.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2013-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.infrastructure; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.test.context.ContextConfiguration; - -/** - * Metamodel tests using OpenJPA. - * - * @author Oliver Gierke - */ -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaMetamodelIntegrationTests extends MetamodelIntegrationTests { - - @Test - @Disabled - @Override - void canAccessParametersByIndexForNativeQueries() {} - - /** - * TODO: Remove once https://issues.apache.org/jira/browse/OPENJPA-2618 is fixed. - */ - @Test - @Disabled - @Override - void doesNotExposeAliasForTupleIfNoneDefined() {} -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaEntityGraphRepositoryMethodsIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaEntityGraphRepositoryMethodsIntegrationTests.java deleted file mode 100644 index c42ae99579..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaEntityGraphRepositoryMethodsIntegrationTests.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2014-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository; - -import org.springframework.test.context.ContextConfiguration; - -/** - * @author Oliver Gierke - */ -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaEntityGraphRepositoryMethodsIntegrationTests extends EntityGraphRepositoryMethodsIntegrationTests {} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserRepositoryTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserRepositoryTests.java deleted file mode 100644 index a69fb9e35c..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserRepositoryTests.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2008-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import jakarta.persistence.EntityManager; -import jakarta.persistence.PersistenceContext; -import jakarta.persistence.TypedQuery; -import jakarta.persistence.criteria.CriteriaBuilder; -import jakarta.persistence.criteria.CriteriaQuery; -import jakarta.persistence.criteria.ParameterExpression; -import jakarta.persistence.criteria.Root; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.data.jpa.domain.sample.User; -import org.springframework.data.jpa.repository.sample.UserRepository; -import org.springframework.test.context.ContextConfiguration; - -/** - * Testcase to run {@link UserRepository} integration tests on top of OpenJPA. - * - * @author Oliver Gierke - * @author Jens Schauder - * @author Krzysztof Krason - */ -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaNamespaceUserRepositoryTests extends NamespaceUserRepositoryTests { - - @PersistenceContext EntityManager em; - - @Test - void checkQueryValidationWithOpenJpa() { - - assertThatThrownBy(() -> em.createQuery("something absurd")).isInstanceOf(RuntimeException.class); - assertThatThrownBy(() -> em.createNamedQuery("not available")).isInstanceOf(RuntimeException.class); - } - - /** - * Test case for https://issues.apache.org/jira/browse/OPENJPA-2018 - */ - @SuppressWarnings({ "rawtypes" }) - @Test - @Disabled - void queryUsingIn() { - - flushTestUsers(); - - CriteriaBuilder builder = em.getCriteriaBuilder(); - - CriteriaQuery criteriaQuery = builder.createQuery(User.class); - Root root = criteriaQuery.from(User.class); - ParameterExpression parameter = builder.parameter(Collection.class); - criteriaQuery.where(root. get("id").in(parameter)); - - TypedQuery query = em.createQuery(criteriaQuery); - query.setParameter(parameter, Arrays.asList(1, 2)); - - List resultList = query.getResultList(); - assertThat(resultList).hasSize(2); - } - - /** - * Temporarily ignored until openjpa works with hsqldb 2.x. - */ - @Override - void shouldFindUsersInNativeQueryWithPagination() {} -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaParentRepositoryIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaParentRepositoryIntegrationTests.java deleted file mode 100644 index d94ed598c0..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaParentRepositoryIntegrationTests.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2013-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository; - -import org.junit.jupiter.api.Disabled; -import org.springframework.test.context.ContextConfiguration; - -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaParentRepositoryIntegrationTests extends ParentRepositoryIntegrationTests { - - @Override - @Disabled - void testWithJoin() {} -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaRepositoryWithCompositeKeyIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaRepositoryWithCompositeKeyIntegrationTests.java deleted file mode 100644 index c6acc17b33..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaRepositoryWithCompositeKeyIntegrationTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2016-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository; - -import org.springframework.context.annotation.ImportResource; -import org.springframework.test.context.ContextConfiguration; - -/** - * Testcase to run {@link RepositoryWithIdClassKeyTests} integration tests on top of OpenJPA. - * - * @author Mark Paluch - */ -@ContextConfiguration -class OpenJpaRepositoryWithCompositeKeyIntegrationTests extends RepositoryWithIdClassKeyTests { - - @ImportResource({ "classpath:infrastructure.xml", "classpath:openjpa.xml" }) - static class TestConfig extends Config { - - } -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaStoredProcedureIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaStoredProcedureIntegrationTests.java deleted file mode 100644 index 6984b99e27..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaStoredProcedureIntegrationTests.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository; - -import org.junit.jupiter.api.Disabled; -import org.springframework.context.annotation.ImportResource; -import org.springframework.test.context.ContextConfiguration; - -/** - * Test case to run {@link StoredProcedureIntegrationTests} integration tests on top of OpenJpa. This is currently not - * supported since, the OpenJPA tests need to be executed with hsqldb1 which doesn't supported stored procedures. - * - * @author Thomas Darimont - * @author Oliver Gierke - */ -@Disabled -@ContextConfiguration(classes = { StoredProcedureIntegrationTests.Config.class }) -class OpenJpaStoredProcedureIntegrationTests extends StoredProcedureIntegrationTests { - - @ImportResource({ "classpath:infrastructure.xml", "classpath:openjpa.xml" }) - static class TestConfig extends Config {} -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaUserRepositoryFinderTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaUserRepositoryFinderTests.java deleted file mode 100644 index d1e1b01f66..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaUserRepositoryFinderTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository; - -import org.junit.jupiter.api.Disabled; -import org.springframework.test.context.ContextConfiguration; - -/** - * Ignores some test cases using IN queries as long as we wait for fix for - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477. - * - * @author Oliver Gierke - */ -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaUserRepositoryFinderTests extends UserRepositoryFinderTests { - - @Disabled - @Override - void findsByLastnameIgnoringCaseLike() {} -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/SimpleJpaParameterBindingTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/SimpleJpaParameterBindingTests.java index efe754ad7b..bad8461741 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/SimpleJpaParameterBindingTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/SimpleJpaParameterBindingTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.jpa.repository; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; @@ -32,6 +32,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; + import org.springframework.data.jpa.domain.sample.User; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -45,7 +46,6 @@ @ExtendWith(SpringExtension.class) @ContextConfiguration({ "classpath:application-context.xml" // , "classpath:eclipselink.xml" -// , "classpath:openjpa.xml" }) @Transactional class SimpleJpaParameterBindingTests { diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java index 9f4fa27ef5..266aee5ad3 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java @@ -802,9 +802,6 @@ void executesFinderWithFalseKeywordCorrectly() { assertThat(repository.findByActiveFalse()).containsOnly(firstUser); } - /** - * Ignored until the query declaration is supported by OpenJPA. - */ @Test void executesAnnotatedCollectionMethodCorrectly() { @@ -1617,11 +1614,7 @@ void deleteByShouldReturnEmptyListInCaseNoEntityHasBeenRemovedAndReturnTypeIsCol assertThat(repository.deleteByLastname("dorfuaeB")).isEmpty(); } - /** - * @see OPENJPA-2484 - */ @Test // DATAJPA-505 - @Disabled void findBinaryDataByIdJpaQl() throws Exception { byte[] data = "Woho!!".getBytes("UTF-8"); diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaJpa21UtilsTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaJpa21UtilsTests.java deleted file mode 100644 index 4c5cac42e1..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaJpa21UtilsTests.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository.query; - -import org.springframework.test.context.ContextConfiguration; - -/** - * @author Christoph Strobl - */ -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaJpa21UtilsTests extends Jpa21UtilsTests { - -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaParameterMetadataProviderIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaParameterMetadataProviderIntegrationTests.java deleted file mode 100644 index 7517a2a7e1..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaParameterMetadataProviderIntegrationTests.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository.query; - -import org.springframework.test.context.ContextConfiguration; - -/** - * OpenJpa-specific tests for {@link ParameterMetadataProvider}. - * - * @author Oliver Gierke - * @soundtrack Elephants Crossing - We are (Irrelephant) - */ -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaParameterMetadataProviderIntegrationTests extends ParameterMetadataProviderIntegrationTests {} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaQueryUtilsIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaQueryUtilsIntegrationTests.java deleted file mode 100644 index fd8f1cb634..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/OpenJpaQueryUtilsIntegrationTests.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2013-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository.query; - -import org.springframework.test.context.ContextConfiguration; - -/** - * @author Oliver Gierke - */ -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaQueryUtilsIntegrationTests extends QueryUtilsIntegrationTests { - -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java index 790ca45dec..a206207b78 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java @@ -299,13 +299,6 @@ Window findTop3ByFirstnameStartingWithOrderByFirstnameAscEmailAddressAsc(S // DATAJPA-460 List deleteByLastname(String lastname); - /** - * @see OPENJPA-2484 - */ - // DATAJPA-505 - // @Query(value = "select u.binaryData from User u where u.id = :id") - // byte[] findBinaryDataByIdJpaQl(@Param("id") Integer id); - /** * Explicitly mapped to a procedure with name "plus1inout" in database. */ diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaJpaRepositoryTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaJpaRepositoryTests.java deleted file mode 100644 index dd8a85fce2..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaJpaRepositoryTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2013-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository.support; - -import org.junit.jupiter.api.Disabled; -import org.springframework.test.context.ContextConfiguration; - -/** - * Integration tests to execute {@link JpaRepositoryTests} against OpenJpa. - * - * @author Oliver Gierke - */ -@ContextConfiguration("classpath:openjpa.xml") -class OpenJpaJpaRepositoryTests extends JpaRepositoryTests { - - @Override - @Disabled - void testCrudOperationsForCompoundKeyEntity() { - } -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaMetamodelEntityInformationIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaMetamodelEntityInformationIntegrationTests.java deleted file mode 100644 index 5c0a0600dd..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaMetamodelEntityInformationIntegrationTests.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2013-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository.support; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -/** - * OpenJpa execution for {@link JpaMetamodelEntityInformationIntegrationTests}. - * - * @author Oliver Gierke - * @author Greg Turnquist - */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration({ "classpath:infrastructure.xml", "classpath:openjpa.xml" }) -class OpenJpaMetamodelEntityInformationIntegrationTests extends JpaMetamodelEntityInformationIntegrationTests { - - @Override - String getMetadadataPersistenceUnitName() { - return "metadata_oj"; - } - - /** - * Re-activate test. - */ - @Test - void reactivatedDetectsIdTypeForMappedSuperclass() { - super.detectsIdTypeForMappedSuperclass(); - } - - /** - * Ignore as it fails with weird {@link NoClassDefFoundError}. - */ - @Override - @Disabled - void findsIdClassOnMappedSuperclass() {} - - /** - * Re-activate test for DATAJPA-820. - */ - @Test - @Override - void detectsVersionPropertyOnMappedSuperClass() { - super.detectsVersionPropertyOnMappedSuperClass(); - } -} diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaProxyIdAccessorTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaProxyIdAccessorTests.java deleted file mode 100644 index 54372525c8..0000000000 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/OpenJpaProxyIdAccessorTests.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2014-2025 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.data.jpa.repository.support; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; -import org.springframework.data.jpa.provider.PersistenceProviderIntegrationTests; -import org.springframework.test.context.ContextConfiguration; - -/** - * @author Oliver Gierke - */ -@ContextConfiguration -class OpenJpaProxyIdAccessorTests extends PersistenceProviderIntegrationTests { - - @Configuration - @ImportResource("classpath:openjpa.xml") - static class Config {} -} diff --git a/spring-data-jpa/src/test/resources/META-INF/persistence.xml b/spring-data-jpa/src/test/resources/META-INF/persistence.xml index 35a8715991..8fffadb357 100644 --- a/spring-data-jpa/src/test/resources/META-INF/persistence.xml +++ b/spring-data-jpa/src/test/resources/META-INF/persistence.xml @@ -157,24 +157,6 @@ - - org.apache.openjpa.persistence.PersistenceProviderImpl - org.springframework.data.jpa.domain.sample.CustomAbstractPersistable - org.springframework.data.jpa.domain.sample.MailMessage - org.springframework.data.jpa.domain.sample.MailSender - org.springframework.data.jpa.domain.sample.MailUser - org.springframework.data.jpa.domain.sample.User - org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformationIntegrationTests$Sample - org.springframework.data.jpa.domain.sample.Dummy - true - - - - - - - - org.hibernate.jpa.HibernatePersistenceProvider org.springframework.data.jpa.domain.sample.CustomAbstractPersistable diff --git a/spring-data-jpa/src/test/resources/openjpa.xml b/spring-data-jpa/src/test/resources/openjpa.xml deleted file mode 100644 index eaca2061cd..0000000000 --- a/spring-data-jpa/src/test/resources/openjpa.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - none - - - - -