Package org.apache.shindig.gadgets.preload

Examples of org.apache.shindig.gadgets.preload.PreloadedData


  /** Create a mock Callable for a single preload task */
  private Callable<PreloadedData> createPreloadTask(final String key, String jsonResult)
      throws JSONException {
    final JSONObject value = new JSONObject(jsonResult);
    value.put("id", key);
    final PreloadedData preloadResult = new PreloadedData() {
      public Collection<Object> toJson() throws PreloadException {
        return ImmutableList.<Object>of(value);
      }
    };

View Full Code Here


    final Collection<Object> someData = ImmutableList.of("string", (Object) 99, 4343434.345345d);

    // Other types are supported (anything valid for org.json.JSONObject), but equality comparisons
    // are more complicated because JSON doesn't implement interfaces like Collection or Map, or
    // implementing equals.
    PreloadedData preloadedData = new PreloadedData() {
      public Collection<Object> toJson() throws PreloadException {
        return someData;
      }
    };
    Gadget gadget = makeDefaultGadget().setPreloads(ImmutableList.of(preloadedData));
View Full Code Here

    }
  }

  @Test
  public void failedPreloadHandledGracefully() throws Exception {
    PreloadedData preloadedData = new PreloadedData() {
      public Collection<Object> toJson() throws PreloadException {
        throw new PreloadException("test");
      }
    };
View Full Code Here

    final Collection<Object> someData = ImmutableList.of("string", (Object) 99, 4343434.345345d);

    // Other types are supported (anything valid for org.json.JSONObject), but equality comparisons
    // are more complicated because JSON doesn't implement interfaces like Collection or Map, or
    // implementing equals.
    PreloadedData preloadedData = new PreloadedData() {
      public Collection<Object> toJson() {
        return someData;
      }
    };
    Gadget gadget = makeDefaultGadget().setPreloads(ImmutableList.of(preloadedData));
View Full Code Here

    }
  }

  @Test
  public void failedPreloadHandledGracefully() throws Exception {
    PreloadedData preloadedData = new PreloadedData() {
      public Collection<Object> toJson() throws PreloadException {
        throw new PreloadException("test");
      }
    };
View Full Code Here

    final Collection<Object> someData = ImmutableList.of("string", (Object) 99, 4343434.345345d);

    // Other types are supported (anything valid for org.json.JSONObject), but equality comparisons
    // are more complicated because JSON doesn't implement interfaces like Collection or Map, or
    // implementing equals.
    PreloadedData preloadedData = new PreloadedData() {
      public Collection<Object> toJson() {
        return someData;
      }
    };
    Gadget gadget = makeDefaultGadget().setPreloads(ImmutableList.of(preloadedData));
View Full Code Here

    }
  }

  @Test
  public void failedPreloadHandledGracefully() throws Exception {
    PreloadedData preloadedData = new PreloadedData() {
      public Collection<Object> toJson() throws PreloadException {
        throw new PreloadException("test");
      }
    };
View Full Code Here

    final Collection<Object> someData = ImmutableList.of("string", (Object) 99, 4343434.345345d);

    // Other types are supported (anything valid for org.json.JSONObject), but equality comparisons
    // are more complicated because JSON doesn't implement interfaces like Collection or Map, or
    // implementing equals.
    PreloadedData preloadedData = new PreloadedData() {
      public Collection<Object> toJson() {
        return someData;
      }
    };
    Gadget gadget = makeDefaultGadget().setPreloads(ImmutableList.of(preloadedData));
View Full Code Here

    }
  }

  @Test
  public void failedPreloadHandledGracefully() throws Exception {
    PreloadedData preloadedData = new PreloadedData() {
      public Collection<Object> toJson() throws PreloadException {
        throw new PreloadException("test");
      }
    };
View Full Code Here

  /** Create a mock Callable for a single preload task */
  private Callable<PreloadedData> createPreloadTask(final String key, String jsonResult)
      throws JSONException {
    final JSONObject value = new JSONObject(jsonResult);
    value.put("id", key);
    final PreloadedData preloadResult = new PreloadedData() {
      public Collection<Object> toJson() throws PreloadException {
        return ImmutableList.<Object>of(value);
      }
    };

View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.preload.PreloadedData

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.