Package us.monoid.web

Examples of us.monoid.web.Resty$Option


   
  }

  @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

//    assertTrue(ggBridge.contains("Golden Gate Bridge"));
//  }
// 
  @Test
  public void testStaticMap() throws Exception {
    Resty r = new Resty();
    File f = r.bytes("http://maps.google.com/maps/api/staticmap?size=512x512&maptype=hybrid" +
        "&markers=size:mid%7Ccolor:red%7C37.815649,-122.477646&sensor=false").save(File.createTempFile("google", ".png"));
    System.out.println(f.toURI());
    f.delete();
  }
View Full Code Here

    ExecutorService pool = Executors.newFixedThreadPool(10);
    List<Callable<File>> tasks = new ArrayList<Callable<File>>(args.length);
    for (final String url : args) {
      tasks.add(new Callable<File>() {
        public File call() throws Exception {
          return new Resty().bytes(url).save(File.createTempFile("img", ".png"));
        }       
      });
    }
    List<Future<File>> results = pool.invokeAll(tasks);
    for (Future<File> ff : results) {
View Full Code Here

TOP

Related Classes of us.monoid.web.Resty$Option

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.