@Test public void execute() throws MojoExecutionException, MojoFailureException { markupToEclipseHelp.multipleOutputFiles = true; markupToEclipseHelp.title = "Test This"; markupToEclipseHelp.execute(); assertTrue(computeOutputFile("test.html").exists()); assertTrue(computeOutputFile("test-toc.xml").exists()); assertTrue(computeOutputFile("Top-Level-Heading-2.html").exists()); assertTrue(computeOutputFile("Top-Level-Heading-3.html").exists()); assertTrue(computeOutputFile("images/wikitext-32.gif").exists()); assertFalse(computeOutputFile("test.textile").exists()); assertHasContent("test.html", "<title>Test This</title>"); assertHasContent("test.html", "<h1 id=\"TestFile\">Test File</h1>"); assertHasContent("test-toc.xml", "<toc topic=\"test.html\" label=\"Test This\">"); assertHasContent("test-toc.xml", "<topic href=\"Top-Level-Heading-2.html\" label=\"Top Level Heading 2\">"); assertHasContent("Top-Level-Heading-2.html", "<h1 id=\"TopLevelHeading2\">Top Level Heading 2</h1>"); assertHasContent("Top-Level-Heading-3.html", "<h1 id=\"TopLevelHeading3\">Top Level Heading 3</h1>"); }
public void execute() throws MojoExecutionException, MojoFailureException { try { ensureOutputFolderExists(); ensureSourceFolderExists(); ServiceLocator serviceLocator = ServiceLocator.getInstance(MarkupToEclipseHelpMojo.class.getClassLoader()); Set<MarkupLanguage> markupLanguages = serviceLocator.getAllMarkupLanguages(); if (markupLanguages.isEmpty()) { throw new MojoFailureException("No markup languages are available"); } getLog().info( format("Generating Eclipse help content from sources: {0} -> {1}", sourceFolder, outputFolder)); final FileToMarkupLanguage fileToMarkupLanguage = new FileToMarkupLanguage(markupLanguages); SourceFileTraversal fileTraversal = new SourceFileTraversal(sourceFolder); final AtomicInteger fileCount = new AtomicInteger(); fileTraversal.traverse((relativePath, sourceFile) -> { fileCount.incrementAndGet(); process(sourceFile, relativePath, fileToMarkupLanguage.get(sourceFile)); }); getLog().info(format("Processed {0} files", fileCount.get())); } catch (BuildFailureException e) { getLog().error(e.getMessage(), e); throw new MojoFailureException(e.getMessage(), e.getCause()); } }
MarkupToEclipseHelpMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { try { ensureOutputFolderExists(); ensureSourceFolderExists(); ServiceLocator serviceLocator = ServiceLocator.getInstance(MarkupToEclipseHelpMojo.class.getClassLoader()); Set<MarkupLanguage> markupLanguages = serviceLocator.getAllMarkupLanguages(); if (markupLanguages.isEmpty()) { throw new MojoFailureException("No markup languages are available"); } getLog().info( format("Generating Eclipse help content from sources: {0} -> {1}", sourceFolder, outputFolder)); final FileToMarkupLanguage fileToMarkupLanguage = new FileToMarkupLanguage(markupLanguages); SourceFileTraversal fileTraversal = new SourceFileTraversal(sourceFolder); final AtomicInteger fileCount = new AtomicInteger(); fileTraversal.traverse((relativePath, sourceFile) -> { fileCount.incrementAndGet(); process(sourceFile, relativePath, fileToMarkupLanguage.get(sourceFile)); }); getLog().info(format("Processed {0} files", fileCount.get())); } catch (BuildFailureException e) { getLog().error(e.getMessage(), e); throw new MojoFailureException(e.getMessage(), e.getCause()); } } }
MarkupToEclipseHelpMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { try { ensureOutputFolderExists(); ensureSourceFolderExists(); ServiceLocator serviceLocator = ServiceLocator.getInstance(MarkupToEclipseHelpMojo.class.getClassLoader()); Set<MarkupLanguage> markupLanguages = serviceLocator.getAllMarkupLanguages(); if (markupLanguages.isEmpty()) { throw new MojoFailureException("No markup languages are available"); } getLog().info( format("Generating Eclipse help content from sources: {0} -> {1}", sourceFolder, outputFolder)); final FileToMarkupLanguage fileToMarkupLanguage = new FileToMarkupLanguage(markupLanguages); SourceFileTraversal fileTraversal = new SourceFileTraversal(sourceFolder); final AtomicInteger fileCount = new AtomicInteger(); fileTraversal.traverse((relativePath, sourceFile) -> { fileCount.incrementAndGet(); process(sourceFile, relativePath, fileToMarkupLanguage.get(sourceFile)); }); getLog().info(format("Processed {0} files", fileCount.get())); } catch (BuildFailureException e) { getLog().error(e.getMessage(), e); throw new MojoFailureException(e.getMessage(), e.getCause()); } }  }
MarkupToEclipseHelpMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { try { ensureOutputFolderExists(); ensureSourceFolderExists(); ServiceLocator serviceLocator = ServiceLocator.getInstance(MarkupToEclipseHelpMojo.class.getClassLoader()); Set<MarkupLanguage> markupLanguages = serviceLocator.getAllMarkupLanguages(); if (markupLanguages.isEmpty()) { throw new MojoFailureException("No markup languages are available"); } getLog().info( format("Generating Eclipse help content from sources: {0} -> {1}", sourceFolder, outputFolder)); final FileToMarkupLanguage fileToMarkupLanguage = new FileToMarkupLanguage(markupLanguages); SourceFileTraversal fileTraversal = new SourceFileTraversal(sourceFolder); final AtomicInteger fileCount = new AtomicInteger(); fileTraversal.traverse((relativePath, sourceFile) -> { fileCount.incrementAndGet(); process(sourceFile, relativePath, fileToMarkupLanguage.get(sourceFile)); }); getLog().info(format("Processed {0} files", fileCount.get())); } catch (BuildFailureException e) { getLog().error(e.getMessage(), e); throw new MojoFailureException(e.getMessage(), e.getCause()); } }  void execute(); }
MarkupToEclipseHelpMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { try { ensureOutputFolderExists(); ensureSourceFolderExists(); ServiceLocator serviceLocator = ServiceLocator.getInstance(MarkupToEclipseHelpMojo.class.getClassLoader()); Set<MarkupLanguage> markupLanguages = serviceLocator.getAllMarkupLanguages(); if (markupLanguages.isEmpty()) { throw new MojoFailureException("No markup languages are available"); } getLog().info( format("Generating Eclipse help content from sources: {0} -> {1}", sourceFolder, outputFolder)); final FileToMarkupLanguage fileToMarkupLanguage = new FileToMarkupLanguage(markupLanguages); SourceFileTraversal fileTraversal = new SourceFileTraversal(sourceFolder); final AtomicInteger fileCount = new AtomicInteger(); fileTraversal.traverse((relativePath, sourceFile) -> { fileCount.incrementAndGet(); process(sourceFile, relativePath, fileToMarkupLanguage.get(sourceFile)); }); getLog().info(format("Processed {0} files", fileCount.get())); } catch (BuildFailureException e) { getLog().error(e.getMessage(), e); throw new MojoFailureException(e.getMessage(), e.getCause()); } }  void execute();  }