@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); }
@Override public void initializeContext() { super.initializeContext(); resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() { }, Names.named(TIMEOUT_RESOURCE_DELETED))); }
@SuppressWarnings("unchecked") @Override protected Optional<Image> findImageWithNameInCache(String name) { ImageCacheSupplier imageCache = (ImageCacheSupplier) context.utils().injector() .getInstance(Key.get(new TypeLiteral<Supplier<Set<? extends Image>>>() { }, Memoized.class)); try { Field field = imageCache.getClass().getDeclaredField("imageCache"); field.setAccessible(true); LoadingCache<String, Image> cache = (LoadingCache<String, Image>) field.get(imageCache); return Optional.fromNullable(getOnlyElement(filter(cache.asMap().values(), new Predicate<Image>() { @Override public boolean apply(Image input) { return imageGroup.equals(input.getName()); } }), null)); } catch (NoSuchFieldException ex) { throw Throwables.propagate(ex); } catch (IllegalAccessException ex) { throw Throwables.propagate(ex); } }
@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); }
@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); }
@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); }
@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); }
@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); }
@Test(enabled = true, dependsOnMethods = "testCompareSizes") public void testConcurrentUseOfComputeServiceToCreateNodes() throws Exception { final long timeoutMs = 20 * 60 * 1000; List<String> groups = Lists.newArrayList(); List<ListenableFuture<NodeMetadata>> futures = Lists.newArrayList(); ListeningExecutorService userExecutor = MoreExecutors.listeningDecorator(context.utils().userExecutor()); try { for (int i = 0; i < 2; i++) { final int groupNum = i; final String group = "twin" + groupNum; groups.add(group); ListenableFuture<NodeMetadata> future = userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { NodeMetadata node = getOnlyElement(client.createNodesInGroup(group, 1, inboundPorts(22, 8080) .blockOnPort(22, 300 + groupNum))); getAnonymousLogger().info("Started node " + node.getId()); return node; } }); futures.add(future); } ListenableFuture<List<NodeMetadata>> compoundFuture = Futures.allAsList(futures); compoundFuture.get(timeoutMs, TimeUnit.MILLISECONDS); } finally { for (String group : groups) { client.destroyNodesMatching(inGroup(group)); } } }
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); }
private Resources resourceApi() { return builder().build().utils().injector().getInstance(Resources.class); } }
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); }
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); }
@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)); } }
@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)); } }
@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")); }
@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); }
@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); }
@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(); } }
@Test(groups = "live") public void testPublicAccess() throws InterruptedException, MalformedURLException, IOException { final String containerName = getScratchContainerName(); try { view.getBlobStore().createContainerInLocation(null, containerName, publicRead()); assertConsistencyAwareContainerExists(containerName); defaultLocation = Iterables.find(view.getBlobStore().list(), new Predicate<StorageMetadata>() { @Override public boolean apply(@Nullable StorageMetadata input) { return input.getName().equals(containerName); } }).getLocation(); view.getBlobStore().putBlob(containerName, view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build()); assertConsistencyAwareContainerSize(containerName, 1); BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, "hello"); assertNotNull(metadata.getPublicUri(), metadata.toString()); SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class); Predicate<HostAndPort> socketTester = retry(socketOpen, 60, 5, SECONDS); int port = metadata.getPublicUri().getPort(); HostAndPort hostAndPort = HostAndPort.fromParts(metadata.getPublicUri().getHost(), port != -1 ? port : 80); assertTrue(socketTester.apply(hostAndPort), metadata.getPublicUri().toString()); assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), TEST_STRING); } finally { // this container is now public, so we can't reuse it directly recycleContainerAndAddToPool(containerName); } }