removed throws clauses to UnsupportedEncodingException where they aren't thrown

This commit is contained in:
Adrian Cole 2011-10-28 15:00:56 +02:00
parent 1c32b110b2
commit 5d252e6fd5
20 changed files with 133 additions and 173 deletions

View File

@ -21,7 +21,6 @@ package org.jclouds.atmos.blobstore.integration;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest; import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest;
@ -34,13 +33,12 @@ import org.testng.annotations.Test;
public class AtmosContainerIntegrationLiveTest extends BaseContainerIntegrationTest { public class AtmosContainerIntegrationLiveTest extends BaseContainerIntegrationTest {
@Override @Override
public void testListContainerMaxResults() throws InterruptedException, public void testListContainerMaxResults() throws InterruptedException {
UnsupportedEncodingException {
// Not currently working // Not currently working
} }
@Override @Override
public void testListContainerMarker() throws InterruptedException, UnsupportedEncodingException { public void testListContainerMarker() throws InterruptedException {
// Not currently working https://community.emc.com/thread/100545 // Not currently working https://community.emc.com/thread/100545
} }

View File

@ -30,7 +30,6 @@ import static org.jclouds.s3.reference.S3Headers.COPY_SOURCE_IF_UNMODIFIED_SINCE
import static org.jclouds.s3.reference.S3Headers.DEFAULT_AMAZON_HEADERTAG; import static org.jclouds.s3.reference.S3Headers.DEFAULT_AMAZON_HEADERTAG;
import static org.jclouds.s3.reference.S3Headers.METADATA_DIRECTIVE; import static org.jclouds.s3.reference.S3Headers.METADATA_DIRECTIVE;
import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -227,7 +226,7 @@ public class CopyObjectOptions extends BaseHttpRequestOptions {
* @param eTag * @param eTag
* hash representing the payload * hash representing the payload
*/ */
public CopyObjectOptions ifSourceETagMatches(String eTag) throws UnsupportedEncodingException { public CopyObjectOptions ifSourceETagMatches(String eTag) {
checkState(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkState(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()");
checkState(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()"); checkState(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()");
replaceHeader(COPY_SOURCE_IF_MATCH, String.format("\"%1$s\"", checkNotNull(eTag, "eTag"))); replaceHeader(COPY_SOURCE_IF_MATCH, String.format("\"%1$s\"", checkNotNull(eTag, "eTag")));
@ -242,10 +241,8 @@ public class CopyObjectOptions extends BaseHttpRequestOptions {
* *
* @param eTag * @param eTag
* hash representing the payload * hash representing the payload
* @throws UnsupportedEncodingException
* if there was a problem converting this into an S3 eTag string
*/ */
public CopyObjectOptions ifSourceETagDoesntMatch(String eTag) throws UnsupportedEncodingException { public CopyObjectOptions ifSourceETagDoesntMatch(String eTag) {
checkState(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkState(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()");
Preconditions.checkState(getIfUnmodifiedSince() == null, Preconditions.checkState(getIfUnmodifiedSince() == null,
"ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()"); "ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()");
@ -307,7 +304,7 @@ public class CopyObjectOptions extends BaseHttpRequestOptions {
/** /**
* @see CopyObjectOptions#ifSourceETagMatches(String) * @see CopyObjectOptions#ifSourceETagMatches(String)
*/ */
public static CopyObjectOptions ifSourceETagMatches(String eTag) throws UnsupportedEncodingException { public static CopyObjectOptions ifSourceETagMatches(String eTag) {
CopyObjectOptions options = new CopyObjectOptions(); CopyObjectOptions options = new CopyObjectOptions();
return options.ifSourceETagMatches(eTag); return options.ifSourceETagMatches(eTag);
} }
@ -315,7 +312,7 @@ public class CopyObjectOptions extends BaseHttpRequestOptions {
/** /**
* @see CopyObjectOptions#ifSourceETagDoesntMatch(String) * @see CopyObjectOptions#ifSourceETagDoesntMatch(String)
*/ */
public static CopyObjectOptions ifSourceETagDoesntMatch(String eTag) throws UnsupportedEncodingException { public static CopyObjectOptions ifSourceETagDoesntMatch(String eTag) {
CopyObjectOptions options = new CopyObjectOptions(); CopyObjectOptions options = new CopyObjectOptions();
return options.ifSourceETagDoesntMatch(eTag); return options.ifSourceETagDoesntMatch(eTag);
} }

View File

@ -35,7 +35,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -155,7 +154,7 @@ public class CopyObjectOptionsTest {
} }
@Test @Test
public void testIfETagMatches() throws UnsupportedEncodingException { public void testIfETagMatches() {
CopyObjectOptions options = new CopyObjectOptions(); CopyObjectOptions options = new CopyObjectOptions();
options.ifSourceETagMatches(etag); options.ifSourceETagMatches(etag);
matchesHex(options.getIfMatch()); matchesHex(options.getIfMatch());
@ -168,18 +167,18 @@ public class CopyObjectOptionsTest {
} }
@Test @Test
public void testIfETagMatchesStatic() throws UnsupportedEncodingException { public void testIfETagMatchesStatic() {
CopyObjectOptions options = ifSourceETagMatches(etag); CopyObjectOptions options = ifSourceETagMatches(etag);
matchesHex(options.getIfMatch()); matchesHex(options.getIfMatch());
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testIfETagMatchesNPE() throws UnsupportedEncodingException { public void testIfETagMatchesNPE() {
ifSourceETagMatches(null); ifSourceETagMatches(null);
} }
@Test @Test
public void testIfETagDoesntMatch() throws UnsupportedEncodingException { public void testIfETagDoesntMatch() {
CopyObjectOptions options = new CopyObjectOptions(); CopyObjectOptions options = new CopyObjectOptions();
options.ifSourceETagDoesntMatch(etag); options.ifSourceETagDoesntMatch(etag);
matchesHex(options.getIfNoneMatch()); matchesHex(options.getIfNoneMatch());
@ -192,17 +191,17 @@ public class CopyObjectOptionsTest {
} }
@Test @Test
public void testIfETagDoesntMatchStatic() throws UnsupportedEncodingException { public void testIfETagDoesntMatchStatic() {
CopyObjectOptions options = ifSourceETagDoesntMatch(etag); CopyObjectOptions options = ifSourceETagDoesntMatch(etag);
matchesHex(options.getIfNoneMatch()); matchesHex(options.getIfNoneMatch());
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testIfETagDoesntMatchNPE() throws UnsupportedEncodingException { public void testIfETagDoesntMatchNPE() {
ifSourceETagDoesntMatch(null); ifSourceETagDoesntMatch(null);
} }
private void matchesHex(String match) throws UnsupportedEncodingException { private void matchesHex(String match) {
String expected = "\"" + etag + "\""; String expected = "\"" + etag + "\"";
assertEquals(match, expected); assertEquals(match, expected);
} }
@ -213,13 +212,13 @@ public class CopyObjectOptionsTest {
} }
public void testIfUnmodifiedAfterETagMatches() throws UnsupportedEncodingException { public void testIfUnmodifiedAfterETagMatches() {
ifSourceETagMatches(etag).ifSourceUnmodifiedSince(now); ifSourceETagMatches(etag).ifSourceUnmodifiedSince(now);
} }
@Test(expectedExceptions = IllegalStateException.class) @Test(expectedExceptions = IllegalStateException.class)
public void testIfUnmodifiedAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testIfUnmodifiedAfterETagDoesntMatch() {
ifSourceETagDoesntMatch(etag).ifSourceUnmodifiedSince(now); ifSourceETagDoesntMatch(etag).ifSourceUnmodifiedSince(now);
} }
@ -230,49 +229,49 @@ public class CopyObjectOptionsTest {
} }
@Test(expectedExceptions = IllegalStateException.class) @Test(expectedExceptions = IllegalStateException.class)
public void testIfModifiedAfterETagMatches() throws UnsupportedEncodingException { public void testIfModifiedAfterETagMatches() {
ifSourceETagMatches(etag).ifSourceModifiedSince(now); ifSourceETagMatches(etag).ifSourceModifiedSince(now);
} }
public void testIfModifiedAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testIfModifiedAfterETagDoesntMatch() {
ifSourceETagDoesntMatch(etag).ifSourceModifiedSince(now); ifSourceETagDoesntMatch(etag).ifSourceModifiedSince(now);
} }
@Test(expectedExceptions = IllegalStateException.class) @Test(expectedExceptions = IllegalStateException.class)
public void testETagMatchesAfterIfModified() throws UnsupportedEncodingException { public void testETagMatchesAfterIfModified() {
ifSourceModifiedSince(now).ifSourceETagMatches(etag); ifSourceModifiedSince(now).ifSourceETagMatches(etag);
} }
public void testETagMatchesAfterIfUnmodified() throws UnsupportedEncodingException { public void testETagMatchesAfterIfUnmodified() {
ifSourceUnmodifiedSince(now).ifSourceETagMatches(etag); ifSourceUnmodifiedSince(now).ifSourceETagMatches(etag);
} }
@Test(expectedExceptions = IllegalStateException.class) @Test(expectedExceptions = IllegalStateException.class)
public void testETagMatchesAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testETagMatchesAfterETagDoesntMatch() {
ifSourceETagDoesntMatch(etag).ifSourceETagMatches(etag); ifSourceETagDoesntMatch(etag).ifSourceETagMatches(etag);
} }
public void testETagDoesntMatchAfterIfModified() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterIfModified() {
ifSourceModifiedSince(now).ifSourceETagDoesntMatch(etag); ifSourceModifiedSince(now).ifSourceETagDoesntMatch(etag);
} }
@Test(expectedExceptions = IllegalStateException.class) @Test(expectedExceptions = IllegalStateException.class)
public void testETagDoesntMatchAfterIfUnmodified() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterIfUnmodified() {
ifSourceUnmodifiedSince(now).ifSourceETagDoesntMatch(etag); ifSourceUnmodifiedSince(now).ifSourceETagDoesntMatch(etag);
} }
@Test(expectedExceptions = IllegalStateException.class) @Test(expectedExceptions = IllegalStateException.class)
public void testETagDoesntMatchAfterETagMatches() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterETagMatches() {
ifSourceETagMatches(etag).ifSourceETagDoesntMatch(etag); ifSourceETagMatches(etag).ifSourceETagDoesntMatch(etag);
} }
@Test @Test
void testBuildRequestHeadersWhenMetadataNull() throws UnsupportedEncodingException { void testBuildRequestHeadersWhenMetadataNull() {
CopyObjectOptions options = new CopyObjectOptions(); CopyObjectOptions options = new CopyObjectOptions();
options.setHeaderTag(DEFAULT_AMAZON_HEADERTAG); options.setHeaderTag(DEFAULT_AMAZON_HEADERTAG);
@ -281,7 +280,7 @@ public class CopyObjectOptionsTest {
} }
@Test @Test
void testBuildRequestHeaders() throws UnsupportedEncodingException { void testBuildRequestHeaders() {
CopyObjectOptions options = ifSourceModifiedSince(now).ifSourceETagDoesntMatch(etag).overrideMetadataWith( CopyObjectOptions options = ifSourceModifiedSince(now).ifSourceETagDoesntMatch(etag).overrideMetadataWith(
goodMeta); goodMeta);
options.setHeaderTag(DEFAULT_AMAZON_HEADERTAG); options.setHeaderTag(DEFAULT_AMAZON_HEADERTAG);
@ -310,7 +309,7 @@ public class CopyObjectOptionsTest {
} }
@Test @Test
void testBuildRequestHeadersACL() throws UnsupportedEncodingException { void testBuildRequestHeadersACL() {
CopyObjectOptions options = overrideAcl(CannedAccessPolicy.AUTHENTICATED_READ); CopyObjectOptions options = overrideAcl(CannedAccessPolicy.AUTHENTICATED_READ);
options.setHeaderTag(DEFAULT_AMAZON_HEADERTAG); options.setHeaderTag(DEFAULT_AMAZON_HEADERTAG);

View File

@ -24,11 +24,10 @@ import static org.jclouds.s3.options.ListBucketOptions.Builder.maxResults;
import static org.jclouds.s3.options.ListBucketOptions.Builder.withPrefix; import static org.jclouds.s3.options.ListBucketOptions.Builder.withPrefix;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.UnsupportedEncodingException;
import java.util.Collections; import java.util.Collections;
import org.jclouds.s3.reference.S3Constants;
import org.jclouds.http.options.HttpRequestOptions; import org.jclouds.http.options.HttpRequestOptions;
import org.jclouds.s3.reference.S3Constants;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
@ -47,7 +46,7 @@ public class ListBucketOptionsTest {
} }
@Test @Test
public void testPrefix() throws UnsupportedEncodingException { public void testPrefix() {
ListBucketOptions options = new ListBucketOptions(); ListBucketOptions options = new ListBucketOptions();
options.withPrefix("test"); options.withPrefix("test");
assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX), Collections assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX), Collections
@ -61,7 +60,7 @@ public class ListBucketOptionsTest {
} }
@Test @Test
public void testOneOptionQueryString() throws UnsupportedEncodingException { public void testOneOptionQueryString() {
ListBucketOptions options = new ListBucketOptions(); ListBucketOptions options = new ListBucketOptions();
options.withPrefix("test"); options.withPrefix("test");
Multimap<String, String> map = options.buildQueryParameters(); Multimap<String, String> map = options.buildQueryParameters();
@ -70,7 +69,7 @@ public class ListBucketOptionsTest {
} }
@Test @Test
public void testTwoOptionQueryString() throws UnsupportedEncodingException { public void testTwoOptionQueryString() {
ListBucketOptions options = new ListBucketOptions(); ListBucketOptions options = new ListBucketOptions();
options.withPrefix("test").maxResults(1); options.withPrefix("test").maxResults(1);
Multimap<String, String> map = options.buildQueryParameters(); Multimap<String, String> map = options.buildQueryParameters();
@ -80,7 +79,7 @@ public class ListBucketOptionsTest {
} }
@Test @Test
public void testPrefixAndDelimiterUrlEncodingQueryString() throws UnsupportedEncodingException { public void testPrefixAndDelimiterUrlEncodingQueryString() {
ListBucketOptions options = new ListBucketOptions(); ListBucketOptions options = new ListBucketOptions();
options.withPrefix("/test").delimiter("/"); options.withPrefix("/test").delimiter("/");
Multimap<String, String> map = options.buildQueryParameters(); Multimap<String, String> map = options.buildQueryParameters();
@ -97,19 +96,19 @@ public class ListBucketOptionsTest {
} }
@Test @Test
public void testPrefixStatic() throws UnsupportedEncodingException { public void testPrefixStatic() {
ListBucketOptions options = withPrefix("test"); ListBucketOptions options = withPrefix("test");
assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX), Collections assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX), Collections
.singletonList("test")); .singletonList("test"));
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testPrefixNPE() throws UnsupportedEncodingException { public void testPrefixNPE() {
withPrefix(null); withPrefix(null);
} }
@Test @Test
public void testMarker() throws UnsupportedEncodingException { public void testMarker() {
ListBucketOptions options = new ListBucketOptions(); ListBucketOptions options = new ListBucketOptions();
options.afterMarker("test"); options.afterMarker("test");
assertEquals(options.buildQueryParameters().get(S3Constants.MARKER), Collections assertEquals(options.buildQueryParameters().get(S3Constants.MARKER), Collections
@ -123,14 +122,14 @@ public class ListBucketOptionsTest {
} }
@Test @Test
public void testMarkerStatic() throws UnsupportedEncodingException { public void testMarkerStatic() {
ListBucketOptions options = afterMarker("test"); ListBucketOptions options = afterMarker("test");
assertEquals(options.buildQueryParameters().get(S3Constants.MARKER), Collections assertEquals(options.buildQueryParameters().get(S3Constants.MARKER), Collections
.singletonList("test")); .singletonList("test"));
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testMarkerNPE() throws UnsupportedEncodingException { public void testMarkerNPE() {
afterMarker(null); afterMarker(null);
} }
@ -161,7 +160,7 @@ public class ListBucketOptionsTest {
} }
@Test @Test
public void testDelimiter() throws UnsupportedEncodingException { public void testDelimiter() {
ListBucketOptions options = new ListBucketOptions(); ListBucketOptions options = new ListBucketOptions();
options.delimiter("test"); options.delimiter("test");
assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER), Collections assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER), Collections
@ -176,14 +175,14 @@ public class ListBucketOptionsTest {
} }
@Test @Test
public void testDelimiterStatic() throws UnsupportedEncodingException { public void testDelimiterStatic() {
ListBucketOptions options = delimiter("test"); ListBucketOptions options = delimiter("test");
assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER), Collections assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER), Collections
.singletonList("test")); .singletonList("test"));
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testDelimiterNPE() throws UnsupportedEncodingException { public void testDelimiterNPE() {
delimiter(null); delimiter(null);
} }
} }

View File

@ -21,8 +21,6 @@ package org.jclouds.s3.options;
import static org.jclouds.s3.options.PutBucketOptions.Builder.withBucketAcl; import static org.jclouds.s3.options.PutBucketOptions.Builder.withBucketAcl;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.UnsupportedEncodingException;
import org.jclouds.s3.domain.CannedAccessPolicy; import org.jclouds.s3.domain.CannedAccessPolicy;
import org.jclouds.s3.reference.S3Headers; import org.jclouds.s3.reference.S3Headers;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -50,7 +48,7 @@ public class PutBucketOptionsTest {
} }
@Test @Test
void testBuildRequestHeaders() throws UnsupportedEncodingException { void testBuildRequestHeaders() {
PutBucketOptions options = withBucketAcl(CannedAccessPolicy.AUTHENTICATED_READ); PutBucketOptions options = withBucketAcl(CannedAccessPolicy.AUTHENTICATED_READ);

View File

@ -21,8 +21,6 @@ package org.jclouds.s3.options;
import static org.jclouds.s3.options.PutObjectOptions.Builder.withAcl; import static org.jclouds.s3.options.PutObjectOptions.Builder.withAcl;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.UnsupportedEncodingException;
import org.jclouds.s3.domain.CannedAccessPolicy; import org.jclouds.s3.domain.CannedAccessPolicy;
import org.jclouds.s3.reference.S3Headers; import org.jclouds.s3.reference.S3Headers;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -50,7 +48,7 @@ public class PutObjectOptionsTest {
} }
@Test @Test
void testBuildRequestHeaders() throws UnsupportedEncodingException { void testBuildRequestHeaders() {
PutObjectOptions options = withAcl(CannedAccessPolicy.AUTHENTICATED_READ); PutObjectOptions options = withAcl(CannedAccessPolicy.AUTHENTICATED_READ);
options.setHeaderTag(S3Headers.DEFAULT_AMAZON_HEADERTAG); options.setHeaderTag(S3Headers.DEFAULT_AMAZON_HEADERTAG);

View File

@ -28,7 +28,6 @@ import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL; import java.net.URL;
import java.util.Date; import java.util.Date;
import java.util.Set; import java.util.Set;
@ -36,6 +35,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.s3.S3Client; import org.jclouds.s3.S3Client;
import org.jclouds.s3.domain.AccessControlList; import org.jclouds.s3.domain.AccessControlList;
import org.jclouds.s3.domain.AccessControlList.CanonicalUserGrantee; import org.jclouds.s3.domain.AccessControlList.CanonicalUserGrantee;
@ -50,7 +50,6 @@ import org.jclouds.s3.domain.ListBucketResponse;
import org.jclouds.s3.domain.Payer; import org.jclouds.s3.domain.Payer;
import org.jclouds.s3.domain.S3Object; import org.jclouds.s3.domain.S3Object;
import org.jclouds.s3.internal.StubS3AsyncClient; import org.jclouds.s3.internal.StubS3AsyncClient;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -332,8 +331,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
} }
} }
public void testListBucketDelimiter() throws InterruptedException, ExecutionException, TimeoutException, public void testListBucketDelimiter() throws InterruptedException, ExecutionException, TimeoutException {
UnsupportedEncodingException {
String bucketName = getContainerName(); String bucketName = getContainerName();
try { try {
String prefix = "apps"; String prefix = "apps";
@ -350,8 +348,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
} }
public void testListBucketPrefix() throws InterruptedException, ExecutionException, TimeoutException, public void testListBucketPrefix() throws InterruptedException, ExecutionException, TimeoutException {
UnsupportedEncodingException {
String bucketName = getContainerName(); String bucketName = getContainerName();
try { try {
String prefix = "apps"; String prefix = "apps";
@ -368,8 +365,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
} }
public void testListBucketMaxResults() throws InterruptedException, ExecutionException, TimeoutException, public void testListBucketMaxResults() throws InterruptedException, ExecutionException, TimeoutException {
UnsupportedEncodingException {
String bucketName = getContainerName(); String bucketName = getContainerName();
try { try {
addAlphabetUnderRoot(bucketName); addAlphabetUnderRoot(bucketName);

View File

@ -21,7 +21,6 @@ package org.jclouds.s3.xml;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import java.util.Set; import java.util.Set;
@ -130,7 +129,7 @@ public class S3ParserTest extends PerformanceTest {
public static final String listContainerResult = "<ListContainerHandler xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Name>adrianjbosstest</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>3366</Key><LastModified>2009-03-12T02:00:13.000Z</LastModified><ETag>&quot;9d7bb64e8e18ee34eec06dd2cf37b766&quot;</ETag><Size>136</Size><Owner><ID>e1a5f66a480ca99a4fdfe8e318c3020446c9989d7004e7778029fbcc5d990fa0</ID><DisplayName>ferncam</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListContainerHandler>"; public static final String listContainerResult = "<ListContainerHandler xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Name>adrianjbosstest</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>3366</Key><LastModified>2009-03-12T02:00:13.000Z</LastModified><ETag>&quot;9d7bb64e8e18ee34eec06dd2cf37b766&quot;</ETag><Size>136</Size><Owner><ID>e1a5f66a480ca99a4fdfe8e318c3020446c9989d7004e7778029fbcc5d990fa0</ID><DisplayName>ferncam</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListContainerHandler>";
public void testCanParseListContainerResult() throws HttpException, UnsupportedEncodingException { public void testCanParseListContainerResult() throws HttpException {
ListBucketResponse container = runParseListContainerResult(); ListBucketResponse container = runParseListContainerResult();
assert !container.isTruncated(); assert !container.isTruncated();
assert container.getName().equals("adrianjbosstest"); assert container.getName().equals("adrianjbosstest");
@ -161,7 +160,7 @@ public class S3ParserTest extends PerformanceTest {
Strings2.toInputStream(successfulCopyObject200)); Strings2.toInputStream(successfulCopyObject200));
} }
public void testCanParseCopyObjectResult() throws HttpException, UnsupportedEncodingException { public void testCanParseCopyObjectResult() throws HttpException {
ObjectMetadata metadata = runParseCopyObjectResult(); ObjectMetadata metadata = runParseCopyObjectResult();
Date expected = new SimpleDateFormatDateService().iso8601DateParse("2009-03-19T13:23:27.000Z"); Date expected = new SimpleDateFormatDateService().iso8601DateParse("2009-03-19T13:23:27.000Z");
assertEquals(metadata.getLastModified(), expected); assertEquals(metadata.getLastModified(), expected);

View File

@ -24,7 +24,6 @@ import static org.jclouds.openstack.swift.options.ListContainerOptions.Builder.u
import static org.jclouds.openstack.swift.options.ListContainerOptions.Builder.withPrefix; import static org.jclouds.openstack.swift.options.ListContainerOptions.Builder.withPrefix;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.UnsupportedEncodingException;
import java.util.Collections; import java.util.Collections;
import org.jclouds.http.options.HttpRequestOptions; import org.jclouds.http.options.HttpRequestOptions;
@ -47,7 +46,7 @@ public class ListContainerOptionsTest {
} }
@Test @Test
public void testPrefix() throws UnsupportedEncodingException { public void testPrefix() {
ListContainerOptions options = new ListContainerOptions(); ListContainerOptions options = new ListContainerOptions();
options.withPrefix("test"); options.withPrefix("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), Collections.singletonList("test")); assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), Collections.singletonList("test"));
@ -60,7 +59,7 @@ public class ListContainerOptionsTest {
} }
@Test @Test
public void testOneOptionQueryString() throws UnsupportedEncodingException { public void testOneOptionQueryString() {
ListContainerOptions options = new ListContainerOptions(); ListContainerOptions options = new ListContainerOptions();
options.withPrefix("test"); options.withPrefix("test");
Multimap<String, String> map = options.buildQueryParameters(); Multimap<String, String> map = options.buildQueryParameters();
@ -69,7 +68,7 @@ public class ListContainerOptionsTest {
} }
@Test @Test
public void testTwoOptionQueryString() throws UnsupportedEncodingException { public void testTwoOptionQueryString() {
ListContainerOptions options = new ListContainerOptions(); ListContainerOptions options = new ListContainerOptions();
options.withPrefix("test").maxResults(1); options.withPrefix("test").maxResults(1);
Multimap<String, String> map = options.buildQueryParameters(); Multimap<String, String> map = options.buildQueryParameters();
@ -79,7 +78,7 @@ public class ListContainerOptionsTest {
} }
@Test @Test
public void testPrefixAndPathUrlEncodingQueryString() throws UnsupportedEncodingException { public void testPrefixAndPathUrlEncodingQueryString() {
ListContainerOptions options = new ListContainerOptions(); ListContainerOptions options = new ListContainerOptions();
options.withPrefix("/cloudfiles/test").underPath("/"); options.withPrefix("/cloudfiles/test").underPath("/");
Multimap<String, String> map = options.buildQueryParameters(); Multimap<String, String> map = options.buildQueryParameters();
@ -96,18 +95,18 @@ public class ListContainerOptionsTest {
} }
@Test @Test
public void testPrefixStatic() throws UnsupportedEncodingException { public void testPrefixStatic() {
ListContainerOptions options = withPrefix("test"); ListContainerOptions options = withPrefix("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), Collections.singletonList("test")); assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), Collections.singletonList("test"));
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testPrefixNPE() throws UnsupportedEncodingException { public void testPrefixNPE() {
withPrefix(null); withPrefix(null);
} }
@Test @Test
public void testMarker() throws UnsupportedEncodingException { public void testMarker() {
ListContainerOptions options = new ListContainerOptions(); ListContainerOptions options = new ListContainerOptions();
options.afterMarker("test"); options.afterMarker("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), Collections.singletonList("test")); assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), Collections.singletonList("test"));
@ -120,13 +119,13 @@ public class ListContainerOptionsTest {
} }
@Test @Test
public void testMarkerStatic() throws UnsupportedEncodingException { public void testMarkerStatic() {
ListContainerOptions options = afterMarker("test"); ListContainerOptions options = afterMarker("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), Collections.singletonList("test")); assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), Collections.singletonList("test"));
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testMarkerNPE() throws UnsupportedEncodingException { public void testMarkerNPE() {
afterMarker(null); afterMarker(null);
} }
@ -155,7 +154,7 @@ public class ListContainerOptionsTest {
} }
@Test @Test
public void testPath() throws UnsupportedEncodingException { public void testPath() {
ListContainerOptions options = new ListContainerOptions(); ListContainerOptions options = new ListContainerOptions();
options.underPath("test"); options.underPath("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), Collections.singletonList("test")); assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), Collections.singletonList("test"));
@ -168,13 +167,13 @@ public class ListContainerOptionsTest {
} }
@Test @Test
public void testPathStatic() throws UnsupportedEncodingException { public void testPathStatic() {
ListContainerOptions options = underPath("test"); ListContainerOptions options = underPath("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), Collections.singletonList("test")); assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), Collections.singletonList("test"));
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testPathNPE() throws UnsupportedEncodingException { public void testPathNPE() {
underPath(null); underPath(null);
} }
} }

View File

@ -21,7 +21,6 @@ package org.jclouds.blobstore.options;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -221,7 +220,7 @@ public class GetOptions {
/** /**
* @see GetOptions#ifETagMatches(String) * @see GetOptions#ifETagMatches(String)
*/ */
public static GetOptions ifETagMatches(String eTag) throws UnsupportedEncodingException { public static GetOptions ifETagMatches(String eTag) {
GetOptions options = new GetOptions(); GetOptions options = new GetOptions();
return options.ifETagMatches(eTag); return options.ifETagMatches(eTag);
} }
@ -229,7 +228,7 @@ public class GetOptions {
/** /**
* @see GetOptions#ifETagDoesntMatch(String) * @see GetOptions#ifETagDoesntMatch(String)
*/ */
public static GetOptions ifETagDoesntMatch(String eTag) throws UnsupportedEncodingException { public static GetOptions ifETagDoesntMatch(String eTag) {
GetOptions options = new GetOptions(); GetOptions options = new GetOptions();
return options.ifETagDoesntMatch(eTag); return options.ifETagDoesntMatch(eTag);
} }

View File

@ -35,7 +35,6 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.util.Arrays; import java.util.Arrays;
@ -51,11 +50,11 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.blobstore.ContainerNotFoundException; import org.jclouds.blobstore.ContainerNotFoundException;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobBuilder.PayloadBlobBuilder;
import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.domain.PageSet; import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata; import org.jclouds.blobstore.domain.StorageMetadata;
import org.jclouds.blobstore.domain.StorageType; import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.blobstore.domain.BlobBuilder.PayloadBlobBuilder;
import org.jclouds.concurrent.Futures; import org.jclouds.concurrent.Futures;
import org.jclouds.crypto.Crypto; import org.jclouds.crypto.Crypto;
import org.jclouds.crypto.CryptoStreams; import org.jclouds.crypto.CryptoStreams;
@ -268,7 +267,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testGetIfMatch() throws InterruptedException, UnsupportedEncodingException { public void testGetIfMatch() throws InterruptedException {
String container = getContainerName(); String container = getContainerName();
try { try {
@ -291,7 +290,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testGetIfNoneMatch() throws InterruptedException, UnsupportedEncodingException { public void testGetIfNoneMatch() throws InterruptedException {
String container = getContainerName(); String container = getContainerName();
try { try {
@ -304,7 +303,6 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
try { try {
context.getBlobStore().getBlob(container, name, ifETagDoesntMatch(goodETag)); context.getBlobStore().getBlob(container, name, ifETagDoesntMatch(goodETag));
validateContent(container, name);
} catch (HttpResponseException ex) { } catch (HttpResponseException ex) {
assertEquals(ex.getResponse().getStatusCode(), 304); assertEquals(ex.getResponse().getStatusCode(), 304);
} }

View File

@ -26,7 +26,6 @@ import static org.jclouds.blobstore.options.ListContainerOptions.Builder.maxResu
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@ -114,7 +113,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testListContainerMarker() throws InterruptedException, UnsupportedEncodingException { public void testListContainerMarker() throws InterruptedException {
String containerName = getContainerName(); String containerName = getContainerName();
try { try {
addAlphabetUnderRoot(containerName); addAlphabetUnderRoot(containerName);
@ -137,7 +136,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testListRootUsesDelimiter() throws InterruptedException, UnsupportedEncodingException { public void testListRootUsesDelimiter() throws InterruptedException {
String containerName = getContainerName(); String containerName = getContainerName();
try { try {
String prefix = "rootdelimeter"; String prefix = "rootdelimeter";
@ -153,7 +152,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testDirectory() throws InterruptedException, UnsupportedEncodingException { public void testDirectory() throws InterruptedException {
String containerName = getContainerName(); String containerName = getContainerName();
try { try {
String directory = "directory"; String directory = "directory";
@ -230,7 +229,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testListContainerPrefix() throws InterruptedException, UnsupportedEncodingException { public void testListContainerPrefix() throws InterruptedException {
String containerName = getContainerName(); String containerName = getContainerName();
try { try {
String prefix = "containerprefix"; String prefix = "containerprefix";
@ -247,7 +246,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testListContainerMaxResults() throws InterruptedException, UnsupportedEncodingException { public void testListContainerMaxResults() throws InterruptedException {
String containerName = getContainerName(); String containerName = getContainerName();
try { try {
addAlphabetUnderRoot(containerName); addAlphabetUnderRoot(containerName);
@ -295,8 +294,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testListContainer() throws InterruptedException, ExecutionException, TimeoutException, public void testListContainer() throws InterruptedException, ExecutionException, TimeoutException {
UnsupportedEncodingException {
String containerName = getContainerName(); String containerName = getContainerName();
try { try {
add15UnderRoot(containerName); add15UnderRoot(containerName);

View File

@ -27,7 +27,6 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
@ -150,7 +149,7 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
} }
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testDirectory() throws InterruptedException, UnsupportedEncodingException { public void testDirectory() throws InterruptedException {
String containerName = getContainerName(); String containerName = getContainerName();
String directory = "apps"; String directory = "apps";
Map<String, V> rootMap = createMap(context, containerName); Map<String, V> rootMap = createMap(context, containerName);

View File

@ -26,7 +26,6 @@ import static org.jclouds.blobstore.options.GetOptions.Builder.range;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;
import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
@ -179,7 +178,7 @@ public class GetOptionsTest {
} }
@Test @Test
public void testIfETagMatches() throws UnsupportedEncodingException { public void testIfETagMatches() {
GetOptions options = new GetOptions(); GetOptions options = new GetOptions();
options.ifETagMatches(etag); options.ifETagMatches(etag);
assertEquals(etag, options.getIfMatch()); assertEquals(etag, options.getIfMatch());
@ -192,18 +191,18 @@ public class GetOptionsTest {
} }
@Test @Test
public void testIfETagMatchesStatic() throws UnsupportedEncodingException { public void testIfETagMatchesStatic() {
GetOptions options = ifETagMatches(etag); GetOptions options = ifETagMatches(etag);
assertEquals(etag, options.getIfMatch()); assertEquals(etag, options.getIfMatch());
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testIfETagMatchesNPE() throws UnsupportedEncodingException { public void testIfETagMatchesNPE() {
ifETagMatches(null); ifETagMatches(null);
} }
@Test @Test
public void testIfETagDoesntMatch() throws UnsupportedEncodingException { public void testIfETagDoesntMatch() {
GetOptions options = new GetOptions(); GetOptions options = new GetOptions();
options.ifETagDoesntMatch(etag); options.ifETagDoesntMatch(etag);
assertEquals(etag, options.getIfNoneMatch()); assertEquals(etag, options.getIfNoneMatch());
@ -216,13 +215,13 @@ public class GetOptionsTest {
} }
@Test @Test
public void testIfETagDoesntMatchStatic() throws UnsupportedEncodingException { public void testIfETagDoesntMatchStatic() {
GetOptions options = ifETagDoesntMatch(etag); GetOptions options = ifETagDoesntMatch(etag);
assertEquals(etag, options.getIfNoneMatch()); assertEquals(etag, options.getIfNoneMatch());
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testIfETagDoesntMatchNPE() throws UnsupportedEncodingException { public void testIfETagDoesntMatchNPE() {
ifETagDoesntMatch(null); ifETagDoesntMatch(null);
} }
@ -232,13 +231,13 @@ public class GetOptionsTest {
} }
public void testIfUnmodifiedAfterETagMatches() throws UnsupportedEncodingException { public void testIfUnmodifiedAfterETagMatches() {
ifETagMatches(etag).ifUnmodifiedSince(now); ifETagMatches(etag).ifUnmodifiedSince(now);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testIfUnmodifiedAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testIfUnmodifiedAfterETagDoesntMatch() {
ifETagDoesntMatch(etag).ifUnmodifiedSince(now); ifETagDoesntMatch(etag).ifUnmodifiedSince(now);
} }
@ -249,44 +248,44 @@ public class GetOptionsTest {
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testIfModifiedAfterETagMatches() throws UnsupportedEncodingException { public void testIfModifiedAfterETagMatches() {
ifETagMatches(etag).ifModifiedSince(now); ifETagMatches(etag).ifModifiedSince(now);
} }
public void testIfModifiedAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testIfModifiedAfterETagDoesntMatch() {
ifETagDoesntMatch(etag).ifModifiedSince(now); ifETagDoesntMatch(etag).ifModifiedSince(now);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testETagMatchesAfterIfModified() throws UnsupportedEncodingException { public void testETagMatchesAfterIfModified() {
ifModifiedSince(now).ifETagMatches(etag); ifModifiedSince(now).ifETagMatches(etag);
} }
public void testETagMatchesAfterIfUnmodified() throws UnsupportedEncodingException { public void testETagMatchesAfterIfUnmodified() {
ifUnmodifiedSince(now).ifETagMatches(etag); ifUnmodifiedSince(now).ifETagMatches(etag);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testETagMatchesAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testETagMatchesAfterETagDoesntMatch() {
ifETagDoesntMatch(etag).ifETagMatches(etag); ifETagDoesntMatch(etag).ifETagMatches(etag);
} }
public void testETagDoesntMatchAfterIfModified() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterIfModified() {
ifModifiedSince(now).ifETagDoesntMatch(etag); ifModifiedSince(now).ifETagDoesntMatch(etag);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testETagDoesntMatchAfterIfUnmodified() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterIfUnmodified() {
ifUnmodifiedSince(now).ifETagDoesntMatch(etag); ifUnmodifiedSince(now).ifETagDoesntMatch(etag);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testETagDoesntMatchAfterETagMatches() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterETagMatches() {
ifETagMatches(etag).ifETagDoesntMatch(etag); ifETagMatches(etag).ifETagDoesntMatch(etag);
} }

View File

@ -21,7 +21,6 @@ package org.jclouds.http.options;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -161,8 +160,6 @@ public class GetOptions extends BaseHttpRequestOptions {
* *
* @param eTag * @param eTag
* hash representing the payload * hash representing the payload
* @throws UnsupportedEncodingException
* if there was a problem converting this into an S3 eTag string
*/ */
public GetOptions ifETagMatches(String eTag) { public GetOptions ifETagMatches(String eTag) {
checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()");
@ -190,8 +187,6 @@ public class GetOptions extends BaseHttpRequestOptions {
* *
* @param eTag * @param eTag
* hash representing the payload * hash representing the payload
* @throws UnsupportedEncodingException
* if there was a problem converting this into an S3 eTag string
*/ */
public GetOptions ifETagDoesntMatch(String eTag) { public GetOptions ifETagDoesntMatch(String eTag) {
checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()");

View File

@ -28,7 +28,6 @@ import static org.jclouds.http.options.GetOptions.Builder.tail;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;
import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.date.internal.SimpleDateFormatDateService;
@ -205,7 +204,7 @@ public class GetOptionsTest {
} }
@Test @Test
public void testIfETagMatches() throws UnsupportedEncodingException { public void testIfETagMatches() {
GetOptions options = new GetOptions(); GetOptions options = new GetOptions();
options.ifETagMatches(etag); options.ifETagMatches(etag);
matchesHex(options.getIfMatch()); matchesHex(options.getIfMatch());
@ -218,18 +217,18 @@ public class GetOptionsTest {
} }
@Test @Test
public void testIfETagMatchesStatic() throws UnsupportedEncodingException { public void testIfETagMatchesStatic() {
GetOptions options = ifETagMatches(etag); GetOptions options = ifETagMatches(etag);
matchesHex(options.getIfMatch()); matchesHex(options.getIfMatch());
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testIfETagMatchesNPE() throws UnsupportedEncodingException { public void testIfETagMatchesNPE() {
ifETagMatches(null); ifETagMatches(null);
} }
@Test @Test
public void testIfETagDoesntMatch() throws UnsupportedEncodingException { public void testIfETagDoesntMatch() {
GetOptions options = new GetOptions(); GetOptions options = new GetOptions();
options.ifETagDoesntMatch(etag); options.ifETagDoesntMatch(etag);
matchesHex(options.getIfNoneMatch()); matchesHex(options.getIfNoneMatch());
@ -242,17 +241,17 @@ public class GetOptionsTest {
} }
@Test @Test
public void testIfETagDoesntMatchStatic() throws UnsupportedEncodingException { public void testIfETagDoesntMatchStatic() {
GetOptions options = ifETagDoesntMatch(etag); GetOptions options = ifETagDoesntMatch(etag);
matchesHex(options.getIfNoneMatch()); matchesHex(options.getIfNoneMatch());
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testIfETagDoesntMatchNPE() throws UnsupportedEncodingException { public void testIfETagDoesntMatchNPE() {
ifETagDoesntMatch(null); ifETagDoesntMatch(null);
} }
private void matchesHex(String match) throws UnsupportedEncodingException { private void matchesHex(String match) {
String expected = "\"" + etag + "\""; String expected = "\"" + etag + "\"";
assertEquals(match, expected); assertEquals(match, expected);
} }
@ -263,13 +262,13 @@ public class GetOptionsTest {
} }
public void testIfUnmodifiedAfterETagMatches() throws UnsupportedEncodingException { public void testIfUnmodifiedAfterETagMatches() {
ifETagMatches(etag).ifUnmodifiedSince(now); ifETagMatches(etag).ifUnmodifiedSince(now);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testIfUnmodifiedAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testIfUnmodifiedAfterETagDoesntMatch() {
ifETagDoesntMatch(etag).ifUnmodifiedSince(now); ifETagDoesntMatch(etag).ifUnmodifiedSince(now);
} }
@ -280,44 +279,44 @@ public class GetOptionsTest {
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testIfModifiedAfterETagMatches() throws UnsupportedEncodingException { public void testIfModifiedAfterETagMatches() {
ifETagMatches(etag).ifModifiedSince(now); ifETagMatches(etag).ifModifiedSince(now);
} }
public void testIfModifiedAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testIfModifiedAfterETagDoesntMatch() {
ifETagDoesntMatch(etag).ifModifiedSince(now); ifETagDoesntMatch(etag).ifModifiedSince(now);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testETagMatchesAfterIfModified() throws UnsupportedEncodingException { public void testETagMatchesAfterIfModified() {
ifModifiedSince(now).ifETagMatches(etag); ifModifiedSince(now).ifETagMatches(etag);
} }
public void testETagMatchesAfterIfUnmodified() throws UnsupportedEncodingException { public void testETagMatchesAfterIfUnmodified() {
ifUnmodifiedSince(now).ifETagMatches(etag); ifUnmodifiedSince(now).ifETagMatches(etag);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testETagMatchesAfterETagDoesntMatch() throws UnsupportedEncodingException { public void testETagMatchesAfterETagDoesntMatch() {
ifETagDoesntMatch(etag).ifETagMatches(etag); ifETagDoesntMatch(etag).ifETagMatches(etag);
} }
public void testETagDoesntMatchAfterIfModified() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterIfModified() {
ifModifiedSince(now).ifETagDoesntMatch(etag); ifModifiedSince(now).ifETagDoesntMatch(etag);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testETagDoesntMatchAfterIfUnmodified() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterIfUnmodified() {
ifUnmodifiedSince(now).ifETagDoesntMatch(etag); ifUnmodifiedSince(now).ifETagDoesntMatch(etag);
} }
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testETagDoesntMatchAfterETagMatches() throws UnsupportedEncodingException { public void testETagDoesntMatchAfterETagMatches() {
ifETagMatches(etag).ifETagDoesntMatch(etag); ifETagMatches(etag).ifETagDoesntMatch(etag);
} }

View File

@ -1485,7 +1485,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoHeader() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildTwoHeader() throws SecurityException, NoSuchMethodException {
Method oneHeader = TestHeader.class.getMethod("twoHeader", String.class); Method oneHeader = TestHeader.class.getMethod("twoHeader", String.class);
Multimap<String, String> headers = factory(TestHeader.class).createRequest(oneHeader, new Object[] { "robot" }) Multimap<String, String> headers = factory(TestHeader.class).createRequest(oneHeader, new Object[] { "robot" })
.getHeaders(); .getHeaders();
@ -1503,7 +1503,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildOneClassHeader() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildOneClassHeader() throws SecurityException, NoSuchMethodException {
Method oneHeader = TestClassHeader.class.getMethod("oneHeader", String.class); Method oneHeader = TestClassHeader.class.getMethod("oneHeader", String.class);
Multimap<String, String> headers = factory(TestClassHeader.class).createRequest(oneHeader, Multimap<String, String> headers = factory(TestClassHeader.class).createRequest(oneHeader,
new Object[] { "robot" }).getHeaders(); new Object[] { "robot" }).getHeaders();
@ -1512,7 +1512,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildOneHeader() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildOneHeader() throws SecurityException, NoSuchMethodException {
Method oneHeader = TestHeader.class.getMethod("oneHeader", String.class); Method oneHeader = TestHeader.class.getMethod("oneHeader", String.class);
Multimap<String, String> headers = factory(TestHeader.class).createRequest(oneHeader, new Object[] { "robot" }) Multimap<String, String> headers = factory(TestHeader.class).createRequest(oneHeader, new Object[] { "robot" })
.getHeaders(); .getHeaders();
@ -1521,7 +1521,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoHeaders() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildTwoHeaders() throws SecurityException, NoSuchMethodException {
Method twoHeaders = TestHeader.class.getMethod("twoHeaders", String.class, String.class); Method twoHeaders = TestHeader.class.getMethod("twoHeaders", String.class, String.class);
Multimap<String, String> headers = factory(TestHeader.class).createRequest(twoHeaders, Multimap<String, String> headers = factory(TestHeader.class).createRequest(twoHeaders,
new Object[] { "robot", "eggs" }).getHeaders(); new Object[] { "robot", "eggs" }).getHeaders();
@ -1530,8 +1530,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoHeadersOutOfOrder() throws SecurityException, NoSuchMethodException, public void testBuildTwoHeadersOutOfOrder() throws SecurityException, NoSuchMethodException {
UnsupportedEncodingException {
Method twoHeadersOutOfOrder = TestHeader.class.getMethod("twoHeadersOutOfOrder", String.class, String.class); Method twoHeadersOutOfOrder = TestHeader.class.getMethod("twoHeadersOutOfOrder", String.class, String.class);
Multimap<String, String> headers = factory(TestHeader.class).createRequest(twoHeadersOutOfOrder, Multimap<String, String> headers = factory(TestHeader.class).createRequest(twoHeadersOutOfOrder,
new Object[] { "robot", "eggs" }).getHeaders(); new Object[] { "robot", "eggs" }).getHeaders();
@ -1546,7 +1545,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testQueryInOptions() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testQueryInOptions() throws SecurityException, NoSuchMethodException {
Method oneQuery = TestQueryReplace.class.getMethod("queryInOptions", String.class, TestReplaceQueryOptions.class); Method oneQuery = TestQueryReplace.class.getMethod("queryInOptions", String.class, TestReplaceQueryOptions.class);
String query = factory(TestQueryReplace.class).createRequest(oneQuery, String query = factory(TestQueryReplace.class).createRequest(oneQuery,
new Object[] { "robot", new TestReplaceQueryOptions() }).getEndpoint().getQuery(); new Object[] { "robot", new TestReplaceQueryOptions() }).getEndpoint().getQuery();
@ -1560,7 +1559,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
@BinderParam(BindMapToMatrixParams.class) Map<String, String> options); @BinderParam(BindMapToMatrixParams.class) Map<String, String> options);
} }
public void testTestMapMatrixParams() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testTestMapMatrixParams() throws SecurityException, NoSuchMethodException {
Method method = TestMapMatrixParams.class.getMethod("action", String.class, String.class, Map.class); Method method = TestMapMatrixParams.class.getMethod("action", String.class, String.class, Map.class);
HttpRequest request = factory(TestMapMatrixParams.class).createRequest(method, HttpRequest request = factory(TestMapMatrixParams.class).createRequest(method,
new Object[] { "robot", "kill", ImmutableMap.of("death", "slow") }); new Object[] { "robot", "kill", ImmutableMap.of("death", "slow") });
@ -1602,7 +1601,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoQuery() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildTwoQuery() throws SecurityException, NoSuchMethodException {
Method oneQuery = TestQueryReplace.class.getMethod("twoQuery", String.class); Method oneQuery = TestQueryReplace.class.getMethod("twoQuery", String.class);
String query = factory(TestQueryReplace.class).createRequest(oneQuery, new Object[] { "robot" }).getEndpoint() String query = factory(TestQueryReplace.class).createRequest(oneQuery, new Object[] { "robot" }).getEndpoint()
.getQuery(); .getQuery();
@ -1618,7 +1617,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildOneClassQuery() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildOneClassQuery() throws SecurityException, NoSuchMethodException {
Method oneQuery = TestClassQuery.class.getMethod("oneQuery", String.class); Method oneQuery = TestClassQuery.class.getMethod("oneQuery", String.class);
String query = factory(TestClassQuery.class).createRequest(oneQuery, new Object[] { "robot" }).getEndpoint() String query = factory(TestClassQuery.class).createRequest(oneQuery, new Object[] { "robot" }).getEndpoint()
.getQuery(); .getQuery();
@ -1626,7 +1625,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildOneQuery() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildOneQuery() throws SecurityException, NoSuchMethodException {
Method oneQuery = TestQueryReplace.class.getMethod("oneQuery", String.class); Method oneQuery = TestQueryReplace.class.getMethod("oneQuery", String.class);
String query = factory(TestQueryReplace.class).createRequest(oneQuery, new Object[] { "robot" }).getEndpoint() String query = factory(TestQueryReplace.class).createRequest(oneQuery, new Object[] { "robot" }).getEndpoint()
.getQuery(); .getQuery();
@ -1634,7 +1633,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoQuerys() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildTwoQuerys() throws SecurityException, NoSuchMethodException {
Method twoQuerys = TestQueryReplace.class.getMethod("twoQuerys", String.class, String.class); Method twoQuerys = TestQueryReplace.class.getMethod("twoQuerys", String.class, String.class);
String query = factory(TestQueryReplace.class).createRequest(twoQuerys, new Object[] { "robot", "eggs" }) String query = factory(TestQueryReplace.class).createRequest(twoQuerys, new Object[] { "robot", "eggs" })
.getEndpoint().getQuery(); .getEndpoint().getQuery();
@ -1642,8 +1641,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoQuerysOutOfOrder() throws SecurityException, NoSuchMethodException, public void testBuildTwoQuerysOutOfOrder() throws SecurityException, NoSuchMethodException {
UnsupportedEncodingException {
Method twoQuerysOutOfOrder = TestQueryReplace.class.getMethod("twoQuerysOutOfOrder", String.class, String.class); Method twoQuerysOutOfOrder = TestQueryReplace.class.getMethod("twoQuerysOutOfOrder", String.class, String.class);
String query = factory(TestQueryReplace.class).createRequest(twoQuerysOutOfOrder, String query = factory(TestQueryReplace.class).createRequest(twoQuerysOutOfOrder,
new Object[] { "robot", "eggs" }).getEndpoint().getQuery(); new Object[] { "robot", "eggs" }).getEndpoint().getQuery();
@ -1657,7 +1655,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testMatrixInOptions() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testMatrixInOptions() throws SecurityException, NoSuchMethodException {
Method oneMatrix = TestMatrixReplace.class.getMethod("matrixInOptions", String.class, Method oneMatrix = TestMatrixReplace.class.getMethod("matrixInOptions", String.class,
TestReplaceMatrixOptions.class); TestReplaceMatrixOptions.class);
String path = factory(TestMatrixReplace.class).createRequest(oneMatrix, String path = factory(TestMatrixReplace.class).createRequest(oneMatrix,
@ -1699,7 +1697,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoMatrix() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildTwoMatrix() throws SecurityException, NoSuchMethodException {
Method oneMatrix = TestMatrixReplace.class.getMethod("twoMatrix", String.class); Method oneMatrix = TestMatrixReplace.class.getMethod("twoMatrix", String.class);
String path = factory(TestMatrixReplace.class).createRequest(oneMatrix, new Object[] { "robot" }).getEndpoint() String path = factory(TestMatrixReplace.class).createRequest(oneMatrix, new Object[] { "robot" }).getEndpoint()
.getPath(); .getPath();
@ -1716,7 +1714,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildOneClassMatrix() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildOneClassMatrix() throws SecurityException, NoSuchMethodException {
Method oneMatrix = TestClassMatrix.class.getMethod("oneMatrix", String.class); Method oneMatrix = TestClassMatrix.class.getMethod("oneMatrix", String.class);
String path = factory(TestClassMatrix.class).createRequest(oneMatrix, new Object[] { "robot" }).getEndpoint() String path = factory(TestClassMatrix.class).createRequest(oneMatrix, new Object[] { "robot" }).getEndpoint()
.getPath(); .getPath();
@ -1724,7 +1722,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildOneMatrix() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildOneMatrix() throws SecurityException, NoSuchMethodException {
Method oneMatrix = TestMatrixReplace.class.getMethod("oneMatrix", String.class); Method oneMatrix = TestMatrixReplace.class.getMethod("oneMatrix", String.class);
String path = factory(TestMatrixReplace.class).createRequest(oneMatrix, new Object[] { "robot" }).getEndpoint() String path = factory(TestMatrixReplace.class).createRequest(oneMatrix, new Object[] { "robot" }).getEndpoint()
.getPath(); .getPath();
@ -1732,7 +1730,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoMatrixs() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildTwoMatrixs() throws SecurityException, NoSuchMethodException {
Method twoMatrixs = TestMatrixReplace.class.getMethod("twoMatrixs", String.class, String.class); Method twoMatrixs = TestMatrixReplace.class.getMethod("twoMatrixs", String.class, String.class);
String path = factory(TestMatrixReplace.class).createRequest(twoMatrixs, new Object[] { "robot", "eggs" }) String path = factory(TestMatrixReplace.class).createRequest(twoMatrixs, new Object[] { "robot", "eggs" })
.getEndpoint().getPath(); .getEndpoint().getPath();
@ -1740,8 +1738,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoMatrixsOutOfOrder() throws SecurityException, NoSuchMethodException, public void testBuildTwoMatrixsOutOfOrder() throws SecurityException, NoSuchMethodException {
UnsupportedEncodingException {
Method twoMatrixsOutOfOrder = TestMatrixReplace.class.getMethod("twoMatrixsOutOfOrder", String.class, Method twoMatrixsOutOfOrder = TestMatrixReplace.class.getMethod("twoMatrixsOutOfOrder", String.class,
String.class); String.class);
String path = factory(TestMatrixReplace.class).createRequest(twoMatrixsOutOfOrder, String path = factory(TestMatrixReplace.class).createRequest(twoMatrixsOutOfOrder,
@ -2380,7 +2377,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoForm() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildTwoForm() throws SecurityException, NoSuchMethodException {
Method oneForm = TestFormReplace.class.getMethod("twoForm", String.class); Method oneForm = TestFormReplace.class.getMethod("twoForm", String.class);
Object form = factory(TestFormReplace.class).createRequest(oneForm, "robot").getPayload().getRawContent(); Object form = factory(TestFormReplace.class).createRequest(oneForm, "robot").getPayload().getRawContent();
assertEquals(form, "slash=/robot&hyphen=-robot"); assertEquals(form, "slash=/robot&hyphen=-robot");
@ -2406,40 +2403,39 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testProvidesWithGeneric() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testProvidesWithGeneric() throws SecurityException, NoSuchMethodException {
Set<String> set = injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).set(); Set<String> set = injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).set();
assertEquals(set, ImmutableSet.of("foo")); assertEquals(set, ImmutableSet.of("foo"));
} }
@Test @Test
public void testProvidesWithGenericQualified() throws SecurityException, NoSuchMethodException, public void testProvidesWithGenericQualified() throws SecurityException, NoSuchMethodException {
UnsupportedEncodingException {
Set<String> set = injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).foo(); Set<String> set = injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).foo();
assertEquals(set, ImmutableSet.of("bar")); assertEquals(set, ImmutableSet.of("bar"));
} }
@Test(expectedExceptions = AuthorizationException.class) @Test(expectedExceptions = AuthorizationException.class)
public void testProvidesWithGenericQualifiedAuthorizationException() throws SecurityException, public void testProvidesWithGenericQualifiedAuthorizationException() throws SecurityException,
NoSuchMethodException, UnsupportedEncodingException { NoSuchMethodException {
injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).exception(); injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).exception();
} }
@Test @Test
public void testBuildOneClassForm() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildOneClassForm() throws SecurityException, NoSuchMethodException {
Method oneForm = TestClassForm.class.getMethod("oneForm", String.class); Method oneForm = TestClassForm.class.getMethod("oneForm", String.class);
Object form = factory(TestClassForm.class).createRequest(oneForm, "robot").getPayload().getRawContent(); Object form = factory(TestClassForm.class).createRequest(oneForm, "robot").getPayload().getRawContent();
assertEquals(form, "x-amz-copy-source=/robot"); assertEquals(form, "x-amz-copy-source=/robot");
} }
@Test @Test
public void testBuildOneForm() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildOneForm() throws SecurityException, NoSuchMethodException {
Method oneForm = TestFormReplace.class.getMethod("oneForm", String.class); Method oneForm = TestFormReplace.class.getMethod("oneForm", String.class);
Object form = factory(TestFormReplace.class).createRequest(oneForm, "robot").getPayload().getRawContent(); Object form = factory(TestFormReplace.class).createRequest(oneForm, "robot").getPayload().getRawContent();
assertEquals(form, "x-amz-copy-source=/robot"); assertEquals(form, "x-amz-copy-source=/robot");
} }
@Test @Test
public void testBuildTwoForms() throws SecurityException, NoSuchMethodException, UnsupportedEncodingException { public void testBuildTwoForms() throws SecurityException, NoSuchMethodException {
Method twoForms = TestFormReplace.class.getMethod("twoForms", String.class, String.class); Method twoForms = TestFormReplace.class.getMethod("twoForms", String.class, String.class);
Object form = factory(TestFormReplace.class).createRequest(twoForms, "robot", "eggs").getPayload() Object form = factory(TestFormReplace.class).createRequest(twoForms, "robot", "eggs").getPayload()
.getRawContent(); .getRawContent();
@ -2447,8 +2443,7 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
} }
@Test @Test
public void testBuildTwoFormsOutOfOrder() throws SecurityException, NoSuchMethodException, public void testBuildTwoFormsOutOfOrder() throws SecurityException, NoSuchMethodException {
UnsupportedEncodingException {
Method twoFormsOutOfOrder = TestFormReplace.class.getMethod("twoFormsOutOfOrder", String.class, String.class); Method twoFormsOutOfOrder = TestFormReplace.class.getMethod("twoFormsOutOfOrder", String.class, String.class);
Object form = factory(TestFormReplace.class).createRequest(twoFormsOutOfOrder, "robot", "eggs").getPayload() Object form = factory(TestFormReplace.class).createRequest(twoFormsOutOfOrder, "robot", "eggs").getPayload()
.getRawContent(); .getRawContent();

View File

@ -20,8 +20,6 @@ package org.jclouds.util;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.UnsupportedEncodingException;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -43,7 +41,7 @@ public class Strings2Test {
assertEquals(Strings2.urlEncode("/read-tests/ tep", '/'), "/read-tests/%20tep"); assertEquals(Strings2.urlEncode("/read-tests/ tep", '/'), "/read-tests/%20tep");
} }
public void testReplaceTokens() throws UnsupportedEncodingException { public void testReplaceTokens() {
assertEquals(Strings2.replaceTokens("hello {where}", ImmutableMap.of("where", "world")), "hello world"); assertEquals(Strings2.replaceTokens("hello {where}", ImmutableMap.of("where", "world")), "hello world");
} }

View File

@ -19,7 +19,6 @@
package org.jclouds.azureblob.blobstore.integration; package org.jclouds.azureblob.blobstore.integration;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
@ -34,7 +33,7 @@ import org.testng.annotations.Test;
public class AzureBlobIntegrationLiveTest extends BaseBlobIntegrationTest { public class AzureBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
@Override @Override
public void testGetIfMatch() throws InterruptedException, UnsupportedEncodingException { public void testGetIfMatch() throws InterruptedException {
// this currently fails // this currently fails
} }

View File

@ -20,8 +20,6 @@ package org.jclouds.scriptbuilder.util;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.UnsupportedEncodingException;
import org.jclouds.scriptbuilder.domain.OsFamily; import org.jclouds.scriptbuilder.domain.OsFamily;
import org.jclouds.scriptbuilder.domain.ShellToken; import org.jclouds.scriptbuilder.domain.ShellToken;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -35,7 +33,7 @@ import com.google.common.collect.ImmutableMap;
@Test(groups = "unit") @Test(groups = "unit")
public class UtilsTest { public class UtilsTest {
public void testReplaceTokens() throws UnsupportedEncodingException { public void testReplaceTokens() {
assertEquals(Utils.replaceTokens("hello {where}", ImmutableMap.of("where", "world")), assertEquals(Utils.replaceTokens("hello {where}", ImmutableMap.of("where", "world")),
"hello world"); "hello world");
} }