Use transfer acceleration

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-04-05 16:37:57 -07:00
parent ea08f39f6e
commit 1bd66297e2
3 changed files with 35 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
package org.whispersystems.textsecuregcm.tests.util;
import com.amazonaws.HttpMethod;
import org.junit.Test;
import org.whispersystems.textsecuregcm.configuration.S3Configuration;
import org.whispersystems.textsecuregcm.util.UrlSigner;
import java.net.URL;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class UrlSignerTest {
@Test
public void testTransferAcceleration() {
S3Configuration configuration = mock(S3Configuration.class);
when(configuration.getAccessKey()).thenReturn("foo");
when(configuration.getAccessSecret()).thenReturn("bar");
when(configuration.getAttachmentsBucket()).thenReturn("attachments-test");
UrlSigner signer = new UrlSigner(configuration);
URL url = signer.getPreSignedUrl(1234, HttpMethod.GET);
System.out.println("The URL: " + url);
assertThat(url).hasHost("attachments-test.s3-accelerate.amazonaws.com");
}
}