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

Examples of org.jclouds.openstack.swift.v1.domain.Container.metadata()


   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);
      }
   }

   @Override
View Full Code Here


         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         SwiftObject object = api.objectApiInRegionForContainer("DFW", "myContainer").head("myObject");
         assertEquals(object.name(), "myObject");
         assertEquals(object.etag(), "8a964ee2a5e88be344f36c22562a6486");
         assertEquals(object.lastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
         for (Entry<String, String> entry : object.metadata().entrySet()) {
            assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
         }
         assertEquals(object.payload().getContentMetadata().getContentLength(), new Long(4));
         assertEquals(object.payload().getContentMetadata().getContentType(), "text/plain; charset=UTF-8");
         assertEquals(Strings2.toStringAndClose(object.payload().getInput()), "");
View Full Code Here

         SwiftObject object = api.objectApiInRegionForContainer("DFW", "myContainer").head("myObject");
         assertEquals(object.name(), "myObject");
         assertEquals(object.etag(), "8a964ee2a5e88be344f36c22562a6486");
         assertEquals(object.lastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
         for (Entry<String, String> entry : object.metadata().entrySet()) {
            assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
         }
         assertEquals(object.payload().getContentMetadata().getContentLength(), new Long(4));
         assertEquals(object.payload().getContentMetadata().getContentType(), "text/plain; charset=UTF-8");
         assertEquals(Strings2.toStringAndClose(object.payload().getInput()), "");
View Full Code Here

         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         SwiftObject object = api.objectApiInRegionForContainer("DFW", "myContainer").get("myObject", tail(1));
         assertEquals(object.name(), "myObject");
         assertEquals(object.etag(), "8a964ee2a5e88be344f36c22562a6486");
         assertEquals(object.lastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
         for (Entry<String, String> entry : object.metadata().entrySet()) {
            assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
         }
         assertEquals(object.payload().getContentMetadata().getContentLength(), new Long(4));
         assertEquals(object.payload().getContentMetadata().getContentType(), "text/plain; charset=UTF-8");
         // note MWS doesn't process Range header at the moment
View Full Code Here

         SwiftObject object = api.objectApiInRegionForContainer("DFW", "myContainer").get("myObject", tail(1));
         assertEquals(object.name(), "myObject");
         assertEquals(object.etag(), "8a964ee2a5e88be344f36c22562a6486");
         assertEquals(object.lastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
         for (Entry<String, String> entry : object.metadata().entrySet()) {
            assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
         }
         assertEquals(object.payload().getContentMetadata().getContentLength(), new Long(4));
         assertEquals(object.payload().getContentMetadata().getContentType(), "text/plain; charset=UTF-8");
         // note MWS doesn't process Range header at the moment
         assertEquals(Strings2.toStringAndClose(object.payload().getInput()), "ABCD");
View Full Code Here

         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()));
         }
      }
   }

   static void containerHasMetadata(ObjectApi objectApi, String name, Map<String, String> meta) {
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);
      }
   }

   @Override
View Full Code Here

         assertNotNull(etagOfEtags);

         SwiftObject bigObject = api.objectApiInRegionForContainer(regionId, containerName).head(name);
         assertNotEquals(bigObject.etag(), etagOfEtags);
         assertEquals(bigObject.payload().getContentMetadata().getContentLength(), new Long(2 * 1024 * 1024));
         assertEquals(bigObject.metadata(), ImmutableMap.of("myfoo", "Bar"));

         // segments are visible
         assertEquals(api.containerApiInRegion(regionId).get(containerName).objectCount(), 3);
      }
   }
View Full Code Here

      to.etag(from.getETag());
      to.lastModified(from.getLastModified());
      long bytes = from.getContentMetadata().getContentLength();
      String contentType = from.getContentMetadata().getContentType();
      to.payload(payload(bytes, contentType));
      to.metadata(from.getUserMetadata());
      return to.build();
   }

   private static final byte[] NO_CONTENT = new byte[] {};
View Full Code Here

      to.etag(from.getETag());
      to.lastModified(from.getLastModified());
      long bytes = from.getContentMetadata().getContentLength();
      String contentType = from.getContentMetadata().getContentType();
      to.payload(payload(bytes, contentType));
      to.metadata(from.getUserMetadata());
      return to.build();
   }

   private static Payload payload(long bytes, String contentType) {
      Payload payload = Payloads.newByteSourcePayload(ByteSource.empty());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.