Package org.jclouds.openstack.swift.v1.domain

Examples of org.jclouds.openstack.swift.v1.domain.ObjectList


   @Test
   public void testGetAccountMetadata() throws Exception {
      for (String regionId : api.getConfiguredRegions()) {
         AccountApi accountApi = api.getAccountApiForRegion(regionId);
         Account account = accountApi.get();
         assertNotNull(account);
         assertTrue(account.getContainerCount() >= 0);
         assertTrue(account.getBytesUsed() >= 0);
      }
   }
View Full Code Here


public class AccountApiLiveTest extends BaseSwiftApiLiveTest {

   public void get() throws Exception {
      for (String regionId : regions) {
         AccountApi accountApi = api.accountApiInRegion(regionId);
         Account account = accountApi.get();

         assertNotNull(account);
         assertTrue(account.containerCount() >= 0);
         assertTrue(account.objectCount() >= 0);
         assertTrue(account.bytesUsed() >= 0);
      }
   }
View Full Code Here

         assertTrue(accountApi.updateMetadata(meta));
         accountHasMetadata(accountApi, meta);

         assertTrue(accountApi.deleteMetadata(meta));
         Account account = accountApi.get();
         for (Entry<String, String> entry : meta.entrySet()) {
            // note keys are returned in lower-case!
            assertFalse(account.metadata().containsKey(entry.getKey().toLowerCase()));
         }
      }
   }
View Full Code Here

         }
      }
   }

   static void accountHasMetadata(AccountApi accountApi, Map<String, String> meta) {
      Account account = accountApi.get();
      for (Entry<String, String> entry : meta.entrySet()) {
         // note keys are returned in lower-case!
         assertEquals(account.metadata().get(entry.getKey().toLowerCase()), entry.getValue(), //
               account + " didn't have metadata: " + entry);
      }
   }
View Full Code Here

            .addHeader("X-Account-Meta-Apiname", "swift") //
            .addHeader("X-Account-Meta-Apiversion", "v1.1")));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         Account account = api.accountApiInRegion("DFW").get();
         assertEquals(account.containerCount(), 3l);
         assertEquals(account.objectCount(), 42l);
         assertEquals(account.bytesUsed(), 323479l);
         for (Entry<String, String> entry : metadata.entrySet()) {
            assertEquals(account.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
         }

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(),
View Full Code Here

   private String containerName = getClass().getSimpleName();

   public void notPresentWhenDeleting() throws Exception {
      for (String regionId : regions) {
         BulkDeleteResponse deleteResponse = api.bulkApiInRegion(regionId).bulkDelete(
               ImmutableList.of(UUID.randomUUID().toString()));
         assertEquals(deleteResponse.deleted(), 0);
         assertEquals(deleteResponse.notFound(), 1);
         assertTrue(deleteResponse.errors().isEmpty());
      }
   }
View Full Code Here

   }

   @Test(dependsOnMethods = "extractArchive")
   public void bulkDelete() throws Exception {
      for (String regionId : regions) {
         BulkDeleteResponse deleteResponse = api.bulkApiInRegion(regionId).bulkDelete(paths);
         assertEquals(deleteResponse.deleted(), OBJECT_COUNT);
         assertEquals(deleteResponse.notFound(), 0);
         assertTrue(deleteResponse.errors().isEmpty());
         assertEquals(api.containerApiInRegion(regionId).get(containerName).objectCount(), 0);
      }
   }
View Full Code Here

         public String apply(SwiftObject input) {
            return containerName + "/" + input.name();
         }
      });
      if (!pathsToDelete.isEmpty()) {
         BulkDeleteResponse response = api.bulkApiInRegion(regionId).bulkDelete(pathsToDelete);
         checkState(response.errors().isEmpty(), "Errors deleting paths %s: %s", pathsToDelete, response);
      }
   }
View Full Code Here

            .addHeader("X-Container-Meta-Apiname", "swift") //
            .addHeader("X-Container-Meta-Apiversion", "v1.1")));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         Container container = api.containerApiInRegion("DFW").get("myContainer");
         assertEquals(container.name(), "myContainer");
         assertEquals(container.objectCount(), 42l);
         assertEquals(container.bytesUsed(), 323479l);
         for (Entry<String, String> entry : container.metadata().entrySet()) {
            assertEquals(container.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
         }

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(),
View Full Code Here

      }
   }

   public void get() throws Exception {
      for (String regionId : regions) {
         Container container = api.containerApiInRegion(regionId).get(name);
         assertEquals(container.name(), name);
         assertTrue(container.objectCount() == 0);
         assertTrue(container.bytesUsed() == 0);
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.swift.v1.domain.ObjectList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.