当前位置: 首页>>代码示例>>Java>>正文


Java CloudStorageAccount.getDevelopmentStorageAccount方法代码示例

本文整理汇总了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;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:AzureBlobStorageTestAccount.java

示例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();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:28,代码来源:AzureNativeFileSystemStore.java


注:本文中的com.microsoft.azure.storage.CloudStorageAccount.getDevelopmentStorageAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。