Package com.google.sitebricks.client

Examples of com.google.sitebricks.client.WebResponse


    assertRedirectResponse(response);
  }

  public void shouldTransportJsonWithoutTemplateNoAnnotations() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/no_annotations/service")
        .transports(String.class)
        .over(Json.class)
        .get();
View Full Code Here


    assertBookResponse(response);
  }

  public void shouldRedirectNoAnnotations() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/no_annotations/service")
        .transports(String.class)
        .over(Text.class)
        .post("");
View Full Code Here

  public void create() {
    String url = AcceptanceTest.BASE_URL + RestfulWebServiceWithCRUDConversions.AT_ME;
    System.out.println("POST " + url);

    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(Widget.class)
      .over(Json.class)
      .post(testWidget);

    Widget result = response.to(Widget.class).using(Json.class);
    assert result.equals(testWidget);
  }
View Full Code Here

  }

  public void readCollection() {
    String url = AcceptanceTest.BASE_URL + RestfulWebServiceWithCRUDConversions.AT_ME;
    System.out.println("GET " + url);
    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(String.class)
      .over(Json.class).get();

    List<Widget> result = new ArrayList<Widget>();
    result = response.to(result.getClass()).using(Json.class);

    assert result.size() == RestfulWebServiceWithCRUDConversions.widgets.size();
  }
View Full Code Here

  }

  public void readIndividual() {
    String url = AcceptanceTest.BASE_URL + RestfulWebServiceWithCRUDConversions.AT_ME + "/" + widgetOne.getId();
    System.out.println("GET " + url);
    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(String.class)
      .over(Json.class)
      .get();

    Widget result = response.to(Widget.class).using(Json.class);
    assert result.equals(widgetOne);
  }
View Full Code Here

    String url = AcceptanceTest.BASE_URL + RestfulWebServiceWithCRUDConversions.AT_ME;

    widgetOne.setPrice(5.50);
    System.out.println("PUT " + url);

    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(Widget.class)
      .over(Json.class)
      .put(widgetOne);

    Widget result = response.to(Widget.class).using(Json.class);
    assert result.equals(widgetOne);
  }
View Full Code Here


  public void delete() {
    String url = AcceptanceTest.BASE_URL + RestfulWebServiceWithCRUDConversions.AT_ME + "/" + testWidget.getId();
    System.out.println("DELETE " + url);
    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(String.class)
      .over(Json.class)
      .delete();

    Widget result = response.to(Widget.class).using(Json.class);
    assert result.equals(testWidget);
  }
View Full Code Here

    perdido.setAuthor(RestfulWebService.CHINA_MIEVILLE);
    perdido.setName(RestfulWebService.PERDIDO_STREET_STATION);
    perdido.setPageCount(RestfulWebService.PAGE_COUNT);


    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/postable?p1=v1,v2")
        .transports(RestfulWebService.Book.class)
        .over(Json.class)
        .post(perdido);

    // Should ping us the author back.
    assert response.toString().contains(perdido.getAuthor()) : response.toString();
  }
View Full Code Here

*/
@Test(suiteName = AcceptanceTest.SUITE)
public class SpiRestfuWebServiceWithSubpaths2AcceptanceTest {

  public void shouldServiceTopLevelDynamicPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/spi/test")
        .transports(String.class)
        .over(Json.class)
        .get();

    assert "get:top".equals(response.toString());
  }
View Full Code Here

    assert "get:top".equals(response.toString());
  }

  public void shouldServiceFirstLevelStaticPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/spi/test")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert "post:junk_subpath1".equals(response.toString()) : response.toString();
  }
View Full Code Here

TOP

Related Classes of com.google.sitebricks.client.WebResponse

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.