Package org.jboss.resteasy.mock

Examples of org.jboss.resteasy.mock.MockHttpRequest.header()


  private void assertCharset(String path) throws URISyntaxException {
    for (String characterSet : characterSets) {
      MockHttpRequest request = MockHttpRequest.get(path);
      request.accept("application/xml");
      request.header("Accept-Charset", characterSet);
   
      MockHttpResponse response = new MockHttpResponse();
      dispatcher.invoke(request, response);
      assertEquals("Status code.", 200, response.getStatus());
View Full Code Here


    @Test
    public void noSecurityHole() throws Exception {
        Method method = FakeResource.class.getMethod("someMethod", String.class);
        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status");
        req.header("Authorization", "BASIC QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
        ResourceMethod rmethod = mock(ResourceMethod.class);
        when(rmethod.getMethod()).thenReturn(method);
        Class clazz = FakeResource.class;
        when(rmethod.getResourceClass()).thenReturn(clazz);
View Full Code Here

    @Test
    public void securityHoleWithAuth() throws Exception {
        Method method = FakeResource.class.getMethod("annotatedMethod", String.class);
        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status");
        req.header("Authorization", "BASIC QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
        ResourceMethod rmethod = mock(ResourceMethod.class);
        when(rmethod.getMethod()).thenReturn(method);
        Class clazz = FakeResource.class;
        when(rmethod.getResourceClass()).thenReturn(clazz);
View Full Code Here

  private void assertCharset(String path) throws URISyntaxException {
    for (String characterSet : characterSets) {
      MockHttpRequest request = MockHttpRequest.get(path);
      request.accept("application/xml");
      request.header("Accept-Charset", characterSet);
   
      MockHttpResponse response = new MockHttpResponse();
      dispatcher.invoke(request, response);
      assertEquals("Status code.", 200, response.getStatus());
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.