Package org.jclouds.nirvanix.sdn.domain

Examples of org.jclouds.nirvanix.sdn.domain.UploadInfo


   public void testApplyInputStreamDetails() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/authtoken.json");

      ParseUploadInfoFromJsonResponse parser = i.getInstance(ParseUploadInfoFromJsonResponse.class);
      UploadInfo response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
      assertEquals(response.getHost(), URI.create("https://node1.nirvanix.com"));
      assertEquals(response.getToken(), "siR-ALYd~BEcJ8GR2tE~oX3SEHO8~2WXKT5xjFk~YLS5OvJyHI21TN34rQ");
   }
View Full Code Here


   public void testUploadToken() throws InterruptedException, ExecutionException, TimeoutException, IOException {
      String containerName = containerPrefix + ".testObjectOperations";
      long size = 1024;

      UploadInfo uploadInfo = connection.getStorageNode(containerName, size);
      assertNotNull(uploadInfo.getHost());
      assertNotNull(uploadInfo.getToken());

      Blob blob = connection.newBlob();
      blob.getMetadata().setName("test.txt");
      blob.setPayload("value");
      Payloads.calculateMD5(blob);

      byte[] md5 = blob.getMetadata().getContentMetadata().getContentMD5();
      connection.upload(uploadInfo.getHost(), uploadInfo.getToken(), containerName, blob);

      Map<String, String> metadata = connection.getMetadata(containerName + "/test.txt");
      assertEquals(metadata.get("MD5"), Base64.encodeBytes(md5));

      String content = connection.getFile(containerName + "/test.txt");
View Full Code Here

   public UploadInfo apply(HttpResponse arg0) {
      Response response = json.apply(arg0);
      if (response.ResponseCode == null || response.ResponseCode != 0)
         throw new RuntimeException("bad response code: "
               + response.ResponseCode);
      return new UploadInfo(response.GetStorageNode.get("UploadToken"), URI
            .create("https://" + response.GetStorageNode.get("UploadHost")));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.nirvanix.sdn.domain.UploadInfo

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.