diff --git a/config/report-config.yaml b/config/report-config.yaml index ca7368fc9d..4e430c7404 100644 --- a/config/report-config.yaml +++ b/config/report-config.yaml @@ -1,20 +1,43 @@ title: RepoSense Report +group-details: + - repo: https://github.com/user/repo/tree/fake-branch + groups: + - group-name: code + globs: + - "**.java" + - group-name: tests + globs: + - "src/test**" + - group-name: docs + globs: + - "docs**" + - "**.adoc" + - "**.md" repos: - - repo: https://github.com/user/repo - authorNames: - - johnDoe - - John Doe - - my home PC + - repo: https://github.com/user/repo/tree/fake-branch + author-emails: + - john@john.com + - johny@mail.com + - j@domain.com + author-git-host-id: johnDoe + author-display-name: John Doe + author-git-author-name: my home PC branches: - branch: main - blurb: very long blurb - - branch: master - blurb: very very long blurb - - repo: https://github.com/user/repo2 - authorNames: - - author1 - - author One - - my author PC - branches: - - branch: main - blurb: very very very long blurb + file-formats: + - override:java + - md + - fxml + ignore-glob-list: + - "docs**" + ignore-standalone-config: true + ignore-commits-list: + - 2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7 + - c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151 + - cd7f610e0becbdf331d5231887d8010a689f87c7 + - 768015345e70f06add2a8b7d1f901dc07bf70582 + ignore-authors-list: + - author1 + - author2 + is-shallow-cloning: true + is-find-previous-authors: false diff --git a/src/main/java/reposense/model/CliArguments.java b/src/main/java/reposense/model/CliArguments.java index e20866a0a9..ce0dd71b5b 100644 --- a/src/main/java/reposense/model/CliArguments.java +++ b/src/main/java/reposense/model/CliArguments.java @@ -156,10 +156,6 @@ public Path getReportConfigFilePath() { return reportConfigFilePath; } - public ReportConfiguration getReportYamlConfiguration() { - return reportConfiguration; - } - public ReportConfiguration getReportConfiguration() { return reportConfiguration; } @@ -201,6 +197,7 @@ public boolean equals(Object other) { && this.isFreshClonePerformed == otherCliArguments.isFreshClonePerformed && Objects.equals(this.locations, otherCliArguments.locations) && this.isViewModeOnly == otherCliArguments.isViewModeOnly + && Objects.equals(this.reportConfiguration, otherCliArguments.reportConfiguration) && Objects.equals(this.reportDirectoryPath, otherCliArguments.reportDirectoryPath) && Objects.equals(this.repoConfigFilePath, otherCliArguments.repoConfigFilePath) && Objects.equals(this.authorConfigFilePath, otherCliArguments.authorConfigFilePath) diff --git a/src/main/java/reposense/model/reportconfig/ReportBranchData.java b/src/main/java/reposense/model/reportconfig/ReportBranchData.java index db4c4c0782..687577b863 100644 --- a/src/main/java/reposense/model/reportconfig/ReportBranchData.java +++ b/src/main/java/reposense/model/reportconfig/ReportBranchData.java @@ -1,5 +1,7 @@ package reposense.model.reportconfig; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -7,19 +9,93 @@ */ public class ReportBranchData { public static final String DEFAULT_BRANCH = "main"; - public static final String DEFAULT_BLURB = "very long blurb"; + public static final List DEFAULT_FILE_FORMATS = List.of( + "override:java", "md", "fxml" + ); + public static final List DEFAULT_IGNORE_GLOB_LIST = List.of( + "docs**" + ); + public static final List DEFAULT_IGNORE_COMMITS_LIST = List.of( + "2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7", + "c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151", + "cd7f610e0becbdf331d5231887d8010a689f87c7", + "768015345e70f06add2a8b7d1f901dc07bf70582" + ); + public static final List DEFAULT_IGNORE_AUTHORS_LIST = List.of( + "author1", + "author2" + ); + public static final boolean DEFAULT_IS_FIND_PREVIOUS_AUTHOR = false; + public static final boolean DEFAULT_IS_SHALLOW_CLONING = true; + public static final boolean DEFAULT_IS_IGNORE_STANDALONE_CONFIG = true; + + public static final ReportBranchData DEFAULT_INSTANCE = new ReportBranchData(); + + static { + DEFAULT_INSTANCE.branch = ReportBranchData.DEFAULT_BRANCH; + DEFAULT_INSTANCE.fileFormats = ReportBranchData.DEFAULT_FILE_FORMATS; + DEFAULT_INSTANCE.ignoreGlobList = ReportBranchData.DEFAULT_IGNORE_GLOB_LIST; + DEFAULT_INSTANCE.ignoreCommitList = ReportBranchData.DEFAULT_IGNORE_COMMITS_LIST; + DEFAULT_INSTANCE.ignoreAuthorList = ReportBranchData.DEFAULT_IGNORE_AUTHORS_LIST; + DEFAULT_INSTANCE.isFindPreviousAuthor = ReportBranchData.DEFAULT_IS_FIND_PREVIOUS_AUTHOR; + DEFAULT_INSTANCE.isShallowCloning = ReportBranchData.DEFAULT_IS_SHALLOW_CLONING; + DEFAULT_INSTANCE.isIgnoreStandaloneConfig = ReportBranchData.DEFAULT_IS_IGNORE_STANDALONE_CONFIG; + } + @JsonProperty("branch") private String branch; - @JsonProperty("blurb") - private String blurb; + @JsonProperty("file-formats") + private List fileFormats; + + @JsonProperty("ignore-glob-list") + private List ignoreGlobList; + + @JsonProperty("ignore-standalone-config") + private Boolean isIgnoreStandaloneConfig; + + @JsonProperty("ignore-commits-list") + private List ignoreCommitList; + + @JsonProperty("ignore-authors-list") + private List ignoreAuthorList; + + @JsonProperty("is-shallow-cloning") + private Boolean isShallowCloning; + + @JsonProperty("is-find-previous-authors") + private Boolean isFindPreviousAuthor; public String getBranch() { return branch == null ? DEFAULT_BRANCH : branch; } - public String getBlurb() { - return blurb == null ? DEFAULT_BLURB : blurb; + public List getFileFormats() { + return fileFormats == null ? DEFAULT_FILE_FORMATS : fileFormats; + } + + public List getIgnoreGlobList() { + return ignoreGlobList == null ? DEFAULT_IGNORE_GLOB_LIST : fileFormats; + } + + public boolean getIsIgnoreStandaloneConfig() { + return isIgnoreStandaloneConfig == null ? DEFAULT_IS_IGNORE_STANDALONE_CONFIG : isIgnoreStandaloneConfig; + } + + public List getIgnoreCommitList() { + return ignoreCommitList == null ? DEFAULT_IGNORE_COMMITS_LIST : ignoreCommitList; + } + + public List getIgnoreAuthorList() { + return ignoreAuthorList == null ? DEFAULT_IGNORE_AUTHORS_LIST : ignoreAuthorList; + } + + public boolean getIsShallowCloning() { + return isShallowCloning == null ? DEFAULT_IS_SHALLOW_CLONING : isShallowCloning; + } + + public boolean getIsFindPreviousAuthor() { + return isFindPreviousAuthor == null ? DEFAULT_IS_FIND_PREVIOUS_AUTHOR : isFindPreviousAuthor; } @Override @@ -29,9 +105,15 @@ public boolean equals(Object obj) { } if (obj instanceof ReportBranchData) { - ReportBranchData reportBranchData = (ReportBranchData) obj; - return reportBranchData.getBranch().equals(this.getBranch()) - && reportBranchData.getBlurb().equals(this.getBlurb()); + ReportBranchData rbd = (ReportBranchData) obj; + return this.getBranch().equals(rbd.getBranch()) + && this.getFileFormats().equals(rbd.getFileFormats()) + && this.getIgnoreGlobList().equals(rbd.getIgnoreGlobList()) + && this.getIsIgnoreStandaloneConfig() == rbd.getIsIgnoreStandaloneConfig() + && this.getIgnoreCommitList().equals(rbd.getIgnoreCommitList()) + && this.getIgnoreAuthorList().equals(rbd.getIgnoreAuthorList()) + && this.getIsShallowCloning() == rbd.getIsShallowCloning() + && this.getIsFindPreviousAuthor() == rbd.getIsFindPreviousAuthor(); } return false; diff --git a/src/main/java/reposense/model/reportconfig/ReportConfiguration.java b/src/main/java/reposense/model/reportconfig/ReportConfiguration.java index c72c43af9f..fcaf682598 100644 --- a/src/main/java/reposense/model/reportconfig/ReportConfiguration.java +++ b/src/main/java/reposense/model/reportconfig/ReportConfiguration.java @@ -11,17 +11,20 @@ */ 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_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; @@ -29,6 +32,10 @@ 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; } diff --git a/src/main/java/reposense/model/reportconfig/ReportGroupDetails.java b/src/main/java/reposense/model/reportconfig/ReportGroupDetails.java new file mode 100644 index 0000000000..8310e86f49 --- /dev/null +++ b/src/main/java/reposense/model/reportconfig/ReportGroupDetails.java @@ -0,0 +1,49 @@ +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/ReportGroupNameAndGlobs.java b/src/main/java/reposense/model/reportconfig/ReportGroupNameAndGlobs.java new file mode 100644 index 0000000000..f3403d31ab --- /dev/null +++ b/src/main/java/reposense/model/reportconfig/ReportGroupNameAndGlobs.java @@ -0,0 +1,69 @@ +package reposense.model.reportconfig; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains details about each report group and the corresponding globs. + */ +public class ReportGroupNameAndGlobs { + public static final String DEFAULT_GROUP_NAME = "code"; + public static final List DEFAULT_GLOBS = List.of( + "**.java" + ); + public static final List DEFAULT_INSTANCES = new ArrayList<>(); + + static { + ReportGroupNameAndGlobs rg1 = new ReportGroupNameAndGlobs(); + rg1.groupName = "code"; + rg1.globs = List.of("**.java"); + + ReportGroupNameAndGlobs rg2 = new ReportGroupNameAndGlobs(); + rg2.groupName = "tests"; + rg2.globs = List.of("src/test**"); + + ReportGroupNameAndGlobs rg3 = new ReportGroupNameAndGlobs(); + rg3.groupName = "docs"; + rg3.globs = List.of("docs**", "**.adoc", "**.md"); + + DEFAULT_INSTANCES.add(rg1); + DEFAULT_INSTANCES.add(rg2); + DEFAULT_INSTANCES.add(rg3); + } + + @JsonProperty("group-name") + private String groupName; + + @JsonProperty("globs") + private List globs; + + public String getGroupName() { + return groupName == null ? DEFAULT_GROUP_NAME : groupName; + } + + public List getGlobs() { + return globs == null ? DEFAULT_GLOBS : globs; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (obj instanceof ReportGroupNameAndGlobs) { + ReportGroupNameAndGlobs rgnag = (ReportGroupNameAndGlobs) obj; + return rgnag.getGroupName().equals(this.getGroupName()) + && rgnag.getGlobs().equals(this.getGlobs()); + } + + return false; + } + + @Override + public String toString() { + return "RGNAG { group-name: " + this.groupName + ", globs: " + this.globs + "}"; + } +} diff --git a/src/main/java/reposense/model/reportconfig/ReportRepoConfiguration.java b/src/main/java/reposense/model/reportconfig/ReportRepoConfiguration.java index c30b732c42..3a90009cad 100644 --- a/src/main/java/reposense/model/reportconfig/ReportRepoConfiguration.java +++ b/src/main/java/reposense/model/reportconfig/ReportRepoConfiguration.java @@ -10,40 +10,66 @@ */ public class ReportRepoConfiguration { public static final String DEFAULT_REPO = "https://github.com/user/repo"; - public static final List DEFAULT_AUTHOR_NAMES = List.of( - "johnDoe", "John Doe", "my home PC" + public static final List DEFAULT_AUTHOR_EMAIL = List.of( + "john@john.com", "johny@mail.com", "j@domain.com" ); + public static final String DEFAULT_GIT_HOST_ID = "johnDoe"; + public static final String DEFAULT_DISPLAY_NAME = "John Doe"; + public static final String DEFAULT_GIT_AUTHOR_NAME = "my home PC"; public static final List DEFAULT_BRANCHES = List.of( - new ReportBranchData() + ReportBranchData.DEFAULT_INSTANCE ); - public static final ReportRepoConfiguration DEFAULT_INSTANCE = new ReportRepoConfiguration(); static { DEFAULT_INSTANCE.repo = DEFAULT_REPO; - DEFAULT_INSTANCE.authorNames = DEFAULT_AUTHOR_NAMES; + DEFAULT_INSTANCE.authorEmails = DEFAULT_AUTHOR_EMAIL; + DEFAULT_INSTANCE.authorGitHostId = DEFAULT_GIT_HOST_ID; + DEFAULT_INSTANCE.authorDisplayName = DEFAULT_DISPLAY_NAME; + DEFAULT_INSTANCE.authorGitAuthorName = DEFAULT_GIT_AUTHOR_NAME; DEFAULT_INSTANCE.branches = DEFAULT_BRANCHES; } @JsonProperty("repo") private String repo; + @JsonProperty("author-emails") + private List authorEmails; + + @JsonProperty("author-git-host-id") + private String authorGitHostId; + + @JsonProperty("author-display-name") + private String authorDisplayName; + + @JsonProperty("author-git-author-name") + private String authorGitAuthorName; + @JsonProperty("branches") private List branches; - @JsonProperty("authorNames") - private List authorNames; - public String getRepo() { return repo == null ? DEFAULT_REPO : repo; } - public List getBranches() { - return branches == null ? DEFAULT_BRANCHES : branches; + public List getAuthorEmails() { + return authorEmails == null ? DEFAULT_AUTHOR_EMAIL : authorEmails; } - public List getAuthorNames() { - return authorNames == null ? DEFAULT_AUTHOR_NAMES : authorNames; + public String getAuthorGitHostId() { + return authorGitHostId == null ? DEFAULT_GIT_HOST_ID : authorGitHostId; + } + + public String getAuthorDisplayName() { + return authorDisplayName == null ? DEFAULT_DISPLAY_NAME : authorDisplayName; + } + + public String getAuthorGitAuthorName() { + return authorGitAuthorName == null ? DEFAULT_GIT_AUTHOR_NAME : authorGitAuthorName; + } + + public List getBranches() { + return branches == null ? DEFAULT_BRANCHES : branches; } @Override @@ -55,8 +81,11 @@ public boolean equals(Object obj) { if (obj instanceof ReportRepoConfiguration) { ReportRepoConfiguration rrc = (ReportRepoConfiguration) obj; return rrc.getRepo().equals(this.getRepo()) - && rrc.getBranches().equals(this.getBranches()) - && rrc.getAuthorNames().equals(this.getAuthorNames()); + && rrc.getAuthorEmails().equals(this.getAuthorEmails()) + && rrc.getAuthorGitHostId().equals(this.getAuthorGitHostId()) + && rrc.getAuthorDisplayName().equals(this.getAuthorDisplayName()) + && rrc.getAuthorGitAuthorName().equals(this.getAuthorGitAuthorName()) + && rrc.getBranches().equals(this.getBranches()); } return false; diff --git a/src/main/java/reposense/parser/ArgsParser.java b/src/main/java/reposense/parser/ArgsParser.java index fd55bca12a..c09ba17df9 100644 --- a/src/main/java/reposense/parser/ArgsParser.java +++ b/src/main/java/reposense/parser/ArgsParser.java @@ -363,7 +363,6 @@ private static void addReportConfigToBuilder(CliArguments.Builder builder, Names if (locations == null) { Path reportConfigFilePath = configFolderPath.resolve(ReportConfigYamlParser.REPORT_CONFIG_FILENAME); - // TODO: ADD BLURB MARKDOWN PARSER HERE try { reportConfig = new ReportConfigYamlParser().parse(reportConfigFilePath); } catch (JsonSyntaxException jse) { diff --git a/src/main/java/reposense/parser/ReportConfigYamlParser.java b/src/main/java/reposense/parser/ReportConfigYamlParser.java index 93b113842f..d584d8d40b 100644 --- a/src/main/java/reposense/parser/ReportConfigYamlParser.java +++ b/src/main/java/reposense/parser/ReportConfigYamlParser.java @@ -47,7 +47,6 @@ protected ReportConfiguration fromJson(Gson gson, Path path, Type type) throws I ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.findAndRegisterModules(); reportConfigation = mapper.readValue(new File(path.toString()), ReportConfiguration.class); - System.out.println(reportConfigation); logger.log(Level.INFO, "report-config.yaml file parsed successfully!"); } catch (IOException ioe) { // if the parse fails for any reason, the default config file is used instead diff --git a/src/systemtest/resources/ConfigSystemTest/report-config.yaml b/src/systemtest/resources/ConfigSystemTest/report-config.yaml index 685458546e..1708f569bd 100644 --- a/src/systemtest/resources/ConfigSystemTest/report-config.yaml +++ b/src/systemtest/resources/ConfigSystemTest/report-config.yaml @@ -1,20 +1,43 @@ title: RepoSense Report Test Title +group-details: + - repo: https://github.com/user/repo/tree/fake-branch + groups: + - group-name: code + globs: + - "**.java" + - group-name: tests + globs: + - "src/test**" + - group-name: docs + globs: + - "docs**" + - "**.adoc" + - "**.md" repos: - - repo: https://github.com/user/repo - authorNames: - - johnDoe - - John Doe - - my home PC + - repo: https://github.com/user/repo/tree/fake-branch + author-emails: + - john@john.com + - johny@mail.com + - j@domain.com + author-git-host-id: johnDoe + author-display-name: John Doe + author-git-author-name: my home PC branches: - branch: main - blurb: very long blurb - - branch: master - blurb: very very long blurb - - repo: https://github.com/user/repo2 - authorNames: - - author1 - - author One - - my author PC - branches: - - branch: main - blurb: very very very long blurb + file-formats: + - override:java + - md + - fxml + ignore-glob-list: + - "docs**" + ignore-standalone-config: true + ignore-commits-list: + - 2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7 + - c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151 + - cd7f610e0becbdf331d5231887d8010a689f87c7 + - 768015345e70f06add2a8b7d1f901dc07bf70582 + ignore-authors-list: + - author1 + - author2 + is-shallow-cloning: true + is-find-previous-authors: false diff --git a/src/test/java/reposense/model/reportconfig/ReportBranchDataTest.java b/src/test/java/reposense/model/reportconfig/ReportBranchDataTest.java index 82fb1eb451..70302084c2 100644 --- a/src/test/java/reposense/model/reportconfig/ReportBranchDataTest.java +++ b/src/test/java/reposense/model/reportconfig/ReportBranchDataTest.java @@ -10,8 +10,43 @@ public void getBranch_equalsDefaultReturnValue_success() { } @Test - public void getBlurb_equalsDefaultReturnValue_success() { - Assertions.assertSame(new ReportBranchData().getBlurb(), ReportBranchData.DEFAULT_BLURB); + public void getFileFormats_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportBranchData().getFileFormats(), ReportBranchData.DEFAULT_FILE_FORMATS); + } + + @Test + public void getIgnoreGlobList_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportBranchData().getIgnoreGlobList(), ReportBranchData.DEFAULT_IGNORE_GLOB_LIST); + } + + @Test + public void getIsIgnoreStandaloneConfig_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportBranchData().getIsIgnoreStandaloneConfig(), + ReportBranchData.DEFAULT_IS_IGNORE_STANDALONE_CONFIG); + } + + @Test + public void getIgnoreCommitList_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportBranchData().getIgnoreCommitList(), + ReportBranchData.DEFAULT_IGNORE_COMMITS_LIST); + } + + @Test + public void getIgnoreAuthorList_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportBranchData().getIgnoreAuthorList(), + ReportBranchData.DEFAULT_IGNORE_AUTHORS_LIST); + } + + @Test + public void getIsShallowCloning_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportBranchData().getIsShallowCloning(), + ReportBranchData.DEFAULT_IS_SHALLOW_CLONING); + } + + @Test + public void getIsFindPreviousAuthor_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportBranchData().getIsFindPreviousAuthor(), + ReportBranchData.DEFAULT_IS_FIND_PREVIOUS_AUTHOR); } @Test diff --git a/src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java b/src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java index 935b0872ff..19a5fad8b3 100644 --- a/src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java +++ b/src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java @@ -15,6 +15,12 @@ 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 new file mode 100644 index 0000000000..d3df44380f --- /dev/null +++ b/src/test/java/reposense/model/reportconfig/ReportGroupDetailsTest.java @@ -0,0 +1,23 @@ +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/java/reposense/model/reportconfig/ReportGroupNameAndGlobsTest.java b/src/test/java/reposense/model/reportconfig/ReportGroupNameAndGlobsTest.java new file mode 100644 index 0000000000..e44028c85e --- /dev/null +++ b/src/test/java/reposense/model/reportconfig/ReportGroupNameAndGlobsTest.java @@ -0,0 +1,22 @@ +package reposense.model.reportconfig; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ReportGroupNameAndGlobsTest { + @Test + public void getRepo_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportGroupNameAndGlobs().getGroupName(), ReportGroupNameAndGlobs.DEFAULT_GROUP_NAME); + } + + @Test + public void getReportGroupNameAndGlobsList_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportGroupNameAndGlobs().getGlobs(), + ReportGroupNameAndGlobs.DEFAULT_GLOBS); + } + + @Test + public void equals_defaultInstancesAreEqual_success() { + Assertions.assertEquals(new ReportGroupNameAndGlobs(), new ReportGroupNameAndGlobs()); + } +} diff --git a/src/test/java/reposense/model/reportconfig/ReportRepoConfigurationTest.java b/src/test/java/reposense/model/reportconfig/ReportRepoConfigurationTest.java index 9fd2ce73c5..679e9ea88f 100644 --- a/src/test/java/reposense/model/reportconfig/ReportRepoConfigurationTest.java +++ b/src/test/java/reposense/model/reportconfig/ReportRepoConfigurationTest.java @@ -10,14 +10,32 @@ public void getRepo_equalsDefaultReturnValue_success() { } @Test - public void getBranches_equalsDefaultReturnValue_success() { - Assertions.assertSame(new ReportRepoConfiguration().getBranches(), ReportRepoConfiguration.DEFAULT_BRANCHES); + public void getAuthorEmails_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportRepoConfiguration().getAuthorEmails(), + ReportRepoConfiguration.DEFAULT_AUTHOR_EMAIL); } @Test - public void getAuthorNames_equalsDefaultReturnValue_success() { - Assertions.assertSame(new ReportRepoConfiguration().getAuthorNames(), - ReportRepoConfiguration.DEFAULT_AUTHOR_NAMES); + public void getAuthorGitHostId_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportRepoConfiguration().getAuthorGitHostId(), + ReportRepoConfiguration.DEFAULT_GIT_HOST_ID); + } + + @Test + public void getAuthorDisplayName_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportRepoConfiguration().getAuthorDisplayName(), + ReportRepoConfiguration.DEFAULT_DISPLAY_NAME); + } + + @Test + public void getAuthorGitAuthorName_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportRepoConfiguration().getAuthorGitAuthorName(), + ReportRepoConfiguration.DEFAULT_GIT_AUTHOR_NAME); + } + + @Test + public void getBranches_equalsDefaultReturnValue_success() { + Assertions.assertSame(new ReportRepoConfiguration().getBranches(), ReportRepoConfiguration.DEFAULT_BRANCHES); } @Test diff --git a/src/test/resources/ReportConfigYamlParserTest/report-config-invalid.yaml b/src/test/resources/ReportConfigYamlParserTest/report-config-invalid.yaml index 053a51eeaf..fda2a639be 100644 --- a/src/test/resources/ReportConfigYamlParserTest/report-config-invalid.yaml +++ b/src/test/resources/ReportConfigYamlParserTest/report-config-invalid.yaml @@ -1,20 +1,36 @@ title: RepoSense Report -repos: - - repo https://github.com/user/reposs - authorName: - - johnDoe - - John Doe - - my home PC - branc: - - branch: main - blurb: very long blurb - - branch: master - blurb: very very long blurb - - repo: https://github.com/user/repo2 - authorNames: - - author1 - - author One - - my author PC +group-details: + - repo: https://github.com/user/repo/tree/fake-branch + grou + - group-name: code + globs: + - "**.java" + - group-name: tests + globs: + - "src/test**" + - group-name: docs + globs: + - "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 - blurb: very very very long blurb + file-formats: + - override:java + - md + - fxml + ignore-glob-list: + - "docs**" + ignore-standalone-config: true + ignore-author-list: + - author1 + - author2 + is-shallow-cloning: true + 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 4ca75973fe..746b0493f6 100644 --- a/src/test/resources/ReportConfigYamlParserTest/report-config-valid.yaml +++ b/src/test/resources/ReportConfigYamlParserTest/report-config-valid.yaml @@ -1,20 +1,44 @@ title: RepoSense Report Repo Test +group-details: + - repo: https://github.com/user/repo/tree/fake-branch + groups: + - group-name: code + globs: + - "**.java" + - group-name: tests + globs: + - "src/test**" + - group-name: docs + globs: + - "docs**" + - "**.adoc" + - "**.md" repos: - - repo: https://github.com/user/repo - authorNames: - - johnDoe - - John Doe - - my home PC + - repo: https://github.com/user/repo/tree/fake-branch + author-emails: + - john@john.com + - johny@mail.com + - j@domain.com + author-git-host-id: johnDoe + author-display-name: John Doe + author-git-author-name: my home PC branches: - branch: main - blurb: very long blurb - - branch: master - blurb: very very long blurb - - repo: https://github.com/user/repo2 - authorNames: - - author1 - - author One - - my author PC - branches: - - branch: main - blurb: very very very long blurb + file-formats: + - override:java + - md + - fxml + ignore-glob-list: + - "docs**" + ignore-standalone-config: true + ignore-commits-list: + - 2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7 + - c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151 + - cd7f610e0becbdf331d5231887d8010a689f87c7 + - 768015345e70f06add2a8b7d1f901dc07bf70582 + ignore-authors-list: + - author1 + - author2 + is-shallow-cloning: true + is-find-previous-authors: false +