Package org.wymiwyg.wrhapi

Examples of org.wymiwyg.wrhapi.RequestURI


      @Override
      public void writeTo(WritableByteChannel out) throws IOException {
        out.write(ByteBuffer.wrap(message.getBytes()));
      }
    });
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    expect(requestURI.getPath()).andReturn("/");
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
    handler.handle(requestMock, responseMock);
View Full Code Here


    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class);
   
    Request requestMock = EasyMock.createNiceMock(Request.class);
    Response responseMock = EasyMock.createNiceMock(Response.class);
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    expect(requestURI.getPath()).andReturn("/path");
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    responseMock.setResponseStatus(ResponseStatus.NOT_FOUND);
    EasyMock.makeThreadSafe(responseMock, true);
    replay(requestMock);
    replay(requestURI);
View Full Code Here

    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class);

    Request requestMock = EasyMock.createNiceMock(Request.class);
    Response responseMock = EasyMock.createNiceMock(Response.class);
    expect(requestMock.getMethod()).andReturn(Method.POST).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    expect(requestURI.getPath()).andReturn("/path");
    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

    Request requestMock = EasyMock.createNiceMock(Request.class);
    ResponseImpl responseImpl = new ResponseImpl();

    String stringMessage = "Hello"
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    expect(requestURI.getPath()).andReturn("/").anyTimes();
    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();
    // now do the same with a decimal value
    String decimalString = "446544";

    expect(requestURI.getPath()).andReturn("/").anyTimes();
    expect(requestURI.getQuery()).andReturn("value=" + decimalString)
        .anyTimes();
    replay(requestURI);
    handler.handle(requestMock, responseImpl);
    responseImpl.consumeBody();
    Assert.assertArrayEquals(("int:" + decimalString).getBytes(), responseImpl.getBodyBytes());
View Full Code Here

    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class);
   
    Request requestMock = EasyMock.createNiceMock(Request.class);
    Response responseMock = EasyMock.createNiceMock(Response.class);
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    String value = "a/path/with/slashes";
    expect(requestURI.getPath()).andReturn("/prefix/"+value).anyTimes();
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
    handler.handle(requestMock, responseMock);
View Full Code Here

    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class);

    Request requestMock = EasyMock.createNiceMock(Request.class);
    Response responseMock = EasyMock.createNiceMock(Response.class);
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    expect(requestURI.getPath()).andReturn("/prefixwithotherstuff/bla/bla").anyTimes();
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
    handler.handle(requestMock, responseMock);
View Full Code Here

    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class);
   
    Request requestMock = EasyMock.createNiceMock(Request.class);
    Response responseMock = EasyMock.createNiceMock(Response.class);
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    String value = "a/path/with/slashes";
    expect(requestURI.getPath()).andReturn("/prefix/"+value).anyTimes();
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
    handler.handle(requestMock, responseMock);
View Full Code Here

    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class,
        MyRuntimeExceptionMapper.class, MyMyExceptionMapper.class);

    Request requestMock = EasyMock.createNiceMock(Request.class);
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    expect(requestURI.getPath()).andReturn("/");
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);

    ResponseImpl responseImpl = new ResponseImpl();
View Full Code Here

    Request requestMock = EasyMock.createNiceMock(Request.class);
    ResponseImpl responseImpl = new ResponseImpl();
   
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    expect(requestURI.getPath()).andReturn("/");
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);

    handler.handle(requestMock, responseImpl);
View Full Code Here

    handler = HandlerCreator.getHandler(MyResource.class);
   
    Request requestMock = EasyMock.createNiceMock(Request.class);
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    expect(requestURI.getPath()).andReturn("/foobar").anyTimes();
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);

    ResponseImpl responseImpl = new ResponseImpl();
View Full Code Here

TOP

Related Classes of org.wymiwyg.wrhapi.RequestURI

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.