Package org.apache.wookie.util.html

Examples of org.apache.wookie.util.html.HtmlCleaner.process()


    //
    // Process Features
    //
    addFlattenedFeatures(startFile.getParentFile(), engine, model);
    FileWriter writer = new FileWriter(startFile);
    engine.process(writer);
  }

  /**
   * Adds features to widget start file by injecting javascript and stylesheets
   * required by each supported feature in the model.
View Full Code Here


    //
    // Process Features
    //
    addFlattenedFeatures(startFile.getParentFile(), engine, model);
    FileWriter writer = new FileWriter(startFile);
    engine.process(writer);
  }

  /**
   * Adds features to widget start file by injecting javascript and stylesheets
   * required by each supported feature in the model.
View Full Code Here

    String out = "";
    StringWriter writer = new StringWriter();
    try {
      cleaner.setReader(new StringReader(content));
      cleaner.injectScript("test.js");
      cleaner.process(writer);
      out = writer.getBuffer().toString();
      assertEquals("<html><head><script type=\"text/javascript\" src=\"test.js\"></script></head><body></body></html>", out);
    } catch (IOException e) {
      fail();
    }
View Full Code Here

    String out = "";
    StringWriter writer = new StringWriter();
    try {
      cleaner.setReader(new StringReader(content));
      cleaner.injectScript("inject.js");
      cleaner.process(writer);
      out = writer.getBuffer().toString();
      assertEquals("<html><head><script type=\"text/javascript\" src=\"inject.js\"></script><script type=\"text/javascript\" src=\"user.js\"></script></head><body></body></html>", out);
    } catch (IOException e) {
      fail();
    }
View Full Code Here

    String out = "";
    StringWriter writer = new StringWriter();
    try {
      cleaner.setReader(new StringReader(content));
      cleaner.injectScript("inject.js");
      cleaner.process(writer);
      out = writer.getBuffer().toString();
      assertEquals("<html><head><script type=\"text/javascript\" src=\"inject.js\"></script><script type=\"text/javascript\" src=\"user.js\"></script><script type=\"text/javascript\">google.load(\"dojo\", \"1.4.1\");</script></head><body></body></html>", out);
    } catch (IOException e) {
      fail();
    }
View Full Code Here

    String out = "";
    StringWriter writer = new StringWriter();
    try {
      cleaner.setReader(new StringReader(content));
      cleaner.injectStylesheet("test.css");
      cleaner.process(writer);
      out = writer.getBuffer().toString();
      assertEquals("<html><head><link type=\"text/css\" rel=\"stylesheet\" href=\"test.css\" /></head><body></body></html>", out);
    } catch (IOException e) {
      fail();
    }
View Full Code Here

  public void nullReader() throws IOException{
    HtmlCleaner cleaner = new HtmlCleaner();
    StringWriter writer = new StringWriter();
    cleaner.setReader(null);
    cleaner.injectStylesheet("test.css");
    cleaner.process(writer);
    fail();
  }
  @Test (expected = IOException.class)
  public void nullContentInReader() throws IOException{
    HtmlCleaner cleaner = new HtmlCleaner();
View Full Code Here

  public void nullContentInReader() throws IOException{
    HtmlCleaner cleaner = new HtmlCleaner();
    StringWriter writer = new StringWriter();
    cleaner.setReader(new FileReader("bogus.html"));
    cleaner.injectStylesheet("test.css");
    cleaner.process(writer);
  }

  @Test  (expected = IOException.class)
  public void nullWriter() throws IOException{
    HtmlCleaner cleaner = new HtmlCleaner();
View Full Code Here

  public void nullWriter() throws IOException{
    HtmlCleaner cleaner = new HtmlCleaner();
    FileWriter writer = null;
    cleaner.setReader(new StringReader("test"));
    cleaner.injectStylesheet("test.css");
    cleaner.process(writer);
  }


}
View Full Code Here

    String out = "";
    StringWriter writer = new StringWriter();
    try {
      cleaner.setReader(new StringReader(content));
      cleaner.injectScript("test.js");
      cleaner.process(writer);
      out = writer.getBuffer().toString();
      assertEquals("<html><head><script type=\"text/javascript\" src=\"test.js\"></script></head><body></body></html>", out);
    } catch (IOException e) {
      fail();
    }
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.