mirror of https://github.com/apache/jclouds.git
Address Xlint warnings
This commit is contained in:
parent
2e1cc3c281
commit
371db8d18f
|
@ -222,7 +222,7 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
|
|||
ListenableFuture<BoundedSet<? extends DirectoryEntry>> returnVal = async.listDirectory(container, nativeOptions);
|
||||
ListenableFuture<PageSet<? extends StorageMetadata>> list = transform(returnVal, container2ResourceList,
|
||||
userExecutor);
|
||||
return (ListenableFuture<PageSet<? extends StorageMetadata>>) (options.isDetailed() ? transform(list,
|
||||
return (options.isDetailed() ? transform(list,
|
||||
fetchBlobMetadataProvider.get().setContainerName(container)) : list);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class AtmosUtils {
|
|||
|
||||
public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
|
||||
throws HttpException {
|
||||
AtmosError error = (AtmosError) factory.create(errorHandlerProvider.get()).parse(content);
|
||||
AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
|
||||
if (error.getCode() == 1032) {
|
||||
error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest<AtmosAsyncCl
|
|||
request,
|
||||
"Accept: */*\nDate: Thu, 05 Jun 2008 16:38:19 GMT\nExpect: 100-continue\nx-emc-signature: 7Cbdnu+YA5rG9J/C9RlHk07mU7w=\nx-emc-uid: identity\n");
|
||||
|
||||
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 2l, new byte[] { 0, 2, 4, 8 }, new Date(1000));
|
||||
assertContentHeadersEqual(request, "text/plain", null, null, null, 2L, new byte[] { 0, 2, 4, 8 }, new Date(1000));
|
||||
|
||||
assertEquals(request.getFilters().size(), 0);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.testng.annotations.Test;
|
|||
public class ErrorHandlerTest extends BaseHandlerTest {
|
||||
|
||||
ParseSax<AtmosError> createParser() {
|
||||
ParseSax<AtmosError> parser = (ParseSax<AtmosError>) factory.create(injector
|
||||
ParseSax<AtmosError> parser = factory.create(injector
|
||||
.getInstance(ErrorHandler.class));
|
||||
return parser;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.google.common.collect.Sets;
|
|||
public class ListDirectoryResponseHandlerTest extends BaseHandlerTest {
|
||||
|
||||
ParseSax<Set<DirectoryEntry>> createParser() {
|
||||
ParseSax<Set<DirectoryEntry>> parser = (ParseSax<Set<DirectoryEntry>>) factory
|
||||
ParseSax<Set<DirectoryEntry>> parser = factory
|
||||
.create(injector.getInstance(ListDirectoryResponseHandler.class));
|
||||
return parser;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class MapToServerInfoTest {
|
|||
"tcp/23", "tcp/25", "tcp/110", "tcp/143", "tcp/43595")).build()))
|
||||
.devices(
|
||||
ImmutableMap.of("ide:0:0",
|
||||
new IDEDevice.Builder((int) 0, (int) 0).uuid("4af85ed3-0caa-4736-8a26-a33d7de0a122").build()
|
||||
new IDEDevice.Builder(0, 0).uuid("4af85ed3-0caa-4736-8a26-a33d7de0a122").build()
|
||||
|
||||
))
|
||||
.metrics(
|
||||
|
@ -95,7 +95,7 @@ public class MapToServerInfoTest {
|
|||
.devices(
|
||||
ImmutableMap.of(
|
||||
"ide:0:0",
|
||||
new IDEDevice.Builder((int) 0, (int) 0).uuid("853bb98a-4fff-4c2f-a265-97c363f19ea5")
|
||||
new IDEDevice.Builder(0, 0).uuid("853bb98a-4fff-4c2f-a265-97c363f19ea5")
|
||||
.mediaType(MediaType.CDROM).build()))
|
||||
.metrics(
|
||||
new ServerMetrics.Builder().driveMetrics(ImmutableMap.of("ide:0:0", new DriveMetrics.Builder().build()))
|
||||
|
@ -143,7 +143,7 @@ public class MapToServerInfoTest {
|
|||
"tcp/23", "tcp/25", "tcp/110", "tcp/143", "tcp/43595")).build()))
|
||||
.devices(
|
||||
ImmutableMap.of("ide:0:0",
|
||||
new IDEDevice.Builder((int) 0, (int) 0).uuid("403c9a86-0aab-4e47-aa95-e9768021c4c1").build()
|
||||
new IDEDevice.Builder(0, 0).uuid("403c9a86-0aab-4e47-aa95-e9768021c4c1").build()
|
||||
|
||||
))
|
||||
.metrics(
|
||||
|
|
|
@ -53,7 +53,7 @@ public abstract class BaseCloudStackExpectTest<S> extends BaseRestClientExpectTe
|
|||
|
||||
@Override
|
||||
public S createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
||||
return (S) clientFrom(createInjector(fn, module, props).getInstance(CloudStackContext.class));
|
||||
return clientFrom(createInjector(fn, module, props).getInstance(CloudStackContext.class));
|
||||
}
|
||||
|
||||
protected abstract S clientFrom(CloudStackContext context);
|
||||
|
|
|
@ -124,7 +124,7 @@ public class DescribeImagesResponseHandlerTest {
|
|||
}
|
||||
|
||||
});
|
||||
ParseSax<Set<Image>> parser = (ParseSax<Set<Image>>) injector.getInstance(ParseSax.Factory.class).create(
|
||||
ParseSax<Set<Image>> parser = injector.getInstance(ParseSax.Factory.class).create(
|
||||
injector.getInstance(DescribeImagesResponseHandler.class));
|
||||
return parser;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
|
|||
}
|
||||
|
||||
});
|
||||
ParseSax<Set<Reservation<? extends RunningInstance>>> parser = (ParseSax<Set<Reservation<? extends RunningInstance>>>) injector
|
||||
ParseSax<Set<Reservation<? extends RunningInstance>>> parser = injector
|
||||
.getInstance(ParseSax.Factory.class)
|
||||
.create(injector.getInstance(DescribeInstancesResponseHandler.class));
|
||||
return parser;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class MapToServerInfoTest {
|
|||
"tcp/23", "tcp/25", "tcp/110", "tcp/143", "tcp/43595")).build()))
|
||||
.devices(
|
||||
ImmutableMap.of("ide:0:0",
|
||||
new IDEDevice.Builder((int) 0, (int) 0).uuid("4af85ed3-0caa-4736-8a26-a33d7de0a122").build()
|
||||
new IDEDevice.Builder(0, 0).uuid("4af85ed3-0caa-4736-8a26-a33d7de0a122").build()
|
||||
|
||||
))
|
||||
.metrics(
|
||||
|
@ -95,7 +95,7 @@ public class MapToServerInfoTest {
|
|||
.devices(
|
||||
ImmutableMap.of(
|
||||
"ide:0:0",
|
||||
new IDEDevice.Builder((int) 0, (int) 0).uuid("853bb98a-4fff-4c2f-a265-97c363f19ea5")
|
||||
new IDEDevice.Builder(0, 0).uuid("853bb98a-4fff-4c2f-a265-97c363f19ea5")
|
||||
.mediaType(MediaType.CDROM).build()))
|
||||
.metrics(
|
||||
new ServerMetrics.Builder().driveMetrics(ImmutableMap.of("ide:0:0", new DriveMetrics.Builder().build()))
|
||||
|
@ -149,7 +149,7 @@ public class MapToServerInfoTest {
|
|||
"tcp/23", "tcp/25", "tcp/110", "tcp/143", "tcp/43595")).build()))
|
||||
.devices(
|
||||
ImmutableMap.of("ide:0:0",
|
||||
new IDEDevice.Builder((int) 0, (int) 0).uuid("403c9a86-0aab-4e47-aa95-e9768021c4c1").build()
|
||||
new IDEDevice.Builder(0, 0).uuid("403c9a86-0aab-4e47-aa95-e9768021c4c1").build()
|
||||
|
||||
))
|
||||
.metrics(
|
||||
|
|
|
@ -42,7 +42,7 @@ public class AccessControlListHandlerTest extends BaseHandlerTest {
|
|||
public static final String aclExtreme = "<AccessControlPolicy xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Owner><ID>1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c</ID><DisplayName>jamesmurty</DisplayName></Owner><AccessControlList><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI></Grantee><Permission>WRITE</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI></Grantee><Permission>READ_ACP</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c</ID><DisplayName>jamesmurty</DisplayName></Grantee><Permission>WRITE</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI></Grantee><Permission>WRITE_ACP</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AllUsers</URI></Grantee><Permission>READ</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI></Grantee><Permission>READ</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/s3/LogDelivery</URI></Grantee><Permission>WRITE</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c</ID><DisplayName>jamesmurty</DisplayName></Grantee><Permission>READ</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c</ID><DisplayName>jamesmurty</DisplayName></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>";
|
||||
|
||||
ParseSax<AccessControlList> createParser() {
|
||||
ParseSax<AccessControlList> parser = (ParseSax<AccessControlList>) factory.create(injector
|
||||
ParseSax<AccessControlList> parser = factory.create(injector
|
||||
.getInstance(AccessControlListHandler.class));
|
||||
return parser;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class CopyObjectHandlerTest extends BaseHandlerTest {
|
|||
.iso8601DateParse("2009-03-19T13:23:27.000Z"),
|
||||
"\"92836a3ea45a6984d1b4d23a747d46bb\"");
|
||||
|
||||
ObjectMetadata result = (ObjectMetadata) factory.create(
|
||||
ObjectMetadata result = factory.create(
|
||||
injector.getInstance(CopyObjectHandler.class)).parse(is);
|
||||
|
||||
assertEquals(result, expected);
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.testng.annotations.Test;
|
|||
public class PayerHandlerTest extends BaseHandlerTest {
|
||||
|
||||
ParseSax<Payer> createParser() {
|
||||
ParseSax<Payer> parser = (ParseSax<Payer>) factory.create(injector
|
||||
ParseSax<Payer> parser = factory.create(injector
|
||||
.getInstance(PayerHandler.class));
|
||||
return parser;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class S3ParserTest extends PerformanceTest {
|
|||
}
|
||||
|
||||
private ListBucketResponse runParseListContainerResult() throws HttpException {
|
||||
return (ListBucketResponse) factory.create(injector.getInstance(ListBucketHandler.class)).setContext(
|
||||
return factory.create(injector.getInstance(ListBucketHandler.class)).setContext(
|
||||
HttpRequest.builder().method("GET").endpoint("http://bucket.com").build()).parse(
|
||||
Strings2.toInputStream(listContainerResult));
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class S3ParserTest extends PerformanceTest {
|
|||
public static final String successfulCopyObject200 = "<CopyObjectResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><LastModified>2009-03-19T13:23:27.000Z</LastModified><ETag>\"92836a3ea45a6984d1b4d23a747d46bb\"</ETag></CopyObjectResult>";
|
||||
|
||||
private ObjectMetadata runParseCopyObjectResult() throws HttpException {
|
||||
return (ObjectMetadata) factory.create(injector.getInstance(CopyObjectHandler.class)).parse(
|
||||
return factory.create(injector.getInstance(CopyObjectHandler.class)).parse(
|
||||
Strings2.toInputStream(successfulCopyObject200));
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams ext
|
|||
}
|
||||
|
||||
public Map<String, String> idReceiptHandle(Iterable<String> input) {
|
||||
return Maps.uniqueIndex((Iterable<String>) input, new Function<String, String>() {
|
||||
return Maps.uniqueIndex(input, new Function<String, String>() {
|
||||
int index = 1;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams exten
|
|||
}
|
||||
|
||||
public Map<String, String> idMessageBody(Iterable<String> input) {
|
||||
return Maps.uniqueIndex((Iterable<String>) input, new Function<String, String>() {
|
||||
return Maps.uniqueIndex(input, new Function<String, String>() {
|
||||
int index = 1;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ErrorHandlerTest extends BaseHandlerTest {
|
|||
public static final String errorFromAmazonIfYouDontRemoveTransferEncodingHeader = "<Error><Code>NotImplemented</Code><Message>A header you provided implies functionality that is not implemented</Message><Header>Transfer-Encoding</Header><RequestId>7C59925D75D15561</RequestId><HostId>fbskVU51OZJg2yZS/wNIxoE2PmCf0ZqFd0iH6Vrzw0uKG3KmokswBytL/Bfp/GWb</HostId></Error>";
|
||||
|
||||
ParseSax<AWSError> createParser() {
|
||||
ParseSax<AWSError> parser = (ParseSax<AWSError>) factory.create(injector.getInstance(ErrorHandler.class));
|
||||
ParseSax<AWSError> parser = factory.create(injector.getInstance(ErrorHandler.class));
|
||||
return parser;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class MultipartUploadSlicingAlgorithm {
|
|||
long unitPartSize = defaultPartSize; // first try with default part size
|
||||
int parts = (int)(length / unitPartSize);
|
||||
long partSize = unitPartSize;
|
||||
int magnitude = (int) (parts / magnitudeBase);
|
||||
int magnitude = parts / magnitudeBase;
|
||||
if (magnitude > 0) {
|
||||
partSize = magnitude * unitPartSize;
|
||||
if (partSize > MultipartUpload.MAX_PART_SIZE) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CreateContainerOptions extends BaseHttpRequestOptions {
|
|||
|
||||
public static CreateContainerOptions withMetadata(Map<String, String> metadata) {
|
||||
CreateContainerOptions options = new CreateContainerOptions();
|
||||
return (CreateContainerOptions) options.withMetadata(metadata);
|
||||
return options.withMetadata(metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class VCloudUtils {
|
|||
String contentType = response.getPayload().getContentMetadata().getContentType();
|
||||
if (contentType != null && contentType.startsWith(VCloudMediaType.ERROR_XML)) {
|
||||
try {
|
||||
return (VCloudError) factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
|
||||
return factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
|
||||
} catch (RuntimeException e) {
|
||||
logger.warn(e, "error parsing error");
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class CatalogHandlerTest {
|
|||
InputStream is = getClass().getResourceAsStream("/catalog-blank.xml");
|
||||
injector = Guice.createInjector(new SaxParserModule());
|
||||
factory = injector.getInstance(ParseSax.Factory.class);
|
||||
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
|
||||
Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
|
||||
assertEquals(result, new CatalogImpl("Jclouds-private", "application/vnd.vmware.vcloud.catalog+xml", URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081"), new ReferenceTypeImpl(null,
|
||||
"application/vnd.vmware.vcloud.org+xml", URI
|
||||
|
@ -67,7 +67,7 @@ public class CatalogHandlerTest {
|
|||
InputStream is = getClass().getResourceAsStream("/catalog.xml");
|
||||
injector = Guice.createInjector(new SaxParserModule());
|
||||
factory = injector.getInstance(ParseSax.Factory.class);
|
||||
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
|
||||
Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "Miami Environment 1");
|
||||
assert result.getDescription() == null;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class OrgHandlerTest {
|
|||
Injector injector = Guice.createInjector(new SaxParserModule());
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
|
||||
Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
|
||||
Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "ExampleOrg");
|
||||
assertEquals(result.getFullName(), "ExampleOrg");
|
||||
assertEquals(result.getDescription(), "Example Corp's Primary Organization.");
|
||||
|
@ -80,7 +80,7 @@ public class OrgHandlerTest {
|
|||
Injector injector = Guice.createInjector(new SaxParserModule());
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
|
||||
Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
|
||||
Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "adrian@jclouds.org");
|
||||
assertEquals(result.getFullName(), "adrian@jclouds.org");
|
||||
assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
|
||||
|
@ -98,7 +98,7 @@ public class OrgHandlerTest {
|
|||
InputStream is = getClass().getResourceAsStream("/org-hosting.xml");
|
||||
Injector injector = Guice.createInjector(new SaxParserModule());
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
|
||||
Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "Customer 188849");
|
||||
assertEquals(result.getFullName(), "Customer 188849");
|
||||
assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849"));
|
||||
|
@ -115,7 +115,7 @@ public class OrgHandlerTest {
|
|||
InputStream is = getClass().getResourceAsStream("/org-savvis.xml");
|
||||
Injector injector = Guice.createInjector(new SaxParserModule());
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
|
||||
Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
|
||||
assertEquals(result, new OrgImpl("607968.0", null, null, "607968.0", "Gravitant Inc", ImmutableMap
|
||||
.<String, ReferenceType> of(), ImmutableMap.<String, ReferenceType> of("GravDataCenter1(Saved)",
|
||||
new ReferenceTypeImpl("GravDataCenter1(Saved)", "application/vnd.vmware.vcloud.vdc+xml", URI
|
||||
|
|
|
@ -83,7 +83,7 @@ public class TransientBlobRequestSignerTest extends BaseAsyncClientTest<LocalAsy
|
|||
assertNonPayloadHeadersEqual(
|
||||
request,
|
||||
"Authorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\nContent-Length: 2\nContent-MD5: AAIECA==\nContent-Type: text/plain\n");
|
||||
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 2l, new byte[] { 0, 2, 4, 8 }, null);
|
||||
assertContentHeadersEqual(request, "text/plain", null, null, null, 2L, new byte[] { 0, 2, 4, 8 }, null);
|
||||
|
||||
assertEquals(request.getFilters().size(), 0);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class TransientBlobRequestSignerTest extends BaseAsyncClientTest<LocalAsy
|
|||
assertNonPayloadHeadersEqual(
|
||||
request,
|
||||
"Authorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\nContent-Length: 3\nContent-MD5: rL0Y20zC+Fzt72VPzMSk2A==\nContent-Type: text/plain\n");
|
||||
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 3l, md5, null);
|
||||
assertContentHeadersEqual(request, "text/plain", null, null, null, 3L, md5, null);
|
||||
|
||||
assertEquals(request.getFilters().size(), 0);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.testng.annotations.Test;
|
|||
public class ErrorHandlerTest extends BaseHandlerTest {
|
||||
|
||||
ParseSax<AzureStorageError> createParser() {
|
||||
ParseSax<AzureStorageError> parser = (ParseSax<AzureStorageError>) factory.create(injector
|
||||
ParseSax<AzureStorageError> parser = factory.create(injector
|
||||
.getInstance(ErrorHandler.class));
|
||||
return parser;
|
||||
}
|
||||
|
|
|
@ -403,7 +403,7 @@ public class InstantiateVAppTemplateOptions {
|
|||
*/
|
||||
public static InstantiateVAppTemplateOptions productProperty(String key, String value) {
|
||||
InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
|
||||
return (InstantiateVAppTemplateOptions) options.productProperty(key, value);
|
||||
return options.productProperty(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,7 +412,7 @@ public class InstantiateVAppTemplateOptions {
|
|||
*/
|
||||
public static InstantiateVAppTemplateOptions productProperties(Map<String, String> properties) {
|
||||
InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
|
||||
return (InstantiateVAppTemplateOptions) options.productProperties(properties);
|
||||
return options.productProperties(properties);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class VCloudUtils {
|
|||
return null;
|
||||
if (TerremarkVCloudMediaType.ERROR_XML.equals(response.getPayload().getContentMetadata().getContentType())) {
|
||||
try {
|
||||
return (VCloudError) factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
|
||||
return factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
|
||||
} catch (RuntimeException e) {
|
||||
logger.warn(e, "error parsing error");
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class CatalogHandlerTest {
|
|||
InputStream is = getClass().getResourceAsStream("/catalog.xml");
|
||||
injector = Guice.createInjector(new SaxParserModule());
|
||||
factory = injector.getInstance(ParseSax.Factory.class);
|
||||
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
|
||||
Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "Miami Environment 1");
|
||||
assert result.getDescription() == null;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class CatalogItemHandlerTest extends BaseHandlerTest {
|
|||
|
||||
InputStream is = getClass().getResourceAsStream("/catalogItem-terremark.xml");
|
||||
|
||||
CatalogItem result = (CatalogItem) factory.create(
|
||||
CatalogItem result = factory.create(
|
||||
injector.getInstance(CatalogItemHandler.class)).parse(is);
|
||||
assertEquals(
|
||||
result,
|
||||
|
|
|
@ -40,7 +40,7 @@ public class CustomizationParametersHandlerTest extends BaseHandlerTest {
|
|||
InputStream is = getClass().getResourceAsStream(
|
||||
"/CustomizationParameters.xml");
|
||||
|
||||
CustomizationParameters result = (CustomizationParameters) factory
|
||||
CustomizationParameters result = factory
|
||||
.create(injector.getInstance(CustomizationParametersHandler.class))
|
||||
.parse(is);
|
||||
assertEquals(result, new CustomizationParameters(true, false, false));
|
||||
|
|
|
@ -49,7 +49,7 @@ public class InternetServiceHandlerTest extends BaseHandlerTest {
|
|||
public void test1() throws UnknownHostException {
|
||||
InputStream is = getClass().getResourceAsStream("/InternetService.xml");
|
||||
|
||||
InternetService result = (InternetService) factory.create(injector.getInstance(InternetServiceHandler.class))
|
||||
InternetService result = factory.create(injector.getInstance(InternetServiceHandler.class))
|
||||
.parse(is);
|
||||
assertEquals(result, new InternetService("IS_for_Jim", null, new PublicIpAddress("10.1.22.159", null), 80,
|
||||
Protocol.HTTP, false, 1, "Some test service"));
|
||||
|
@ -58,7 +58,7 @@ public class InternetServiceHandlerTest extends BaseHandlerTest {
|
|||
public void test2() throws UnknownHostException {
|
||||
InputStream is = getClass().getResourceAsStream("/InternetService2.xml");
|
||||
|
||||
InternetService result = (InternetService) factory.create(injector.getInstance(InternetServiceHandler.class))
|
||||
InternetService result = factory.create(injector.getInstance(InternetServiceHandler.class))
|
||||
.parse(is);
|
||||
assertEquals(result, new InternetService("IS_for_Jim2", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/InternetServices/524"), new PublicIpAddress(
|
||||
|
|
|
@ -40,7 +40,7 @@ public class NodeHandlerTest extends BaseHandlerTest {
|
|||
public void test1() throws UnknownHostException {
|
||||
InputStream is = getClass().getResourceAsStream("/NodeService.xml");
|
||||
|
||||
Node result = (Node) factory.create(injector.getInstance(NodeHandler.class)).parse(is);
|
||||
Node result = factory.create(injector.getInstance(NodeHandler.class)).parse(is);
|
||||
assertEquals(result, new Node("Node for Jim", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/NodeServices/242"), "172.16.20.3", 80,
|
||||
false, "Some test node"));
|
||||
|
|
|
@ -78,7 +78,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
|
|||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/launched_vapp.xml");
|
||||
|
||||
VApp result = (VApp) factory.create(
|
||||
VApp result = factory.create(
|
||||
injector.getInstance(VAppHandler.class)).parse(is);
|
||||
|
||||
assertEquals(result.getName(), "adriantest");
|
||||
|
@ -95,7 +95,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
|
|||
public void testGetVApp() throws UnknownHostException {
|
||||
InputStream is = getClass().getResourceAsStream("/get_vapp.xml");
|
||||
|
||||
VApp result = (VApp) factory.create(
|
||||
VApp result = factory.create(
|
||||
injector.getInstance(VAppHandler.class)).parse(is);
|
||||
|
||||
assertEquals(result.getName(), "centos-53");
|
||||
|
|
|
@ -335,7 +335,7 @@ public class Sha512Crypt {
|
|||
StringBuilder result = new StringBuilder();
|
||||
|
||||
while (--size >= 0) {
|
||||
result.append(itoa64.charAt((int) (v & 0x3f)));
|
||||
result.append(itoa64.charAt(v & 0x3f));
|
||||
v >>>= 6;
|
||||
}
|
||||
|
||||
|
|
|
@ -567,7 +567,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||
assert node.getLocation() != null : node;
|
||||
assertEquals(node.getType(), ComputeType.NODE);
|
||||
assert node instanceof NodeMetadata;
|
||||
NodeMetadata nodeMetadata = (NodeMetadata) node;
|
||||
NodeMetadata nodeMetadata = node;
|
||||
assert nodeMetadata.getProviderId() != null : nodeMetadata;
|
||||
// nullable
|
||||
// assert nodeMetadata.getImage() != null : node;
|
||||
|
|
|
@ -77,7 +77,7 @@ public class HttpResponseException extends RuntimeException {
|
|||
|
||||
public HttpResponseException(HttpCommand command, HttpResponse response) {
|
||||
this(String.format("request: %s %sfailed with response: %s", command.getCurrentRequest().getRequestLine(),
|
||||
requestPayloadIfStringOrFormIfNotReturnEmptyString((HttpRequest) command.getCurrentRequest()),
|
||||
requestPayloadIfStringOrFormIfNotReturnEmptyString(command.getCurrentRequest()),
|
||||
response.getStatusLine()), command, response);
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public final class DeserializationConstructorAndReflectiveTypeAdapterFactory imp
|
|||
|
||||
private T newInstance(Object[] ctorParams) throws AssertionError {
|
||||
try {
|
||||
return (T) parameterizedCtor.invoke(null, ctorParams);
|
||||
return parameterizedCtor.invoke(null, ctorParams);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new AssertionError(e);
|
||||
} catch (InvocationTargetException e) {
|
||||
|
|
|
@ -108,7 +108,7 @@ public abstract class BaseContextLiveTest<C extends Context> {
|
|||
*/
|
||||
protected ApiMetadata createApiMetadata() {
|
||||
try {
|
||||
return (ApiMetadata) Apis.withId(provider);
|
||||
return Apis.withId(provider);
|
||||
} catch (NoSuchElementException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public abstract class BaseContextLiveTest<C extends Context> {
|
|||
protected ContextBuilder newBuilder() {
|
||||
if (provider != null)
|
||||
try {
|
||||
return (ContextBuilder) ContextBuilder.newBuilder(provider);
|
||||
return ContextBuilder.newBuilder(provider);
|
||||
} catch (NoSuchElementException e){
|
||||
Logger.getAnonymousLogger()
|
||||
.warning("provider ["
|
||||
|
|
|
@ -134,7 +134,7 @@ public class Throwables2Test {
|
|||
public void testGetFirstThrowableOfTypeOuterTransformParallel() {
|
||||
Exception aex = createMock(AuthorizationException.class);
|
||||
TransformParallelException pex = new TransformParallelException(ImmutableMap.<Object, Future<?>> of(),
|
||||
ImmutableMap.of("bad", (Exception) aex), "test");
|
||||
ImmutableMap.of("bad", aex), "test");
|
||||
assertEquals(getFirstThrowableOfType(new ExecutionException(pex), AuthorizationException.class), aex);
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public class AWSDescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest
|
|||
}
|
||||
|
||||
});
|
||||
ParseSax<Set<Reservation<? extends RunningInstance>>> parser = (ParseSax<Set<Reservation<? extends RunningInstance>>>) injector
|
||||
ParseSax<Set<Reservation<? extends RunningInstance>>> parser = injector
|
||||
.getInstance(ParseSax.Factory.class)
|
||||
.create(injector.getInstance(AWSDescribeInstancesResponseHandler.class));
|
||||
return parser;
|
||||
|
|
|
@ -75,7 +75,7 @@ public class MultipartUploadSlicingAlgorithm {
|
|||
long unitPartSize = defaultPartSize; // first try with default part size
|
||||
int parts = (int)(length / unitPartSize);
|
||||
long partSize = unitPartSize;
|
||||
int magnitude = (int) (parts / magnitudeBase);
|
||||
int magnitude = parts / magnitudeBase;
|
||||
if (magnitude > 0) {
|
||||
partSize = magnitude * unitPartSize;
|
||||
if (partSize > MultipartUpload.MAX_PART_SIZE) {
|
||||
|
|
|
@ -166,7 +166,7 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
|
|||
long chunkSize = algorithm.getChunkSize();
|
||||
long remaining = algorithm.getRemaining();
|
||||
if (parts > 0) {
|
||||
AWSS3Client client = (AWSS3Client) ablobstore
|
||||
AWSS3Client client = ablobstore
|
||||
.getContext().unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
String uploadId = null;
|
||||
final Map<Integer, ListenableFuture<String>> futureParts =
|
||||
|
|
|
@ -99,7 +99,7 @@ public class SequentialMultipartUploadStrategy implements MultipartUploadStrateg
|
|||
int parts = algorithm.getParts();
|
||||
long chunkSize = algorithm.getChunkSize();
|
||||
if (parts > 0) {
|
||||
AWSS3Client client = (AWSS3Client) ablobstore.getContext()
|
||||
AWSS3Client client = ablobstore.getContext()
|
||||
.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
String uploadId = client.initiateMultipartUpload(container,
|
||||
ObjectMetadataBuilder.create().key(key).build()); // TODO md5
|
||||
|
|
|
@ -83,7 +83,7 @@ public class AWSS3ClientLiveTest extends S3ClientLiveTest {
|
|||
|
||||
@Override
|
||||
public AWSS3Client getApi() {
|
||||
return (AWSS3Client) view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
return view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
}
|
||||
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
|
|
|
@ -72,7 +72,7 @@ public class CreateContainerOptions extends CreateOptions {
|
|||
*/
|
||||
public static CreateContainerOptions withMetadata(Multimap<String, String> metadata) {
|
||||
CreateContainerOptions options = new CreateContainerOptions();
|
||||
return (CreateContainerOptions) options.withMetadata(metadata);
|
||||
return options.withMetadata(metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class AzureBlobRequestSignerTest extends BaseAsyncClientTest<AzureBlobAsy
|
|||
assertNonPayloadHeadersEqual(
|
||||
request,
|
||||
"Authorization: SharedKeyLite identity:ssvK6ZB8GMqRcp1lBpY9vIzbLKL9Goxh7wZ2YhfHNzQ=\nDate: Thu, 05 Jun 2008 16:38:19 GMT\nExpect: 100-continue\nx-ms-blob-type: BlockBlob\nx-ms-version: 2009-09-19\n");
|
||||
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 2l, new byte[] { 0, 2, 4, 8 }, new Date(1000));
|
||||
assertContentHeadersEqual(request, "text/plain", null, null, null, 2L, new byte[] { 0, 2, 4, 8 }, new Date(1000));
|
||||
|
||||
assertEquals(request.getFilters().size(), 0);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest {
|
|||
BoundedSet<ContainerProperties> list = new BoundedHashSet<ContainerProperties>(contents, URI
|
||||
.create("http://myaccount.blob.core.windows.net/"), null, null, 3, "video");
|
||||
|
||||
BoundedSet<ContainerProperties> result = (BoundedSet<ContainerProperties>) factory.create(
|
||||
BoundedSet<ContainerProperties> result = factory.create(
|
||||
injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is);
|
||||
|
||||
assertEquals(result, list);
|
||||
|
@ -96,7 +96,7 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest {
|
|||
InputStream is = getClass().getResourceAsStream("/test_list_containers_options.xml");
|
||||
BoundedSet<ContainerProperties> list = new BoundedHashSet<ContainerProperties>(contents, URI
|
||||
.create("http://myaccount.blob.core.windows.net"), "prefix", "marker", 1, "video");
|
||||
BoundedSet<ContainerProperties> result = (BoundedSet<ContainerProperties>) factory.create(
|
||||
BoundedSet<ContainerProperties> result = factory.create(
|
||||
injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is);
|
||||
assertEquals(result, list);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class ContainerNameEnumerationResultsHandlerTest extends BaseHandlerTest
|
|||
URI.create("http://myaccount.blob.core.windows.net/mycontainer"), "myfolder/", null, 4, "newblob2.txt",
|
||||
null, ImmutableSet.<String> of("myfolder/"));
|
||||
|
||||
ListBlobsResponse result = (ListBlobsResponse) factory.create(
|
||||
ListBlobsResponse result = factory.create(
|
||||
injector.getInstance(ContainerNameEnumerationResultsHandler.class)).parse(is);
|
||||
|
||||
assertEquals(result, list);
|
||||
|
@ -99,7 +99,7 @@ public class ContainerNameEnumerationResultsHandlerTest extends BaseHandlerTest
|
|||
null, null, 1, "2!68!MDAwMDA2IWFwcGxlcyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", "/",
|
||||
Sets.<String> newTreeSet());
|
||||
|
||||
ListBlobsResponse result = (ListBlobsResponse) factory.create(
|
||||
ListBlobsResponse result = factory.create(
|
||||
injector.getInstance(ContainerNameEnumerationResultsHandler.class)).parse(is);
|
||||
|
||||
assertEquals(result, list);
|
||||
|
|
|
@ -74,6 +74,7 @@ public enum ShellToken {
|
|||
return familyToTokenValueMap.getUnchecked(family);
|
||||
}
|
||||
|
||||
@SuppressWarnings("fallthrough")
|
||||
public String to(OsFamily family) {
|
||||
checkNotNull(family, "family");
|
||||
switch (this) {
|
||||
|
|
Loading…
Reference in New Issue