Package org.stringtree

Examples of org.stringtree.Tract


    }
   
    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

        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

    assertEquals("text/html", output.responseType);
    assertEquals(40, output.responseLength);
  }
 
  public void testActiveTract() throws IOException {
    Tract tpl = new MapTract("val=${inc.get}, val=${inc.get}");
    putAndInit(tpl, "inc", new ValueIncrementer(7));
    common.put("template.thing", tpl);
    assertEquals("val=7, val=8", request("/thing"));
  }
View Full Code Here

public class TractReturnTest extends WebAppTestCase {
    Map<String, Object> params;

    public void setUp() {
        Tract t1 = new MapTract("hello");
        Tract t2 = new MapTract("hello${@" + HTTPConstants.RESPONSE_CODE +"='404'}");
        params = new HashMap<String, Object>();
        params.put(MojasefConstants.HTTP_APPLICATION, new StringRet());
        params.put(Templater.TEMPLATE + ".t1", t1);
        params.put(Templater.TEMPLATE + ".t2", t2);
        init(params);
View Full Code Here

        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

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.