Skip to content

Commit d45f6ba

Browse files
authored
java 11 (#62)
1 parent 42e7e89 commit d45f6ba

File tree

12 files changed

+86
-82
lines changed

12 files changed

+86
-82
lines changed

pom.xml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<parent>
3131
<groupId>org.springframework.boot</groupId>
3232
<artifactId>spring-boot-starter-parent</artifactId>
33-
<version>2.0.5.RELEASE</version>
33+
<version>2.6.3</version>
3434
<relativePath />
3535
</parent>
3636

@@ -57,10 +57,10 @@
5757
<properties>
5858
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5959
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
60-
<java.version>1.8</java.version>
60+
<java.version>11</java.version>
6161

62-
<testng.version>6.11</testng.version>
63-
<commons-io.version>2.7</commons-io.version>
62+
<testng.version>7.5</testng.version>
63+
<commons-io.version>2.11.0</commons-io.version>
6464
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
6565
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
6666
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
@@ -84,6 +84,17 @@
8484
<artifactId>spring-boot-configuration-processor</artifactId>
8585
<optional>true</optional>
8686
</dependency>
87+
<dependency>
88+
<groupId>jakarta.xml.bind</groupId>
89+
<artifactId>jakarta.xml.bind-api</artifactId>
90+
<version>3.0.1</version>
91+
</dependency>
92+
<dependency>
93+
<groupId>com.sun.xml.bind</groupId>
94+
<artifactId>jaxb-impl</artifactId>
95+
<version>3.0.1</version>
96+
<scope>runtime</scope>
97+
</dependency>
8798

8899
<dependency>
89100
<groupId>org.springframework.boot</groupId>

src/main/java/cz/sparko/boxitory/service/filesystem/FilesystemBoxRepository.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package cz.sparko.boxitory.service.filesystem;
22

3+
import static cz.sparko.boxitory.domain.BoxVersion.VERSION_COMPARATOR;
4+
35
import cz.sparko.boxitory.conf.AppProperties;
4-
import cz.sparko.boxitory.exception.NotFoundException;
56
import cz.sparko.boxitory.domain.Box;
67
import cz.sparko.boxitory.domain.BoxProvider;
78
import cz.sparko.boxitory.domain.BoxVersion;
9+
import cz.sparko.boxitory.exception.NotFoundException;
810
import cz.sparko.boxitory.model.BoxStream;
911
import cz.sparko.boxitory.model.CalculatedChecksumCounter;
1012
import cz.sparko.boxitory.model.FileBoxStream;
1113
import cz.sparko.boxitory.service.BoxRepository;
1214
import cz.sparko.boxitory.service.DescriptionProvider;
1315
import cz.sparko.boxitory.service.HashService;
14-
import org.slf4j.Logger;
15-
import org.slf4j.LoggerFactory;
16-
1716
import java.io.File;
1817
import java.util.ArrayList;
1918
import java.util.Arrays;
@@ -23,11 +22,10 @@
2322
import java.util.Objects;
2423
import java.util.Optional;
2524
import java.util.TreeMap;
26-
import java.util.function.Supplier;
2725
import java.util.stream.Collectors;
2826
import java.util.stream.Stream;
29-
30-
import static cz.sparko.boxitory.domain.BoxVersion.VERSION_COMPARATOR;
27+
import org.slf4j.Logger;
28+
import org.slf4j.LoggerFactory;
3129

3230
public class FilesystemBoxRepository implements BoxRepository {
3331
private static final Logger LOG = LoggerFactory.getLogger(FilesystemBoxRepository.class);

src/main/java/cz/sparko/boxitory/service/filesystem/FilesystemDigestHashService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import cz.sparko.boxitory.service.HashService;
44
import cz.sparko.boxitory.service.HashStore;
55
import cz.sparko.boxitory.service.noop.NoopHashStore;
6+
import jakarta.xml.bind.DatatypeConverter;
67
import org.slf4j.Logger;
78
import org.slf4j.LoggerFactory;
89

9-
import javax.xml.bind.DatatypeConverter;
1010
import java.io.File;
1111
import java.io.IOException;
1212
import java.io.InputStream;

src/test/java/cz/sparko/boxitory/test/e2e/AbstractIntegrationTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import cz.sparko.boxitory.controller.BoxController;
66
import cz.sparko.boxitory.controller.BoxRestController;
77
import cz.sparko.boxitory.controller.DownloadController;
8+
import cz.sparko.boxitory.test.e2e.AbstractIntegrationTest.TestConfig;
89
import org.apache.commons.io.FileUtils;
910
import org.springframework.beans.factory.annotation.Autowired;
1011
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
@@ -22,9 +23,9 @@
2223
import java.io.File;
2324
import java.io.IOException;
2425

25-
@ContextConfiguration(classes = App.class)
26+
@ContextConfiguration(classes = {App.class, TestConfig.class})
2627
@WebMvcTest(controllers = {BoxRestController.class, DownloadController.class, BoxController.class})
27-
@AutoConfigureMockMvc(secure = false)
28+
@AutoConfigureMockMvc
2829
@TestPropertySource(locations = "classpath:test.properties")
2930
@Test(groups = "e2e")
3031
public abstract class AbstractIntegrationTest extends AbstractTestNGSpringContextTests {

src/test/java/cz/sparko/boxitory/test/e2e/BoxitoryPathTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
package cz.sparko.boxitory.test.e2e;
22

3-
import org.springframework.test.context.TestPropertySource;
4-
import org.testng.annotations.Test;
5-
6-
import java.io.File;
7-
import java.io.IOException;
8-
93
import static org.hamcrest.Matchers.containsString;
104
import static org.hamcrest.Matchers.hasSize;
115
import static org.hamcrest.Matchers.is;
12-
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8;
6+
import static org.springframework.http.MediaType.APPLICATION_JSON;
137
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
148
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
159
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
1610
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
1711
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
1812

13+
import java.io.File;
14+
import java.io.IOException;
15+
import org.springframework.test.context.TestPropertySource;
16+
import org.testng.annotations.Test;
17+
1918
@TestPropertySource(properties = {"box.path_type=BOXITORY"})
2019
public class BoxitoryPathTest extends AbstractIntegrationTest {
2120
private final String VM = "vm";
@@ -39,7 +38,7 @@ public void givenBoxitoryPathConfig_whenGetBox_thenReturnProperUrls() throws Exc
3938
mockMvc.perform(get("/vm"))
4039
.andDo(print())
4140
.andExpect(status().isOk())
42-
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
41+
.andExpect(content().contentType(APPLICATION_JSON))
4342
.andExpect(jsonPath("$.name", is(VM)))
4443
.andExpect(jsonPath("$.description", is(VM)))
4544
.andExpect(jsonPath("$.versions", hasSize(2)))

src/test/java/cz/sparko/boxitory/test/e2e/MultiProviderTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
package cz.sparko.boxitory.test.e2e;
22

3-
import org.springframework.test.context.TestPropertySource;
4-
import org.testng.annotations.Test;
5-
6-
import java.io.File;
7-
import java.io.IOException;
8-
93
import static org.hamcrest.Matchers.containsString;
104
import static org.hamcrest.Matchers.hasSize;
115
import static org.hamcrest.Matchers.is;
12-
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8;
6+
import static org.springframework.http.MediaType.APPLICATION_JSON;
137
import static org.springframework.http.MediaType.TEXT_HTML;
148
import static org.springframework.http.MediaType.TEXT_PLAIN;
159
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -19,6 +13,11 @@
1913
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
2014
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
2115

16+
import java.io.File;
17+
import java.io.IOException;
18+
import org.springframework.test.context.TestPropertySource;
19+
import org.testng.annotations.Test;
20+
2221
@TestPropertySource(properties = {"box.sort_desc=true"})
2322
public class MultiProviderTest extends AbstractIntegrationTest {
2423

@@ -51,7 +50,7 @@ public void givenMultiProviders_whenBox_thenReturnListOfVmVersions() throws Exce
5150
mockMvc.perform(get("/vm"))
5251
.andDo(print())
5352
.andExpect(status().isOk())
54-
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
53+
.andExpect(content().contentType(APPLICATION_JSON))
5554
.andExpect(jsonPath("$.name", is(VM)))
5655
.andExpect(jsonPath("$.description", is(VM)))
5756
.andExpect(jsonPath("$.versions", hasSize(2)))

src/test/java/cz/sparko/boxitory/test/e2e/MultiVmTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
package cz.sparko.boxitory.test.e2e;
22

3-
import cz.sparko.boxitory.conf.AppProperties;
4-
import org.springframework.beans.factory.annotation.Autowired;
5-
import org.springframework.test.context.TestPropertySource;
6-
import org.testng.annotations.Test;
7-
8-
import java.io.File;
9-
import java.io.IOException;
10-
113
import static org.hamcrest.Matchers.containsString;
124
import static org.hamcrest.Matchers.hasSize;
135
import static org.hamcrest.Matchers.is;
14-
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8;
6+
import static org.springframework.http.MediaType.APPLICATION_JSON;
157
import static org.springframework.http.MediaType.TEXT_HTML;
168
import static org.springframework.http.MediaType.TEXT_PLAIN;
179
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -21,6 +13,13 @@
2113
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
2214
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
2315

16+
import cz.sparko.boxitory.conf.AppProperties;
17+
import java.io.File;
18+
import java.io.IOException;
19+
import org.springframework.beans.factory.annotation.Autowired;
20+
import org.springframework.test.context.TestPropertySource;
21+
import org.testng.annotations.Test;
22+
2423
@TestPropertySource(properties = {"box.sort_desc=true"})
2524
public class MultiVmTest extends AbstractIntegrationTest {
2625

@@ -59,7 +58,7 @@ public void givenMultiProviders_whenVm1Box_thenReturnListOfVmVersions() throws E
5958
mockMvc.perform(get("/" + VM1))
6059
.andDo(print())
6160
.andExpect(status().isOk())
62-
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
61+
.andExpect(content().contentType(APPLICATION_JSON))
6362
.andExpect(jsonPath("$.name", is(VM1)))
6463
.andExpect(jsonPath("$.description", is(VM1)))
6564
.andExpect(jsonPath("$.versions", hasSize(2)))
@@ -79,7 +78,7 @@ public void givenMultiProviders_whenVm2Box_thenReturnListOfVmVersions() throws E
7978
mockMvc.perform(get("/" + VM2))
8079
.andDo(print())
8180
.andExpect(status().isOk())
82-
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
81+
.andExpect(content().contentType(APPLICATION_JSON))
8382
.andExpect(jsonPath("$.name", is(VM2)))
8483
.andExpect(jsonPath("$.description", is(VM2)))
8584
.andExpect(jsonPath("$.versions", hasSize(1)))

src/test/java/cz/sparko/boxitory/test/e2e/ensurechecksum/ChecksumEnsureTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
package cz.sparko.boxitory.test.e2e.ensurechecksum;
22

3-
import cz.sparko.boxitory.test.e2e.AbstractIntegrationTest;
4-
import org.springframework.test.context.TestPropertySource;
5-
import org.testng.annotations.Test;
6-
7-
import java.io.File;
8-
import java.io.FileWriter;
9-
import java.io.IOException;
10-
113
import static org.hamcrest.Matchers.is;
12-
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8;
4+
import static org.springframework.http.MediaType.APPLICATION_JSON;
135
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
146
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
157
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
168
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
179
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
1810

11+
import cz.sparko.boxitory.test.e2e.AbstractIntegrationTest;
12+
import java.io.File;
13+
import java.io.FileWriter;
14+
import java.io.IOException;
15+
import org.springframework.test.context.TestPropertySource;
16+
import org.testng.annotations.Test;
17+
1918
@TestPropertySource(properties = {"box.checksum=md5", "box.checksum_persist=false", "box.checksum_ensure=2"})
2019
public class ChecksumEnsureTest extends AbstractIntegrationTest {
2120
private static final String VM1 = "vm1";
@@ -50,7 +49,7 @@ public void givenOneBox_whenRequestWithEnsureChecksumSetToTwo_thenChecksumIsProc
5049
mockMvc.perform(get("/" + VM1))
5150
.andDo(print())
5251
.andExpect(status().isOk())
53-
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
52+
.andExpect(content().contentType(APPLICATION_JSON))
5453
.andExpect(jsonPath("$.versions[0].providers[0].checksum", is(EXPECTED_BOX_CHECKSUM)))
5554
.andExpect(jsonPath("$.versions[1].providers[0].checksum", is(EXPECTED_BOX_CHECKSUM)))
5655
.andExpect(jsonPath("$.versions[2].providers[0].checksum").doesNotExist());

src/test/java/cz/sparko/boxitory/test/e2e/hashtype/HashTypeTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package cz.sparko.boxitory.test.e2e.hashtype;
22

3-
import cz.sparko.boxitory.test.e2e.AbstractIntegrationTest;
4-
import org.testng.annotations.Test;
5-
6-
import java.io.File;
7-
import java.io.IOException;
8-
93
import static org.hamcrest.Matchers.is;
10-
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8;
4+
import static org.springframework.http.MediaType.APPLICATION_JSON;
115
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
126
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
137
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
148
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
159
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
1610

11+
import cz.sparko.boxitory.test.e2e.AbstractIntegrationTest;
12+
import java.io.File;
13+
import java.io.IOException;
14+
import org.testng.annotations.Test;
15+
1716
abstract public class HashTypeTest extends AbstractIntegrationTest {
1817
private final String VM = "vm";
1918
private final String VM_1_VBOX = VM + "_1_virtualbox.box";
@@ -32,7 +31,7 @@ public void givenHashAlg_whenGetBox_thenHashMethodIsCorrect() throws Exception {
3231
mockMvc.perform(get("/" + VM))
3332
.andDo(print())
3433
.andExpect(status().isOk())
35-
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
34+
.andExpect(content().contentType(APPLICATION_JSON))
3635
.andExpect(jsonPath("$.versions[0].providers[0].checksum_type", is(expectedAlg())));
3736
}
3837
}

src/test/java/cz/sparko/boxitory/test/e2e/versionastimestamp/VersionAsTimestampTest.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
package cz.sparko.boxitory.test.e2e.versionastimestamp;
22

3-
import cz.sparko.boxitory.service.filesystem.FilesystemDescriptionProvider;
4-
import cz.sparko.boxitory.test.e2e.AbstractIntegrationTest;
5-
import org.springframework.test.context.TestPropertySource;
6-
import org.testng.annotations.Test;
7-
8-
import java.io.File;
9-
import java.io.FileWriter;
10-
import java.io.IOException;
11-
import java.time.Instant;
12-
133
import static org.hamcrest.Matchers.is;
14-
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8;
4+
import static org.springframework.http.MediaType.APPLICATION_JSON;
155
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
166
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
177
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
188
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
199
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
2010

11+
import cz.sparko.boxitory.service.filesystem.FilesystemDescriptionProvider;
12+
import cz.sparko.boxitory.test.e2e.AbstractIntegrationTest;
13+
import java.io.File;
14+
import java.io.FileWriter;
15+
import java.io.IOException;
16+
import java.time.Instant;
17+
import org.springframework.test.context.TestPropertySource;
18+
import org.testng.annotations.Test;
19+
2120
@TestPropertySource(properties = {"box.version_as_timestamp=true"})
2221
public class VersionAsTimestampTest extends AbstractIntegrationTest {
2322

@@ -56,7 +55,7 @@ public void givenValidRepo_whenBoxWithTimestampAsVersion_thenDescriptionContains
5655
mockMvc.perform(get("/" + VM1))
5756
.andDo(print())
5857
.andExpect(status().isOk())
59-
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
58+
.andExpect(content().contentType(APPLICATION_JSON))
6059
.andExpect(jsonPath("$.versions[0].description", is(EXPECTED_VM1BOX_DESCRIPTION)));
6160
}
6261

@@ -65,7 +64,7 @@ public void givenValidRepo_whenBoxWithTimestampAsVersionHasRecordInDescriptionFi
6564
mockMvc.perform(get("/" + VM2))
6665
.andDo(print())
6766
.andExpect(status().isOk())
68-
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
67+
.andExpect(content().contentType(APPLICATION_JSON))
6968
.andExpect(jsonPath("$.versions[0].description", is(EXPECTED_VM2BOX_DESCRIPTION)));
7069
}
7170
}

0 commit comments

Comments
 (0)