Skip to content

Commit

Permalink
Merge branch 'master' into documentation_update
Browse files Browse the repository at this point in the history
  • Loading branch information
antares1470 committed Jul 11, 2024
2 parents 75ea0f8 + ae3aa2a commit 0f99f4f
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class Generator implements Runnable {
private static final Logger LOGGER = Logger.getLogger(Generator.class.getName());
private static String baseDirectory = "";
private static String tocDirectory = "";
private static String onlineTocDirectory = "";
public static final String TOC_FILE_NAME = "toc.md";
public static final String ROOT_NODE_NAME = "Constellation Documentation";

Expand All @@ -60,10 +61,14 @@ public Generator() {
public void run() {
baseDirectory = getBaseDirectory();
tocDirectory = String.format("ext%1$s%2$s", File.separator, TOC_FILE_NAME);
onlineTocDirectory = getOnlineHelpTOCDirectory(baseDirectory);

// Create TOCFile with the location of the resources file
// Create the root node for application-wide table of contents
TOCGenerator.createTOCFile(baseDirectory + tocDirectory);

// Also create the TOCFile in the base directory for online help
TOCGenerator.createTOCFile(onlineTocDirectory);
final TreeNode<?> root = new TreeNode(new TOCItem(ROOT_NODE_NAME, ""));
final List<File> tocXMLFiles = getXMLFiles(baseDirectory);

Expand Down Expand Up @@ -137,5 +142,15 @@ protected static String getResource() throws IllegalArgumentException {
final String newPath = jarIx > -1 ? path.toString().substring(0, jarIx) : "";
return newPath != null ? newPath + File.separator + "ext" : "";
}

protected static String getOnlineHelpTOCDirectory(final String filePath) {
final int index = filePath.indexOf("constellation");
if (index <= 0) {
return filePath;
} else {
final String newPath = filePath.substring(0, index + 14);
return newPath + TOC_FILE_NAME;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testRun() {
generator.run();

// verify that the toc file was called to be created, and that the xml mappings were to be converted
tocgeneratorStaticMock.verify(() -> TOCGenerator.createTOCFile(Mockito.anyString()));
tocgeneratorStaticMock.verify(() -> TOCGenerator.createTOCFile(Mockito.anyString()), times(2));
tocgeneratorStaticMock.verify(() -> TOCGenerator.convertXMLMappings(Mockito.any(), Mockito.any()));

generatorStaticMock.verify(() -> Generator.getBaseDirectory(), times(2));
Expand Down
Loading

0 comments on commit 0f99f4f

Please sign in to comment.