Package org.apache.shindig.config

Examples of org.apache.shindig.config.ContainerConfig


  }

  // processJsUri tests
  @Test
  public void processDefaultConfig() throws GadgetException {
    ContainerConfig config = mockDefaultConfig("foo", "/gadgets/js");
    DefaultJsUriManager manager = makeManager(config, null);
    manager.processExternJsUri(Uri.parse("http://example.com?container=" + CONTAINER));
  }
View Full Code Here


  }

  @Test
  public void processPathPrefixMismatch() throws GadgetException {
    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());
View Full Code Here

  }

  @Test
  public void processPathSuffixNoJs() throws GadgetException {
    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());
View Full Code Here

    assertCollectionEquals(jsUri.getLibs(), extern);
  }

  @Test
  public void processPathWithLoadedJs() throws GadgetException {
    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);
View Full Code Here

  }

  @Test
  public void processValidUnversionedNoVersioner() throws GadgetException {
    String targetHost = "target-host.org";
    ContainerConfig config = mockConfig("http://" + targetHost, "/gadgets/js");
    List<String> extern = Lists.newArrayList("feature", "another");
    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 + '&' +
View Full Code Here

  }

  @Test
  public void processValidInvalidVersion() throws GadgetException {
    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);
View Full Code Here

  }

  @Test
  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);
View Full Code Here

  }

  @Test
  public void processValidVersioned() 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);
View Full Code Here

  // end-to-end integration-ish test: makeX builds a Uri that processX correctly handles
  @Test
  public void makeAndProcessSymmetric() throws GadgetException {
    // Make...
    ContainerConfig config = mockConfig("http://www.js.org", "/gadgets/js");
    List<String> extern = Lists.newArrayList("feature1", "feature2", "feature3");
    JsUri ctx = mockGadgetContext(false, false, extern);
    String version = "verstring";
    Versioner versioner = mockVersioner(ctx, version, version);
    TestDefaultJsUriManager manager = makeManager(config, versioner);
View Full Code Here

    List<String> testCopy = Lists.newArrayList(test);
    assertEquals(expectedCopy, testCopy);
  }

  private ContainerConfig mockConfig(String jsHost, String jsPath) {
    ContainerConfig config = createMock(ContainerConfig.class);
    expect(config.getString(CONTAINER, DefaultJsUriManager.JS_HOST_PARAM))
        .andReturn(jsHost).anyTimes();
    expect(config.getString(CONTAINER, DefaultJsUriManager.JS_PATH_PARAM))
        .andReturn(jsPath).anyTimes();
    expect(config.getString(ContainerConfig.DEFAULT_CONTAINER, DefaultJsUriManager.JS_HOST_PARAM))
        .andReturn(null).anyTimes();
    expect(config.getString(ContainerConfig.DEFAULT_CONTAINER, DefaultJsUriManager.JS_PATH_PARAM))
        .andReturn(null).anyTimes();
    replay(config);
    return config;
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.config.ContainerConfig

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.