Package com.google.mockwebserver

Examples of com.google.mockwebserver.MockWebServer.takeRequest()


      try {
         assertEquals(api.execute("container", new BlobBuilderImpl().name("foo").payload(bytes).build()), "fff");
      } finally {

         RecordedRequest initiate = server.takeRequest();
         assertEquals(initiate.getRequestLine(), "POST /container/foo?uploads HTTP/1.1");
         assertEquals(initiate.getHeader("Content-Length"), "0");

         RecordedRequest part1 = server.takeRequest();
         assertEquals(part1.getRequestLine(), "PUT /container/foo?partNumber=1&uploadId=upload-id HTTP/1.1");
View Full Code Here


         RecordedRequest initiate = server.takeRequest();
         assertEquals(initiate.getRequestLine(), "POST /container/foo?uploads HTTP/1.1");
         assertEquals(initiate.getHeader("Content-Length"), "0");

         RecordedRequest part1 = server.takeRequest();
         assertEquals(part1.getRequestLine(), "PUT /container/foo?partNumber=1&uploadId=upload-id HTTP/1.1");
         assertEquals(part1.getHeader("Content-Length"), String.valueOf(partSize));
         assertEquals(new String(part1.getBody()), "01234567");

         RecordedRequest abort = server.takeRequest();
View Full Code Here

         RecordedRequest part1 = server.takeRequest();
         assertEquals(part1.getRequestLine(), "PUT /container/foo?partNumber=1&uploadId=upload-id HTTP/1.1");
         assertEquals(part1.getHeader("Content-Length"), String.valueOf(partSize));
         assertEquals(new String(part1.getBody()), "01234567");

         RecordedRequest abort = server.takeRequest();
         assertEquals(abort.getRequestLine(), "DELETE /container/foo?uploadId=upload-id HTTP/1.1");

         server.shutdown();
      }
   }
View Full Code Here

      TerremarkECloudClient api = mockTerremarkECloudClient(url.get().toString());

      try {
         api.listOrgs();
      } finally {
         RecordedRequest getVersions = server.takeRequest();
         assertEquals(getVersions.getRequestLine(), "GET /versions HTTP/1.1");

         RecordedRequest login = server.takeRequest();
         assertEquals(login.getRequestLine(), "POST /v0.8/login HTTP/1.1");
         assertEquals(login.getHeader("Authorization"), "Basic dXNlcjpwYXNzd29yZA==");
View Full Code Here

         api.listOrgs();
      } finally {
         RecordedRequest getVersions = server.takeRequest();
         assertEquals(getVersions.getRequestLine(), "GET /versions HTTP/1.1");

         RecordedRequest login = server.takeRequest();
         assertEquals(login.getRequestLine(), "POST /v0.8/login HTTP/1.1");
         assertEquals(login.getHeader("Authorization"), "Basic dXNlcjpwYXNzd29yZA==");
         assertEquals(login.getHeader("Content-Length"), "0");

         server.shutdown();
View Full Code Here

      SequentialMultipartUploadStrategy api = mockSequentialMultipartUploadStrategy(url.get().toString(), partSize);

      try {
         assertEquals(api.execute("container", new BlobBuilderImpl().name("foo").payload(bytes).build()), "fff");
      } finally {
         RecordedRequest authRequest = server.takeRequest();
         assertEquals(authRequest.getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(new String(authRequest.getBody()), authRequestBody);
         assertEquals(authRequest.getHeader("Content-Length"), String.valueOf(authRequestBody.length()));

         RecordedRequest part1 = server.takeRequest();
View Full Code Here

         RecordedRequest authRequest = server.takeRequest();
         assertEquals(authRequest.getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(new String(authRequest.getBody()), authRequestBody);
         assertEquals(authRequest.getHeader("Content-Length"), String.valueOf(authRequestBody.length()));

         RecordedRequest part1 = server.takeRequest();
         assertEquals(part1.getRequestLine(), "PUT /container/foo/1 HTTP/1.1");
         assertEquals(part1.getHeader("X-Auth-Token"), token);
         assertEquals(part1.getHeader("Content-Length"), String.valueOf(partSize));
         assertEquals(new String(part1.getBody()), "01234567");
View Full Code Here

         assertEquals(part1.getRequestLine(), "PUT /container/foo/1 HTTP/1.1");
         assertEquals(part1.getHeader("X-Auth-Token"), token);
         assertEquals(part1.getHeader("Content-Length"), String.valueOf(partSize));
         assertEquals(new String(part1.getBody()), "01234567");

         RecordedRequest part2 = server.takeRequest();
         assertEquals(part2.getRequestLine(), "PUT /container/foo/2 HTTP/1.1");
         assertEquals(part2.getHeader("X-Auth-Token"), token);
         assertEquals(part2.getHeader("Content-Length"), String.valueOf(partSize));
         assertEquals(new String(part2.getBody()), "89abcdef");
View Full Code Here

         assertEquals(part2.getRequestLine(), "PUT /container/foo/2 HTTP/1.1");
         assertEquals(part2.getHeader("X-Auth-Token"), token);
         assertEquals(part2.getHeader("Content-Length"), String.valueOf(partSize));
         assertEquals(new String(part2.getBody()), "89abcdef");

         RecordedRequest manifest = server.takeRequest();
         assertEquals(manifest.getRequestLine(), "PUT /container/foo HTTP/1.1");
         assertEquals(manifest.getHeader("X-Auth-Token"), token);
         assertEquals(manifest.getHeader("Content-Length"), "0");

         server.shutdown();
View Full Code Here

         HPCloudObjectStorageApi api = api(server.getUrl("/").toString());

         assertEquals(api.getConfiguredRegions(), ImmutableSet.of("region-a.geo-1", "region-b.geo-1"));

         assertEquals(server.getRequestCount(), 1);
         RecordedRequest authRequest = server.takeRequest();
         assertEquals(authRequest.getRequestLine(), "POST /tokens HTTP/1.1");
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.