diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-10-31 13:36:43 -0500 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-12-09 20:46:14 +0100 |
commit | 1b7c2ba7e13e675657f58d422d04d548d210da08 (patch) | |
tree | cc6d01e54676f156e23fd9c4a349a3157f6216b8 /server/sonar-db-dao | |
parent | 1beafb82821b593010abb721a4d20e60a962e098 (diff) | |
download | sonarqube-1b7c2ba7e13e675657f58d422d04d548d210da08.tar.gz sonarqube-1b7c2ba7e13e675657f58d422d04d548d210da08.zip |
SONAR-12626 CE and Web no longer support SLBs
Diffstat (limited to 'server/sonar-db-dao')
5 files changed, 17 insertions, 31 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchType.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchType.java index 124daeaf1d2..852476d08d3 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchType.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchType.java @@ -31,6 +31,8 @@ public enum BranchType { */ SHORT, + BRANCH, + /** * Pull request */ diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java index 1b32e961ed4..505c55cb536 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java @@ -61,7 +61,7 @@ public class BranchDaoTest { BranchDto dto = new BranchDto(); dto.setProjectUuid("U1"); dto.setUuid("U2"); - dto.setBranchType(BranchType.SHORT); + dto.setBranchType(BranchType.LONG); dto.setKey("feature/foo"); underTest.insert(dbSession, dto); @@ -70,7 +70,7 @@ public class BranchDaoTest { assertThat(map).contains( entry("projectUuid", "U1"), entry("uuid", "U2"), - entry("branchType", "SHORT"), + entry("branchType", "LONG"), entry("kee", "feature/foo"), entry("mergeBranchUuid", null), entry("pullRequestBinary", null), @@ -125,20 +125,12 @@ public class BranchDaoTest { }; } - @DataProvider - public static Object[][] nonLongBranchType() { - return new Object[][] { - {BranchType.SHORT}, - {BranchType.PULL_REQUEST} - }; - } - @Test public void insert_branch_with_all_fields_and_max_length_values() { BranchDto dto = new BranchDto(); dto.setProjectUuid(repeat("a", 50)); dto.setUuid(repeat("b", 50)); - dto.setBranchType(BranchType.SHORT); + dto.setBranchType(BranchType.LONG); dto.setKey(repeat("c", 255)); dto.setMergeBranchUuid(repeat("d", 50)); @@ -234,7 +226,7 @@ public class BranchDaoTest { // the fields that can't be updated. New values are ignored. dto.setProjectUuid("ignored"); - dto.setBranchType(BranchType.SHORT); + dto.setBranchType(BranchType.LONG); underTest.upsert(dbSession, dto); BranchDto loaded = underTest.selectByBranchKey(dbSession, "U1", "foo").get(); @@ -270,7 +262,7 @@ public class BranchDaoTest { // the fields that can't be updated. New values are ignored. dto.setProjectUuid("ignored"); - dto.setBranchType(BranchType.SHORT); + dto.setBranchType(BranchType.LONG); underTest.upsert(dbSession, dto); BranchDto loaded = underTest.selectByPullRequestKey(dbSession, "U1", "foo").get(); @@ -351,7 +343,7 @@ public class BranchDaoTest { BranchDto featureBranch = new BranchDto(); featureBranch.setProjectUuid("U1"); featureBranch.setUuid("U2"); - featureBranch.setBranchType(BranchType.SHORT); + featureBranch.setBranchType(BranchType.LONG); featureBranch.setKey("feature/foo"); featureBranch.setMergeBranchUuid("U3"); underTest.insert(dbSession, featureBranch); @@ -380,7 +372,7 @@ public class BranchDaoTest { BranchDto featureBranch = new BranchDto(); featureBranch.setProjectUuid("U1"); featureBranch.setUuid("U2"); - featureBranch.setBranchType(BranchType.SHORT); + featureBranch.setBranchType(BranchType.LONG); featureBranch.setKey("feature/foo"); featureBranch.setMergeBranchUuid("U3"); underTest.insert(dbSession, featureBranch); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java index c323c4099ad..15b1acc9eec 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java @@ -71,6 +71,7 @@ import static org.assertj.core.api.Assertions.tuple; import static org.sonar.api.resources.Qualifiers.APP; import static org.sonar.api.resources.Qualifiers.PROJECT; import static org.sonar.api.utils.DateUtils.parseDate; +import static org.sonar.db.component.BranchType.LONG; import static org.sonar.db.component.BranchType.PULL_REQUEST; import static org.sonar.db.component.ComponentTesting.newBranchDto; import static org.sonar.db.component.ComponentTesting.newDirectory; @@ -218,10 +219,9 @@ public class ComponentDaoTest { } @Test - @UseDataProvider("branchBranchTypes") - public void selectByKeyAndBranch(BranchType branchType) { + public void selectByKeyAndBranch() { ComponentDto project = db.components().insertMainBranch(); - ComponentDto branch = db.components().insertProjectBranch(project, b -> b.setKey("my_branch").setBranchType(branchType)); + ComponentDto branch = db.components().insertProjectBranch(project, b -> b.setKey("my_branch").setBranchType(LONG)); ComponentDto file = db.components().insertComponent(newFileDto(branch)); assertThat(underTest.selectByKeyAndBranch(dbSession, project.getKey(), "master").get().uuid()).isEqualTo(project.uuid()); @@ -231,14 +231,6 @@ public class ComponentDaoTest { assertThat(underTest.selectByKeyAndBranch(dbSession, file.getKey(), "unknown")).isNotPresent(); } - @DataProvider - public static Object[][] branchBranchTypes() { - return new Object[][]{ - {BranchType.SHORT}, - {BranchType.LONG} - }; - } - @Test public void selectByKeyAndPullRequest() { ComponentDto project = db.components().insertMainBranch(); @@ -1625,12 +1617,12 @@ public class ComponentDaoTest { long recentTime = 3_000_000_000L; // project with only a non-main and old analyzed branch ComponentDto oldProject = db.components().insertMainBranch(); - ComponentDto oldProjectBranch = db.components().insertProjectBranch(oldProject, newBranchDto(oldProject).setBranchType(BranchType.SHORT)); + ComponentDto oldProjectBranch = db.components().insertProjectBranch(oldProject, newBranchDto(oldProject).setBranchType(BranchType.LONG)); db.components().insertSnapshot(oldProjectBranch, s -> s.setLast(true).setCreatedAt(aLongTimeAgo)); // project with only a old main branch and a recent non-main branch ComponentDto recentProject = db.components().insertMainBranch(); - ComponentDto recentProjectBranch = db.components().insertProjectBranch(recentProject, newBranchDto(recentProject).setBranchType(BranchType.SHORT)); + ComponentDto recentProjectBranch = db.components().insertProjectBranch(recentProject, newBranchDto(recentProject).setBranchType(BranchType.LONG)); db.components().insertSnapshot(recentProjectBranch, s -> s.setCreatedAt(recentTime).setLast(true)); db.components().insertSnapshot(recentProjectBranch, s -> s.setCreatedAt(aLongTimeAgo).setLast(false)); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java index 6b7553cde1e..2361a6872a5 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java @@ -198,7 +198,7 @@ public class IssueDaoTest { ComponentDto project = db.components().insertMainBranch(); ComponentDto projectBranch = db.components().insertProjectBranch(project, b -> b.setKey("feature/foo") - .setBranchType(BranchType.SHORT)); + .setBranchType(BranchType.LONG)); ComponentDto file = db.components().insertComponent(newFileDto(projectBranch)); @@ -220,7 +220,7 @@ public class IssueDaoTest { ComponentDto project = db.components().insertMainBranch(); ComponentDto projectBranch = db.components().insertProjectBranch(project, b -> b.setKey("feature/foo") - .setBranchType(BranchType.SHORT)); + .setBranchType(BranchType.LONG)); ComponentDto file = db.components().insertComponent(newFileDto(projectBranch)); IssueDto fpIssue = db.issues().insert(rule, projectBranch, file, i -> i.setStatus("RESOLVED").setResolution("FALSE-POSITIVE")); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java index a9edaf58a21..43c79c32c17 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java @@ -1220,7 +1220,7 @@ public class AuthorizationDaoTest { @Test public void keepAuthorizedLoginsOnProject_return_correct_users_on_branch() { ComponentDto project = db.components().insertPrivateProject(organization); - ComponentDto branch = db.components().insertProjectBranch(project, c -> c.setBranchType(random.nextBoolean() ? BranchType.SHORT : BranchType.LONG)); + ComponentDto branch = db.components().insertProjectBranch(project, c -> c.setBranchType(BranchType.LONG)); GroupDto userGroup = db.users().insertGroup(organization, "USERS"); GroupDto adminGroup = db.users().insertGroup(organization, "ADMIN"); |