aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task-projectanalysis
diff options
context:
space:
mode:
authorlukasz-jarocki-sonarsource <lukasz.jarocki@sonarsource.com>2023-10-23 10:11:44 +0200
committersonartech <sonartech@sonarsource.com>2023-10-23 20:02:42 +0000
commitf7e2b799ec400776c95fee4c6f4a8678f984a296 (patch)
tree48b6a9993b42e9afb3ca4849cc7a01db7c19c7bc /server/sonar-ce-task-projectanalysis
parente869b8fd3f912c19324409e23a1df0154f721e62 (diff)
downloadsonarqube-f7e2b799ec400776c95fee4c6f4a8678f984a296.tar.gz
sonarqube-f7e2b799ec400776c95fee4c6f4a8678f984a296.zip
NO-JIRA removing unused fields
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepIT.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepIT.java8
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java6
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStepTest.java18
4 files changed, 10 insertions, 24 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepIT.java b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepIT.java
index 7dd7d3449c9..92eba69d6de 100644
--- a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepIT.java
+++ b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepIT.java
@@ -86,7 +86,7 @@ public class ReportPersistComponentsStepIT extends BaseStepTest {
BranchPersister branchPersister = mock(BranchPersister.class);
ProjectPersister projectPersister = mock(ProjectPersister.class);
- underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, analysisMetadataHolder, branchPersister, projectPersister);
+ underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, branchPersister, projectPersister);
}
@Override
diff --git a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepIT.java b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepIT.java
index d0ad21e6cd7..e7a5ca89179 100644
--- a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepIT.java
+++ b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepIT.java
@@ -30,10 +30,8 @@ import org.junit.Test;
import org.sonar.api.resources.Qualifiers;
import org.sonar.api.resources.Scopes;
import org.sonar.api.utils.System2;
-import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
import org.sonar.ce.task.projectanalysis.component.BranchPersister;
import org.sonar.ce.task.projectanalysis.component.Component;
-import org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl;
import org.sonar.ce.task.projectanalysis.component.MutableDisabledComponentsHolder;
import org.sonar.ce.task.projectanalysis.component.ProjectPersister;
import org.sonar.ce.task.projectanalysis.component.ProjectViewAttributes;
@@ -61,7 +59,6 @@ import static org.mockito.Mockito.when;
import static org.sonar.ce.task.projectanalysis.component.ViewAttributes.Type.APPLICATION;
import static org.sonar.ce.task.projectanalysis.component.ViewAttributes.Type.PORTFOLIO;
import static org.sonar.ce.task.projectanalysis.component.ViewsComponent.builder;
-import static org.sonar.db.component.BranchDto.DEFAULT_MAIN_BRANCH_NAME;
import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
import static org.sonar.db.component.ComponentTesting.newProjectCopy;
import static org.sonar.db.component.ComponentTesting.newSubPortfolio;
@@ -89,8 +86,6 @@ public class ViewsPersistComponentsStepIT extends BaseStepTest {
@Rule
public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule();
- @Rule
- public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule();
private final System2 system2 = mock(System2.class);
private final DbClient dbClient = dbTester.getDbClient();
@@ -103,10 +98,9 @@ public class ViewsPersistComponentsStepIT extends BaseStepTest {
now = DATE_FORMAT.parse("2015-06-02");
when(system2.now()).thenReturn(now.getTime());
- analysisMetadataHolder.setBranch(new DefaultBranchImpl(DEFAULT_MAIN_BRANCH_NAME));
BranchPersister branchPersister = mock(BranchPersister.class);
ProjectPersister projectPersister = mock(ProjectPersister.class);
- underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, analysisMetadataHolder, branchPersister, projectPersister);
+ underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, branchPersister, projectPersister);
}
@Override
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 e1070725c21..2017d69ed17 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
@@ -30,7 +30,6 @@ import org.apache.commons.lang.StringUtils;
import org.sonar.api.resources.Qualifiers;
import org.sonar.api.resources.Scopes;
import org.sonar.api.utils.System2;
-import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder;
import org.sonar.ce.task.projectanalysis.component.BranchPersister;
import org.sonar.ce.task.projectanalysis.component.Component;
import org.sonar.ce.task.projectanalysis.component.CrawlerDepthLimit;
@@ -60,18 +59,15 @@ public class PersistComponentsStep implements ComputationStep {
private final TreeRootHolder treeRootHolder;
private final System2 system2;
private final MutableDisabledComponentsHolder disabledComponentsHolder;
- private final AnalysisMetadataHolder analysisMetadataHolder;
private final BranchPersister branchPersister;
private final ProjectPersister projectPersister;
public PersistComponentsStep(DbClient dbClient, TreeRootHolder treeRootHolder, System2 system2,
- MutableDisabledComponentsHolder disabledComponentsHolder, AnalysisMetadataHolder analysisMetadataHolder,
- BranchPersister branchPersister, ProjectPersister projectPersister) {
+ MutableDisabledComponentsHolder disabledComponentsHolder, BranchPersister branchPersister, ProjectPersister projectPersister) {
this.dbClient = dbClient;
this.treeRootHolder = treeRootHolder;
this.system2 = system2;
this.disabledComponentsHolder = disabledComponentsHolder;
- this.analysisMetadataHolder = analysisMetadataHolder;
this.branchPersister = branchPersister;
this.projectPersister = projectPersister;
}
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 fdfa6af27cf..b1e0b9a9a71 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
@@ -21,7 +21,6 @@ package org.sonar.ce.task.projectanalysis.step;
import org.junit.Test;
import org.sonar.api.utils.System2;
-import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder;
import org.sonar.ce.task.projectanalysis.component.BranchPersister;
import org.sonar.ce.task.projectanalysis.component.Component;
import org.sonar.ce.task.projectanalysis.component.MutableDisabledComponentsHolder;
@@ -55,16 +54,13 @@ public class PersistComponentsStepTest {
doReturn(componentDao).when(dbClient).componentDao();
doReturn(emptyList()).when(componentDao).selectByBranchUuid(eq(projectKey), any(DbSession.class));
- assertThatThrownBy(() -> {
- new PersistComponentsStep(
- dbClient,
- treeRootHolder,
- System2.INSTANCE,
- mock(MutableDisabledComponentsHolder.class),
- mock(AnalysisMetadataHolder.class),
- mock(BranchPersister.class),
- mock(ProjectPersister.class)).execute(new TestComputationStepContext());
- })
+ assertThatThrownBy(() -> new PersistComponentsStep(
+ dbClient,
+ treeRootHolder,
+ System2.INSTANCE,
+ mock(MutableDisabledComponentsHolder.class),
+ mock(BranchPersister.class),
+ mock(ProjectPersister.class)).execute(new TestComputationStepContext()))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("The project '" + projectKey + "' is not stored in the database, during a project analysis");
}