Skip to content

Commit a29e856

Browse files
authored
Merge pull request #743 from marklogic/feature/22526-spring-6
MLE-22526 Bumping to Spring 6 and Java 17
2 parents 5720cdb + f02a4de commit a29e856

File tree

8 files changed

+32
-26
lines changed

8 files changed

+32
-26
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pipeline{
66
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '')
77
}
88
environment{
9-
JAVA_HOME_DIR="/home/builder/java/jdk-11.0.2"
9+
JAVA_HOME_DIR="/home/builder/java/jdk-17.0.2"
1010
GRADLE_DIR =".gradle"
1111
DMC_USER = credentials('MLBUILD_USER')
1212
DMC_PASSWORD = credentials('MLBUILD_PASSWORD')

build.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ subprojects {
77
version = "5.1-SNAPSHOT"
88

99
java {
10-
sourceCompatibility = JavaVersion.VERSION_1_8
11-
targetCompatibility = JavaVersion.VERSION_1_8
10+
sourceCompatibility = 17
11+
targetCompatibility = 17
1212
}
1313

1414
repositories {
@@ -17,15 +17,11 @@ subprojects {
1717

1818
dependencies {
1919
// Forcing Spring to use logback instead of commons-logging
20-
testImplementation "ch.qos.logback:logback-classic:1.3.15" // Not using 1.4.x yet as it requires Java 11
20+
testImplementation "ch.qos.logback:logback-classic:1.5.18"
2121
testImplementation 'org.slf4j:jcl-over-slf4j:2.0.17'
2222
testImplementation 'org.slf4j:slf4j-api:2.0.17'
2323
}
2424

25-
task javadocJar(type: Jar, dependsOn: javadoc) {
26-
archiveClassifier = "javadoc"
27-
from javadoc
28-
}
2925
javadoc.failOnError = false
3026
// Ignores warnings on params that don't have descriptions, which is a little too noisy
3127
javadoc.options.addStringOption('Xdoclint:none', '-quiet')

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
1+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStorePath=wrapper/dists

ml-app-deployer/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ dependencies {
22
api project(":ml-javaclient-util")
33

44
// For RestTemplate, which wraps OkHttpClient.
5-
api 'org.springframework:spring-web:5.3.39'
5+
api 'org.springframework:spring-web:6.2.7'
66

7-
// For wrangling JSON.
7+
// For wrangling JSON. Matching the version used by the Java Client.
88
api 'com.fasterxml.jackson.core:jackson-databind:2.17.2'
99

1010
// For resolving XPath expressions against XML documents.
@@ -30,8 +30,9 @@ dependencies {
3030
compileOnly "com.beust:jcommander:1.82"
3131
compileOnly "ch.qos.logback:logback-classic:1.3.15"
3232

33-
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
34-
testImplementation 'org.springframework:spring-test:5.3.39'
33+
// With 5.12.x, tests are somehow not found by Gradle.
34+
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.2'
35+
testImplementation 'org.springframework:spring-test:6.2.7'
3536
testImplementation 'commons-io:commons-io:2.19.0'
3637
testImplementation 'xmlunit:xmlunit:1.6'
3738
}

ml-app-deployer/src/main/java/com/marklogic/rest/util/PreviewInterceptor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ public PreviewInterceptor(ManageClient manageClient) {
6666
* If the associated triggers database hasn't been created yet, a 404 will occur. But that shouldn't interrupt a
6767
* deployment process. So a 404 is logged but not treated as an error.
6868
*
69-
* @param statusCode
69+
* @param httpResponse
7070
* @return
7171
*/
7272
@Override
73-
protected boolean hasError(HttpStatus statusCode) {
74-
if (HttpStatus.NOT_FOUND.equals(statusCode)) {
73+
public boolean hasError(ClientHttpResponse httpResponse) throws IOException {
74+
if (HttpStatus.NOT_FOUND.equals(httpResponse.getStatusCode())) {
7575
logger.info("Received a 404 response, but ignoring while doing a preview");
7676
return false;
7777
}
78-
return super.hasError(statusCode);
78+
return super.hasError(httpResponse);
7979
}
8080

8181
@Override

ml-app-deployer/src/test/java/com/marklogic/rest/util/PreviewInterceptorTest.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,26 @@
1818
import com.fasterxml.jackson.databind.node.ObjectNode;
1919
import com.fasterxml.jackson.databind.node.TextNode;
2020
import com.marklogic.mgmt.util.ObjectMapperFactory;
21-
import static org.junit.jupiter.api.Assertions.*;
2221
import org.junit.jupiter.api.Test;
2322
import org.springframework.http.HttpStatus;
23+
import org.springframework.mock.http.client.MockClientHttpResponse;
24+
25+
import java.io.IOException;
26+
import java.nio.charset.Charset;
27+
28+
import static org.junit.jupiter.api.Assertions.assertFalse;
29+
import static org.junit.jupiter.api.Assertions.assertTrue;
2430

2531
public class PreviewInterceptorTest {
2632

2733
private PreviewInterceptor interceptor = new PreviewInterceptor(null);
2834

2935
@Test
30-
public void hasError() {
31-
assertTrue(interceptor.hasError(HttpStatus.BAD_REQUEST));
32-
assertFalse(interceptor.hasError(HttpStatus.NOT_FOUND),
36+
public void hasError() throws IOException {
37+
final byte[] fakeData = "{}".getBytes(Charset.defaultCharset());
38+
39+
assertTrue(interceptor.hasError(new MockClientHttpResponse(fakeData, HttpStatus.BAD_REQUEST)));
40+
assertFalse(interceptor.hasError(new MockClientHttpResponse(fakeData, HttpStatus.NOT_FOUND)),
3341
"A 404 isn't regarded as an error because while doing a preview, " +
3442
"it may occur because a new resource, like a database, needs to be created and a GET is " +
3543
"being made on a resource specific to that database, like a CPF pipeline");

ml-gradle/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies {
1818
}
1919

2020
// For tasks that need to fiddle with the filesystem.
21-
implementation "commons-io:commons-io:2.16.1"
21+
implementation "commons-io:commons-io:2.19.0"
2222

2323
// For UnitTestTask.
2424
compileOnly ("com.marklogic:marklogic-unit-test-client:1.5.0") {

ml-javaclient-util/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependencies {
22
api 'com.marklogic:marklogic-client-api:7.1.0'
3-
api 'com.marklogic:marklogic-xcc:11.3.0'
4-
api 'org.springframework:spring-context:5.3.39'
3+
api 'com.marklogic:marklogic-xcc:11.3.1'
4+
api 'org.springframework:spring-context:6.2.7'
55

66
implementation 'org.jdom:jdom2:2.0.6.1'
77

@@ -11,8 +11,9 @@ dependencies {
1111
// LoggingObject; not clear yet on whether the protected Logger in that class should make this an api dependency or not
1212
implementation 'org.slf4j:slf4j-api:2.0.17'
1313

14-
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
15-
testImplementation 'org.springframework:spring-test:5.3.39'
14+
// With 5.12.x, tests are somehow not found by Gradle.
15+
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.2'
16+
testImplementation 'org.springframework:spring-test:6.2.7'
1617
testImplementation 'org.mockito:mockito-core:4.11.0'
1718

1819
// Used for testing loading modules from the classpath

0 commit comments

Comments
 (0)