Package org.apache.shindig.gadgets.features.FeatureRegistry

Examples of org.apache.shindig.gadgets.features.FeatureRegistry.FeatureBundle


  public void testPopulateWithLoadedFeatures() throws Exception {
    List<String> reqLibs = ImmutableList.of("feature1", "feature2");
    List<String> loadLibs = ImmutableList.of("feature2");

    FeatureResource resource1 = mockResource(true);
    FeatureBundle bundle1 = mockBundle("feature1", null, null, Lists.newArrayList(resource1));
    FeatureBundle bundle2 = mockBundle("feature2", "export2", "extern2", null);

    setupJsUriAndRegistry(UriStatus.VALID_UNVERSIONED,
        reqLibs, ImmutableList.of(bundle1, bundle2),
        loadLibs, ImmutableList.of(bundle2));
View Full Code Here


    List<String> reqLibs = ImmutableList.of("feature");
    List<String> loadLibs = EMPTY_STRING_LIST;

    FeatureResource resource1 = mockResource(proxyCacheable);
    FeatureResource resource2 = mockResource(proxyCacheable);
    FeatureBundle bundle = mockBundle("feature", null, null,
        Lists.newArrayList(resource1, resource2));

    setupJsUriAndRegistry(uriStatus,
        reqLibs, Lists.newArrayList(bundle),
        loadLibs, EMPTY_BUNDLE_LIST);
View Full Code Here

    expect(result.isProxyCacheable()).andReturn(proxyCacheable).anyTimes();
    return result;
  }

  private FeatureBundle mockBundle(String name, String export, String extern, List<FeatureResource> resources) {
    FeatureBundle result = control.createMock(FeatureBundle.class);
    expect(result.getName()).andReturn(name).anyTimes();
    if (export != null) {
      expect(result.getApis(ApiDirective.Type.JS, true)).andReturn(ImmutableList.of(export));
    }
    if (extern != null) {
      expect(result.getApis(ApiDirective.Type.JS, false)).andReturn(ImmutableList.of(extern));
    }
    if (resources != null) {
      expect(result.getResources()).andReturn(resources);
    }
    return result;
  }
View Full Code Here

  @Ignore("This class was not being run and when I ran it this test did not pass.  Not familiar enough to enable it.")
  @Test
  public void testGetJsContentWithGoogSymbolExports() throws Exception {
    realOptionsMock = mockRealJsCompilerOptions(true); // with
    compiler = newClosureJsCompiler(null, realOptionsMock, compilerMock, cacheMock);
    FeatureBundle bundle = mockBundle(EXPORTS);
    Iterable<JsContent> actual = compiler.getJsContent(mockJsUri(false), bundle);
    assertEquals(EXPORT_COMPILER_STRING +
        "goog.exportSymbol('bar', bar);\n" +
        "goog.exportSymbol('foo', foo);\n",
        getContent(actual));
View Full Code Here

  @Ignore("This class was not being run and when I ran it this test did not pass.  Not familiar enough to enable it.")
  @Test
  public void testGetJsContentWithoutGoogSymbolExports() throws Exception {
    realOptionsMock = mockRealJsCompilerOptions(false); // without
    compiler = newClosureJsCompiler(null, realOptionsMock, compilerMock, cacheMock);
    FeatureBundle bundle = mockBundle(EXPORTS);
    Iterable<JsContent> actual = compiler.getJsContent(mockJsUri(false), bundle);
    assertEquals(EXPORT_COMPILER_STRING, getContent(actual));
  }
View Full Code Here

    replay(result);
    return result;
  }

  private FeatureBundle mockBundle(List<String> exports) {
    FeatureBundle result = createMock(FeatureBundle.class);
    expect(result.getApis(ApiDirective.Type.JS, true)).andReturn(exports).anyTimes();
    expect(result.getName()).andReturn(null).anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

  }

  public void testGetJsContentWithGoogSymbolExports() throws Exception {
    realOptionsMock = mockRealJsCompilerOptions(true); // with
    compiler = newClosureJsCompiler(null, realOptionsMock, compilerMock, cacheMock);
    FeatureBundle bundle = mockBundle(EXPORTS);
    Iterable<JsContent> actual = compiler.getJsContent(mockJsUri(false), bundle);
    assertEquals(EXPORT_COMPILER_STRING +
        "goog.exportSymbol('bar', bar);\n" +
        "goog.exportSymbol('foo', foo);\n",
        getContent(actual));
View Full Code Here

  }

  public void testGetJsContentWithoutGoogSymbolExports() throws Exception {
    realOptionsMock = mockRealJsCompilerOptions(false); // without
    compiler = newClosureJsCompiler(null, realOptionsMock, compilerMock, cacheMock);
    FeatureBundle bundle = mockBundle(EXPORTS);
    Iterable<JsContent> actual = compiler.getJsContent(mockJsUri(false), bundle);
    assertEquals(EXPORT_COMPILER_STRING, getContent(actual));
  }
View Full Code Here

    replay(result);
    return result;
  }

  private FeatureBundle mockBundle(List<String> exports) {
    FeatureBundle result = createMock(FeatureBundle.class);
    expect(result.getApis(ApiDirective.Type.JS, true)).andReturn(exports).anyTimes();
    expect(result.getName()).andReturn(null).anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

  }

  private FeatureBundle mockBundle(List<String> exports) {
    List<ApiDirective> apis = Lists.newArrayList();
    for (String e : exports) apis.add(mockApiDirective(true, e));
    FeatureBundle result = createMock(FeatureBundle.class);
    expect(result.getApis(ApiDirective.Type.JS, true)).andReturn(exports).anyTimes();
    expect(result.isSupportDefer()).andReturn(false).anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.features.FeatureRegistry.FeatureBundle

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.