Package org.stringtree.tract

Examples of org.stringtree.tract.ByteTract


        assertEquals("I am aa: ${*hello}", tpls.getObject("home"));
        assertEquals("Hello, ${value}!", tpls.getObject("hello"));
    }

    private void check(LocalServer server, String expected, String page) {
        ByteTract request = new LocalRequest(page);
        Tract response = server.request(request);
        assertTrue(response.hasContent());
        assertEquals(expected, response.getContent());
    }
View Full Code Here


    public LocalServer(Object app) throws IOException {
      super(app, "9999", (Fetcher)null, (Fetcher)null);
    }

  public ByteTract request(ByteTract req) {
        ByteTract ret = new MapByteTract();
        RequestContext context = new LocalRequestContext(common, aliases, req, ret);
        ModalOutputCollector output = new LocalOutputCollector(ret, context);
        request(context, output);       
        return ret;
    }
View Full Code Here

  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

        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

    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

        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

   
    public void testPostMapRequest() {
        Map<String, String> args = new HashMap<String, String>();
        args.put("TEXT", "hello");
        args.put("twins", "Castor & Pollux");
        ByteTract request = new LocalPostRequest("ptest", args);
        Tract response = server.request(request);
        assertTrue(response.hasContent());
        assertEquals("hello from Castor & Pollux", response.getContent());
    }
View Full Code Here

        assertTrue(response.hasContent());
        assertEquals("hello from Castor & Pollux", response.getContent());
    }
   
    public void testPostStringRequest() {
        ByteTract request = new LocalPostRequest("pstest", "thing", "text/crinkly");
        Tract response = server.request(request);
        assertTrue(response.hasContent());
        assertEquals("hello from thing (text/crinkly)", response.getContent());
    }
View Full Code Here

    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

Related Classes of org.stringtree.tract.ByteTract

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.