mirror of https://github.com/apache/jclouds.git
commit
44a939aa28
|
@ -225,8 +225,8 @@ 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,
|
||||
fetchBlobMetadataProvider.get().setContainerName(container)) : 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;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.jclouds.logging.Logger;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.util.concurrent.Atomics;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.UncheckedTimeoutException;
|
||||
|
@ -97,7 +98,7 @@ public class CloudServersImageExtension implements ImageExtension {
|
|||
org.jclouds.cloudservers.domain.Image csImage = client.createImageFromServer(cloneTemplate.getName(),
|
||||
Integer.parseInt(cloneTemplate.getSourceNodeId()));
|
||||
|
||||
final AtomicReference<Image> image = new AtomicReference<Image>(new ImageBuilder()
|
||||
final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
|
||||
.location(location.get())
|
||||
.ids(csImage.getId() + "")
|
||||
.description(cloneTemplate.getName())
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class EncryptedPasswordAndPrivateKey {
|
|||
return builder().fromEncryptedPasswordAndPrivateKey(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
|
||||
protected String encryptedPassword;
|
||||
protected String privateKey;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -93,7 +93,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
|
|||
return properties;
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Builder() {
|
||||
this(EC2Client.class, EC2AsyncClient.class);
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.jclouds.logging.Logger;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.util.concurrent.Atomics;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.UncheckedTimeoutException;
|
||||
|
@ -110,7 +111,7 @@ public class EC2ImageExtension implements ImageExtension {
|
|||
String imageId = ec2Client.getAMIServices().createImageInRegion(region, cloneTemplate.getName(), instanceId,
|
||||
CreateImageOptions.NONE);
|
||||
|
||||
final AtomicReference<Image> image = new AtomicReference<Image>(new ImageBuilder()
|
||||
final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
|
||||
.location(find(locations.get(), idEquals(region)))
|
||||
.id(region + "/" + imageId)
|
||||
.providerId(imageId)
|
||||
|
|
|
@ -161,7 +161,7 @@ public final class Subnet {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String subnetId;
|
||||
private State subnetState;
|
||||
private String vpcId;
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -73,7 +73,7 @@ public class KeystoneApiMetadata extends BaseRestApiMetadata {
|
|||
return properties;
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Builder() {
|
||||
this(KeystoneApi.class, KeystoneAsyncApi.class);
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.util.concurrent.Atomics;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.UncheckedTimeoutException;
|
||||
|
@ -109,7 +110,7 @@ public class NovaImageExtension implements ImageExtension {
|
|||
|
||||
logger.info(">> Registered new Image %s, waiting for it to become available.", newImageId);
|
||||
|
||||
final AtomicReference<Image> image = new AtomicReference<Image>(new ImageBuilder()
|
||||
final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
|
||||
.location(find(locations.get(), idEquals(targetImageZoneAndId.getZone())))
|
||||
.id(targetImageZoneAndId.slashEncode())
|
||||
.providerId(targetImageZoneAndId.getId())
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ServerCreated extends Resource {
|
|||
return builder().fromServerCreated(this);
|
||||
}
|
||||
|
||||
public final static class Builder extends Resource.Builder<Builder> {
|
||||
public static final class Builder extends Resource.Builder<Builder> {
|
||||
protected String adminPass;
|
||||
|
||||
/**
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ChangeBatch extends ForwardingList<ActionOnResourceRecordSet> {
|
|||
return new Builder();
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private Optional<String> comment = Optional.absent();
|
||||
private ImmutableList.Builder<ActionOnResourceRecordSet> changes = ImmutableList.builder();
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public final class HostedZone {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String id;
|
||||
private String name;
|
||||
private String callerReference;
|
||||
|
|
|
@ -95,7 +95,7 @@ public class ResourceRecordSet {
|
|||
/**
|
||||
* A portion of a RRs who share the same name and type
|
||||
*/
|
||||
public static abstract class RecordSubset extends ResourceRecordSet {
|
||||
public abstract static class RecordSubset extends ResourceRecordSet {
|
||||
public static final class Weighted extends RecordSubset {
|
||||
|
||||
private final int weight;
|
||||
|
@ -261,7 +261,7 @@ public class ResourceRecordSet {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String id;
|
||||
private String name;
|
||||
private String type;
|
||||
|
|
|
@ -94,7 +94,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
|
|||
return properties;
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Builder() {
|
||||
this(S3Client.class, S3AsyncClient.class);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -109,7 +109,7 @@ public final class SessionCredentials extends Credentials {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder extends Credentials.Builder<SessionCredentials> {
|
||||
public static final class Builder extends Credentials.Builder<SessionCredentials> {
|
||||
private String accessKeyId;
|
||||
private String secretAccessKey;
|
||||
private String sessionToken;
|
||||
|
|
|
@ -26,7 +26,8 @@ import static com.google.common.io.BaseEncoding.base64;
|
|||
import static com.google.common.io.ByteStreams.readBytes;
|
||||
import static org.jclouds.aws.reference.FormParameters.ACTION;
|
||||
import static org.jclouds.aws.reference.FormParameters.AWS_ACCESS_KEY_ID;
|
||||
import static org.jclouds.aws.reference.FormParameters.*;
|
||||
import static org.jclouds.aws.reference.FormParameters.SECURITY_TOKEN;
|
||||
import static org.jclouds.aws.reference.FormParameters.SIGNATURE;
|
||||
import static org.jclouds.aws.reference.FormParameters.SIGNATURE_METHOD;
|
||||
import static org.jclouds.aws.reference.FormParameters.SIGNATURE_VERSION;
|
||||
import static org.jclouds.aws.reference.FormParameters.TIMESTAMP;
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class UserAndSessionCredentials {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private User user;
|
||||
private SessionCredentials credentials;
|
||||
private int packedPolicySize;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SwiftApiMetadata extends BaseRestApiMetadata {
|
|||
return properties;
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Builder() {
|
||||
this(SwiftClient.class, SwiftAsyncClient.class);
|
||||
|
|
|
@ -75,7 +75,7 @@ public class SwiftKeystoneApiMetadata extends SwiftApiMetadata {
|
|||
return properties;
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> extends SwiftApiMetadata.Builder<T> {
|
||||
public abstract static class Builder<T extends Builder<T>> extends SwiftApiMetadata.Builder<T> {
|
||||
protected Builder() {
|
||||
this(SwiftKeystoneClient.class, SwiftKeystoneAsyncClient.class);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -20,7 +20,8 @@ package org.jclouds.compute.domain;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import static com.google.common.base.CaseFormat.*;
|
||||
import static com.google.common.base.CaseFormat.LOWER_HYPHEN;
|
||||
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
|
||||
|
||||
/**
|
||||
* Running Operating system
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -585,7 +585,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 abstract class BaseApiMetadata implements ApiMetadata {
|
|||
return props;
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> implements ApiMetadata.Builder<T> {
|
||||
public abstract static class Builder<T extends Builder<T>> implements ApiMetadata.Builder<T> {
|
||||
protected abstract T self();
|
||||
|
||||
private String id;
|
||||
|
|
|
@ -88,7 +88,7 @@ public class IterableWithMarkers {
|
|||
}
|
||||
}
|
||||
|
||||
private static abstract class ForwardingIterableWithMarker<T> extends IterableWithMarker<T> {
|
||||
private abstract static class ForwardingIterableWithMarker<T> extends IterableWithMarker<T> {
|
||||
|
||||
protected abstract IterableWithMarker<T> delegate();
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public abstract class Arg0ToPagedIterable<T, I extends Arg0ToPagedIterable<T, I>
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public static abstract class FromCaller<T, I extends FromCaller<T, I>> extends Arg0ToPagedIterable<T, I> {
|
||||
public abstract static class FromCaller<T, I extends FromCaller<T, I>> extends Arg0ToPagedIterable<T, I> {
|
||||
@Override
|
||||
protected List<Object> getArgs(GeneratedHttpRequest request) {
|
||||
return request.getCaller().get().getArgs();
|
||||
|
|
|
@ -113,7 +113,7 @@ public class WithSubmissionTrace {
|
|||
}
|
||||
}
|
||||
|
||||
private final static Set<String> stackTracesToTrim = ImmutableSet.of(WithSubmissionTrace.class.getName(),
|
||||
private static final Set<String> stackTracesToTrim = ImmutableSet.of(WithSubmissionTrace.class.getName(),
|
||||
ListeningExecutorService.class.getName(), ListenableFuture.class.getName(),
|
||||
ListeningScheduledExecutorService.class.getName(), ScheduledFuture.class.getName());
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.http;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -199,7 +199,7 @@ public class NamingStrategies {
|
|||
/**
|
||||
* Determines field naming from constructor annotations
|
||||
*/
|
||||
public final static class AnnotationConstructorNamingStrategy extends AnnotationBasedNamingStrategy {
|
||||
public static final class AnnotationConstructorNamingStrategy extends AnnotationBasedNamingStrategy {
|
||||
private final Predicate<Invokable<?, ?>> hasMarker;
|
||||
private final Collection<? extends Class<? extends Annotation>> markers;
|
||||
|
||||
|
|
|
@ -289,7 +289,9 @@ public class Reflection2 {
|
|||
if (raw == Object.class)
|
||||
continue;
|
||||
for (Method method : raw.getDeclaredMethods()) {
|
||||
if (!coreJavaClass(raw)) {
|
||||
method.setAccessible(true);
|
||||
}
|
||||
builder.add(key.method(method));
|
||||
}
|
||||
}
|
||||
|
@ -297,6 +299,17 @@ public class Reflection2 {
|
|||
}
|
||||
});
|
||||
|
||||
private static boolean coreJavaClass(Class<?> clazz) {
|
||||
// treat null packages (e.g. for proxy objects) as "non-core"
|
||||
Package clazzPackage = clazz.getPackage();
|
||||
if (clazzPackage == null) {
|
||||
return false;
|
||||
}
|
||||
String packageName = clazzPackage.getName();
|
||||
return packageName.startsWith("com.sun.") || packageName.startsWith("java.")
|
||||
|| packageName.startsWith("javax.") || packageName.startsWith("sun.");
|
||||
}
|
||||
|
||||
/**
|
||||
* ensures that exceptions are not doubly-wrapped
|
||||
*/
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class BaseHttpApiMetadata<A> extends BaseApiMetadata implements
|
|||
}, apiToken);
|
||||
}
|
||||
|
||||
public static abstract class Builder<A, T extends Builder<A, T>> extends BaseApiMetadata.Builder<T> implements
|
||||
public abstract static class Builder<A, T extends Builder<A, T>> extends BaseApiMetadata.Builder<T> implements
|
||||
HttpApiMetadata.Builder<A, T> {
|
||||
protected Class<A> api;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class BaseRestApiMetadata extends BaseApiMetadata implements Res
|
|||
}, asyncApiToken);
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> extends BaseApiMetadata.Builder<T> implements RestApiMetadata.Builder<T> {
|
||||
public abstract static class Builder<T extends Builder<T>> extends BaseApiMetadata.Builder<T> implements RestApiMetadata.Builder<T> {
|
||||
protected Class<?> api;
|
||||
protected Class<?> asyncApi;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public final class GeneratedHttpRequest extends HttpRequest {
|
|||
return new Builder().fromGeneratedHttpRequest(this);
|
||||
}
|
||||
|
||||
public final static class Builder extends HttpRequest.Builder<Builder> {
|
||||
public static final class Builder extends HttpRequest.Builder<Builder> {
|
||||
private Invocation invocation;
|
||||
private Optional<Invocation> caller = Optional.absent();
|
||||
|
||||
|
|
|
@ -572,8 +572,8 @@ public class RestAnnotationProcessor implements Function<Invocation, HttpRequest
|
|||
}
|
||||
|
||||
private boolean shouldAddHostHeader(Invocation invocation) {
|
||||
return (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(VirtualHost.class) || invocation
|
||||
.getInvokable().isAnnotationPresent(VirtualHost.class));
|
||||
return invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(VirtualHost.class) || invocation
|
||||
.getInvokable().isAnnotationPresent(VirtualHost.class);
|
||||
}
|
||||
|
||||
private GeneratedHttpRequest decorateRequest(GeneratedHttpRequest request) throws NegativeArraySizeException {
|
||||
|
|
|
@ -109,7 +109,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;
|
||||
}
|
||||
|
@ -124,7 +124,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 ["
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.google.common.reflect.Invokable;
|
|||
@Test(testName = "Arg0ToPagedIterableTest")
|
||||
public class Arg0ToPagedIterableTest {
|
||||
|
||||
private static abstract class TestArg0 extends Arg0ToPagedIterable<String, TestArg0> {
|
||||
private abstract static class TestArg0 extends Arg0ToPagedIterable<String, TestArg0> {
|
||||
private TestArg0(GeneratedHttpRequest in) {
|
||||
this.setContext(in);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class Arg0ToPagedIterableTest {
|
|||
}
|
||||
}
|
||||
|
||||
private static abstract class TestCallerArg0 extends Arg0ToPagedIterable.FromCaller<String, TestCallerArg0> {
|
||||
private abstract static class TestCallerArg0 extends Arg0ToPagedIterable.FromCaller<String, TestCallerArg0> {
|
||||
private TestCallerArg0(GeneratedHttpRequest in) {
|
||||
this.setContext(in);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.reflect;
|
||||
|
||||
import static org.easymock.EasyMock.createNiceMock;
|
||||
import static org.easymock.EasyMock.expectLastCall;
|
||||
import static org.easymock.EasyMock.replay;
|
||||
import static org.jclouds.reflect.Reflection2.methods;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ReflectPermission;
|
||||
|
||||
import org.easymock.IAnswer;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests {@link Reflection2#methods()} on core Java classes where
|
||||
* reflective access may be limited by a {@link SecurityManager}.
|
||||
*
|
||||
* This test has been separated out into a separate class as it modifies
|
||||
* a system-wide setting (the {@code SecurityManager}) and needs to perform
|
||||
* cleanup to avoid affecting other tests.
|
||||
*
|
||||
* @author Andrew Phillips
|
||||
*/
|
||||
@Test(singleThreaded = true)
|
||||
public class Reflection2CoreJavaClassesTest {
|
||||
private SecurityManager originalSecurityManager;
|
||||
private boolean securityManagerOverridden = false;
|
||||
|
||||
@BeforeClass
|
||||
public void backupSecurityManager() {
|
||||
originalSecurityManager = System.getSecurityManager();
|
||||
}
|
||||
|
||||
public void testCoreJavaMethodsNotMadeAccessible(final Method testMethod) {
|
||||
// a nice mock is required because plenty of other checks will be made
|
||||
SecurityManager mockSecurityManager = createNiceMock(SecurityManager.class);
|
||||
// clunky way of failing if the following method is ever called
|
||||
mockSecurityManager.checkPermission(new ReflectPermission("suppressAccessChecks"));
|
||||
expectLastCall().andStubAnswer(new IAnswer<Void>() {
|
||||
@Override
|
||||
public Void answer() throws Throwable {
|
||||
try {
|
||||
// generate a stacktrace
|
||||
throw new Exception();
|
||||
} catch(Exception exception) {
|
||||
// fail *only* if being called from this test
|
||||
for (StackTraceElement element : exception.getStackTrace()) {
|
||||
if (element.getMethodName().equals(testMethod.getName())) {
|
||||
throw new AssertionError("checkPermission(new ReflectPermission(\"suppressAccessChecks\")) should not be called");
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
replay(mockSecurityManager);
|
||||
System.setSecurityManager(mockSecurityManager);
|
||||
securityManagerOverridden = true;
|
||||
methods(Enum.class);
|
||||
}
|
||||
|
||||
@AfterClass(alwaysRun = true)
|
||||
public void restoreSecurityManager() {
|
||||
// will only be true if we have permission to set the SecurityManager
|
||||
if (securityManagerOverridden) {
|
||||
System.setSecurityManager(originalSecurityManager);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class SessionConnection implements Connection<Session> {
|
|||
return new Builder();
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
|
||||
private HostAndPort hostAndPort;
|
||||
private LoginCredentials loginCredentials;
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -118,7 +118,7 @@ public class DynECTHttpApiModule extends HttpApiModule<DynECTApi> {
|
|||
* synchronized to prevent multiple callers from overlapping requests on the same session
|
||||
*/
|
||||
@Override
|
||||
synchronized protected HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException {
|
||||
protected synchronized HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException {
|
||||
HttpResponse response = super.invoke(connection);
|
||||
if (response.getStatusCode() == 200) {
|
||||
byte[] data = closeClientButKeepContentStream(response);
|
||||
|
|
|
@ -106,7 +106,7 @@ public final class CreatePrimaryZone {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String fqdn;
|
||||
private String contact;
|
||||
private int defaultTTL = 3600;
|
||||
|
|
|
@ -66,7 +66,7 @@ public final class SOARecord extends Record<SOAData> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder extends Record.Builder<SOAData, Builder> {
|
||||
public static final class Builder extends Record.Builder<SOAData, Builder> {
|
||||
|
||||
private SerialStyle serialStyle;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public final class SessionCredentials extends Credentials {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder extends Credentials.Builder<SessionCredentials> {
|
||||
public static final class Builder extends Credentials.Builder<SessionCredentials> {
|
||||
private String customerName;
|
||||
private String userName;
|
||||
private String password;
|
||||
|
|
|
@ -156,7 +156,7 @@ public final class Zone {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String fqdn;
|
||||
private Type type;
|
||||
private int serial;
|
||||
|
|
|
@ -73,7 +73,7 @@ public class AAAAData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String address;
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,7 +74,7 @@ public class AData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String address;
|
||||
|
||||
/**
|
||||
|
|
|
@ -75,7 +75,7 @@ public class CNAMEData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String cname;
|
||||
|
||||
/**
|
||||
|
|
|
@ -89,7 +89,7 @@ public class MXData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private int preference = -1;
|
||||
private String exchange;
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public class NSData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String nsdname;
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,7 +74,7 @@ public class PTRData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String ptrdname;
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,7 +145,7 @@ public class SOAData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String mname;
|
||||
private String rname;
|
||||
private int serial = -1;
|
||||
|
|
|
@ -113,7 +113,7 @@ public class SRVData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private int priority = -1;
|
||||
private int weight = -1;
|
||||
private int port = -1;
|
||||
|
|
|
@ -85,7 +85,7 @@ public class SSHFPData extends ForwardingMap<String, Object> {
|
|||
return fingerprint;
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private int algorithm;
|
||||
private int fptype;
|
||||
private String fingerprint;
|
||||
|
|
|
@ -74,7 +74,7 @@ public class TXTData extends ForwardingMap<String, Object> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String txtdata;
|
||||
|
||||
/**
|
||||
|
|
|
@ -92,7 +92,7 @@ public final class AccountLevelGroup {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String id;
|
||||
private String name;
|
||||
private Type type;
|
||||
|
|
|
@ -92,7 +92,7 @@ public class DirectionalGroup extends ForwardingMultimap<String, String> {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String name;
|
||||
private Optional<String> description = Optional.absent();
|
||||
private ImmutableMultimap.Builder<String, String> regionToTerritories = ImmutableMultimap
|
||||
|
|
|
@ -107,7 +107,7 @@ public class DirectionalGroupCoordinates {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String zoneName;
|
||||
private String recordName;
|
||||
private int recordType = -1;
|
||||
|
|
|
@ -175,7 +175,7 @@ public final class DirectionalPool {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String zoneId;
|
||||
private String id;
|
||||
private Optional<String> name = Optional.absent();
|
||||
|
|
|
@ -103,7 +103,7 @@ public class DirectionalPoolRecord {
|
|||
return drBuilder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String type;
|
||||
private int ttl = -1;
|
||||
private boolean noResponseRecord;
|
||||
|
|
|
@ -117,7 +117,7 @@ public class DirectionalPoolRecordDetail {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String zoneName;
|
||||
private String name;
|
||||
private String id;
|
||||
|
|
|
@ -148,7 +148,7 @@ public final class PoolRecordSpec {
|
|||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
public static final class Builder {
|
||||
private String description;
|
||||
private String state;
|
||||
private boolean probingEnabled;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue