예제 #1
0
  protected int doPost(String operationURI, Hashtable params, RAPServlet rapServlet, Writer out)
      throws ServletException, IOException {

    FakeServletRequest request = new FakeServletRequest(FakeServletRequest.transform(params));
    PrintWriter writer = new PrintWriter(out);
    FakeServletResponse response = new FakeServletResponse(writer);
    rapServlet.doPost(request, response, operationURI);
    return response.getStatus();
  }
예제 #2
0
  protected int doGet(
      String operationURI,
      String parameters,
      Hashtable params,
      RAPServlet rapServlet,
      Writer out,
      int httpcode)
      throws ServletException, IOException {

    Hashtable tempTable = new Hashtable(params);
    tempTable.putAll(
        TMRAPTestUtils.tabularizeParameters(TMRAPTestUtils.tokenizeParameters(parameters)));

    FakeServletRequest request = new FakeServletRequest(FakeServletRequest.transform(tempTable));
    PrintWriter writer = new PrintWriter(out);
    FakeServletResponse response = new FakeServletResponse(writer);
    rapServlet.doGet(request, response, operationURI);

    if (httpcode != -1 && response.getStatus() != httpcode)
      throw new ServletException("Error in HTTP operation: " + response.getMessage());

    return response.getStatus();
  }