Package us.monoid.web

Examples of us.monoid.web.Resty


    System.out.println(result);
  }

  @Test
  public void testSubmitPut() throws IOException {
    Resty r = new Resty();
    String uri = ts.getBaseUri() + "mime/put";
    System.out.println("Put to:" + uri);
    String result = r.text(uri, put(content("bubu"))).toString();
    System.out.println(result);
  }
View Full Code Here


    System.out.println(result);
  }
 
  @Test
  public void testPutLocation() throws IOException {
    Resty r = new Resty();
    String uri = ts.getBaseUri() + "mime/put";
    System.out.println("Put to:" + uri);
    URI loc = r.text(uri, put(content("bubu"))).location();
    System.out.println("Location of new resource:" + loc);
    assertNotNull(loc);
   
  }
View Full Code Here

   
  }

  @Test
  public void testSubmitDelete() throws IOException {
    Resty r = new Resty();
    String uri = ts.getBaseUri() + "mime/delete";
    System.out.println("Delete at " + uri);
    TextResource text = r.text(uri, delete());
    String result = text.toString();
    System.out.println(result);
    assertTrue(result.equals("DELETED"));
    assertTrue(text.status(200));
  }
View Full Code Here

  static {
    System.setProperty("content.types.user.table","src/test/java/us/monoid/web/mimecap.properties");
  }
  @Test
  public void sampleUse() throws Exception {
    Resty r = new Resty();
    assertEquals(r.json(getClass().getResource("test.json").toString()).json(path("key.subkey")).object().getInt("secret"), 42);
  }
View Full Code Here

//    assertEquals(name, "Rehlingen-Siersburg");
//  }
// 
  @Test
  public void formDataGet() throws Exception {
    Resty r = new Resty();
    String t = r.text("http://www.google.com/search?" +  GOOGLE_QUERY_DATA).toString();
    System.out.println(t);
    assertTrue(t.contains("resty"));
  }
View Full Code Here

    assertTrue(t.contains("resty"));
  }
  @Test
  public void formDataPost() throws Exception {
    Resty r = new Resty();
    String t = r.text("http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echoraw.cgi",
        form(GOOGLE_QUERY_DATA)).toString();
    System.out.println(t);
    assertTrue(t.contains(GOOGLE_QUERY_DATA));
  }
View Full Code Here

  static {
    System.setProperty("content.types.user.table","src/test/java/us/monoid/web/mimecap.properties");
  }
  @Test
  public void sampleUse() throws Exception {
    Resty r = new Resty();
    assertEquals(r.json(getClass().getResource("test.json").toString()).json(path("key.subkey")).object().getInt("secret"), 42);
  }
View Full Code Here

//    assertEquals(name, "Rehlingen-Siersburg");
//  }
// 
  @Test
  public void formDataGet() throws Exception {
    Resty r = new Resty();
    String t = r.text("http://www.google.com/search?" +  GOOGLE_QUERY_DATA).toString();
    System.out.println(t);
    assertTrue(t.contains("resty"));
  }
View Full Code Here

    assertTrue(t.contains("resty"));
  }
  @Test
  public void formDataPost() throws Exception {
    Resty r = new Resty();
    String t = r.text("http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echoraw.cgi",
        form(GOOGLE_QUERY_DATA)).toString();
    System.out.println(t);
    assertTrue(t.contains(GOOGLE_QUERY_DATA));
  }
View Full Code Here

   * @param args
   * @throws Exception
   * @throws 
   */
  public static void main(String[] args) throws Exception {
    Resty r = new Resty();
    String result = r.xml("http://bart.gov/dev/eta/bart_eta.xml").get("/root/station/eta/estimate[../../name/text()='Powell St.' and ../destination/text()='SF Airport']", String.class);
    System.out.println("Next train to SFO from Powell St.:" + result);
  }
View Full Code Here

TOP

Related Classes of us.monoid.web.Resty

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.