@Override public void create(OperationContext opContext) throws StorageException { container.create(null, opContext); }
@Override public void create(OperationContext opContext) throws StorageException { container.create(null, opContext); }
/** * Creates the container. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void create() throws StorageException { this.create(BlobContainerPublicAccessType.OFF, null /* options */, null /* opContext */); }
/** * Creates the container. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void create() throws StorageException { this.create(BlobContainerPublicAccessType.OFF, null /* options */, null /* opContext */); }
/** * Creates the container using the specified options and operation context. * * @param options * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudBlobClient}). * @param opContext * An {@link OperationContext} object that represents the context for the current operation. This object * is used to track requests to the storage service, and to provide additional runtime information about * the operation. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void create(BlobRequestOptions options, OperationContext opContext) throws StorageException { this.create(BlobContainerPublicAccessType.OFF, options, opContext); }
@NotNull public static String createContainer(@NotNull final StorageInputs inputs) throws Exception { final CloudBlobClient blobClient = getCloudBlobClient(inputs); final CloudBlobContainer container = blobClient.getContainerReference(inputs.getContainerName()); container.create(); return inputs.getContainerName(); }
@Before public void blobOutputStreamTestMethodSetUp() throws URISyntaxException, StorageException { this.container = BlobTestHelper.getRandomContainerReference(); this.container.create(); }
@Before public void leaseTestMethodSetUp() throws StorageException, URISyntaxException { this.container = BlobTestHelper.getRandomContainerReference(); this.container.create(); }
@Before public void appendBlobTestMethodSetUp() throws URISyntaxException, StorageException { this.container = BlobTestHelper.getRandomContainerReference(); this.container.create(); }
@Before public void pageBlobTestMethodSetUp() throws URISyntaxException, StorageException { this.container = BlobTestHelper.getRandomContainerReference(); this.container.create(); }
@Before public void cloudBlockBlobTestMethodSetUp() throws URISyntaxException, StorageException { this.container = BlobTestHelper.getRandomContainerReference(); this.container.create(); }
@Before public void blobSasTestMethodSetUp() throws URISyntaxException, StorageException, IOException { this.container = BlobTestHelper.getRandomContainerReference(); this.container.create(); this.blob = (CloudBlockBlob) BlobTestHelper.uploadNewBlob(this.container, BlobType.BLOCK_BLOB, "test", 100, null); }
private static CloudBlobContainer createContainer(String delimiter) throws URISyntaxException, StorageException { CloudBlobClient client = BlobTestHelper.createCloudBlobClient(); client.setDirectoryDelimiter(delimiter); String name = BlobTestHelper.generateRandomContainerName(); CloudBlobContainer container = client.getContainerReference(name); container.create(); return container; } }
@Before public void blobEncryptionTestMethodSetup() throws URISyntaxException, StorageException, IOException { this.container = BlobTestHelper.getRandomContainerReference(); this.container.create(); this.blob = this.container.getBlockBlobReference(BlobTestHelper.generateRandomBlobNameWithPrefix("testBlob")); this.blob.uploadText("test"); }
public CloudBlobContainer getContainer(String name) throws URISyntaxException, StorageException, InvalidKeyException { int mappedPort = getMappedPort(); CloudStorageAccount cloud = CloudStorageAccount.parse("DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:" + mappedPort + "/devstoreaccount1;"); CloudBlobContainer container = cloud.createCloudBlobClient().getContainerReference(name); container.deleteIfExists(); container.create(); return container; }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudBlobContainerReferenceFromServerSAS() throws StorageException, URISyntaxException, IOException, InvalidKeyException { this.container.create(); CloudBlob blob = BlobTestHelper.uploadNewBlob(this.container, BlobType.BLOCK_BLOB, null, 1024, null); SharedAccessBlobPolicy policy = new SharedAccessBlobPolicy(); Calendar now = Calendar.getInstance(); now.add(Calendar.MINUTE, 10); policy.setSharedAccessExpiryTime(now.getTime()); policy.setPermissions(EnumSet.of(SharedAccessBlobPermissions.READ)); String token = this.container.generateSharedAccessSignature(policy, null); CloudBlobContainer containerSAS = new CloudBlobContainer(this.container.getStorageUri(), new StorageCredentialsSharedAccessSignature(token)); CloudBlob blobRef = containerSAS.getBlobReferenceFromServer(blob.getName()); assertEquals(blob.getClass(), blobRef.getClass()); assertEquals(blob.getUri(), blobRef.getUri()); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudBlobContainerReferenceFromServerMissingBlob() throws StorageException, URISyntaxException, IOException { this.container.create(); String blobName = BlobTestHelper.generateRandomBlobNameWithPrefix("missing"); try { this.container.getBlobReferenceFromServer(blobName); fail("Get reference from server should fail."); } catch (StorageException ex) { assertEquals(404, ex.getHttpStatusCode()); } }
/** * Try to delete a non-existing container * * @throws StorageException */ @Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudBlobContainerDeleteIfExists() throws StorageException { assertFalse(container.deleteIfExists()); container.create(); assertTrue(container.deleteIfExists()); assertFalse(container.exists()); assertFalse(container.deleteIfExists()); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudBlobContainerReferenceFromServerSnapshot() throws StorageException, URISyntaxException, IOException { this.container.create(); CloudBlob blob = BlobTestHelper.uploadNewBlob(this.container, BlobType.BLOCK_BLOB, null, 1024, null); CloudBlob snapshot = blob.createSnapshot(); snapshot.getProperties().setContentType("application/octet-stream"); snapshot.getProperties().setLength(1024); CloudBlob blobRef = this.container.getBlobReferenceFromServer(snapshot.getName(), snapshot.getSnapshotID(), null, null, null); BlobTestHelper.assertAreEqual(snapshot, blobRef); }
/** * Check a container's existence * * @throws StorageException */ @Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudBlobContainerExists() throws StorageException { assertFalse(this.container.exists()); this.container.create(); assertTrue(this.container.exists()); assertNotNull(this.container.getProperties().getEtag()); this.container.delete(); assertFalse(this.container.exists()); }