diff --git a/config/report-config.yaml b/config/report-config.yaml index b5914b25ce..71b1bc3e00 100644 --- a/config/report-config.yaml +++ b/config/report-config.yaml @@ -1,5 +1,5 @@ title: RepoSense Report -group-details: +repos: - repo: https://github.com/reposense/testrepo-Delta.git groups: - group-name: code @@ -13,8 +13,6 @@ group-details: - "docs**" - "**.adoc" - "**.md" -repos: - - repo: https://github.com/reposense/testrepo-Delta.git branches: - branch: master authors: diff --git a/src/main/java/reposense/model/reportconfig/ReportConfiguration.java b/src/main/java/reposense/model/reportconfig/ReportConfiguration.java index fcaf682598..b91f4d4a08 100644 --- a/src/main/java/reposense/model/reportconfig/ReportConfiguration.java +++ b/src/main/java/reposense/model/reportconfig/ReportConfiguration.java @@ -11,20 +11,15 @@ */ public class ReportConfiguration { public static final String DEFAULT_TITLE = "RepoSense Report"; - public static final List DEFAULT_REPORT_GROUP_DETAILS = new ArrayList<>(); public static final List DEFAULT_REPORT_REPO_CONFIGS = new ArrayList<>(); static { DEFAULT_REPORT_REPO_CONFIGS.add(ReportRepoConfiguration.DEFAULT_INSTANCE); - DEFAULT_REPORT_GROUP_DETAILS.add(ReportGroupDetails.DEFAULT_INSTANCE); } @JsonProperty("title") private String title; - @JsonProperty("group-details") - private List groupDetails; - @JsonProperty("repos") private List reportRepoConfigurations; @@ -32,10 +27,6 @@ public String getTitle() { return title == null ? DEFAULT_TITLE : title; } - public List getGroupDetails() { - return groupDetails == null ? DEFAULT_REPORT_GROUP_DETAILS : groupDetails; - } - public List getReportRepoConfigurations() { return reportRepoConfigurations == null ? DEFAULT_REPORT_REPO_CONFIGS : reportRepoConfigurations; } @@ -54,4 +45,9 @@ public boolean equals(Object obj) { return false; } + + @Override + public String toString() { + return title + "\n" + reportRepoConfigurations; + } } diff --git a/src/main/java/reposense/model/reportconfig/ReportGroupDetails.java b/src/main/java/reposense/model/reportconfig/ReportGroupDetails.java deleted file mode 100644 index 8310e86f49..0000000000 --- a/src/main/java/reposense/model/reportconfig/ReportGroupDetails.java +++ /dev/null @@ -1,49 +0,0 @@ -package reposense.model.reportconfig; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Contains information about the group contained in a particular repo. - */ -public class ReportGroupDetails { - public static final String DEFAULT_REPO = "https://github.com/user/repo/tree/fake-branch"; - public static final List DEFAULT_NAMES_AND_GLOBS = - ReportGroupNameAndGlobs.DEFAULT_INSTANCES; - public static final ReportGroupDetails DEFAULT_INSTANCE = new ReportGroupDetails(); - - static { - DEFAULT_INSTANCE.repo = DEFAULT_REPO; - DEFAULT_INSTANCE.reportGroupNameAndGlobsList = ReportGroupNameAndGlobs.DEFAULT_INSTANCES; - } - - @JsonProperty("repo") - private String repo; - - @JsonProperty("groups") - private List reportGroupNameAndGlobsList; - - public String getRepo() { - return repo == null ? DEFAULT_REPO : repo; - } - - public List getReportGroupNameAndGlobsList() { - return reportGroupNameAndGlobsList == null ? DEFAULT_NAMES_AND_GLOBS : reportGroupNameAndGlobsList; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - - if (obj instanceof ReportGroupDetails) { - ReportGroupDetails rgd = (ReportGroupDetails) obj; - return this.getRepo().equals(rgd.getRepo()) - && this.getReportGroupNameAndGlobsList().equals(rgd.getReportGroupNameAndGlobsList()); - } - - return false; - } -} diff --git a/src/main/java/reposense/model/reportconfig/ReportRepoConfiguration.java b/src/main/java/reposense/model/reportconfig/ReportRepoConfiguration.java index 375ce95653..9d14d2a5df 100644 --- a/src/main/java/reposense/model/reportconfig/ReportRepoConfiguration.java +++ b/src/main/java/reposense/model/reportconfig/ReportRepoConfiguration.java @@ -10,6 +10,7 @@ */ public class ReportRepoConfiguration { public static final String DEFAULT_REPO = "https://github.com/user/repo"; + public static final List DEFAULT_GROUP_DETAILS = ReportGroupNameAndGlobs.DEFAULT_INSTANCES; public static final List DEFAULT_BRANCHES = List.of( ReportBranchData.DEFAULT_INSTANCE ); @@ -17,12 +18,16 @@ public class ReportRepoConfiguration { static { DEFAULT_INSTANCE.repo = DEFAULT_REPO; + DEFAULT_INSTANCE.groups = DEFAULT_GROUP_DETAILS; DEFAULT_INSTANCE.branches = DEFAULT_BRANCHES; } @JsonProperty("repo") private String repo; + @JsonProperty("groups") + private List groups; + @JsonProperty("branches") private List branches; @@ -30,6 +35,10 @@ public String getRepo() { return repo == null ? DEFAULT_REPO : repo; } + public List getGroupDetails() { + return groups == null ? DEFAULT_GROUP_DETAILS : groups; + } + public List getBranches() { return branches == null ? DEFAULT_BRANCHES : branches; } @@ -43,9 +52,15 @@ public boolean equals(Object obj) { if (obj instanceof ReportRepoConfiguration) { ReportRepoConfiguration rrc = (ReportRepoConfiguration) obj; return rrc.getRepo().equals(this.getRepo()) + && rrc.getGroupDetails().equals(this.getGroupDetails()) && rrc.getBranches().equals(this.getBranches()); } return false; } + + @Override + public String toString() { + return repo + "\n" + groups + "\n" + branches; + } } diff --git a/src/main/java/reposense/parser/ReportConfigYamlParser.java b/src/main/java/reposense/parser/ReportConfigYamlParser.java index d584d8d40b..1cdceaa13a 100644 --- a/src/main/java/reposense/parser/ReportConfigYamlParser.java +++ b/src/main/java/reposense/parser/ReportConfigYamlParser.java @@ -5,40 +5,32 @@ import java.lang.reflect.Type; import java.nio.file.Path; import java.util.logging.Level; -import java.util.logging.Logger; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import com.google.gson.Gson; import reposense.model.reportconfig.ReportConfiguration; -import reposense.system.LogsManager; /** * YAML Parser for report-config.yaml files. */ -public class ReportConfigYamlParser extends JsonParser { +public class ReportConfigYamlParser extends YamlParser { public static final String REPORT_CONFIG_FILENAME = "report-config.yaml"; - private static final Logger logger = LogsManager.getLogger(ReportConfigYamlParser.class); @Override public Type getType() { return ReportConfiguration.class; } + /** + * Parses the YAML file at {@code path}. + * + * @param path Path to the YAML file + * @return Parsed {@code ReportConfiguration} object + * @throws IOException if the provided path is invalid + */ @Override public ReportConfiguration parse(Path path) throws IOException { - return this.fromJson(null, path, null); - } - - @Override - protected ReportConfiguration fromJson(Path path) throws IOException { - return this.fromJson(null, path, null); - } - - @Override - protected ReportConfiguration fromJson(Gson gson, Path path, Type type) throws IOException , JsonMappingException { // adapted from https://www.baeldung.com/jackson-yaml ReportConfiguration reportConfigation; diff --git a/src/main/java/reposense/parser/YamlParser.java b/src/main/java/reposense/parser/YamlParser.java new file mode 100644 index 0000000000..5c47407e18 --- /dev/null +++ b/src/main/java/reposense/parser/YamlParser.java @@ -0,0 +1,32 @@ +package reposense.parser; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.file.Path; +import java.util.logging.Logger; + +import reposense.system.LogsManager; + +/** + * Represents a YAML parser that is able to parse a YAML file from a {@link Path} into an object of + * type {@code T}. + * + * @param Type {@code T} that this parser can parse and return as an object + */ +public abstract class YamlParser { + protected static final Logger logger = LogsManager.getLogger(YamlParser.class); + + /** + * Returns the type of {@code T} for YAML file conversion. + */ + public abstract Type getType(); + + /** + * Converts the YAML file from the given {@code path} into object of type {@code T} and return it. + * + * @param path Path to the YAML file + * @return Parsed object of type {@code T} + * @throws IOException if the {@code path} is invalid + */ + public abstract T parse(Path path) throws IOException; +} diff --git a/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDate/expected/summary.json b/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDate/expected/summary.json index c809a19ae0..b4a4475f8f 100644 --- a/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDate/expected/summary.json +++ b/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDate/expected/summary.json @@ -1 +1,82 @@ -{"reportGeneratedTime":"Tue Jul 24 17:45:15 SGT 2018","reportGenerationTime":"15 second(s)","zoneId":"Asia/Singapore","reportTitle":"RepoSense Report Test Title","repos":[{"location":{"location":"https://github.com/reposense/testrepo-Alpha.git","repoName":"testrepo-Alpha","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Alpha[master]","outputFolderName":"reposense_testrepo-Alpha_master"},{"location":{"location":"https://github.com/reposense/testrepo-Beta.git","repoName":"testrepo-Beta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Beta[master]","outputFolderName":"reposense_testrepo-Beta_master"},{"location":{"location":"https://github.com/reposense/testrepo-Charlie.git","repoName":"testrepo-Charlie","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Charlie[master]","outputFolderName":"reposense_testrepo-Charlie_master"},{"location":{"location":"https://github.com/reposense/testrepo-Delta.git","repoName":"testrepo-Delta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Delta[master]","outputFolderName":"reposense_testrepo-Delta_master"}],"errorSet":[{"repoName":"ttps://github.com/reposense/testrepo-Beta.git","errorMessage":"ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL."},{"repoName":"reposense/testrepo-Delta[nonExistentBranch]","errorMessage":"Branch \"nonExistentBranch\" does not exist."}],"sinceDate":"2017-10-01","untilDate":"2017-11-01","isSinceDateProvided":false,"isUntilDateProvided":true,"supportedDomainUrlMap":{"NOT_RECOGNIZED":{"BRANCH":"","REPO_URL":"UNSUPPORTED","BASE_URL":"UNSUPPORTED","HISTORY_PATH":"","COMMIT_PATH":"","BLAME_PATH":""},"github":{"BRANCH":"tree/$BRANCH","REPO_URL":"https://github.com/$ORGANIZATION/$REPO_NAME/","BASE_URL":"https://github.com/","HISTORY_PATH":"commits/$BRANCH/$FILE_PATH","COMMIT_PATH":"commit/$COMMIT_HASH","BLAME_PATH":"blame/$BRANCH/$FILE_PATH"}}} +{ + "zoneId": "Asia/Singapore", + "reportTitle": "RepoSense Report", + "repos": [ + { + "location": { + "location": "https://github.com/reposense/testrepo-Alpha.git", + "repoName": "testrepo-Alpha", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Alpha[master]", + "outputFolderName": "reposense_testrepo-Alpha_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Beta.git", + "repoName": "testrepo-Beta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Beta[master]", + "outputFolderName": "reposense_testrepo-Beta_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Charlie.git", + "repoName": "testrepo-Charlie", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Charlie[master]", + "outputFolderName": "reposense_testrepo-Charlie_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Delta.git", + "repoName": "testrepo-Delta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Delta[master]", + "outputFolderName": "reposense_testrepo-Delta_master" + } + ], + "errorSet": [ + { + "repoName": "ttps://github.com/reposense/testrepo-Beta.git", + "errorMessage": "ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL." + }, + { + "repoName": "reposense/testrepo-Delta[nonExistentBranch]", + "errorMessage": "Branch \"nonExistentBranch\" does not exist." + } + ], + "sinceDate": "2017-10-01", + "untilDate": "2017-11-01", + "isSinceDateProvided": false, + "isUntilDateProvided": true, + "supportedDomainUrlMap": { + "NOT_RECOGNIZED": { + "BRANCH": "", + "REPO_URL": "UNSUPPORTED", + "BASE_URL": "UNSUPPORTED", + "HISTORY_PATH": "", + "COMMIT_PATH": "", + "BLAME_PATH": "" + }, + "github": { + "BRANCH": "tree/$BRANCH", + "REPO_URL": "https://github.com/$ORGANIZATION/$REPO_NAME/", + "BASE_URL": "https://github.com/", + "HISTORY_PATH": "commits/$BRANCH/$FILE_PATH", + "COMMIT_PATH": "commit/$COMMIT_HASH", + "BLAME_PATH": "blame/$BRANCH/$FILE_PATH" + } + } +} diff --git a/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDateFindPreviousAuthors/expected/summary.json b/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDateFindPreviousAuthors/expected/summary.json index c809a19ae0..b4a4475f8f 100644 --- a/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDateFindPreviousAuthors/expected/summary.json +++ b/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDateFindPreviousAuthors/expected/summary.json @@ -1 +1,82 @@ -{"reportGeneratedTime":"Tue Jul 24 17:45:15 SGT 2018","reportGenerationTime":"15 second(s)","zoneId":"Asia/Singapore","reportTitle":"RepoSense Report Test Title","repos":[{"location":{"location":"https://github.com/reposense/testrepo-Alpha.git","repoName":"testrepo-Alpha","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Alpha[master]","outputFolderName":"reposense_testrepo-Alpha_master"},{"location":{"location":"https://github.com/reposense/testrepo-Beta.git","repoName":"testrepo-Beta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Beta[master]","outputFolderName":"reposense_testrepo-Beta_master"},{"location":{"location":"https://github.com/reposense/testrepo-Charlie.git","repoName":"testrepo-Charlie","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Charlie[master]","outputFolderName":"reposense_testrepo-Charlie_master"},{"location":{"location":"https://github.com/reposense/testrepo-Delta.git","repoName":"testrepo-Delta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Delta[master]","outputFolderName":"reposense_testrepo-Delta_master"}],"errorSet":[{"repoName":"ttps://github.com/reposense/testrepo-Beta.git","errorMessage":"ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL."},{"repoName":"reposense/testrepo-Delta[nonExistentBranch]","errorMessage":"Branch \"nonExistentBranch\" does not exist."}],"sinceDate":"2017-10-01","untilDate":"2017-11-01","isSinceDateProvided":false,"isUntilDateProvided":true,"supportedDomainUrlMap":{"NOT_RECOGNIZED":{"BRANCH":"","REPO_URL":"UNSUPPORTED","BASE_URL":"UNSUPPORTED","HISTORY_PATH":"","COMMIT_PATH":"","BLAME_PATH":""},"github":{"BRANCH":"tree/$BRANCH","REPO_URL":"https://github.com/$ORGANIZATION/$REPO_NAME/","BASE_URL":"https://github.com/","HISTORY_PATH":"commits/$BRANCH/$FILE_PATH","COMMIT_PATH":"commit/$COMMIT_HASH","BLAME_PATH":"blame/$BRANCH/$FILE_PATH"}}} +{ + "zoneId": "Asia/Singapore", + "reportTitle": "RepoSense Report", + "repos": [ + { + "location": { + "location": "https://github.com/reposense/testrepo-Alpha.git", + "repoName": "testrepo-Alpha", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Alpha[master]", + "outputFolderName": "reposense_testrepo-Alpha_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Beta.git", + "repoName": "testrepo-Beta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Beta[master]", + "outputFolderName": "reposense_testrepo-Beta_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Charlie.git", + "repoName": "testrepo-Charlie", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Charlie[master]", + "outputFolderName": "reposense_testrepo-Charlie_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Delta.git", + "repoName": "testrepo-Delta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Delta[master]", + "outputFolderName": "reposense_testrepo-Delta_master" + } + ], + "errorSet": [ + { + "repoName": "ttps://github.com/reposense/testrepo-Beta.git", + "errorMessage": "ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL." + }, + { + "repoName": "reposense/testrepo-Delta[nonExistentBranch]", + "errorMessage": "Branch \"nonExistentBranch\" does not exist." + } + ], + "sinceDate": "2017-10-01", + "untilDate": "2017-11-01", + "isSinceDateProvided": false, + "isUntilDateProvided": true, + "supportedDomainUrlMap": { + "NOT_RECOGNIZED": { + "BRANCH": "", + "REPO_URL": "UNSUPPORTED", + "BASE_URL": "UNSUPPORTED", + "HISTORY_PATH": "", + "COMMIT_PATH": "", + "BLAME_PATH": "" + }, + "github": { + "BRANCH": "tree/$BRANCH", + "REPO_URL": "https://github.com/$ORGANIZATION/$REPO_NAME/", + "BASE_URL": "https://github.com/", + "HISTORY_PATH": "commits/$BRANCH/$FILE_PATH", + "COMMIT_PATH": "commit/$COMMIT_HASH", + "BLAME_PATH": "blame/$BRANCH/$FILE_PATH" + } + } +} diff --git a/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDateWithShallowCloning/expected/summary.json b/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDateWithShallowCloning/expected/summary.json index c809a19ae0..b4a4475f8f 100644 --- a/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDateWithShallowCloning/expected/summary.json +++ b/src/systemtest/resources/ConfigSystemTest/30daysFromUntilDateWithShallowCloning/expected/summary.json @@ -1 +1,82 @@ -{"reportGeneratedTime":"Tue Jul 24 17:45:15 SGT 2018","reportGenerationTime":"15 second(s)","zoneId":"Asia/Singapore","reportTitle":"RepoSense Report Test Title","repos":[{"location":{"location":"https://github.com/reposense/testrepo-Alpha.git","repoName":"testrepo-Alpha","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Alpha[master]","outputFolderName":"reposense_testrepo-Alpha_master"},{"location":{"location":"https://github.com/reposense/testrepo-Beta.git","repoName":"testrepo-Beta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Beta[master]","outputFolderName":"reposense_testrepo-Beta_master"},{"location":{"location":"https://github.com/reposense/testrepo-Charlie.git","repoName":"testrepo-Charlie","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Charlie[master]","outputFolderName":"reposense_testrepo-Charlie_master"},{"location":{"location":"https://github.com/reposense/testrepo-Delta.git","repoName":"testrepo-Delta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Delta[master]","outputFolderName":"reposense_testrepo-Delta_master"}],"errorSet":[{"repoName":"ttps://github.com/reposense/testrepo-Beta.git","errorMessage":"ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL."},{"repoName":"reposense/testrepo-Delta[nonExistentBranch]","errorMessage":"Branch \"nonExistentBranch\" does not exist."}],"sinceDate":"2017-10-01","untilDate":"2017-11-01","isSinceDateProvided":false,"isUntilDateProvided":true,"supportedDomainUrlMap":{"NOT_RECOGNIZED":{"BRANCH":"","REPO_URL":"UNSUPPORTED","BASE_URL":"UNSUPPORTED","HISTORY_PATH":"","COMMIT_PATH":"","BLAME_PATH":""},"github":{"BRANCH":"tree/$BRANCH","REPO_URL":"https://github.com/$ORGANIZATION/$REPO_NAME/","BASE_URL":"https://github.com/","HISTORY_PATH":"commits/$BRANCH/$FILE_PATH","COMMIT_PATH":"commit/$COMMIT_HASH","BLAME_PATH":"blame/$BRANCH/$FILE_PATH"}}} +{ + "zoneId": "Asia/Singapore", + "reportTitle": "RepoSense Report", + "repos": [ + { + "location": { + "location": "https://github.com/reposense/testrepo-Alpha.git", + "repoName": "testrepo-Alpha", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Alpha[master]", + "outputFolderName": "reposense_testrepo-Alpha_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Beta.git", + "repoName": "testrepo-Beta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Beta[master]", + "outputFolderName": "reposense_testrepo-Beta_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Charlie.git", + "repoName": "testrepo-Charlie", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Charlie[master]", + "outputFolderName": "reposense_testrepo-Charlie_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Delta.git", + "repoName": "testrepo-Delta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Delta[master]", + "outputFolderName": "reposense_testrepo-Delta_master" + } + ], + "errorSet": [ + { + "repoName": "ttps://github.com/reposense/testrepo-Beta.git", + "errorMessage": "ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL." + }, + { + "repoName": "reposense/testrepo-Delta[nonExistentBranch]", + "errorMessage": "Branch \"nonExistentBranch\" does not exist." + } + ], + "sinceDate": "2017-10-01", + "untilDate": "2017-11-01", + "isSinceDateProvided": false, + "isUntilDateProvided": true, + "supportedDomainUrlMap": { + "NOT_RECOGNIZED": { + "BRANCH": "", + "REPO_URL": "UNSUPPORTED", + "BASE_URL": "UNSUPPORTED", + "HISTORY_PATH": "", + "COMMIT_PATH": "", + "BLAME_PATH": "" + }, + "github": { + "BRANCH": "tree/$BRANCH", + "REPO_URL": "https://github.com/$ORGANIZATION/$REPO_NAME/", + "BASE_URL": "https://github.com/", + "HISTORY_PATH": "commits/$BRANCH/$FILE_PATH", + "COMMIT_PATH": "commit/$COMMIT_HASH", + "BLAME_PATH": "blame/$BRANCH/$FILE_PATH" + } + } +} diff --git a/src/systemtest/resources/ConfigSystemTest/report-config.yaml b/src/systemtest/resources/ConfigSystemTest/report-config.yaml index 5d7a6d7079..1c6fed2d3c 100644 --- a/src/systemtest/resources/ConfigSystemTest/report-config.yaml +++ b/src/systemtest/resources/ConfigSystemTest/report-config.yaml @@ -1,5 +1,5 @@ -title: RepoSense Report Test Title -group-details: +title: RepoSense Report +repos: - repo: https://github.com/user/repo.git groups: - group-name: code @@ -13,8 +13,6 @@ group-details: - "docs**" - "**.adoc" - "**.md" -repos: - - repo: https://github.com/user/repo.git branches: - branch: main authors: diff --git a/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRange/expected/summary.json b/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRange/expected/summary.json index f0d69e7d5b..629c28d968 100644 --- a/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRange/expected/summary.json +++ b/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRange/expected/summary.json @@ -1 +1,82 @@ -{"reportGeneratedTime":"Tue Jul 24 17:45:15 SGT 2018","reportGenerationTime":"15 second(s)","zoneId":"Asia/Singapore","reportTitle":"RepoSense Report Test Title","repos":[{"location":{"location":"https://github.com/reposense/testrepo-Alpha.git","repoName":"testrepo-Alpha","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Alpha[master]","outputFolderName":"reposense_testrepo-Alpha_master"},{"location":{"location":"https://github.com/reposense/testrepo-Beta.git","repoName":"testrepo-Beta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Beta[master]","outputFolderName":"reposense_testrepo-Beta_master"},{"location":{"location":"https://github.com/reposense/testrepo-Charlie.git","repoName":"testrepo-Charlie","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Charlie[master]","outputFolderName":"reposense_testrepo-Charlie_master"},{"location":{"location":"https://github.com/reposense/testrepo-Delta.git","repoName":"testrepo-Delta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Delta[master]","outputFolderName":"reposense_testrepo-Delta_master"}],"errorSet":[{"repoName":"ttps://github.com/reposense/testrepo-Beta.git","errorMessage":"ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL."},{"repoName":"reposense/testrepo-Delta[nonExistentBranch]","errorMessage":"Branch \"nonExistentBranch\" does not exist."}],"sinceDate":"2017-09-30","untilDate":"2019-03-02","isSinceDateProvided":true,"isUntilDateProvided":true,"supportedDomainUrlMap":{"NOT_RECOGNIZED":{"BRANCH":"","REPO_URL":"UNSUPPORTED","BASE_URL":"UNSUPPORTED","HISTORY_PATH":"","COMMIT_PATH":"","BLAME_PATH":""},"github":{"BRANCH":"tree/$BRANCH","REPO_URL":"https://github.com/$ORGANIZATION/$REPO_NAME/","BASE_URL":"https://github.com/","HISTORY_PATH":"commits/$BRANCH/$FILE_PATH","COMMIT_PATH":"commit/$COMMIT_HASH","BLAME_PATH":"blame/$BRANCH/$FILE_PATH"}}} +{ + "zoneId": "Asia/Singapore", + "reportTitle": "RepoSense Report", + "repos": [ + { + "location": { + "location": "https://github.com/reposense/testrepo-Alpha.git", + "repoName": "testrepo-Alpha", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Alpha[master]", + "outputFolderName": "reposense_testrepo-Alpha_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Beta.git", + "repoName": "testrepo-Beta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Beta[master]", + "outputFolderName": "reposense_testrepo-Beta_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Charlie.git", + "repoName": "testrepo-Charlie", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Charlie[master]", + "outputFolderName": "reposense_testrepo-Charlie_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Delta.git", + "repoName": "testrepo-Delta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Delta[master]", + "outputFolderName": "reposense_testrepo-Delta_master" + } + ], + "errorSet": [ + { + "repoName": "ttps://github.com/reposense/testrepo-Beta.git", + "errorMessage": "ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL." + }, + { + "repoName": "reposense/testrepo-Delta[nonExistentBranch]", + "errorMessage": "Branch \"nonExistentBranch\" does not exist." + } + ], + "sinceDate": "2017-09-30", + "untilDate": "2019-03-02", + "isSinceDateProvided": true, + "isUntilDateProvided": true, + "supportedDomainUrlMap": { + "NOT_RECOGNIZED": { + "BRANCH": "", + "REPO_URL": "UNSUPPORTED", + "BASE_URL": "UNSUPPORTED", + "HISTORY_PATH": "", + "COMMIT_PATH": "", + "BLAME_PATH": "" + }, + "github": { + "BRANCH": "tree/$BRANCH", + "REPO_URL": "https://github.com/$ORGANIZATION/$REPO_NAME/", + "BASE_URL": "https://github.com/", + "HISTORY_PATH": "commits/$BRANCH/$FILE_PATH", + "COMMIT_PATH": "commit/$COMMIT_HASH", + "BLAME_PATH": "blame/$BRANCH/$FILE_PATH" + } + } +} diff --git a/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRangeFindPreviousAuthors/expected/summary.json b/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRangeFindPreviousAuthors/expected/summary.json index f0d69e7d5b..629c28d968 100644 --- a/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRangeFindPreviousAuthors/expected/summary.json +++ b/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRangeFindPreviousAuthors/expected/summary.json @@ -1 +1,82 @@ -{"reportGeneratedTime":"Tue Jul 24 17:45:15 SGT 2018","reportGenerationTime":"15 second(s)","zoneId":"Asia/Singapore","reportTitle":"RepoSense Report Test Title","repos":[{"location":{"location":"https://github.com/reposense/testrepo-Alpha.git","repoName":"testrepo-Alpha","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Alpha[master]","outputFolderName":"reposense_testrepo-Alpha_master"},{"location":{"location":"https://github.com/reposense/testrepo-Beta.git","repoName":"testrepo-Beta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Beta[master]","outputFolderName":"reposense_testrepo-Beta_master"},{"location":{"location":"https://github.com/reposense/testrepo-Charlie.git","repoName":"testrepo-Charlie","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Charlie[master]","outputFolderName":"reposense_testrepo-Charlie_master"},{"location":{"location":"https://github.com/reposense/testrepo-Delta.git","repoName":"testrepo-Delta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Delta[master]","outputFolderName":"reposense_testrepo-Delta_master"}],"errorSet":[{"repoName":"ttps://github.com/reposense/testrepo-Beta.git","errorMessage":"ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL."},{"repoName":"reposense/testrepo-Delta[nonExistentBranch]","errorMessage":"Branch \"nonExistentBranch\" does not exist."}],"sinceDate":"2017-09-30","untilDate":"2019-03-02","isSinceDateProvided":true,"isUntilDateProvided":true,"supportedDomainUrlMap":{"NOT_RECOGNIZED":{"BRANCH":"","REPO_URL":"UNSUPPORTED","BASE_URL":"UNSUPPORTED","HISTORY_PATH":"","COMMIT_PATH":"","BLAME_PATH":""},"github":{"BRANCH":"tree/$BRANCH","REPO_URL":"https://github.com/$ORGANIZATION/$REPO_NAME/","BASE_URL":"https://github.com/","HISTORY_PATH":"commits/$BRANCH/$FILE_PATH","COMMIT_PATH":"commit/$COMMIT_HASH","BLAME_PATH":"blame/$BRANCH/$FILE_PATH"}}} +{ + "zoneId": "Asia/Singapore", + "reportTitle": "RepoSense Report", + "repos": [ + { + "location": { + "location": "https://github.com/reposense/testrepo-Alpha.git", + "repoName": "testrepo-Alpha", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Alpha[master]", + "outputFolderName": "reposense_testrepo-Alpha_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Beta.git", + "repoName": "testrepo-Beta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Beta[master]", + "outputFolderName": "reposense_testrepo-Beta_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Charlie.git", + "repoName": "testrepo-Charlie", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Charlie[master]", + "outputFolderName": "reposense_testrepo-Charlie_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Delta.git", + "repoName": "testrepo-Delta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Delta[master]", + "outputFolderName": "reposense_testrepo-Delta_master" + } + ], + "errorSet": [ + { + "repoName": "ttps://github.com/reposense/testrepo-Beta.git", + "errorMessage": "ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL." + }, + { + "repoName": "reposense/testrepo-Delta[nonExistentBranch]", + "errorMessage": "Branch \"nonExistentBranch\" does not exist." + } + ], + "sinceDate": "2017-09-30", + "untilDate": "2019-03-02", + "isSinceDateProvided": true, + "isUntilDateProvided": true, + "supportedDomainUrlMap": { + "NOT_RECOGNIZED": { + "BRANCH": "", + "REPO_URL": "UNSUPPORTED", + "BASE_URL": "UNSUPPORTED", + "HISTORY_PATH": "", + "COMMIT_PATH": "", + "BLAME_PATH": "" + }, + "github": { + "BRANCH": "tree/$BRANCH", + "REPO_URL": "https://github.com/$ORGANIZATION/$REPO_NAME/", + "BASE_URL": "https://github.com/", + "HISTORY_PATH": "commits/$BRANCH/$FILE_PATH", + "COMMIT_PATH": "commit/$COMMIT_HASH", + "BLAME_PATH": "blame/$BRANCH/$FILE_PATH" + } + } +} diff --git a/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRangeWithShallowCloning/expected/summary.json b/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRangeWithShallowCloning/expected/summary.json index f0d69e7d5b..629c28d968 100644 --- a/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRangeWithShallowCloning/expected/summary.json +++ b/src/systemtest/resources/ConfigSystemTest/sinceBeginningDateRangeWithShallowCloning/expected/summary.json @@ -1 +1,82 @@ -{"reportGeneratedTime":"Tue Jul 24 17:45:15 SGT 2018","reportGenerationTime":"15 second(s)","zoneId":"Asia/Singapore","reportTitle":"RepoSense Report Test Title","repos":[{"location":{"location":"https://github.com/reposense/testrepo-Alpha.git","repoName":"testrepo-Alpha","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Alpha[master]","outputFolderName":"reposense_testrepo-Alpha_master"},{"location":{"location":"https://github.com/reposense/testrepo-Beta.git","repoName":"testrepo-Beta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Beta[master]","outputFolderName":"reposense_testrepo-Beta_master"},{"location":{"location":"https://github.com/reposense/testrepo-Charlie.git","repoName":"testrepo-Charlie","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Charlie[master]","outputFolderName":"reposense_testrepo-Charlie_master"},{"location":{"location":"https://github.com/reposense/testrepo-Delta.git","repoName":"testrepo-Delta","organization":"reposense","domainName":"github"},"branch":"master","displayName":"reposense/testrepo-Delta[master]","outputFolderName":"reposense_testrepo-Delta_master"}],"errorSet":[{"repoName":"ttps://github.com/reposense/testrepo-Beta.git","errorMessage":"ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL."},{"repoName":"reposense/testrepo-Delta[nonExistentBranch]","errorMessage":"Branch \"nonExistentBranch\" does not exist."}],"sinceDate":"2017-09-30","untilDate":"2019-03-02","isSinceDateProvided":true,"isUntilDateProvided":true,"supportedDomainUrlMap":{"NOT_RECOGNIZED":{"BRANCH":"","REPO_URL":"UNSUPPORTED","BASE_URL":"UNSUPPORTED","HISTORY_PATH":"","COMMIT_PATH":"","BLAME_PATH":""},"github":{"BRANCH":"tree/$BRANCH","REPO_URL":"https://github.com/$ORGANIZATION/$REPO_NAME/","BASE_URL":"https://github.com/","HISTORY_PATH":"commits/$BRANCH/$FILE_PATH","COMMIT_PATH":"commit/$COMMIT_HASH","BLAME_PATH":"blame/$BRANCH/$FILE_PATH"}}} +{ + "zoneId": "Asia/Singapore", + "reportTitle": "RepoSense Report", + "repos": [ + { + "location": { + "location": "https://github.com/reposense/testrepo-Alpha.git", + "repoName": "testrepo-Alpha", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Alpha[master]", + "outputFolderName": "reposense_testrepo-Alpha_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Beta.git", + "repoName": "testrepo-Beta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Beta[master]", + "outputFolderName": "reposense_testrepo-Beta_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Charlie.git", + "repoName": "testrepo-Charlie", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Charlie[master]", + "outputFolderName": "reposense_testrepo-Charlie_master" + }, + { + "location": { + "location": "https://github.com/reposense/testrepo-Delta.git", + "repoName": "testrepo-Delta", + "organization": "reposense", + "domainName": "github" + }, + "branch": "master", + "displayName": "reposense/testrepo-Delta[master]", + "outputFolderName": "reposense_testrepo-Delta_master" + } + ], + "errorSet": [ + { + "repoName": "ttps://github.com/reposense/testrepo-Beta.git", + "errorMessage": "ttps://github.com/reposense/testrepo-Beta.git is an invalid remote URL." + }, + { + "repoName": "reposense/testrepo-Delta[nonExistentBranch]", + "errorMessage": "Branch \"nonExistentBranch\" does not exist." + } + ], + "sinceDate": "2017-09-30", + "untilDate": "2019-03-02", + "isSinceDateProvided": true, + "isUntilDateProvided": true, + "supportedDomainUrlMap": { + "NOT_RECOGNIZED": { + "BRANCH": "", + "REPO_URL": "UNSUPPORTED", + "BASE_URL": "UNSUPPORTED", + "HISTORY_PATH": "", + "COMMIT_PATH": "", + "BLAME_PATH": "" + }, + "github": { + "BRANCH": "tree/$BRANCH", + "REPO_URL": "https://github.com/$ORGANIZATION/$REPO_NAME/", + "BASE_URL": "https://github.com/", + "HISTORY_PATH": "commits/$BRANCH/$FILE_PATH", + "COMMIT_PATH": "commit/$COMMIT_HASH", + "BLAME_PATH": "blame/$BRANCH/$FILE_PATH" + } + } +} diff --git a/src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java b/src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java index 19a5fad8b3..935b0872ff 100644 --- a/src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java +++ b/src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java @@ -15,12 +15,6 @@ public void getReportRepoConfigurations_equalsDefaultReturnValue_success() { ReportConfiguration.DEFAULT_REPORT_REPO_CONFIGS); } - @Test - public void getGroupDetails_equalsDefaultReturnValue_success() { - Assertions.assertSame(new ReportConfiguration().getGroupDetails(), - ReportConfiguration.DEFAULT_REPORT_GROUP_DETAILS); - } - @Test public void equals_defaultInstancesAreEqual_success() { Assertions.assertEquals(new ReportConfiguration(), new ReportConfiguration()); diff --git a/src/test/java/reposense/model/reportconfig/ReportGroupDetailsTest.java b/src/test/java/reposense/model/reportconfig/ReportGroupDetailsTest.java deleted file mode 100644 index d3df44380f..0000000000 --- a/src/test/java/reposense/model/reportconfig/ReportGroupDetailsTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package reposense.model.reportconfig; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public class ReportGroupDetailsTest { - @Test - public void getRepo_equalsDefaultReturnValue_success() { - Assertions.assertSame(new ReportGroupDetails().getRepo(), ReportGroupDetails.DEFAULT_REPO); - } - - @Test - public void getReportGroupNameAndGlobsList_equalsDefaultReturnValue_success() { - Assertions.assertSame(new ReportGroupDetails().getReportGroupNameAndGlobsList(), - ReportGroupDetails.DEFAULT_NAMES_AND_GLOBS); - } - - @Test - public void equals_defaultInstancesAreEqual_success() { - Assertions.assertEquals(new ReportGroupDetails(), new ReportGroupDetails()); - Assertions.assertEquals(new ReportGroupDetails(), ReportGroupDetails.DEFAULT_INSTANCE); - } -} diff --git a/src/test/resources/ReportConfigYamlParserTest/report-config-invalid.yaml b/src/test/resources/ReportConfigYamlParserTest/report-config-invalid.yaml index fda2a639be..bd6058f6c4 100644 --- a/src/test/resources/ReportConfigYamlParserTest/report-config-invalid.yaml +++ b/src/test/resources/ReportConfigYamlParserTest/report-config-invalid.yaml @@ -1,36 +1,30 @@ -title: RepoSense Report -group-details: - - repo: https://github.com/user/repo/tree/fake-branch - grou - - group-name: code +titles: RepoSense Report +repo: + - repos: https://github.com/reposense/testrepo-Delta.git + group: + - grame: code globs: - "**.java" - group-name: tests globs: - "src/test**" - group-name: docs - globs: + gl: - "docs**" - "**.adoc" - "**.md" -os: - - repo: https://github.com/user/repo/tree/fake-branch - author-emails: - - john@john.com - - johny@mail.com - - j@domain.com - author-git-author-name: my home PC - branches: - - branch: main + bhes: + - branch: master + autho:thor-name: WANG CHAO + author-emails: + - 1229983126@qq.com + - author-git-host-id: FH-30 + author-display-name: Francis Hodianto + author-git-author-name: Francis Hodianto + author-emails: + - file-formats: - override:java - md - - fxml - ignore-glob-list: - - "docs**" - ignore-standalone-config: true - ignore-author-list: - - author1 - - author2 - is-shallow-cloning: true + is-shallow-cloning: false is-find-previous-authors: false diff --git a/src/test/resources/ReportConfigYamlParserTest/report-config-valid.yaml b/src/test/resources/ReportConfigYamlParserTest/report-config-valid.yaml index 5ff5b91dc0..dea7a91415 100644 --- a/src/test/resources/ReportConfigYamlParserTest/report-config-valid.yaml +++ b/src/test/resources/ReportConfigYamlParserTest/report-config-valid.yaml @@ -1,6 +1,6 @@ -title: RepoSense Report Repo Test -group-details: - - repo: https://github.com/user/repo/tree/fake-branch +title: RepoSense Report Test Repo +repos: + - repo: https://github.com/reposense/testrepo-Delta.git groups: - group-name: code globs: @@ -13,33 +13,29 @@ group-details: - "docs**" - "**.adoc" - "**.md" -repos: - - repo: https://github.com/user/repo/tree/fake-branch branches: - - branch: main + - branch: master authors: - - author-git-host-id: johnDoe - author-display-name: John Doe - author-git-author-name: my home PC + - author-git-host-id: fzdy1914 + author-display-name: WANG CHAO + author-git-author-name: WANG CHAO author-emails: - - john@john.com - - johny@mail.com - - j@domain.com + - 1229983126@qq.com + - author-git-host-id: FH-30 + author-display-name: Francis Hodianto + author-git-author-name: Francis Hodianto + author-emails: + - file-formats: - override:java - md - fxml ignore-glob-list: - - "docs**" - ignore-standalone-config: true + - + ignore-standalone-config: false ignore-commits-list: - - 2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7 - - c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151 - - cd7f610e0becbdf331d5231887d8010a689f87c7 - - 768015345e70f06add2a8b7d1f901dc07bf70582 + - ignore-authors-list: - - author1 - - author2 - is-shallow-cloning: true + - + is-shallow-cloning: false is-find-previous-authors: false -