Package io.s4.message

Examples of io.s4.message.Request$RInfo


  }

  @Test
  public void testReplayWithMatch()
  {
    final Request req = request();
    final Response res = response();
    final CaptureLastCallFilter captureFilter = new CaptureLastCallFilter();
    final FilterChain fc = getFilterChain().addFirst(captureFilter);

    // Record a response for the request we will fire
View Full Code Here


public class TestRestReplayFilter extends AbstractReplayFilterTest
{
  @Test
  public void testReplayWithRestException()
  {
    final Request req = request();
    final RestResponse res = new RestResponseBuilder().setStatus(RestStatus.NOT_FOUND).build();

    final CaptureLastCallFilter captureFilter = new CaptureLastCallFilter();
    final FilterChain fc = getFilterChain().addFirst(captureFilter);
View Full Code Here

  @Test
  @SuppressWarnings("deprecation")
  public void testChainBuildRpcRequestFromRequestBuilder()
  {
    final Request req = new RpcRequestBuilder(URI.create("test"))
            .setEntity(new byte[] {1,2,3,4})
            .build()
            .requestBuilder()
              .setEntity(new byte[] {5,6,7,8})
              .setURI(URI.create("anotherURI"))
              .build();

    Assert.assertEquals(new byte[] {5,6,7,8}, req.getEntity().copyBytes());
    Assert.assertEquals(URI.create("anotherURI"), req.getURI());
  }
View Full Code Here

  }

  @Test
  public void testChainBuildRestRequestFromRequestBuilder()
  {
    final Request req = new RestRequestBuilder(URI.create("test"))
            .setEntity(new byte[] {1,2,3,4})
            .setHeader("k1", "v1")
            .setMethod(RestMethod.PUT)
            .build()
            .requestBuilder()
              .setEntity(new byte[] {5,6,7,8})
              .setURI(URI.create("anotherURI"))
              .build();

    Assert.assertEquals(new byte[] {5,6,7,8}, req.getEntity().copyBytes());
    Assert.assertEquals(URI.create("anotherURI"), req.getURI());

    Assert.assertTrue(req instanceof RestRequest);
    final RestRequest restReq = (RestRequest)req;
    Assert.assertEquals("v1", restReq.getHeader("k1"));
    Assert.assertEquals(RestMethod.PUT, restReq.getMethod());
View Full Code Here

      InputStream reqIn = null;
      InputStream resIn = null;
      try
      {
        reqIn = new FileInputStream(DirectoryDbUtil.requestFileName(dir, id));
        final Request req = DirectoryDbUtil.isRestId(id) ? serializer.readRestRequest(reqIn)
                                                         : serializer.readRpcRequest(reqIn);

        resIn = new FileInputStream(DirectoryDbUtil.responseFileName(dir, id));
        final Response res = DirectoryDbUtil.isRestId(id) ? serializer.readRestResponse(resIn)
                                                          : serializer.readRpcResponse(resIn);
View Full Code Here

{
  @Test
  @SuppressWarnings("deprecation")
  public void testInitialCapture()
  {
    final Request req = request();
    final Response res = response();

    Assert.assertNull(getDb().replay(req));

    FilterUtil.fireUntypedRequestResponse(getFilterChain(), req, res);
View Full Code Here

  @Test
  @SuppressWarnings("deprecation")
  public void testTwoDifferentRequests()
  {
    final Request req1 = request();
    final Request req2 = req1.requestBuilder().setEntity("This is a different request".getBytes()).build();
    final Response res1 = response();
    final Response res2 = res1.responseBuilder().setEntity("This is a different response".getBytes()).build();

    FilterUtil.fireUntypedRequestResponse(getFilterChain(), req1, res1);
    FilterUtil.fireUntypedRequestResponse(getFilterChain(), req2, res2);
View Full Code Here

  @Test
  @SuppressWarnings("deprecation")
  public void testSameRequestDifferentResponses()
  {
    final Request req = request();
    final Response res1 = response();
    final Response res2 = res1.responseBuilder().setEntity("This is a different response".getBytes()).build();

    FilterUtil.fireUntypedRequestResponse(getFilterChain(), req, res1);
    FilterUtil.fireUntypedRequestResponse(getFilterChain(), req, res2);
View Full Code Here

  }

  @Test
  public void testException()
  {
    final Request req = request();
    final Exception ex = new Exception();

    FilterUtil.fireUntypedRequestError(getFilterChain(), req, ex);

    // Request / response should not be recorded
View Full Code Here

public class TestRestCaptureFilter extends AbstractCaptureFilterTest
{
  @Test
  public void testCaptureRestException()
  {
    final Request req = request();
    final RestResponse res = new RestResponseBuilder().setStatus(RestStatus.NOT_FOUND).build();
    final Exception ex = new RestException(res);

    FilterUtil.fireUntypedRequestError(getFilterChain(), req, ex);
View Full Code Here

TOP

Related Classes of io.s4.message.Request$RInfo

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.