Package org.jclouds.atmos.domain

Examples of org.jclouds.atmos.domain.SystemMetadata


         String[] entrySplit = entry.split("=");
         metaMap.put(entrySplit[0], entrySplit[1]);
      }
      assert metaMap.size() >= 12 : String.format("Should be 12 entries in %s", metaMap);
      byte[] md5 = metaMap.containsKey("content-md5") ? base16().lowerCase().decode(metaMap.get("content-md5")) : null;
      return new SystemMetadata(md5, dateService.iso8601SecondsDateParse(checkNotNull(metaMap.get("atime"), "atime")),
            dateService.iso8601SecondsDateParse(checkNotNull(metaMap.get("ctime"), "ctime")), checkNotNull(
                  metaMap.get("gid"), "gid"), dateService.iso8601SecondsDateParse(checkNotNull(metaMap.get("itime"),
                  "itime")), dateService.iso8601SecondsDateParse(checkNotNull(metaMap.get("mtime"), "mtime")),
            Integer.parseInt(checkNotNull(metaMap.get("nlink"), "nlink")), checkNotNull(metaMap.get("objectid"),
                  "objectid"), checkNotNull(metaMap.get("objname"), "objname"), checkNotNull(metaMap.get("policyname"),
View Full Code Here


   }

   @Test
   public void testCorrectSystemMetadataObjectName() throws SecurityException, NoSuchMethodException {

      AtmosObject blob = BLOB_FACTORY.create(new SystemMetadata(null, null, null, null, null, null, 0, null, "foo",
            null, 0, null, null), new UserMetadata());
      assertEquals(fn.apply(blob), "foo");
   }
View Full Code Here

   );

   public void test() {
      ParseSystemMetadataFromHeaders parser = Guice.createInjector().getInstance(ParseSystemMetadataFromHeaders.class);

      SystemMetadata data = parser.apply(ParseObjectFromHeadersAndHttpContentTest.RESPONSE);

      assertEquals(data, EXPECTED);
   }
View Full Code Here

   private static void verifyMetadata(String metadataValue, AtmosObject getBlob) {
      assertEquals(getBlob.getContentMetadata().getContentLength(), Long.valueOf(16));
      assert getBlob.getContentMetadata().getContentType().startsWith("text/plain");
      assertEquals(getBlob.getUserMetadata().getMetadata().get("Metadata"), metadataValue);
      SystemMetadata md = getBlob.getSystemMetadata();
      assertEquals(md.getSize(), 16);
      assert md.getGroupID() != null;
      assertEquals(md.getHardLinkCount(), 1);
      assert md.getInceptionTime() != null;
      assert md.getLastAccessTime() != null;
      assert md.getLastMetadataModification() != null;
      assert md.getLastUserDataModification() != null;
      assert md.getObjectID() != null;
      assertEquals(md.getObjectName(), "object");
      assert md.getPolicyName() != null;
      assertEquals(md.getType(), FileType.REGULAR);
      assert md.getUserID() != null;

      try {
         Strings2.toStringAndClose(URI.create(
                  "http://accesspoint.emccis.com/rest/objects/" + getBlob.getSystemMetadata().getObjectID()).toURL()
                  .openStream());
View Full Code Here

   private static void verifyMetadata(String metadataValue, AtmosObject getBlob) {
      assertEquals(getBlob.getContentMetadata().getContentLength(), Long.valueOf(16));
      assert getBlob.getContentMetadata().getContentType().startsWith("text/plain");
      assertEquals(getBlob.getUserMetadata().getMetadata().get("Metadata"), metadataValue);
      SystemMetadata md = getBlob.getSystemMetadata();
      assertEquals(md.getSize(), 16);
      assert md.getGroupID() != null;
      assertEquals(md.getHardLinkCount(), 1);
      assert md.getInceptionTime() != null;
      assert md.getLastAccessTime() != null;
      assert md.getLastMetadataModification() != null;
      assert md.getLastUserDataModification() != null;
      assert md.getObjectID() != null;
      assertEquals(md.getObjectName(), "object");
      assert md.getPolicyName() != null;
      assertEquals(md.getType(), FileType.REGULAR);
      assert md.getUserID() != null;

      try {
         Strings2.toStringAndClose(URI.create(
                  "http://accesspoint.emccis.com/rest/objects/" + getBlob.getSystemMetadata().getObjectID()).toURL()
                  .openStream());
View Full Code Here

   }

   @Test
   public void testCorrectSystemMetadataObjectName() throws SecurityException, NoSuchMethodException {

      AtmosObject blob = BLOB_FACTORY.create(new SystemMetadata(null, null, null, null, null, null, 0, null, "foo",
            null, 0, null, null), new UserMetadata());
      assertEquals(fn.apply(blob), "foo");
   }
View Full Code Here

   );

   public void test() {
      ParseSystemMetadataFromHeaders parser = Guice.createInjector().getInstance(ParseSystemMetadataFromHeaders.class);

      SystemMetadata data = parser.apply(ParseObjectFromHeadersAndHttpContentTest.RESPONSE);

      assertEquals(data, EXPECTED);
   }
View Full Code Here

import com.google.common.base.Function;

@Singleton
public class BlobToSystemMetadata implements Function<BlobMetadata, SystemMetadata> {
   public SystemMetadata apply(BlobMetadata base) {
      return new SystemMetadata(base.getContentMetadata().getContentMD5(), null, base.getLastModified(), null, null,
               null, 1, null, base.getName(), null, (base.getContentMetadata().getContentLength() != null) ? base
                        .getContentMetadata().getContentLength() : 0, FileType.REGULAR, "root");
   }
View Full Code Here

      checkNotNull(from, "http response");
      String meta = checkNotNull(from.getFirstHeaderOrNull(AtmosHeaders.META), AtmosHeaders.META);
      Map<String, String> metaMap = Splitter.on(", ").withKeyValueSeparator('=').split(meta);
      assert metaMap.size() >= 12 : String.format("Should be 12 entries in %s", metaMap);
      byte[] md5 = metaMap.containsKey("content-md5") ? base16().lowerCase().decode(metaMap.get("content-md5")) : null;
      return new SystemMetadata(md5, dateService.iso8601SecondsDateParse(checkNotNull(metaMap.get("atime"), "atime")),
            dateService.iso8601SecondsDateParse(checkNotNull(metaMap.get("ctime"), "ctime")), checkNotNull(
                  metaMap.get("gid"), "gid"), dateService.iso8601SecondsDateParse(checkNotNull(metaMap.get("itime"),
                  "itime")), dateService.iso8601SecondsDateParse(checkNotNull(metaMap.get("mtime"), "mtime")),
            Integer.parseInt(checkNotNull(metaMap.get("nlink"), "nlink")), checkNotNull(metaMap.get("objectid"),
                  "objectid"), checkNotNull(metaMap.get("objname"), "objname"), checkNotNull(metaMap.get("policyname"),
View Full Code Here

TOP

Related Classes of org.jclouds.atmos.domain.SystemMetadata

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.