Examples of FeatureResource


Examples of org.apache.shindig.gadgets.features.FeatureResource

    expect(denied.getName()).andReturn("hello");
    expect(gadgetAdminStore.checkFeatureAdminInfo(isA(Gadget.class))).andReturn(true);
    expect(gadgetAdminStore.isAllowedFeature(eq(denied), isA(Gadget.class))).andReturn(false);
    replay();

    FeatureResource fooResource = inline("foo-content", "foo-debug");
    expectFeatureCalls(gadget,
        ImmutableList.of(fooResource),
        libs,
        ImmutableList.of(fooResource, inline("bar-c", "bar-d"), inline("baz-c", "baz-d")));
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

  public void setUp() {
    String featureContent = "THE_FEATURE_CONTENT";
    String debugContent = "FEATURE_DEBUG_CONTENT";
    featureChecksum = HashUtil.checksum((featureContent + debugContent).getBytes());
    FeatureRegistry registry = createMock(FeatureRegistry.class);
    FeatureResource resource = new FeatureResource.Simple(featureContent, debugContent);
    List<FeatureResource> allResources = Lists.newArrayList(resource);
    expect(registry.getAllFeatures()).andReturn(allResources).once();
    replay(registry);
    versioner = new AllJsIframeVersioner(registry);
    verify(registry);
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

      }
    };

    Gadget gadget = makeGadgetWithSpec(gadgetXml).setContext(context);

    FeatureResource fooResource = inline("foo-content", "foo-debug");
    expectFeatureCalls(gadget,
        ImmutableList.of(fooResource),
        libs,
        ImmutableList.of(fooResource, inline("bar-c", "bar-d"), inline("baz-c", "baz-d")));
   
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

    assertEquals(UriStatus.VALID_VERSIONED, status);
    verify(registry);
  }
 
  private void expectReq(String feature, String content) {
    FeatureResource resource = new FeatureResource.Simple(content, "");
    Collection<String> libs = Lists.newArrayList(feature);
    List<FeatureResource> resources = Lists.newArrayList(resource);
    expect(registry.getFeatureResources(isA(GadgetContext.class), eq(libs),
        EasyMock.<List<String>>isNull())).andReturn(resources).anyTimes();
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

  @Before
  public void setUp() throws Exception {
    GadgetContext ctx = new GadgetContext();
    Provider<GadgetContext> contextProviderMock = Providers.of(ctx);
    FeatureResource resource = mockResource(DEFER_JS_DEB);
    FeatureRegistry.FeatureBundle bundle = mockExportJsBundle(resource);
    LookupResult lookupMock = mockLookupResult(bundle);
    final FeatureRegistry featureRegistryMock = mockRegistry(lookupMock);
    featureRegistry = featureRegistryMock;
    FeatureRegistryProvider registryProvider = new FeatureRegistryProvider() {
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

    replay(result);
    return result;
  }

  private FeatureResource mockResource(String debContent) {
    FeatureResource result = createMock(FeatureResource.class);
    expect(result.getDebugContent()).andReturn(debContent).anyTimes();
    expect(result.getName()).andReturn("js").anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

  }

  @Test
  public void testGetJsContentWithDeb() throws Exception {
    JsUri jsUri = mockJsUri(true); // debug
    FeatureResource extRes = mockResource(true, RESOURCE_URL_DEB, RESOURCE_URL_OPT);
    FeatureResource intRes = mockResource(false, RESOURCE_CONTENT_DEB, RESOURCE_CONTENT_OPT);
    FeatureBundle bundle = mockBundle(Lists.newArrayList(extRes, intRes));
    Iterable<JsContent> actual = compiler.getJsContent(jsUri, bundle);
    assertEquals(
        "document.write('<script src=\"" + RESOURCE_URL_DEB + "\"></script>');\n" +
        RESOURCE_CONTENT_DEB + ";\n",
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

  }

  @Test
  public void testGetJsContentWithOpt() throws Exception {
    JsUri jsUri = mockJsUri(false); // optimized
    FeatureResource extRes = mockResource(true, RESOURCE_URL_DEB, RESOURCE_URL_OPT);
    FeatureResource intRes = mockResource(false, RESOURCE_CONTENT_DEB, RESOURCE_CONTENT_OPT);
    FeatureBundle bundle = mockBundle(Lists.newArrayList(extRes, intRes));
    Iterable<JsContent> actual = compiler.getJsContent(jsUri, bundle);
    assertEquals(
        "document.write('<script src=\"" + RESOURCE_URL_OPT + "\"></script>');\n" +
        RESOURCE_CONTENT_OPT + ";\n",
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

    replay(result);
    return result;
  }

  private FeatureResource mockResource(boolean external, String debContent, String optContent) {
    FeatureResource result = createMock(FeatureResource.class);
    expect(result.getDebugContent()).andReturn(debContent).anyTimes();
    expect(result.getContent()).andReturn(optContent).anyTimes();
    expect(result.isExternal()).andReturn(external).anyTimes();
    expect(result.getName()).andReturn("source").anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.features.FeatureResource

  @Test
  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),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.