Package us.monoid.web

Examples of us.monoid.web.Resty


        HttpsURLConnection.setDefaultSSLSocketFactory(new SSLSocketFactoryImpl());
        HttpsURLConnection.setDefaultHostnameVerifier(new DefaultHostnameVerifier());

        startServer("us/monoid/web/ssl/test-ssl-hostname-eq-localhost.keystore");

        Resty resty = new Resty();

        resty.text(String.format("https://localhost:%d%s", getPort(), HelloWorldTestResource.HELLO_WORLD_PATH));
    }
View Full Code Here


        HttpsURLConnection.setDefaultSSLSocketFactory(new SSLSocketFactoryImpl());
        HttpsURLConnection.setDefaultHostnameVerifier(AllowAllHostnameVerifier.ALLOW_ALL_HOSTNAMES);

        startServer("us/monoid/web/ssl/test-ssl-hostname-eq-site.com.keystore");

        Resty resty = new Resty();

        resty.text(String.format("https://localhost:%d%s", getPort(), HelloWorldTestResource.HELLO_WORLD_PATH));
    }
View Full Code Here

public class RestyWithOption {

    @Test
    public void testOptions() {
      /** Configure Resty with a socket timeout of 3000ms */
      new Resty(Option.timeout(3000));
    }
View Full Code Here

   * @throws IOException
   * @throws JSONException
   */
  @Test
  public void createMultiformTest() throws IOException, JSONException {
    Resty r = new Resty();
    //TextResource text = r.text("http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echoraw.cgi",
    TextResource text = r.text("http://localhost:9998/mime/multipart",
        form(data("bubu", "lala"), data("schön", "böööh")));
    String result = text.toString();
    System.out.println(result);
    assertTrue(result.contains("bubu"));
    JSONObject json = new JSONObject();
    json.put("bubu", "lala");
    text = r.text("http://localhost:9998/mime/multipart", form(data("someJson", content(json)), data("someText", "Text")));
    result = text.toString();
    System.out.println(result);
    assertTrue(result.contains("someJson") && result.contains("application/json") && result.contains("someText"));
  }
View Full Code Here

    assertTrue(result.contains("someJson") && result.contains("application/json") && result.contains("someText"));
  }
 
  @Test
  public void testSubmitPost() throws IOException {
    Resty r = new Resty();
    String uri = ts.getBaseUri() + "mime/text";
    System.out.println("Posting to:" + uri);
    String result = r.text(uri, content("bubu")).toString();
    System.out.println(result);
  }
View Full Code Here

    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

   * @throws IOException
   * @throws JSONException
   */
  @Test
  public void createMultiformTest() throws IOException, JSONException {
    Resty r = new Resty();
    //TextResource text = r.text("http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echoraw.cgi",
    TextResource text = r.text("http://localhost:9998/mime/multipart",
        form(data("bubu", "lala"), data("schön", "böööh")));
    String result = text.toString();
    System.out.println(result);
    assertTrue(result.contains("bubu"));
    JSONObject json = new JSONObject();
    json.put("bubu", "lala");
    text = r.text("http://localhost:9998/mime/multipart", form(data("someJson", content(json)), data("someText", "Text")));
    result = text.toString();
    System.out.println(result);
    assertTrue(result.contains("someJson") && result.contains("application/json") && result.contains("someText"));
  }
View Full Code Here

    assertTrue(result.contains("someJson") && result.contains("application/json") && result.contains("someText"));
  }
 
  @Test
  public void testSubmitPost() throws IOException {
    Resty r = new Resty();
    String uri = ts.getBaseUri() + "mime/text";
    System.out.println("Posting to:" + uri);
    String result = r.text(uri, content("bubu")).toString();
    System.out.println(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.