Package net.sf.sahi.response

Examples of net.sf.sahi.response.HttpResponse


        return httpResponse;
    }

    public HttpResponse currentParsedScript(final HttpRequest request) {
        Session session = request.session();
        HttpResponse httpResponse;
        if (getScript(session) != null) {
            httpResponse = new SimpleHttpResponse("<pre>" + getScript(session).modifiedScript().replaceAll("\\\\r",
                    "").replaceAll("\\\\n", "<br>") + "</pre>");
        } else {
            httpResponse = new SimpleHttpResponse(
View Full Code Here


        session.setVariable(name, value);
    }

    public HttpResponse getVar(final HttpRequest request) {
        Session session = request.session();
        HttpResponse httpResponse;
        String name = request.getParameter("name");
        Hits.increment("SessionState_getVar :: " + name);
        boolean isDelete = "1".equals(request.getParameter("isdelete"));
        String value = null;
        if (setVarOnSuite(request)){
View Full Code Here

            return new HttpFileResponse(fileName, null, false, false);
        }
    }

    public HttpResponse getBrowserScript(final HttpRequest request) {
        HttpResponse httpResponse;
        String scriptPath = request.getParameter("href");
        SahiScript script = new ScriptFactory().getScript(scriptPath);
    if (script != null) {
            httpResponse = new SimpleHttpResponse(LogViewer.highlight(script.getBrowserJSWithLineNumbers(), getLineNumber(request)));
        } else {
View Full Code Here

    assertTrue(browser.div("Hi there").exists());   
  }

   
  public HttpResponse mockMe(HttpRequest request){
    HttpResponse response = new SimpleHttpResponse("<div>Hi there</div>");
    StreamingHttpResponse response2 = new HttpModifiedResponse(response, request.isSSL(), request.fileExtension());
    response2.addFilter(new ChunkedFilter());
    return response2;
 
View Full Code Here

        HELPFILE.delete();
    }

    public void xtestExecuteRunsACommand() throws InterruptedException {
        assertTrue(HELPFILE.exists());
        HttpResponse response = commandInvoker.execute(prepareMockHttpRequest(getCommandPath("test.cmd"), true));
        String actualResponse = new String(response.data());
        assertEquals(CommandInvoker.SUCCESS, actualResponse);
        assertFalse(HELPFILE.exists());
    }
View Full Code Here

        assertEquals(CommandInvoker.SUCCESS, actualResponse);
        assertFalse(HELPFILE.exists());
    }

    public void xtestExecuteReturnsFailureForInvalidCommand() throws InterruptedException {
        HttpResponse response = commandInvoker.execute(prepareMockHttpRequest("invalid", true));
        String actualResponse = new String(response.data());
        assertEquals(CommandInvoker.FAILURE, actualResponse);
    }
View Full Code Here

        String actualResponse = new String(response.data());
        assertEquals(CommandInvoker.FAILURE, actualResponse);
    }

    public void xtestExecuteRunsACommandInAsyncMode() throws InterruptedException {
        HttpResponse response = commandInvoker.execute(prepareMockHttpRequest(getCommandPath("test.cmd"), false));
        String actualResponse = new String(response.data());
        assertEquals(CommandInvoker.SUCCESS, actualResponse);
    }
View Full Code Here

TOP

Related Classes of net.sf.sahi.response.HttpResponse

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.