/** * Write the link tag with a reference to the favicon. * @param iconHref * @return the canvas * @throws IOException */ public T favicon(String iconHref) throws IOException { return (T)canvas .link(href(iconHref) .rel("shortcut icon")); } }
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(); } }
@Override public void renderOn(HtmlCanvas html) throws IOException { String goalName = null; if (goal != null && getMavenProject() != null && goal.startsWith(getMavenProject().getGroupId() + ":" + getMavenProject().getArtifactId())) { goalName = goal.substring(goal.lastIndexOf(":") + 1, goal.length()); } if (goalName != null) { html.a(href("./" + goalName + "-mojo.html")); } html.write(goal); if (goalName != null) { html._a(); } html.br(); } });
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 static <T> void writeTestTables(Class<T> testClass) throws IOException { html.b().a(href("#" + testClass.getCanonicalName())) .content(testClass.getCanonicalName())._b(); html.br(); writeTestClassTable(testClass); html.br(); }
private void writeIndirectCases() throws IOException { if(indirectCases.size() == 0){ html.p().b().write("No Indirect Test Cases.")._b()._p(); } else { html.ul(); for (Method method : indirectCases) { if (method.getAnnotation(SpecTest.class) != null) { String name = method.getDeclaringClass().getCanonicalName(); name = name.substring(name.lastIndexOf(".") + 1); String normalizedName = AbstractEarlReporter.createTestCaseName(name, method.getName()); html.li().a(href("#" + method.getName())).b().write(normalizedName)._b()._a()._li(); } } html._ul(); } }
private static void toTestClass(String name) throws IOException { html.p(class_("totest")).a(href("#" + name)) .content("Back to Main Test Class")._p(); }
@Override public void renderOn(HtmlCanvas html) throws IOException { html.li().a(href(subMenuLink)).write(subMenuElement)._a()._li(); }
private void toTop() throws IOException { html.p(class_("totop")).a(href("#top")).content("Back to Top")._p(); } private void writeOverallBarChart() throws IOException {
private static void toTop() throws IOException { html.p(class_("totop")).a(href("#top")).content("Back to Top")._p(); }
/** * Render the receiver on a html to provide debugging information about the exception. */ public void renderOn(HtmlCanvas html) throws IOException { html.div(style("color:red")); if (isEmptyStack) { html.write("[Render Error] unexpected close()"); return; } if (expectedTag != null) { // tag mismatch html.write(String.format("[Render Error] expected [%s] actual [%s]", expectedTag, closingTag)); } if (exception != null) { // general error html.write(String.format("[Render Error] general exception [%s]", exception.getMessage())); } // if debugging, the error component is available Renderable errorComponent = (Renderable)(html.getPageContext().getObject("renderable.error")); if (errorComponent != null) { html.write(" in ").write(errorComponent.getClass().getName()); } else { html.a(href("?inspect")).write(" Inspect details")._a(); this.renderStackTraceOn(html); } html._div(); } /**
@SuppressWarnings("unchecked") protected void generateHTMLReport() throws IOException, SecurityException { html = new HtmlCanvas(); html.html().head(); writeCss(); html.title().content(title + ": Test Cases Coverage Report")._head().body(); html.h1().content("W3C Linked Data Platform (" + title + ") Test Suite: Test Cases Coverage Report"); html.p().a(href("http://www.w3.org/2012/ldp/")).content("See also W3C Linked Data Platform WG")._p(); html.p().a(href(specUri)).content("Specification Requirements Page")._p(); final String commit = BuildProperties.getRevision(); if (commit != null) { html.div() .write("Test Suite Revision: ") .a(href("https://github.com/w3c/ldp-testsuite/commit/" + commit)).content(commit)._div(); } DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.ENGLISH); html.div().content("Updated: " + dateFormat.format(new Date())); // Generate the summary diagrams and information createSummaryReport(); toTop(); // Go through all the classes and generate details of each test case for (@SuppressWarnings("rawtypes") Class testcaseClass: testClasses) { writeTestCasesForClass(testcaseClass); } }
private void updateMenu(File htmlFile, List<SubMenuReplacement> subMenuReplacements) throws IOException, MojoExecutionException { if (subMenuReplacements == null || subMenuReplacements.isEmpty()) return; for (SubMenuReplacement subMenuReplacement : subMenuReplacements) { HtmlCanvas html = new HtmlCanvas(); html .li(class_("dropdown-submenu")) .a(href(subMenuReplacement.getOriginalMenuElementLink())).write(subMenuReplacement.getOriginalMenuElement())._a() .ul(class_("dropdown-menu")); if (subMenuReplacement.getSubMenuElements() != null) { for (String subMenuElement : subMenuReplacement.getSubMenuElements().keySet()) { html.render(new SubMenuElement(subMenuElement, subMenuReplacement.getSubMenuElements().get(subMenuElement))); } } html ._ul() ._li(); replaceByLine(htmlFile, "<li.*><a href=.*>" + subMenuReplacement.getOriginalMenuElement() + "</a></li>", formatHtml(html.toHtml())); } }
private void makeMethodsList(ITestContext testContext) throws IOException { IResultMap failed = testContext.getFailedTests(); IResultMap passed = testContext.getPassedTests(); IResultMap skipped = testContext.getSkippedTests(); html.h1(class_("center")).content("Methods called"); html.a(href("#Skipped")).write("Go To Skipped Tests").br()._a(); html.a(href("#Passed")).write("Go To Passed Tests").br()._a(); html.a(href("#Indirect")).write("Go To Indirect Tests").br()._a(); html.br(); makeMethodSummaryTable(failed, "Failed"); html.br(); toTop(); html.br(); makeMethodSummaryTable(skipped, "Skipped"); html.br(); toTop(); html.br(); makeMethodSummaryTable(passed, "Passed"); html.br(); toTop(); makeIndirectSummaryTable(); html.br(); }
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 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 void generateSummaryTableStart(Date date, String suiteName) throws IOException { html.tr().th().content("Test Suite Name"); html.th().content("Revision"); html.th().content("Report Date"); html.th().content("Skipped Tests"); html.th().content("MUST Requirements"); html.th().content("SHOULD Requirements"); html.th().content("MAY Requirements"); html._tr(); html.tr(class_("alt")).td().content(suiteName); final String commit = BuildProperties.getRevision(); if (commit == null) { html.td().content("<UNKNOWN>"); } else { html.td().a(href("https://github.com/w3c/ldp-testsuite/commit/" + commit)).content(commit)._td(); } html.td().content(date.toString()); }
private HtmlCanvas generateSampleProfileDocumentation(HtmlCanvas html) throws IOException { HtmlCanvas sampleProfile = new HtmlCanvas(); sampleProfile = generateSampleProfile(sampleProfile); html. div(class_("section")). h3(id("Sample_Profile")).write("Sample Profile")._h3(). p().em().write("Based on above properties, here is a sample profile to include in ").a(href("https://maven.apache.org/settings.html")).write("Maven settings.xml file")._a().write(":")._em()._p(). write(sampleProfile.toHtml(), false). write(sampleProfileCommandLineGenerator, false) ._div(); addPropertyInSessionRequest("sampleProfile", sampleProfile.toHtml()); return html; }
@Override public void renderOn(HtmlCanvas html) throws IOException { html. div(class_("section")). h3(id("Lifecycle_"+this.getPackagingName())).a(href("packaging-"+this.getPackagingName()+".html")).write(this.getPackagingName())._a()._h3(). table(border("0").class_("bodyTable table table-striped table-hover")). thead(). tr(class_("a")). th().write("Phase")._th(). th().write("Goal")._th(). _tr() ._thead(). tbody(); for (t3.LifecyclesUtils.Phase phase : this.getPhases()) { ((Phase) phase).renderOn(html); } html ._tbody() ._table() ._div(); }
} else { html.p().write("For details of test cases, ") .a(href("https://github.com/w3c/ldp-testsuite")) .write("see source in GitHub")._a()._p(); html.ul();