@Override protected void after() { logger.debug("S3 proxy is stopping"); try { s3Proxy.stop(); BlobStore blobStore = blobStoreContext.getBlobStore(); for (StorageMetadata metadata : blobStore.list()) { blobStore.deleteContainer(metadata.getName()); } blobStoreContext.close(); } catch (Exception e) { throw new RuntimeException("Unable to stop S3 proxy", e); } FileUtils.deleteQuietly(blobStoreLocation); logger.debug("S3 proxy has stopped"); }
/** * A really simple wrapper on closable object to allow trivial close * attempts when we are unsure if they are even open. * * @param toClose * A Closeable Object to try closing */ static void close() { context.close(); }
@Override public void dispose(BlobStoreContext blobStoreContext) { blobStoreContext.close(); } }
/** * {@inheritDoc} */ @Override public void close () throws IOException { mContext.close(); }
@PreDestroy public void cleanUp() { blobStoreContext.close(); }
@Override public void run() { LOG.debug("closing BlobStoreContext {}", context); context.close(); } });
@PreDestroy public void cleanUp() { blobStoreContext.close(); }
/** * Close all blob store connections */ public static synchronized void closeAll() { for (String profileName : blobStoreContexts.keySet()) { blobStoreContexts.get(profileName).close(); blobStoreContexts.remove(profileName); } }
public synchronized void dropAndClose() { if (container != null && temporary) { LOG.info("Removing blob cache '{}'", container); context.getBlobStore().deleteContainer(container); } context.close(); } }
public synchronized void dropAndClose() { if (container != null && temporary) { LOG.info("Removing blob cache '{}'", container); context.getBlobStore().deleteContainer(container); } context.close(); } }
@AfterClass(groups = { "integration", "live" }) @Override protected void tearDownContext() { if (exec != null) { exec.shutdownNow(); } view.close(); }
/** * Delete the cloud container and all its contents. * */ public void deleteBucket() { Preconditions.checkNotNull(context); if (context.getBlobStore().containerExists(cloudContainer)) { context.getBlobStore().deleteContainer(cloudContainer); } context.close(); }
/** * Delete the cloud container and all its contents. * */ public void deleteBucket() { Preconditions.checkNotNull(context); if (context.getBlobStore().containerExists(cloudContainer)) { context.getBlobStore().deleteContainer(cloudContainer); } context.close(); }
@Override protected void doCall(JcloudsLocation loc, String indent) throws Exception { BlobStoreContext context = BlobStoreContextFactoryImpl.INSTANCE.newBlobStoreContext(loc); try { org.jclouds.blobstore.BlobStore blobStore = context.getBlobStore(); doCall(blobStore, indent); } finally { context.close(); } } }
@AfterMethod protected void tearDown() throws IOException { context.close(); Utils.deleteRecursively(new File(TestUtils.TARGET_BASE_DIR)); }
@Override public boolean isInStorage() { BlobStoreContext context = createContext(); try { BlobStore store = createBlobStore(context); return store.blobExists(getContainer(), getPath()); } finally { context.close(); } } }
/** * There are a lot of retries here mainly from experience running inside amazon EC2. */ @BeforeSuite public void setUpResourcesForAllThreads(ITestContext testContext) throws Exception { setupContext(); createContainersSharedByAllThreads(view, testContext); view.close(); view = null; }
@Test(expectedExceptions = { ContainerNotFoundException.class }) public void testListAllForUnknownContainerFromTransientBlobStoreEagerly() throws Exception { ListContainerOptions containerOptions = ListContainerOptions.NONE; ListAllOptions listAllOptions = ListAllOptions.Builder.eager(true); BlobStoreContext context = blobStoreContext(); try { BlobStore blobStore = context.getBlobStore(); BlobStores.listAll(blobStore, "wrongcontainer", containerOptions, listAllOptions); } finally { context.close(); } }
@Override protected InputStream createData() throws IOException { BlobStoreContext context = createContext(); try { BlobStore store = createBlobStore(context); Blob blob = store.getBlob(getContainer(), getPath()); return blob.getPayload().getInput(); } finally { context.close(); } }
@AfterEach void tearDown() throws Exception { blobStore.deleteContainer(containerName.value()); blobStore.getContext().close(); }