コード例 #1
0
  @BeforeGroups(groups = {"live"})
  public void setupClient() throws InterruptedException, ExecutionException, TimeoutException {
    String uid = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
    String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");

    RestContext<AtmosStorageAsyncClient, AtmosStorageClient> context =
        new AtmosStorageContextBuilder(new AtmosStoragePropertiesBuilder(uid, key).build())
            .withModules(new Log4JLoggingModule())
            .buildContext();
    connection = context.getApi();
    ClearContainerStrategy clearer = new RecursiveRemove(context.getAsyncApi(), connection);
    for (DirectoryEntry entry : connection.listDirectories()) {
      if (entry.getObjectName().startsWith(containerPrefix)) {
        clearer.execute(entry.getObjectName());
        deleteConfirmed(entry.getObjectName());
      }
    }
  }
コード例 #2
0
 @Test(timeOut = 5 * 60 * 1000)
 public void testCreateDirectory() throws Exception {
   boolean created = false;
   while (!created) {
     privateDirectory = containerPrefix + new SecureRandom().nextInt();
     try {
       created = connection.createDirectory(privateDirectory) != null;
     } catch (UndeclaredThrowableException e) {
       HttpResponseException htpe = (HttpResponseException) e.getCause().getCause();
       if (htpe.getResponse().getStatusCode() == 409) continue;
       throw e;
     }
   }
   BoundedSortedSet<? extends DirectoryEntry> response = connection.listDirectories();
   for (DirectoryEntry id : response) {
     BoundedSortedSet<? extends DirectoryEntry> r2 = connection.listDirectory(id.getObjectName());
     assert r2 != null;
   }
 }