Package org.wymiwyg.wrhapi

Examples of org.wymiwyg.wrhapi.RequestURI


    JaxRsHandler handler = HandlerCreator.getHandler("/prefix", components);

    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("/test2/");
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
    handler.handle(requestMock, responseMock);
View Full Code Here


    Request requestMock = EasyMock.createNiceMock(Request.class);
    EasyMock.makeThreadSafe(requestMock, true);
    ResponseImpl responseImpl = new ResponseImpl();
    expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
    EasyMock.makeThreadSafe(requestURI, true);
    String queryString = "key=value";
    expect(requestURI.getQuery()).andReturn(queryString).anyTimes();
    expect(requestURI.getPath()).andReturn("/").anyTimes();
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);

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

    receivedBody = null;

    Request requestMock = EasyMock.createNiceMock(Request.class);
    Response responseMock = EasyMock.createNiceMock(Response.class);
    RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);

    expect(requestMock.getMethod()).andReturn(Method.PUT).anyTimes();
    String[] contentTypeHeader = { "application/x-mymessage" };
    expect(requestMock.getHeaderValues(HeaderName.CONTENT_TYPE)).andReturn(
        contentTypeHeader).anyTimes();
    // this redundancy makes me prefer not to use mocks
    Set<HeaderName> headerNames = new HashSet<HeaderName>();
    headerNames.add(HeaderName.CONTENT_TYPE);
    expect(requestMock.getHeaderNames()).andReturn(headerNames).anyTimes();
    final String message = "The message in the body";
    expect(requestMock.getMessageBody()).andReturn(new MessageBody2Write() {

      @Override
      public void writeTo(WritableByteChannel out) throws IOException {
        out.write(ByteBuffer.wrap(message.getBytes()));
      }
    });
    expect(requestURI.getPath()).andReturn(currentRequestUri);
    expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
    replay(requestMock);
    replay(requestURI);
    replay(responseMock);
View Full Code Here

    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class, HidingWriter.class);
 
    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);
    responseImpl.consumeBody();
View Full Code Here

        ResponseImpl responseImpl = new ResponseImpl();
        expect(requestMock.getMethod()).andReturn(Method.GET).anyTimes();
        headerNames.add(HeaderName.ACCEPT);
        expect(requestMock.getHeaderNames()).andReturn(headerNames);
        expect(requestMock.getHeaderValues(HeaderName.ACCEPT)).andReturn(accept);
        RequestURI requestURI = EasyMock.createNiceMock(RequestURI.class);
        expect(requestURI.getPath()).andReturn("/foo").anyTimes();
        expect(requestMock.getRequestURI()).andReturn(requestURI).anyTimes();
        //responseMock.addHeader(HeaderName.CONTENT_TYPE, MediaType.valueOf("text/plain;q=.8"));

        replay(requestMock);
        replay(requestURI);
View Full Code Here

      public Method getMethod() throws HandlerException {
        return Method.GET;
      }
 
      public RequestURI getRequestURI() throws HandlerException {
        return new RequestURI() {
 
          public String getPath() {
            return "/admin/refresh-cache";
          }
 
View Full Code Here

    // TODO add Accept and Accept_langugage header if not already there and non-null vars
    return super.getHeaderNames();
  }

  public RequestURI getRequestURI() throws HandlerException {
    RequestURI orig = super.getRequestURI();
    return new RequestURIWrapper(orig, baseName);
  }
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.