use of com.microsoft.azure.storage.blob.CloudAppendBlob in project camel by apache.
the class BlobServiceProducer method deleteAppendBlob.
private void deleteAppendBlob(Exchange exchange) throws Exception {
CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(getConfiguration());
doDeleteBlock(client, exchange);
}
use of com.microsoft.azure.storage.blob.CloudAppendBlob in project camel by apache.
the class BlobServiceUtil method createAppendBlobClient.
public static CloudAppendBlob createAppendBlobClient(BlobServiceConfiguration cfg) throws Exception {
CloudAppendBlob client = (CloudAppendBlob) getConfiguredClient(cfg);
if (client == null) {
URI uri = prepareStorageBlobUri(cfg);
StorageCredentials creds = getAccountCredentials(cfg);
client = new CloudAppendBlob(uri, creds);
}
return client;
}
use of com.microsoft.azure.storage.blob.CloudAppendBlob in project camel by apache.
the class BlobServiceUtilTest method testGetConfiguredClientUriMismatch.
@Test
public void testGetConfiguredClientUriMismatch() throws Exception {
CloudAppendBlob client = new CloudAppendBlob(URI.create("https://camelazure.blob.core.windows.net/container/blob"));
JndiRegistry registry = (JndiRegistry) ((PropertyPlaceholderDelegateRegistry) context.getRegistry()).getRegistry();
registry.bind("azureBlobClient", client);
BlobServiceComponent component = new BlobServiceComponent(context);
BlobServiceEndpoint endpoint = (BlobServiceEndpoint) component.createEndpoint("azure-blob://camelazure/container/blob2?azureBlobClient=#azureBlobClient&publicForRead=true" + "&blobType=appendBlob");
try {
BlobServiceUtil.getConfiguredClient(endpoint.getConfiguration());
fail();
} catch (IllegalArgumentException ex) {
assertEquals("Invalid Client URI", ex.getMessage());
}
}
use of com.microsoft.azure.storage.blob.CloudAppendBlob in project jackrabbit-oak by apache.
the class AzureJournalReaderTest method createJournalReader.
protected JournalReader createJournalReader(String s) throws IOException {
try {
CloudAppendBlob blob = container.getAppendBlobReference("journal/journal.log.001");
blob.createOrReplace();
blob.appendText(s);
return new JournalReader(new AzureJournalFile(container.getDirectoryReference("journal"), "journal.log"));
} catch (StorageException | URISyntaxException e) {
throw new IOException(e);
}
}
use of com.microsoft.azure.storage.blob.CloudAppendBlob in project jackrabbit-oak by apache.
the class ReverseFileReaderTest method createFile.
private List<String> createFile(int lines, int maxLineLength) throws IOException, URISyntaxException, StorageException {
Random random = new Random();
List<String> entries = new ArrayList<>();
CloudAppendBlob blob = getBlob();
for (int i = 0; i < lines; i++) {
int entrySize = random.nextInt(maxLineLength) + 1;
String entry = randomString(entrySize);
try {
blob.appendText(entry + '\n');
} catch (StorageException e) {
throw new IOException(e);
}
entries.add(entry);
}
entries.add("");
Collections.reverse(entries);
return entries;
}
Aggregations