diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-08-12 18:21:32 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-08-24 14:00:30 +0200 |
commit | a1feea20dda2b5013311acef8fe8ac04025b410d (patch) | |
tree | fa539065c0956aee23cb7a179a79c85e20ad49f7 /server | |
parent | b1f137ca79da8dcee79ff258cd39d439fad80820 (diff) | |
download | sonarqube-a1feea20dda2b5013311acef8fe8ac04025b410d.tar.gz sonarqube-a1feea20dda2b5013311acef8fe8ac04025b410d.zip |
rename DumbComponent to ReportComponent
Diffstat (limited to 'server')
70 files changed, 338 insertions, 337 deletions
diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java index 20fa1bfb92f..2906a4e4ac9 100644 --- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java +++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java @@ -41,7 +41,7 @@ import org.sonar.server.computation.batch.BatchReportDirectoryHolderImpl; import org.sonar.server.computation.batch.BatchReportReaderImpl; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.step.PersistFileSourcesStep; import org.sonar.server.db.DbClient; @@ -110,7 +110,7 @@ public class PersistFileSourcesStepTest { components.add(generateFileReport(writer, fileRef)); project.addChildRef(fileRef); } - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1) .setUuid(PROJECT_UUID) .setKey("PROJECT") .addChildren(components.toArray(new Component[components.size()])) @@ -139,7 +139,7 @@ public class PersistFileSourcesStepTest { writer.writeComponentSymbols(fileRef, lineData.symbols); writer.writeComponentDuplications(fileRef, lineData.duplications); - return DumbComponent.builder(Component.Type.FILE, fileRef).setUuid(Uuids.create()).setKey("PROJECT:" + fileRef).build(); + return ReportComponent.builder(Component.Type.FILE, fileRef).setUuid(Uuids.create()).setKey("PROJECT:" + fileRef).build(); } private static class LineData { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/batch/ComponentTreeRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/batch/ComponentTreeRule.java index 9caf27388cf..b1a799d8e30 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/batch/ComponentTreeRule.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/batch/ComponentTreeRule.java @@ -31,7 +31,7 @@ import org.junit.runners.model.Statement; import org.sonar.batch.protocol.output.BatchReport; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.ComponentImpl; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; public class ComponentTreeRule implements TestRule { @@ -95,8 +95,8 @@ public class ComponentTreeRule implements TestRule { return newComponent(batchReportReader.readComponent(rootComponentRef), build_options); } - private DumbComponent newComponent(BatchReport.Component component, BUILD_OPTIONS build_options) { - return DumbComponent.builder(ComponentImpl.convertType(component.getType()), component.getRef()) + private ReportComponent newComponent(BatchReport.Component component, BUILD_OPTIONS build_options) { + return ReportComponent.builder(ComponentImpl.convertType(component.getType()), component.getRef()) .setUuid(build_options.uuid ? uuidOf(component.getRef()) : null) .setKey(build_options.key ? keyOf(component.getRef()) : null) .addChildren(buildChildren(component, build_options)) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/DbIdsRepositoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/DbIdsRepositoryTest.java index f9627f04dbb..3e63f53454a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/DbIdsRepositoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/DbIdsRepositoryTest.java @@ -31,7 +31,7 @@ public class DbIdsRepositoryTest { @Rule public ExpectedException thrown = ExpectedException.none(); - Component component = DumbComponent.DUMB_PROJECT; + Component component = ReportComponent.DUMB_PROJECT; @Test public void add_and_get_component_id() { @@ -46,7 +46,7 @@ public class DbIdsRepositoryTest { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Component ref '" + component.getReportAttributes().getRef() + "' has no component id"); - new DbIdsRepository().getComponentId(DumbComponent.DUMB_PROJECT); + new DbIdsRepository().getComponentId(ReportComponent.DUMB_PROJECT); } @Test @@ -72,7 +72,7 @@ public class DbIdsRepositoryTest { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Component ref '" + component.getReportAttributes().getRef() + "' has no snapshot id"); - new DbIdsRepository().getSnapshotId(DumbComponent.DUMB_PROJECT); + new DbIdsRepository().getSnapshotId(ReportComponent.DUMB_PROJECT); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareCrawlerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareCrawlerTest.java index c284c6dedfa..de62b94bb85 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareCrawlerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareCrawlerTest.java @@ -44,29 +44,29 @@ import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ public class PathAwareCrawlerTest { private static final int ROOT_REF = 1; - private static final DumbComponent SOME_TREE_ROOT = DumbComponent.builder(PROJECT, ROOT_REF) + private static final ReportComponent SOME_TREE_ROOT = ReportComponent.builder(PROJECT, ROOT_REF) .addChildren( - DumbComponent.builder(MODULE, 11) + ReportComponent.builder(MODULE, 11) .addChildren( - DumbComponent.builder(DIRECTORY, 111) + ReportComponent.builder(DIRECTORY, 111) .addChildren( - DumbComponent.builder(FILE, 1111).build(), - DumbComponent.builder(FILE, 1112).build() + ReportComponent.builder(FILE, 1111).build(), + ReportComponent.builder(FILE, 1112).build() ) .build(), - DumbComponent.builder(DIRECTORY, 112) + ReportComponent.builder(DIRECTORY, 112) .addChildren( - DumbComponent.builder(FILE, 1121).build() + ReportComponent.builder(FILE, 1121).build() ) .build()) .build(), - DumbComponent.builder(MODULE, 12) + ReportComponent.builder(MODULE, 12) .addChildren( - DumbComponent.builder(MODULE, 121) + ReportComponent.builder(MODULE, 121) .addChildren( - DumbComponent.builder(DIRECTORY, 1211) + ReportComponent.builder(DIRECTORY, 1211) .addChildren( - DumbComponent.builder(FILE, 12111).build() + ReportComponent.builder(FILE, 12111).build() ) .build() ).build() diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareCrawlerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareCrawlerTest.java index a6e8cb98f22..63717089709 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareCrawlerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareCrawlerTest.java @@ -296,7 +296,7 @@ public class PostOrderDepthTraversalTypeAwareCrawlerTest { } private static Component component(final Component.Type type, final int ref, final Component... children) { - return DumbComponent.builder(type, ref).addChildren(children).build(); + return ReportComponent.builder(type, ref).addChildren(children).build(); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareCrawlerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareCrawlerTest.java index d3d858c7734..057b54092af 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareCrawlerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareCrawlerTest.java @@ -291,7 +291,7 @@ public class PreOrderDepthTraversalTypeAwareCrawlerTest { } private static Component component(final Component.Type type, final int ref, final Component... children) { - return DumbComponent.builder(type, ref).addChildren(children).build(); + return ReportComponent.builder(type, ref).addChildren(children).build(); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/DumbComponent.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/ReportComponent.java index c390e5ccec8..11108f119b7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/DumbComponent.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/ReportComponent.java @@ -24,14 +24,14 @@ import java.util.ArrayList; import java.util.List; import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static java.util.Arrays.asList; -import static java.util.Objects.requireNonNull; /** - * Implementation of {@link Component} for unit tests. + * Implementation of {@link Component} to unit test report components. */ -public class DumbComponent implements Component { +public class ReportComponent implements Component { private static final FileAttributes DEFAULT_FILE_ATTRIBUTES = new FileAttributes(false, null); @@ -45,7 +45,7 @@ public class DumbComponent implements Component { private final FileAttributes fileAttributes; private final List<Component> children; - private DumbComponent(Builder builder) { + private ReportComponent(Builder builder) { this.type = builder.type; this.key = builder.key; this.name = builder.name == null ? String.valueOf(builder.key) : builder.name; @@ -105,7 +105,7 @@ public class DumbComponent implements Component { if (o == null || getClass() != o.getClass()) { return false; } - DumbComponent that = (DumbComponent) o; + ReportComponent that = (ReportComponent) o; return reportAttributes.getRef() == that.reportAttributes.getRef(); } @@ -116,7 +116,7 @@ public class DumbComponent implements Component { @Override public String toString() { - return "DumbComponent{" + + return "ReportComponent{" + "ref=" + this.reportAttributes.getRef() + ", key='" + key + '\'' + ", type=" + type + @@ -138,7 +138,7 @@ public class DumbComponent implements Component { private final List<Component> children = new ArrayList<>(); private Builder(Type type, int ref) { - requireNonNull(type, "Component type must not be null"); + checkArgument(type.isReportType(), "Component type must not be a report type"); this.type = type; this.ref = ref; } @@ -170,12 +170,15 @@ public class DumbComponent implements Component { } public Builder addChildren(Component... c) { + for (Component component : c) { + checkArgument(component.getType().isReportType()); + } this.children.addAll(asList(c)); return this; } - public DumbComponent build() { - return new DumbComponent(this); + public ReportComponent build() { + return new ReportComponent(this); } } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/TreeRootHolderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/TreeRootHolderImplTest.java index 1bf393f9451..53e21a444dd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/TreeRootHolderImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/TreeRootHolderImplTest.java @@ -31,7 +31,7 @@ public class TreeRootHolderImplTest { public ExpectedException thrown = ExpectedException.none(); TreeRootHolderImpl treeRootHolder = new TreeRootHolderImpl(); - Component project = DumbComponent.DUMB_PROJECT; + Component project = ReportComponent.DUMB_PROJECT; @Test public void setRoot_throws_NPE_if_arg_is_null() { @@ -53,10 +53,10 @@ public class TreeRootHolderImplTest { @Test public void get_by_ref() { - Component file = DumbComponent.builder(Component.Type.FILE, 4).build(); - Component directory = DumbComponent.builder(Component.Type.DIRECTORY, 3).addChildren(file).build(); - Component module = DumbComponent.builder(Component.Type.MODULE, 2).addChildren(directory).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).addChildren(module).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 4).build(); + Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 3).addChildren(file).build(); + Component module = ReportComponent.builder(Component.Type.MODULE, 2).addChildren(directory).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).addChildren(module).build(); treeRootHolder.setRoot(project); assertThat(treeRootHolder.getComponentByRef(1)).isEqualTo(project); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerTest.java index 5e1624981d8..0bb4d2ea8c1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerTest.java @@ -123,7 +123,7 @@ public class VisitorsCrawlerTest { } private static Component component(final Component.Type type, final int ref, final Component... children) { - return DumbComponent.builder(type, ref).addChildren(children).build(); + return ReportComponent.builder(type, ref).addChildren(children).build(); } private static class TestTypeAwareVisitor extends TypeAwareVisitorAdapter { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPathAwareVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPathAwareVisitorTest.java index 5b0b9950bb1..6308555df0d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPathAwareVisitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPathAwareVisitorTest.java @@ -46,29 +46,29 @@ import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ public class VisitorsCrawlerWithPathAwareVisitorTest { private static final int ROOT_REF = 1; - private static final DumbComponent SOME_TREE_ROOT = DumbComponent.builder(PROJECT, ROOT_REF) + private static final ReportComponent SOME_TREE_ROOT = ReportComponent.builder(PROJECT, ROOT_REF) .addChildren( - DumbComponent.builder(MODULE, 11) + ReportComponent.builder(MODULE, 11) .addChildren( - DumbComponent.builder(DIRECTORY, 111) + ReportComponent.builder(DIRECTORY, 111) .addChildren( - DumbComponent.builder(FILE, 1111).build(), - DumbComponent.builder(FILE, 1112).build() + ReportComponent.builder(FILE, 1111).build(), + ReportComponent.builder(FILE, 1112).build() ) .build(), - DumbComponent.builder(DIRECTORY, 112) + ReportComponent.builder(DIRECTORY, 112) .addChildren( - DumbComponent.builder(FILE, 1121).build() + ReportComponent.builder(FILE, 1121).build() ) .build()) .build(), - DumbComponent.builder(MODULE, 12) + ReportComponent.builder(MODULE, 12) .addChildren( - DumbComponent.builder(MODULE, 121) + ReportComponent.builder(MODULE, 121) .addChildren( - DumbComponent.builder(DIRECTORY, 1211) + ReportComponent.builder(DIRECTORY, 1211) .addChildren( - DumbComponent.builder(FILE, 12111).build() + ReportComponent.builder(FILE, 12111).build() ) .build() ).build() diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPostOrderTypeAwareVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPostOrderTypeAwareVisitorTest.java index 1044f4754db..173848f8f90 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPostOrderTypeAwareVisitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPostOrderTypeAwareVisitorTest.java @@ -293,7 +293,7 @@ public class VisitorsCrawlerWithPostOrderTypeAwareVisitorTest { } private static Component component(final Component.Type type, final int ref, final Component... children) { - return DumbComponent.builder(type, ref).addChildren(children).build(); + return ReportComponent.builder(type, ref).addChildren(children).build(); } private static VisitorsCrawler newVisitorsCrawler(ComponentVisitor componentVisitor) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPreOrderTypeAwareVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPreOrderTypeAwareVisitorTest.java index 43b606ed194..5e3bbd6e733 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPreOrderTypeAwareVisitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/VisitorsCrawlerWithPreOrderTypeAwareVisitorTest.java @@ -286,7 +286,7 @@ public class VisitorsCrawlerWithPreOrderTypeAwareVisitorTest { } private static Component component(final Component.Type type, final int ref, final Component... children) { - return DumbComponent.builder(type, ref).addChildren(children).build(); + return ReportComponent.builder(type, ref).addChildren(children).build(); } private static VisitorsCrawler newVisitorsCrawler(ComponentVisitor componentVisitor) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/event/EventRepositoryImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/event/EventRepositoryImplTest.java index bc3f7aac34c..84708957c93 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/event/EventRepositoryImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/event/EventRepositoryImplTest.java @@ -21,7 +21,7 @@ package org.sonar.server.computation.event; import org.junit.Test; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import static org.assertj.core.api.Assertions.assertThat; @@ -66,6 +66,6 @@ public class EventRepositoryImplTest { } private static Component newComponent(int i) { - return DumbComponent.builder(Component.Type.FILE, i).build(); + return ReportComponent.builder(Component.Type.FILE, i).build(); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java index 4d3435f4fb3..2132beb98a6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.sonar.api.measures.CoreMetrics; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.metric.MetricRepositoryRule; import org.sonar.server.computation.period.PeriodsHolderRule; @@ -40,7 +40,7 @@ import static org.sonar.api.measures.CoreMetrics.FUNCTION_COMPLEXITY_KEY; import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; @@ -74,7 +74,7 @@ public class AverageFormulaExecutionTest { @Test public void add_measures() { - DumbComponent project = builder(PROJECT, 1) + ReportComponent project = builder(PROJECT, 1) .addChildren( builder(MODULE, 11) .addChildren( @@ -118,7 +118,7 @@ public class AverageFormulaExecutionTest { @Test public void not_add_measures_when_no_data_on_file() { - DumbComponent project = builder(PROJECT, 1) + ReportComponent project = builder(PROJECT, 1) .addChildren( builder(MODULE, 11) .addChildren( diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaTest.java index 4df0a9a1017..319a796f2bd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.measures.CoreMetrics; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.metric.Metric; import org.sonar.server.computation.period.PeriodsHolder; @@ -52,7 +52,7 @@ public class AverageFormulaTest { FileAggregateContext fileAggregateContext = mock(FileAggregateContext.class); CreateMeasureContext createMeasureContext = new DumbCreateMeasureContext( - DumbComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class)); + ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class)); @Rule public ExpectedException thrown = ExpectedException.none(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java index cf3d6d73760..8f6990451d7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.sonar.api.measures.CoreMetrics; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.metric.MetricRepositoryRule; @@ -37,7 +37,7 @@ import static org.sonar.api.measures.CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTIO import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; @@ -61,7 +61,7 @@ public class DistributionFormulaExecutionTest { @Test public void add_measures() { - DumbComponent project = builder(PROJECT, 1) + ReportComponent project = builder(PROJECT, 1) .addChildren( builder(MODULE, 11) .addChildren( @@ -100,7 +100,7 @@ public class DistributionFormulaExecutionTest { @Test public void not_add_measures_when_no_data_on_file() { - DumbComponent project = builder(PROJECT, 1) + ReportComponent project = builder(PROJECT, 1) .addChildren( builder(MODULE, 11) .addChildren( diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaTest.java index a653cb529be..7f4b623e485 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaTest.java @@ -26,7 +26,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.metric.Metric; import org.sonar.server.computation.period.PeriodsHolder; @@ -45,9 +45,9 @@ public class DistributionFormulaTest { FileAggregateContext fileAggregateContext = mock(FileAggregateContext.class); CreateMeasureContext projectCreateMeasureContext = new DumbCreateMeasureContext( - DumbComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class)); + ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class)); CreateMeasureContext fileCreateMeasureContext = new DumbCreateMeasureContext( - DumbComponent.builder(Component.Type.FILE, 1).build(), mock(Metric.class), mock(PeriodsHolder.class)); + ReportComponent.builder(Component.Type.FILE, 1).build(), mock(Metric.class), mock(PeriodsHolder.class)); @Test public void check_new_counter_class() { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawlerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawlerTest.java index e9bf9a7cc83..1d998bba9b0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawlerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawlerTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.sonar.api.measures.CoreMetrics; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.formula.counter.IntVariationValue; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; @@ -46,25 +46,25 @@ import static org.sonar.api.measures.CoreMetrics.NEW_LINES_TO_COVER_KEY; import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; public class FormulaExecutorComponentCrawlerTest { - public static final DumbComponent BALANCED_COMPONENT_TREE = DumbComponent.builder(PROJECT, 1) + public static final ReportComponent BALANCED_COMPONENT_TREE = ReportComponent.builder(PROJECT, 1) .addChildren( - DumbComponent.builder(MODULE, 11) + ReportComponent.builder(MODULE, 11) .addChildren( - DumbComponent.builder(DIRECTORY, 111) + ReportComponent.builder(DIRECTORY, 111) .addChildren( builder(Component.Type.FILE, 1111).build(), builder(Component.Type.FILE, 1112).build() ).build() ).build(), - DumbComponent.builder(MODULE, 12) + ReportComponent.builder(MODULE, 12) .addChildren( - DumbComponent.builder(DIRECTORY, 121) + ReportComponent.builder(DIRECTORY, 121) .addChildren( builder(Component.Type.FILE, 1211).build() ).build() @@ -174,11 +174,11 @@ public class FormulaExecutorComponentCrawlerTest { @Test public void add_no_measure() throws Exception { - DumbComponent project = DumbComponent.builder(PROJECT, 1) + ReportComponent project = ReportComponent.builder(PROJECT, 1) .addChildren( - DumbComponent.builder(MODULE, 11) + ReportComponent.builder(MODULE, 11) .addChildren( - DumbComponent.builder(DIRECTORY, 111) + ReportComponent.builder(DIRECTORY, 111) .addChildren( builder(Component.Type.FILE, 1111).build() ).build() @@ -196,11 +196,11 @@ public class FormulaExecutorComponentCrawlerTest { @Test public void add_no_measure_when_no_file() throws Exception { - DumbComponent project = DumbComponent.builder(PROJECT, 1) + ReportComponent project = ReportComponent.builder(PROJECT, 1) .addChildren( - DumbComponent.builder(MODULE, 11) + ReportComponent.builder(MODULE, 11) .addChildren( - DumbComponent.builder(DIRECTORY, 111).build() + ReportComponent.builder(DIRECTORY, 111).build() ).build() ).build(); treeRootHolder.setRoot(project); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java index 5dd73ba9690..1370ddd7d0a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.sonar.api.measures.CoreMetrics; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.metric.MetricRepositoryRule; @@ -37,7 +37,7 @@ import static org.sonar.api.measures.CoreMetrics.LINES_KEY; import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; @@ -61,7 +61,7 @@ public class SumFormulaExecutionTest { @Test public void add_measures() { - DumbComponent project = builder(PROJECT, 1) + ReportComponent project = builder(PROJECT, 1) .addChildren( builder(MODULE, 11) .addChildren( @@ -100,7 +100,7 @@ public class SumFormulaExecutionTest { @Test public void not_add_measures_when_no_data_on_file() { - DumbComponent project = builder(PROJECT, 1) + ReportComponent project = builder(PROJECT, 1) .addChildren( builder(MODULE, 11) .addChildren( diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaTest.java index 41e4d9f4b8f..c9a7fe67c1f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaTest.java @@ -26,7 +26,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.metric.Metric; import org.sonar.server.computation.period.PeriodsHolder; @@ -45,9 +45,9 @@ public class SumFormulaTest { FileAggregateContext fileAggregateContext = mock(FileAggregateContext.class); CreateMeasureContext projectCreateMeasureContext = new DumbCreateMeasureContext( - DumbComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class)); + ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class)); CreateMeasureContext fileCreateMeasureContext = new DumbCreateMeasureContext( - DumbComponent.builder(Component.Type.FILE, 2).build(), mock(Metric.class), mock(PeriodsHolder.class)); + ReportComponent.builder(Component.Type.FILE, 2).build(), mock(Metric.class), mock(PeriodsHolder.class)); @Test public void check_create_new_counter_class() { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/DebtAggregatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/DebtAggregatorTest.java index 8769a2b635b..1ae9cb199a6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/DebtAggregatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/DebtAggregatorTest.java @@ -26,7 +26,7 @@ import org.sonar.api.measures.CoreMetrics; import org.sonar.api.utils.Duration; import org.sonar.core.issue.DefaultIssue; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.debt.Characteristic; import org.sonar.server.computation.debt.DebtModelHolderImpl; import org.sonar.server.computation.debt.MutableDebtModelHolder; @@ -61,8 +61,8 @@ public class DebtAggregatorTest { */ public static final int RELIABILITY_ID = 1003; - Component file = DumbComponent.builder(Component.Type.FILE, 1).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 2).addChildren(file).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 1).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 2).addChildren(file).build(); DumbRule rule = new DumbRule(RuleTesting.XOO_X1).setId(100).setSubCharacteristicId(PORTABILITY_SOFT_ID); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java index 0a7d0f59170..8d1f6e3990e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java @@ -28,7 +28,7 @@ import org.sonar.api.config.Settings; import org.sonar.batch.protocol.output.BatchReport; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.es.EsTester; import org.sonar.server.source.index.SourceLineDoc; import org.sonar.server.source.index.SourceLineIndex; @@ -45,7 +45,7 @@ public class IssueAssignerTest { public BatchReportReaderRule reportReader = new BatchReportReaderRule(); ScmAccountToUser scmAccountToUser = mock(ScmAccountToUser.class); DefaultAssignee defaultAssignee = mock(DefaultAssignee.class); - Component file = DumbComponent.builder(Component.Type.FILE, 1).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 1).build(); IssueAssigner underTest; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueCounterTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueCounterTest.java index 44dda105ea1..71fe454d848 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueCounterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueCounterTest.java @@ -64,7 +64,7 @@ import static org.sonar.api.measures.CoreMetrics.VIOLATIONS_KEY; import static org.sonar.api.rule.Severity.BLOCKER; import static org.sonar.api.rule.Severity.CRITICAL; import static org.sonar.api.rule.Severity.MAJOR; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.metric.Metric.MetricType.INT; public class IssueCounterTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/NewDebtAggregatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/NewDebtAggregatorTest.java index c4114df32d3..ee3910f3255 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/NewDebtAggregatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/NewDebtAggregatorTest.java @@ -27,7 +27,7 @@ import org.sonar.api.utils.Duration; import org.sonar.core.issue.DefaultIssue; import org.sonar.db.DbClient; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.metric.MetricRepositoryRule; @@ -48,7 +48,7 @@ public class NewDebtAggregatorTest { private static final Period PERIOD = new Period(1, TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, null, 1_500_000_000L, 1000L); - Component file = DumbComponent.builder(Component.Type.FILE, 1).setUuid("FILE").build(); + Component file = ReportComponent.builder(Component.Type.FILE, 1).setUuid("FILE").build(); NewDebtCalculator calculator = mock(NewDebtCalculator.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/TrackerRawInputFactoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/TrackerRawInputFactoryTest.java index b54f45048b4..47a989b3425 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/TrackerRawInputFactoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/TrackerRawInputFactoryTest.java @@ -33,7 +33,7 @@ import org.sonar.core.issue.tracking.Input; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.issue.commonrule.CommonRuleEngine; import org.sonar.server.rule.CommonRuleKeys; @@ -44,8 +44,8 @@ import static org.mockito.Mockito.when; public class TrackerRawInputFactoryTest { - static DumbComponent PROJECT = DumbComponent.builder(Component.Type.PROJECT, 1).setKey("PROJECT_KEY_2").setUuid("PROJECT_UUID_1").build(); - static DumbComponent FILE = DumbComponent.builder(Component.Type.FILE, 2).setKey("FILE_KEY_2").setUuid("FILE_UUID_2").build(); + static ReportComponent PROJECT = ReportComponent.builder(Component.Type.PROJECT, 1).setKey("PROJECT_KEY_2").setUuid("PROJECT_UUID_1").build(); + static ReportComponent FILE = ReportComponent.builder(Component.Type.FILE, 2).setKey("FILE_KEY_2").setUuid("FILE_UUID_2").build(); @Rule public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule().setRoot(PROJECT); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CommentDensityRuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CommentDensityRuleTest.java index ae74ffa6867..ac9c83e0451 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CommentDensityRuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CommentDensityRuleTest.java @@ -29,7 +29,7 @@ import org.sonar.api.rule.Severity; import org.sonar.core.issue.DefaultIssue; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; @@ -39,13 +39,13 @@ import org.sonar.server.computation.qualityprofile.ActiveRulesHolderRule; import org.sonar.server.rule.CommonRuleKeys; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.server.computation.component.DumbComponent.DUMB_PROJECT; +import static org.sonar.server.computation.component.ReportComponent.DUMB_PROJECT; public class CommentDensityRuleTest { static RuleKey RULE_KEY = RuleKey.of(CommonRuleKeys.commonRepositoryForLang("java"), CommonRuleKeys.INSUFFICIENT_COMMENT_DENSITY); - static DumbComponent FILE = DumbComponent.builder(Component.Type.FILE, 1) + static ReportComponent FILE = ReportComponent.builder(Component.Type.FILE, 1) .setFileAttributes(new FileAttributes(false, "java")) .build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CommonRuleEngineImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CommonRuleEngineImplTest.java index 5eef07383c7..c03e57a92b0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CommonRuleEngineImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CommonRuleEngineImplTest.java @@ -23,14 +23,14 @@ import java.util.Collection; import org.junit.Test; import org.sonar.core.issue.DefaultIssue; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -import static org.sonar.server.computation.component.DumbComponent.DUMB_PROJECT; +import static org.sonar.server.computation.component.ReportComponent.DUMB_PROJECT; public class CommonRuleEngineImplTest { @@ -40,7 +40,7 @@ public class CommonRuleEngineImplTest { @Test public void process_files_with_known_language() throws Exception { - DumbComponent file = DumbComponent.builder(Component.Type.FILE, 1) + ReportComponent file = ReportComponent.builder(Component.Type.FILE, 1) .setKey("FILE_KEY").setUuid("FILE_UUID") .setFileAttributes(new FileAttributes(false, "java")) .build(); @@ -54,7 +54,7 @@ public class CommonRuleEngineImplTest { @Test public void do_not_process_files_with_unknown_language() throws Exception { - DumbComponent file = DumbComponent.builder(Component.Type.FILE, 1) + ReportComponent file = ReportComponent.builder(Component.Type.FILE, 1) .setKey("FILE_KEY").setUuid("FILE_UUID") .setFileAttributes(new FileAttributes(false, null)) .build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CoverageRuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CoverageRuleTest.java index c20848fd731..68d6c59e9db 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CoverageRuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/CoverageRuleTest.java @@ -29,7 +29,7 @@ import org.sonar.api.rule.Severity; import org.sonar.core.issue.DefaultIssue; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; @@ -38,11 +38,11 @@ import org.sonar.server.computation.qualityprofile.ActiveRule; import org.sonar.server.computation.qualityprofile.ActiveRulesHolderRule; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.server.computation.component.DumbComponent.DUMB_PROJECT; +import static org.sonar.server.computation.component.ReportComponent.DUMB_PROJECT; public abstract class CoverageRuleTest { - static DumbComponent FILE = DumbComponent.builder(Component.Type.FILE, 1) + static ReportComponent FILE = ReportComponent.builder(Component.Type.FILE, 1) .setFileAttributes(new FileAttributes(false, "java")) .build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/DuplicatedBlockRuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/DuplicatedBlockRuleTest.java index 6bbe64ef1ed..f61fccac141 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/DuplicatedBlockRuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/DuplicatedBlockRuleTest.java @@ -28,7 +28,7 @@ import org.sonar.api.rule.Severity; import org.sonar.core.issue.DefaultIssue; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; @@ -38,13 +38,13 @@ import org.sonar.server.computation.qualityprofile.ActiveRulesHolderRule; import org.sonar.server.rule.CommonRuleKeys; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.server.computation.component.DumbComponent.DUMB_PROJECT; +import static org.sonar.server.computation.component.ReportComponent.DUMB_PROJECT; public class DuplicatedBlockRuleTest { static RuleKey RULE_KEY = RuleKey.of(CommonRuleKeys.commonRepositoryForLang("java"), CommonRuleKeys.DUPLICATED_BLOCKS); - static DumbComponent FILE = DumbComponent.builder(Component.Type.FILE, 1) + static ReportComponent FILE = ReportComponent.builder(Component.Type.FILE, 1) .setFileAttributes(new FileAttributes(false, "java")) .build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/SkippedTestRuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/SkippedTestRuleTest.java index 9a4c3d8a083..595e207d8e3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/SkippedTestRuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/SkippedTestRuleTest.java @@ -28,7 +28,7 @@ import org.sonar.api.rule.Severity; import org.sonar.core.issue.DefaultIssue; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; @@ -38,13 +38,13 @@ import org.sonar.server.computation.qualityprofile.ActiveRulesHolderRule; import org.sonar.server.rule.CommonRuleKeys; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.server.computation.component.DumbComponent.DUMB_PROJECT; +import static org.sonar.server.computation.component.ReportComponent.DUMB_PROJECT; public class SkippedTestRuleTest { static RuleKey RULE_KEY = RuleKey.of(CommonRuleKeys.commonRepositoryForLang("java"), CommonRuleKeys.SKIPPED_UNIT_TESTS); - static DumbComponent FILE = DumbComponent.builder(Component.Type.FILE, 1) + static ReportComponent FILE = ReportComponent.builder(Component.Type.FILE, 1) .setFileAttributes(new FileAttributes(true, "java")) .setName("FooTest.java") .build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/TestErrorRuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/TestErrorRuleTest.java index 826439a0ad0..d3467ae57a4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/TestErrorRuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/commonrule/TestErrorRuleTest.java @@ -28,7 +28,7 @@ import org.sonar.api.rule.Severity; import org.sonar.core.issue.DefaultIssue; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; @@ -38,13 +38,13 @@ import org.sonar.server.computation.qualityprofile.ActiveRulesHolderRule; import org.sonar.server.rule.CommonRuleKeys; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.server.computation.component.DumbComponent.DUMB_PROJECT; +import static org.sonar.server.computation.component.ReportComponent.DUMB_PROJECT; public class TestErrorRuleTest { static RuleKey RULE_KEY = RuleKey.of(CommonRuleKeys.commonRepositoryForLang("java"), CommonRuleKeys.FAILED_UNIT_TESTS); - static DumbComponent FILE = DumbComponent.builder(Component.Type.FILE, 1) + static ReportComponent FILE = ReportComponent.builder(Component.Type.FILE, 1) .setFileAttributes(new FileAttributes(true, "java")) .setName("FooTest.java") .build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/BestValueOptimizationTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/BestValueOptimizationTest.java index 389a9387201..90491dd2cc0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/BestValueOptimizationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/BestValueOptimizationTest.java @@ -22,7 +22,7 @@ package org.sonar.server.computation.measure; import com.google.common.base.Predicate; import org.junit.Test; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.metric.Metric; import org.sonar.server.computation.metric.MetricImpl; @@ -31,8 +31,8 @@ import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; public class BestValueOptimizationTest { - private static final DumbComponent FILE_COMPONENT = DumbComponent.builder(Component.Type.FILE, 1).build(); - private static final DumbComponent SOME_NON_FILE_COMPONENT = DumbComponent.builder(Component.Type.MODULE, 2).build(); + private static final ReportComponent FILE_COMPONENT = ReportComponent.builder(Component.Type.FILE, 1).build(); + private static final ReportComponent SOME_NON_FILE_COMPONENT = ReportComponent.builder(Component.Type.MODULE, 2).build(); private static final String SOME_DATA = "some_data"; private static final MetricImpl METRIC_BOOLEAN_FALSE = createMetric(Metric.MetricType.BOOL, 6d); private static final MetricImpl METRIC_BOOLEAN_TRUE = createMetric(Metric.MetricType.BOOL, 1d); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureComputersVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureComputersVisitorTest.java index cb4c8ea6f1d..c43e70139ec 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureComputersVisitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureComputersVisitorTest.java @@ -41,7 +41,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryImplTest.java index 44f428e5557..3adc378da7f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryImplTest.java @@ -46,7 +46,7 @@ import org.sonar.db.rule.RuleDto; import org.sonar.server.computation.batch.BatchReportReader; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.debt.Characteristic; import org.sonar.server.computation.metric.Metric; import org.sonar.server.computation.metric.MetricImpl; @@ -71,8 +71,8 @@ public class MeasureRepositoryImplTest { public BatchReportReaderRule reportReader = new BatchReportReaderRule(); private static final String FILE_COMPONENT_KEY = "file cpt key"; - private static final DumbComponent FILE_COMPONENT = DumbComponent.builder(Component.Type.FILE, 1).setKey(FILE_COMPONENT_KEY).build(); - private static final DumbComponent OTHER_COMPONENT = DumbComponent.builder(Component.Type.FILE, 2).setKey("some other key").build(); + private static final ReportComponent FILE_COMPONENT = ReportComponent.builder(Component.Type.FILE, 1).setKey(FILE_COMPONENT_KEY).build(); + private static final ReportComponent OTHER_COMPONENT = ReportComponent.builder(Component.Type.FILE, 2).setKey("some other key").build(); private static final String METRIC_KEY_1 = "metric 1"; private static final int METRIC_ID_1 = 1; private static final String METRIC_KEY_2 = "metric 2"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/MeasureComputerImplementationContextTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/MeasureComputerImplementationContextTest.java index de1e872c1cf..161d6c7673e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/MeasureComputerImplementationContextTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/MeasureComputerImplementationContextTest.java @@ -44,7 +44,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES_KEY; import static org.sonar.api.measures.CoreMetrics.NCLOC_KEY; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; public class MeasureComputerImplementationContextTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/sqale/SqaleMeasuresVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/sqale/SqaleMeasuresVisitorTest.java index 3227782a9e1..52a6cfa3d3e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/sqale/SqaleMeasuresVisitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/sqale/SqaleMeasuresVisitorTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.sonar.api.measures.CoreMetrics; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.ComponentVisitor; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.server.computation.component.VisitorsCrawler; import org.sonar.server.computation.measure.Measure; @@ -96,7 +96,7 @@ public class SqaleMeasuresVisitorTest { @Test public void measures_created_for_project_are_all_zero_when_they_have_no_FILE_child() { - DumbComponent root = DumbComponent.builder(PROJECT, 1).build(); + ReportComponent root = ReportComponent.builder(PROJECT, 1).build(); treeRootHolder.setRoot(root); underTest.visit(root); @@ -130,7 +130,7 @@ public class SqaleMeasuresVisitorTest { SqaleRatingGrid.SqaleRating expectedRating) { long measureValue = 10; - DumbComponent fileComponent = createFileComponent(languageKey, 1); + ReportComponent fileComponent = createFileComponent(languageKey, 1); treeRootHolder.setRoot(fileComponent); measureRepository.addRawMeasure(fileComponent.getReportAttributes().getRef(), metricKey, newMeasureBuilder().create(measureValue)); measureRepository.addRawMeasure(fileComponent.getReportAttributes().getRef(), TECHNICAL_DEBT_KEY, newMeasureBuilder().create(debt)); @@ -142,29 +142,29 @@ public class SqaleMeasuresVisitorTest { @Test public void verify_aggregation_of_developmentCost_and_value_of_measures_computed_from_that() { - DumbComponent root = DumbComponent.builder(PROJECT, 1) + ReportComponent root = ReportComponent.builder(PROJECT, 1) .addChildren( - DumbComponent.builder(MODULE, 11) + ReportComponent.builder(MODULE, 11) .addChildren( - DumbComponent.builder(DIRECTORY, 111) + ReportComponent.builder(DIRECTORY, 111) .addChildren( createFileComponent(LANGUAGE_KEY_1, 1111), createFileComponent(LANGUAGE_KEY_2, 1112) ).build(), - DumbComponent.builder(DIRECTORY, 112) + ReportComponent.builder(DIRECTORY, 112) .addChildren( createFileComponent(LANGUAGE_KEY_2, 1121) ).build() ).build(), - DumbComponent.builder(MODULE, 12) + ReportComponent.builder(MODULE, 12) .addChildren( - DumbComponent.builder(DIRECTORY, 121) + ReportComponent.builder(DIRECTORY, 121) .addChildren( createFileComponent(LANGUAGE_KEY_1, 1211) ).build(), - DumbComponent.builder(DIRECTORY, 122).build() + ReportComponent.builder(DIRECTORY, 122).build() ).build(), - DumbComponent.builder(MODULE, 13).build() + ReportComponent.builder(MODULE, 13).build() ).build(); treeRootHolder.setRoot(root); @@ -229,8 +229,8 @@ public class SqaleMeasuresVisitorTest { verifyComponentMeasures(1, devCost1, debt1 / (double) devCost1, A); } - private DumbComponent createFileComponent(String languageKey1, int fileRef) { - return DumbComponent.builder(FILE, fileRef).setFileAttributes(new FileAttributes(false, languageKey1)).build(); + private ReportComponent createFileComponent(String languageKey1, int fileRef) { + return ReportComponent.builder(FILE, fileRef).setFileAttributes(new FileAttributes(false, languageKey1)).build(); } private void verifyNoMeasure(int componentRef) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ApplyPermissionsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ApplyPermissionsStepTest.java index bc316ed4688..90dec13849f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ApplyPermissionsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ApplyPermissionsStepTest.java @@ -43,7 +43,7 @@ import org.sonar.db.component.ComponentTesting; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.es.EsTester; import org.sonar.server.issue.index.IssueAuthorizationIndexer; import org.sonar.server.issue.index.IssueIndexDefinition; @@ -110,7 +110,7 @@ public class ApplyPermissionsStepTest extends BaseStepTest { dbClient.permissionTemplateDao().insertGroupPermission(permissionTemplateDto.getId(), null, UserRole.USER); dbSession.commit(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build(); dbIdsRepository.setComponentId(project, projectDto.getId()); treeRootHolder.setRoot(project); @@ -138,7 +138,7 @@ public class ApplyPermissionsStepTest extends BaseStepTest { dbSession.commit(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build(); dbIdsRepository.setComponentId(project, projectDto.getId()); treeRootHolder.setRoot(project); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java index 1b056c6cada..33c60c20d09 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CommentMeasuresStepTest.java @@ -47,7 +47,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; public class CommentMeasuresStepTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComplexityMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComplexityMeasuresStepTest.java index fc22ae201da..449a7a23ec2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComplexityMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComplexityMeasuresStepTest.java @@ -24,7 +24,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.metric.MetricRepositoryRule; @@ -58,7 +58,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; @@ -72,7 +72,7 @@ public class ComplexityMeasuresStepTest { private static final int FILE_1_REF = 11111; private static final int FILE_2_REF = 11121; - private static final DumbComponent MULTIPLE_FILES_TREE = builder(PROJECT, ROOT_REF) + private static final ReportComponent MULTIPLE_FILES_TREE = builder(PROJECT, ROOT_REF) .addChildren( builder(MODULE, MODULE_REF) .addChildren( diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java index e6bbd85fb76..354c4e8b2ad 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputeQProfileMeasureStepTest.java @@ -30,7 +30,7 @@ import org.junit.rules.ExpectedException; import org.sonar.api.utils.MessageException; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.metric.MetricRepositoryRule; @@ -57,11 +57,11 @@ public class ComputeQProfileMeasureStepTest { private static final int MODULE_REF = 11; private static final int SUB_MODULE_REF = 111; - private static final Component MULTI_MODULE_PROJECT = DumbComponent.builder(PROJECT, PROJECT_REF).setKey(PROJECT_KEY) + private static final Component MULTI_MODULE_PROJECT = ReportComponent.builder(PROJECT, PROJECT_REF).setKey(PROJECT_KEY) .addChildren( - DumbComponent.builder(MODULE, MODULE_REF) + ReportComponent.builder(MODULE, MODULE_REF) .addChildren( - DumbComponent.builder(MODULE, SUB_MODULE_REF).build() + ReportComponent.builder(MODULE, SUB_MODULE_REF).build() ) .build() ).build(); @@ -99,14 +99,14 @@ public class ComputeQProfileMeasureStepTest { @Test public void add_quality_profile_measure_from_multiple_modules() throws Exception { - DumbComponent project = DumbComponent.builder(PROJECT, PROJECT_REF) + ReportComponent project = ReportComponent.builder(PROJECT, PROJECT_REF) .addChildren( - DumbComponent.builder(MODULE, MODULE_REF) + ReportComponent.builder(MODULE, MODULE_REF) .addChildren( - DumbComponent.builder(MODULE, SUB_MODULE_REF).build() + ReportComponent.builder(MODULE, SUB_MODULE_REF).build() ) .build(), - DumbComponent.builder(MODULE, 12).build() + ReportComponent.builder(MODULE, 12).build() ).build(); treeRootHolder.setRoot(project); @@ -123,7 +123,7 @@ public class ComputeQProfileMeasureStepTest { @Test public void nothing_to_add_when_measure_already_exists_on_project() throws Exception { - DumbComponent project = DumbComponent.builder(PROJECT, PROJECT_REF).build(); + ReportComponent project = ReportComponent.builder(PROJECT, PROJECT_REF).build(); treeRootHolder.setRoot(project); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java index 7247919d832..a8d3fc9a5dd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoverageMeasuresStepTest.java @@ -29,15 +29,13 @@ import org.sonar.server.computation.formula.coverage.LinesAndConditionsWithUncov import org.sonar.server.computation.measure.MeasureRepoEntry; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.metric.MetricRepositoryRule; -import org.sonar.server.computation.period.Period; -import org.sonar.server.computation.period.PeriodsHolderRule; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CustomMeasuresCopyStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CustomMeasuresCopyStepTest.java index ccf2986b5c0..845569f6ab5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CustomMeasuresCopyStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CustomMeasuresCopyStepTest.java @@ -30,7 +30,7 @@ import org.sonar.db.DbTester; import org.sonar.db.measure.custom.CustomMeasureDto; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.MutableTreeRootHolderRule; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepository; @@ -81,9 +81,9 @@ public class CustomMeasuresCopyStepTest { when(metricRepository.getById(stringMetric.getId())).thenReturn(stringMetric); // components. File1 and project have custom measures, but not file2 - Component file1 = DumbComponent.builder(Component.Type.FILE, 1).setUuid("FILE1").build(); - Component file2 = DumbComponent.builder(Component.Type.FILE, 2).setUuid("FILE2").build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 3).setUuid("PROJECT1").addChildren(file1, file2).build(); + Component file1 = ReportComponent.builder(Component.Type.FILE, 1).setUuid("FILE1").build(); + Component file2 = ReportComponent.builder(Component.Type.FILE, 2).setUuid("FILE2").build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 3).setUuid("PROJECT1").addChildren(file1, file2).build(); treeRootHolder.setRoot(project); underTest.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java index 39ff993c65e..17f08370daf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/DuplicationMeasuresStepTest.java @@ -47,7 +47,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; public class DuplicationMeasuresStepTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ExecuteVisitorsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ExecuteVisitorsStepTest.java index f7bd96ada45..f8da0fd7857 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ExecuteVisitorsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ExecuteVisitorsStepTest.java @@ -43,7 +43,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; public class ExecuteVisitorsStepTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/FeedPeriodsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/FeedPeriodsStepTest.java index d255c5e26f5..66ba41052df 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/FeedPeriodsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/FeedPeriodsStepTest.java @@ -38,7 +38,7 @@ import org.sonar.db.DbTester; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.period.Period; import org.sonar.server.computation.period.PeriodsHolderImpl; import org.sonar.test.DbTests; @@ -83,7 +83,7 @@ public class FeedPeriodsStepTest extends BaseStepTest { .setAnalysisDate(DATE_FORMAT.parse("2008-11-30").getTime()) .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).setVersion("1.1").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).setVersion("1.1").build()); underTest = new FeedPeriodsStep(dbClient, settings, treeRootHolder, reportReader, periodsHolder); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStepTest.java index f466b1e0b65..e90819a3eb6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStepTest.java @@ -35,7 +35,7 @@ import org.sonar.db.component.ComponentTesting; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.metric.Metric; @@ -59,7 +59,7 @@ public class FillMeasuresWithVariationsStepTest { static final ComponentDto PROJECT_DTO = ComponentTesting.newProjectDto(); - static final Component PROJECT = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_DTO.uuid()).build(); + static final Component PROJECT = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_DTO.uuid()).build(); @Rule public DbTester dbTester = DbTester.create(System2.INSTANCE); @@ -116,7 +116,7 @@ public class FillMeasuresWithVariationsStepTest { @Test public void do_nothing_when_no_period() { - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_DTO.uuid()).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_DTO.uuid()).build(); treeRootHolder.setRoot(project); periodsHolder.setPeriods(); @@ -142,8 +142,8 @@ public class FillMeasuresWithVariationsStepTest { periodsHolder.setPeriods(newPeriod(1, period1ProjectSnapshot)); - Component directory = DumbComponent.builder(Component.Type.DIRECTORY, 2).setUuid(directoryDto.uuid()).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_DTO.uuid()).addChildren(directory).build(); + Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid(directoryDto.uuid()).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_DTO.uuid()).addChildren(directory).build(); treeRootHolder.setRoot(project); addRawMeasure(project, ISSUES_METRIC, Measure.newMeasureBuilder().create(80, null)); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexComponentsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexComponentsStepTest.java index 2f9e5c45d2c..a735f6c8ddf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexComponentsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexComponentsStepTest.java @@ -27,7 +27,7 @@ import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -48,7 +48,7 @@ public class IndexComponentsStepTest extends BaseStepTest { @Test public void call_indexProject_of_dao() { - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("PROJECT_UUID").setKey(PROJECT_KEY).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("PROJECT_UUID").setKey(PROJECT_KEY).build(); dbIdsRepository.setComponentId(project, 123L); treeRootHolder.setRoot(project); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexSourceLinesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexSourceLinesStepTest.java index 3cfcf70a36b..dae40433271 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexSourceLinesStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexSourceLinesStepTest.java @@ -31,7 +31,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbTester; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.es.EsTester; import org.sonar.server.source.index.FileSourceTesting; import org.sonar.server.source.index.SourceLineDoc; @@ -67,7 +67,7 @@ public class IndexSourceLinesStepTest extends BaseStepTest { FileSourceTesting.updateDataColumn(connection, "FILE1_UUID", FileSourceTesting.newRandomData(1).build()); } - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey("PROJECT_KEY").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey("PROJECT_KEY").build()); step().execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexTestsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexTestsStepTest.java index 37416a459c4..a35b0fdeaac 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexTestsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexTestsStepTest.java @@ -32,7 +32,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbTester; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.es.EsTester; import org.sonar.server.test.db.TestTesting; import org.sonar.server.test.index.TestDoc; @@ -71,7 +71,7 @@ public class IndexTestsStepTest extends BaseStepTest { dbTester.prepareDbUnit(getClass(), "index_source.xml"); TestTesting.updateDataColumn(dbTester.getSession(), "FILE1_UUID", TestTesting.newRandomTests(1)); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey("PROJECT_KEY").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey("PROJECT_KEY").build()); step().execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/LanguageDistributionMeasuresTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/LanguageDistributionMeasuresTest.java index 95205039d14..114420ddaac 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/LanguageDistributionMeasuresTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/LanguageDistributionMeasuresTest.java @@ -38,7 +38,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; public class LanguageDistributionMeasuresTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java index 4f7bd2a7807..3801da410ff 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/NewCoverageMeasuresStepTest.java @@ -28,7 +28,7 @@ import org.sonar.batch.protocol.output.BatchReport; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.server.computation.formula.coverage.LinesAndConditionsWithUncoveredMetricKeys; import org.sonar.server.computation.measure.Measure; @@ -54,7 +54,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; @@ -71,7 +71,7 @@ public class NewCoverageMeasuresStepTest { private static final int FILE_2_REF = 11121; private static final int FILE_3_REF = 11122; - private static final DumbComponent MULTIPLE_FILES_TREE = builder(PROJECT, ROOT_REF) + private static final ReportComponent MULTIPLE_FILES_TREE = builder(PROJECT, ROOT_REF) .addChildren( builder(MODULE, MODULE_REF) .addChildren( @@ -137,7 +137,7 @@ public class NewCoverageMeasuresStepTest { private NewCoverageMeasuresStep underTest = new NewCoverageMeasuresStep(treeRootHolder, periodsHolder, reportReader, measureRepository, metricRepository); - public static final DumbComponent FILE_COMPONENT = DumbComponent.builder(Component.Type.FILE, FILE_1_REF) + public static final ReportComponent FILE_COMPONENT = ReportComponent.builder(Component.Type.FILE, FILE_1_REF) .setFileAttributes(new FileAttributes(false, null)).build(); @Before @@ -149,7 +149,7 @@ public class NewCoverageMeasuresStepTest { @Test public void no_measure_for_PROJECT_component() { - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, ROOT_REF).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, ROOT_REF).build()); underTest.execute(); @@ -158,7 +158,7 @@ public class NewCoverageMeasuresStepTest { @Test public void no_measure_for_MODULE_component() { - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.MODULE, MODULE_REF).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.MODULE, MODULE_REF).build()); underTest.execute(); @@ -167,7 +167,7 @@ public class NewCoverageMeasuresStepTest { @Test public void no_measure_for_DIRECTORY_component() { - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.DIRECTORY, DIRECTORY_1_REF).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.DIRECTORY, DIRECTORY_1_REF).build()); underTest.execute(); @@ -176,7 +176,7 @@ public class NewCoverageMeasuresStepTest { @Test public void no_measure_for_unit_test_FILE_component() { - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.FILE, FILE_1_REF).setFileAttributes(new FileAttributes(true, null)).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.FILE, FILE_1_REF).setFileAttributes(new FileAttributes(true, null)).build()); underTest.execute(); @@ -185,7 +185,7 @@ public class NewCoverageMeasuresStepTest { @Test public void no_measures_for_FILE_component_without_code() { - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.FILE, FILE_1_REF).setFileAttributes(new FileAttributes(false, null)).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.FILE, FILE_1_REF).setFileAttributes(new FileAttributes(false, null)).build()); underTest.execute(); @@ -239,7 +239,7 @@ public class NewCoverageMeasuresStepTest { @Test public void no_measures_for_FILE_component_without_CoverageData() { - DumbComponent fileComponent = DumbComponent.builder(Component.Type.FILE, FILE_1_REF).setFileAttributes(new FileAttributes(false, null)).build(); + ReportComponent fileComponent = ReportComponent.builder(Component.Type.FILE, FILE_1_REF).setFileAttributes(new FileAttributes(false, null)).build(); treeRootHolder.setRoot(fileComponent); reportReader.putChangesets(Changesets.newBuilder() diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistComponentsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistComponentsStepTest.java index 07f4022b43b..a9fa787684d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistComponentsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistComponentsStepTest.java @@ -39,7 +39,7 @@ import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.test.DbTests; @@ -122,10 +122,10 @@ public class PersistComponentsStepTest extends BaseStepTest { .setLanguage("java") .build()); - Component file = DumbComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build(); - Component directory = DumbComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren(file).build(); - Component module = DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren(directory).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(module).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build(); + Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren(file).build(); + Component module = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren(directory).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(module).build(); treeRootHolder.setRoot(project); underTest.execute(); @@ -213,9 +213,9 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("pom.xml") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.DIRECTORY, 2).setUuid("CDEF").setKey(PROJECT_KEY + ":/").addChildren( - DumbComponent.builder(Component.Type.FILE, 3).setUuid("DEFG").setKey(PROJECT_KEY + ":pom.xml").build() + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid("CDEF").setKey(PROJECT_KEY + ":/").addChildren( + ReportComponent.builder(Component.Type.FILE, 3).setUuid("DEFG").setKey(PROJECT_KEY + ":pom.xml").build() ).build() ).build()); @@ -252,9 +252,9 @@ public class PersistComponentsStepTest extends BaseStepTest { .setIsTest(true) .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.DIRECTORY, 2).setUuid("CDEF").setKey(PROJECT_KEY + ":src/test/java/dir").addChildren( - DumbComponent.builder(Component.Type.FILE, 3).setUuid("DEFG").setKey(PROJECT_KEY + ":src/test/java/dir/FooTest.java").setFileAttributes(new FileAttributes(true, null)).build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid("CDEF").setKey(PROJECT_KEY + ":src/test/java/dir").addChildren( + ReportComponent.builder(Component.Type.FILE, 3).setUuid("DEFG").setKey(PROJECT_KEY + ":src/test/java/dir/FooTest.java").setFileAttributes(new FileAttributes(true, null)).build()) .build()) .build()); @@ -302,10 +302,10 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("src/main/java/dir/Foo.java") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( - DumbComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren( - DumbComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( + ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren( + ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build()) .build()) .build()) .build()); @@ -375,11 +375,11 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("src/main/java/dir") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( - DumbComponent.builder(Component.Type.MODULE, 3).setUuid("CDEF").setKey("SUB_MODULE_1_KEY").addChildren( - DumbComponent.builder(Component.Type.MODULE, 4).setUuid("DEFG").setKey("SUB_MODULE_2_KEY").addChildren( - DumbComponent.builder(Component.Type.DIRECTORY, 5).setUuid("EFGH").setKey("SUB_MODULE_2_KEY:src/main/java/dir").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( + ReportComponent.builder(Component.Type.MODULE, 3).setUuid("CDEF").setKey("SUB_MODULE_1_KEY").addChildren( + ReportComponent.builder(Component.Type.MODULE, 4).setUuid("DEFG").setKey("SUB_MODULE_2_KEY").addChildren( + ReportComponent.builder(Component.Type.DIRECTORY, 5).setUuid("EFGH").setKey("SUB_MODULE_2_KEY:src/main/java/dir").build()) .build()) .build()) .build()) @@ -440,10 +440,10 @@ public class PersistComponentsStepTest extends BaseStepTest { .setName("Module B") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_A").addChildren( - DumbComponent.builder(Component.Type.MODULE, 3).setUuid("DEFG").setKey("SUB_MODULE_A").build()).build(), - DumbComponent.builder(Component.Type.MODULE, 4).setUuid("CDEF").setKey("MODULE_B").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_A").addChildren( + ReportComponent.builder(Component.Type.MODULE, 3).setUuid("DEFG").setKey("SUB_MODULE_A").build()).build(), + ReportComponent.builder(Component.Type.MODULE, 4).setUuid("CDEF").setKey("MODULE_B").build()) .build()); underTest.execute(); @@ -508,10 +508,10 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("src/main/java/dir/Foo.java") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( - DumbComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren( - DumbComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( + ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren( + ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build()) .build()) .build()) .build()); @@ -582,8 +582,8 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("New path") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").build()) .build()); underTest.execute(); @@ -619,8 +619,8 @@ public class PersistComponentsStepTest extends BaseStepTest { .setDescription("New module description") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").build()) .build()); underTest.execute(); @@ -655,8 +655,8 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("New path") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").build()) .build()); underTest.execute(); @@ -711,11 +711,11 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("src/main/java/dir/Foo.java") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("EDCB").setKey("MODULE_A").addChildren( - DumbComponent.builder(Component.Type.MODULE, 3).setUuid("BCDE").setKey("MODULE_B").addChildren( - DumbComponent.builder(Component.Type.DIRECTORY, 4).setUuid("CDEF").setKey("MODULE_B:src/main/java/dir").addChildren( - DumbComponent.builder(Component.Type.FILE, 5).setUuid("DEFG").setKey("MODULE_B:src/main/java/dir/Foo.java").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("EDCB").setKey("MODULE_A").addChildren( + ReportComponent.builder(Component.Type.MODULE, 3).setUuid("BCDE").setKey("MODULE_B").addChildren( + ReportComponent.builder(Component.Type.DIRECTORY, 4).setUuid("CDEF").setKey("MODULE_B:src/main/java/dir").addChildren( + ReportComponent.builder(Component.Type.FILE, 5).setUuid("DEFG").setKey("MODULE_B:src/main/java/dir/Foo.java").build()) .build()) .build()) .build()) @@ -769,7 +769,7 @@ public class PersistComponentsStepTest extends BaseStepTest { .addChildRef(2) .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); underTest.execute(); @@ -815,10 +815,10 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("src/main/java/dir/Foo.java") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( - DumbComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren( - DumbComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( + ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren( + ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build()) .build()) .build()) .build()); @@ -911,10 +911,10 @@ public class PersistComponentsStepTest extends BaseStepTest { .setPath("src/main/java/dir/Foo.java") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( - DumbComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren( - DumbComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren( + ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren( + ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build()) .build()) .build()) .build()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistDuplicationsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistDuplicationsStepTest.java index f685c92f4db..7281ae69156 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistDuplicationsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistDuplicationsStepTest.java @@ -37,7 +37,7 @@ import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.test.DbTests; import static com.google.common.collect.Lists.newArrayList; @@ -123,9 +123,9 @@ public class PersistDuplicationsStepTest extends BaseStepTest { @Test public void persist_duplications_on_same_file_linked_on_a_module() { - Component file = DumbComponent.builder(Component.Type.FILE, 3).setUuid("CDEF").setKey("MODULE_KEY:file").build(); - Component module = DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren(file).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(module).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 3).setUuid("CDEF").setKey("MODULE_KEY:file").build(); + Component module = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren(file).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(module).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, 1); @@ -162,9 +162,9 @@ public class PersistDuplicationsStepTest extends BaseStepTest { @Test public void persist_duplications_on_same_file_linked_on_a_folder() { - Component file = DumbComponent.builder(Component.Type.FILE, 3).setUuid("CDEF").setKey("PROJECT_KEY:file").build(); - Component directory = DumbComponent.builder(Component.Type.DIRECTORY, 2).setUuid("BCDE").setKey("PROJECT_KEY:dir").addChildren(file).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(directory).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 3).setUuid("CDEF").setKey("PROJECT_KEY:file").build(); + Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid("BCDE").setKey("PROJECT_KEY:dir").addChildren(file).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(directory).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, 1); @@ -201,10 +201,10 @@ public class PersistDuplicationsStepTest extends BaseStepTest { @Test public void persist_duplications_on_same_file_linked_on_sub_folder() { - Component file = DumbComponent.builder(Component.Type.FILE, 10).setUuid("DEFG").setKey("PROJECT_KEY:file").build(); - Component directory1 = DumbComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("PROJECT_KEY:dir1").addChildren(file).build(); - Component directory2 = DumbComponent.builder(Component.Type.DIRECTORY, 2).setUuid("BCDE").setKey("PROJECT_KEY:dir2").addChildren(directory1).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(directory2).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 10).setUuid("DEFG").setKey("PROJECT_KEY:file").build(); + Component directory1 = ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("PROJECT_KEY:dir1").addChildren(file).build(); + Component directory2 = ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid("BCDE").setKey("PROJECT_KEY:dir2").addChildren(directory1).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(directory2).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, 1); @@ -244,9 +244,9 @@ public class PersistDuplicationsStepTest extends BaseStepTest { public void persist_duplications_on_different_files() { saveDuplicationMetric(); - Component file2 = DumbComponent.builder(Component.Type.FILE, 3).setUuid("CDEF").setKey("PROJECT_KEY:file2").build(); - Component file = DumbComponent.builder(Component.Type.FILE, 2).setUuid("BCDE").setKey("PROJECT_KEY:file").build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(file, file2).build(); + Component file2 = ReportComponent.builder(Component.Type.FILE, 3).setUuid("CDEF").setKey("PROJECT_KEY:file2").build(); + Component file = ReportComponent.builder(Component.Type.FILE, 2).setUuid("BCDE").setKey("PROJECT_KEY:file").build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(file, file2).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, 1); @@ -309,8 +309,8 @@ public class PersistDuplicationsStepTest extends BaseStepTest { } private void initReportWithProjectAndFile() { - Component file = DumbComponent.builder(Component.Type.FILE, 2).setUuid("BCDE").setKey("PROJECT_KEY:file").build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(file).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 2).setUuid("BCDE").setKey("PROJECT_KEY:file").build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(file).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, 1); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistEventsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistEventsStepTest.java index ae712278ee5..2277feb61b8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistEventsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistEventsStepTest.java @@ -33,7 +33,7 @@ import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.event.Event; import org.sonar.server.computation.event.EventRepository; import org.sonar.test.DbTests; @@ -77,7 +77,7 @@ public class PersistEventsStepTest extends BaseStepTest { public void nothing_to_do_when_no_events_in_report() { dbTester.prepareDbUnit(getClass(), "nothing_to_do_when_no_events_in_report.xml"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); reportReader.setMetadata(BatchReport.Metadata.newBuilder() .setRootComponentRef(1) @@ -93,8 +93,8 @@ public class PersistEventsStepTest extends BaseStepTest { public void persist_report_events_with_component_children() { dbTester.prepareDbUnit(getClass(), "empty.xml"); - DumbComponent module = DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").build(); - DumbComponent root = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").addChildren(module).build(); + ReportComponent module = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").build(); + ReportComponent root = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").addChildren(module).build(); treeRootHolder.setRoot(root); dbIdsRepository.setSnapshotId(root, 1000L); @@ -120,7 +120,7 @@ public class PersistEventsStepTest extends BaseStepTest { public void create_version_event() { dbTester.prepareDbUnit(getClass(), "empty.xml"); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setVersion("1.0").build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setVersion("1.0").build(); treeRootHolder.setRoot(project); dbIdsRepository.setSnapshotId(project, 1000L); @@ -138,7 +138,7 @@ public class PersistEventsStepTest extends BaseStepTest { public void keep_one_event_by_version() { dbTester.prepareDbUnit(getClass(), "keep_one_event_by_version.xml"); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setVersion("1.5-SNAPSHOT").build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setVersion("1.5-SNAPSHOT").build(); treeRootHolder.setRoot(project); dbIdsRepository.setSnapshotId(project, 1001L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java index a6edd165b31..97a54e9aa51 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java @@ -39,7 +39,7 @@ import org.sonar.db.source.FileSourceDto.Type; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.language.LanguageRepository; import org.sonar.test.DbTests; @@ -115,8 +115,8 @@ public class PersistFileSourcesStepTest extends BaseStepTest { @Test public void persist_last_line() { - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.FILE, FILE_REF).setUuid(FILE_UUID).setKey("PROJECT_KEY:file").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.FILE, FILE_REF).setUuid(FILE_UUID).setKey("PROJECT_KEY:file").build()) .build()); reportReader.putComponent(BatchReport.Component.newBuilder() @@ -417,9 +417,9 @@ public class PersistFileSourcesStepTest extends BaseStepTest { } private void initBasicReport(int numberOfLines) { - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("MODULE").setKey("MODULE_KEY").addChildren( - DumbComponent.builder(Component.Type.FILE, FILE_REF).setUuid(FILE_UUID).setKey("MODULE_KEY:src/Foo.java").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("MODULE").setKey("MODULE_KEY").addChildren( + ReportComponent.builder(Component.Type.FILE, FILE_REF).setUuid(FILE_UUID).setKey("MODULE_KEY:src/Foo.java").build()) .build()) .build()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java index fa646206d12..e989b56caee 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java @@ -35,7 +35,7 @@ import org.sonar.db.rule.RuleDto; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepositoryRule; import org.sonar.server.computation.measure.MeasureVariations; @@ -94,8 +94,8 @@ public class PersistMeasuresStepTest extends BaseStepTest { projectDto = addComponent("project-key"); fileDto = addComponent("file-key"); - Component file = DumbComponent.builder(Component.Type.FILE, FILE_REF).setUuid("CDEF").setKey("MODULE_KEY:file").build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, PROJECT_REF).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(file).build(); + Component file = ReportComponent.builder(Component.Type.FILE, FILE_REF).setUuid("CDEF").setKey("MODULE_KEY:file").build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, PROJECT_REF).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(file).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, projectDto.getId()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStepTest.java index 69934fa72ad..1ee02d0e62b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStepTest.java @@ -34,7 +34,7 @@ import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.language.LanguageRepository; import org.sonar.server.computation.metric.Metric; import org.sonar.server.computation.metric.MetricImpl; @@ -123,8 +123,8 @@ public class PersistNumberOfDaysSinceLastCommitStepTest extends BaseStepTest { } private void initProject() { - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("project-uuid").addChildren( - DumbComponent.builder(Component.Type.FILE, 2).setUuid("file-uuid").build()) + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("project-uuid").addChildren( + ReportComponent.builder(Component.Type.FILE, 2).setUuid("file-uuid").build()) .build(); treeRootHolder.setRoot(project); dbIdsRepository.setSnapshotId(project, 1000); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistProjectLinksStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistProjectLinksStepTest.java index 5cf3740e6d5..cc51e596f44 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistProjectLinksStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistProjectLinksStepTest.java @@ -33,7 +33,7 @@ import org.sonar.db.DbTester; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.test.DbTests; import static org.assertj.core.api.Assertions.assertThat; @@ -76,8 +76,8 @@ public class PersistProjectLinksStepTest extends BaseStepTest { public void add_links_on_project_and_module() { dbTester.prepareDbUnit(getClass(), "empty.xml"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").build()) .build()); // project and 1 module @@ -106,7 +106,7 @@ public class PersistProjectLinksStepTest extends BaseStepTest { public void nothing_to_do_when_link_already_exists() { dbTester.prepareDbUnit(getClass(), "nothing_to_do_when_link_already_exists.xml"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); reportReader.putComponent(BatchReport.Component.newBuilder() .setRef(1) @@ -123,8 +123,8 @@ public class PersistProjectLinksStepTest extends BaseStepTest { public void do_not_add_links_on_file() { dbTester.prepareDbUnit(getClass(), "empty.xml"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").addChildren( - DumbComponent.builder(Component.Type.FILE, 2).setUuid("BCDE").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").addChildren( + ReportComponent.builder(Component.Type.FILE, 2).setUuid("BCDE").build()) .build()); reportReader.putComponent(BatchReport.Component.newBuilder() @@ -147,7 +147,7 @@ public class PersistProjectLinksStepTest extends BaseStepTest { public void update_link() { dbTester.prepareDbUnit(getClass(), "update_link.xml"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); reportReader.putComponent(BatchReport.Component.newBuilder() .setRef(1) @@ -164,7 +164,7 @@ public class PersistProjectLinksStepTest extends BaseStepTest { public void delete_link() { dbTester.prepareDbUnit(getClass(), "delete_link.xml"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); reportReader.putComponent(BatchReport.Component.newBuilder() .setRef(1) @@ -180,7 +180,7 @@ public class PersistProjectLinksStepTest extends BaseStepTest { public void not_delete_custom_link() { dbTester.prepareDbUnit(getClass(), "not_delete_custom_link.xml"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); reportReader.putComponent(BatchReport.Component.newBuilder() .setRef(1) @@ -196,7 +196,7 @@ public class PersistProjectLinksStepTest extends BaseStepTest { public void fail_when_trying_to_add_same_link_type_multiple_times() { dbTester.prepareDbUnit(getClass(), "empty.xml"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").build()); reportReader.putComponent(BatchReport.Component.newBuilder() .setRef(1) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistSnapshotsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistSnapshotsStepTest.java index 1bc97d75c63..59a4f901aa7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistSnapshotsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistSnapshotsStepTest.java @@ -40,7 +40,7 @@ import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import org.sonar.server.computation.period.Period; import org.sonar.server.computation.period.PeriodsHolderRule; @@ -115,10 +115,10 @@ public class PersistSnapshotsStepTest extends BaseStepTest { dbClient.componentDao().insert(dbTester.getSession(), fileDto); dbTester.getSession().commit(); - Component file = DumbComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build(); - Component directory = DumbComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren(file).build(); - Component module = DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").setVersion("1.1").addChildren(directory).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).setVersion("1.0").addChildren(module).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build(); + Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren(file).build(); + Component module = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").setVersion("1.1").addChildren(directory).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).setVersion("1.0").addChildren(module).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, projectDto.getId()); @@ -208,9 +208,9 @@ public class PersistSnapshotsStepTest extends BaseStepTest { dbClient.componentDao().insert(dbTester.getSession(), fileDto); dbTester.getSession().commit(); - Component file = DumbComponent.builder(Component.Type.FILE, 3).setUuid("DEFG").setKey(PROJECT_KEY + ":src/main/java/dir/Foo.java").setFileAttributes(new FileAttributes(true, null)).build(); - Component directory = DumbComponent.builder(Component.Type.DIRECTORY, 2).setUuid("CDEF").setKey(PROJECT_KEY + ":src/main/java/dir").addChildren(file).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(directory).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 3).setUuid("DEFG").setKey(PROJECT_KEY + ":src/main/java/dir/Foo.java").setFileAttributes(new FileAttributes(true, null)).build(); + Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid("CDEF").setKey(PROJECT_KEY + ":src/main/java/dir").addChildren(file).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(directory).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, projectDto.getId()); @@ -236,10 +236,10 @@ public class PersistSnapshotsStepTest extends BaseStepTest { dbClient.componentDao().insert(dbTester.getSession(), moduleBDto); dbTester.getSession().commit(); - Component moduleB = DumbComponent.builder(Component.Type.MODULE, 4).setUuid("DEFG").setKey("MODULE_B").build(); - Component subModuleA = DumbComponent.builder(Component.Type.MODULE, 3).setUuid("CDEF").setKey("SUB_MODULE_A").build(); - Component moduleA = DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_A").addChildren(subModuleA).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(moduleA, moduleB).build(); + Component moduleB = ReportComponent.builder(Component.Type.MODULE, 4).setUuid("DEFG").setKey("MODULE_B").build(); + Component subModuleA = ReportComponent.builder(Component.Type.MODULE, 3).setUuid("CDEF").setKey("SUB_MODULE_A").build(); + Component moduleA = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_A").addChildren(subModuleA).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(moduleA, moduleB).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, projectDto.getId()); @@ -289,7 +289,7 @@ public class PersistSnapshotsStepTest extends BaseStepTest { dbTester.getSession().commit(); periodsHolderRule.setPeriods(new Period(1, CoreProperties.TIMEMACHINE_MODE_DATE, "2015-01-01", analysisDate, 123L)); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, projectDto.getId()); @@ -327,10 +327,10 @@ public class PersistSnapshotsStepTest extends BaseStepTest { dbTester.getSession().commit(); - Component file = DumbComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build(); - Component directory = DumbComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren(file).build(); - Component module = DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren(directory).build(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(module).build(); + Component file = ReportComponent.builder(Component.Type.FILE, 4).setUuid("DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java").build(); + Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 3).setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir").addChildren(file).build(); + Component module = ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("MODULE_KEY").addChildren(directory).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren(module).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, projectDto.getId()); @@ -361,7 +361,7 @@ public class PersistSnapshotsStepTest extends BaseStepTest { dbClient.snapshotDao().insert(dbTester.getSession(), snapshotDto); dbTester.getSession().commit(); - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, projectDto.getId()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistTestsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistTestsStepTest.java index 041efd2b4bb..b05a3a7cca2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistTestsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistTestsStepTest.java @@ -38,7 +38,7 @@ import org.sonar.db.source.FileSourceDto; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.FileAttributes; import static org.assertj.core.api.Assertions.assertThat; @@ -86,12 +86,12 @@ public class PersistTestsStepTest extends BaseStepTest { underTest = new PersistTestsStep(dbClient, system2, reportReader, treeRootHolder); - root = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("MODULE_UUID").setKey("MODULE_KEY").addChildren( - DumbComponent.builder(Component.Type.FILE, 3).setUuid(TEST_FILE_UUID_1).setKey("TEST_FILE1_KEY").setFileAttributes(new FileAttributes(true, null)).build(), - DumbComponent.builder(Component.Type.FILE, 4).setUuid(TEST_FILE_UUID_2).setKey("TEST_FILE2_KEY").setFileAttributes(new FileAttributes(true, null)).build(), - DumbComponent.builder(Component.Type.FILE, 5).setUuid(MAIN_FILE_UUID_1).setKey("MAIN_FILE1_KEY").build(), - DumbComponent.builder(Component.Type.FILE, 6).setUuid(MAIN_FILE_UUID_2).setKey("MAIN_FILE2_KEY").build()).build()) + root = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("MODULE_UUID").setKey("MODULE_KEY").addChildren( + ReportComponent.builder(Component.Type.FILE, 3).setUuid(TEST_FILE_UUID_1).setKey("TEST_FILE1_KEY").setFileAttributes(new FileAttributes(true, null)).build(), + ReportComponent.builder(Component.Type.FILE, 4).setUuid(TEST_FILE_UUID_2).setKey("TEST_FILE2_KEY").setFileAttributes(new FileAttributes(true, null)).build(), + ReportComponent.builder(Component.Type.FILE, 5).setUuid(MAIN_FILE_UUID_1).setKey("MAIN_FILE1_KEY").build(), + ReportComponent.builder(Component.Type.FILE, 6).setUuid(MAIN_FILE_UUID_2).setKey("MAIN_FILE2_KEY").build()).build()) .build(); treeRootHolder.setRoot(root); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java index 09024c4a867..1b16a41e1de 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java @@ -34,7 +34,7 @@ import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.ProjectSettingsRepository; import org.sonar.server.db.DbClient; @@ -68,7 +68,7 @@ public class PurgeDatastoresStepTest extends BaseStepTest { @Test public void call_purge_method_of_the_purge_task() { - Component project = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("UUID-1234").setKey(PROJECT_KEY).build(); + Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("UUID-1234").setKey(PROJECT_KEY).build(); treeRootHolder.setRoot(project); dbIdsRepository.setComponentId(project, 123L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateEventsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateEventsStepTest.java index dd2ddadc6f3..c490a24ebc2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateEventsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateEventsStepTest.java @@ -27,7 +27,7 @@ import org.mockito.ArgumentCaptor; import org.sonar.api.notifications.Notification; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.event.Event; import org.sonar.server.computation.event.EventRepository; import org.sonar.server.computation.measure.Measure; @@ -50,8 +50,8 @@ import static org.sonar.server.computation.measure.Measure.Level.OK; import static org.sonar.server.computation.measure.Measure.Level.WARN; public class QualityGateEventsStepTest { - private static final DumbComponent PROJECT_COMPONENT = DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("uuid 1").setKey("key 1") - .addChildren(DumbComponent.builder(Component.Type.MODULE, 2).build()) + private static final ReportComponent PROJECT_COMPONENT = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("uuid 1").setKey("key 1") + .addChildren(ReportComponent.builder(Component.Type.MODULE, 2).build()) .build(); private static final String INVALID_ALERT_STATUS = "trololo"; private static final String ALERT_TEXT = "alert text"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateLoadingStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateLoadingStepTest.java index 55f703f0f89..27781488aeb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateLoadingStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateLoadingStepTest.java @@ -27,7 +27,7 @@ import org.junit.rules.ExpectedException; import org.sonar.api.config.Settings; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.ProjectSettingsRepository; import org.sonar.server.computation.qualitygate.Condition; import org.sonar.server.computation.qualitygate.MutableQualityGateHolderRule; @@ -43,7 +43,7 @@ import static org.mockito.Mockito.when; public class QualityGateLoadingStepTest { private static final String PROJECT_KEY = "project key"; - private static final DumbComponent PROJECT_ALONE = DumbComponent.builder(Component.Type.PROJECT, 1).setKey(PROJECT_KEY).build(); + private static final ReportComponent PROJECT_ALONE = ReportComponent.builder(Component.Type.PROJECT, 1).setKey(PROJECT_KEY).build(); @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -59,7 +59,7 @@ public class QualityGateLoadingStepTest { @Test public void execute_sets_default_QualityGate_when_project_has_no_settings() { - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setKey(PROJECT_KEY).addChildren(DumbComponent.builder(Component.Type.FILE, 2).build()).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setKey(PROJECT_KEY).addChildren(ReportComponent.builder(Component.Type.FILE, 2).build()).build()); when(projectSettingsRepository.getProjectSettings(PROJECT_KEY)).thenReturn(new Settings()); underTest.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateMeasuresStepTest.java index 663be5b4a17..5566480e44c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityGateMeasuresStepTest.java @@ -31,7 +31,7 @@ import org.mockito.stubbing.Answer; import org.sonar.api.measures.CoreMetrics; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.measure.Measure; import org.sonar.server.computation.measure.MeasureRepository; import org.sonar.server.computation.measure.qualitygatedetails.EvaluatedCondition; @@ -61,7 +61,7 @@ public class QualityGateMeasuresStepTest { private static final MetricImpl INT_METRIC_1 = createIntMetric(1); private static final MetricImpl INT_METRIC_2 = createIntMetric(2); - private static final DumbComponent PROJECT_COMPONENT = DumbComponent.builder(Component.Type.PROJECT, 1).build(); + private static final ReportComponent PROJECT_COMPONENT = ReportComponent.builder(Component.Type.PROJECT, 1).build(); @Rule public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule(); @@ -103,7 +103,7 @@ public class QualityGateMeasuresStepTest { @Test public void no_measure_if_tree_has_no_project() { - DumbComponent notAProjectComponent = DumbComponent.builder(Component.Type.MODULE, 1).build(); + ReportComponent notAProjectComponent = ReportComponent.builder(Component.Type.MODULE, 1).build(); treeRootHolder.setRoot(notAProjectComponent); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityProfileEventsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityProfileEventsStepTest.java index 72d9354f952..ac4b52ea09c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityProfileEventsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/QualityProfileEventsStepTest.java @@ -39,7 +39,7 @@ import org.sonar.api.resources.Language; import org.sonar.core.util.UtcDateUtils; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.event.Event; import org.sonar.server.computation.event.EventRepository; import org.sonar.server.computation.language.LanguageRepository; @@ -85,7 +85,7 @@ public class QualityProfileEventsStepTest { @Before public void setUp() { when(metricRepository.getByKey(CoreMetrics.QUALITY_PROFILES_KEY)).thenReturn(qualityProfileMetric); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("uuid").setKey("key").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("uuid").setKey("key").build()); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SendIssueNotificationsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SendIssueNotificationsStepTest.java index e1fd598d8be..f0d088d383c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SendIssueNotificationsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SendIssueNotificationsStepTest.java @@ -33,7 +33,7 @@ import org.sonar.core.issue.DefaultIssue; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.issue.IssueCache; import org.sonar.server.computation.issue.RuleRepository; import org.sonar.server.issue.notification.IssueChangeNotification; @@ -72,7 +72,7 @@ public class SendIssueNotificationsStepTest extends BaseStepTest { NewIssuesNotificationFactory newIssuesNotificationFactory = mock(NewIssuesNotificationFactory.class, Mockito.RETURNS_DEEP_STUBS); underTest = new SendIssueNotificationsStep(issueCache, mock(RuleRepository.class), treeRootHolder, notifService, reportReader, newIssuesNotificationFactory); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build()); reportReader.setMetadata(BatchReport.Metadata.newBuilder() .setRootComponentRef(1) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SizeMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SizeMeasuresStepTest.java index 984ee6b158b..3cdb7341dc4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SizeMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SizeMeasuresStepTest.java @@ -46,7 +46,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java index 90cecee3056..2c7fbd21414 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java @@ -31,7 +31,7 @@ import org.sonar.db.component.SnapshotDao; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepository; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.db.DbClient; import org.sonar.test.DbTests; @@ -63,7 +63,7 @@ public class SwitchSnapshotStepTest { public void one_switch_with_a_snapshot_and_his_children() { db.prepareDbUnit(getClass(), "snapshots.xml"); - Component project = DumbComponent.DUMB_PROJECT; + Component project = ReportComponent.DUMB_PROJECT; treeRootHolder.setRoot(project); dbIdsRepository.setSnapshotId(project, 1); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/UnitTestMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/UnitTestMeasuresStepTest.java index b01fd23593f..143af7e3010 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/UnitTestMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/UnitTestMeasuresStepTest.java @@ -47,7 +47,7 @@ import static org.sonar.server.computation.component.Component.Type.DIRECTORY; import static org.sonar.server.computation.component.Component.Type.FILE; import static org.sonar.server.computation.component.Component.Type.MODULE; import static org.sonar.server.computation.component.Component.Type.PROJECT; -import static org.sonar.server.computation.component.DumbComponent.builder; +import static org.sonar.server.computation.component.ReportComponent.builder; import static org.sonar.server.computation.measure.Measure.newMeasureBuilder; import static org.sonar.server.computation.measure.MeasureRepoEntry.entryOf; import static org.sonar.server.computation.measure.MeasureRepoEntry.toEntries; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ValidateProjectStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ValidateProjectStepTest.java index df413f8bc0e..379d7046e67 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ValidateProjectStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ValidateProjectStepTest.java @@ -39,7 +39,7 @@ import org.sonar.server.component.SnapshotTesting; import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.test.DbTests; @Category(DbTests.class) @@ -87,7 +87,7 @@ public class ValidateProjectStepTest { settings.appendProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, "true"); dbClient.componentDao().insert(dbTester.getSession(), ComponentTesting.newProjectDto("ABCD").setKey(PROJECT_KEY)); dbTester.getSession().commit(); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); underTest.execute(); } @@ -105,7 +105,7 @@ public class ValidateProjectStepTest { .build()); settings.appendProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, "true"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); underTest.execute(); } @@ -120,7 +120,7 @@ public class ValidateProjectStepTest { .build()); settings.appendProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, "false"); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); underTest.execute(); } @@ -136,7 +136,7 @@ public class ValidateProjectStepTest { .setType(Constants.ComponentType.PROJECT) .setKey(PROJECT_KEY) .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY + ":origin/master").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY + ":origin/master").build()); underTest.execute(); } @@ -156,7 +156,7 @@ public class ValidateProjectStepTest { .setType(Constants.ComponentType.PROJECT) .setKey(PROJECT_KEY) .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY + ":bran#ch").build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY + ":bran#ch").build()); underTest.execute(); } @@ -182,8 +182,8 @@ public class ValidateProjectStepTest { .setType(Constants.ComponentType.MODULE) .setKey("Module$Key") .build()); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(invalidProjectKey).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("Module$Key").build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(invalidProjectKey).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey("Module$Key").build()) .build()); underTest.execute(); @@ -214,8 +214,8 @@ public class ValidateProjectStepTest { dbClient.componentDao().insert(dbTester.getSession(), project); dbTester.getSession().commit(); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey(MODULE_KEY).build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey(MODULE_KEY).build()) .build()); underTest.execute(); @@ -248,8 +248,8 @@ public class ValidateProjectStepTest { dbClient.componentDao().insert(dbTester.getSession(), module); dbTester.getSession().commit(); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey(MODULE_KEY).build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey(MODULE_KEY).build()) .build()); underTest.execute(); @@ -283,8 +283,8 @@ public class ValidateProjectStepTest { dbClient.componentDao().insert(dbTester.getSession(), module); dbTester.getSession().commit(); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( - DumbComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey(MODULE_KEY).build()) + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).addChildren( + ReportComponent.builder(Component.Type.MODULE, 2).setUuid("BCDE").setKey(MODULE_KEY).build()) .build()); underTest.execute(); @@ -307,7 +307,7 @@ public class ValidateProjectStepTest { dbClient.snapshotDao().insert(dbTester.getSession(), SnapshotTesting.createForProject(project).setCreatedAt(1420088400000L)); // 2015-01-01 dbTester.getSession().commit(); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); underTest.execute(); } @@ -334,7 +334,7 @@ public class ValidateProjectStepTest { dbClient.snapshotDao().insert(dbTester.getSession(), SnapshotTesting.createForProject(project).setCreatedAt(1433131200000L)); // 2015-06-01 dbTester.getSession().commit(); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); + treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build()); underTest.execute(); } |