Package org.apache.clerezza.triaxrs

Examples of org.apache.clerezza.triaxrs.JaxRsHandler.handle()


    request.setMessageBody(messageBody);

    request.setMethod(Method.POST);

    handler.handle(request, response);

    Assert.assertEquals(queryParam, value);
    Assert.assertEquals(bodyString, body);
  }
View Full Code Here


    uri.setPath("foo");
    request.setRequestURI(uri);
    request.setMethod(Method.POST);

    handler.handle(request, response);

    Assert.assertEquals("post2", value);
    Assert.assertNull(body);
  }
View Full Code Here

    uri.setQuery("name="+queryParam);
    request.setRequestURI(uri);

    request.setMethod(Method.POST);

    handler.handle(request, response);

    Assert.assertEquals("post2", value);
    Assert.assertEquals(null, body);
  }
}
View Full Code Here

    expect(requestURI.getPath()).andReturn("/");
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
    handler.handle(requestMock, responseMock);
    Assert.assertEquals(message, receivedBody);

  }
}
View Full Code Here

    RequestImpl request = new RequestImpl();
    ResponseImpl response = new ResponseImpl();
    uri.setPath("/");
    request.setRequestURI(uri);
    request.setMethod(Method.OPTIONS);
    handler.handle(request, response);
    Map<HeaderName,String[]> headers = response.getHeaders();
    String[] allowHeader = headers.get(HeaderName.ALLOW);
    Assert.assertNotNull(allowHeader);
    String allow = "";
    for(String st : allowHeader){
View Full Code Here

    RequestImpl request = new RequestImpl();
    ResponseImpl response = new ResponseImpl();
    uri.setPath("/sub");
    request.setRequestURI(uri);
    request.setMethod(Method.OPTIONS);
    handler.handle(request, response);
    Map<HeaderName,String[]> headers = response.getHeaders();
    String[] allowHeader = headers.get(HeaderName.ALLOW);
    Assert.assertNotNull(allowHeader);
    String allow = "";
    for(String st : allowHeader){
View Full Code Here

    ResponseImpl response = new ResponseImpl();

    uri.setType(RequestURI.Type.NO_RESOURCE);
    request.setRequestURI(uri);
    request.setMethod(Method.OPTIONS);
    handler.handle(request, response);
    Map<HeaderName,String[]> headers = response.getHeaders();
    String[] allowHeader = headers.get(HeaderName.ALLOW);
    Assert.assertNotNull(allowHeader);
    String allow = "";
    for(String st : allowHeader){
View Full Code Here

    EasyMock.makeThreadSafe(responseMock, true);
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
    //handler.handle(requestMock, response);
    handler.handle(requestMock, responseMock);

    EasyMock.verify(responseMock);

  }
}
View Full Code Here

    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    expect(requestURI.getType()).andReturn(null).anyTimes();
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
    handler.handle(requestMock, responseMock);
    assertTrue(methodInvokedForPost);

  }
}
View Full Code Here

    expect(requestURI.getQuery()).andReturn("value=" + stringMessage)
        .anyTimes();
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);
    handler.handle(requestMock, responseImpl);
    responseImpl.consumeBody();
    Assert.assertArrayEquals(stringMessage.getBytes(), responseImpl.getBodyBytes());

    reset(requestURI);
    responseImpl = new ResponseImpl();
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.