org.jclouds.rest.Utils.injector()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.jclouds.rest.Utils.injector()方法的一些代码示例,展示了Utils.injector()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.injector()方法的具体详情如下:
包路径:org.jclouds.rest.Utils
类名称:Utils
方法名:injector

Utils.injector介绍

[英]#see #getInjector
[中]#参见#getInjector

代码示例

代码示例来源:origin: apache/jclouds

@Override
protected void initializeContext() {
 super.initializeContext();
 resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
 }, Names.named(TIMEOUT_RESOURCE_DELETED)));
 publicIpAvailable = context.utils().injector().getInstance(PublicIpAvailablePredicateFactory.class);
 resourceAvailable = context.utils().injector()
    .getInstance(Key.get(new TypeLiteral<Predicate<Supplier<Provisionable>>>() {
    }));
 api = view.unwrapApi(AzureComputeApi.class);
}

代码示例来源:origin: apache/jclouds

@Override
public void initializeContext() {
 super.initializeContext();
 resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
 }, Names.named(TIMEOUT_RESOURCE_DELETED)));
}

代码示例来源:origin: jclouds/jclouds-labs

private Set<String> getZones() {
 final String region = ctx.utils().injector().getInstance(ImplicitRegionIdSupplier.class).get();
 final Map<String, Supplier<Set<String>>> regionToZoneMap = ctx.utils().injector()
    .getInstance(RegionIdToZoneIdsSupplier.class).get();
 return regionToZoneMap.get(region).get();
}

代码示例来源:origin: jclouds/jclouds-labs

private Set<String> getZones() {
 final String region = ctx.utils().injector().getInstance(ImplicitRegionIdSupplier.class).get();
 final Map<String, Supplier<Set<String>>> regionToZoneMap = ctx.utils().injector()
    .getInstance(RegionIdToZoneIdsSupplier.class).get();
 return regionToZoneMap.get(region).get();
}

代码示例来源:origin: apache/jclouds

@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
 super.setupContext();
 resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
 }, Names.named(TIMEOUT_RESOURCE_DELETED)));
 createResourceGroup(resourceGroupName);
}

代码示例来源:origin: apache/jclouds

@Override
protected void initializeContext() {
 super.initializeContext();
 resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
 }, Names.named(TIMEOUT_RESOURCE_DELETED)));
 api = view.unwrapApi(AzureComputeApi.class);
}

代码示例来源:origin: apache/jclouds

@Override
protected void initializeContext() {
 super.initializeContext();
 resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
 }, Names.named(TIMEOUT_RESOURCE_DELETED)));
 api = view.unwrapApi(AzureComputeApi.class);
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test(groups = "live")
public void testSetGetContainerMetadata() throws InterruptedException {
 CommonSwiftClient swift = view.utils().injector().getInstance(CommonSwiftClient.class);
 String containerName = getContainerName();
 
 assertTrue(swift.createContainer(containerName));
 
 ImmutableMap<String, String> metadata = ImmutableMap.<String, String> of(
    "key1", "value1",
    "key2", "value2"); 
 assertTrue(swift.setContainerMetadata(containerName, metadata));
 ContainerMetadata containerMetadata = swift.getContainerMetadata(containerName);
 
 assertEquals(containerMetadata.getMetadata().get("key1"), "value1");
 assertEquals(containerMetadata.getMetadata().get("key2"), "value2");
}

代码示例来源:origin: jclouds/legacy-jclouds

public void testGetAndSetTemporaryUrlKey() {
   TemporaryUrlKeyApi client = view.utils().injector().getInstance(TemporaryUrlKeyApi.class);

   String currentSecretKey = client.getTemporaryUrlKey();
   assertNotNull(currentSecretKey);
   try {
     String testKey = UUID.randomUUID().toString();
     client.setTemporaryUrlKey(testKey);
     assertEquals(client.getTemporaryUrlKey(), testKey);

   } finally {
     client.setTemporaryUrlKey(currentSecretKey);
   }
  }
}

代码示例来源:origin: jclouds/legacy-jclouds

protected void buildSocketTester() {
 SocketOpen socketOpen = view.utils().injector().getInstance(SocketOpen.class);
 socketTester = retry(socketOpen, 60, 1, SECONDS);
 // wait a maximum of 60 seconds for port 8080 to open.
 openSocketFinder = context.utils().injector().getInstance(OpenSocketFinder.class);
}

代码示例来源:origin: apache/jclouds

@Override
protected KeystoneApi create(Properties props, Iterable<Module> modules) {
 ApiContext<KeystoneApi> ctx = newBuilder().modules(modules).overrides(props).build();
 authenticationApi = ctx.utils().injector().getInstance(AuthenticationApi.class);
 token = ctx.utils().injector().getInstance(Key.get(new TypeLiteral<Supplier<String>>() {
 }, Authentication.class));
 return ctx.getApi();
}

代码示例来源:origin: apache/jclouds

protected void buildSocketTester() {
 SocketOpen socketOpen = view.utils().injector().getInstance(SocketOpen.class);
 socketTester = retry(socketOpen, 60, 1, SECONDS);
 // wait a maximum of 60 seconds for port 8080 to open.
 openSocketFinder = context.utils().injector().getInstance(OpenSocketFinder.class);
}

代码示例来源:origin: apache/jclouds

protected void buildSocketTester() {
 SocketOpen socketOpen = view.utils().injector().getInstance(SocketOpen.class);
 socketTester = retry(socketOpen, 60, 1, SECONDS);
 // wait a maximum of 60 seconds for port 8080 to open.
 openSocketFinder = context.utils().injector().getInstance(OpenSocketFinder.class);
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test(expectedExceptions=UnsupportedOperationException.class)
  public void testSocketOpenThrowsUnsupported() {
   Context context = ContextBuilder.newBuilder(
         AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class, IntegrationTestAsyncClient.class,
            "dummyurl"))
      .modules(ImmutableSet.of(new GoogleAppEngineConfigurationModule()))
      .build();

   SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
   socketOpen.apply(HostAndPort.fromParts("localhost", 22));
  }
}

代码示例来源:origin: apache/jclouds

@Test(expectedExceptions = UnsupportedOperationException.class)
  public void testSocketOpenThrowsUnsupported() {
   Context context = ContextBuilder.newBuilder(forApiOnEndpoint(IntegrationTestClient.class, "dummyurl"))
      .modules(ImmutableSet.of(new GoogleAppEngineConfigurationModule()))
      .build();

   SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
   socketOpen.apply(HostAndPort.fromParts("localhost", 22));
  }
}

代码示例来源:origin: apache/jclouds

@BeforeGroups(groups = { "live" })
public void setupContext() {
 super.setupContext();
 adapter = context.utils().injector().getInstance(
    CloudStackComputeServiceAdapter.class);
 keyPairName = prefix + "-adapter-test-keypair";
 keyPair = SshKeys.generate();
 client.getSSHKeyPairApi().deleteSSHKeyPair(keyPairName);
 client.getSSHKeyPairApi().registerSSHKeyPair(keyPairName, keyPair.get("public"));
}

代码示例来源:origin: jclouds/legacy-jclouds

@Override
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
 super.setupContext();
 imageId = view.getComputeService().templateBuilder().build().getImage().getId();
    client = view.utils().injector().getInstance(ElasticStackClient.class);
 driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
 SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
 socketTester = retry(socketOpen, maxDriveImageTime, 1, SECONDS);
}

代码示例来源:origin: apache/jclouds

@Override
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
 super.setupContext();
 imageId = view.getComputeService().templateBuilder().build().getImage().getId();
    client = view.utils().injector().getInstance(ElasticStackApi.class);
 driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
 SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
 socketTester = retry(socketOpen, maxDriveImageTime, 1, SECONDS);
}

代码示例来源:origin: jclouds/legacy-jclouds

@BeforeGroups(groups = { "integration", "live" })
@Override
public void setupContext() {
 super.setupContext();
 client = view.utils().injector().getInstance(CloudSigmaClient.class);
 driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
 SocketOpen socketOpten = context.utils().injector().getInstance(SocketOpen.class);
 socketTester = retry(socketOpten, maxDriveImageTime, 1, SECONDS);
 if (template == null || template.getImageId() == null) {
   imageId = view.getComputeService().templateBuilder().build().getImage().getId();
 }
}

代码示例来源:origin: jclouds/jclouds-labs

@BeforeMethod
public void start() throws IOException {
 server = new MockWebServer();
 server.play();
 ctx = ContextBuilder.newBuilder(DimensionDataCloudControlProviderMetadata.builder().build()).credentials("", "")
    .endpoint(url("")).modules(modules).overrides(new Properties()).build();
 json = ctx.utils().injector().getInstance(Json.class);
 api = ctx.getApi();
 applyAdditionalServerConfig();
 assertedRequestCount = 0;
 datacenters = getZones();
}

相关文章