Skip to content

Commit e10c0ca

Browse files
committed
fix warning
1 parent 1c4fe0f commit e10c0ca

3 files changed

Lines changed: 35 additions & 35 deletions

File tree

server/src/main/java/au/org/aodn/ogcapi/server/core/service/wfs/DownloadWfsDataService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import au.org.aodn.ogcapi.server.core.model.ogc.FeatureRequest;
44
import au.org.aodn.ogcapi.server.core.model.ogc.wfs.WfsField;
55
import au.org.aodn.ogcapi.server.core.model.ogc.wfs.WfsFields;
6-
import au.org.aodn.ogcapi.server.core.service.wms.WmsServer;
76
import au.org.aodn.ogcapi.server.core.util.DatetimeUtils;
87
import au.org.aodn.ogcapi.server.core.util.GeometryUtils;
98
import lombok.extern.slf4j.Slf4j;
@@ -29,7 +28,6 @@ public class DownloadWfsDataService {
2928
private final int chunkSize;
3029

3130
public DownloadWfsDataService(
32-
WmsServer wmsServer,
3331
WfsServer wfsServer,
3432
RestTemplate restTemplate,
3533
@Qualifier("pretendUserEntity") HttpEntity<?> pretendUserEntity,

server/src/test/java/au/org/aodn/ogcapi/server/core/service/wfs/DownloadWfsDataServiceTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void setUp() {
6363
wmsServer = Mockito.spy(new WmsServer(search, wfsServer, pretendUserEntity));
6464

6565
downloadWfsDataService = new DownloadWfsDataService(
66-
wmsServer, wfsServer, restTemplate, pretendUserEntity, 16384
66+
wfsServer, restTemplate, pretendUserEntity, 16384
6767
);
6868
}
6969

@@ -261,8 +261,10 @@ public void verifyRequestUrlGenerateCorrect() {
261261
);
262262
assertEquals("https://test.com/geoserver/wfs?VERSION=1.0.0&typeName=test:layer&SERVICE=WFS&REQUEST=GetFeature&outputFormat=shape-zip&cql_filter=((timestamp DURING 2024-01-01T00:00:00Z/2024-12-31T23:59:59Z))", result, "Correct url 1");
263263
}
264+
264265
/**
265266
* Make sure the url generated contains the correct polygon
267+
*
266268
* @throws JsonProcessingException - Not expected
267269
*/
268270
@Test

server/src/test/java/au/org/aodn/ogcapi/server/service/wfs/DownloadWfsDataServiceTest.java

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import au.org.aodn.ogcapi.server.core.model.ogc.FeatureRequest;
44
import au.org.aodn.ogcapi.server.core.service.wfs.DownloadWfsDataService;
55
import au.org.aodn.ogcapi.server.core.service.wfs.WfsServer;
6-
import au.org.aodn.ogcapi.server.core.service.wms.WmsServer;
76
import org.junit.jupiter.api.Test;
87
import org.mockito.Mock;
98
import org.springframework.http.HttpEntity;
@@ -30,13 +29,12 @@ public class DownloadWfsDataServiceTest {
3029
@Mock
3130
protected WfsServer wfsServer;
3231

33-
@Mock
34-
protected WmsServer wmsServer;
35-
3632
@Mock
3733
protected HttpEntity<?> entity;
34+
3835
/**
3936
* Test a text file from source is break down into chunk correct and reconstruct correctly
37+
*
4038
* @throws Exception - Not expected
4139
*/
4240
@Test
@@ -45,7 +43,7 @@ void verifyDecodeTextCorrectlyForSSE() throws Exception {
4543
RestTemplate restTemplateMock = mock(RestTemplate.class);
4644
// Intended to set a very small chunk size to test the edge case
4745
DownloadWfsDataService service = new DownloadWfsDataService(
48-
wmsServer, wfsServer, restTemplateMock, entity, 10);
46+
wfsServer, restTemplateMock, entity, 10);
4947

5048
String original = "id,name,age,city\n1,Alice,30,Sydney\n2,Bob,25,Melbourne\n3,„Café“,42,Perth\n";
5149
byte[] originalBytes = original.getBytes(StandardCharsets.UTF_8);
@@ -67,11 +65,11 @@ void verifyDecodeTextCorrectlyForSSE() throws Exception {
6765
var d = builder.build();
6866

6967
d.forEach(s -> {
70-
if(s.getData() instanceof Map) {
68+
if (s.getData() instanceof Map) {
7169
@SuppressWarnings("unchecked")
72-
Map<String, Object> data = (Map<String, Object>)s.getData();
70+
Map<String, Object> data = (Map<String, Object>) s.getData();
7371

74-
if(data.containsKey("data")) {
72+
if (data.containsKey("data")) {
7573
base64Chunks.add((String) data.get("data"));
7674
}
7775
if (data.containsKey("filename")) {
@@ -105,8 +103,10 @@ void verifyDecodeTextCorrectlyForSSE() throws Exception {
105103

106104
assertEquals(original, result);
107105
}
106+
108107
/**
109108
* Test a binary file from source is break down into chunk correct and reconstruct correctly
109+
*
110110
* @throws Exception - Not expected
111111
*/
112112
@Test
@@ -115,47 +115,47 @@ void verifyDecodeBinaryCorrectlyForSSE() throws Exception {
115115
RestTemplate restTemplateMock = mock(RestTemplate.class);
116116
// Intended to set a very small chunk size to test the edge case
117117
DownloadWfsDataService service = new DownloadWfsDataService(
118-
wmsServer, wfsServer, restTemplateMock, entity, 10);
118+
wfsServer, restTemplateMock, entity, 10);
119119

120120
// Just some big enough random binary to trigger chunk split
121-
byte[] originalBytes = new byte[] {
121+
byte[] originalBytes = new byte[]{
122122
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
123123
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
124-
(byte)0xFF, (byte)0xFE, (byte)0xFD, (byte)0xFC, (byte)0xFB, (byte)0xFA, (byte)0xF9, (byte)0xF8,
125-
(byte)0x80, (byte)0x81, (byte)0x82, (byte)0x83, 0x7F, 0x7E, 0x7D, 0x7C,
124+
(byte) 0xFF, (byte) 0xFE, (byte) 0xFD, (byte) 0xFC, (byte) 0xFB, (byte) 0xFA, (byte) 0xF9, (byte) 0xF8,
125+
(byte) 0x80, (byte) 0x81, (byte) 0x82, (byte) 0x83, 0x7F, 0x7E, 0x7D, 0x7C,
126126
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
127127
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
128-
(byte)0xA0, (byte)0xA1, (byte)0xA2, (byte)0xA3, (byte)0xA4, (byte)0xA5, (byte)0xA6, (byte)0xA7,
129-
(byte)0xB0, (byte)0xB1, (byte)0xB2, (byte)0xB3, (byte)0xB4, (byte)0xB5, (byte)0xB6, (byte)0xB7,
128+
(byte) 0xA0, (byte) 0xA1, (byte) 0xA2, (byte) 0xA3, (byte) 0xA4, (byte) 0xA5, (byte) 0xA6, (byte) 0xA7,
129+
(byte) 0xB0, (byte) 0xB1, (byte) 0xB2, (byte) 0xB3, (byte) 0xB4, (byte) 0xB5, (byte) 0xB6, (byte) 0xB7,
130130
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
131131
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
132-
(byte)0xC0, (byte)0xC1, (byte)0xC2, (byte)0xC3, (byte)0xC4, (byte)0xC5, (byte)0xC6, (byte)0xC7,
133-
(byte)0xD0, (byte)0xD1, (byte)0xD2, (byte)0xD3, (byte)0xD4, (byte)0xD5, (byte)0xD6, (byte)0xD7,
132+
(byte) 0xC0, (byte) 0xC1, (byte) 0xC2, (byte) 0xC3, (byte) 0xC4, (byte) 0xC5, (byte) 0xC6, (byte) 0xC7,
133+
(byte) 0xD0, (byte) 0xD1, (byte) 0xD2, (byte) 0xD3, (byte) 0xD4, (byte) 0xD5, (byte) 0xD6, (byte) 0xD7,
134134
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
135135
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
136-
(byte)0xE0, (byte)0xE1, (byte)0xE2, (byte)0xE3, (byte)0xE4, (byte)0xE5, (byte)0xE6, (byte)0xE7,
137-
(byte)0xF0, (byte)0xF1, (byte)0xF2, (byte)0xF3, (byte)0xF4, (byte)0xF5, (byte)0xF6, (byte)0xF7,
136+
(byte) 0xE0, (byte) 0xE1, (byte) 0xE2, (byte) 0xE3, (byte) 0xE4, (byte) 0xE5, (byte) 0xE6, (byte) 0xE7,
137+
(byte) 0xF0, (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4, (byte) 0xF5, (byte) 0xF6, (byte) 0xF7,
138138
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
139139
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
140-
(byte)0xFF, (byte)0xFE, (byte)0xFD, (byte)0xFC, (byte)0xFB, (byte)0xFA, (byte)0xF9, (byte)0xF8,
141-
(byte)0x80, (byte)0x81, (byte)0x82, (byte)0x83, 0x7F, 0x7E, 0x7D, 0x7C,
140+
(byte) 0xFF, (byte) 0xFE, (byte) 0xFD, (byte) 0xFC, (byte) 0xFB, (byte) 0xFA, (byte) 0xF9, (byte) 0xF8,
141+
(byte) 0x80, (byte) 0x81, (byte) 0x82, (byte) 0x83, 0x7F, 0x7E, 0x7D, 0x7C,
142142
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
143143
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
144-
(byte)0xA0, (byte)0xA1, (byte)0xA2, (byte)0xA3, (byte)0xA4, (byte)0xA5, (byte)0xA6, (byte)0xA7,
145-
(byte)0xB0, (byte)0xB1, (byte)0xB2, (byte)0xB3, (byte)0xB4, (byte)0xB5, (byte)0xB6, (byte)0xB7,
144+
(byte) 0xA0, (byte) 0xA1, (byte) 0xA2, (byte) 0xA3, (byte) 0xA4, (byte) 0xA5, (byte) 0xA6, (byte) 0xA7,
145+
(byte) 0xB0, (byte) 0xB1, (byte) 0xB2, (byte) 0xB3, (byte) 0xB4, (byte) 0xB5, (byte) 0xB6, (byte) 0xB7,
146146
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
147147
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
148-
(byte)0xC0, (byte)0xC1, (byte)0xC2, (byte)0xC3, (byte)0xC4, (byte)0xC5, (byte)0xC6, (byte)0xC7,
149-
(byte)0xD0, (byte)0xD1, (byte)0xD2, (byte)0xD3, (byte)0xD4, (byte)0xD5, (byte)0xD6, (byte)0xD7,
148+
(byte) 0xC0, (byte) 0xC1, (byte) 0xC2, (byte) 0xC3, (byte) 0xC4, (byte) 0xC5, (byte) 0xC6, (byte) 0xC7,
149+
(byte) 0xD0, (byte) 0xD1, (byte) 0xD2, (byte) 0xD3, (byte) 0xD4, (byte) 0xD5, (byte) 0xD6, (byte) 0xD7,
150150
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
151151
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
152-
(byte)0xE0, (byte)0xE1, (byte)0xE2, (byte)0xE3, (byte)0xE4, (byte)0xE5, (byte)0xE6, (byte)0xE7,
153-
(byte)0xF0, (byte)0xF1, (byte)0xF2, (byte)0xF3, (byte)0xF4, (byte)0xF5, (byte)0xF6, (byte)0xF7,
154-
(byte)0xD0, (byte)0xD1, (byte)0xD2, (byte)0xD3, (byte)0xD4, (byte)0xD5, (byte)0xD6, (byte)0xD7,
152+
(byte) 0xE0, (byte) 0xE1, (byte) 0xE2, (byte) 0xE3, (byte) 0xE4, (byte) 0xE5, (byte) 0xE6, (byte) 0xE7,
153+
(byte) 0xF0, (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4, (byte) 0xF5, (byte) 0xF6, (byte) 0xF7,
154+
(byte) 0xD0, (byte) 0xD1, (byte) 0xD2, (byte) 0xD3, (byte) 0xD4, (byte) 0xD5, (byte) 0xD6, (byte) 0xD7,
155155
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
156156
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
157-
(byte)0xE0, (byte)0xE1, (byte)0xE2, (byte)0xE3, (byte)0xE4, (byte)0xE5, (byte)0xE6, (byte)0xE7,
158-
(byte)0xF0, (byte)0xF1, (byte)0xF2, (byte)0xF3, (byte)0xF4, (byte)0xF5
157+
(byte) 0xE0, (byte) 0xE1, (byte) 0xE2, (byte) 0xE3, (byte) 0xE4, (byte) 0xE5, (byte) 0xE6, (byte) 0xE7,
158+
(byte) 0xF0, (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4, (byte) 0xF5
159159
};
160160

161161
// Mock WFS response
@@ -175,11 +175,11 @@ void verifyDecodeBinaryCorrectlyForSSE() throws Exception {
175175
var d = builder.build();
176176

177177
d.forEach(s -> {
178-
if(s.getData() instanceof Map) {
178+
if (s.getData() instanceof Map) {
179179
@SuppressWarnings("unchecked")
180-
Map<String, Object> data = (Map<String, Object>)s.getData();
180+
Map<String, Object> data = (Map<String, Object>) s.getData();
181181

182-
if(data.containsKey("data")) {
182+
if (data.containsKey("data")) {
183183
base64Chunks.add((String) data.get("data"));
184184
}
185185
if (data.containsKey("filename")) {

0 commit comments

Comments
 (0)