public void testSignPutBlob()
      throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
          NoSuchMethodException, IOException {
    Blob blob = blobFactory.create(null);
    blob.getMetadata().setName("name");
    blob.setPayload("");
    blob.getPayload().getContentMetadata().setContentLength(2l);
    blob.getPayload().getContentMetadata().setContentMD5(new byte[] {0, 2, 4, 8});
    blob.getPayload().getContentMetadata().setContentType("text/plain");

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

    assertRequestLineEquals(request, "PUT http://storageUrl/container/name HTTP/1.1");
    assertNonPayloadHeadersEqual(request, "X-Auth-Token: testtoken\n");
    assertContentHeadersEqual(
        request, "text/plain", null, null, null, (long) 2l, new byte[] {0, 2, 4, 8});

    assertEquals(request.getFilters().size(), 0);
  }
Ejemplo n.º 2
0
  public void testSignPutBlob()
      throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
          NoSuchMethodException, IOException {
    Blob blob = blobFactory.create(null);
    blob.getMetadata().setName("name");
    blob.setPayload("");
    blob.getPayload().getContentMetadata().setContentLength(2l);
    blob.getPayload().getContentMetadata().setContentMD5(new byte[] {0, 2, 4, 8});
    blob.getPayload().getContentMetadata().setContentType("text/plain");

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

    assertRequestLineEquals(
        request, "POST https://accesspoint.atmosonline.com/rest/namespace/container/name HTTP/1.1");
    assertNonPayloadHeadersEqual(
        request,
        "Accept: */*\nDate: Thu, 05 Jun 2008 16:38:19 GMT\nx-emc-signature: aLpB1oQaCA27AXT6Nzam7s0f0pI=\nx-emc-uid: identity\n");

    assertContentHeadersEqual(
        request, "text/plain", null, null, null, (long) 2l, new byte[] {0, 2, 4, 8});

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