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

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


  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() {
      public FeatureRegistry get(String repository) {
        return featureRegistryMock;
View Full Code Here


    replay(result);
    return result;
  }

  private LookupResult mockLookupResult(FeatureRegistry.FeatureBundle featureBundle) {
    LookupResult result = createMock(LookupResult.class);
    expect(result.getBundles()).andReturn(ImmutableList.of(featureBundle)).anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

    expect(jsUri.getLibs()).andReturn(reqLibs);
    expect(jsUri.getLoadedLibs()).andReturn(loadLibs);

    expect(request.getJsUri()).andReturn(jsUri);

    LookupResult reqLookup = mockLookupResult(reqLookupBundles);
    LookupResult loadLookup = mockLookupResult(loadLookupBundles);

    expect(registry.getFeatureResources(isA(JsGadgetContext.class), eq(reqLibs),
        isNull(List.class))).andReturn(reqLookup);
    expect(registry.getFeatureResources(isA(JsGadgetContext.class), eq(loadLibs),
        isNull(List.class))).andReturn(loadLookup);
View Full Code Here

    expect(registry.getFeatureResources(isA(JsGadgetContext.class), eq(loadLibs),
        isNull(List.class))).andReturn(loadLookup);
  }

  private LookupResult mockLookupResult(List<FeatureBundle> bundles) {
    LookupResult result = control.createMock(LookupResult.class);
    expect(result.getBundles()).andReturn(bundles);
    return result;
  }
View Full Code Here

  public void setUp() throws Exception {
    GadgetContext ctx = new GadgetContext();
    Provider<GadgetContext> contextProviderMock = Providers.of(ctx);
    FeatureResource resource = mockResource(EXPORT_JS_DEB);
    FeatureRegistry.FeatureBundle bundle = mockExportJsBundle(resource);
    LookupResult lookupMock = mockLookupResult(bundle);
    final FeatureRegistry featureRegistryMock = mockRegistry(lookupMock);
    FeatureRegistryProvider registryProvider = new FeatureRegistryProvider() {
      public FeatureRegistry get(String repository) {
        return featureRegistryMock;
      }
View Full Code Here

    replay(result);
    return result;
  }

  private LookupResult mockLookupResult(FeatureRegistry.FeatureBundle featureBundle) {
    LookupResult result = createMock(LookupResult.class);
    expect(result.getBundles()).andReturn(ImmutableList.of(featureBundle)).anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

    return result.toString();
  }

  private List<FeatureBundle> getSupportDeferBundles(FeatureRegistry registry, JsRequest jsRequest) {
    List<FeatureBundle> result = Lists.newArrayList();
    LookupResult lookup = registry.getFeatureResources(context.get(),
      jsRequest.getNewFeatures(), null, false);
    for (FeatureBundle bundle : lookup.getBundles()) {
      if (bundle.isSupportDefer()) {
        result.add(bundle);
      }
    }
    return result;
View Full Code Here

  }

  protected final List<JsContent> getSurfaceJsContents(
      FeatureRegistry featureRegistry, String featureName) {
    ImmutableList.Builder<JsContent> result = ImmutableList.builder();
    LookupResult lookup = featureRegistry.getFeatureResources(context.get(),
        ImmutableList.of(featureName), null);
    for (FeatureBundle bundle : lookup.getBundles()) {
      for (FeatureResource resource : bundle.getResources()) {
        result.add(JsContent.fromFeature(
            resource.getDebugContent(), resource.getName(),
            bundle, resource));
      }
View Full Code Here

        featureNames.add(feature.getName());
      }
    }
    try {
      FeatureRegistry featureRegistry = featureRegistryProvider.get(context.getRepository());
      LookupResult result = featureRegistry.getFeatureResources(context,
          featureRegistry.getFeatures(featureNames), null);
      List<FeatureBundle> bundles = result.getBundles();
      for (FeatureBundle bundle : bundles) {
        rpcEndpoints.addAll(bundle.getApis(ApiDirective.Type.RPC, false));
      }
    } catch (GadgetException e) {
      LOG.log(Level.WARNING, "Error getting features from feature registry", e);
View Full Code Here

        featureNames.add(feature.getName());
      }
    }
    try {
      FeatureRegistry featureRegistry = featureRegistryProvider.get(context.getRepository());
      LookupResult result = featureRegistry.getFeatureResources(context,
          featureRegistry.getFeatures(featureNames), null);
      List<FeatureBundle> bundles = result.getBundles();
      for (FeatureBundle bundle : bundles) {
        rpcEndpoints.addAll(bundle.getApis(ApiDirective.Type.RPC, false));
      }
    } catch (GadgetException e) {
      LOG.log(Level.WARNING, "Error getting features from feature registry", e);
View Full Code Here

TOP

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

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.