Package org.fusesource.restygwt.client

Examples of org.fusesource.restygwt.client.Resource


      assertEquals("123456789",method.builder.getHeader("X-CustomHeader"));
  }
 
  // Uris with trailing '/'
  public void testUriWithTrailingSlash() {
    Resource r1 = new Resource(BU + "/");

    assertEquals(BU, r1.getPath());
    assertEquals(null, r1.getQuery());
    assertEquals(BU, r1.getUri());

    Resource r2 = r1.addQueryParam("a", "1").addQueryParam("b", "2");

    assertEquals(BU, r2.getPath());
    assertEquals(EQ, r2.getQuery());
    assertEquals(BU + "?" + EQ, r2.getUri());

    assertNull(r2.getHeaders());
  }
View Full Code Here


  public void testUri_HeadersWithTrailingSlash() {
    Map<String, String> headersMap = new HashMap<String, String>();
    headersMap.put("Authentication", "Basic 4711");
    headersMap.put("Accept", "application/json");

    Resource r1 = new Resource(BU + "/", headersMap);

    assertEquals(BU, r1.getPath());
    assertEquals(null, r1.getQuery());
    assertEquals(BU, r1.getUri());

    Resource r2 = r1.addQueryParam("a", "1").addQueryParam("b", "2");

    assertEquals(BU, r2.getPath());
    assertEquals(EQ, r2.getQuery());
    assertEquals(BU + "?" + EQ, r2.getUri());

    assertEquals(2, r2.getHeaders().size());
  }
View Full Code Here

    assertEquals(2, r2.getHeaders().size());
  }

  public void testUri_QueryWithTrailingSlash() {
    Resource r1 = new Resource(BU + "/", "x=y");

    assertEquals(BU, r1.getPath());
    assertEquals("x=y", r1.getQuery());
    assertEquals(BU + "?" + "x=y", r1.getUri());

    Resource r2 = r1.addQueryParam("a", "1").addQueryParam("b", "2");

    assertEquals(BU, r2.getPath());
    assertEquals("x=y" + "&" + EQ, r2.getQuery());
    assertEquals(BU + "?" + "x=y" + "&" + EQ, r2.getUri());

    assertNull(r2.getHeaders());
  }
View Full Code Here

  public void testUri_Query_HeadersWithTrailingSlash() {
    Map<String, String> headersMap = new HashMap<String, String>();
    headersMap.put("Authentication", "Basic 4711");
    headersMap.put("Accept", "application/json");

    Resource r1 = new Resource(BU + "/", "x=y", headersMap);

    assertEquals(BU, r1.getPath());
    assertEquals("x=y", r1.getQuery());
    assertEquals(BU + "?" + "x=y", r1.getUri());

    Resource r2 = r1.addQueryParam("a", "1").addQueryParam("b", "2");

    assertEquals(BU, r2.getPath());
    assertEquals("x=y" + "&" + EQ, r2.getQuery());
    assertEquals(BU + "?" + "x=y" + "&" + EQ, r2.getUri());

    assertEquals(2, r2.getHeaders().size());
  }
View Full Code Here

    assertEquals(2, r2.getHeaders().size());
  }

  // Uri that includes Query
  public void testUriIncludingQuery() {
    Resource r1 = new Resource(BU + "?" + "x=y");

    assertEquals(BU, r1.getPath());
    assertEquals("x=y", r1.getQuery());
    assertEquals(BU + "?" + "x=y", r1.getUri());

    Resource r2 = r1.addQueryParam("a", "1").addQueryParam("b", "2");

    assertEquals(BU, r2.getPath());
    assertEquals("x=y" + "&" + EQ, r2.getQuery());
    assertEquals(BU + "?" + "x=y" + "&" + EQ, r2.getUri());

    assertNull(r2.getHeaders());
  }
View Full Code Here

  public void testUriIncludingQuery_Headers() {
    Map<String, String> headersMap = new HashMap<String, String>();
    headersMap.put("Authentication", "Basic 4711");
    headersMap.put("Accept", "application/json");

    Resource r1 = new Resource(BU + "?" + "x=y", headersMap);

    assertEquals(BU, r1.getPath());
    assertEquals("x=y", r1.getQuery());
    assertEquals(BU + "?" + "x=y", r1.getUri());

    Resource r2 = r1.addQueryParam("a", "1").addQueryParam("b", "2");

    assertEquals(BU, r2.getPath());
    assertEquals("x=y" + "&" + EQ, r2.getQuery());
    assertEquals(BU + "?" + "x=y" + "&" + EQ, r2.getUri());

    assertEquals(2, r2.getHeaders().size());
  }
View Full Code Here

    public void testFailingConnection() {
        /*
         *  setup the service, usually done in gin
         */
        Resource resource = new Resource(GWT.getModuleBaseURL() + "api/getendpoint");
        service = GWT.create(ExampleService.class);
        ((RestServiceProxy) service).setResource(resource);

        service.getExampleDto(new MethodCallback<ExampleDto>() {
            @Override
View Full Code Here

    }

    public void testDefaultFunction() {

        //configure RESTY
        Resource resource = new Resource(GWT.getModuleBaseURL() + URI_PATH);


        JsonpService service = GWT.create(JsonpService.class);
        ((RestServiceProxy) service).setResource(resource);
View Full Code Here

   
    @Test
    public void testCancel() {

        //configure RESTY
        Resource resource = new Resource(GWT.getModuleBaseURL() + URI_PATH);


        JsonpService service = GWT.create(JsonpService.class);
        ((RestServiceProxy) service).setResource(resource);
View Full Code Here

    }

    public void testDefaultFunction() {

        //configure RESTY
        Resource resource = new Resource(GWT.getModuleBaseURL() + "api/getendpoint");


        ExampleService service = GWT.create(ExampleService.class);
        ((RestServiceProxy) service).setResource(resource);
View Full Code Here

TOP

Related Classes of org.fusesource.restygwt.client.Resource

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.