Package com.google.sitebricks.client

Examples of com.google.sitebricks.client.WebResponse


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

  public void shouldServiceTopLevelDynamicPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/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.baseUrl() + "/spi/test")
        .transports(String.class)
        .over(Json.class)
        .post("");

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

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

  public void shouldServiceTopLevelPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/superpath")
        .transports(String.class)
        .over(Json.class)
        .get();

    assert RestfulWebServiceWithSubpaths.TOPLEVEL.equals(response.toString());
  }
View Full Code Here

    assert RestfulWebServiceWithSubpaths.TOPLEVEL.equals(response.toString());
  }

  public void shouldServiceFirstSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/superpath/subpath1")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert RestfulWebServiceWithSubpaths.PATH_1.equals(response.toString()) : response.toString();
  }
View Full Code Here

    assert RestfulWebServiceWithSubpaths.PATH_1.equals(response.toString()) : response.toString();
  }

  public void shouldServiceSecondSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/superpath/subpath2")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert RestfulWebServiceWithSubpaths.PATH_2.equals(response.toString()) : response.toString();
  }
View Full Code Here

    assert RestfulWebServiceWithSubpaths.PATH_2.equals(response.toString()) : response.toString();
  }

  public void shouldServiceThirdSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/superpath/subpath3")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert RestfulWebServiceWithSubpaths.PATH_3.equals(response.toString()) : response.toString();
  }
View Full Code Here

    assert RestfulWebServiceWithSubpaths.PATH_3.equals(response.toString()) : response.toString();
  }

  public void shouldServiceVariableTwoLevelSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/superpath/subpath1/a_thing")
        .transports(String.class)
        .over(Json.class)
        .post("");

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

    assert "a_thing".equals(response.toString()) : response.toString();
  }

  public void shouldServiceVariableThreeLevelSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/superpath/subpath1/a_thing/another_thing")
        .transports(String.class)
        .over(Json.class)
        .post("");

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

    assert "a_thing_another_thing".equals(response.toString()) : response.toString();
  }

  public void shouldServiceVariableTwoLevelSubPath2() {
    String aString = "aoskdoaksd" + new Date().hashCode();
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/superpath/subpath3/" + aString)
        .transports(String.class)
        .over(Json.class)
        .post("");

    // Should be reflected
    assert aString.equals(response.toString()) : response.toString();
  }
View Full Code Here

public class RestfulWebServiceWithGenericsAcceptanceTest {

  public void whatWasPostedIsReturnedAsResponse() {
    List<Person> personList = Lists.newArrayList(new Person("John Smith"));

    WebResponse response = createInjector()
            .getInstance(Web.class)
            .clientOf(AcceptanceTest.baseUrl() + "/serviceWithGenerics")
            .transports(new TypeLiteral<List<Person>>() { })
            .over(Json.class)
            .post(personList);

    assert HttpServletResponse.SC_OK == response.status();

    List<Person> result = response.to(new TypeLiteral<List<Person>>() {}).using(Json.class);
    assert result.size() == 1;
    assert "John Smith".equals(result.get(0).getName());
  }
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.