Example #1
0
  @Test
  public void whenInnerClass() throws Exception {
    Aradon aradon =
        AradonTester.create()
            .register("test", "/ex1", HelloAbstractLet.class)
            .register("test", "/ex2/{name}", HelloResource.class)
            .register("test", "/ex3", HelloObjectLet.class)
            .getAradon();

    AradonClient ac = AradonClientFactory.create(aradon);
    assertEquals("hello", ac.createRequest("/test/ex1").get().getText());
    assertEquals("hi bleujin", ac.createRequest("/test/ex2/bleujin").get().getText());

    List<String> names = ac.createSerialRequest("/test/ex3?name=jin").get(List.class);
    assertEquals("[bleujin, hero, jin]", names.toString());

    //		aradon.startServer(9000) ;
    //		new InfinityThread().startNJoin() ;
  }
Example #2
0
  @Test
  public void formBean() throws Exception {

    AradonClient ac = AradonClientFactory.create(aradon);
    HttpMultipartEntity rf = new HttpMultipartEntity();
    rf.addParameter("name", "bleujin");
    rf.addParameter("file", new File("./build.xml"));
    rf.addParameter("age", "20");
    rf.addParameter("age", "25");

    Representation result = ac.createRequest("/hello").setEntity(rf.makeRepresentation()).post();

    Assert.assertEquals("bleujin2025application/octet-stream", result.getText());
  }