diff options
author | Wojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com> | 2024-03-27 14:54:08 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-03-28 20:02:50 +0000 |
commit | 0720dee972bcc286fad8f8b73000dfe07aaca5b3 (patch) | |
tree | 4037b1d83b6a9c0a9d727a9b2c7844e080c59835 /server/sonar-db-dao/src | |
parent | 50f49a4d7a17aecc35290234dc9bdca638b21cd6 (diff) | |
download | sonarqube-0720dee972bcc286fad8f8b73000dfe07aaca5b3.tar.gz sonarqube-0720dee972bcc286fad8f8b73000dfe07aaca5b3.zip |
SONAR-21821 Add monorepo related project 'CreationMethod's
Diffstat (limited to 'server/sonar-db-dao/src')
-rw-r--r-- | server/sonar-db-dao/src/main/java/org/sonar/db/project/CreationMethod.java | 6 | ||||
-rw-r--r-- | server/sonar-db-dao/src/test/java/org/sonar/db/project/CreationMethodTest.java | 21 |
2 files changed, 17 insertions, 10 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/project/CreationMethod.java b/server/sonar-db-dao/src/main/java/org/sonar/db/project/CreationMethod.java index 668e7ee2a37..481c400743d 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/project/CreationMethod.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/project/CreationMethod.java @@ -27,6 +27,8 @@ public enum CreationMethod { LOCAL_BROWSER(Category.LOCAL, true, true), ALM_IMPORT_API(Category.ALM_IMPORT, false, false), ALM_IMPORT_BROWSER(Category.ALM_IMPORT, true, false), + ALM_IMPORT_MONOREPO_API(Category.ALM_IMPORT_MONOREPO, false, false), + ALM_IMPORT_MONOREPO_BROWSER(Category.ALM_IMPORT_MONOREPO, true, false), SCANNER_API(Category.SCANNER, false, true), SCANNER_API_DEVOPS_AUTO_CONFIG(Category.SCANNER, false, false); @@ -60,5 +62,7 @@ public enum CreationMethod { return isLocal; } - public enum Category {UNKNOWN, LOCAL, ALM_IMPORT, SCANNER} + public enum Category { + UNKNOWN, LOCAL, ALM_IMPORT, ALM_IMPORT_MONOREPO, SCANNER + } } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/project/CreationMethodTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/project/CreationMethodTest.java index fdab1c56e73..a73f7585134 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/project/CreationMethodTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/project/CreationMethodTest.java @@ -25,6 +25,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; +import org.sonar.db.project.CreationMethod.Category; import static org.assertj.core.api.Assertions.assertThat; @@ -33,20 +34,22 @@ class CreationMethodTest { static class CreationMethodProvider implements ArgumentsProvider { @Override public Stream<? extends Arguments> provideArguments(ExtensionContext context) { - return Stream.of(Arguments.of(CreationMethod.Category.UNKNOWN, true, CreationMethod.UNKNOWN), - Arguments.of(CreationMethod.Category.UNKNOWN, false, CreationMethod.UNKNOWN), - Arguments.of(CreationMethod.Category.LOCAL, true, CreationMethod.LOCAL_BROWSER), - Arguments.of(CreationMethod.Category.LOCAL, false, CreationMethod.LOCAL_API), - Arguments.of(CreationMethod.Category.ALM_IMPORT, true, CreationMethod.ALM_IMPORT_BROWSER), - Arguments.of(CreationMethod.Category.ALM_IMPORT, false, CreationMethod.ALM_IMPORT_API), - Arguments.of(CreationMethod.Category.SCANNER, true, CreationMethod.UNKNOWN), - Arguments.of(CreationMethod.Category.SCANNER, false, CreationMethod.SCANNER_API)); + return Stream.of(Arguments.of(Category.UNKNOWN, true, CreationMethod.UNKNOWN), + Arguments.of(Category.UNKNOWN, false, CreationMethod.UNKNOWN), + Arguments.of(Category.LOCAL, true, CreationMethod.LOCAL_BROWSER), + Arguments.of(Category.LOCAL, false, CreationMethod.LOCAL_API), + Arguments.of(Category.ALM_IMPORT, true, CreationMethod.ALM_IMPORT_BROWSER), + Arguments.of(Category.ALM_IMPORT, false, CreationMethod.ALM_IMPORT_API), + Arguments.of(Category.ALM_IMPORT_MONOREPO, true, CreationMethod.ALM_IMPORT_MONOREPO_BROWSER), + Arguments.of(Category.ALM_IMPORT_MONOREPO, false, CreationMethod.ALM_IMPORT_MONOREPO_API), + Arguments.of(Category.SCANNER, true, CreationMethod.UNKNOWN), + Arguments.of(Category.SCANNER, false, CreationMethod.SCANNER_API)); } } @ParameterizedTest() @ArgumentsSource(CreationMethodProvider.class) - void getCreationMethod_returnsCorrectCreationMethod(CreationMethod.Category category, boolean isCreatedViaBrowser, + void getCreationMethod_returnsCorrectCreationMethod(Category category, boolean isCreatedViaBrowser, CreationMethod expectedCreationMethod) { CreationMethod creationMethod = CreationMethod.getCreationMethod(category, isCreatedViaBrowser); assertThat(creationMethod).isEqualTo(expectedCreationMethod); |