@Override public void run() { LOG.debug("closing ComputeServiceContext {}", context); context.close(); } });
@Override public void run() { LOG.debug("closing ComputeServiceContext {}", context); context.close(); } });
/** * Close the connection */ public void closeConnection(){ compute.getContext().close(); journal.log(Level.INFO, ">> Closing connection ..."); }
public void destroy() { if (computeService != null) { this.computeService.getContext().close(); } }
/** * Close the connection */ public void closeConnection(){ compute.getContext().close(); journal.log(Level.INFO, ">> Closing connection ..."); }
/** * Close the connection */ public void closeConnection(){ novaComputeService.getContext().close(); journal.log(Level.INFO, ">> Closing connection ..."); }
@AfterClass(groups = "live") public void close() throws FileNotFoundException, IOException { if (context != null) context.close(); } }
void shutdown() { echo("Shutting down Provisioner..."); // shutdown thread pool executor.shutdown(); awaitTermination(executor, EXECUTOR_TERMINATION_TIMEOUT_SECONDS, SECONDS); // shutdown compute service (which holds another thread pool) if (computeService != null) { computeService.getContext().close(); } echo("Done!"); }
@Test public void testAndExperiment() { ComputeServiceContext context = null; try { context = computeContextForKnownArgumentsAndConstantPassword(); assertEquals(context.getComputeService().listAssignableLocations().size(), 4); } finally { if (context != null) context.close(); } }
@Test public void testCanBuildById() { ComputeServiceContext context = ContextBuilder.newBuilder("servermanager").build(ComputeServiceContext.class); context.close(); }
@Test public void testCanBuildWithOverridingProperties() { Properties overrides = new Properties(); overrides.setProperty("servermanager.endpoint", "http://host"); overrides.setProperty("servermanager.api-version", "1"); ComputeServiceContext context = ContextBuilder.newBuilder("servermanager") .overrides(overrides).build(ComputeServiceContext.class); context.close(); }
@Test public void testAndExperiment() { ComputeServiceContext context = null; try { context = computeContextForKnownArgumentsAndConstantPassword(); assertEquals(context.getComputeService().listAssignableLocations().size(), 4); } finally { if (context != null) context.close(); } }
@Test public void testUnwrapIsCorrectType() { ComputeServiceContext context = ContextBuilder.newBuilder("servermanager").build(ComputeServiceContext.class); assertEquals(context.unwrap().getClass(), ContextImpl.class); context.close(); } }
@Test public void testCanBuildWithApiMetadata() { ComputeServiceContext context = ContextBuilder.newBuilder( new ServerManagerApiMetadata()).build(ComputeServiceContext.class); context.close(); }
@Test public void testAndExperiment() { ComputeServiceContext context = null; try { context = ContextBuilder.newBuilder(new ServerManagerApiMetadata()).build(ComputeServiceContext.class); context.getComputeService().listNodes(); } finally { if (context != null) context.close(); } }
private void checkAuthAsUser(ApiKeyPair keyPair) { ComputeServiceContext context = createView(credentialsAsProperties(keyPair), setupModules()); CloudStackClient client = context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi(); Set<Account> accounts = client.getAccountClient().listAccounts(); assert accounts.size() > 0; context.close(); }
@AfterClass(groups = { "integration", "live" }) @Override protected void tearDownContext() { if (loadbalancer != null) { view.getLoadBalancerService().destroyLoadBalancer(loadbalancer.getId()); } if (nodes != null) { computeContext.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group)); } computeContext.close(); super.tearDownContext(); }
@AfterClass(groups = { "integration", "live" }) @Override protected void tearDownContext() { if (loadbalancer != null) { view.getLoadBalancerService().destroyLoadBalancer(loadbalancer.getId()); } if (nodes != null) { computeContext.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group)); } computeContext.close(); super.tearDownContext(); }
@Test public void testTemplateBuilderCanUseImageId() throws Exception { Template defaultTemplate = view.getComputeService().templateBuilder().build(); view.close(); setupContext(); Template template = view.getComputeService().templateBuilder().imageId(defaultTemplate.getImage().getId()) .locationId(defaultTemplate.getLocation().getId()).build(); assertEquals(template.getImage(), defaultTemplate.getImage()); }
protected void initializeComputeContext() { if (computeContext != null) computeContext.close(); Properties overrides = setupComputeProperties(); ContextBuilder builder = ContextBuilder.newBuilder(computeProvider) .credentials(computeIdentity, computeCredential).overrides(overrides).modules(setupModules()); if (computeApiversion != null) builder.apiVersion(computeApiversion); if (computeBuildversion != null) builder.buildVersion(computeBuildversion); computeContext = builder.buildView(ComputeServiceContext.class); }