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

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


   private void listObjects() {
      System.out.format("List Objects%n");

      ObjectApi objectApi = cloudFiles.getObjectApiForRegionAndContainer(REGION, CONTAINER);
      ObjectList objects = objectApi.list(ListContainerOptions.NONE);

      for (SwiftObject object: objects) {
         System.out.format("  %s%n", object);
      }
   }
View Full Code Here


      System.out.format("List Objects With Filtering%n");

      ObjectApi objectApi = cloudFiles.getObjectApiForRegionAndContainer(REGION, CONTAINER);

      ListContainerOptions filter = ListContainerOptions.Builder.prefix("createObjectFromString");
      ObjectList objects =  objectApi.list(filter);

      for (SwiftObject object: objects) {
         System.out.format("  %s%n", object);
      }
   }
View Full Code Here

   }

   protected void deleteAllObjectsInContainer(String regionId, final String containerName) {
      Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS);
     
      ObjectList objects = api.getObjectApiForRegionAndContainer(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.getObjectApiForRegionAndContainer(regionId, containerName);
         ObjectList response = objectApi.list();
         assertEquals(response.getContainer(), api.getContainerApiForRegion(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.getObjectApiForRegionAndContainer(regionId, containerName);
         ObjectList response = objectApi.list(ListContainerOptions.NONE);
         assertEquals(response.getContainer(), api.getContainerApiForRegion(regionId).get(containerName));
         for (SwiftObject object : response) {
            checkObject(object);
         }
      }
   }
View Full Code Here

   }

   @Override
   public PageSet<? extends StorageMetadata> list(final String container, ListContainerOptions options) {
      ObjectApi objectApi = api.getObjectApi(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

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

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

         // Check MD5 is parsed from the ETag header.
         SwiftObject object1 = objects.get(1);
         assertEquals(base16().lowerCase().decode(object1.getETag()),
               object1.getPayload().getContentMetadata().getContentMD5AsHashCode().asBytes());

         assertEquals(server.getRequestCount(), 2);
         assertAuthentication(server);
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.getObjectApi("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");
      } finally {
View Full Code Here

      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(containerResponse().setBody(stringFromResource("/object_list.json"))));

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

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

   }

   public void testList() throws Exception {
      for (String regionId : regions) {
         ObjectApi objectApi = api.getObjectApi(regionId, containerName);
         ObjectList response = objectApi.list();
         assertEquals(response.getContainer(), api.getContainerApi(regionId).get(containerName));
         for (SwiftObject object : response) {
            checkObject(object);
         }
      }
   }
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.