Package org.apache.shindig.gadgets.uri.JsUriManager

Examples of org.apache.shindig.gadgets.uri.JsUriManager.JsUri


  @Test
  public void makeJsUriAddPathSlashVersioned() {
    ContainerConfig config = mockConfig("http://www.js.org", "/gadgets/js");
    List<String> extern = Lists.newArrayList("feature");
    JsUri ctx = mockGadgetContext(false, false, extern);
    String version = "verstring";
    Versioner versioner = this.mockVersioner(ctx, version, version);
    TestDefaultJsUriManager manager = makeManager(config, versioner);
    Uri jsUri = manager.makeExternJsUri(ctx);
    assertFalse(manager.hadError());
View Full Code Here


  @Test
  public void makeJsUriWithVersionerNoVersionOnIgnoreCache() {
    ContainerConfig config = mockConfig("http://www.js.org", "/gadgets/js");
    List<String> extern = Lists.newArrayList("feature");
    JsUri ctx = mockGadgetContext(true, false, extern)// no cache
    String version = "verstring";
    Versioner versioner = this.mockVersioner(ctx, version, version);
    TestDefaultJsUriManager manager = makeManager(config, versioner);
    Uri jsUri = manager.makeExternJsUri(ctx);
    assertFalse(manager.hadError());
View Full Code Here

  @Test
  public void makeJsUriWithContainerContext() {
    ContainerConfig config = mockConfig("http://www.js.org", "/gadgets/js/");
    TestDefaultJsUriManager manager = makeManager(config, null);
    List<String> extern = Lists.newArrayList("feature", "another");
    JsUri ctx = mockGadgetContext(false, false, extern, null, true, null,
        JsCompileMode.CONCAT_COMPILE_EXPORT_ALL, null);
    Uri jsUri = manager.makeExternJsUri(ctx);
    assertFalse(manager.hadError());
    assertEquals("http", jsUri.getScheme());
    assertEquals("www.js.org", jsUri.getAuthority());
View Full Code Here

  public void makeJsUriWithLoadedLibraries() throws Exception {
    ContainerConfig config = mockConfig("http://www.js.org", "/gadgets/js/");
    TestDefaultJsUriManager manager = makeManager(config, null);
    List<String> extern = Lists.newArrayList("feature", "another");
    List<String> loaded = Lists.newArrayList("another", "onemore");
    JsUri ctx = mockGadgetContext(false, false, extern, loaded);
    Uri jsUri = manager.makeExternJsUri(ctx);
    assertFalse(manager.hadError());
    assertEquals("http", jsUri.getScheme());
    assertEquals("www.js.org", jsUri.getAuthority());
    assertEquals("/gadgets/js/" + addJsLibs(extern) + "!" + addJsLibs(loaded) +
View Full Code Here

    String targetHost = "target-host.org";
    ContainerConfig config = mockConfig("http://" + targetHost, "/gadgets/js");
    TestDefaultJsUriManager manager = makeManager(config, null);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/other-js/feature" + JS_SUFFIX + '?' +
        Param.CONTAINER.getKey() + '=' + CONTAINER);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    List<String> extern = Lists.newArrayList("feature");
    assertEquals(extern, jsUri.getLibs());
    List<String> loaded = Lists.newArrayList();
    assertEquals(loaded, jsUri.getLoadedLibs());
    assertEquals(CONTAINER, jsUri.getContainer());
    assertEquals(RenderingContext.GADGET, jsUri.getContext());
  }
View Full Code Here

    String targetHost = "target-host.org";
    ContainerConfig config = mockConfig("http://" + targetHost, "/gadgets/js");
    TestDefaultJsUriManager manager = makeManager(config, null);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/feature:another?" +
        Param.CONTAINER.getKey() + '=' + CONTAINER);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.VALID_UNVERSIONED);
    List<String> extern = Lists.newArrayList("feature", "another");
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here

    ContainerConfig config = mockConfig("http://host", "/gadgets/js");
    TestDefaultJsUriManager manager = makeManager(config, null);
    Uri testUri = Uri.parse("http://host/gadgets/js/feature:another!load1:load2.js?" +
        Param.LOADED.getKey() + "=load3:load4&" +
        Param.CONTAINER.getKey() + '=' + CONTAINER);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    List<String> extern = Lists.newArrayList("feature", "another");
    assertCollectionEquals(jsUri.getLibs(), extern);
    assertCollectionEquals(jsUri.getLoadedLibs(), Lists.newArrayList(
        "load1", "load2", "load3", "load4"));
  }
View Full Code Here

    String version = "verstring";
    TestDefaultJsUriManager manager = makeManager(config, null);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/" + addJsLibs(extern) +
        JS_SUFFIX + '?' + Param.CONTAINER.getKey() + '=' + CONTAINER + '&' +
        Param.VERSION.getKey() + '=' + version);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.VALID_UNVERSIONED);
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here

    String targetHost = "target-host.org";
    ContainerConfig config = mockConfig("http://" + targetHost, "/gadgets/js");
    List<String> extern = Lists.newArrayList("feature", "another");
    String version = "verstring";
    String badVersion = version + "-a";
    JsUri ctx = mockGadgetContext(false, false, extern);
    Versioner versioner = mockVersioner(ctx, version, badVersion);
    TestDefaultJsUriManager manager = makeManager(config, versioner);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/" + addJsLibs(extern) +
        JS_SUFFIX + '?' + Param.CONTAINER.getKey() + '=' + CONTAINER + '&' +
        Param.VERSION.getKey() + '=' + badVersion);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.INVALID_VERSION);
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here

  public void processValidUnversionedNoParam() throws GadgetException {
    String targetHost = "target-host.org";
    ContainerConfig config = mockConfig("http://" + targetHost, "/gadgets/js");
    List<String> extern = Lists.newArrayList("feature", "another");
    String version = "verstring";
    JsUri ctx = mockGadgetContext(false, false, extern);
    Versioner versioner = mockVersioner(ctx, version, version);
    TestDefaultJsUriManager manager = makeManager(config, versioner);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/" + addJsLibs(extern) +
        JS_SUFFIX + '?' + Param.CONTAINER.getKey() + '=' + CONTAINER);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.VALID_UNVERSIONED);
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.uri.JsUriManager.JsUri

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.