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

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


            .addHeader("X-Container-Read", ".r:*,.rlistings") //
            .setBody(objectList));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         ObjectList objects = api.objectApiInRegionForContainer("DFW", "myContainer").list(new ListContainerOptions());
         assertEquals(objects, parsedObjectsForUrl(server.getUrl("/").toString()));
         assertEquals(objects.container().name(), "myContainer");
         assertTrue(objects.container().anybodyRead().get());

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(),
               "GET /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/?format=json HTTP/1.1");
View Full Code Here


      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(containerResponse().setBody(objectList));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         ObjectList objects = api.objectApiInRegionForContainer("DFW", "myContainer").list(marker("test"));
         assertEquals(objects, parsedObjectsForUrl(server.getUrl("/").toString()));

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

      setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
      return props;
   }

   protected void deleteAllObjectsInContainer(String regionId, final String containerName) {
      ObjectList objects = api.objectApiInRegionForContainer(regionId, containerName).list(new ListContainerOptions());
      if (objects == null) {
         return;
      }
      List<String> pathsToDelete = Lists.transform(objects, new Function<SwiftObject, String>() {
         public String apply(SwiftObject input) {
View Full Code Here

   @Test
   public void list() throws Exception {
      for (String regionId : api.configuredRegions()) {
         ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
         ObjectList response = objectApi.list(new ListContainerOptions());
         assertEquals(response.container(), api.containerApiInRegion(regionId).get(containerName));
         assertNotNull(response);
         for (SwiftObject object : response) {
            checkObject(object);
         }
      }
View Full Code Here

   }

   @Override
   public PageSet<? extends StorageMetadata> list(final String container, ListContainerOptions options) {
      ObjectApi objectApi = api.getObjectApiForRegionAndContainer(regionId, container);
      ObjectList objects = objectApi.list(toListContainerOptions.apply(options));
      if (objects == null) {
         containerCache.put(container, Optional.<Container> absent());
         return new PageSetImpl<StorageMetadata>(ImmutableList.<StorageMetadata> of(), null);
      } else {
         containerCache.put(container, Optional.of(objects.getContainer()));
         List<? extends StorageMetadata> list = transform(objects, toBlobMetadata(container));
         int limit = Optional.fromNullable(options.getMaxResults()).or(10000);
         String marker = list.size() == limit ? list.get(limit - 1).getName() : null;
         // TODO: we should probably deprecate this option
         if (options.isDetailed()) {
View Full Code Here

   }

   protected void deleteAllObjectsInContainer(String regionId, final String containerName) {
      Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS);
     
      ObjectList objects = api.objectApiInRegionForContainer(regionId, containerName).list(new ListContainerOptions());
      if (objects == null) {
         return;
      }
      List<String> pathsToDelete = Lists.transform(objects, new Function<SwiftObject, String>() {
         public String apply(SwiftObject input) {
View Full Code Here

   }

   public void testList() throws Exception {
      for (String regionId : regions) {
         ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
         ObjectList response = objectApi.list();
         assertEquals(response.getContainer(), api.containerApiInRegion(regionId).get(containerName));
         for (SwiftObject object : response) {
            checkObject(object);
         }
      }
   }
View Full Code Here

   }

   public void testListWithOptions() throws Exception {
      for (String regionId : regions) {
         ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
         ObjectList response = objectApi.list(ListContainerOptions.NONE);
         assertEquals(response.getContainer(), api.containerApiInRegion(regionId).get(containerName));
         for (SwiftObject object : response) {
            checkObject(object);
         }
      }
   }
View Full Code Here

            .addHeader(CONTAINER_READ, CONTAINER_ACL_ANYBODY_READ)
            .setBody(stringFromResource("/object_list.json"))));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         ObjectList objects = api.objectApiInRegionForContainer("DFW", "myContainer").list();
         assertEquals(objects, parsedObjectsForUrl(server.getUrl("/").toString()));
         assertEquals(objects.getContainer().getName(), "myContainer");
         assertTrue(objects.getContainer().getAnybodyRead().get());

         assertEquals(server.getRequestCount(), 2);
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/?format=json");
      } finally {
View Full Code Here

            .addHeader(CONTAINER_READ, CONTAINER_ACL_ANYBODY_READ)
            .setBody(stringFromResource("/object_list.json"))));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         ObjectList objects = api.objectApiInRegionForContainer("DFW", "myContainer").list(new ListContainerOptions());
         assertEquals(objects, parsedObjectsForUrl(server.getUrl("/").toString()));
         assertEquals(objects.getContainer().getName(), "myContainer");
         assertTrue(objects.getContainer().getAnybodyRead().get());

         assertEquals(server.getRequestCount(), 2);
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/?format=json");
      } finally {
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.