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

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


    replay(result);
    return result;
  }

  private JsUri mockJsUri(JsCompileMode mode, boolean isJsload, List<String> libs) {
    JsUri result = createMock(JsUri.class);
    expect(result.getCompileMode()).andStubReturn(mode);
    expect(result.getRepository()).andStubReturn(null);
    expect(result.isJsload()).andReturn(isJsload).anyTimes();
    expect(result.getLibs()).andReturn(libs).anyTimes();
    expect(result.getLoadedLibs()).andReturn(LOADED).anyTimes();
    replay(result);
    return result;
  }
View Full Code Here


    processor = new CompilationProcessor(compiler);
  }

  @Test
  public void compilerIsRun() throws Exception {
    JsUri jsUri = control.createMock(JsUri.class);
    JsResponseBuilder builder =
        new JsResponseBuilder().setCacheTtlSecs(1234).setStatusCode(200)
          .appendJs("content1:", "source1")
          .appendJs("content2", "source2")
          .appendJs(JsContent.fromFeature("content3:", "source3", mockBundle("extern3"), null))
View Full Code Here

    assertFalse(outIterator.hasNext());
  }

  @Test
  public void compilerTtlIsUsed() throws Exception {
    JsUri jsUri = control.createMock(JsUri.class);
    JsResponseBuilder builder =
        new JsResponseBuilder().setCacheTtlSecs(1234).setStatusCode(200)
          .appendJs("content1:", "source1");
    JsResponse outputResponse =
        new JsResponseBuilder().setCacheTtlSecs(789)
View Full Code Here

    assertEquals("", response.build().toJsString());
    control.verify();
  }

  private void setUpJsUri(String uri) {
    jsUri = new JsUri(UriStatus.VALID_UNVERSIONED, Uri.parse(uri), REQ_LIBS, LOAD_LIBS);
    EasyMock.expect(request.getJsUri()).andReturn(jsUri);
  }
View Full Code Here

    replay(result);
    return result;
  }

  private JsUri mockJsUri(boolean debug) {
    JsUri result = createMock(JsUri.class);
    expect(result.isDebug()).andReturn(debug).anyTimes();
    expect(result.getCompileMode()).andReturn(JsCompileMode.CONCAT_COMPILE_EXPORT_ALL).anyTimes();
    expect(result.getStatus()).andReturn(UriStatus.VALID_UNVERSIONED).anyTimes();
    expect(result.getContainer()).andReturn("container").anyTimes();
    expect(result.getContext()).andReturn(RenderingContext.CONFIGURED_GADGET).anyTimes();
    expect(result.getRefresh()).andReturn(1000).anyTimes();
    expect(result.isNoCache()).andReturn(false).anyTimes();
    expect(result.getGadget()).andReturn("http://foo.com/g.xml").anyTimes();
    expect(result.getLibs()).andReturn(ImmutableList.<String>of()).anyTimes();
    expect(result.getLoadedLibs()).andReturn(ImmutableList.<String>of()).anyTimes();
    expect(result.getOnload()).andReturn("foo").anyTimes();
    expect(result.isJsload()).andReturn(true).anyTimes();
    expect(result.isNohint()).andReturn(true).anyTimes();
    expect(result.getOrigUri()).andReturn(null).anyTimes();
    expect(result.getRepository()).andReturn(null).anyTimes();
    expect(result.getExtensionParams()).andReturn(null).anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

  // makeJsUri tests
  @Test(expected = RuntimeException.class)
  public void makeMissingHostConfig() {
    ContainerConfig config = mockConfig(null, "/gadgets/js");
    DefaultJsUriManager manager = makeManager(config, null);
    JsUri ctx = mockGadgetContext(false, false, null);
    manager.makeExternJsUri(ctx);
  }
View Full Code Here

  @Test(expected = RuntimeException.class)
  public void makeMissingPathConfig() {
    ContainerConfig config = mockConfig("foo", null);
    DefaultJsUriManager manager = makeManager(config, null);
    JsUri ctx = mockGadgetContext(false, false, null);
    manager.makeExternJsUri(ctx);
  }
View Full Code Here

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

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

  @Test
  public void makeJsUriAddPathSlashNoVersion() {
    ContainerConfig config = mockConfig("http://www.js.org", "/gadgets/js");
    TestDefaultJsUriManager manager = makeManager(config, null);
    List<String> extern = Lists.newArrayList("feature");
    JsUri ctx = mockGadgetContext(false, false, extern);
    Uri jsUri = manager.makeExternJsUri(ctx);
    assertFalse(manager.hadError());
    assertEquals("http", jsUri.getScheme());
    assertEquals("www.js.org", jsUri.getAuthority());
    assertEquals("/gadgets/js/" + addJsLibs(extern) + JS_SUFFIX, jsUri.getPath());
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.