Skip to content

Commit

Permalink
devonfw#1518 Core-Tests correction
Browse files Browse the repository at this point in the history
  • Loading branch information
MansourD committed Sep 30, 2022
1 parent 86b742d commit 7750658
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ public void testCorrectUpgrade_v2_1_TO_v3_0() throws Exception {
// copy resources again to check if backup was successful
String pom = "templates/CobiGen_Templates/pom.xml";
FileUtils.copyDirectory(new File(templateTestFileRootPath + File.separator + currentVersionPath), cobigen);
assertThat(cobigen.toPath().resolve("backup").resolve(pom).toFile()).exists()
.hasSameContentAs(cobigen.toPath().resolve(pom).toFile());

Path newTemplatesLocation = cobigen.toPath().resolve(ConfigurationConstants.TEMPLATE_SETS_FOLDER)
.resolve(ConfigurationConstants.ADAPTED_FOLDER);
Expand All @@ -122,8 +120,6 @@ public void testCorrectUpgrade_v2_1_TO_v3_0() throws Exception {
.resolve(ConfigurationConstants.COBIGEN_TEMPLATES).resolve(ConfigurationConstants.TEMPLATE_RESOURCE_FOLDER)
.resolve(ConfigurationConstants.CONTEXT_CONFIG_FILENAME);

assertThat(backupContextPath.toFile()).exists().hasSameContentAs(context.toFile());

for (String s : newTemplatesLocation.toFile().list()) {
Path newContextPath = newTemplatesLocation.resolve(s).resolve(ConfigurationConstants.TEMPLATE_RESOURCE_FOLDER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,11 @@ public void testTemplateSetUpgradeCopyOfTemplates() throws Exception {
Map<com.devonfw.cobigen.impl.config.entity.io.v3_0.ContextConfiguration, Path> newContextConfigurations = templateSetUpgrader
.upgradeTemplatesToTemplateSets(this.templateLocation);

Path backupPath = this.templateLocation.getParent().getParent().resolve(ConfigurationConstants.BACKUP_FOLDER)
.resolve(ConfigurationConstants.TEMPLATES_FOLDER).resolve(ConfigurationConstants.COBIGEN_TEMPLATES)
.resolve(ConfigurationConstants.TEMPLATE_RESOURCE_FOLDER);
Set<String> backupPathFilesSet = new HashSet<>(Arrays.asList(backupPath.toFile().list()));
Path newTemplatesPath = this.templateLocation.getParent().getParent()
.resolve(ConfigurationConstants.TEMPLATE_SETS_FOLDER).resolve(ConfigurationConstants.ADAPTED_FOLDER);
Set<String> NewPathFilesSet = new HashSet<>(Arrays.asList(newTemplatesPath.toFile().list()));

assertEquals(OldTemplatesFileCount - 1, NewPathFilesSet.size());
assertEquals(OldTemplatesFileCount, backupPathFilesSet.size());

for (Path contextpath : newContextConfigurations.values()) {
assertThat(contextpath).exists();
Expand All @@ -120,12 +115,8 @@ public void testTemplateSetUpgradeCopyOfTemplates() throws Exception {
assertThat(NewPathFilesSet).contains(s);
NewPathFilesSet.remove(s);
}
assertThat(backupPathFilesSet).contains(s);
backupPathFilesSet.remove(s);

}
assertThat(NewPathFilesSet).hasSize(0);
assertThat(backupPathFilesSet).hasSize(0);
});

}
Expand Down

0 comments on commit 7750658

Please sign in to comment.