Skip to content

Commit

Permalink
Release version 1.0.0-1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdesair committed Aug 12, 2018
1 parent bc58e63 commit 4e9d795
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>me.desair.tus</groupId>
<artifactId>tus-java-server</artifactId>
<version>1.0.0-1.1-SNAPSHOT</version>
<version>1.0.0-1.1</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package me.desair.tus.server.checksum;

import static org.junit.Assert.fail;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;

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

@Before
public void setUp() throws Exception {
servletRequest = new MockHttpServletRequest();
servletRequest = spy(new MockHttpServletRequest());
servletResponse = new MockHttpServletResponse();
tusFeature = new ChecksumExtension();
uploadInfo = null;
Expand Down Expand Up @@ -70,6 +73,8 @@ public void testValidChecksumNormalHeader() throws Exception {
servletRequest.setContent(content.getBytes());

executeCall(HttpMethod.PATCH, true);

verify(servletRequest, atLeastOnce()).getHeader(HttpHeader.UPLOAD_CHECKSUM);
}

@Test(expected = UploadChecksumMismatchException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ public void validateNotFinal1() throws Exception {
servletRequest.addHeader(HttpHeader.UPLOAD_LENGTH, "10L");

//When we validate the request
validator.validate(HttpMethod.POST, servletRequest, null, null);
try {
validator.validate(HttpMethod.POST, servletRequest, null, null);
} catch (Exception ex) {
fail();
}

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

//When we validate the request
validator.validate(HttpMethod.POST, servletRequest, null, null);
try {
validator.validate(HttpMethod.POST, servletRequest, null, null);
} catch (Exception ex) {
fail();
}

//No Exception is thrown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public void validateValidLengthInitialUpload() throws Exception {
servletRequest.addHeader(HttpHeader.CONTENT_LENGTH, 10L);

//When we validate the request
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
try {
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
} catch (Exception ex) {
fail();
}

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

//When we validate the request
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
try {
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
} catch (Exception ex) {
fail();
}

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

//When we validate the request
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
try {
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
} catch (Exception ex) {
fail();
}

//No Exception is thrown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;

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

validator.validate(HttpMethod.PATCH, servletRequest, null, null);
try {
validator.validate(HttpMethod.PATCH, servletRequest, null, null);
} catch (Exception ex) {
fail();
}

//No exception is thrown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;

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

@Test
public void validateValid() throws Exception {
validator.validate(HttpMethod.POST, servletRequest, uploadStorageService, null);
try {
validator.validate(HttpMethod.POST, servletRequest, uploadStorageService, null);
} catch (Exception ex) {
fail();
}
}

@Test(expected = UnsupportedMethodException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public void validateValidOffsetInitialUpload() throws Exception {
servletRequest.addHeader(HttpHeader.UPLOAD_OFFSET, 0L);

//When we validate the request
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
try {
validator.validate(HttpMethod.PATCH, servletRequest, uploadStorageService, null);
} catch (Exception ex) {
fail();
}

//No Exception is thrown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public void validateMissingContentLength() throws Exception {
//servletRequest.addHeader(HttpHeader.CONTENT_LENGTH, 3L);

//When we validate the request
validator.validate(HttpMethod.POST, servletRequest, null, null);
try {
validator.validate(HttpMethod.POST, servletRequest, null, null);
} catch (Exception ex) {
fail();
}

//No Exception is thrown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;

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

validator.validate(HttpMethod.POST, servletRequest, uploadStorageService, null);
try {
validator.validate(HttpMethod.POST, servletRequest, uploadStorageService, null);
} catch (Exception ex) {
fail();
}

//No Exception is thrown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ public void validateUploadLengthNotPresentOnFinal() throws Exception {
servletRequest.addHeader(HttpHeader.UPLOAD_CONCAT, "final;1234 5678");

//When we validate the request
validator.validate(HttpMethod.POST, servletRequest, null, null);
try {
validator.validate(HttpMethod.POST, servletRequest, null, null);
} catch (Exception ex) {
fail();
}

//No Exception is thrown
}
Expand Down

0 comments on commit 4e9d795

Please sign in to comment.