Skip to content

Commit

Permalink
devonfw#1509 Adapted testAdaptMonolithicTemplatesAndGenerate to make …
Browse files Browse the repository at this point in the history
…the download works
  • Loading branch information
Cedric Betom committed Feb 13, 2023
1 parent 79296a0 commit 801773d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void testBasicOpenAPIGenerationWithAdaptMonolithicTemplates() throws Exce
@Test
public void testAdaptMonolithicTemplatesAndGenerate() throws Exception {

File tmpProject = this.tempFolder.newFolder("playground", "project");
File tmpProject = this.tempFolder.newFolder("playground", "project", "templates");
withEnvironmentVariable("COBIGEN_HOME", tmpProject.toPath().toString())
.execute(() -> testBasicOpenAPIGenerationWithAdaptMonolithicTemplates());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,16 @@ public static Path getTemplatesFolderPath() {
*/
public static Path getTemplatesFolderPath(Path home) {

Path templatesPath = home.resolve(ConfigurationConstants.TEMPLATES_FOLDER);
return templatesPath;
File file = new File(home.toString());
int lastSlash = file.getName().lastIndexOf("/");
String lastWord = file.getName().substring(lastSlash + 1);
if (lastWord.equals(ConfigurationConstants.TEMPLATES_FOLDER)) {
return home;
} else {
home = home.resolve(ConfigurationConstants.TEMPLATES_FOLDER);
}

return home;
}

/**
Expand Down

0 comments on commit 801773d

Please sign in to comment.