Package com.google.common.hash

Examples of com.google.common.hash.HashCode


      assertEquals(removeBlob.getContext().getSigner().signRemoveBlob(container, name), removeBlob());
   }

   @Test
   public void testSignPutBlob() throws Exception {
      HashCode hashCode = HashCode.fromBytes(new byte[16]);
      BlobStore signPutBlob = requestsSendResponses(init());
      Blob blob = signPutBlob.blobBuilder("name").forSigning().contentLength(2l).contentMD5(hashCode)
            .contentType("text/plain").expires(new Date(1000)).build();
      HttpRequest compare = putBlob();
      compare.setPayload(blob.getPayload());
View Full Code Here


      assertEquals(request.getFilters().size(), 0);
   }

   public void testSignPutBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
            NoSuchMethodException, IOException {
      HashCode hashCode = HashCode.fromBytes(new byte[16]);
      Blob blob = blobFactory.get().name(blobName).forSigning().contentLength(2l).contentMD5(hashCode)
               .contentType("text/plain").build();

      assertEquals(blob.getPayload().getContentMetadata().getContentMD5AsHashCode(), hashCode);

      HttpRequest request = signer.signPutBlob(containerName, blob);

      assertRequestLineEquals(request, "PUT " + fullUrl + " HTTP/1.1");
      assertNonPayloadHeadersEqual(
               request,
               "Authorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\n" +
               "Content-Length: 2\n" +
               "Content-MD5: AAAAAAAAAAAAAAAAAAAAAA==\n" +
               "Content-Type: text/plain\n");
      assertContentHeadersEqual(request, "text/plain", null, null, null, 2L, hashCode.asBytes(), null);

      assertEquals(request.getFilters().size(), 0);
   }
View Full Code Here

   public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception {
      super.setUpResourcesOnThisThread(testContext);
   }

   public void testMultipartSynchronously() throws InterruptedException, IOException {
      HashCode oneHundredOneConstitutionsMD5 = oneHundredOneConstitutions.hash(md5());
      String containerName = getContainerName();
      S3Object object = null;
      try {
         String key = "constitution.txt";
         String uploadId = getApi().initiateMultipartUpload(containerName,
                  ObjectMetadataBuilder.create().key(key).contentMD5(oneHundredOneConstitutionsMD5.asBytes()).build());
         byte[] buffer = oneHundredOneConstitutions.read();
         assertEquals(oneHundredOneConstitutions.size(), (long) buffer.length);

         Payload part1 = newByteArrayPayload(buffer);
         part1.getContentMetadata().setContentLength((long) buffer.length);
View Full Code Here

      assertEquals(request.getFilters().size(), 0);
   }

   public void testSignPutBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
            NoSuchMethodException, IOException {
      HashCode hashCode = HashCode.fromBytes(new byte[16]);
      Blob blob = blobFactory.create(null);
      blob.getMetadata().setName("name");
      blob.setPayload("");
      blob.getPayload().getContentMetadata().setContentLength(2l);
      blob.getPayload().getContentMetadata().setContentMD5(hashCode);
      blob.getPayload().getContentMetadata().setContentType("text/plain");
      blob.getPayload().getContentMetadata().setExpires(new Date(1000));

      HttpRequest request = signer.signPutBlob("container", blob);

      assertRequestLineEquals(request, "PUT https://identity.blob.core.windows.net/container/name HTTP/1.1");
      assertNonPayloadHeadersEqual(
               request,
               "Authorization: SharedKeyLite identity:V0gyrdMZzwQrCvxEfq6eBe8PL233yJ91+aNcISEzjfE=\n" +
               "Date: Thu, 05 Jun 2008 16:38:19 GMT\n" +
               "Expect: 100-continue\n" +
               "x-ms-blob-type: BlockBlob\n" +
               "x-ms-version: 2012-02-12\n");
      assertContentHeadersEqual(request, "text/plain", null, null, null, 2L, hashCode.asBytes(), new Date(1000));

      assertEquals(request.getFilters().size(), 0);
   }
View Full Code Here

TOP

Related Classes of com.google.common.hash.HashCode

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.