Package org.apache.shindig.common.uri

Examples of org.apache.shindig.common.uri.Uri


   
    control.replay();
   
    String callback = getGenerator().generateCallback(fetcherConfig,
        "http://base/basecallback?foo=bar%20baz", request, responseParams);
    Uri callbackUri = Uri.parse(callback);
    assertEquals("http", callbackUri.getScheme());
    assertEquals("base", callbackUri.getAuthority());
    assertEquals("/basecallback", callbackUri.getPath());
    assertEquals("bar baz", callbackUri.getQueryParameter("foo"));
    OAuthCallbackState state = new OAuthCallbackState(stateCrypter,
        callbackUri.getQueryParameter("cs"));
    assertEquals("https://renderinghost/final/callback", state.getRealCallbackUrl());
   
    control.verify();
  }
View Full Code Here


      // Nothing.
    }
  };

  public void testValidateUrlNoPath() throws Exception {
    Uri url = proxy.validateUrl("http://www.example.com");
    assertEquals("http", url.getScheme());
    assertEquals("www.example.com", url.getAuthority());
    assertEquals("/", url.getPath());
    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }
View Full Code Here

    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }

  public void testValidateUrlHttps() throws Exception {
    Uri url = proxy.validateUrl("https://www.example.com");
    assertEquals("https", url.getScheme());
    assertEquals("www.example.com", url.getAuthority());
    assertEquals("/", url.getPath());
    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }
View Full Code Here

    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }

  public void testValidateUrlWithPath() throws Exception {
    Uri url = proxy.validateUrl("http://www.example.com/foo");
    assertEquals("http", url.getScheme());
    assertEquals("www.example.com", url.getAuthority());
    assertEquals("/foo", url.getPath());
    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }
View Full Code Here

    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }

  public void testValidateUrlWithPort() throws Exception {
    Uri url = proxy.validateUrl("http://www.example.com:8080/foo");
    assertEquals("http", url.getScheme());
    assertEquals("www.example.com:8080", url.getAuthority());
    assertEquals("/foo", url.getPath());
    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }
View Full Code Here

    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }

  public void testValidateUrlWithEncodedPath() throws Exception {
    Uri url = proxy.validateUrl("http://www.example.com/foo%20bar");
    assertEquals("http", url.getScheme());
    assertEquals("www.example.com", url.getAuthority());
    assertEquals("/foo%20bar", url.getPath());
    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }
View Full Code Here

    assertNull(url.getQuery());
    assertNull(url.getFragment());
  }

  public void testValidateUrlWithEncodedQuery() throws Exception {
    Uri url = proxy.validateUrl("http://www.example.com/foo?q=with%20space");
    assertEquals("http", url.getScheme());
    assertEquals("www.example.com", url.getAuthority());
    assertEquals("/foo", url.getPath());
    assertEquals("q=with%20space", url.getQuery());
    assertEquals("with space", url.getQueryParameter("q"));
    assertNull(url.getFragment());
  }
View Full Code Here

    assertEquals("with space", url.getQueryParameter("q"));
    assertNull(url.getFragment());
  }

  public void testValidateUrlWithNoPathAndEncodedQuery() throws Exception {
    Uri url = proxy.validateUrl("http://www.example.com?q=with%20space");
    assertEquals("http", url.getScheme());
    assertEquals("www.example.com", url.getAuthority());
    assertEquals("/", url.getPath());
    assertEquals("q=with%20space", url.getQuery());
    assertNull(url.getFragment());
  }
View Full Code Here

    assertEquals(UNCOMPRESSED_FILE_JS, lib.getDebugContent());
  }

  public void testUrl() throws Exception {
    HttpFetcher mockFetcher = mock(HttpFetcher.class);
    Uri location = Uri.parse("http://example.org/file.js");
    HttpRequest request = new HttpRequest(location);
    HttpResponse response = new HttpResponseBuilder()
        .setResponse(URL_JS.getBytes())
        .create();
    expect(mockFetcher.fetch(eq(request))).andReturn(response);
    replay();
    JsLibrary lib = JsLibrary.create(
        JsLibrary.Type.URL, location.toString(), null, mockFetcher);
    verify();

    // No type test here because it could potentially change.
    assertEquals(URL_JS, lib.getContent());
    assertEquals(URL_JS, lib.getDebugContent());
View Full Code Here

    expect(context.getHost()).andReturn("example.org");
    replay();

    String jsParam = urlGenerator.getBundledJsUrl(features, context);

    Uri uri = Uri.parse(jsParam);

    assertEquals("example.org", uri.getAuthority());
    assertEquals("/get-together/livescript/foo:bar.js", uri.getPath());
    assertTrue("Missing checksum.", uri.getQueryParameter("v").matches("[0-9a-zA-Z]*"));
    assertEquals(CONTAINER, uri.getQueryParameter("container"));
    assertEquals("0", uri.getQueryParameter("debug"));
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.common.uri.Uri

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.