Skip to content

Commit 4994942

Browse files
committed
Update Spring and Hibernate ORM versions
1 parent 3489d84 commit 4994942

File tree

15 files changed

+111
-48
lines changed

15 files changed

+111
-48
lines changed

build.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ if [[ "$JPAPROVIDER" == hibernate-6* ]]; then
5959
ADDITIONAL_PROFILES=,jakarta
6060
fi
6161

62-
if [[ "$JPAPROVIDER" == hibernate-7* ]]; then
63-
# We don't have a Spring Data integration that supports Hibernate ORM 7.0 yet
64-
PROPERTIES="$PROPERTIES -pl !integration/spring-data/testsuite/webmvc-jakarta-runner"
65-
fi
66-
6762
if [[ "$NATIVE" == "true" ]]; then
6863
exec $DIR/mvnw -B -P ${JPAPROVIDER},${RDBMS},${SPRING_DATA:-spring-data-2.7.x},${DELTASPIKE:-deltaspike-1.9},native${ADDITIONAL_PROFILES} clean install -am -V $PROPERTIES
6964
else

integration/spring-data/4.0/src/main/java/com/blazebit/persistence/spring/data/impl/query/EntityViewAwareRepositoryInformation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.springframework.data.repository.core.RepositoryInformation;
1212
import org.springframework.data.repository.core.support.RepositoryComposition;
1313
import org.springframework.data.repository.core.support.RepositoryFragment;
14-
import org.springframework.data.util.TypeInformation;
14+
import org.springframework.data.core.TypeInformation;
1515

1616
import java.io.Serializable;
1717
import java.lang.reflect.Method;

integration/spring-data/4.0/src/main/java/com/blazebit/persistence/spring/data/impl/query/EntityViewAwareRepositoryMetadataImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.springframework.data.repository.core.CrudMethods;
1212
import org.springframework.data.repository.core.RepositoryMetadata;
1313
import org.springframework.data.repository.core.support.RepositoryFragment;
14-
import org.springframework.data.util.TypeInformation;
14+
import org.springframework.data.core.TypeInformation;
1515

1616
import java.lang.reflect.Method;
1717
import java.util.Set;

integration/spring-data/4.0/src/main/java/com/blazebit/persistence/spring/data/impl/repository/QueryExecutionResultHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.springframework.core.convert.support.GenericConversionService;
2323
import org.springframework.data.repository.util.QueryExecutionConverters;
2424
import org.springframework.data.repository.util.ReactiveWrapperConverters;
25-
import org.springframework.data.util.NullableWrapper;
25+
import org.springframework.data.core.NullableWrapper;
2626
import org.springframework.data.util.Streamable;
2727
import org.springframework.lang.Nullable;
2828

integration/spring-data/base-4.0/src/main/java/com/blazebit/persistence/spring/data/base/query/JpaParameters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import java.util.ArrayList;
3333
import java.util.Date;
3434
import java.util.List;
35-
import org.springframework.data.util.TypeInformation;
35+
import org.springframework.data.core.TypeInformation;
3636

3737
/**
3838
* Custom extension of {@link Parameters} discovering additional query parameter annotations.

integration/spring-data/base-4.0/src/main/java/com/blazebit/persistence/spring/data/base/repository/EntityGraphFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import jakarta.persistence.EntityGraph;
1919
import jakarta.persistence.EntityManager;
2020
import jakarta.persistence.Subgraph;
21-
import org.springframework.data.mapping.PropertyPath;
21+
import org.springframework.data.core.PropertyPath;
2222

2323
import java.util.HashMap;
2424
import java.util.Map;

integration/spring-data/base-4.0/src/main/java/org/springframework/data/jpa/repository/query/FixedJpaQueryCreator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.blazebit.persistence.spring.data.base.query.ParameterMetadataProvider;
2121

2222
import org.springframework.data.domain.Sort;
23-
import org.springframework.data.mapping.PropertyPath;
23+
import org.springframework.data.core.PropertyPath;
2424
import org.springframework.data.repository.query.parser.AbstractQueryCreator;
2525
import org.springframework.data.repository.query.parser.Part;
2626
import org.springframework.data.repository.query.parser.PartTree;

integration/spring-data/testsuite/webflux-jakarta-runner/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,12 @@
492492
<version>${version.spring-boot}</version>
493493
<scope>test</scope>
494494
</dependency>
495+
<dependency>
496+
<groupId>org.springframework.boot</groupId>
497+
<artifactId>spring-boot-webflux-test</artifactId>
498+
<version>${version.spring-boot}</version>
499+
<scope>test</scope>
500+
</dependency>
495501
</dependencies>
496502
</profile>
497503
</profiles>

integration/spring-data/testsuite/webflux-jakarta/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
<properties>
2222
<module.name>com.blazebit.persistence.integration.spring.data.testsuite.webflux</module.name>
23+
<second.rename>empty.properties</second.rename>
2324
</properties>
2425

2526
<dependencies>
@@ -53,6 +54,8 @@
5354
<arg value="-o" />
5455
<arg value="-tr" />
5556
<arg value="${project.basedir}/../../../../rules/jakarta-renames.properties" />
57+
<arg value="-tr"/>
58+
<arg value="${project.basedir}/../../../../rules/${second.rename}" />
5659
<classpath>
5760
<!--suppress UnresolvedMavenProperty -->
5861
<pathelement path="${plugin_classpath}" />
@@ -80,6 +83,8 @@
8083
<arg value="-o" />
8184
<arg value="-tr" />
8285
<arg value="${project.basedir}/../../../../rules/jakarta-renames.properties" />
86+
<arg value="-tr"/>
87+
<arg value="${project.basedir}/../../../../rules/${second.rename}" />
8388
<classpath>
8489
<!--suppress UnresolvedMavenProperty -->
8590
<pathelement path="${plugin_classpath}" />
@@ -107,6 +112,8 @@
107112
<arg value="-o" />
108113
<arg value="-tr" />
109114
<arg value="${project.basedir}/../../../../rules/jakarta-renames.properties" />
115+
<arg value="-tr"/>
116+
<arg value="${project.basedir}/../../../../rules/${second.rename}" />
110117
<classpath>
111118
<!--suppress UnresolvedMavenProperty -->
112119
<pathelement path="${plugin_classpath}" />
@@ -134,6 +141,8 @@
134141
<arg value="-o" />
135142
<arg value="-tr" />
136143
<arg value="${project.basedir}/../../../../rules/jakarta-renames.properties" />
144+
<arg value="-tr"/>
145+
<arg value="${project.basedir}/../../../../rules/${second.rename}" />
137146
<classpath>
138147
<!--suppress UnresolvedMavenProperty -->
139148
<pathelement path="${plugin_classpath}" />
@@ -215,6 +224,12 @@
215224
</plugins>
216225
</build>
217226
<profiles>
227+
<profile>
228+
<id>spring-data-4.0.x</id>
229+
<properties>
230+
<second.rename>spring-boot-4-renames.properties</second.rename>
231+
</properties>
232+
</profile>
218233
<profile>
219234
<id>blazebit-release</id>
220235
<build>

integration/spring-data/testsuite/webmvc/src/test/java/com/blazebit/persistence/spring/data/testsuite/webmvc/AbstractSpringWebMvcTest.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package com.blazebit.persistence.spring.data.testsuite.webmvc;
77

8+
import java.lang.reflect.Method;
9+
810
import com.blazebit.persistence.view.IdMapping;
911
import com.fasterxml.jackson.annotation.JsonAutoDetect;
1012
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -13,18 +15,45 @@
1315
import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
1416
import org.junit.Before;
1517
import org.springframework.beans.factory.annotation.Autowired;
18+
import org.springframework.http.MediaType;
1619
import org.springframework.test.context.web.WebAppConfiguration;
1720
import org.springframework.test.web.servlet.MockMvc;
21+
import org.springframework.test.web.servlet.RequestBuilder;
22+
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
1823
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
1924
import org.springframework.web.context.WebApplicationContext;
2025

26+
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
27+
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
28+
2129
/**
2230
* @author Moritz Becker
2331
* @since 1.5.0
2432
*/
2533
@WebAppConfiguration
2634
public abstract class AbstractSpringWebMvcTest extends AbstractSpringTest {
2735

36+
private static final Method CONTENT;
37+
private static final Method CONTENT_TYPE;
38+
private static final Method ACCEPT;
39+
40+
static {
41+
Method content = null;
42+
Method contentType = null;
43+
Method accept = null;
44+
try {
45+
Class<?> clazz = Class.forName("org.springframework.test.web.servlet.request.AbstractMockHttpServletRequestBuilder");
46+
content = clazz.getMethod("content", byte[].class);
47+
contentType = clazz.getMethod("contentType", MediaType.class);
48+
accept = clazz.getMethod("accept", String[].class);
49+
} catch (NoSuchMethodException | ClassNotFoundException e) {
50+
51+
}
52+
CONTENT = content;
53+
CONTENT_TYPE = contentType;
54+
ACCEPT = accept;
55+
}
56+
2857
@Autowired
2958
private WebApplicationContext wac;
3059

@@ -54,4 +83,41 @@ public boolean isGetterVisible(AnnotatedMethod m) {
5483
return result;
5584
}
5685

86+
protected RequestBuilder putJson(String path, Object idParam, Object updateView, boolean withId, String accept)
87+
throws JsonProcessingException {
88+
MockHttpServletRequestBuilder builder = idParam == null ? put(path) : put(path, idParam);
89+
if (CONTENT != null) {
90+
try {
91+
CONTENT.invoke(builder, withId ? toJsonWithId(updateView) : toJsonWithoutId(updateView));
92+
CONTENT_TYPE.invoke(builder, MediaType.APPLICATION_JSON);
93+
if (accept != null) {
94+
ACCEPT.invoke(builder, (Object) new String[]{ accept });
95+
}
96+
} catch (Exception e) {
97+
throw new RuntimeException(e);
98+
}
99+
return builder;
100+
} else {
101+
builder.content(withId ? toJsonWithId(updateView) : toJsonWithoutId(updateView))
102+
.contentType(MediaType.APPLICATION_JSON);
103+
return accept == null ? builder : builder.accept(accept);
104+
}
105+
}
106+
107+
protected RequestBuilder postJson(String path, Object createView) throws JsonProcessingException {
108+
MockHttpServletRequestBuilder builder = post(path);
109+
if (CONTENT != null) {
110+
try {
111+
CONTENT.invoke(builder, toJsonWithId(createView));
112+
CONTENT_TYPE.invoke(builder, MediaType.APPLICATION_JSON);
113+
} catch (Exception e) {
114+
throw new RuntimeException(e);
115+
}
116+
return builder;
117+
} else {
118+
return builder.content(toJsonWithId(createView))
119+
.contentType(MediaType.APPLICATION_JSON);
120+
}
121+
}
122+
57123
}

0 commit comments

Comments
 (0)