Package org.apache.shindig.gadgets.rewrite.OsTemplateXmlLoaderRewriter

Examples of org.apache.shindig.gadgets.rewrite.OsTemplateXmlLoaderRewriter.Converter


  public void setUp() {
    Injector injector = Guice.createInjector(new ParseModule(), new PropertiesModule());
    parser = injector.getInstance(GadgetHtmlParser.class);
    domImpl = injector.getInstance(DOMImplementation.class);
    doc = domImpl.createDocument(null, null, null);
    converter = new Converter(parser, domImpl);
  }
View Full Code Here


  }
 
  private void checkRevisitSingle(Element tpl, String id) throws Exception {
    Gadget gadget = mockGadget(OsTemplateXmlLoaderRewriter.OS_TEMPLATES_FEATURE_NAME, "another");
    String xmlVal = "xml";
    Converter converter = mockConverter(xmlVal, "{thejson}", 1);
    tpl.setTextContent(xmlVal);
    completeDocAsHtml(tpl);
    assertTrue(revisit(gadget, converter, tpl));
    verify(gadget);
    verify(converter);
View Full Code Here

    Element tplName = createRewritableDiv();
    tplName.removeAttribute("id");
    tplName.setAttribute("name", "otherid");
    Gadget gadget = mockGadget(OsTemplateXmlLoaderRewriter.OS_TEMPLATES_FEATURE_NAME, "another");
    String xmlVal = "thexml";
    Converter converter = mockConverter(xmlVal, "{thejson}", 2);
    tplId.setTextContent(xmlVal);
    tplName.setTextContent(xmlVal);
    completeDocAsHtml(tplId, tplName);
    assertTrue(revisit(gadget, converter, tplId, tplName));
    verify(gadget);
View Full Code Here

    replay(gadget);
    return gadget;
  }
 
  private Converter mockConverter(String xml, String result, int times) {
    Converter converter = createMock(Converter.class);
    expect(converter.domToJson(xml)).andReturn(result).times(times);
    replay(converter);
    return converter;
  }
View Full Code Here

      throws Exception {
    HttpRequest req = new HttpRequest(Uri.parse("http://dummy.com")).setRewriteMimeType(reqMime);
    HttpResponse resp = new HttpResponseBuilder().setHeader("Content-Type", origMime).create();
    String inXml = "thexml";
    String outJson = "{thejson}";
    Converter converter = mockConverter(inXml, outJson, 1);
    MutableContent mc = createMock(MutableContent.class);
    if (expectRewrite) {
      expect(mc.getContent()).andReturn(inXml).once();
      mc.setContent(outJson);
      expectLastCall().once();
View Full Code Here

  public void setUp() {
    Injector injector = Guice.createInjector(new ParseModule(), new PropertiesModule());
    parser = injector.getInstance(GadgetHtmlParser.class);
    domImpl = injector.getInstance(DOMImplementation.class);
    doc = domImpl.createDocument(null, null, null);
    converter = new Converter(parser, domImpl);
  }
View Full Code Here

  }

  private void checkRevisitSingle(Element tpl, String id) throws Exception {
    Gadget gadget = mockGadget(OsTemplateXmlLoaderRewriter.OS_TEMPLATES_FEATURE_NAME, "another");
    String xmlVal = "xml";
    Converter converter = mockConverter(xmlVal, "{thejson}", 1);
    tpl.setTextContent(xmlVal);
    completeDocAsHtml(tpl);
    assertTrue(revisit(gadget, converter, tpl));
    verify(gadget);
    verify(converter);
View Full Code Here

    Element tplName = createRewritableDiv();
    tplName.removeAttribute("id");
    tplName.setAttribute("name", "otherid");
    Gadget gadget = mockGadget(OsTemplateXmlLoaderRewriter.OS_TEMPLATES_FEATURE_NAME, "another");
    String xmlVal = "thexml";
    Converter converter = mockConverter(xmlVal, "{thejson}", 2);
    tplId.setTextContent(xmlVal);
    tplName.setTextContent(xmlVal);
    completeDocAsHtml(tplId, tplName);
    assertTrue(revisit(gadget, converter, tplId, tplName));
    verify(gadget);
View Full Code Here

    replay(gadget);
    return gadget;
  }

  private Converter mockConverter(String xml, String result, int times) {
    Converter converter = createMock(Converter.class);
    expect(converter.domToJson(xml)).andReturn(result).times(times);
    replay(converter);
    return converter;
  }
View Full Code Here

      throws Exception {
    HttpRequest req = new HttpRequest(Uri.parse("http://dummy.com")).setRewriteMimeType(reqMime);
    HttpResponse resp = new HttpResponseBuilder().setHeader("Content-Type", origMime).create();
    String inXml = "thexml";
    String outJson = "{thejson}";
    Converter converter = mockConverter(inXml, outJson, 1);
    MutableContent mc = createMock(MutableContent.class);
    if (expectRewrite) {
      expect(mc.getContent()).andReturn(inXml).once();
      mc.setContent(outJson);
      expectLastCall().once();
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.rewrite.OsTemplateXmlLoaderRewriter.Converter

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.