本文整理汇总了Java中com.microsoft.azure.storage.CloudStorageAccount.getDevelopmentStorageAccount方法的典型用法代码示例。如果您正苦于以下问题:Java CloudStorageAccount.getDevelopmentStorageAccount方法的具体用法?Java CloudStorageAccount.getDevelopmentStorageAccount怎么用?Java CloudStorageAccount.getDevelopmentStorageAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.microsoft.azure.storage.CloudStorageAccount
的用法示例。
在下文中一共展示了CloudStorageAccount.getDevelopmentStorageAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createForEmulator
import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
/**
* Creates a test account that goes against the storage emulator.
*
* @return The test account, or null if the emulator isn't setup.
*/
public static AzureBlobStorageTestAccount createForEmulator()
throws Exception {
saveMetricsConfigFile();
NativeAzureFileSystem fs = null;
CloudBlobContainer container = null;
Configuration conf = createTestConfiguration();
if (!conf.getBoolean(USE_EMULATOR_PROPERTY_NAME, false)) {
// Not configured to test against the storage emulator.
System.out
.println("Skipping emulator Azure test because configuration " +
"doesn't indicate that it's running." +
" Please see RunningLiveWasbTests.txt for guidance.");
return null;
}
CloudStorageAccount account =
CloudStorageAccount.getDevelopmentStorageAccount();
fs = new NativeAzureFileSystem();
String containerName = String.format("wasbtests-%s-%tQ",
System.getProperty("user.name"), new Date());
container = account.createCloudBlobClient().getContainerReference(
containerName);
container.create();
// Set account URI and initialize Azure file system.
URI accountUri = createAccountUri(DEFAULT_STORAGE_EMULATOR_ACCOUNT_NAME,
containerName);
fs.initialize(accountUri, conf);
// Create test account initializing the appropriate member variables.
//
AzureBlobStorageTestAccount testAcct =
new AzureBlobStorageTestAccount(fs, account, container);
return testAcct;
}
示例2: connectUsingCredentials
import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
private void connectUsingCredentials(String accountName,
StorageCredentials credentials, String containerName)
throws URISyntaxException, StorageException, AzureException {
URI blobEndPoint;
if (isStorageEmulatorAccount(accountName)) {
isStorageEmulator = true;
CloudStorageAccount account =
CloudStorageAccount.getDevelopmentStorageAccount();
storageInteractionLayer.createBlobClient(account);
} else {
blobEndPoint = new URI(getHTTPScheme() + "://" +
accountName);
storageInteractionLayer.createBlobClient(blobEndPoint, credentials);
}
suppressRetryPolicyInClientIfNeeded();
// Capture the container reference for debugging purposes.
container = storageInteractionLayer.getContainerReference(containerName);
rootDirectory = container.getDirectoryReference("");
// Can only create container if using account key credentials
canCreateOrModifyContainer = credentials instanceof StorageCredentialsAccountAndKey;
// Configure Azure storage session.
configureAzureStorageSession();
}