Skip to content

Commit 4e9d795

Browse files
committed
Release version 1.0.0-1.1
1 parent bc58e63 commit 4e9d795

10 files changed

+65
-13
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>me.desair.tus</groupId>
66
<artifactId>tus-java-server</artifactId>
7-
<version>1.0.0-1.1-SNAPSHOT</version>
7+
<version>1.0.0-1.1</version>
88
<packaging>jar</packaging>
99

1010
<name>${project.groupId}:${project.artifactId}</name>

src/test/java/me/desair/tus/server/checksum/ITChecksumExtension.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package me.desair.tus.server.checksum;
22

33
import static org.junit.Assert.fail;
4+
import static org.mockito.Mockito.atLeastOnce;
5+
import static org.mockito.Mockito.spy;
6+
import static org.mockito.Mockito.verify;
47

58
import me.desair.tus.server.AbstractTusExtensionIntegrationTest;
69
import me.desair.tus.server.HttpHeader;
@@ -16,7 +19,7 @@ public class ITChecksumExtension extends AbstractTusExtensionIntegrationTest {
1619

1720
@Before
1821
public void setUp() throws Exception {
19-
servletRequest = new MockHttpServletRequest();
22+
servletRequest = spy(new MockHttpServletRequest());
2023
servletResponse = new MockHttpServletResponse();
2124
tusFeature = new ChecksumExtension();
2225
uploadInfo = null;
@@ -70,6 +73,8 @@ public void testValidChecksumNormalHeader() throws Exception {
7073
servletRequest.setContent(content.getBytes());
7174

7275
executeCall(HttpMethod.PATCH, true);
76+
77+
verify(servletRequest, atLeastOnce()).getHeader(HttpHeader.UPLOAD_CHECKSUM);
7378
}
7479

7580
@Test(expected = UploadChecksumMismatchException.class)

src/test/java/me/desair/tus/server/concatenation/validation/NoUploadLengthOnFinalValidatorTest.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ public void validateNotFinal1() throws Exception {
6565
servletRequest.addHeader(HttpHeader.UPLOAD_LENGTH, "10L");
6666

6767
//When we validate the request
68-
validator.validate(HttpMethod.POST, servletRequest, null, null);
68+
try {
69+
validator.validate(HttpMethod.POST, servletRequest, null, null);
70+
} catch (Exception ex) {
71+
fail();
72+
}
6973

7074
//No Exception is thrown
7175
}
@@ -76,7 +80,11 @@ public void validateNotFinal2() throws Exception {
7680
//servletRequest.addHeader(HttpHeader.UPLOAD_LENGTH, "10L");
7781

7882
//When we validate the request
79-
validator.validate(HttpMethod.POST, servletRequest, null, null);
83+
try {
84+
validator.validate(HttpMethod.POST, servletRequest, null, null);
85+
} catch (Exception ex) {
86+
fail();
87+
}
8088

8189
//No Exception is thrown
8290
}

src/test/java/me/desair/tus/server/core/validation/ContentLengthValidatorTest.java

+15-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public void validateValidLengthInitialUpload() throws Exception {
4444
servletRequest.addHeader(HttpHeader.CONTENT_LENGTH, 10L);
4545

4646
//When we validate the request
47-
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
47+
try {
48+
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
49+
} catch (Exception ex) {
50+
fail();
51+
}
4852

4953
//No Exception is thrown
5054
}
@@ -143,7 +147,11 @@ public void validateMissingContentLength() throws Exception {
143147
//servletRequest.addHeader(HttpHeader.CONTENT_LENGTH, 3L);
144148

145149
//When we validate the request
146-
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
150+
try {
151+
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
152+
} catch (Exception ex) {
153+
fail();
154+
}
147155

148156
//No Exception is thrown
149157
}
@@ -155,7 +163,11 @@ public void validateMissingUploadInfo() throws Exception {
155163
servletRequest.addHeader(HttpHeader.CONTENT_LENGTH, 3L);
156164

157165
//When we validate the request
158-
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
166+
try {
167+
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
168+
} catch (Exception ex) {
169+
fail();
170+
}
159171

160172
//No Exception is thrown
161173
}

src/test/java/me/desair/tus/server/core/validation/ContentTypeValidatorTest.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.hamcrest.CoreMatchers.is;
44
import static org.hamcrest.MatcherAssert.assertThat;
5+
import static org.junit.Assert.fail;
56

67
import me.desair.tus.server.HttpHeader;
78
import me.desair.tus.server.HttpMethod;
@@ -27,7 +28,11 @@ public void setUp() {
2728
public void validateValid() throws Exception {
2829
servletRequest.addHeader(HttpHeader.CONTENT_TYPE, ContentTypeValidator.APPLICATION_OFFSET_OCTET_STREAM);
2930

30-
validator.validate(HttpMethod.PATCH, servletRequest, null, null);
31+
try {
32+
validator.validate(HttpMethod.PATCH, servletRequest, null, null);
33+
} catch (Exception ex) {
34+
fail();
35+
}
3136

3237
//No exception is thrown
3338
}

src/test/java/me/desair/tus/server/core/validation/HttpMethodValidatorTest.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.hamcrest.CoreMatchers.is;
44
import static org.hamcrest.MatcherAssert.assertThat;
5+
import static org.junit.Assert.fail;
56

67
import me.desair.tus.server.HttpMethod;
78
import me.desair.tus.server.exception.UnsupportedMethodException;
@@ -26,7 +27,11 @@ public void setUp() {
2627

2728
@Test
2829
public void validateValid() throws Exception {
29-
validator.validate(HttpMethod.POST, servletRequest, uploadStorageService, null);
30+
try {
31+
validator.validate(HttpMethod.POST, servletRequest, uploadStorageService, null);
32+
} catch (Exception ex) {
33+
fail();
34+
}
3035
}
3136

3237
@Test(expected = UnsupportedMethodException.class)

src/test/java/me/desair/tus/server/core/validation/UploadOffsetValidatorTest.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public void validateValidOffsetInitialUpload() throws Exception {
4444
servletRequest.addHeader(HttpHeader.UPLOAD_OFFSET, 0L);
4545

4646
//When we validate the request
47-
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
47+
try {
48+
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
49+
} catch (Exception ex) {
50+
fail();
51+
}
4852

4953
//No Exception is thrown
5054
}

src/test/java/me/desair/tus/server/creation/validation/PostEmptyRequestValidatorTest.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ public void validateMissingContentLength() throws Exception {
4141
//servletRequest.addHeader(HttpHeader.CONTENT_LENGTH, 3L);
4242

4343
//When we validate the request
44-
validator.validate(HttpMethod.POST, servletRequest, null, null);
44+
try {
45+
validator.validate(HttpMethod.POST, servletRequest, null, null);
46+
} catch (Exception ex) {
47+
fail();
48+
}
4549

4650
//No Exception is thrown
4751
}

src/test/java/me/desair/tus/server/creation/validation/PostURIValidatorTest.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.hamcrest.CoreMatchers.is;
44
import static org.hamcrest.MatcherAssert.assertThat;
5+
import static org.junit.Assert.fail;
56
import static org.mockito.Mockito.when;
67

78
import me.desair.tus.server.HttpMethod;
@@ -47,7 +48,11 @@ public void validateMatchingUrl() throws Exception {
4748
servletRequest.setRequestURI("/test/upload");
4849
when(uploadStorageService.getUploadURI()).thenReturn("/test/upload");
4950

50-
validator.validate(HttpMethod.POST, servletRequest, uploadStorageService, null);
51+
try {
52+
validator.validate(HttpMethod.POST, servletRequest, uploadStorageService, null);
53+
} catch (Exception ex) {
54+
fail();
55+
}
5156

5257
//No Exception is thrown
5358
}

src/test/java/me/desair/tus/server/creation/validation/UploadDeferLengthValidatorTest.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ public void validateUploadLengthNotPresentOnFinal() throws Exception {
105105
servletRequest.addHeader(HttpHeader.UPLOAD_CONCAT, "final;1234 5678");
106106

107107
//When we validate the request
108-
validator.validate(HttpMethod.POST, servletRequest, null, null);
108+
try {
109+
validator.validate(HttpMethod.POST, servletRequest, null, null);
110+
} catch (Exception ex) {
111+
fail();
112+
}
109113

110114
//No Exception is thrown
111115
}

0 commit comments

Comments
 (0)