Package org.jclouds.http.options

Examples of org.jclouds.http.options.GetOptions


   public void testRanges() {
      org.jclouds.blobstore.options.GetOptions in = new org.jclouds.blobstore.options.GetOptions();
      in.range(0,1024);
      in.startAt(2048);
     
      GetOptions expected = new GetOptions();
      expected.range(0,1024);
      expected.startAt(2048);

      assertEquals(fn.apply(in), expected);

   }


   @Test
   public void testRangesTail() {
      org.jclouds.blobstore.options.GetOptions in = new org.jclouds.blobstore.options.GetOptions();
      in.tail(1024);

      GetOptions expected = new GetOptions();
      expected.tail(1024);

      assertEquals(fn.apply(in), expected);

   }

   @Test
   public void testRangesStart() {
      org.jclouds.blobstore.options.GetOptions in = new org.jclouds.blobstore.options.GetOptions();
      in.startAt(1024);

      GetOptions expected = new GetOptions();
      expected.startAt(1024);

      assertEquals(fn.apply(in), expected);

   }

    * @param key
    *           blob key
    */
   @Override
   public Blob getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
      GetOptions azureOptions = blob2ObjectGetOptions.apply(options);
      return azureBlob2Blob.apply(sync.getBlob(container, key, azureOptions));

   }

    * @param key
    *           blob key
    */
   @Override
   public ListenableFuture<Blob> getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
      GetOptions azureOptions = blob2ObjectGetOptions.apply(options);
      ListenableFuture<AzureBlob> returnVal = async.getBlob(container, key, azureOptions);
      return transform(returnVal, azureBlob2Blob, userExecutor);
   }

   @Test
   void testOneRange() {
      BlobToHttpGetOptions converter = new BlobToHttpGetOptions();
      org.jclouds.blobstore.options.GetOptions blobGet = new org.jclouds.blobstore.options.GetOptions()
            .range(2, 5);
      GetOptions httpGet = converter.apply(blobGet);
      assertEquals(httpGet.buildRequestHeaders().get("Range"), ImmutableSet
            .of("bytes=2-5"));

   }

   /**
    * This implementation invokes {@link AtmosClient#readFile}
    */
   @Override
   public Blob getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
      GetOptions httpOptions = blob2ObjectGetOptions.apply(options);
      return object2Blob.apply(sync.readFile(container + "/" + key, httpOptions));
   }

   /**
    * This implementation invokes {@link AtmosAsyncClient#readFile}
    */
   @Override
   public ListenableFuture<Blob> getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
      GetOptions httpOptions = blob2ObjectGetOptions.apply(options);
      ListenableFuture<AtmosObject> returnVal = async.readFile(container + "/" + key, httpOptions);
      return transform(returnVal, object2Blob, userExecutor);
   }

    * @param key
    *           object key
    */
   @Override
   public ListenableFuture<Blob> getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
      GetOptions httpOptions = blob2ObjectGetOptions.apply(options);
      return transform(async.getObject(container, key, httpOptions), object2Blob, userExecutor);
   }

    * @param key
    *           object key
    */
   @Override
   public Blob getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions optionsList) {
      GetOptions httpOptions = blob2ObjectGetOptions.apply(optionsList);
      return object2Blob.apply(sync.getObject(container, key, httpOptions));
   }

TOP

Related Classes of org.jclouds.http.options.GetOptions

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.