/** * Write the content as text using the html. Escape if needed. */ public void renderOn(HtmlCanvas html) throws IOException { html.write(content, escapeNeeded); } }
private void writePassFailLegend() throws IOException { html.write("<svg id=\"passFailLegend\" width=\"150\" height=\"250\">", NO_ESCAPE); html.write("<rect width=\"15\" height=\"15\" x=\"0\" y=\"0\" style=\"fill:#a2bf2f\"/>", NO_ESCAPE); html.write("<text x=\"20\" y=\"13\" fill=\"black\">Passed Tests</text>", NO_ESCAPE); html.write("<rect width=\"15\" height=\"15\" x=\"0\" y=\"20\" style=\"fill:#a80000\"/>", NO_ESCAPE); html.write("<text x=\"20\" y=\"33\" fill=\"black\">Failed Tests</text>", NO_ESCAPE); html.write("<rect width=\"15\" height=\"15\" x=\"0\" y=\"40\" style=\"fill:#606060\"/>", NO_ESCAPE); html.write("<text x=\"20\" y=\"53\" fill=\"black\">Skipped Tests</text>", NO_ESCAPE); html.write("</svg>"); }
public void renderOn(HtmlCanvas html) throws IOException { html.write(this.declaration,false); } }
public class CssRenderable implements Renderable { public void renderOn(HtmlCanvas html) throws IOException { String host = RequestUtils.getHeaderValue(html, "HOST"); if(host.startsWith("localhost")) return; html.write(StringResource.get("assets/stylesheets/mystyle.css"),NO_ESCAPE); } }
/** * Convenience method that calls write(aString) and closes the last opened tag. * The content (aString) will be HTML escaped. * @param aString * @return * @throws IOException */ public HtmlCanvas content(String aString) throws IOException { this.write(aString); return this.close(); } /**
private void printReqCellResult(int passed, int failed, int skipped) throws IOException { int total = passed + failed + skipped; html.td().b().write(passed + "/" + total)._b(); html.write(" Passed"); html.br().b().write(failed + "/" + total)._b(); html.write(" Failed"); html.br().b().write(skipped + "/" + total)._b(); html.write(" Skipped"); html._td(); }
/** * Render information about the exception (if any) * @param html * @throws IOException */ public void renderStackTraceOn(HtmlCanvas html) throws IOException { // @formatter:off if (null == exception) return; StringWriter sw = new StringWriter(); PrintWriter buffer = new PrintWriter(sw); exception.printStackTrace(buffer); html.pre().write(sw.toString(), true)._pre(); html.hr(); }
/** * Write some character data inside a CDATA section. * @param cdata * @return the canvas * @throws IOException */ public T cdata(String cdata) throws IOException { canvas.cdata(); canvas.write(cdata,NO_ESCAPE); return (T)canvas._cdata(); }
@Override public void renderOn(HtmlCanvas html) throws IOException { if (caption == null || caption.trim().isEmpty()) return; html .a(class_("brand").href(link)) .write(caption, false) ._a(); } }
private static void iterateTableList(HashMap<String, String> list) throws IOException { String className; String methodName; Iterator<Entry<String, String>> codeIter = list.entrySet().iterator(); while(codeIter.hasNext()){ Entry<String, String> entry = codeIter.next(); className = entry.getValue(); className = className.substring(className.lastIndexOf(".") + 1); methodName = entry.getKey(); String normalizedName = AbstractEarlReporter.createTestCaseName(className, methodName); html.li().a(href("#" + methodName)).b().write(normalizedName)._b()._a()._li(); } }
public static void renderCssOn(HtmlCanvas html) throws IOException {// @formatter:off html .style(type("text/css")) .write(".rendersnake-inspector { border: 1px solid red }") ._style(); } // @formatter:on
private static void writeCss() throws IOException { html.style().write(StringResource.get("testCaseStyle.css"), NO_ESCAPE) ._style(); }
private static void generateList(ArrayList<String> list) throws IOException { if(list.size() == 0) { html.p().content("No tests of this type found."); } else { html.ul(); for (int i = 0; i < list.size(); i++) { html.li().a(href("#" + list.get(i))).write(list.get(i))._a()._li(); } html._ul(); } }
private <T> void writeTestCasesForClass(Class<T> classType) throws IOException, SecurityException { String className = classType.getCanonicalName(); html.h2().a(id(className)).write("Test Class: " + className)._a()._h2(); html.ul(); for (Method method : classType.getDeclaredMethods()) { if (method.isAnnotationPresent(Test.class)) { writeTestCaseDetails(method, className); } } html._ul(); toTop(); }
@Override public void renderOn(HtmlCanvas html) throws IOException { html.li().a(href(subMenuLink)).write(subMenuElement)._a()._li(); }
private HtmlCanvas addIssue(HtmlCanvas html, Issue issue) throws IOException { MutableDataSet options = new MutableDataSet(); Parser parser = Parser.builder(options).build(); HtmlRenderer renderer = HtmlRenderer.builder(options).build(); String description = issue.getDescription(); description = renderer.render(parser.parse(description)); return html.li().h5().write(issue.getTitle() + " ").a(href(gitlabRepository + "/issues/"+issue.getIid()).class_("external")).write("#"+issue.getIid())._a()._h5().write(description, false)._li(); }
private HtmlCanvas addMergeRequest(HtmlCanvas html, MergeRequest mergeRequest) throws IOException { MutableDataSet options = new MutableDataSet(); Parser parser = Parser.builder(options).build(); HtmlRenderer renderer = HtmlRenderer.builder(options).build(); String description = mergeRequest.getDescription(); description = renderer.render(parser.parse(description)); return html.li().h5().write(mergeRequest.getTitle() + " ").a(href(gitlabRepository + "/merge_requests/"+mergeRequest.getIid()).class_("external")).write("#"+mergeRequest.getIid())._a()._h5().write(description, false)._li(); }
private static void amendReport() throws IOException { html.script().content(StringResource.get("/raphael/raphael-min.js"), NO_ESCAPE); html.script().content(StringResource.get("/prototype/prototype.js"), NO_ESCAPE); html.script().content(StringResource.get("/grafico/grafico-min.js"), NO_ESCAPE); html.write(graphs.toString(), NO_ESCAPE); html._body()._html(); }
private static <T> void writeTestClassTable(Class<T> classType) throws IOException { html.span(class_("chartStart")); html.label(class_("label")).b().write("Test Case Status")._b()._label(); html.div(class_("smallBar").id(classType.getSimpleName() + "_statusbar"))._div(); writeStatusLegend(); html.span(class_("chartStart")); html.label(class_("label")).b().write("Test Case Implementation")._b()._label(); html.div(class_("smallBar").id(classType.getSimpleName() + "_implmtbar"))._div(); writeImplmntLegend(); acquireTestInfo(classType); }