diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2021-01-05 12:19:25 -0600 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-01-11 20:20:39 +0000 |
commit | 6789a2ec09f916b67bb34400f332570d2ca26b94 (patch) | |
tree | 767909bb951844bafb67f4b99c0b7c18b560e670 /server/sonar-ce-task-projectanalysis | |
parent | 16d235022a4711857cde9d0953be3a864b1bfb83 (diff) | |
download | sonarqube-6789a2ec09f916b67bb34400f332570d2ca26b94.tar.gz sonarqube-6789a2ec09f916b67bb34400f332570d2ca26b94.zip |
SONAR-14245 Drop organization related tables
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
7 files changed, 11 insertions, 30 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutor.java index 30db006817d..a0c4d6fb635 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutor.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutor.java @@ -269,7 +269,12 @@ public class PostProjectAnalysisTasksExecutor implements ComputationStepExecutor this.scmRevisionId = scmRevisionId; } + /** + * + * @deprecated since 8.7. No longer used - it's always empty. + */ @Override + @Deprecated public Optional<Organization> getOrganization() { return empty(); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java index 9e9a8f1daf7..dc9ab683f8d 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java @@ -49,7 +49,6 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentUpdateDto; -import org.sonar.server.organization.DefaultOrganizationProvider; import static java.util.Optional.ofNullable; import static org.sonar.ce.task.projectanalysis.component.ComponentVisitor.Order.PRE_ORDER; @@ -68,11 +67,10 @@ public class PersistComponentsStep implements ComputationStep { private final AnalysisMetadataHolder analysisMetadataHolder; private final BranchPersister branchPersister; private final ProjectPersister projectPersister; - private final DefaultOrganizationProvider defaultOrganizationProvider; public PersistComponentsStep(DbClient dbClient, TreeRootHolder treeRootHolder, System2 system2, MutableDisabledComponentsHolder disabledComponentsHolder, AnalysisMetadataHolder analysisMetadataHolder, - BranchPersister branchPersister, ProjectPersister projectPersister, DefaultOrganizationProvider defaultOrganizationProvider) { + BranchPersister branchPersister, ProjectPersister projectPersister) { this.dbClient = dbClient; this.treeRootHolder = treeRootHolder; this.system2 = system2; @@ -80,7 +78,6 @@ public class PersistComponentsStep implements ComputationStep { this.analysisMetadataHolder = analysisMetadataHolder; this.branchPersister = branchPersister; this.projectPersister = projectPersister; - this.defaultOrganizationProvider = defaultOrganizationProvider; } @Override @@ -364,7 +361,6 @@ public class PersistComponentsStep implements ComputationStep { String componentUuid = component.getUuid(); ComponentDto componentDto = new ComponentDto(); - componentDto.setOrganizationUuid(defaultOrganizationProvider.get().getUuid()); componentDto.setUuid(componentUuid); componentDto.setDbKey(componentKey); componentDto.setMainBranchProjectUuid(mainBranchProjectUuid); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java index 7ce45cdf4d5..5a0a7090989 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java @@ -155,7 +155,7 @@ public class PostProjectAnalysisTasksExecutorTest { @Test @UseDataProvider("booleanValues") - public void organization_is_null_when_organization_are_disabled(boolean allStepsExecuted) { + public void organization_is_null(boolean allStepsExecuted) { underTest.finished(allStepsExecuted); verify(postProjectAnalysisTask).finished(taskContextCaptor.capture()); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStepTest.java index 9d462758f02..3a7ab70f7f8 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStepTest.java @@ -33,7 +33,6 @@ import org.sonar.ce.task.step.TestComputationStepContext; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDao; -import org.sonar.server.organization.DefaultOrganizationProvider; import static java.util.Collections.emptyList; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; @@ -70,7 +69,6 @@ public class PersistComponentsStepTest { mock(MutableDisabledComponentsHolder.class), mock(AnalysisMetadataHolder.class), mock(BranchPersister.class), - mock(ProjectPersister.class), - mock(DefaultOrganizationProvider.class)).execute(new TestComputationStepContext()); + mock(ProjectPersister.class)).execute(new TestComputationStepContext()); } } diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java index cfa4ea82acd..ef34736d364 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java @@ -48,8 +48,6 @@ import org.sonar.db.DbTester; import org.sonar.db.component.BranchType; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentTesting; -import org.sonar.server.organization.DefaultOrganizationProvider; -import org.sonar.server.organization.TestDefaultOrganizationProvider; import org.sonar.server.project.Project; import static org.apache.commons.lang.StringUtils.isEmpty; @@ -74,7 +72,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest { @Rule public DbTester db = DbTester.create(System2.INSTANCE); - public DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db); @Rule public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule(); @Rule @@ -93,8 +90,7 @@ public class ReportPersistComponentsStepTest extends BaseStepTest { BranchPersister branchPersister = mock(BranchPersister.class); ProjectPersister projectPersister = mock(ProjectPersister.class); - underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, analysisMetadataHolder, branchPersister, projectPersister, - defaultOrganizationProvider); + underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, analysisMetadataHolder, branchPersister, projectPersister); } @Override @@ -125,7 +121,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest { assertThat(db.countRowsOfTable("components")).isEqualTo(3); ComponentDto directoryDto = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir").get(); - assertThat(directoryDto.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); assertThat(directoryDto.name()).isEqualTo("dir"); assertThat(directoryDto.longName()).isEqualTo("src/main/java/dir"); assertThat(directoryDto.description()).isNull(); @@ -142,7 +137,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest { assertThat(directoryDto.getCreatedAt()).isEqualTo(now); ComponentDto fileDto = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir/Foo.java").get(); - assertThat(fileDto.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); assertThat(fileDto.name()).isEqualTo("Foo.java"); assertThat(fileDto.longName()).isEqualTo("src/main/java/dir/Foo.java"); assertThat(fileDto.description()).isNull(); @@ -184,7 +178,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest { assertThat(db.countRowsOfTable("components")).isEqualTo(3); ComponentDto directoryDto = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir").get(); - assertThat(directoryDto.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); assertThat(directoryDto.name()).isEqualTo("dir"); assertThat(directoryDto.longName()).isEqualTo("src/main/java/dir"); assertThat(directoryDto.description()).isNull(); @@ -201,7 +194,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest { assertThat(directoryDto.getCreatedAt()).isEqualTo(now); ComponentDto fileDto = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir/Foo.java").get(); - assertThat(fileDto.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); assertThat(fileDto.name()).isEqualTo("Foo.java"); assertThat(fileDto.longName()).isEqualTo("src/main/java/dir/Foo.java"); assertThat(fileDto.description()).isNull(); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/UpdateQualityProfilesLastUsedDateStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/UpdateQualityProfilesLastUsedDateStepTest.java index 4bb7c50bd32..e9ab08da8f6 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/UpdateQualityProfilesLastUsedDateStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/UpdateQualityProfilesLastUsedDateStepTest.java @@ -50,7 +50,7 @@ import static org.sonar.api.measures.CoreMetrics.QUALITY_PROFILES_KEY; import static org.sonar.db.qualityprofile.QualityProfileTesting.newQualityProfileDto; public class UpdateQualityProfilesLastUsedDateStepTest { - static final long ANALYSIS_DATE = 1_123_456_789L; + private static final long ANALYSIS_DATE = 1_123_456_789L; private static final Component PROJECT = ReportComponent.DUMB_PROJECT; private QProfileDto sonarWayJava = newProfile("sonar-way-java"); private QProfileDto sonarWayPhp = newProfile("sonar-way-php"); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java index 11ccedd67ce..c5fac8293c5 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java @@ -48,8 +48,6 @@ import org.sonar.db.DbTester; import org.sonar.db.component.ComponentDbTester; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentTesting; -import org.sonar.server.organization.DefaultOrganizationProvider; -import org.sonar.server.organization.TestDefaultOrganizationProvider; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; @@ -81,8 +79,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest { @Rule public DbTester dbTester = DbTester.create(System2.INSTANCE); - public DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(dbTester); - @Rule public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule(); @Rule @@ -103,8 +99,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest { analysisMetadataHolder.setBranch(new DefaultBranchImpl()); BranchPersister branchPersister = mock(BranchPersister.class); ProjectPersister projectPersister = mock(ProjectPersister.class); - underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, analysisMetadataHolder, branchPersister, projectPersister, - defaultOrganizationProvider); + underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, analysisMetadataHolder, branchPersister, projectPersister); } @Override @@ -485,7 +480,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest { private ComponentDto newViewDto() { return ComponentTesting.newView(VIEW_UUID) - .setOrganizationUuid(defaultOrganizationProvider.get().getUuid()) .setDbKey(VIEW_KEY) .setName(VIEW_NAME); } @@ -499,7 +493,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest { * Assertions to verify the DTO created from {@link #createViewBuilder(ViewAttributes.Type)} ()} */ private void assertDtoIsView(ComponentDto dto) { - assertThat(dto.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); assertThat(dto.name()).isEqualTo(VIEW_NAME); assertThat(dto.longName()).isEqualTo(VIEW_NAME); assertThat(dto.description()).isEqualTo(VIEW_DESCRIPTION); @@ -519,7 +512,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest { * Assertions to verify the DTO created from {@link #createViewBuilder(ViewAttributes.Type)} ()} */ private void assertDtoIsApplication(ComponentDto dto) { - assertThat(dto.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); assertThat(dto.name()).isEqualTo(VIEW_NAME); assertThat(dto.longName()).isEqualTo(VIEW_NAME); assertThat(dto.description()).isEqualTo(VIEW_DESCRIPTION); @@ -539,7 +531,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest { * Assertions to verify the DTO created from {@link #createProjectView1Builder(ComponentDto, Long)} */ private void assertDtoIsSubView1(ComponentDto viewDto, ComponentDto sv1Dto) { - assertThat(sv1Dto.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); assertThat(sv1Dto.name()).isEqualTo(SUBVIEW_1_NAME); assertThat(sv1Dto.longName()).isEqualTo(SUBVIEW_1_NAME); assertThat(sv1Dto.description()).isEqualTo(SUBVIEW_1_DESCRIPTION); @@ -556,7 +547,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest { } private void assertDtoIsProjectView1(ComponentDto pv1Dto, ComponentDto viewDto, ComponentDto parentViewDto, ComponentDto project) { - assertThat(pv1Dto.getOrganizationUuid()).isEqualTo(defaultOrganizationProvider.get().getUuid()); assertThat(pv1Dto.name()).isEqualTo(PROJECT_VIEW_1_NAME); assertThat(pv1Dto.longName()).isEqualTo(PROJECT_VIEW_1_NAME); assertThat(pv1Dto.description()).isNull(); |