Skip to content

Commit 6c06a73

Browse files
authored
💥 drop support for Java 1.8 (#310)
1 parent 3691852 commit 6c06a73

23 files changed

Lines changed: 383 additions & 558 deletions

.github/workflows/_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
strategy:
1212
matrix:
1313
java-version:
14+
- "25"
1415
- "21"
1516
- "17"
1617
- "11"
17-
- "8"
1818
distribution:
1919
- "temurin"
2020

.github/workflows/_publish-code.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up JDK
2323
uses: actions/setup-java@v5
2424
with:
25-
java-version: "8"
25+
java-version: "11"
2626
distribution: "adopt"
2727
server-id: central
2828
server-username: MAVEN_USERNAME

.github/workflows/_test-code-samples.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
java-version:
2424
- "25"
2525
- "11"
26-
- "8"
2726
distribution:
2827
- "temurin"
2928

.github/workflows/_test-integrations.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ jobs:
2323
strategy:
2424
matrix:
2525
java-version:
26-
- "21"
26+
- "25"
2727
- "11"
28-
- "8"
2928
distribution:
3029
- "temurin"
3130

pom.xml

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
<version>${org.projectlombok.lombok-mapstruct-binding.version}</version>
9191
</path>
9292
</annotationProcessorPaths>
93-
<source>1.8</source>
94-
<target>1.8</target>
93+
<source>11</source>
94+
<target>11</target>
9595
</configuration>
9696
</plugin>
9797
<plugin>
@@ -102,7 +102,7 @@
102102
<linkXRef>false</linkXRef>
103103
<printFailingErrors>true</printFailingErrors>
104104
<failurePriority>3</failurePriority>
105-
<targetJdk>1.8</targetJdk>
105+
<targetJdk>11</targetJdk>
106106
</configuration>
107107
</plugin>
108108
<plugin>
@@ -129,8 +129,8 @@
129129
<groupId>org.apache.maven.plugins</groupId>
130130
<artifactId>maven-compiler-plugin</artifactId>
131131
<configuration>
132-
<source>8</source>
133-
<target>8</target>
132+
<source>11</source>
133+
<target>11</target>
134134
</configuration>
135135
</plugin>
136136
<plugin>
@@ -290,8 +290,8 @@
290290
</dependency>
291291
<dependency>
292292
<artifactId>jackson-databind</artifactId>
293-
<groupId>com.fasterxml.jackson.core</groupId>
294-
<version>${com.fasterxml.jackson.version}</version>
293+
<groupId>tools.jackson.core</groupId>
294+
<version>${tools.jackson.core.databind.version}</version>
295295
</dependency>
296296
<dependency>
297297
<artifactId>jackson-datatype-jsr310</artifactId>
@@ -366,21 +366,8 @@
366366
<artifactId>junit-pioneer</artifactId>
367367
<groupId>org.junit-pioneer</groupId>
368368
<scope>test</scope>
369-
<!-- version 2.0 is not compatible with java 8 -->
370369
<version>${org.junit.pioneer.version}</version>
371370
</dependency>
372-
<dependency>
373-
<artifactId>mockito-junit-jupiter</artifactId>
374-
<groupId>org.mockito</groupId>
375-
<scope>test</scope>
376-
<version>${org.mockito.junit.jupiter.version}</version>
377-
</dependency>
378-
<dependency>
379-
<artifactId>mockito-inline</artifactId>
380-
<groupId>org.mockito</groupId>
381-
<scope>test</scope>
382-
<version>${org.mockito.inline.version}</version>
383-
</dependency>
384371
<dependency>
385372
<groupId>net.bytebuddy</groupId>
386373
<artifactId>byte-buddy</artifactId>
@@ -394,8 +381,8 @@
394381
<scope>test</scope>
395382
</dependency>
396383
<dependency>
397-
<groupId>com.github.tomakehurst</groupId>
398-
<artifactId>wiremock-jre8</artifactId>
384+
<groupId>org.wiremock</groupId>
385+
<artifactId>wiremock</artifactId>
399386
<version>${wiremock.version}</version>
400387
<scope>test</scope>
401388
</dependency>
@@ -418,18 +405,18 @@
418405
<!-- MINDEE VERSION GOES HERE -->
419406
<revision>5.0.0-alpha1</revision>
420407

421-
<com.fasterxml.jackson.version>2.15.4</com.fasterxml.jackson.version>
422-
<com.fasterxml.jackson.datatype.version>2.15.4</com.fasterxml.jackson.datatype.version>
408+
<tools.jackson.core.databind.version>3.1.1</tools.jackson.core.databind.version>
409+
<com.fasterxml.jackson.datatype.version>2.21.2</com.fasterxml.jackson.datatype.version>
423410
<com.squareup.okhttp3.version>4.12.0</com.squareup.okhttp3.version>
424411
<info.picocli.version>4.7.6</info.picocli.version>
425-
<maven.compiler.source>1.8</maven.compiler.source>
426-
<maven.compiler.target>1.8</maven.compiler.target>
412+
<maven.compiler.source>11</maven.compiler.source>
413+
<maven.compiler.target>11</maven.compiler.target>
427414
<org.apache.commons.math3.version>3.6.1</org.apache.commons.math3.version>
428415
<org.apache.httpcomponents.client5.httpclient5.version>5.4.4</org.apache.httpcomponents.client5.httpclient5.version>
429416
<commons-codec.version>1.20.0</commons-codec.version>
430417
<org.apache.maven.clean.version>3.1.0</org.apache.maven.clean.version>
431418
<org.apache.maven.compiler.version>3.12.1</org.apache.maven.compiler.version>
432-
<org.apache.maven.failsafe.version>3.3.1</org.apache.maven.failsafe.version>
419+
<org.apache.maven.failsafe.version>3.5.5</org.apache.maven.failsafe.version>
433420
<org.apache.maven.gpg.version>1.5</org.apache.maven.gpg.version>
434421
<org.apache.maven.install.version>2.5.2</org.apache.maven.install.version>
435422
<org.apache.maven.javadoc.version>3.2.0</org.apache.maven.javadoc.version>
@@ -441,17 +428,14 @@
441428
<org.apache.pdfbox.version>3.0.5</org.apache.pdfbox.version>
442429
<org.junit.jupiter.version>5.8.2</org.junit.jupiter.version>
443430
<org.junit.pioneer.version>1.9.1</org.junit.pioneer.version>
444-
<org.junit.platform.version>1.8.2</org.junit.platform.version>
431+
<org.junit.platform.version>1.9.2</org.junit.platform.version>
445432
<org.hamcrest.version>2.2</org.hamcrest.version>
446433
<org.mapstruct.version>1.5.3.Final</org.mapstruct.version>
447-
<org.mockito.inline.version>4.11.0</org.mockito.inline.version>
448-
<org.mockito.junit.jupiter.version>4.11.0</org.mockito.junit.jupiter.version>
449434
<org.projectlombok.lombok-mapstruct-binding.version>0.2.0</org.projectlombok.lombok-mapstruct-binding.version>
450435
<org.projectlombok.version>1.18.38</org.projectlombok.version>
451436
<org.slf4j.version>2.0.17</org.slf4j.version>
452437
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
453-
<surefire.addOpens></surefire.addOpens>
454-
<wiremock.version>2.35.2</wiremock.version>
438+
<wiremock.version>3.13.2</wiremock.version>
455439
</properties>
456440

457441
</project>

src/main/java/com/mindee/v1/http/MindeeApiV1.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public abstract <DocT extends Inference> PredictResponse<DocT> predictPost(
3939
RequestParameters requestParameters
4040
) throws IOException;
4141

42+
/**
43+
* Execute a workflow.
44+
*/
4245
public abstract <DocT extends Inference> WorkflowResponse<DocT> executeWorkflowPost(
4346
Class<DocT> documentClass,
4447
String workflowId,

src/main/java/com/mindee/v2/MindeeClient.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import com.mindee.v2.parsing.ErrorResponse;
1111
import com.mindee.v2.parsing.JobResponse;
1212
import com.mindee.v2.product.extraction.ExtractionResponse;
13-
import com.mindee.v2.product.extraction.params.ExtractionParameters;
1413
import java.io.IOException;
1514

1615
/**
@@ -34,26 +33,6 @@ public MindeeClient(MindeeApiV2 mindeeApi) {
3433
this.mindeeApi = mindeeApi;
3534
}
3635

37-
/**
38-
* @deprecated use `enqueue` instead.
39-
*/
40-
public JobResponse enqueueInference(
41-
LocalInputSource inputSource,
42-
ExtractionParameters params
43-
) throws IOException {
44-
return enqueue(inputSource, params);
45-
}
46-
47-
/**
48-
* @deprecated use `enqueue` instead.
49-
*/
50-
public JobResponse enqueueInference(
51-
URLInputSource inputSource,
52-
ExtractionParameters params
53-
) throws IOException {
54-
return enqueue(inputSource, params);
55-
}
56-
5736
/**
5837
* Enqueue a document in the asynchronous queue.
5938
*
@@ -88,13 +67,6 @@ public JobResponse getJob(String jobId) {
8867
return mindeeApi.reqGetJob(jobId);
8968
}
9069

91-
/**
92-
* @deprecated use `getResult` instead.
93-
*/
94-
public ExtractionResponse getInference(String inferenceId) {
95-
return getResult(ExtractionResponse.class, inferenceId);
96-
}
97-
9870
/**
9971
* Get the result of an inference that was previously enqueued.
10072
* The inference will only be available after it has finished processing.
@@ -109,26 +81,6 @@ public <TResponse extends CommonResponse> TResponse getResult(
10981
return mindeeApi.reqGetResult(responseClass, inferenceId);
11082
}
11183

112-
/**
113-
* @deprecated use `enqueueAndGetResult` instead.
114-
*/
115-
public ExtractionResponse enqueueAndGetInference(
116-
LocalInputSource inputSource,
117-
ExtractionParameters options
118-
) throws IOException, InterruptedException {
119-
return enqueueAndGetResult(ExtractionResponse.class, inputSource, options);
120-
}
121-
122-
/**
123-
* @deprecated use `enqueueAndGetResult` instead.
124-
*/
125-
public ExtractionResponse enqueueAndGetInference(
126-
URLInputSource inputSource,
127-
ExtractionParameters options
128-
) throws IOException, InterruptedException {
129-
return enqueueAndGetResult(ExtractionResponse.class, inputSource, options);
130-
}
131-
13284
/**
13385
* Send a local file to an async queue, poll, and parse when complete.
13486
*

src/test/java/com/mindee/TestingUtilities.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ public static String getV1ResourcePathString(String filePath) {
2525
return getV1ResourcePath(filePath).toString();
2626
}
2727

28-
public static String readFileAsString(Path path) throws IOException {
29-
byte[] encoded = Files.readAllBytes(path);
30-
return new String(encoded);
31-
}
32-
3328
public static void assertStringEqualsFile(String expected, String filePath) throws IOException {
3429
String[] actualLines = expected.split(System.lineSeparator());
3530
List<String> expectedLines = Files.readAllLines(Paths.get(filePath));

src/test/java/com/mindee/input/URLInputSourceTest.java

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.mindee.input;
22

33
import static org.junit.jupiter.api.Assertions.*;
4-
import static org.mockito.Mockito.*;
54

65
import java.io.File;
76
import java.io.IOException;
@@ -11,6 +10,7 @@
1110
import java.nio.file.Paths;
1211
import lombok.Setter;
1312
import org.junit.jupiter.api.*;
13+
import org.junit.jupiter.api.Test;
1414

1515
public class URLInputSourceTest {
1616

@@ -31,7 +31,7 @@ public void tearDown() {
3131
void fetchFile_shouldSaveFileLocally() throws IOException {
3232
urlInputSource.fetchFile();
3333

34-
File savedFile = new File(urlInputSource.getLocalFilename());
34+
var savedFile = new File(urlInputSource.getLocalFilename());
3535
assertTrue(savedFile.exists(), "The file should be saved locally");
3636

3737
Files.deleteIfExists(savedFile.toPath());
@@ -47,7 +47,7 @@ void fetchFile_shouldThrowIOException_onFailedFetch() {
4747

4848
@Test
4949
void fetchFile_shouldHandleRedirects() throws IOException {
50-
urlInputSource.setMockResponseCode(HttpURLConnection.HTTP_MOVED_TEMP);
50+
urlInputSource.setMockResponseCode(HttpURLConnection.HTTP_OK);
5151
urlInputSource.setMockRedirectUrl("https://example.com/redirectedfile.pdf");
5252

5353
urlInputSource.setMockResponseCode(HttpURLConnection.HTTP_OK);
@@ -84,7 +84,7 @@ void toLocalInputSource_shouldCreateLocalInputSource() throws IOException {
8484
urlInputSource.cleanup();
8585
}
8686

87-
class TestableURLInputSource extends URLInputSource {
87+
static class TestableURLInputSource extends URLInputSource {
8888

8989
@Setter
9090
private int mockResponseCode = HttpURLConnection.HTTP_OK;
@@ -98,23 +98,51 @@ public TestableURLInputSource(String url) {
9898

9999
@Override
100100
protected HttpURLConnection createConnection(String urlString) throws IOException {
101-
HttpURLConnection mockConnection = mock(HttpURLConnection.class);
102-
103-
when(mockConnection.getResponseCode()).thenReturn(mockResponseCode);
101+
java.net.URL url = new java.net.URL(urlString);
102+
boolean wasRedirected = isRedirected;
104103

105-
Path path = Paths.get("src/test/resources/file_types/pdf/multipage.pdf");
106-
if (isRedirected) {
107-
when(mockConnection.getHeaderField("Location")).thenReturn(null);
108-
when(mockConnection.getInputStream()).thenReturn(Files.newInputStream(path));
109-
} else {
110-
when(mockConnection.getHeaderField("Location")).thenReturn(mockRedirectUrl);
111-
when(mockConnection.getResponseCode()).thenReturn(HttpURLConnection.HTTP_MOVED_TEMP);
104+
if (!isRedirected && mockRedirectUrl != null) {
112105
isRedirected = true;
113-
return mockConnection;
114106
}
115107

116-
when(mockConnection.getInputStream()).thenReturn(Files.newInputStream(path));
117-
return mockConnection;
108+
return new HttpURLConnection(url) {
109+
@Override
110+
public void disconnect() {
111+
}
112+
113+
@Override
114+
public boolean usingProxy() {
115+
return false;
116+
}
117+
118+
@Override
119+
public void connect() {
120+
}
121+
122+
@Override
123+
public int getResponseCode() {
124+
if (mockRedirectUrl != null && !wasRedirected) {
125+
return HttpURLConnection.HTTP_MOVED_TEMP;
126+
}
127+
return mockResponseCode;
128+
}
129+
130+
@Override
131+
public String getHeaderField(String name) {
132+
if ("Location".equalsIgnoreCase(name)) {
133+
if (mockRedirectUrl != null && !wasRedirected) {
134+
return mockRedirectUrl;
135+
}
136+
}
137+
return null;
138+
}
139+
140+
@Override
141+
public java.io.InputStream getInputStream() throws IOException {
142+
Path path = Paths.get("src/test/resources/file_types/pdf/multipage.pdf");
143+
return Files.newInputStream(path);
144+
}
145+
};
118146
}
119147
}
120148
}

0 commit comments

Comments
 (0)