Examples of LocalRequest


Examples of org.stringtree.mojasef.local.LocalRequest

        callAndCheckCode(request, "401");
        assertEquals("Basic realm=\"id:12345\"", response.get("WWW-Authenticate"));
    }

    public void testGetPrivateIdKnownAndAuthenticated() {
        request = new LocalRequest("id/12345/details");
        request.put("Authorization", "Basic 12345:1111");
        callAndCheckXML(request, "item12345");
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

  public void setUp() throws IOException {
    server = new LocalServer("src/test/plugins/http.spec");
  }
   
    public void testNonMatchingRequest() {
        ByteTract request = new LocalRequest("simple");
        Tract response = server.request(request);
        assertTrue(response.hasContent());
        assertEquals("Plugin: []", response.getContent());
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

        assertTrue(response.hasContent());
        assertEquals("Plugin: []", response.getContent());
    }
   
    public void testMatchingRequest() {
        ByteTract request = new LocalRequest("complex");
        Tract response = server.request(request);
        assertTrue(response.hasContent());
        assertEquals("Plugin: [hello]", response.getContent());
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

    public void setUp() throws IOException {
        server = new LocalServer("src/test/files/local/http.spec");
    }
   
    public void testGetRequest() {
        ByteTract request = new LocalRequest("ugh");
        request.setContent("<request>xx</request>");
        Tract response = server.request(request);
        assertTrue(response.hasContent());
        assertEquals("hello xx", response.getContent());
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

        assertTrue(response.hasContent());
        assertEquals("hello xx", response.getContent());
    }
   
    public void testGetRequestWithSystemOutPollution() {
        ByteTract request = new LocalRequest("polluted");
        request.setContent("<request>xx</request>");
        Tract response = server.request(request);
        assertTrue(response.hasContent());
        TestHelper.assertSameish("hello aa\r\nbb", response.getContent());
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

    public void setUp() throws IOException {
        server = new LocalServer("src/test/files/auth/http.spec");
    }

    public void testUnknown() {
        request = new LocalRequest("private/12346");
        response = server.request(request);
        assertEquals("404", response.get(HTTPConstants.RESPONSE_CODE));
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

        response = server.request(request);
        assertEquals("404", response.get(HTTPConstants.RESPONSE_CODE));
    }

    public void testKnownButUnauthorized() {
        request = new LocalRequest("private/12345");
        response = server.request(request);
        assertEquals("401", response.get(HTTPConstants.RESPONSE_CODE));
        assertEquals("Basic realm=\"private:12345\"", response.get("WWW-Authenticate"));
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

        assertEquals("401", response.get(HTTPConstants.RESPONSE_CODE));
        assertEquals("Basic realm=\"private:12345\"", response.get("WWW-Authenticate"));
    }

    public void testIncorrectlyAuthorized() {
        request = new LocalRequest("private/12345");
        request.put("Authorization", "Basic 12345:2222");
        response = server.request(request);
        assertEquals("401", response.get(HTTPConstants.RESPONSE_CODE));
        assertEquals("Basic realm=\"private:12345\"", response.get("WWW-Authenticate"));
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

        assertEquals("401", response.get(HTTPConstants.RESPONSE_CODE));
        assertEquals("Basic realm=\"private:12345\"", response.get("WWW-Authenticate"));
    }

    public void testCorrectlyAuthorized() {
        request = new LocalRequest("private/12345");
        request.put("Authorization", "Basic 12345:1111");
        response = server.request(request);
        assertEquals("200", response.get(HTTPConstants.RESPONSE_CODE));
        assertEquals("hello", response.getContent());
    }
View Full Code Here

Examples of org.stringtree.mojasef.local.LocalRequest

    public void setUp() throws IOException {
        server = new LocalServer(new StringRet());
    }
   
    private String request(String url) {
        ByteTract request = new LocalRequest(url);
        Tract response = server.request(request);
        assertTrue(response.hasContent());
        return response.getContent();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.