Package net.sf.jruby.rails.asyncweb.mock

Examples of net.sf.jruby.rails.asyncweb.mock.MockHttpRequest


public class RailsServiceResolverTest extends TestCase {

    private RailsServiceResolver resolver = null;

    public void testResolveFileRequest() throws Exception {
        MockHttpRequest request = new MockHttpRequest();
        request.setRequestURI("/images/rails.png");

        assertEquals("fileService", resolver.resolveService(request));
    }
View Full Code Here


        assertEquals("fileService", resolver.resolveService(request));
    }

    public void testResolveIndexFileRequest() throws Exception {
        MockHttpRequest fileRequest = new MockHttpRequest();
        fileRequest.setRequestURI("/");

        assertEquals("fileService", resolver.resolveService(fileRequest));
    }
View Full Code Here

        assertEquals("fileService", resolver.resolveService(fileRequest));
    }

    public void testResolveRailsRequest() throws Exception {
        MockHttpRequest fileRequest = new MockHttpRequest();
        fileRequest.setRequestURI("/controller");

        assertEquals("railsService", resolver.resolveService(fileRequest));
    }
View Full Code Here

        service.stop();
    }

    public void testRun() throws Exception {
        try {
            MockHttpRequest request = new MockHttpRequest();
            MockHttpResponse response = new MockHttpResponse();

            request.setHttpResponse(response);

            request.setParameterString("");
            request.setRequestURI("/functional_test/get");

            request.setHeader("Host", "localhost");
            request.setHeader("Accept", "text/html, text/plain, text/sgml, */*;q=0.01");
            request.setHeader("Accept-Encoding", "gzip, compress");
            request.setHeader("Accept-Language", "ja, en");

            service.handleRequest(request);

            assertEquals(200, response.getStatus().getCode());
            assertEquals("OK", response.getReason());
View Full Code Here

public class RailsFileServiceTest extends TestCase {

    private RailsFileService service = null;

    public void testHandleRequest() throws Exception {
        MockHttpRequest request = new MockHttpRequest();
        request.setRequestURI("/robots.txt");

        MockHttpResponse response = new MockHttpResponse();
        response.setOutputStream(new ByteArrayOutputStream());

        request.setHttpResponse(response);
        service.handleRequest(request);

        assertEquals("text/plain", response.getContentType());
        assertEquals(ResponseStatus.OK, response.getStatus());
        assertEquals("# robots.txt", response.getOutputAsText());
View Full Code Here

        assertEquals(ResponseStatus.OK, response.getStatus());
        assertEquals("# robots.txt", response.getOutputAsText());
    }

    public void testHandleRequestNot() throws Exception {
        MockHttpRequest request = new MockHttpRequest();
        request.setRequestURI("/robots.txt");
        request.setHeader("If-Modified-Since", "Wed, 01 Jan 3000 00:00:00 GMT");

        MockHttpResponse response = new MockHttpResponse();
        response.setOutputStream(new ByteArrayOutputStream());

        request.setHttpResponse(response);
        service.handleRequest(request);

        assertEquals(ResponseStatus.NOT_MODIFIED, response.getStatus());
        assertEquals("", response.getOutputAsText());
    }
View Full Code Here

TOP

Related Classes of net.sf.jruby.rails.asyncweb.mock.MockHttpRequest

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.