Package org.apache.shindig.gadgets.spec

Examples of org.apache.shindig.gadgets.spec.PipelinedData$SocialData$Property


    assertEquals("canonical", personRequest.getJSONObject("params").getJSONArray("userId").get(0));
  }

  @Test
  public void executeWithBlockedBatch() throws Exception {
    PipelinedData pipeline = getPipelinedData(BLOCKED_FIRST_BATCH_CONTENT);

    // Expect a batch with no content
    expect(
        preloader.createPreloadTasks(same(context), eqBatch(0, 0)))
            .andReturn(ImmutableList.<Callable<PreloadedData>>of());
View Full Code Here


    control.verify();
  }

  @Test
  public void executeError() throws Exception {
    PipelinedData pipeline = getPipelinedData(CONTENT);

    Capture<PipelinedData.Batch> batchCapture =
      new Capture<PipelinedData.Batch>();

    JSONObject expectedData = new JSONObject("{error: {message: 'NO!', code: 500}}");
View Full Code Here

    control.verify();
  }

  @Test
  public void executePreloadException() throws Exception {
    PipelinedData pipeline = getPipelinedData(CONTENT);
    final PreloadedData willThrow = control.createMock(PreloadedData.class);

    Callable<PreloadedData> callable = new Callable<PreloadedData>() {
      public PreloadedData call() throws Exception {
        return willThrow;
View Full Code Here

    setupGadget(getGadgetXml(contentWithDataRequest));
    Map<PipelinedData, ? extends Object> pipelines =
        rewriter.parsePipelinedData(gadget, content.getDocument());
    assertEquals(1, pipelines.size());
    PipelinedData pipeline = pipelines.keySet().iterator().next();
    PipelinedData.Batch batch = pipeline.getBatch(Expressions.forTesting(), new RootELResolver());
    Map<String, PipelinedData.BatchItem> preloads = batch.getPreloads();
    assertTrue(preloads.containsKey("me"));
    assertEquals(PipelinedData.BatchType.SOCIAL, preloads.get("me").getType());

    JsonAssert.assertObjectEquals(
View Full Code Here

  Map<PipelinedData, Node> parsePipelinedData(Gadget gadget, Document doc) {
    List<Element> dataTags = SocialDataTags.getTags(doc, SocialDataTags.OSML_DATA_TAG);
    Map<PipelinedData, Node> pipelineNodes = Maps.newHashMap();
    for (Element n : dataTags) {
      try {
        PipelinedData pipelineData = new PipelinedData(n, gadget.getSpec().getUrl());
        pipelineNodes.put(pipelineData, n);
      } catch (SpecParserException e) {
        // Leave the element to the client
        if (LOG.isLoggable(Level.INFO)) {
          LOG.logp(Level.INFO, classname, "parsePipelinedData", MessageKeys.FAILED_TO_PARSE_PRELOAD, new Object[] {gadget.getSpec().getUrl()});
View Full Code Here

   */
  protected HttpRequest createPipelinedProxyRequest(Gadget gadget, HttpRequest original) {
    HttpRequest request = new HttpRequest(original);
    request.setIgnoreCache(true);

    PipelinedData data = gadget.getCurrentView().getPipelinedData();
    if (data != null) {
      PipelineExecutor.Results results =
        pipelineExecutor.execute(gadget.getContext(), ImmutableList.of(data));

      if (results != null && !results.results.isEmpty()) {
View Full Code Here

  Map<PipelinedData, Node> parsePipelinedData(Gadget gadget, Document doc) {
    List<Element> dataTags = SocialDataTags.getTags(doc, SocialDataTags.OSML_DATA_TAG);
    Map<PipelinedData, Node> pipelineNodes = Maps.newHashMap();
    for (Element n : dataTags) {
      try {
        PipelinedData pipelineData = new PipelinedData(n, gadget.getSpec().getUrl());
        pipelineNodes.put(pipelineData, n);
      } catch (SpecParserException e) {
        // Leave the element to the client
        LOG.log(Level.INFO, "Failed to parse preload in " + gadget.getSpec().getUrl(), e);
      }
View Full Code Here

   */
  private HttpRequest createPipelinedProxyRequest(Gadget gadget, HttpRequest original) {
    HttpRequest request = new HttpRequest(original);
    request.setIgnoreCache(true);

    PipelinedData data = gadget.getCurrentView().getPipelinedData();
    if (data != null) {
      PipelineExecutor.Results results =
        pipelineExecutor.execute(gadget.getContext(), ImmutableList.of(data));

      if (results != null && !results.results.isEmpty()) {
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case Bpmn2Package.PROPERTY: {
            Property property = (Property) theEObject;
            T result = caseProperty(property);
            if (result == null)
                result = caseItemAwareElement(property);
            if (result == null)
                result = caseBaseElement(property);
View Full Code Here

                    MetafacadeConstants.NAMESPACE_SCOPE_OPERATOR,
                    true);
            if (modelElement instanceof Type)
            {
                Type element = (Type)modelElement;
                final Property property = umlClass.createOwnedAttribute(
                        name,
                        element,
                        1,
                        1);
                VisibilityKind kind = VisibilityKind.PUBLIC_LITERAL;
                if (visibility.equalsIgnoreCase("package"))
                {
                    kind = VisibilityKind.PACKAGE_LITERAL;
                }
                if (visibility.equalsIgnoreCase("private"))
                {
                    kind = VisibilityKind.PRIVATE_LITERAL;
                }
                if (visibility.equalsIgnoreCase("protected"))
                {
                    kind = VisibilityKind.PROTECTED_LITERAL;
                }
                property.setVisibility(kind);
                Stereotype stereotype =
                    UmlUtilities.findApplicableStereotype(
                        property,
                        UMLProfile.STEREOTYPE_IDENTIFIER);
                if (stereotype == null)
                {
                    throw new MetafacadeException("Could not apply '" + UMLProfile.STEREOTYPE_IDENTIFIER + "' to " +
                        property + ", the stereotype could not be found");
                }
                property.apply(stereotype);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.spec.PipelinedData$SocialData$Property

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.