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

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


         ObjectApi srcApi = api.objectApiInRegionForContainer(regionId, sourceContainer);
         ObjectApi destApi = api.objectApiInRegionForContainer(regionId, destinationContainer);
        
         // Create source object
         assertNotNull(srcApi.replace(sourceObject, data, ImmutableMap.<String, String> of()));
         SwiftObject object = srcApi.get(sourceObject, GetOptions.NONE);
         checkObject(object);

         // Create the destination object
         assertNotNull(destApi.replace(destinationObject, data, ImmutableMap.<String, String> of()));
         object = destApi.get(destinationObject, GetOptions.NONE);
         checkObject(destApi.get(destinationObject, GetOptions.NONE));

         // check the copy operation
         assertTrue(destApi.copy(destinationObject, sourceContainer, sourceObject));
         assertNotNull(destApi.head(destinationObject));
        
         // now get a real SwiftObject
         SwiftObject destSwiftObject = destApi.get(destinationObject, GetOptions.NONE);
         assertEquals(Strings2.toString(destSwiftObject.payload()), stringPayload);
        
         // test exception thrown on bad source name
         try {
            destApi.copy(destinationObject, badSource, sourceObject);
            fail("Expected CopyObjectException");
View Full Code Here


      assertNotNull(object.payload().getContentMetadata().getContentType());
   }

   public void metadata() throws Exception {
      for (String regionId : regions) {
         SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).head(name);
         assertEquals(object.name(), name);
         checkObject(object);
         assertEquals(toStringAndClose(object.payload().getInput()), "");
      }
   }
View Full Code Here

      }
   }

   public void get() throws Exception {
      for (String regionId : regions) {
         SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).get(name, GetOptions.NONE);
         assertEquals(object.name(), name);
         checkObject(object);
         assertEquals(toStringAndClose(object.payload().getInput()), "swifty");
      }
   }
View Full Code Here

      }
   }

   public void privateByDefault() throws Exception {
      for (String regionId : regions) {
         SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).head(name);
         try {
            object.uri().toURL().openStream();
            fail("shouldn't be able to access " + object);
         } catch (IOException expected) {
         }
      }
   }
View Full Code Here

      }
   }

   public void getOptions() throws Exception {
      for (String regionId : regions) {
         SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).get(name, tail(1));
         assertEquals(object.name(), name);
         checkObject(object);
         assertEquals(toStringAndClose(object.payload().getInput()), "y");
      }
   }
View Full Code Here

   }

   public void listOptions() throws Exception {
      String lexicographicallyBeforeName = name.substring(0, name.length() - 1);
      for (String regionId : regions) {
         SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName)
               .list(marker(lexicographicallyBeforeName)).get(0);
         assertEquals(object.name(), name);
         checkObject(object);
      }
   }
View Full Code Here

         assertTrue(objectApi.updateMetadata(name, meta));
         containerHasMetadata(objectApi, name, meta);

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

         }
      }
   }

   static void containerHasMetadata(ObjectApi objectApi, String name, Map<String, String> meta) {
      SwiftObject object = objectApi.head(name);
      for (Entry<String, String> entry : meta.entrySet()) {
         // note keys are returned in lower-case!
         assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue(), //
               object + " didn't have metadata: " + entry);
      }
   }
View Full Code Here

   private String name = getClass().getSimpleName();
   private String containerName = getClass().getSimpleName() + "Container";

   public void signForPublicAccess() throws Exception {
      for (String regionId : api.configuredRegions()) {
         SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).head(name);

         long expires = System.currentTimeMillis() / 1000 + 5;
         String signature = TemporaryUrlSigner.checkApiEvery(api.accountApiInRegion(regionId), 5) //
               .sign("GET", object.uri().getPath(), expires);

         URI signed = URI.create(format("%s?temp_url_sig=%s&temp_url_expires=%s", object.uri(), signature, expires));

         InputStream publicStream = signed.toURL().openStream();
         assertEquals(Strings2.toStringAndClose(publicStream), "swifty");

         // let it expire
View Full Code Here

      return objectApi.replace(blob.getMetadata().getName(), blob.getPayload(), blob.getMetadata().getUserMetadata());
   }

   @Override
   public BlobMetadata blobMetadata(String container, String name) {
      SwiftObject object = api.objectApiInRegionForContainer(region.getId(), container).head(name);
      if (object == null) {
         return null;
      }
      return toBlobMetadata(container).apply(object);
   }
View Full Code Here

TOP

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

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.