wrapper -> view

This commit is contained in:
Adrian Cole 2012-04-23 19:14:36 -07:00
parent 2756040b7e
commit df7d2acbb4
240 changed files with 762 additions and 763 deletions

View File

@ -82,7 +82,7 @@ public class ComputeTaskUtils {
return ContextBuilder.newBuilder(provider)
.credentials(creds.identity, creds.credential)
.modules(modules)
.overrides(props).buildAndWrapWith(ComputeServiceContext.class);
.overrides(props).buildView(ComputeServiceContext.class);
}
});

View File

@ -85,7 +85,7 @@ public class AtmosApiMetadata extends BaseRestApiMetadata {
.version("1.4.0")
.defaultEndpoint("https://accesspoint.atmosonline.com")
.defaultProperties(AtmosApiMetadata.defaultProperties())
.wrapper(TypeToken.of(BlobStoreContext.class))
.view(TypeToken.of(BlobStoreContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(AtmosRestClientModule.class, AtmosBlobStoreContextModule.class));
}

View File

@ -57,7 +57,7 @@ import com.google.common.collect.Sets;
public class AtmosClientLiveTest extends BaseBlobStoreIntegrationTest {
public AtmosClient getApi() {
return wrapper.unwrap(AtmosApiMetadata.CONTEXT_TOKEN).getApi();
return view.unwrap(AtmosApiMetadata.CONTEXT_TOKEN).getApi();
}
private static final class HeadMatches implements Runnable {

View File

@ -34,6 +34,6 @@ public class AtmosLiveTest extends BaseBlobLiveTest {
}
protected void checkMD5(String container, String name, byte[] md5) {
// atmos does not support content-md5 yet
assertEquals(wrapper.getBlobStore().blobMetadata(container, name).getContentMetadata().getContentMD5(), null);
assertEquals(view.getBlobStore().blobMetadata(container, name).getContentMetadata().getContentMD5(), null);
}
}

View File

@ -70,7 +70,7 @@ public class BYONApiMetadata extends BaseApiMetadata {
.documentation(URI.create("https://github.com/jclouds/jclouds/tree/master/apis/byon"))
.version(String.format("%s.%s", JcloudsVersion.get().majorVersion, JcloudsVersion.get().minorVersion))
.buildVersion(JcloudsVersion.get().toString())
.wrapper(ComputeServiceContext.class)
.view(ComputeServiceContext.class)
.defaultModules(ImmutableSet.<Class<? extends Module>>of(YamlNodeStoreModule.class, BYONComputeServiceContextModule.class));
}

View File

@ -83,7 +83,7 @@ public class CloudFilesApiMetadata extends BaseRestApiMetadata {
.documentation(URI.create("http://docs.rackspacecloud.com/files/api/v1/cfdevguide_d5/content/ch01.html"))
.version(OpenStackAuthAsyncClient.VERSION)
.defaultProperties(CloudFilesApiMetadata.defaultProperties())
.wrapper(TypeToken.of(BlobStoreContext.class))
.view(TypeToken.of(BlobStoreContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudFilesRestClientModule.class, CloudFilesBlobStoreContextModule.class));
}

View File

@ -55,7 +55,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides asynchronous access to Cloud Files via their REST API.
* <p/>
* All commands return a ListenableFuture of the result from Cloud Files. Any exceptions incurred
* during processing will be wrapped in an {@link ExecutionException} as documented in
* during processing will be backend in an {@link ExecutionException} as documented in
* {@link ListenableFuture#get()}.
*
* @see CloudFilesClient

View File

@ -33,7 +33,7 @@ import org.jclouds.openstack.swift.CommonSwiftClient;
* Provides access to Cloud Files via their REST API.
* <p/>
* All commands return a Future of the result from Cloud Files. Any exceptions incurred during
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
* processing will be backend in an {@link ExecutionException} as documented in {@link Future#get()}.
*
* @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
* @author Adrian Cole

View File

@ -47,7 +47,7 @@ public class CloudFilesClientLiveTest extends CommonSwiftClientLiveTest<CloudFil
@Override
public CloudFilesClient getApi() {
return wrapper.unwrap(CloudFilesApiMetadata.CONTEXT_TOKEN).getApi();
return view.unwrap(CloudFilesApiMetadata.CONTEXT_TOKEN).getApi();
}
@Override

View File

@ -78,7 +78,7 @@ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
.version(OpenStackAuthAsyncClient.VERSION)
.defaultEndpoint("https://auth.api.rackspacecloud.com")
.defaultProperties(CloudLoadBalancersApiMetadata.defaultProperties())
.wrapper(TypeToken.of(LoadBalancerServiceContext.class))
.view(TypeToken.of(LoadBalancerServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudLoadBalancersRestClientModule.class, CloudLoadBalancersLoadBalancerContextModule.class));
}

View File

@ -20,7 +20,7 @@ package org.jclouds.cloudloadbalancers.internal;
import java.util.concurrent.TimeUnit;
import org.jclouds.apis.BaseWrapperLiveTest;
import org.jclouds.apis.BaseViewLiveTest;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersAsyncClient;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersClient;
import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
@ -42,7 +42,7 @@ import com.google.inject.Injector;
*
* @author Adrian Cole
*/
public class BaseCloudLoadBalancersClientLiveTest extends BaseWrapperLiveTest<LoadBalancerServiceContext> {
public class BaseCloudLoadBalancersClientLiveTest extends BaseViewLiveTest<LoadBalancerServiceContext> {
public BaseCloudLoadBalancersClientLiveTest() {
provider = "cloudloadbalancers";
@ -61,7 +61,7 @@ public class BaseCloudLoadBalancersClientLiveTest extends BaseWrapperLiveTest<Lo
@Override
public void setupContext() {
super.setupContext();
lbContext = wrapper.unwrap();
lbContext = view.unwrap();
client = lbContext.getApi();
@ -75,7 +75,7 @@ public class BaseCloudLoadBalancersClientLiveTest extends BaseWrapperLiveTest<Lo
}
@Override
protected TypeToken<LoadBalancerServiceContext> wrapperType() {
protected TypeToken<LoadBalancerServiceContext> viewType() {
return TypeToken.of(LoadBalancerServiceContext.class);
}

View File

@ -77,7 +77,7 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
.version(OpenStackAuthAsyncClient.VERSION)
.defaultEndpoint("https://auth.api.rackspacecloud.com")
.defaultProperties(CloudServersApiMetadata.defaultProperties())
.wrapper(TypeToken.of(ComputeServiceContext.class))
.view(TypeToken.of(ComputeServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudServersRestClientModule.class, CloudServersComputeServiceContextModule.class));
}

View File

@ -69,7 +69,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides asynchronous access to Cloud Servers via their REST API.
* <p/>
* All commands return a ListenableFuture of the result from Cloud Servers. Any exceptions incurred
* during processing will be wrapped in an {@link ExecutionException} as documented in
* during processing will be backend in an {@link ExecutionException} as documented in
* {@link ListenableFuture#get()}.
*
* @see CloudServersClient

View File

@ -44,7 +44,7 @@ import org.jclouds.rest.ResourceNotFoundException;
* Provides access to Cloud Servers via their REST API.
* <p/>
* All commands return a Future of the result from Cloud Servers. Any exceptions incurred during
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
* processing will be backend in an {@link ExecutionException} as documented in {@link Future#get()}.
*
* @see CloudServersAsyncClient
* @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" />

View File

@ -85,7 +85,7 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
@Override
public void setupContext() {
super.setupContext();
Injector injector = wrapper.utils().injector();
Injector injector = view.utils().injector();
client = injector.getInstance(CloudServersClient.class);
sshFactory = injector.getInstance(SshClient.Factory.class);
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);

View File

@ -82,7 +82,7 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
.version("1.0")
.defaultEndpoint("https://api.cloudsigma.com")
.defaultProperties(CloudSigmaApiMetadata.defaultProperties())
.wrapper(TypeToken.of(ComputeServiceContext.class))
.view(TypeToken.of(ComputeServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudSigmaRestClientModule.class, CloudSigmaComputeServiceContextModule.class));
}

View File

@ -89,7 +89,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
@Override
public void setupContext() {
super.setupContext();
cloudSigmaContext = wrapper.unwrap();
cloudSigmaContext = view.unwrap();
client = cloudSigmaContext.getApi();
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
@ -98,7 +98,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
TimeUnit.SECONDS);
if (Strings.emptyToNull(imageId) == null) {
imageId = wrapper.getComputeService().templateBuilder().build().getImage().getId();
imageId = view.getComputeService().templateBuilder().build().getImage().getId();
}
}

View File

@ -89,7 +89,7 @@ public class CloudStackApiMetadata extends BaseRestApiMetadata {
.documentation(URI.create("http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html"))
.defaultEndpoint("http://localhost:8080/client/api")
.version("2.2")
.wrapper(TypeToken.of(CloudStackContext.class))
.view(TypeToken.of(CloudStackContext.class))
.defaultProperties(CloudStackApiMetadata.defaultProperties())
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudStackRestClientModule.class, CloudStackComputeServiceContextModule.class));
}

View File

@ -46,10 +46,10 @@ public class ParseAsyncJobsFromHttpResponse implements Function<HttpResponse, Se
private final ParseTypedAsyncJob parseTyped;
@Inject
public ParseAsyncJobsFromHttpResponse(ParseTypedAsyncJob parseTyped, GsonWrapper gsonWrapper) {
public ParseAsyncJobsFromHttpResponse(ParseTypedAsyncJob parseTyped, GsonWrapper gsonView) {
this.parseTyped = checkNotNull(parseTyped, "parseTyped");
this.parser = new ParseFirstJsonValueNamed<Set<AsyncJob<Map<String, JsonBall>>>>(
checkNotNull(gsonWrapper, "gsonWrapper"),
checkNotNull(gsonView, "gsonView"),
new TypeLiteral<Set<AsyncJob<Map<String, JsonBall>>>>() { },
"asyncjobs");
}

View File

@ -54,8 +54,8 @@ public class ParseEventTypesFromHttpResponse implements Function<HttpResponse, S
}
@Inject
public ParseEventTypesFromHttpResponse(GsonWrapper gsonWrapper) {
this.parser = new ParseFirstJsonValueNamed<Set<EventType>>(checkNotNull(gsonWrapper, "gsonWrapper"),
public ParseEventTypesFromHttpResponse(GsonWrapper gsonView) {
this.parser = new ParseFirstJsonValueNamed<Set<EventType>>(checkNotNull(gsonView, "gsonView"),
new TypeLiteral<Set<EventType>>() {
}, "eventtype");
}

View File

@ -78,8 +78,8 @@ public class ParseIdToNameFromHttpResponse implements Function<HttpResponse, Map
}
@Inject
public ParseIdToNameFromHttpResponse(GsonWrapper gsonWrapper) {
this.parser = new ParseFirstJsonValueNamed<Set<IdName>>(checkNotNull(gsonWrapper, "gsonWrapper"),
public ParseIdToNameFromHttpResponse(GsonWrapper gsonView) {
this.parser = new ParseFirstJsonValueNamed<Set<IdName>>(checkNotNull(gsonView, "gsonView"),
new TypeLiteral<Set<IdName>>() {
}, "oscategory");
}

View File

@ -23,7 +23,7 @@ public class ParseLoginResponseFromHttpResponse implements Function<HttpResponse
@Inject
ParseLoginResponseFromHttpResponse(GsonWrapper gson) {
this.parser = new ParseFirstJsonValueNamed<LoginResponse>(checkNotNull(gson, "gsonWrapper"),
this.parser = new ParseFirstJsonValueNamed<LoginResponse>(checkNotNull(gson, "gsonView"),
new TypeLiteral<LoginResponse>(){}, "loginresponse");
}

View File

@ -73,8 +73,8 @@ public class ParseNamesFromHttpResponse implements Function<HttpResponse, Set<St
}
@Inject
public ParseNamesFromHttpResponse(GsonWrapper gsonWrapper) {
this.parser = new ParseFirstJsonValueNamed<Set<Name>>(checkNotNull(gsonWrapper, "gsonWrapper"),
public ParseNamesFromHttpResponse(GsonWrapper gsonView) {
this.parser = new ParseFirstJsonValueNamed<Set<Name>>(checkNotNull(gsonView, "gsonView"),
new TypeLiteral<Set<Name>>() {
}, "hypervisor");
}

View File

@ -46,11 +46,11 @@ public class CloudStackContextImpl extends ComputeServiceContextImpl implements
private final RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext;
@Inject
public CloudStackContextImpl(@Provider Context wrapped, @Provider TypeToken<? extends Context> wrappedType,
public CloudStackContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
ComputeService computeService, Utils utils,
RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext,
RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext) {
super(wrapped, wrappedType, computeService, utils);
super(backend, backendType, computeService, utils);
this.domainContext = domainContext;
this.globalContext = globalContext;
}

View File

@ -157,7 +157,7 @@ public class CloudStackComputeServiceAdapterLiveTest extends BaseCloudStackClien
public void testCreateNodeWithGroupEncodedIntoName() throws InterruptedException {
String group = prefix + "-foo";
String name = group + "-node-" + new Random().nextInt();
Template template = wrapper.getComputeService().templateBuilder().build();
Template template = view.getComputeService().templateBuilder().build();
if (!client
.getTemplateClient()

View File

@ -90,9 +90,9 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
Network network = null;
Set<? extends NodeMetadata> nodes = null;
try {
assert wrapper.getComputeService().listAssignableLocations().size() > 0;
assert view.getComputeService().listAssignableLocations().size() > 0;
Template template = wrapper.getComputeService().templateBuilder().build();
Template template = view.getComputeService().templateBuilder().build();
// get the zone we are launching into
long zoneId = Long.parseLong(template.getLocation().getId());
@ -115,7 +115,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
template.getOptions().as(CloudStackTemplateOptions.class).networkId(network.getId());
// launch the VM
nodes = wrapper.getComputeService().createNodesInGroup(group, 1, template);
nodes = view.getComputeService().createNodesInGroup(group, 1, template);
assert nodes.size() > 0;
@ -124,7 +124,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
nodes = newTreeSet(concat(e.getSuccessfulNodes(), e.getNodeErrors().keySet()));
} finally {
if (nodes != null)
wrapper.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
if (network != null)
domainAdminContext.getApi().getNetworkClient().deleteNetwork(network.getId());
}
@ -143,14 +143,14 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
SshKeyPair keyPair = client.getSSHKeyPairClient().createSSHKeyPair(keyPairName);
String group = prefix + "-windows-test";
Template template = wrapper.getComputeService().templateBuilder()
Template template = view.getComputeService().templateBuilder()
.imageId("290").locationId("1")
.options(new CloudStackTemplateOptions().setupStaticNat(false).keyPair(keyPairName))
.build();
NodeMetadata node = null;
try {
node = getOnlyElement(wrapper.getComputeService()
node = getOnlyElement(view.getComputeService()
.createNodesInGroup(group, 1, template));
String encryptedPassword = client.getVirtualMachineClient()
@ -165,7 +165,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
} finally {
if (node != null) {
wrapper.getComputeService().destroyNode(node.getId());
view.getComputeService().destroyNode(node.getId());
}
}

View File

@ -85,7 +85,7 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
}
@Override
protected TypeToken<CloudStackContext> wrapperType() {
protected TypeToken<CloudStackContext> viewType() {
return TypeToken.of(CloudStackContext.class);
}
@ -199,14 +199,14 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
@Override
public void setupContext() {
super.setupContext();
computeClient = wrapper.getComputeService();
cloudStackContext = wrapper.unwrap();
computeClient = view.getComputeService();
cloudStackContext = view.unwrap();
client = cloudStackContext.getApi();
user = verifyCurrentUserIsOfType(cloudStackContext, Account.Type.USER);
domainAdminEnabled = setupDomainAdminProperties() != null;
if (domainAdminEnabled) {
domainAdminComputeContext = createWrapper(setupDomainAdminProperties(), setupModules());
domainAdminComputeContext = createView(setupDomainAdminProperties(), setupModules());
domainAdminContext = domainAdminComputeContext.getDomainContext();
domainAdminClient = domainAdminContext.getApi();
domainAdminUser = verifyCurrentUserIsOfType(domainAdminContext, Account.Type.DOMAIN_ADMIN);
@ -215,7 +215,7 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
globalAdminEnabled = setupGlobalAdminProperties() != null;
if (globalAdminEnabled) {
globalAdminComputeContext = createWrapper(setupGlobalAdminProperties(), setupModules());
globalAdminComputeContext = createView(setupGlobalAdminProperties(), setupModules());
globalAdminContext = globalAdminComputeContext.getGlobalContext();
globalAdminClient = globalAdminContext.getApi();
globalAdminUser = verifyCurrentUserIsOfType(globalAdminContext, Account.Type.ADMIN);

View File

@ -84,7 +84,7 @@ public class GlobalUserClientLiveTest extends BaseCloudStackClientLiveTest {
}
private void checkAuthAsUser(ApiKeyPair keyPair) {
ComputeServiceContext context = createWrapper(credentialsAsProperties(keyPair), setupModules());
ComputeServiceContext context = createView(credentialsAsProperties(keyPair), setupModules());
CloudStackClient client = context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi();
Set<Account> accounts = client.getAccountClient().listAccounts();

View File

@ -18,7 +18,7 @@
*/
package org.jclouds.cloudwatch;
import org.jclouds.Wrapper;
import org.jclouds.View;
import org.jclouds.rest.internal.BaseRestApiMetadataTest;
import org.testng.annotations.Test;
@ -34,6 +34,6 @@ public class CloudWatchApiMetadataTest extends BaseRestApiMetadataTest {
// no monitoring abstraction, yet
public CloudWatchApiMetadataTest() {
super(new CloudWatchApiMetadata(), ImmutableSet.<TypeToken<? extends Wrapper>> of());
super(new CloudWatchApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of());
}
}

View File

@ -75,7 +75,7 @@ public class DeltacloudApiMetadata extends BaseRestApiMetadata {
.version("0.3.0")
.defaultEndpoint("http://localhost:3001/api")
.defaultProperties(DeltacloudApiMetadata.defaultProperties())
.wrapper(TypeToken.of(ComputeServiceContext.class))
.view(TypeToken.of(ComputeServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(DeltacloudRestClientModule.class, DeltacloudComputeServiceContextModule.class));
}

View File

@ -71,7 +71,7 @@ public class ReadOnlyDeltacloudClientLiveTest extends BaseComputeServiceContextL
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.unwrap(DeltacloudApiMetadata.CONTEXT_TOKEN).getApi();
client = view.unwrap(DeltacloudApiMetadata.CONTEXT_TOKEN).getApi();
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 180, 1, TimeUnit.SECONDS);
stateChanges = ImmutableMap.<Instance.State, Predicate<Instance>> of(//
Instance.State.RUNNING, new RetryablePredicate<Instance>(new InstanceRunning(client), 600, 1,

View File

@ -70,7 +70,7 @@ public class DeltacloudTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.wrapper.getComputeService().templateBuilder().build();
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);

View File

@ -104,7 +104,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
.version(EC2AsyncClient.VERSION)
.defaultProperties(EC2ApiMetadata.defaultProperties())
.context(CONTEXT_TOKEN)
.wrapper(EC2ComputeServiceContext.class)
.view(EC2ComputeServiceContext.class)
.defaultModules(ImmutableSet.<Class<? extends Module>>of(EC2RestClientModule.class, EC2ResolveImagesModule.class, EC2ComputeServiceContextModule.class));
}

View File

@ -36,9 +36,9 @@ import com.google.common.reflect.TypeToken;
@Singleton
public class EC2ComputeServiceContextImpl extends ComputeServiceContextImpl implements EC2ComputeServiceContext {
@Inject
public EC2ComputeServiceContextImpl(@Provider Context wrapped, @Provider TypeToken<? extends Context> wrappedType,
public EC2ComputeServiceContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
EC2ComputeService computeService, Utils utils) {
super(wrapped, wrappedType, computeService, utils);
super(backend, backendType, computeService, utils);
}
@Override

View File

@ -95,7 +95,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
Injector injector = wrapper.utils().injector();
Injector injector = view.utils().injector();
client = injector.getInstance(EC2Client.class);
sshFactory = injector.getInstance(SshClient.Factory.class);
runningTester = new RetryablePredicate<RunningInstance>(new InstanceStateRunning(client), 180, 5,

View File

@ -126,7 +126,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
Injector injector = wrapper.utils().injector();
Injector injector = view.utils().injector();
client = injector.getInstance(EC2Client.class);
sshFactory = injector.getInstance(SshClient.Factory.class);
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);

View File

@ -102,13 +102,13 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Test(enabled = true, dependsOnMethods = "testCompareSizes")
public void testExtendedOptionsAndLogin() throws Exception {
SecurityGroupClient securityGroupClient = EC2Client.class.cast(wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
SecurityGroupClient securityGroupClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
.getSecurityGroupServices();
KeyPairClient keyPairClient = EC2Client.class.cast(wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
KeyPairClient keyPairClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
.getKeyPairServices();
InstanceClient instanceClient = EC2Client.class.cast(wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
InstanceClient instanceClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
.getInstanceServices();
String group = this.group + "o";
@ -181,7 +181,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
Properties overrides = setupProperties();
overrides.setProperty(EC2Constants.PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS, "true");
context = createWrapper(overrides, setupModules());
context = createView(overrides, setupModules());
// create a node
Set<? extends NodeMetadata> nodes =
@ -233,19 +233,19 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Test(enabled = true)
public void testMapEBS() throws Exception {
InstanceClient instanceClient = EC2Client.class.cast(wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
InstanceClient instanceClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
.getInstanceServices();
ElasticBlockStoreClient ebsClient = EC2Client.class.cast(wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
ElasticBlockStoreClient ebsClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
.getElasticBlockStoreServices();
String group = this.group + "e";
int volumeSize = 8;
final Template template = wrapper.getComputeService().templateBuilder().hardwareId(InstanceType.M1_SMALL)
final Template template = view.getComputeService().templateBuilder().hardwareId(InstanceType.M1_SMALL)
.osFamily(OsFamily.UBUNTU).osVersionMatches("10.04").imageDescriptionMatches(".*ebs.*").build();
Location zone = Iterables.find(wrapper.getComputeService().listAssignableLocations(), new Predicate<Location>() {
Location zone = Iterables.find(view.getComputeService().listAssignableLocations(), new Predicate<Location>() {
@Override
public boolean apply(Location arg0) {

View File

@ -50,7 +50,7 @@ public abstract class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLive
@Test
public void testTemplateBuilderCanUseImageIdWithoutFetchingAllImages() throws Exception {
Template defaultTemplate = wrapper.getComputeService().templateBuilder().build();
Template defaultTemplate = view.getComputeService().templateBuilder().build();
String defaultImageId = defaultTemplate.getImage().getId();
String defaultImageProviderId = defaultTemplate.getImage().getProviderId();
@ -58,7 +58,7 @@ public abstract class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLive
try {
// Track http commands
final List<HttpCommand> commandsInvoked = Lists.newArrayList();
context = createWrapper(
context = createView(
setupProperties(),
ImmutableSet.<Module> of(new Log4JLoggingModule(),
TrackingJavaUrlHttpCommandExecutorService.newTrackingModule(commandsInvoked)));

View File

@ -39,18 +39,18 @@ public class TestCanRecreateGroupLiveTest extends BaseComputeServiceContextLiveT
public void testCanRecreateGroup() throws Exception {
String tag = PREFIX + "recreate";
wrapper.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
try {
Template template = wrapper.getComputeService().templateBuilder().build();
wrapper.getComputeService().createNodesInGroup(tag, 1, template);
wrapper.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
wrapper.getComputeService().createNodesInGroup(tag, 1, template);
Template template = view.getComputeService().templateBuilder().build();
view.getComputeService().createNodesInGroup(tag, 1, template);
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
view.getComputeService().createNodesInGroup(tag, 1, template);
} catch (RunNodesException e) {
System.err.println(e.getNodeErrors().keySet());
Throwables.propagate(e);
} finally {
wrapper.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
}
}

View File

@ -56,7 +56,7 @@ public class AvailabilityZoneAndRegionClientLiveTest extends BaseComputeServiceC
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices();
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices();
}
public void testDescribeAvailabilityZones() {

View File

@ -61,12 +61,12 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticBlockStoreServices();
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticBlockStoreServices();
}
@Test
void testDescribeVolumes() {
for (String region : wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices().describeRegions().keySet()) {
for (String region : view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices().describeRegions().keySet()) {
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
assertNotNull(allResults);
if (allResults.size() >= 1) {

View File

@ -50,7 +50,7 @@ public class ElasticIPAddressClientLiveTest extends BaseComputeServiceContextLiv
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticIPAddressServices();
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticIPAddressServices();
}
@Test

View File

@ -49,7 +49,7 @@ public class InstanceClientLiveTest extends BaseComputeServiceContextLiveTest {
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getInstanceServices();
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getInstanceServices();
}
@Test

View File

@ -51,7 +51,7 @@ public class KeyPairClientLiveTest extends BaseComputeServiceContextLiveTest {
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getKeyPairServices();
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getKeyPairServices();
}
@Test

View File

@ -60,7 +60,7 @@ public class SecurityGroupClientLiveTest extends BaseComputeServiceContextLiveTe
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getSecurityGroupServices();
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getSecurityGroupServices();
}
@Test
@ -281,6 +281,6 @@ public class SecurityGroupClientLiveTest extends BaseComputeServiceContextLiveTe
@AfterTest
public void shutdown() {
wrapper.close();
view.close();
}
}

View File

@ -76,8 +76,8 @@ public class WindowsClientLiveTest extends BaseComputeServiceContextLiveTest {
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getWindowsServices();
computeService = wrapper.getComputeService();
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getWindowsServices();
computeService = view.getComputeService();
}
@ -141,7 +141,7 @@ public class WindowsClientLiveTest extends BaseComputeServiceContextLiveTest {
node.getCredentials().getPrivateKey());
// And apply it to the decryption function
WindowsLoginCredentialsFromEncryptedData f = wrapper.getUtils().getInjector().getInstance(WindowsLoginCredentialsFromEncryptedData.class);
WindowsLoginCredentialsFromEncryptedData f = view.getUtils().getInjector().getInstance(WindowsLoginCredentialsFromEncryptedData.class);
LoginCredentials credentials = f.apply(dataAndKey);
assertEquals(credentials.getUser(), "Administrator");

View File

@ -85,7 +85,7 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata {
.version("1.0")
.defaultEndpoint("https://api.lon-p.elastichosts.com")
.defaultProperties(ElasticStackApiMetadata.defaultProperties())
.wrapper(TypeToken.of(ComputeServiceContext.class))
.view(TypeToken.of(ComputeServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(ElasticStackRestClientModule.class, ElasticStackComputeServiceContextModule.class));
}

View File

@ -88,7 +88,7 @@ public class ElasticStackClientLiveTest
@Override
public void setupContext() {
super.setupContext();
cloudStackContext = wrapper.unwrap();
cloudStackContext = view.unwrap();
client = cloudStackContext.getApi();
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
@ -97,7 +97,7 @@ public class ElasticStackClientLiveTest
TimeUnit.SECONDS);
if (Strings.emptyToNull(imageId) == null) {
imageId = wrapper.getComputeService().templateBuilder().build().getImage().getId();
imageId = view.getComputeService().templateBuilder().build().getImage().getId();
}
}

View File

@ -63,7 +63,7 @@ public class FilesystemApiMetadata extends BaseApiMetadata {
.defaultCredential("bar")
.version("1")
.documentation(URI.create("http://www.jclouds.org/documentation/userguide/blobstore-guide"))
.wrapper(BlobStoreContext.class)
.view(BlobStoreContext.class)
.defaultModule(FilesystemBlobStoreContextModule.class);
}

View File

@ -62,14 +62,14 @@ public class FilesystemContainerIntegrationTestDisabled extends BaseContainerInt
// NOTE all metadata in jclouds comes out as lowercase, in an effort to normalize the
// providers.
Blob object = wrapper.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
Blob object = view.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
.payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).build();
String containerName = getContainerName();
try {
addBlobToContainer(containerName, object);
validateContent(containerName, key);
PageSet<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName, maxResults(1));
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1));
BlobMetadata metadata = (BlobMetadata) Iterables.getOnlyElement(container);
// transient container should be lenient and not return metadata on undetailed listing.

View File

@ -76,7 +76,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata {
.version("1.1")
.defaultEndpoint("http://localhost:5000")
.defaultProperties(NovaApiMetadata.defaultProperties())
.wrapper(TypeToken.of(ComputeServiceContext.class))
.view(TypeToken.of(ComputeServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(NovaRestClientModule.class, NovaComputeServiceContextModule.class));
}

View File

@ -62,7 +62,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides asynchronous access to OpenStack Nova via their REST API.
* <p/>
* All commands return a ListenableFuture of the result from OpenStack Nova. Any exceptions incurred
* during processing will be wrapped in an {@link ExecutionException} as documented in
* during processing will be backend in an {@link ExecutionException} as documented in
* {@link ListenableFuture#get()}.
*
* @author Adrian Cole

View File

@ -40,7 +40,7 @@ import org.jclouds.rest.ResourceNotFoundException;
* Provides access to OpenStack Nova via their REST API.
* <p/>
* All commands return a Future of the result from OpenStack Nova. Any exceptions incurred
* during processing will be wrapped in an {@link ExecutionException} as documented in
* during processing will be backend in an {@link ExecutionException} as documented in
* {@link Future#get()}.
*
* @see NovaAsyncClient

View File

@ -78,7 +78,7 @@ public class NovaClientLiveTest extends BaseComputeServiceContextLiveTest {
@Override
public void setupContext() {
super.setupContext();
Injector injector = wrapper.utils().injector();
Injector injector = view.utils().injector();
client = injector.getInstance(NovaClient.class);
sshFactory = injector.getInstance(SshClient.Factory.class);
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);

View File

@ -94,7 +94,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata {
.version("1.1")
.defaultEndpoint("http://localhost:5000")
.defaultProperties(NovaApiMetadata.defaultProperties())
.wrapper(TypeToken.of(ComputeServiceContext.class))
.view(TypeToken.of(ComputeServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(NovaRestClientModule.class, NovaComputeServiceContextModule.class));
}

View File

@ -151,8 +151,8 @@ public class NovaComputeService extends BaseComputeService {
Optional<KeyPairClient> keyPairClient = novaClient.getKeyPairExtensionForZone(zoneId);
if (keyPairClient.isPresent()) {
for (String group : groups) {
for (Map<String, KeyPair> wrapper : keyPairClient.get().listKeyPairs()) {
for (KeyPair pair : Iterables.filter(wrapper.values(),
for (Map<String, KeyPair> view : keyPairClient.get().listKeyPairs()) {
for (KeyPair pair : Iterables.filter(view.values(),
KeyPairPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName());
logger.debug(">> deleting keypair(%s)", zoneAndName);

View File

@ -55,13 +55,13 @@ public class NovaParserModule extends AbstractModule {
@Singleton
public static class HostResourceUsageAdapter implements JsonSerializer<HostResourceUsage>, JsonDeserializer<HostResourceUsage> {
public HostResourceUsage apply(HostResourceUsageWrapper in) {
public HostResourceUsage apply(HostResourceUsageView in) {
return in.resource.toBuilder().build();
}
@Override
public HostResourceUsage deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
return apply((HostResourceUsageWrapper) context.deserialize(jsonElement, HostResourceUsageWrapper.class));
return apply((HostResourceUsageView) context.deserialize(jsonElement, HostResourceUsageView.class));
}
@Override
@ -69,7 +69,7 @@ public class NovaParserModule extends AbstractModule {
return context.serialize(hostResourceUsage);
}
private static class HostResourceUsageWrapper {
private static class HostResourceUsageView {
protected HostResourceUsageInternal resource;
}
private static class HostResourceUsageInternal extends HostResourceUsage {

View File

@ -48,7 +48,7 @@ public class BaseNovaClientLiveTest extends BaseComputeServiceContextLiveTest {
@Override
public void setupContext() {
super.setupContext();
novaContext = wrapper.unwrap();
novaContext = view.unwrap();
}
@Override

View File

@ -108,7 +108,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
.version(S3AsyncClient.VERSION)
.defaultProperties(S3ApiMetadata.defaultProperties())
.context(CONTEXT_TOKEN)
.wrapper(TypeToken.of(S3BlobStoreContext.class))
.view(TypeToken.of(S3BlobStoreContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(S3RestClientModule.class, S3BlobStoreContextModule.class));
}

View File

@ -95,7 +95,7 @@ import com.google.inject.Provides;
* Provides asynchronous access to S3 via their REST API.
* <p/>
* All commands return a ListenableFuture of the result from S3. Any exceptions incurred during
* processing will be wrapped in an {@link ExecutionException} as documented in
* processing will be backend in an {@link ExecutionException} as documented in
* {@link ListenableFuture#get()}.
*
* @author Adrian Cole

View File

@ -44,7 +44,7 @@ import com.google.inject.Provides;
* Provides access to S3 via their REST API.
* <p/>
* All commands return a Future of the result from S3. Any exceptions incurred during
* processing will be wrapped in an {@link ExecutionException} as documented in
* processing will be backend in an {@link ExecutionException} as documented in
* {@link Future#get()}.
*
* @author Adrian Cole

View File

@ -44,11 +44,11 @@ import com.google.common.reflect.TypeToken;
public class S3BlobStoreContextImpl extends BlobStoreContextImpl implements S3BlobStoreContext {
@Inject
public S3BlobStoreContextImpl(@Provider Context wrapped, @Provider TypeToken<? extends Context> wrappedType,
public S3BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
BlobMap.Factory blobMapFactory, Utils utils, ConsistencyModel consistencyModel,
InputStreamMap.Factory inputStreamMapFactory, AsyncBlobStore ablobStore, BlobStore blobStore,
BlobRequestSigner blobRequestSigner) {
super(wrapped, wrappedType, blobMapFactory, utils, consistencyModel, inputStreamMapFactory, ablobStore,
super(backend, backendType, blobMapFactory, utils, consistencyModel, inputStreamMapFactory, ablobStore,
blobStore, blobRequestSigner);
}

View File

@ -68,7 +68,7 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest {
}
public S3Client getApi() {
return wrapper.unwrap(S3ApiMetadata.CONTEXT_TOKEN).getApi();
return view.unwrap(S3ApiMetadata.CONTEXT_TOKEN).getApi();
}
/**

View File

@ -71,7 +71,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
}
public S3Client getApi() {
return (S3Client) wrapper.unwrap(S3ApiMetadata.CONTEXT_TOKEN).getApi();
return (S3Client) view.unwrap(S3ApiMetadata.CONTEXT_TOKEN).getApi();
}
/**

View File

@ -83,7 +83,7 @@ public class SwiftApiMetadata extends BaseRestApiMetadata {
.documentation(URI.create("http://api.openstack.org/"))
.version(OpenStackAuthAsyncClient.VERSION)
.defaultProperties(SwiftApiMetadata.defaultProperties())
.wrapper(TypeToken.of(BlobStoreContext.class))
.view(TypeToken.of(BlobStoreContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(SwiftRestClientModule.class, SwiftBlobStoreContextModule.class));
}

View File

@ -33,7 +33,7 @@ public class SwiftClientLiveTest extends CommonSwiftClientLiveTest<SwiftClient>
@Override
public SwiftClient getApi() {
return wrapper.unwrap(SwiftApiMetadata.CONTEXT_TOKEN).getApi();
return view.unwrap(SwiftApiMetadata.CONTEXT_TOKEN).getApi();
}
}

View File

@ -89,7 +89,7 @@ public class SwiftBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
String containerName = getContainerName();
try {
BlobStore blobStore = wrapper.getBlobStore();
BlobStore blobStore = view.getBlobStore();
blobStore.createContainerInLocation(null, containerName);
Blob blob = blobStore.blobBuilder("const.txt")
.payload(new File("target/const.txt")).contentMD5(oneHundredOneConstitutionsMD5).build();

View File

@ -96,7 +96,7 @@ public class VCloudApiMetadata extends BaseRestApiMetadata {
.documentation(URI.create("http://www.vmware.com/support/pubs/vcd_pubs.html"))
.version("1.0")
.defaultProperties(VCloudApiMetadata.defaultProperties())
.wrapper(TypeToken.of(ComputeServiceContext.class))
.view(TypeToken.of(ComputeServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(VCloudRestClientModule.class, VCloudComputeServiceContextModule.class));
}

View File

@ -49,7 +49,7 @@ public class CatalogClientLiveTest extends BaseVCloudClientLiveTest {
public void testFindCatalogIsWriteableIfNotVersion1_5() throws Exception {
// when we are in vCloud 1.0.0 public catalogs don't work, so our default
// catalog is private
if (!wrapper.utils().injector().getInstance(Key.get(String.class, ApiVersion.class)).startsWith("1.5"))
if (!view.utils().injector().getInstance(Key.get(String.class, ApiVersion.class)).startsWith("1.5"))
assertTrue(getVCloudApi().getCatalogClient().findCatalogInOrgNamed(null, null).isReadOnly());
}
}

View File

@ -45,14 +45,14 @@ public abstract class BaseVCloudClientLiveTest extends BaseComputeServiceContext
}
protected VCloudClient getVCloudApi() {
return VCloudClient.class.cast(wrapper.unwrap(VCloudApiMetadata.CONTEXT_TOKEN).getApi());
return VCloudClient.class.cast(view.unwrap(VCloudApiMetadata.CONTEXT_TOKEN).getApi());
}
@Override
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
client = wrapper.getComputeService();
client = view.getComputeService();
}
@Override

View File

@ -20,7 +20,7 @@ package org.jclouds.blobstore;
import java.io.Closeable;
import org.jclouds.Wrapper;
import org.jclouds.View;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.internal.BlobStoreContextImpl;
import org.jclouds.blobstore.options.ListContainerOptions;
@ -37,7 +37,7 @@ import com.google.inject.ImplementedBy;
*
*/
@ImplementedBy(BlobStoreContextImpl.class)
public interface BlobStoreContext extends Closeable, Wrapper {
public interface BlobStoreContext extends Closeable, View {
/**
*
* Generates signed requests for blobs. useful in other tools such as backup utilities.
@ -119,8 +119,8 @@ public interface BlobStoreContext extends Closeable, Wrapper {
/**
* will be removed in jclouds 1.6
*
* @see Wrapper#getInputType
* @see Wrapper#unwrap
* @see View#getInputType
* @see View#unwrap
*/
@Deprecated
<S, A> RestContext<S, A> getProviderSpecificContext();

View File

@ -61,7 +61,7 @@ public class TransientApiMetadata extends BaseApiMetadata {
.defaultIdentity(System.getProperty("user.name"))
.defaultCredential("bar")
.version("1")
.wrapper(BlobStoreContext.class)
.view(BlobStoreContext.class)
.defaultModule(TransientBlobStoreContextModule.class)
.documentation(URI.create("http://www.jclouds.org/documentation/userguide/blobstore-guide"));
}

View File

@ -32,7 +32,7 @@ import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.internal.BaseWrapper;
import org.jclouds.internal.BaseView;
import org.jclouds.location.Provider;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.Utils;
@ -44,7 +44,7 @@ import com.google.common.reflect.TypeToken;
* @author Adrian Cole
*/
@Singleton
public class BlobStoreContextImpl extends BaseWrapper implements BlobStoreContext {
public class BlobStoreContextImpl extends BaseView implements BlobStoreContext {
private final BlobMap.Factory blobMapFactory;
private final InputStreamMap.Factory inputStreamMapFactory;
private final AsyncBlobStore ablobStore;
@ -54,11 +54,11 @@ public class BlobStoreContextImpl extends BaseWrapper implements BlobStoreContex
private final BlobRequestSigner blobRequestSigner;
@Inject
public BlobStoreContextImpl(@Provider Context wrapped, @Provider TypeToken<? extends Context> wrappedType,
public BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
BlobMap.Factory blobMapFactory, Utils utils, ConsistencyModel consistencyModel,
InputStreamMap.Factory inputStreamMapFactory, AsyncBlobStore ablobStore, BlobStore blobStore,
BlobRequestSigner blobRequestSigner) {
super(wrapped, wrappedType);
super(backend, backendType);
this.consistencyModel = checkNotNull(consistencyModel, "consistencyModel");
this.blobMapFactory = checkNotNull(blobMapFactory, "blobMapFactory");
this.inputStreamMapFactory = checkNotNull(inputStreamMapFactory, "inputStreamMapFactory");

View File

@ -53,7 +53,7 @@ public class TransientContainerIntegrationTest extends BaseContainerIntegrationT
String key = "hello";
// NOTE all metadata in jclouds comes out as lowercase, in an effort to normalize the
// providers.
Blob blob = wrapper.getBlobStore().blobBuilder("hello").userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
Blob blob = view.getBlobStore().blobBuilder("hello").userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
.payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).build();
String containerName = getContainerName();
@ -61,7 +61,7 @@ public class TransientContainerIntegrationTest extends BaseContainerIntegrationT
addBlobToContainer(containerName, blob);
validateContent(containerName, key);
PageSet<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName, maxResults(1));
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1));
BlobMetadata metadata = (BlobMetadata) getOnlyElement(container);
// transient container should be lenient and not return metadata on undetailed listing.
@ -75,7 +75,7 @@ public class TransientContainerIntegrationTest extends BaseContainerIntegrationT
@Test(groups = { "integration", "live" })
public void testDuplicateCreateContainer() {
BlobStore blobStore = wrapper.getBlobStore();
BlobStore blobStore = view.getBlobStore();
Location location = null;
String container = "container";
boolean created;

View File

@ -141,15 +141,15 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
@Override
public Void call() throws Exception {
String name = blobCount.incrementAndGet() + "";
Blob blob = wrapper.getBlobStore().blobBuilder(name).payload(testPayload).build();
wrapper.getBlobStore().putBlob(container, blob);
Blob blob = view.getBlobStore().blobBuilder(name).payload(testPayload).build();
view.getBlobStore().putBlob(container, blob);
assertConsistencyAwareBlobExists(container, name);
blob = wrapper.getBlobStore().getBlob(container, name);
blob = view.getBlobStore().getBlob(container, name);
assert Arrays.equals(CryptoStreams.md5(blob.getPayload()), md5) : String.format(
"md5 didn't match on %s/%s", container, name);
wrapper.getBlobStore().removeBlob(container, name);
view.getBlobStore().removeBlob(container, name);
assertConsistencyAwareBlobDoesntExist(container, name);
return null;
}
@ -176,7 +176,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
Map<Integer, Future<?>> responses = Maps.newHashMap();
for (int i = 0; i < 10; i++) {
responses.put(i, Futures.compose(wrapper.getAsyncBlobStore().getBlob(container, name),
responses.put(i, Futures.compose(view.getAsyncBlobStore().getBlob(container, name),
new Function<Blob, Void>() {
@Override
@ -204,9 +204,9 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
}
private void uploadConstitution(String container, String name, String contentDisposition) throws IOException {
wrapper.getBlobStore().putBlob(
view.getBlobStore().putBlob(
container,
wrapper.getBlobStore().blobBuilder(name).payload(oneHundredOneConstitutions.getInput()).contentType(
view.getBlobStore().blobBuilder(name).payload(oneHundredOneConstitutions.getInput()).contentType(
"text/plain").contentMD5(oneHundredOneConstitutionsMD5).contentLength(
oneHundredOneConstitutionsLength).contentDisposition(contentDisposition).build());
}
@ -224,11 +224,11 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
addObjectAndValidateContent(container, name);
Date after = new Date(System.currentTimeMillis() + 1000);
wrapper.getBlobStore().getBlob(container, name, ifModifiedSince(before));
view.getBlobStore().getBlob(container, name, ifModifiedSince(before));
validateContent(container, name);
try {
wrapper.getBlobStore().getBlob(container, name, ifModifiedSince(after));
view.getBlobStore().getBlob(container, name, ifModifiedSince(after));
validateContent(container, name);
} catch (HttpResponseException ex) {
assertEquals(ex.getResponse().getStatusCode(), 304);
@ -250,11 +250,11 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
addObjectAndValidateContent(container, name);
Date after = new Date(System.currentTimeMillis() + 1000);
wrapper.getBlobStore().getBlob(container, name, ifUnmodifiedSince(after));
view.getBlobStore().getBlob(container, name, ifUnmodifiedSince(after));
validateContent(container, name);
try {
wrapper.getBlobStore().getBlob(container, name, ifUnmodifiedSince(before));
view.getBlobStore().getBlob(container, name, ifUnmodifiedSince(before));
validateContent(container, name);
} catch (HttpResponseException ex) {
assertEquals(ex.getResponse().getStatusCode(), 412);
@ -273,11 +273,11 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String goodETag = addObjectAndValidateContent(container, name);
wrapper.getBlobStore().getBlob(container, name, ifETagMatches(goodETag));
view.getBlobStore().getBlob(container, name, ifETagMatches(goodETag));
validateContent(container, name);
try {
wrapper.getBlobStore().getBlob(container, name, ifETagMatches("powerfrisbee"));
view.getBlobStore().getBlob(container, name, ifETagMatches("powerfrisbee"));
validateContent(container, name);
} catch (HttpResponseException ex) {
assertEquals(ex.getResponse().getStatusCode(), 412);
@ -296,11 +296,11 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String goodETag = addObjectAndValidateContent(container, name);
wrapper.getBlobStore().getBlob(container, name, ifETagDoesntMatch("powerfrisbee"));
view.getBlobStore().getBlob(container, name, ifETagDoesntMatch("powerfrisbee"));
validateContent(container, name);
try {
wrapper.getBlobStore().getBlob(container, name, ifETagDoesntMatch(goodETag));
view.getBlobStore().getBlob(container, name, ifETagDoesntMatch(goodETag));
} catch (HttpResponseException ex) {
assertEquals(ex.getResponse().getStatusCode(), 304);
}
@ -317,11 +317,11 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String name = "apples";
addObjectAndValidateContent(container, name);
Blob blob1 = wrapper.getBlobStore().getBlob(container, name, range(0, 5));
Blob blob1 = view.getBlobStore().getBlob(container, name, range(0, 5));
validateMetadata(blob1.getMetadata(), container, name);
assertEquals(getContentAsStringOrNullAndClose(blob1), TEST_STRING.substring(0, 6));
Blob blob2 = wrapper.getBlobStore().getBlob(container, name, range(6, TEST_STRING.length()));
Blob blob2 = view.getBlobStore().getBlob(container, name, range(6, TEST_STRING.length()));
validateMetadata(blob2.getMetadata(), container, name);
assertEquals(getContentAsStringOrNullAndClose(blob2), TEST_STRING.substring(6, TEST_STRING.length()));
} finally {
@ -337,7 +337,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String name = "apples";
addObjectAndValidateContent(container, name);
Blob blob = wrapper.getBlobStore().getBlob(container, name, range(0, 5).range(6, TEST_STRING.length()));
Blob blob = view.getBlobStore().getBlob(container, name, range(0, 5).range(6, TEST_STRING.length()));
validateMetadata(blob.getMetadata(), container, name);
assertEquals(getContentAsStringOrNullAndClose(blob), TEST_STRING);
} finally {
@ -401,7 +401,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String container = getContainerName();
String name = "test";
try {
wrapper.getBlobStore().removeBlob(container, name);
view.getBlobStore().removeBlob(container, name);
} finally {
returnContainer(container);
}
@ -412,7 +412,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String container = getContainerName();
String name = "test";
try {
assert !wrapper.getBlobStore().blobExists(container, name);
assert !view.getBlobStore().blobExists(container, name);
} finally {
returnContainer(container);
}
@ -429,7 +429,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String container = getContainerName();
try {
addBlobToContainer(container, name, name, MediaType.TEXT_PLAIN);
wrapper.getBlobStore().removeBlob(container, name);
view.getBlobStore().removeBlob(container, name);
assertContainerEmptyDeleting(container, name);
} finally {
returnContainer(container);
@ -437,7 +437,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
}
private void assertContainerEmptyDeleting(String container, String name) {
Iterable<? extends StorageMetadata> listing = Iterables.filter(wrapper.getBlobStore().list(container),
Iterable<? extends StorageMetadata> listing = Iterables.filter(view.getBlobStore().list(container),
new Predicate<StorageMetadata>() {
@Override
@ -454,7 +454,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
@Test(groups = { "integration", "live" })
public void deleteObjectNoContainer() {
try {
wrapper.getBlobStore().removeBlob("donb", "test");
view.getBlobStore().removeBlob("donb", "test");
} catch (HttpResponseException e) {
assertEquals(e.getResponse().getStatusCode(), 404);
} catch (ContainerNotFoundException e) {
@ -475,7 +475,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
@Test(groups = { "integration", "live" }, dataProvider = "putTests")
public void testPutObject(String name, String type, Object content, Object realObject) throws InterruptedException,
IOException {
PayloadBlobBuilder blobBuilder = wrapper.getBlobStore().blobBuilder(name).payload(Payloads.newPayload(content))
PayloadBlobBuilder blobBuilder = view.getBlobStore().blobBuilder(name).payload(Payloads.newPayload(content))
.contentType(type);
addContentMetadata(blobBuilder);
if (content instanceof InputStream) {
@ -484,14 +484,14 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
Blob blob = blobBuilder.build();
String container = getContainerName();
try {
assertNotNull(wrapper.getBlobStore().putBlob(container, blob));
blob = wrapper.getBlobStore().getBlob(container, blob.getMetadata().getName());
assertNotNull(view.getBlobStore().putBlob(container, blob));
blob = view.getBlobStore().getBlob(container, blob.getMetadata().getName());
validateMetadata(blob.getMetadata(), container, name);
checkContentMetadata(blob);
String returnedString = getContentAsStringOrNullAndClose(blob);
assertEquals(returnedString, realObject);
PageSet<? extends StorageMetadata> set = wrapper.getBlobStore().list(container);
PageSet<? extends StorageMetadata> set = view.getBlobStore().list(container);
assert set.size() == 1 : set;
} finally {
returnContainer(container);
@ -500,7 +500,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
@Test(groups = { "integration", "live" })
public void testPutObjectStream() throws InterruptedException, IOException, ExecutionException {
PayloadBlobBuilder blobBuilder = wrapper.getBlobStore().blobBuilder("streaming").payload(
PayloadBlobBuilder blobBuilder = view.getBlobStore().blobBuilder("streaming").payload(
new StreamingPayload(new WriteTo() {
@Override
public void writeTo(OutputStream outstream) throws IOException {
@ -514,14 +514,14 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String container = getContainerName();
try {
assertNotNull(wrapper.getBlobStore().putBlob(container, blob));
assertNotNull(view.getBlobStore().putBlob(container, blob));
blob = wrapper.getBlobStore().getBlob(container, blob.getMetadata().getName());
blob = view.getBlobStore().getBlob(container, blob.getMetadata().getName());
String returnedString = getContentAsStringOrNullAndClose(blob);
assertEquals(returnedString, "foo");
validateMetadata(blob.getMetadata(), container, blob.getMetadata().getName());
checkContentMetadata(blob);
PageSet<? extends StorageMetadata> set = wrapper.getBlobStore().list(container);
PageSet<? extends StorageMetadata> set = view.getBlobStore().list(container);
assert set.size() == 1 : set;
} finally {
returnContainer(container);
@ -588,11 +588,11 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
// NOTE all metadata in jclouds comes out as lowercase, in an effort to
// normalize the
// providers.
Blob blob = wrapper.getBlobStore().blobBuilder(name).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
Blob blob = view.getBlobStore().blobBuilder(name).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
.payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).calculateMD5().build();
String container = getContainerName();
try {
assertNull(wrapper.getBlobStore().blobMetadata(container, "powderpuff"));
assertNull(view.getBlobStore().blobMetadata(container, "powderpuff"));
addBlobToContainer(container, blob);
Blob newObject = validateContent(container, name);
@ -601,7 +601,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
validateMetadata(metadata);
validateMetadata(metadata, container, name);
validateMetadata(wrapper.getBlobStore().blobMetadata(container, name));
validateMetadata(view.getBlobStore().blobMetadata(container, name));
// write 2 items with the same name to ensure that provider doesn't
// accept dupes
@ -609,7 +609,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
blob.getMetadata().getUserMetadata().put("Adrian", "powderpuff");
addBlobToContainer(container, blob);
validateMetadata(wrapper.getBlobStore().blobMetadata(container, name));
validateMetadata(view.getBlobStore().blobMetadata(container, name));
} finally {
returnContainer(container);

View File

@ -51,18 +51,18 @@ public class BaseBlobLiveTest extends BaseBlobStoreIntegrationTest {
httpStreamMD5 = checkNotNull(httpStreamMD5 != null ? httpStreamMD5 : sysHttpStreamMD5, "httpStreamMd5");
HttpResponse response = wrapper.utils().http().invoke(
HttpResponse response = view.utils().http().invoke(
HttpRequest.builder().method("GET").endpoint(URI.create(httpStreamUrl)).build());
long length = response.getPayload().getContentMetadata().getContentLength();
String name = "hello";
byte[] md5 = CryptoStreams.hex(httpStreamMD5);
Blob blob = wrapper.getBlobStore().blobBuilder(name).payload(response.getPayload()).contentLength(length)
Blob blob = view.getBlobStore().blobBuilder(name).payload(response.getPayload()).contentLength(length)
.contentMD5(md5).build();
String container = getContainerName();
try {
wrapper.getBlobStore().putBlob(container, blob);
view.getBlobStore().putBlob(container, blob);
checkMD5(container, name, md5);
} finally {
returnContainer(container);
@ -70,7 +70,7 @@ public class BaseBlobLiveTest extends BaseBlobStoreIntegrationTest {
}
protected void checkMD5(String container, String name, byte[] md5) {
assertEquals(wrapper.getBlobStore().blobMetadata(container, name).getContentMetadata().getContentMD5(), md5);
assertEquals(view.getBlobStore().blobMetadata(container, name).getContentMetadata().getContentMD5(), md5);
}
}

View File

@ -73,7 +73,7 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
public void testValues() throws IOException, InterruptedException {
String bucketName = getContainerName();
try {
BlobMap map = createMap(wrapper, bucketName);
BlobMap map = createMap(view, bucketName);
putFiveStrings(map);
putFiveStringsUnderPath(map);
@ -95,7 +95,7 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
public void testRemove() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String bucketName = getContainerName();
try {
Map<String, Blob> map = createMap(wrapper, bucketName);
Map<String, Blob> map = createMap(view, bucketName);
putStringWithMD5(map, "one", "two");
assertConsistencyAwareContentEquals(map, "one", "two");
// TODO track how often this occurs and potentially update map implementation
@ -126,7 +126,7 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
public void testEntrySet() throws IOException, InterruptedException {
String bucketName = getContainerName();
try {
final BlobMap map = createMap(wrapper, bucketName);
final BlobMap map = createMap(view, bucketName);
putFiveStrings(map);
assertConsistencyAwareMapSize(map, 5);
Set<Entry<String, Blob>> entries = map.entrySet();
@ -159,9 +159,9 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
public void testContains() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String bucketName = getContainerName();
try {
Map<String, Blob> map = createMap(wrapper, bucketName);
Map<String, Blob> map = createMap(view, bucketName);
putStringWithMD5(map, "one", "apple");
Blob blob = wrapper.getBlobStore().blobBuilder("one").payload("apple").calculateMD5().build();
Blob blob = view.getBlobStore().blobBuilder("one").payload("apple").calculateMD5().build();
assertConsistencyAwareContainsValue(map, blob);
} finally {
returnContainer(bucketName);
@ -185,8 +185,8 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
public void testPut() throws IOException, InterruptedException {
String bucketName = getContainerName();
try {
Map<String, Blob> map = createMap(wrapper, bucketName);
Blob blob = wrapper.getBlobStore().blobBuilder("one").payload(Strings2.toInputStream("apple")).calculateMD5()
Map<String, Blob> map = createMap(view, bucketName);
Blob blob = view.getBlobStore().blobBuilder("one").payload(Strings2.toInputStream("apple")).calculateMD5()
.build();
Blob old = map.put(blob.getMetadata().getName(), blob);
getOneReturnsAppleAndOldValueIsNull(map, old);
@ -203,12 +203,12 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
public void testPutAll() throws InterruptedException, ExecutionException, TimeoutException {
String bucketName = getContainerName();
try {
Map<String, Blob> map = createMap(wrapper, bucketName);
Map<String, Blob> map = createMap(view, bucketName);
ImmutableMap.Builder<String, Blob> newMap = ImmutableMap.builder();
for (String key : fiveInputs.keySet()) {
newMap.put(
key,
wrapper.getBlobStore().blobBuilder(key).payload(fiveInputs.get(key))
view.getBlobStore().blobBuilder(key).payload(fiveInputs.get(key))
.contentLength((long) fiveBytes.get(key).length).build());
}
map.putAll(newMap.build());
@ -226,7 +226,7 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
return;
String bucketName = getContainerName();
try {
BlobMap map = createMap(wrapper, bucketName);
BlobMap map = createMap(view, bucketName);
Builder<String> keySet = ImmutableSet.builder();
for (int i = 0; i < maxResultsForTestListings() + 1; i++) {
keySet.add(i + "");
@ -250,7 +250,7 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
@Override
protected void putStringWithMD5(Map<String, Blob> map, String key, String text) throws IOException {
map.put(key, wrapper.getBlobStore().blobBuilder(key).payload(text).calculateMD5().build());
map.put(key, view.getBlobStore().blobBuilder(key).payload(text).calculateMD5().build());
}
protected void putFiveStrings(BlobMap map) {
@ -277,7 +277,7 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
@Override
protected void addTenObjectsUnderPrefix(String containerName, String prefix) throws InterruptedException {
BlobMap blobMap = createMap(wrapper, containerName, inDirectory(prefix));
BlobMap blobMap = createMap(view, containerName, inDirectory(prefix));
for (int i = 0; i < 10; i++) {
blobMap.put(i + "", blobMap.blobBuilder().payload(i + "content").build());
}
@ -285,7 +285,7 @@ public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<
@Override
protected void addTenObjectsUnderRoot(String containerName) throws InterruptedException {
BlobMap blobMap = createMap(wrapper, containerName, ListContainerOptions.NONE);
BlobMap blobMap = createMap(view, containerName, ListContainerOptions.NONE);
for (int i = 0; i < 10; i++) {
blobMap.put(i + "", blobMap.blobBuilder().payload(i + "content").build());
}

View File

@ -41,15 +41,15 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
String name = "hello";
String text = "fooooooooooooooooooooooo";
Blob blob = wrapper.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
String container = getContainerName();
try {
wrapper.getBlobStore().putBlob(container, blob);
view.getBlobStore().putBlob(container, blob);
assertConsistencyAwareContainerSize(container, 1);
HttpRequest request = wrapper.getSigner().signRemoveBlob(container, name);
HttpRequest request = view.getSigner().signRemoveBlob(container, name);
assertEquals(request.getFilters().size(), 0);
wrapper.utils().http().invoke(request);
assert !wrapper.getBlobStore().blobExists(container, name);
view.utils().http().invoke(request);
assert !view.getBlobStore().blobExists(container, name);
} finally {
returnContainer(container);
}
@ -60,14 +60,14 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
String name = "hello";
String text = "fooooooooooooooooooooooo";
Blob blob = wrapper.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
String container = getContainerName();
try {
wrapper.getBlobStore().putBlob(container, blob);
view.getBlobStore().putBlob(container, blob);
assertConsistencyAwareContainerSize(container, 1);
HttpRequest request = wrapper.getSigner().signGetBlob(container, name);
HttpRequest request = view.getSigner().signGetBlob(container, name);
assertEquals(request.getFilters().size(), 0);
assertEquals(Strings2.toStringAndClose(wrapper.utils().http().invoke(request).getPayload().getInput()), text);
assertEquals(Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().getInput()), text);
} finally {
returnContainer(container);
}
@ -78,14 +78,14 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
String name = "hello";
String text = "fooooooooooooooooooooooo";
Blob blob = wrapper.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
String container = getContainerName();
try {
wrapper.getBlobStore().putBlob(container, blob);
view.getBlobStore().putBlob(container, blob);
assertConsistencyAwareContainerSize(container, 1);
HttpRequest request = wrapper.getSigner().signGetBlob(container, name, range(0, 1));
HttpRequest request = view.getSigner().signGetBlob(container, name, range(0, 1));
assertEquals(request.getFilters().size(), 0);
assertEquals(Strings2.toStringAndClose(wrapper.utils().http().invoke(request).getPayload().getInput()), "fo");
assertEquals(Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().getInput()), "fo");
} finally {
returnContainer(container);
}
@ -96,12 +96,12 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
String name = "hello";
String text = "fooooooooooooooooooooooo";
Blob blob = wrapper.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
String container = getContainerName();
try {
HttpRequest request = wrapper.getSigner().signPutBlob(container, blob);
HttpRequest request = view.getSigner().signPutBlob(container, blob);
assertEquals(request.getFilters().size(), 0);
Strings2.toStringAndClose(wrapper.utils().http().invoke(request).getPayload().getInput());
Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().getInput());
assertConsistencyAwareContainerSize(container, 1);
} finally {
returnContainer(container);

View File

@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.ws.rs.core.MediaType;
import org.jclouds.apis.BaseWrapperLiveTest;
import org.jclouds.apis.BaseViewLiveTest;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.domain.Blob;
@ -59,7 +59,7 @@ import com.google.common.collect.Sets;
import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreContext> {
public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreContext> {
protected static final String LOCAL_ENCODING = System.getProperty("file.encoding");
protected static final String XML_STRING_FORMAT = "<apples><apple name=\"%s\"></apple> </apples>";
protected static final String TEST_STRING = String.format(XML_STRING_FORMAT, "apple");
@ -90,9 +90,9 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
@BeforeSuite
public void setUpResourcesForAllThreads(ITestContext testContext) throws Exception {
setupContext();
createContainersSharedByAllThreads(wrapper, testContext);
wrapper.close();
wrapper = null;
createContainersSharedByAllThreads(view, testContext);
view.close();
view = null;
}
protected Iterable<Module> setupModules() {
@ -119,7 +119,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
if (exec != null) {
exec.shutdownNow();
}
wrapper.close();
view.close();
}
private static volatile boolean initialized = false;
@ -224,7 +224,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
}
protected void assertConsistencyAware(Runnable assertion) throws InterruptedException {
assertConsistencyAware(wrapper, assertion);
assertConsistencyAware(view, assertion);
}
protected static void createContainerAndEnsureEmpty(BlobStoreContext context, final String containerName)
@ -236,7 +236,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
}
protected void createContainerAndEnsureEmpty(String containerName) throws InterruptedException {
createContainerAndEnsureEmpty(wrapper, containerName);
createContainerAndEnsureEmpty(view, containerName);
}
protected String addBlobToContainer(String sourceContainer, String key) {
@ -244,20 +244,20 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
}
protected String addBlobToContainer(String sourceContainer, String key, String payload, String contentType) {
Blob sourceObject = wrapper.getBlobStore().blobBuilder(key).payload(payload).contentType(contentType).build();
Blob sourceObject = view.getBlobStore().blobBuilder(key).payload(payload).contentType(contentType).build();
return addBlobToContainer(sourceContainer, sourceObject);
}
protected void add5BlobsUnderPathAnd5UnderRootToContainer(String sourceContainer) {
for (Entry<String, String> entry : Iterables.concat(fiveStrings.entrySet(), fiveStringsUnderPath.entrySet())) {
Blob sourceObject = wrapper.getBlobStore().blobBuilder(entry.getKey()).payload(entry.getValue())
Blob sourceObject = view.getBlobStore().blobBuilder(entry.getKey()).payload(entry.getValue())
.contentType("text/xml").build();
addBlobToContainer(sourceContainer, sourceObject);
}
}
protected String addBlobToContainer(String sourceContainer, Blob object) {
return wrapper.getBlobStore().putBlob(sourceContainer, object);
return view.getBlobStore().putBlob(sourceContainer, object);
}
protected <T extends BlobMetadata> T validateMetadata(T md, String container, String name) {
@ -269,7 +269,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
protected Blob validateContent(String container, String name) throws InterruptedException {
assertConsistencyAwareContainerSize(container, 1);
Blob newObject = wrapper.getBlobStore().getBlob(container, name);
Blob newObject = view.getBlobStore().getBlob(container, name);
assert newObject != null;
validateMetadata(newObject.getMetadata(), container, name);
try {
@ -285,9 +285,9 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
assertConsistencyAware(new Runnable() {
public void run() {
try {
assert wrapper.getBlobStore().countBlobs(containerName) == count : String.format(
assert view.getBlobStore().countBlobs(containerName) == count : String.format(
"expected only %d values in %s: %s", count, containerName, ImmutableSet.copyOf(Iterables
.transform(wrapper.getBlobStore().list(containerName),
.transform(view.getBlobStore().list(containerName),
new Function<StorageMetadata, String>() {
public String apply(StorageMetadata from) {
@ -307,9 +307,9 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
assertConsistencyAware(new Runnable() {
public void run() {
try {
assert wrapper.getBlobStore().blobExists(containerName, name) : String.format(
assert view.getBlobStore().blobExists(containerName, name) : String.format(
"could not find %s in %s: %s", name, containerName, ImmutableSet.copyOf(Iterables.transform(
wrapper.getBlobStore().list(containerName), new Function<StorageMetadata, String>() {
view.getBlobStore().list(containerName), new Function<StorageMetadata, String>() {
public String apply(StorageMetadata from) {
return from.getName();
@ -328,7 +328,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
assertConsistencyAware(new Runnable() {
public void run() {
try {
assert !wrapper.getBlobStore().blobExists(containerName, name) : String.format("found %s in %s", name,
assert !view.getBlobStore().blobExists(containerName, name) : String.format("found %s in %s", name,
containerName);
} catch (Exception e) {
Throwables.propagateIfPossible(e);
@ -367,7 +367,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
* *substantially* slow down tests on a real server over a network.
*/
if (SANITY_CHECK_RETURNED_BUCKET_NAME) {
if (!Iterables.any(wrapper.getBlobStore().list(), new Predicate<StorageMetadata>() {
if (!Iterables.any(view.getBlobStore().list(), new Predicate<StorageMetadata>() {
public boolean apply(StorageMetadata md) {
return containerName.equals(md.getName());
}
@ -382,7 +382,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
assertConsistencyAware(new Runnable() {
public void run() {
try {
assert !wrapper.getBlobStore().containerExists(containerName) : "container " + containerName
assert !view.getBlobStore().containerExists(containerName) : "container " + containerName
+ " still exists";
} catch (Exception e) {
propagateIfPossible(e);
@ -416,7 +416,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
private String allocateNewContainerName(final String container) {
exec.submit(new Runnable() {
public void run() {
deleteContainerOrWarnIfUnable(wrapper, container);
deleteContainerOrWarnIfUnable(view, container);
}
});
String newScratchContainer = container + containerIndex.incrementAndGet();
@ -429,7 +429,7 @@ public class BaseBlobStoreIntegrationTest extends BaseWrapperLiveTest<BlobStoreC
}
@Override
protected TypeToken<BlobStoreContext> wrapperType() {
protected TypeToken<BlobStoreContext> viewType() {
return TypeToken.of(BlobStoreContext.class);
}

View File

@ -49,21 +49,21 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
@Test(groups = { "integration", "live" })
public void containerDoesntExist() {
assert !wrapper.getBlobStore().containerExists("forgetaboutit");
assert !wrapper.getBlobStore().containerExists("cloudcachestorefunctionalintegrationtest-first");
assert !view.getBlobStore().containerExists("forgetaboutit");
assert !view.getBlobStore().containerExists("cloudcachestorefunctionalintegrationtest-first");
}
@Test(groups = { "integration", "live" })
public void testPutTwiceIsOkAndDoesntOverwrite() throws InterruptedException {
String containerName = getContainerName();
try {
wrapper.getBlobStore().createContainerInLocation(null, containerName);
view.getBlobStore().createContainerInLocation(null, containerName);
Blob blob = wrapper.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build();
wrapper.getBlobStore().putBlob(containerName, blob);
Blob blob = view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build();
view.getBlobStore().putBlob(containerName, blob);
wrapper.getBlobStore().createContainerInLocation(null, containerName);
assertEquals(wrapper.getBlobStore().countBlobs(containerName), 1);
view.getBlobStore().createContainerInLocation(null, containerName);
assertEquals(view.getBlobStore().countBlobs(containerName), 1);
} finally {
returnContainer(containerName);
}
@ -77,11 +77,11 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
addBlobToContainer(containerName,
// NOTE all metadata in jclouds comes out as lowercase, in an effort to
// normalize the providers.
wrapper.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
view.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
.payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).calculateMD5().build());
validateContent(containerName, key);
PageSet<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName,
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName,
maxResults(1).withDetails());
BlobMetadata metadata = BlobMetadata.class.cast(get(container, 0));
@ -105,7 +105,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
String containerName = getContainerName();
try {
add5BlobsUnderPathAnd5UnderRootToContainer(containerName);
wrapper.getBlobStore().clearContainer(containerName);
view.getBlobStore().clearContainer(containerName);
assertConsistencyAwareContainerSize(containerName, 0);
} finally {
returnContainer(containerName);
@ -118,13 +118,13 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
try {
addAlphabetUnderRoot(containerName);
PageSet<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName, maxResults(1));
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1));
assert container.getNextMarker() != null;
assertEquals(container.size(), 1);
String marker = container.getNextMarker();
container = wrapper.getBlobStore().list(containerName, afterMarker(marker));
container = view.getBlobStore().list(containerName, afterMarker(marker));
assertEquals(container.getNextMarker(), null);
assert container.size() == 25 : String.format("size should have been 25, but was %d: %s", container.size(),
container);
@ -142,7 +142,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
String prefix = "rootdelimeter";
addTenObjectsUnderPrefix(containerName, prefix);
add15UnderRoot(containerName);
PageSet<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName);
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName);
assert container.getNextMarker() == null;
assertEquals(container.size(), 16);
} finally {
@ -157,17 +157,17 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
try {
String directory = "directory";
assert !wrapper.getBlobStore().directoryExists(containerName, directory);
assert !view.getBlobStore().directoryExists(containerName, directory);
wrapper.getBlobStore().createDirectory(containerName, directory);
view.getBlobStore().createDirectory(containerName, directory);
assert wrapper.getBlobStore().directoryExists(containerName, directory);
PageSet<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName);
assert view.getBlobStore().directoryExists(containerName, directory);
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName);
// we should have only the directory under root
assert container.getNextMarker() == null;
assert container.size() == 1 : container;
container = wrapper.getBlobStore().list(containerName, inDirectory(directory));
container = view.getBlobStore().list(containerName, inDirectory(directory));
// we should have nothing in the directory
assert container.getNextMarker() == null;
@ -175,50 +175,50 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
addTenObjectsUnderPrefix(containerName, directory);
container = wrapper.getBlobStore().list(containerName);
container = view.getBlobStore().list(containerName);
// we should still have only the directory under root
assert container.getNextMarker() == null;
assert container.size() == 1 : container;
container = wrapper.getBlobStore().list(containerName, inDirectory(directory));
container = view.getBlobStore().list(containerName, inDirectory(directory));
// we should have only the 10 items under the directory
assert container.getNextMarker() == null;
assert container.size() == 10 : container;
// try 2 level deep directory
assert !wrapper.getBlobStore().directoryExists(containerName, directory + "/" + directory);
wrapper.getBlobStore().createDirectory(containerName, directory + "/" + directory);
assert wrapper.getBlobStore().directoryExists(containerName, directory + "/" + directory);
assert !view.getBlobStore().directoryExists(containerName, directory + "/" + directory);
view.getBlobStore().createDirectory(containerName, directory + "/" + directory);
assert view.getBlobStore().directoryExists(containerName, directory + "/" + directory);
wrapper.getBlobStore().clearContainer(containerName, inDirectory(directory));
assert wrapper.getBlobStore().directoryExists(containerName, directory);
assert wrapper.getBlobStore().directoryExists(containerName, directory + "/" + directory);
view.getBlobStore().clearContainer(containerName, inDirectory(directory));
assert view.getBlobStore().directoryExists(containerName, directory);
assert view.getBlobStore().directoryExists(containerName, directory + "/" + directory);
// should have only the 2 level-deep directory above
container = wrapper.getBlobStore().list(containerName, inDirectory(directory));
container = view.getBlobStore().list(containerName, inDirectory(directory));
assert container.getNextMarker() == null;
assert container.size() == 1 : container;
wrapper.getBlobStore().createDirectory(containerName, directory + "/" + directory);
view.getBlobStore().createDirectory(containerName, directory + "/" + directory);
container = wrapper.getBlobStore().list(containerName, inDirectory(directory).recursive());
container = view.getBlobStore().list(containerName, inDirectory(directory).recursive());
assert container.getNextMarker() == null;
assert container.size() == 1 : container;
wrapper.getBlobStore().clearContainer(containerName, inDirectory(directory).recursive());
view.getBlobStore().clearContainer(containerName, inDirectory(directory).recursive());
// should no longer have the 2 level-deep directory above
container = wrapper.getBlobStore().list(containerName, inDirectory(directory));
container = view.getBlobStore().list(containerName, inDirectory(directory));
assert container.getNextMarker() == null;
assert container.size() == 0 : container;
container = wrapper.getBlobStore().list(containerName);
container = view.getBlobStore().list(containerName);
// should only have the directory
assert container.getNextMarker() == null;
assert container.size() == 1 : container;
wrapper.getBlobStore().deleteDirectory(containerName, directory);
view.getBlobStore().deleteDirectory(containerName, directory);
container = wrapper.getBlobStore().list(containerName);
container = view.getBlobStore().list(containerName);
// now should be completely empty
assert container.getNextMarker() == null;
assert container.size() == 0 : container;
@ -236,7 +236,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
addTenObjectsUnderPrefix(containerName, prefix);
add15UnderRoot(containerName);
PageSet<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName, inDirectory(prefix));
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, inDirectory(prefix));
assert container.getNextMarker() == null;
assertEquals(container.size(), 10);
} finally {
@ -251,7 +251,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
try {
addAlphabetUnderRoot(containerName);
PageSet<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName, maxResults(5));
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(5));
assertEquals(container.size(), 5);
assert container.getNextMarker() != null;
} finally {
@ -263,7 +263,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
public void containerExists() throws InterruptedException {
String containerName = getContainerName();
try {
assert wrapper.getBlobStore().containerExists(containerName);
assert view.getBlobStore().containerExists(containerName);
} finally {
returnContainer(containerName);
}
@ -274,7 +274,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
String containerName = getContainerName();
try {
addBlobToContainer(containerName, "test");
wrapper.getBlobStore().deleteContainer(containerName);
view.getBlobStore().deleteContainer(containerName);
assertNotExists(containerName);
} finally {
recycleContainer(containerName);
@ -285,7 +285,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
public void deleteContainerIfEmpty() throws InterruptedException {
final String containerName = getContainerName();
try {
wrapper.getBlobStore().deleteContainer(containerName);
view.getBlobStore().deleteContainer(containerName);
assertNotExists(containerName);
} finally {
// this container is now deleted, so we can't reuse it directly
@ -298,7 +298,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
String containerName = getContainerName();
try {
add15UnderRoot(containerName);
Set<? extends StorageMetadata> container = wrapper.getBlobStore().list(containerName);
Set<? extends StorageMetadata> container = view.getBlobStore().list(containerName);
assertEquals(container.size(), 15);
} finally {
returnContainer(containerName);
@ -308,8 +308,8 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
protected void addAlphabetUnderRoot(String containerName) throws InterruptedException {
for (char letter = 'a'; letter <= 'z'; letter++) {
wrapper.getBlobStore().putBlob(containerName,
wrapper.getBlobStore().blobBuilder(letter + "").payload(letter + "content").build());
view.getBlobStore().putBlob(containerName,
view.getBlobStore().blobBuilder(letter + "").payload(letter + "content").build());
}
assertContainerSize(containerName, 26);
@ -319,7 +319,7 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
assertConsistencyAware(new Runnable() {
public void run() {
try {
assertEquals(wrapper.getBlobStore().countBlobs(containerName), size);
assertEquals(view.getBlobStore().countBlobs(containerName), size);
} catch (Exception e) {
propagateIfPossible(e);
}
@ -329,15 +329,15 @@ public class BaseContainerIntegrationTest extends BaseBlobStoreIntegrationTest {
protected void add15UnderRoot(String containerName) throws InterruptedException {
for (int i = 0; i < 15; i++) {
wrapper.getBlobStore().putBlob(containerName,
wrapper.getBlobStore().blobBuilder(i + "").payload(i + "content").build());
view.getBlobStore().putBlob(containerName,
view.getBlobStore().blobBuilder(i + "").payload(i + "content").build());
}
}
protected void addTenObjectsUnderPrefix(String containerName, String prefix) throws InterruptedException {
for (int i = 0; i < 10; i++) {
wrapper.getBlobStore().putBlob(containerName,
wrapper.getBlobStore().blobBuilder(prefix + "/" + i).payload(i + "content").build());
view.getBlobStore().putBlob(containerName,
view.getBlobStore().blobBuilder(prefix + "/" + i).payload(i + "content").build());
}
}
}

View File

@ -38,18 +38,18 @@ public class BaseContainerLiveTest extends BaseBlobStoreIntegrationTest {
public void testPublicAccess() throws InterruptedException, MalformedURLException, IOException {
final String containerName = getScratchContainerName();
try {
wrapper.getBlobStore().createContainerInLocation(null, containerName, publicRead());
view.getBlobStore().createContainerInLocation(null, containerName, publicRead());
assertConsistencyAwareContainerSize(containerName, 0);
wrapper.getBlobStore().putBlob(containerName,
wrapper.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build());
view.getBlobStore().putBlob(containerName,
view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build());
assertConsistencyAwareContainerSize(containerName, 1);
BlobMetadata metadata = wrapper.getBlobStore().blobMetadata(containerName, "hello");
BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, "hello");
assert metadata.getPublicUri() != null : metadata;
assertEquals(Strings2.toStringAndClose(wrapper.utils().http().get(metadata.getPublicUri())), TEST_STRING);
assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), TEST_STRING);
} finally {
// this container is now public, so we can't reuse it directly

View File

@ -53,7 +53,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testValues() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
map.putAll(this.fiveInputs);
// this will cause us to block until the bucket updates.
assertConsistencyAwareMapSize(map, 5);
@ -74,7 +74,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPutMoreThanSingleListing() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
InputStreamMap map = createMap(wrapper, containerName);
InputStreamMap map = createMap(view, containerName);
Set<String> keySet = Sets.newLinkedHashSet();
for (int i = 0; i < maxResultsForTestListings() + 1; i++) {
keySet.add(i + "");
@ -100,7 +100,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testRemove() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
putStringWithMD5(map, "one", "two");
InputStream old = map.remove("one");
assertEquals(Strings2.toStringAndClose(old), "two");
@ -120,7 +120,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testEntrySet() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putAllStrings(this.fiveStrings);
// this will cause us to block until the bucket updates.
assertConsistencyAwareKeySize(map, 5);
@ -143,7 +143,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testContainsStringValue() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putString("one", String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareContainsValue(map, fiveStrings.get("one"));
} finally {
@ -155,7 +155,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testContainsFileValue() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putString("one", String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareContainsValue(map, fiveFiles.get("one"));
} finally {
@ -167,7 +167,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testContainsInputStreamValue() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putString("one", String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareContainsValue(map, this.fiveInputs.get("one"));
} finally {
@ -179,7 +179,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testContainsBytesValue() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putString("one", String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareContainsValue(map, this.fiveBytes.get("one"));
} finally {
@ -192,7 +192,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPutAll() throws InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
map.putAll(this.fiveInputs);
assertConsistencyAwareMapSize(map, 5);
assertConsistencyAwareKeySetEquals(map, new TreeSet<String>(fiveInputs.keySet()));
@ -206,7 +206,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPutAllBytes() throws InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putAllBytes(this.fiveBytes);
assertConsistencyAwareMapSize(map, 5);
@ -221,7 +221,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPutAllFiles() throws InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putAllFiles(this.fiveFiles);
assertConsistencyAwareMapSize(map, 5);
@ -236,7 +236,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPutAllStrings() throws InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putAllStrings(this.fiveStrings);
assertConsistencyAwareMapSize(map, 5);
@ -251,7 +251,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPutString() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
InputStream old = ((InputStreamMap) map).putString("one", fiveStrings.get("one"));
getOneReturnsAppleAndOldValueIsNull(map, old);
@ -280,7 +280,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPutFile() throws IOException, InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
InputStream old = ((InputStreamMap) map).putFile("one", fiveFiles.get("one"));
getOneReturnsAppleAndOldValueIsNull(map, old);
@ -295,7 +295,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPutBytes() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
InputStream old = ((InputStreamMap) map).putBytes("one", fiveBytes.get("one"));
getOneReturnsAppleAndOldValueIsNull(map, old);
@ -310,7 +310,7 @@ public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrati
public void testPut() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(wrapper, containerName);
Map<String, InputStream> map = createMap(view, containerName);
InputStream old = map.put("one", fiveInputs.get("one"));
getOneReturnsAppleAndOldValueIsNull(map, old);

View File

@ -106,7 +106,7 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
public void testClear() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerNameName = getContainerName();
try {
Map<String, V> map = createMap(wrapper, containerNameName);
Map<String, V> map = createMap(view, containerNameName);
assertConsistencyAwareMapSize(map, 0);
putStringWithMD5(map, "one", "apple");
assertConsistencyAwareMapSize(map, 1);
@ -124,7 +124,7 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
public void testKeySet() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerNameName = getContainerName();
try {
Map<String, V> map = createMap(wrapper, containerNameName);
Map<String, V> map = createMap(view, containerNameName);
assertConsistencyAwareKeySize(map, 0);
putStringWithMD5(map, "one", "two");
assertConsistencyAwareKeySize(map, 1);
@ -136,15 +136,15 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
protected void addTenObjectsUnderPrefix(String containerName, String prefix) throws InterruptedException {
for (int i = 0; i < 10; i++) {
wrapper.getBlobStore().putBlob(containerName,
wrapper.getBlobStore().blobBuilder(prefix + "/" + i).payload(i + "content").build());
view.getBlobStore().putBlob(containerName,
view.getBlobStore().blobBuilder(prefix + "/" + i).payload(i + "content").build());
}
}
protected void addTenObjectsUnderRoot(String containerName) throws InterruptedException {
for (int i = 0; i < 10; i++) {
wrapper.getBlobStore().putBlob(containerName,
wrapper.getBlobStore().blobBuilder(i + "").payload(i + "content").build());
view.getBlobStore().putBlob(containerName,
view.getBlobStore().blobBuilder(i + "").payload(i + "content").build());
}
}
@ -152,13 +152,13 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
public void testDirectory() throws InterruptedException {
String containerName = getContainerName();
String directory = "apps";
Map<String, V> rootMap = createMap(wrapper, containerName);
Map<String, V> rootRecursiveMap = createMap(wrapper, containerName, recursive());
Map<String, V> inDirectoryMap = createMap(wrapper, containerName, inDirectory(directory));
Map<String, V> inDirectoryRecursiveMap = createMap(wrapper, containerName, inDirectory(directory).recursive());
Map<String, V> rootMap = createMap(view, containerName);
Map<String, V> rootRecursiveMap = createMap(view, containerName, recursive());
Map<String, V> inDirectoryMap = createMap(view, containerName, inDirectory(directory));
Map<String, V> inDirectoryRecursiveMap = createMap(view, containerName, inDirectory(directory).recursive());
try {
wrapper.getBlobStore().createDirectory(containerName, directory);
view.getBlobStore().createDirectory(containerName, directory);
addTenObjectsUnderRoot(containerName);
assertEquals(rootMap.size(), 10);
assertEquals(ImmutableSortedSet.copyOf(rootMap.keySet()),
@ -184,7 +184,7 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
assertEquals(ImmutableSortedSet.copyOf(inDirectoryRecursiveMap.keySet()),
ImmutableSortedSet.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
wrapper.getBlobStore().createDirectory(containerName, directory + "/" + directory);
view.getBlobStore().createDirectory(containerName, directory + "/" + directory);
assertEquals(rootMap.size(), 10);
assertEquals(rootRecursiveMap.size(), 20);
assertEquals(inDirectoryMap.size(), 10);
@ -252,7 +252,7 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
public void testContainsKey() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerNameName = getContainerName();
try {
Map<String, V> map = createMap(wrapper, containerNameName);
Map<String, V> map = createMap(view, containerNameName);
assertConsistencyAwareDoesntContainKey(map);
putStringWithMD5(map, "one", "apple");
assertConsistencyAwareContainsKey(map);
@ -294,7 +294,7 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
public void testIsEmpty() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerNameName = getContainerName();
try {
Map<String, V> map = createMap(wrapper, containerNameName);
Map<String, V> map = createMap(view, containerNameName);
assertConsistencyAwareEmpty(map);
putStringWithMD5(map, "one", "apple");
assertConsistencyAwareNotEmpty(map);
@ -343,7 +343,7 @@ public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegration
public void testListContainer() throws InterruptedException, ExecutionException, TimeoutException {
String containerNameName = getContainerName();
try {
ListableMap<?, ?> map = (ListableMap<?, ?>) createMap(wrapper, containerNameName);
ListableMap<?, ?> map = (ListableMap<?, ?>) createMap(view, containerNameName);
assertConsistencyAwareListContainer(map, containerNameName);
} finally {
returnContainer(containerNameName);

View File

@ -41,24 +41,24 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
@Test(groups = { "integration", "live" })
void containerDoesntExist() {
Set<? extends StorageMetadata> list = wrapper.getBlobStore().list();
Set<? extends StorageMetadata> list = view.getBlobStore().list();
assert !list.contains(new MutableStorageMetadataImpl());
}
@Test(groups = { "integration", "live" })
public void testAllLocations() throws InterruptedException {
for (final Location location : wrapper.getBlobStore().listAssignableLocations()) {
for (final Location location : view.getBlobStore().listAssignableLocations()) {
final String containerName = getScratchContainerName();
try {
System.err.printf(" >> creating container in location %s%n", location);
wrapper.getBlobStore().createContainerInLocation(location, containerName);
view.getBlobStore().createContainerInLocation(location, containerName);
System.err.printf(" << call complete.. checking%n");
assertConsistencyAware(new Runnable() {
@Override
public void run() {
PageSet<? extends StorageMetadata> list = wrapper.getBlobStore().list();
PageSet<? extends StorageMetadata> list = view.getBlobStore().list();
assert Iterables.any(list, new Predicate<StorageMetadata>() {
public boolean apply(StorageMetadata md) {
return containerName.equals(md.getName()) && location.equals(md.getLocation());
@ -79,9 +79,9 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
@Test(groups = { "integration", "live" })
public void testGetAssignableLocations() throws Exception {
if (wrapper.unwrap() instanceof Location)
assertProvider(Location.class.cast(wrapper.unwrap()));
for (Location location : wrapper.getBlobStore().listAssignableLocations()) {
if (view.unwrap() instanceof Location)
assertProvider(Location.class.cast(view.unwrap()));
for (Location location : view.getBlobStore().listAssignableLocations()) {
System.err.printf("location %s%n", location);
assert location.getId() != null : location;
assert location != location.getParent() : location;

View File

@ -18,7 +18,7 @@
*/
package org.jclouds.blobstore.internal;
import org.jclouds.Wrapper;
import org.jclouds.View;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.apis.internal.BaseApiMetadataTest;
import org.jclouds.blobstore.BlobStoreContext;
@ -35,7 +35,7 @@ import com.google.common.reflect.TypeToken;
public abstract class BaseBlobStoreApiMetadataTest extends BaseApiMetadataTest {
public BaseBlobStoreApiMetadataTest(ApiMetadata toTest) {
super(toTest, ImmutableSet.<TypeToken<? extends Wrapper>>of(TypeToken.of(BlobStoreContext.class)));
super(toTest, ImmutableSet.<TypeToken<? extends View>>of(TypeToken.of(BlobStoreContext.class)));
}
}

View File

@ -56,7 +56,7 @@ public abstract class TerremarkVCloudApiMetadata extends BaseRestApiMetadata {
.credentialName("Password")
.version("0.8")
.defaultProperties(TerremarkVCloudApiMetadata.defaultProperties())
.wrapper(ComputeServiceContext.class);
.view(ComputeServiceContext.class);
}
@Override

View File

@ -482,7 +482,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
injector = wrapper.utils().injector();
injector = view.utils().injector();
sshFactory = injector.getInstance(SshClient.Factory.class);
socketTester = new RetryablePredicate<IPSocket>(injector.getInstance(SocketOpen.class), 300, 10, TimeUnit.SECONDS);// make
@ -492,7 +492,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
// default internet
// service timeout
successTester = new RetryablePredicate<URI>(injector.getInstance(TaskSuccess.class), 650, 10, TimeUnit.SECONDS);
connection = (S) RestContext.class.cast(wrapper.unwrap()).getApi();
connection = (S) RestContext.class.cast(view.unwrap()).getApi();
orgs = listOrgs();
}
@ -514,7 +514,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
for (Org org : orgs) {
RestContext<S, A> newContext = null;
try {
newContext = createWrapper(
newContext = createView(
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName())),
setupModules()).unwrap();
assertEquals(newContext.getApi().findOrgNamed(null), org);
@ -549,7 +549,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
for (ReferenceType cat : org.getCatalogs().values()) {
RestContext<S, A> newContext = null;
try {
newContext = createWrapper(
newContext = createView(
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CATALOG, cat.getName())), setupModules())
.unwrap();
@ -592,7 +592,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
for (ReferenceType net : response.getAvailableNetworks().values()) {
RestContext<S, A> newContext = null;
try {
newContext = createWrapper(
newContext = createView(
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC, vdc.getName(),
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK, net.getName())), setupModules())
@ -671,7 +671,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
for (ReferenceType vdc : org.getVDCs().values()) {
RestContext<S, A> newContext = null;
try {
newContext = createWrapper(
newContext = createView(
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC, vdc.getName())), setupModules())
.unwrap();
@ -703,7 +703,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
for (ReferenceType tasksList : org.getTasksLists().values()) {
RestContext<S, A> newContext = null;
try {
newContext = createWrapper(
newContext = createView(
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_TASKSLIST, tasksList.getName())), setupModules())
.unwrap();
@ -737,7 +737,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
@AfterGroups(groups = { "live" })
public void teardownClient() {
wrapper.close();
view.close();
}
protected Iterable<Org> listOrgs() {

View File

@ -54,7 +54,7 @@ extends BaseComputeServiceContextLiveTest {
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
Injector injector = wrapper.utils().injector();
Injector injector = view.utils().injector();
tmClient = injector.getInstance(TerremarkVCloudClient.class);
allCatalogItemsInOrg = injector.getInstance(AllCatalogItemsInOrg.class);

View File

@ -60,10 +60,10 @@ public abstract class BaseTerremarkClientLiveTest<S extends TerremarkVCloudClien
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
Injector injector = wrapper.utils().injector();
Injector injector = view.utils().injector();
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 300, 1, TimeUnit.SECONDS);
sshFactory = injector.getInstance(Factory.class);
connection = (S) RestContext.class.cast(wrapper.unwrap()).getApi();
connection = (S) RestContext.class.cast(view.unwrap()).getApi();
}
protected Module getSshModule() {

View File

@ -21,7 +21,7 @@ package org.jclouds.compute;
import java.io.Closeable;
import java.util.Map;
import org.jclouds.Wrapper;
import org.jclouds.View;
import org.jclouds.compute.internal.ComputeServiceContextImpl;
import org.jclouds.domain.Credentials;
import org.jclouds.rest.RestContext;
@ -37,7 +37,7 @@ import com.google.inject.ImplementedBy;
*
*/
@ImplementedBy(ComputeServiceContextImpl.class)
public interface ComputeServiceContext extends Closeable, Wrapper {
public interface ComputeServiceContext extends Closeable, View {
ComputeService getComputeService();
@ -69,8 +69,8 @@ public interface ComputeServiceContext extends Closeable, Wrapper {
/**
* will be removed in jclouds 1.6
*
* @see Wrapper#getInputType
* @see Wrapper#unwrap
* @see View#getInputType
* @see View#unwrap
*/
@Deprecated
<S, A> RestContext<S, A> getProviderSpecificContext();

View File

@ -30,7 +30,7 @@ import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.Utils;
import org.jclouds.domain.Credentials;
import org.jclouds.internal.BaseWrapper;
import org.jclouds.internal.BaseView;
import org.jclouds.location.Provider;
import org.jclouds.rest.RestContext;
@ -40,14 +40,14 @@ import com.google.common.reflect.TypeToken;
* @author Adrian Cole
*/
@Singleton
public class ComputeServiceContextImpl extends BaseWrapper implements ComputeServiceContext {
public class ComputeServiceContextImpl extends BaseView implements ComputeServiceContext {
private final ComputeService computeService;
private final Utils utils;
@Inject
public ComputeServiceContextImpl(@Provider Context wrapped, @Provider TypeToken<? extends Context> wrappedType,
public ComputeServiceContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
ComputeService computeService, Utils utils) {
super(wrapped, wrappedType);
super(backend, backendType);
this.computeService = checkNotNull(computeService, "computeService");
this.utils = checkNotNull(utils, "utils");
}

View File

@ -62,7 +62,7 @@ public class StubApiMetadata extends BaseApiMetadata {
.defaultCredential("stub")
.defaultEndpoint("stub")
.documentation(URI.create("http://www.jclouds.org/documentation/userguide/compute"))
.wrapper(ComputeServiceContext.class)
.view(ComputeServiceContext.class)
.defaultModule(StubComputeServiceContextModule.class);
}

View File

@ -1,6 +1,6 @@
package org.jclouds.compute.internal;
import org.jclouds.Wrapper;
import org.jclouds.View;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.apis.internal.BaseApiMetadataTest;
import org.jclouds.compute.ComputeServiceContext;
@ -17,7 +17,7 @@ import com.google.common.reflect.TypeToken;
public abstract class BaseComputeServiceApiMetadataTest extends BaseApiMetadataTest {
public BaseComputeServiceApiMetadataTest(ApiMetadata toTest) {
super(toTest, ImmutableSet.<TypeToken<? extends Wrapper>>of(TypeToken.of(ComputeServiceContext.class)));
super(toTest, ImmutableSet.<TypeToken<? extends View>>of(TypeToken.of(ComputeServiceContext.class)));
}
}

View File

@ -28,7 +28,7 @@ import com.google.common.reflect.TypeToken;
public abstract class BaseComputeServiceContextLiveTest extends BaseGenericComputeServiceContextLiveTest<ComputeServiceContext> {
@Override
protected TypeToken<ComputeServiceContext> wrapperType() {
protected TypeToken<ComputeServiceContext> viewType() {
return TypeToken.of(ComputeServiceContext.class);
}

View File

@ -150,7 +150,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
protected void buildSocketTester() {
SocketOpen socketOpen = wrapper.utils().injector().getInstance(SocketOpen.class);
SocketOpen socketOpen = view.utils().injector().getInstance(SocketOpen.class);
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);
// wait a maximum of 60 seconds for port 8080 to open.
long maxWait = TimeUnit.SECONDS.toMillis(60);
@ -162,7 +162,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
@Override
protected void initializeContext() {
super.initializeContext();
client = wrapper.getComputeService();
client = view.getComputeService();
}
// wait up to 5 seconds for an auth exception
@ -320,7 +320,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
}
protected void checkHttpGet(NodeMetadata node) {
ComputeTestUtils.checkHttpGet(wrapper.utils().http(), node, 8080);
ComputeTestUtils.checkHttpGet(view.utils().http(), node, 8080);
}
@Test(enabled = true, dependsOnMethods = "testCompareSizes")
@ -416,7 +416,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
public void testCredentialsCache() throws Exception {
initializeContext();
for (NodeMetadata node : nodes)
assert (wrapper.utils().credentialStore().get("node#" + node.getId()) != null) : "credentials for " + node.getId();
assert (view.utils().credentialStore().get("node#" + node.getId()) != null) : "credentials for " + node.getId();
}
protected Map<? extends NodeMetadata, ExecResponse> runScriptWithCreds(final String group, OperatingSystem os,
@ -431,7 +431,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
assertNotNull(node.getGroup());
assertEquals(node.getGroup(), group);
assertEquals(node.getState(), NodeState.RUNNING);
Credentials fromStore = wrapper.utils().credentialStore().get("node#" + node.getId());
Credentials fromStore = view.utils().credentialStore().get("node#" + node.getId());
assertEquals(fromStore, node.getCredentials());
assert node.getPublicAddresses().size() >= 1 || node.getPrivateAddresses().size() >= 1 : "no ips in" + node;
assertNotNull(node.getCredentials());
@ -548,7 +548,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
assertEquals(toDestroy, destroyed.size());
for (NodeMetadata node : filter(client.listNodesDetailsMatching(all()), inGroup(group))) {
assert node.getState() == NodeState.TERMINATED : node;
assert wrapper.utils().credentialStore().get("node#" + node.getId()) == null : "credential should have been null for "
assert view.utils().credentialStore().get("node#" + node.getId()) == null : "credential should have been null for "
+ "node#" + node.getId();
}
}
@ -650,7 +650,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
format("ls %s/bundles/org/jboss/as/osgi/configadmin/main|sed -e 's/.*-//g' -e 's/.jar//g'",
JBOSS_HOME)), configureSeconds));
trackAvailabilityOfProcessOnNode(wrapper.utils().userExecutor().submit(new Callable<ExecResponse>() {
trackAvailabilityOfProcessOnNode(view.utils().userExecutor().submit(new Callable<ExecResponse>() {
@Override
public ExecResponse call() {
return client.runScriptOnNode(nodeId, startJBoss(configuration), runAsRoot(false).blockOnComplete(false)
@ -666,7 +666,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
client.runScriptOnNode(nodeId, "/tmp/init-jboss stop", runAsRoot(false).wrapInInitScript(false));
trackAvailabilityOfProcessOnNode(wrapper.utils().userExecutor().submit(new Callable<ExecResponse>() {
trackAvailabilityOfProcessOnNode(view.utils().userExecutor().submit(new Callable<ExecResponse>() {
@Override
public ExecResponse call() {
@ -814,7 +814,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
}
protected void doCheckJavaIsInstalledViaSsh(NodeMetadata node, String taskName) throws IOException {
SshClient ssh = wrapper.utils().sshForNode().apply(node);
SshClient ssh = view.utils().sshForNode().apply(node);
try {
ssh.connect();
ExecResponse hello = ssh.exec("echo hello");

View File

@ -22,7 +22,7 @@ import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import org.jclouds.apis.BaseWrapperLiveTest;
import org.jclouds.apis.BaseViewLiveTest;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.domain.LoginCredentials.Builder;
@ -39,7 +39,7 @@ import com.google.inject.util.Modules;
/**
* @author Jason King, Adrian Cole
*/
public abstract class BaseGenericComputeServiceContextLiveTest<W extends ComputeServiceContext> extends BaseWrapperLiveTest<W> {
public abstract class BaseGenericComputeServiceContextLiveTest<W extends ComputeServiceContext> extends BaseViewLiveTest<W> {
protected String imageId;
protected String loginUser;

View File

@ -53,13 +53,13 @@ public abstract class BaseImageExtensionLiveTest extends BaseComputeServiceConte
* @return
*/
public Template getNodeTemplate() {
return wrapper.getComputeService().templateBuilder().any().build();
return view.getComputeService().templateBuilder().any().build();
}
@Test(groups = { "integration", "live" }, singleThreaded = true)
public void testCreateImage() throws RunNodesException, InterruptedException {
ComputeService computeService = wrapper.getComputeService();
ComputeService computeService = view.getComputeService();
Optional<ImageExtension> imageExtension = computeService.getImageExtension();
assertTrue("image extension was not present", imageExtension.isPresent());
@ -87,20 +87,20 @@ public abstract class BaseImageExtensionLiveTest extends BaseComputeServiceConte
@Test(groups = { "integration", "live" }, singleThreaded = true, dependsOnMethods = "testCreateImage")
public void testSpawnNodeFromImage() throws RunNodesException {
ComputeService computeService = wrapper.getComputeService();
ComputeService computeService = view.getComputeService();
Template template = computeService.templateBuilder().fromImage(getImage().get()).build();
NodeMetadata node = Iterables.getOnlyElement(computeService.createNodesInGroup("test-create-image", 1, template));
SshClient client = wrapper.utils().sshForNode().apply(node);
SshClient client = view.utils().sshForNode().apply(node);
client.connect();
ExecResponse hello = client.exec("echo hello");
assertEquals(hello.getOutput().trim(), "hello");
wrapper.getComputeService().destroyNode(node.getId());
view.getComputeService().destroyNode(node.getId());
}
@ -108,7 +108,7 @@ public abstract class BaseImageExtensionLiveTest extends BaseComputeServiceConte
"testSpawnNodeFromImage" })
public void testDeleteImage() {
ComputeService computeService = wrapper.getComputeService();
ComputeService computeService = view.getComputeService();
Optional<ImageExtension> imageExtension = computeService.getImageExtension();
assertTrue("image extension was not present", imageExtension.isPresent());
@ -123,7 +123,7 @@ public abstract class BaseImageExtensionLiveTest extends BaseComputeServiceConte
}
private Optional<? extends Image> getImage() {
return Iterables.tryFind(wrapper.getComputeService().listImages(), new Predicate<Image>() {
return Iterables.tryFind(view.getComputeService().listImages(), new Predicate<Image>() {
@Override
public boolean apply(Image input) {
return input.getId().contains("test-create-image");

View File

@ -66,11 +66,11 @@ import com.google.inject.Module;
public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceContextLiveTest {
public void testCompareSizes() throws Exception {
Hardware defaultSize = wrapper.getComputeService().templateBuilder().build().getHardware();
Hardware defaultSize = view.getComputeService().templateBuilder().build().getHardware();
Hardware smallest = wrapper.getComputeService().templateBuilder().smallest().build().getHardware();
Hardware fastest = wrapper.getComputeService().templateBuilder().fastest().build().getHardware();
Hardware biggest = wrapper.getComputeService().templateBuilder().biggest().build().getHardware();
Hardware smallest = view.getComputeService().templateBuilder().smallest().build().getHardware();
Hardware fastest = view.getComputeService().templateBuilder().fastest().build().getHardware();
Hardware biggest = view.getComputeService().templateBuilder().biggest().build().getHardware();
System.out.printf("smallest %s%n", smallest);
System.out.printf("fastest %s%n", fastest);
@ -89,8 +89,8 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
}
public void testFromTemplate() {
Template defaultTemplate = wrapper.getComputeService().templateBuilder().build();
assertEquals(wrapper.getComputeService().templateBuilder().fromTemplate(defaultTemplate).build().toString(),
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertEquals(view.getComputeService().templateBuilder().fromTemplate(defaultTemplate).build().toString(),
defaultTemplate.toString());
}
@ -134,7 +134,7 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
@Test(dataProvider = "osSupported")
public void testTemplateBuilderCanFind(OsFamilyVersion64Bit matrix) throws InterruptedException {
TemplateBuilder builder = wrapper.getComputeService().templateBuilder().osFamily(matrix.family)
TemplateBuilder builder = view.getComputeService().templateBuilder().osFamily(matrix.family)
.os64Bit(matrix.is64Bit);
if (!matrix.version.equals(""))
builder.osVersionMatches("^" + matrix.version + "$");
@ -147,7 +147,7 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
@Test(dataProvider = "osNotSupported", expectedExceptions = NoSuchElementException.class)
public void testTemplateBuilderCannotFind(OsFamilyVersion64Bit matrix) throws InterruptedException {
TemplateBuilder builder = wrapper.getComputeService().templateBuilder().osFamily(matrix.family)
TemplateBuilder builder = view.getComputeService().templateBuilder().osFamily(matrix.family)
.os64Bit(matrix.is64Bit);
if (!matrix.version.equals(""))
builder.osVersionMatches("^" + matrix.version + "$");
@ -156,18 +156,18 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
@Test
public void testTemplateBuilderCanUseImageId() throws Exception {
Template defaultTemplate = wrapper.getComputeService().templateBuilder().build();
wrapper.close();
Template defaultTemplate = view.getComputeService().templateBuilder().build();
view.close();
setupContext();
Template template = wrapper.getComputeService().templateBuilder().imageId(defaultTemplate.getImage().getId())
Template template = view.getComputeService().templateBuilder().imageId(defaultTemplate.getImage().getId())
.locationId(defaultTemplate.getLocation().getId()).build();
assertEquals(template.getImage(), defaultTemplate.getImage());
}
@Test
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = wrapper.getComputeService().templateBuilder().build();
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assert defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[012].[10][04]") : defaultTemplate
.getImage().getOperatingSystem().getVersion();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
@ -179,8 +179,8 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
@Test(groups = { "integration", "live" })
public void testGetAssignableLocations() throws Exception {
assertProvider(wrapper.unwrap());
for (Location location : wrapper.getComputeService().listAssignableLocations()) {
assertProvider(view.unwrap());
for (Location location : view.getComputeService().listAssignableLocations()) {
System.err.printf("location %s%n", location);
assert location.getId() != null : location;
assert location != location.getParent() : location;
@ -218,14 +218,14 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
@Test
public void testTemplateBuilderWithImageIdSpecified() throws IOException {
Template defaultTemplate = wrapper.getComputeService().templateBuilder().build();
Template defaultTemplate = view.getComputeService().templateBuilder().build();
ComputeServiceContext context = null;
try {
Properties overrides = setupProperties();
overrides.setProperty("jclouds.image-id", defaultTemplate.getImage().getId());
context = createWrapper(overrides, setupModules());
context = createView(overrides, setupModules());
assertEquals(context.getComputeService().templateBuilder().build().toString(), defaultTemplate.toString());
} finally {
@ -238,7 +238,7 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
Properties overrides = setupProperties();
overrides.setProperty(provider + ".image-id", defaultTemplate.getImage().getId());
context = createWrapper(overrides, setupModules());
context = createView(overrides, setupModules());
assertEquals(context.getComputeService().templateBuilder().build().toString(), defaultTemplate.toString());
} finally {
@ -266,7 +266,7 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
boolean auth = authenticateSudo != null ? Boolean.valueOf(authenticateSudo) : true;
overrides.setProperty(propertyKey + ".image.authenticate-sudo", auth + "");
context = createWrapper(overrides, ImmutableSet.<Module>of(credentialStoreModule));
context = createView(overrides, ImmutableSet.<Module>of(credentialStoreModule));
Iterable<String> userPass = Splitter.on(':').split(login);
String user = Iterables.get(userPass, 0);

View File

@ -486,37 +486,37 @@ public class ContextBuilder {
}
/**
* @see #buildAndWrapWith(Class)
* @see #buildView(Class)
*/
public <W extends Wrapper> W build(Class<W> wrapperType) {
return buildAndWrapWith(checkNotNull(wrapperType, "wrapperType"));
public <V extends View> V build(Class<V> viewType) {
return buildView(checkNotNull(viewType, "viewType"));
}
/**
* @see #buildAndWrapWith(TypeToken)
* @see #buildView(TypeToken)
*/
public <W extends Wrapper> W buildAndWrapWith(Class<W> wrapperType) {
return buildAndWrapWith(TypeToken.of(checkNotNull(wrapperType, "wrapperType")));
public <V extends View> V buildView(Class<V> viewType) {
return buildView(TypeToken.of(checkNotNull(viewType, "viewType")));
}
/**
* this will build any {@link ApiMetadata#getWrappers() wrapper} supported by the ApiMetadata.
* this will build any {@link ApiMetadata#getViews() view} supported by the ApiMetadata.
*
* ex. {@code builder.build(BlobStoreContext.class) } will work, if {@code TypeToken<BlobStore>}
* is a configured {@link ApiMetadata#getWrappers() wrapper} of this api.
* is a configured {@link ApiMetadata#getViews() view} of this api.
*
*/
@SuppressWarnings("unchecked")
public <W extends Wrapper> W buildAndWrapWith(TypeToken<W> wrapperType) {
TypeToken<W> returnType;
public <V extends View> V buildView(TypeToken<V> viewType) {
TypeToken<V> returnType;
try {
returnType = (TypeToken<W>) Apis.findWrapper(apiMetadata, checkNotNull(wrapperType, "wrapperType"));
returnType = (TypeToken<V>) Apis.findView(apiMetadata, checkNotNull(viewType, "viewType"));
} catch (NoSuchElementException e) {
throw new IllegalArgumentException(String.format(
"api %s not wrappable as %s; context: %s, wrappers: %s", apiMetadata,
wrapperType, apiMetadata.getContext(), apiMetadata.getWrappers()));
"api %s not wrappable as %s; context: %s, views: %s", apiMetadata,
viewType, apiMetadata.getContext(), apiMetadata.getViews()));
}
return (W) buildInjector().getInstance(Key.get(TypeLiteral.get(returnType.getType())));
return (V) buildInjector().getInstance(Key.get(TypeLiteral.get(returnType.getType())));
}
/**

View File

@ -22,10 +22,10 @@ import com.google.common.annotations.Beta;
import com.google.common.reflect.TypeToken;
/**
* {@link Wrapper} allows access to the provider-specific, or library-driven api
* behind an abstraction. One wrapped context can support multiple wrappers.
* {@link View} allows access to the provider-specific, or library-driven api
* behind an abstraction. One backend context can support multiple views.
* <p/>
* For example, the {@code CloudStackContext} can be wrapped by both
* For example, the {@code CloudStackContext} can be backend by both
* {@code ComputeServiceContext} and {@code LoadBalancerServiceContext}, as the
* api covers these features.
*
@ -33,27 +33,27 @@ import com.google.common.reflect.TypeToken;
*
*/
@Beta
public interface Wrapper {
public interface View {
/**
*
* @return type of the context powering the current one.
*/
TypeToken<?> getWrappedType();
TypeToken<?> getBackendType();
/**
* Return an object of the specified type to allow access to the wrapped
* context. If the wrapped context is not assignable from the supplied type,
* Return an object of the specified type to allow access to the backend
* context. If the backend context is not assignable from the supplied type,
* an {@link IllegalArgumentException} is thrown.
*
* @param type
* the type of the context to be returned. The wrapped context must
* the type of the context to be returned. The backend context must
* be assignable from this type.
* @return an instance of the specified type
* @throws IllegalArgumentException
* if the wrapped context is not assignable from the specified
* if the backend context is not assignable from the specified
* class.
* @see #getWrappedType()
* @see #getBackendType()
*/
<C extends Context> C unwrap(TypeToken<C> type) throws IllegalArgumentException;
@ -69,7 +69,7 @@ public interface Wrapper {
*
* @throws ClassCastException
* if the user supplied {@code C} param is not assignableFrom
* {@link #getWrappedType()}
* {@link #getBackendType()}
*/
<C extends Context> C unwrap() throws ClassCastException;

Some files were not shown because too many files have changed in this diff Show More