protected HtmlCanvas createArchetypesCommandLines(Dependency dependency, String archetypeAdditionalArguments, boolean addBreak) throws IOException { HtmlCanvas archetypesCommandLine = new HtmlCanvas(); String commandLine = "mvn archetype:generate"; List<String> arguments = new ArrayList<>(); arguments.add("-DarchetypeGroupId=" + dependency.getGroupId()); arguments.add("-DarchetypeArtifactId=" + dependency.getArtifactId()); arguments.add("-DarchetypeVersion=" + dependency.getVersion()); if (archetypeAdditionalArguments != null) { String[] lines = archetypeAdditionalArguments.split(" "); if (lines.length > 0) { for (int i = 0; i < lines.length; i++) { arguments.add(lines[i].trim()); } } else { arguments.add(archetypeAdditionalArguments); } } this.project.getProperties().put("data-clipboard-text", getFullCommandLine(commandLine, arguments)); this.project.getProperties().put("command-title", " "); String templateStart = replaceProperties(replaceProperties("${commandLineStart}")); String templateEnd = replaceProperties(replaceProperties("${commandLineEnd}")); archetypesCommandLine = createCommandLines(commandLine, templateStart, templateEnd, arguments, new ArrayList<String>(), addBreak); addPropertyInSessionRequest(dependency.getArtifactId() + "_ArchetypeCommandLine", archetypesCommandLine.toHtml()); HtmlCanvas result = new HtmlCanvas(); result. p().write("Command line for this archetype:")._p(). write(archetypesCommandLine.toHtml(), false); return result; }
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 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 void writeSteps(String[] steps, String title) throws IOException { html.p().content("How to Run " + title); html.ul(); for(String step : steps) html.li().content(step); html._ul(); }
private static void writeSteps(String[] steps, String title) throws IOException { html.p().content("How to Run " + title); html.ul(); for(String step : steps) html.li().content(step); html._ul(); }
private static void toTestClass(String name) throws IOException { html.p(class_("totest")).a(href("#" + name)) .content("Back to Main Test Class")._p(); }
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(); }
@Override public void renderOn(HtmlCanvas html) throws IOException { html.p(); if (description != null && !description.isEmpty()) { html.write(replaceProperties(description), false).br(); } if (name != null && !name.isEmpty()) { if (description != null && !description.isEmpty()) { html.br(); } html.b().write("Parameter name is")._b().write(": " + name + "."); } if (property != null && !property.isEmpty()) { if (name != null && !name.isEmpty() || description != null && !description.isEmpty()) { html.br(); } html.b().write("User property is")._b().write(": " + property + "."); } if (defaultValue != null && !defaultValue.isEmpty()) { if (property != null && !property.isEmpty() || name != null && !name.isEmpty() || description != null && !description.isEmpty()) { html.br(); } html.b().write("Default value is")._b().write(": " + defaultValue + "."); } html._p(); } });
parameters += p.toString() + " "; html.p(class_("indented")).b().write("Parameters: ")._b() .write(parameters)._p(); .getAnnotation(SpecTest.class); if(!testLdp.comment().equals("")) html.p(class_("note")).b().write("NOTE: ")._b() .write(testLdp.comment())._p(); if(testLdp.steps().length != 0) writeSteps(testLdp.steps(), m.getName()); if(testLdp.coveredByTests().length > 0 && testLdp.coveredByGroups().length > 0){ html.p().b().content("Test Case is covered Indirectly by the following:")._p(); html.ul(); for(Class<?> className : testLdp.coveredByTests()){ html.p(class_("indented")).b().write("Reference URI: ")._b() .a(href(testLdp.specRefUri())).write(testLdp.specRefUri())._a()._p();
result.p().a(href(gitlabRepository + "/compare/" + lastCommitId + "..." + commitId)).write("Full changelog")._a()._p(); result = result._ul(); } else { result = result.p().write("No merge request for this release")._p(); result = result._ul(); } else { result = result.p().write("No issue for this release")._p();
@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); } }
html.p().write("")._p(); html.b().write("Used by Class: ")._b(); boolean seen=false; writeSteps(testLdp.steps(), method.getName()); if(!testLdp.comment().equals("")) html.p(class_("note")).b().write("NOTE: ")._b() .write(testLdp.comment())._p(); if(testLdp.testMethod().equals(METHOD.INDIRECT)){ html.p().b().write("This test is covered Indirectly by other test cases.")._b()._p(); html.p().content("Test Cases that cover this test:"); html.ul(); for(Class<?> coverTest : testLdp.coveredByTests()) {
private void generateDetail(IResultMap tests) throws IOException { for (ITestResult m : tests.getAllResults()) { ITestNGMethod method = m.getMethod(); String normalizedName = AbstractEarlReporter.createTestCaseName( m.getTestClass().getName(), method.getMethodName()); html.h2() .a(id(m.getTestClass().getName() + "_" + method.getMethodName())) .write(normalizedName)._a()._h2(); getAdditionalInfo(m, method); html.p(class_("indented")) .b() .write("Description: ") ._b() .write((method.getDescription() != null ? method .getDescription() : "No description for this test method found")) ._p(); String groups = ""; for (String group : method.getGroups()) { groups += group + " "; } html.p(class_("indented")).b().write("Requirement Level: ")._b() .write(groups)._p(); toTop(); } }
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 HtmlCanvas getContent(HtmlCanvas html) throws IOException, SAXException { html. div(class_("row")). div(class_("span12")). div(class_("body-content")). div(class_("section")). div(class_("page-header")). h2(id(packagingName + "-packaging")).write(packagingName + " packaging")._h2(). p().write("This is the packaging for " + packagingName + ".")._p() ._div() ._div() ._div() ._div() ._div(); return html; } };
div(class_("section")). h3(id("Global_Parameters")).write("Global Parameters")._h3(). p().em().write("By default, only parameters which cannot be guessed are displayed. ")._em(). a(href("#").id("toggleGuessed")).write("Show other parameters")._a().write(" to customize default values.")._p(); html.p().write(c.description)._p();
private HtmlCanvas getLifecyclesDocumentation(HtmlCanvas html) throws IOException { html. div(class_("row")). div(class_("span12")). div(class_("body-content")). div(class_("section")). div(class_("page-header")). h2(id("Lifecycles")).write("Lifecycles")._h2(). p().write("The different lifecycles of the plugin are associated with custom packagings.")._p(); html.render(new Renderable() { @Override public void renderOn(HtmlCanvas html) throws IOException { getLifecyclesSection(html); } }); html ._div() ._div() ._div() ._div() ._div(); return html; }
private HtmlCanvas generateGlobalDocumentation(HtmlCanvas html) throws IOException { html. div(class_("row")). div(class_("span12")). div(class_("body-content")). div(class_("section")). div(class_("page-header")). h2(id("Global_Documentation")).write("Global Documentation")._h2(). p().write("The global documentation describes parameters which are common to a group of projects.")._p(); html.render(new Renderable() { @Override public void renderOn(HtmlCanvas html) throws IOException { generateGlobalParametersSection(html); } }); html.render(new Renderable() { @Override public void renderOn(HtmlCanvas html) throws IOException { generateSampleProfileDocumentation(html); } }); html ._div() ._div() ._div() ._div() ._div(); return html; }
html.b().write("No test cases awaiting approval.")._b().br(); } else { html.p().write("For details of test cases, ") .a(href("https://github.com/w3c/ldp-testsuite")) .write("see source in GitHub")._a()._p();