Package org.jclouds.io.payloads

Examples of org.jclouds.io.payloads.StringPayload


      server.play();

      HttpClient client =  api(HttpClient.class, server.getUrl("/").toString());

      // Make a fake payload that has no data, but says there's a lot!
      Payload fakePayload = new StringPayload("");
      fakePayload.getContentMetadata().setContentLength(reallyLongContent);

      try {
         try {
            client.post(server.getUrl("/").toURI(), fakePayload);
            fail("Should have errored since we didn't sent that much data!");
View Full Code Here


   }

   public void testUploadContent() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(ChefApi.class, "uploadContent", URI.class, Payload.class);
      GeneratedHttpRequest httpRequest = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(URI.create("http://foo/bar"), new StringPayload("{\"foo\": \"bar\"}"))));
      assertRequestLineEquals(httpRequest, "PUT http://foo/bar HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: " + ChefApiMetadata.DEFAULT_API_VERSION
            + "-test\n");
      assertPayloadEquals(httpRequest, "{\"foo\": \"bar\"}", "application/x-binary", false);
View Full Code Here

TOP

Related Classes of org.jclouds.io.payloads.StringPayload

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.