Examples of AtmosObject


Examples of org.jclouds.atmos.domain.AtmosObject

      return stream ? Strings2.toInputStream(in) : in;
   }

   private void createOrReplaceObject(String name, Object data, String metadataValue) throws Exception {
      // Test PUT with string data, ETag hash, and a piece of metadata
      AtmosObject object = getApi().newObject();
      object.getContentMetadata().setName(name);
      object.setPayload(Payloads.newPayload(data));
      object.getContentMetadata().setContentLength(16l);
      Payloads.calculateMD5(object);
      object.getContentMetadata().setContentType("text/plain");
      object.getUserMetadata().getMetadata().put("Metadata", metadataValue);
      replaceObject(object);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      assertEventually(new HeadMatches(getApi(), privateDirectory + "/" + name, metadataValue));
   }

   private static void verifyHeadObject(AtmosClient connection, String path, String metadataValue)
            throws InterruptedException, ExecutionException, TimeoutException, IOException {
      AtmosObject getBlob = connection.headFile(path);
      assertEquals(Strings2.toString(getBlob.getPayload()), "");
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      verifyMetadata(metadataValue, getBlob);
   }

   private static void verifyObject(AtmosClient connection, String path, String compare, String metadataValue)
            throws InterruptedException, ExecutionException, TimeoutException, IOException {
      AtmosObject getBlob = connection.readFile(path);
      assertEquals(Strings2.toString(getBlob.getPayload()), compare);
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

public class BindMetadataToHeadersTest {
   Injector injector = Guice.createInjector();
   BindMetadataToHeaders binder = injector.getInstance(BindMetadataToHeaders.class);

   public void testGood() {
      AtmosObject object = injector.getInstance(AtmosObject.Factory.class).create(null);
      Payload payload = Payloads.newStringPayload("");
      object.setPayload(payload);
      object.getUserMetadata().getListableMetadata().put("apple", "bear");
      object.getUserMetadata().getListableMetadata().put("sushi", "king");
      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://localhost").build();
      request = binder.bindToRequest(request, object);
      assertEquals(request.getFirstHeaderOrNull("x-emc-listable-meta"), "apple=bear,sushi=king");
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      binder.bindToRequest(request, null);
   }

   @Test(expectedExceptions = NullPointerException.class)
   public void testNullPayloadIsBad() {
      AtmosObject object = injector.getInstance(AtmosObject.Factory.class).create(null);
      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://localhost").build();
      binder.bindToRequest(request, object);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      }
   }

   @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testFileOperations" })
   public void testPutZeroLengthBlob() throws Exception {
      AtmosObject object = getApi().newObject();
      object.getContentMetadata().setName("object");
      byte[] payload = new byte[0];
      object.setPayload(Payloads.newPayload(payload));
      object.getContentMetadata().setContentLength(Long.valueOf(payload.length));
      replaceObject(object);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      binder.bindToRequest(request, object);
   }
  
   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testNullContentLengthIllegal() {
      AtmosObject object = injector.getInstance(AtmosObject.Factory.class).create(null);
      Payload payload = Payloads.newStringPayload("");
      payload.getContentMetadata().setContentLength(null);
      object.setPayload(payload);
      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://localhost").build();
      binder.bindToRequest(request, object);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      return stream ? Strings2.toInputStream(in) : in;
   }

   private void createOrReplaceObject(String name, Object data, String metadataValue) throws Exception {
      // Test PUT with string data, ETag hash, and a piece of metadata
      AtmosObject object = getApi().newObject();
      object.getContentMetadata().setName(name);
      object.setPayload(Payloads.newPayload(data));
      object.getContentMetadata().setContentLength(16l);
      Payloads.calculateMD5(object);
      object.getContentMetadata().setContentType("text/plain");
      object.getUserMetadata().getMetadata().put("Metadata", metadataValue);
      replaceObject(object);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      assertEventually(new HeadMatches(getApi(), privateDirectory + "/" + name, metadataValue));
   }

   private static void verifyHeadObject(AtmosClient connection, String path, String metadataValue)
            throws InterruptedException, ExecutionException, TimeoutException, IOException {
      AtmosObject getBlob = connection.headFile(path);
      assertEquals(Strings2.toString(getBlob.getPayload()), "");
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      verifyMetadata(metadataValue, getBlob);
   }

   private static void verifyObject(AtmosClient connection, String path, String compare, String metadataValue)
            throws InterruptedException, ExecutionException, TimeoutException, IOException {
      AtmosObject getBlob = connection.readFile(path);
      assertEquals(Strings2.toString(getBlob.getPayload()), compare);
      verifyMetadata(metadataValue, getBlob);
   }
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.