summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-08-06 17:03:10 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-08-10 14:18:18 +0200
commit5adcb11906a8577bb42be02f547a5f18e2e7d4e2 (patch)
tree65dcd4edcba0e8794ae1ac8ed22978f66dac24c9 /server
parent00299c27b24f7c2745efc88ed7861a48d69bea46 (diff)
downloadsonarqube-5adcb11906a8577bb42be02f547a5f18e2e7d4e2.tar.gz
sonarqube-5adcb11906a8577bb42be02f547a5f18e2e7d4e2.zip
Rename Visitor to Crawler
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/component/ComponentCrawler.java (renamed from server/sonar-server/src/main/java/org/sonar/server/computation/component/ComponentVisitor.java)2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/component/DepthTraversalTypeAwareCrawler.java (renamed from server/sonar-server/src/main/java/org/sonar/server/computation/component/DepthTraversalTypeAwareVisitor.java)6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/component/PathAwareCrawler.java (renamed from server/sonar-server/src/main/java/org/sonar/server/computation/component/PathAwareVisitor.java)16
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/component/TreeRootHolderImpl.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/component/TypeAwareCrawler.java (renamed from server/sonar-server/src/main/java/org/sonar/server/computation/component/TypeAwareVisitor.java)4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawler.java (renamed from server/sonar-server/src/main/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitor.java)26
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/CommentMeasuresStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/ComplexityMeasuresStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputePluginMeasuresStep.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputeQProfileMeasureStep.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/CoverageMeasuresStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/CustomMeasuresCopyStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/DuplicationMeasuresStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStep.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/IntegrateIssuesStep.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/LanguageDistributionMeasuresStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/NewCoverageMeasuresStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistDuplicationsStep.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistEventsStep.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStep.java14
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistProjectLinksStep.java14
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistTestsStep.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateEventsStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateLoadingStep.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateMeasuresStep.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/SizeMeasuresStep.java16
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/SqaleMeasuresStep.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/UnitTestMeasuresStep.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/ValidateProjectStep.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java6
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareCrawlerTest.java (renamed from server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareVisitorTest.java)26
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareCrawlerTest.java (renamed from server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareVisitorTest.java)14
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareCrawlerTest.java (renamed from server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareVisitorTest.java)14
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/formula/AverageFormulaExecutionTest.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/formula/DistributionFormulaExecutionTest.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawlerTest.java (renamed from server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitorTest.java)6
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/formula/SumFormulaExecutionTest.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java6
41 files changed, 170 insertions, 170 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/component/ComponentVisitor.java b/server/sonar-server/src/main/java/org/sonar/server/computation/component/ComponentCrawler.java
index 4039933865c..37599cd0283 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/component/ComponentVisitor.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/component/ComponentCrawler.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.computation.component;
-public interface ComponentVisitor {
+public interface ComponentCrawler {
void visit(Component tree);
enum Order {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/component/DepthTraversalTypeAwareVisitor.java b/server/sonar-server/src/main/java/org/sonar/server/computation/component/DepthTraversalTypeAwareCrawler.java
index cf6277cd8dc..0e7d10786ef 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/component/DepthTraversalTypeAwareVisitor.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/component/DepthTraversalTypeAwareCrawler.java
@@ -23,15 +23,15 @@ package org.sonar.server.computation.component;
import static java.util.Objects.requireNonNull;
/**
- * Implementation of {@link TypeAwareVisitor} that implements a depth traversal of a {@link Component} tree.
+ * Implementation of {@link TypeAwareCrawler} that implements a depth traversal of a {@link Component} tree.
* <p>It supports visiting traversal in either pre-order or post-order</p>
* It supports a max depth for crawling (component strictly deeper than the specified type will be ignored).
*/
-public abstract class DepthTraversalTypeAwareVisitor implements TypeAwareVisitor {
+public abstract class DepthTraversalTypeAwareCrawler implements TypeAwareCrawler {
private final Component.Type maxDepth;
private final Order order;
- protected DepthTraversalTypeAwareVisitor(Component.Type maxDepth, Order order) {
+ protected DepthTraversalTypeAwareCrawler(Component.Type maxDepth, Order order) {
this.maxDepth = requireNonNull(maxDepth);
this.order = requireNonNull(order);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/component/PathAwareVisitor.java b/server/sonar-server/src/main/java/org/sonar/server/computation/component/PathAwareCrawler.java
index 21e65c9eeea..119fbe6d746 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/component/PathAwareVisitor.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/component/PathAwareCrawler.java
@@ -25,22 +25,22 @@ import java.util.Iterator;
import java.util.NoSuchElementException;
import static java.util.Objects.requireNonNull;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.POST_ORDER;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
/**
* A ComponentVisitor which provide access to a representation of the path from the root to the currently visited
* Component. It also provides a way to have an object associated to each Component and access it and all of its
* parent's.
- * As for {@link DepthTraversalTypeAwareVisitor}, this visitor supports max depth visit and ordering.
+ * As for {@link DepthTraversalTypeAwareCrawler}, this visitor supports max depth visit and ordering.
*/
-public abstract class PathAwareVisitor<T> implements ComponentVisitor {
+public abstract class PathAwareCrawler<T> implements ComponentCrawler {
private final Component.Type maxDepth;
private final Order order;
private final StackElementFactory<T> factory;
private final DequeBasedPath<T> stack = new DequeBasedPath<>();
- public PathAwareVisitor(Component.Type maxDepth, Order order, StackElementFactory<T> factory) {
+ public PathAwareCrawler(Component.Type maxDepth, Order order, StackElementFactory<T> factory) {
this.maxDepth = requireNonNull(maxDepth);
this.order = requireNonNull(order);
this.factory = requireNonNull(factory, "Factory can not be null");
@@ -254,9 +254,9 @@ public abstract class PathAwareVisitor<T> implements ComponentVisitor {
T root();
/**
- * The path to the current Component as an Iterable of {@link PathAwareVisitor.PathElement} which starts with
- * the {@link PathAwareVisitor.PathElement} of the current Component and ends with the
- * {@link PathAwareVisitor.PathElement} of the root of the tree.
+ * The path to the current Component as an Iterable of {@link PathAwareCrawler.PathElement} which starts with
+ * the {@link PathAwareCrawler.PathElement} of the current Component and ends with the
+ * {@link PathAwareCrawler.PathElement} of the root of the tree.
*/
Iterable<PathElement<T>> getCurrentPath();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/component/TreeRootHolderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/component/TreeRootHolderImpl.java
index 6ebc2aade59..6cd47a20ed4 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/component/TreeRootHolderImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/component/TreeRootHolderImpl.java
@@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
/**
* Holds the reference to the root of the {@link Component} tree for the current CE run.
@@ -63,7 +63,7 @@ public class TreeRootHolderImpl implements MutableTreeRootHolder {
}
private void feedComponentsByRef() {
- new DepthTraversalTypeAwareVisitor(Component.Type.FILE, POST_ORDER) {
+ new DepthTraversalTypeAwareCrawler(Component.Type.FILE, POST_ORDER) {
@Override
public void visitAny(Component component) {
componentsByRef.put(component.getRef(), component);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/component/TypeAwareVisitor.java b/server/sonar-server/src/main/java/org/sonar/server/computation/component/TypeAwareCrawler.java
index dec025a09d9..cf9117baadf 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/component/TypeAwareVisitor.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/component/TypeAwareCrawler.java
@@ -20,9 +20,9 @@
package org.sonar.server.computation.component;
/**
- * A {@link ComponentVisitor} which can exposes methods which ensure the type of the visited Component.
+ * A {@link ComponentCrawler} which can exposes methods which ensure the type of the visited Component.
*/
-public interface TypeAwareVisitor extends ComponentVisitor {
+public interface TypeAwareCrawler extends ComponentCrawler {
/**
* Called when encountering a Component of type {@link Component.Type#PROJECT}
*/
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitor.java b/server/sonar-server/src/main/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawler.java
index 95876fe1f0d..ef0d10adc0b 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitor.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawler.java
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Map;
import javax.annotation.CheckForNull;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.PathAwareVisitor;
+import org.sonar.server.computation.component.PathAwareCrawler;
import org.sonar.server.computation.measure.Measure;
import org.sonar.server.computation.measure.MeasureRepository;
import org.sonar.server.computation.metric.Metric;
@@ -36,8 +36,8 @@ import org.sonar.server.computation.period.PeriodsHolder;
import static java.util.Objects.requireNonNull;
-public class FormulaExecutorComponentVisitor extends PathAwareVisitor<FormulaExecutorComponentVisitor.Counters> {
- private static final PathAwareVisitor.SimpleStackElementFactory<Counters> COUNTERS_FACTORY = new PathAwareVisitor.SimpleStackElementFactory<Counters>() {
+public class FormulaExecutorComponentCrawler extends PathAwareCrawler<FormulaExecutorComponentCrawler.Counters> {
+ private static final PathAwareCrawler.SimpleStackElementFactory<Counters> COUNTERS_FACTORY = new PathAwareCrawler.SimpleStackElementFactory<Counters>() {
@Override
public Counters createForAny(Component component) {
@@ -57,7 +57,7 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitor<FormulaExe
private final MeasureRepository measureRepository;
private final List<Formula> formulas;
- private FormulaExecutorComponentVisitor(Builder builder, List<Formula> formulas) {
+ private FormulaExecutorComponentCrawler(Builder builder, List<Formula> formulas) {
super(Component.Type.FILE, Order.POST_ORDER, COUNTERS_FACTORY);
this.periodsHolder = builder.periodsHolder;
this.measureRepository = builder.measureRepository;
@@ -89,32 +89,32 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitor<FormulaExe
return this;
}
- public FormulaExecutorComponentVisitor buildFor(List<Formula> formulas) {
- return new FormulaExecutorComponentVisitor(this, formulas);
+ public FormulaExecutorComponentCrawler buildFor(List<Formula> formulas) {
+ return new FormulaExecutorComponentCrawler(this, formulas);
}
}
@Override
- protected void visitProject(Component project, Path<FormulaExecutorComponentVisitor.Counters> path) {
+ protected void visitProject(Component project, Path<FormulaExecutorComponentCrawler.Counters> path) {
processNotFile(project, path);
}
@Override
- protected void visitModule(Component module, Path<FormulaExecutorComponentVisitor.Counters> path) {
+ protected void visitModule(Component module, Path<FormulaExecutorComponentCrawler.Counters> path) {
processNotFile(module, path);
}
@Override
- protected void visitDirectory(Component directory, Path<FormulaExecutorComponentVisitor.Counters> path) {
+ protected void visitDirectory(Component directory, Path<FormulaExecutorComponentCrawler.Counters> path) {
processNotFile(directory, path);
}
@Override
- protected void visitFile(Component file, Path<FormulaExecutorComponentVisitor.Counters> path) {
+ protected void visitFile(Component file, Path<FormulaExecutorComponentCrawler.Counters> path) {
processFile(file, path);
}
- private void processNotFile(Component component, Path<FormulaExecutorComponentVisitor.Counters> path) {
+ private void processNotFile(Component component, Path<FormulaExecutorComponentCrawler.Counters> path) {
for (Formula formula : formulas) {
Counter counter = path.current().getCounter(formula);
// If there were no file under this node, the counter won't be initialized
@@ -127,7 +127,7 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitor<FormulaExe
}
}
- private void processFile(Component file, Path<FormulaExecutorComponentVisitor.Counters> path) {
+ private void processFile(Component file, Path<FormulaExecutorComponentCrawler.Counters> path) {
FileAggregateContext counterContext = new FileAggregateContextImpl(file);
for (Formula formula : formulas) {
Counter counter = formula.createNewCounter();
@@ -147,7 +147,7 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitor<FormulaExe
}
}
- private void aggregateToParent(Path<FormulaExecutorComponentVisitor.Counters> path, Formula formula, Counter currentCounter) {
+ private void aggregateToParent(Path<FormulaExecutorComponentCrawler.Counters> path, Formula formula, Counter currentCounter) {
if (!path.isRoot()) {
path.parent().aggregate(formula, currentCounter);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/CommentMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/CommentMeasuresStep.java
index 3202a47ca6d..63845ecf9f2 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/CommentMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/CommentMeasuresStep.java
@@ -28,7 +28,7 @@ import org.sonar.server.computation.formula.Counter;
import org.sonar.server.computation.formula.CreateMeasureContext;
import org.sonar.server.computation.formula.FileAggregateContext;
import org.sonar.server.computation.formula.Formula;
-import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor;
+import org.sonar.server.computation.formula.FormulaExecutorComponentCrawler;
import org.sonar.server.computation.formula.SumCounter;
import org.sonar.server.computation.formula.SumFormula;
import org.sonar.server.computation.measure.Measure;
@@ -68,7 +68,7 @@ public class CommentMeasuresStep implements ComputationStep {
@Override
public void execute() {
- FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(formulas)
.visit(treeRootHolder.getRoot());
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComplexityMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComplexityMeasuresStep.java
index a9e64edf4e6..7eec6bf1aed 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComplexityMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComplexityMeasuresStep.java
@@ -25,7 +25,7 @@ import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.formula.AverageFormula;
import org.sonar.server.computation.formula.DistributionFormula;
import org.sonar.server.computation.formula.Formula;
-import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor;
+import org.sonar.server.computation.formula.FormulaExecutorComponentCrawler;
import org.sonar.server.computation.formula.SumFormula;
import org.sonar.server.computation.measure.MeasureRepository;
import org.sonar.server.computation.metric.MetricRepository;
@@ -85,7 +85,7 @@ public class ComplexityMeasuresStep implements ComputationStep {
@Override
public void execute() {
- FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(FORMULAS)
.visit(treeRootHolder.getRoot());
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputePluginMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputePluginMeasuresStep.java
index f336a5970b7..9d4692a811b 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputePluginMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputePluginMeasuresStep.java
@@ -21,7 +21,7 @@
package org.sonar.server.computation.step;
import org.sonar.api.ce.measure.MeasureComputer;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.ProjectSettingsRepository;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.measure.MeasureComputersHolder;
@@ -30,7 +30,7 @@ import org.sonar.server.computation.measure.api.MeasureComputerImplementationCon
import org.sonar.server.computation.metric.MetricRepository;
import static org.sonar.server.computation.component.Component.Type.FILE;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.Visitor.Order.PRE_ORDER;
public class ComputePluginMeasuresStep implements ComputationStep {
@@ -55,7 +55,7 @@ public class ComputePluginMeasuresStep implements ComputationStep {
new NewMetricDefinitionsVisitor().visit(treeRootHolder.getRoot());
}
- private class NewMetricDefinitionsVisitor extends DepthTraversalTypeAwareVisitor {
+ private class NewMetricDefinitionsVisitor extends DepthTraversalTypeAwareCrawler {
public NewMetricDefinitionsVisitor() {
super(FILE, PRE_ORDER);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputeQProfileMeasureStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputeQProfileMeasureStep.java
index 85b9f6d0173..71e24866917 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputeQProfileMeasureStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputeQProfileMeasureStep.java
@@ -26,7 +26,7 @@ import java.util.Map;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.utils.MessageException;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.PathAwareVisitor;
+import org.sonar.server.computation.component.PathAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.measure.Measure;
import org.sonar.server.computation.measure.MeasureRepository;
@@ -36,7 +36,7 @@ import org.sonar.server.computation.qualityprofile.QPMeasureData;
import org.sonar.server.computation.qualityprofile.QualityProfile;
import static org.sonar.server.computation.component.Component.Type.MODULE;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
/**
* Aggregates quality profile on lower-level module nodes on their parent modules and project
@@ -56,14 +56,14 @@ public class ComputeQProfileMeasureStep implements ComputationStep {
@Override
public void execute() {
Metric qProfilesMetric = metricRepository.getByKey(CoreMetrics.QUALITY_PROFILES_KEY);
- new NewCoverageAggregationComponentVisitor(qProfilesMetric).visit(treeRootHolder.getRoot());
+ new NewCoverageAggregationComponentCrawler(qProfilesMetric).visit(treeRootHolder.getRoot());
}
- private class NewCoverageAggregationComponentVisitor extends PathAwareVisitor<QProfiles> {
+ private class NewCoverageAggregationComponentCrawler extends PathAwareCrawler<QProfiles> {
private final Metric qProfilesMetric;
- public NewCoverageAggregationComponentVisitor(Metric qProfilesMetric) {
+ public NewCoverageAggregationComponentCrawler(Metric qProfilesMetric) {
super(MODULE, POST_ORDER, new SimpleStackElementFactory<QProfiles>() {
@Override
public QProfiles createForAny(Component component) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/CoverageMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/CoverageMeasuresStep.java
index 86505c74a15..63eefa50bfd 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/CoverageMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/CoverageMeasuresStep.java
@@ -22,7 +22,7 @@ package org.sonar.server.computation.step;
import com.google.common.collect.ImmutableList;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.formula.Formula;
-import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor;
+import org.sonar.server.computation.formula.FormulaExecutorComponentCrawler;
import org.sonar.server.computation.formula.SumFormula;
import org.sonar.server.computation.formula.coverage.LinesAndConditionsWithUncoveredFormula;
import org.sonar.server.computation.formula.coverage.LinesAndConditionsWithUncoveredMetricKeys;
@@ -98,7 +98,7 @@ public class CoverageMeasuresStep implements ComputationStep {
@Override
public void execute() {
- FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(COVERAGE_FORMULAS)
.visit(treeRootHolder.getRoot());
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/CustomMeasuresCopyStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/CustomMeasuresCopyStep.java
index c3a2454bebb..3f0339c7148 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/CustomMeasuresCopyStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/CustomMeasuresCopyStep.java
@@ -27,7 +27,7 @@ import org.sonar.db.DbSession;
import org.sonar.db.MyBatis;
import org.sonar.db.measure.custom.CustomMeasureDto;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.measure.Measure;
import org.sonar.server.computation.measure.MeasureRepository;
@@ -51,7 +51,7 @@ public class CustomMeasuresCopyStep implements ComputationStep {
@Override
public void execute() {
- new DepthTraversalTypeAwareVisitor(Component.Type.FILE, DepthTraversalTypeAwareVisitor.Order.PRE_ORDER) {
+ new DepthTraversalTypeAwareCrawler(Component.Type.FILE, DepthTraversalTypeAwareCrawler.Order.PRE_ORDER) {
@Override
public void visitAny(Component component) {
copy(component);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/DuplicationMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/DuplicationMeasuresStep.java
index 84131162002..9052b5bf4d4 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/DuplicationMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/DuplicationMeasuresStep.java
@@ -29,7 +29,7 @@ import org.sonar.server.computation.formula.Counter;
import org.sonar.server.computation.formula.CreateMeasureContext;
import org.sonar.server.computation.formula.FileAggregateContext;
import org.sonar.server.computation.formula.Formula;
-import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor;
+import org.sonar.server.computation.formula.FormulaExecutorComponentCrawler;
import org.sonar.server.computation.formula.SumCounter;
import org.sonar.server.computation.measure.Measure;
import org.sonar.server.computation.measure.MeasureRepository;
@@ -72,7 +72,7 @@ public class DuplicationMeasuresStep implements ComputationStep {
@Override
public void execute() {
- FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(formulas)
.visit(treeRootHolder.getRoot());
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStep.java
index 517724c400a..187a17c7f11 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/FillMeasuresWithVariationsStep.java
@@ -35,7 +35,7 @@ import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.measure.PastMeasureDto;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.measure.Measure;
import org.sonar.server.computation.measure.MeasureKey;
@@ -46,7 +46,7 @@ import org.sonar.server.computation.metric.MetricRepository;
import org.sonar.server.computation.period.Period;
import org.sonar.server.computation.period.PeriodsHolder;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
/**
* Set variations on all numeric measures found in the repository.
@@ -85,19 +85,19 @@ public class FillMeasuresWithVariationsStep implements ComputationStep {
DbSession dbSession = dbClient.openSession(false);
try {
Iterable<Metric> metrics = FluentIterable.from(metricRepository.getAll()).filter(NumericMetric.INSTANCE);
- new VariationMeasuresVisitor(dbSession, metrics).visit(treeRootHolder.getRoot());
+ new VariationMeasuresCrawler(dbSession, metrics).visit(treeRootHolder.getRoot());
} finally {
dbSession.close();
}
}
- private class VariationMeasuresVisitor extends DepthTraversalTypeAwareVisitor {
+ private class VariationMeasuresCrawler extends DepthTraversalTypeAwareCrawler {
private final DbSession session;
private final Set<Integer> metricIds;
private final Map<String, Metric> metricByKeys;
- public VariationMeasuresVisitor(DbSession session, Iterable<Metric> metrics) {
+ public VariationMeasuresCrawler(DbSession session, Iterable<Metric> metrics) {
// measures on files are currently purged, so past measures are not available on files
super(Component.Type.DIRECTORY, PRE_ORDER);
this.session = session;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/IntegrateIssuesStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/IntegrateIssuesStep.java
index 2a8eb12123b..7d30c8a853e 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/IntegrateIssuesStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/IntegrateIssuesStep.java
@@ -27,7 +27,7 @@ import org.sonar.api.utils.log.Loggers;
import org.sonar.core.issue.DefaultIssue;
import org.sonar.core.issue.tracking.Tracking;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.issue.BaseIssuesLoader;
import org.sonar.server.computation.issue.IssueCache;
@@ -36,7 +36,7 @@ import org.sonar.server.computation.issue.IssueVisitors;
import org.sonar.server.computation.issue.TrackerExecution;
import org.sonar.server.util.cache.DiskCache;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
public class IntegrateIssuesStep implements ComputationStep {
@@ -63,7 +63,7 @@ public class IntegrateIssuesStep implements ComputationStep {
// all the components that had issues before this analysis
final Set<String> unprocessedComponentUuids = Sets.newHashSet(baseIssuesLoader.loadUuidsOfComponentsWithOpenIssues());
- new DepthTraversalTypeAwareVisitor(Component.Type.FILE, POST_ORDER) {
+ new DepthTraversalTypeAwareCrawler(Component.Type.FILE, POST_ORDER) {
@Override
public void visitAny(Component component) {
processIssues(component);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/LanguageDistributionMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/LanguageDistributionMeasuresStep.java
index d8b2d54f0cc..cf7870a174a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/LanguageDistributionMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/LanguageDistributionMeasuresStep.java
@@ -33,7 +33,7 @@ import org.sonar.server.computation.formula.Counter;
import org.sonar.server.computation.formula.CreateMeasureContext;
import org.sonar.server.computation.formula.FileAggregateContext;
import org.sonar.server.computation.formula.Formula;
-import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor;
+import org.sonar.server.computation.formula.FormulaExecutorComponentCrawler;
import org.sonar.server.computation.measure.Measure;
import org.sonar.server.computation.measure.MeasureRepository;
import org.sonar.server.computation.metric.MetricRepository;
@@ -63,7 +63,7 @@ public class LanguageDistributionMeasuresStep implements ComputationStep {
@Override
public void execute() {
- FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(FORMULAS)
.visit(treeRootHolder.getRoot());
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/NewCoverageMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/NewCoverageMeasuresStep.java
index ef2c0e6d70e..973cbd947c1 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/NewCoverageMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/NewCoverageMeasuresStep.java
@@ -37,7 +37,7 @@ import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.formula.CreateMeasureContext;
import org.sonar.server.computation.formula.FileAggregateContext;
import org.sonar.server.computation.formula.Formula;
-import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor;
+import org.sonar.server.computation.formula.FormulaExecutorComponentCrawler;
import org.sonar.server.computation.formula.counter.IntVariationValue;
import org.sonar.server.computation.formula.coverage.LinesAndConditionsWithUncoveredMetricKeys;
import org.sonar.server.computation.formula.coverage.LinesAndConditionsWithUncoveredVariationFormula;
@@ -74,7 +74,7 @@ public class NewCoverageMeasuresStep implements ComputationStep {
@Override
public void execute() {
- FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.withVariationSupport(periodsHolder)
.buildFor(ImmutableList.<Formula>of(
// UT coverage
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistDuplicationsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistDuplicationsStep.java
index 32f1205905e..9413a9831e6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistDuplicationsStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistDuplicationsStep.java
@@ -33,10 +33,10 @@ import org.sonar.db.metric.MetricDto;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.computation.component.Component;
import org.sonar.server.computation.component.DbIdsRepository;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
/**
* Persist duplications into
@@ -60,19 +60,19 @@ public class PersistDuplicationsStep implements ComputationStep {
DbSession session = dbClient.openSession(true);
try {
MetricDto duplicationMetric = dbClient.metricDao().selectOrFailByKey(session, CoreMetrics.DUPLICATIONS_DATA_KEY);
- new DuplicationVisitor(session, duplicationMetric).visit(treeRootHolder.getRoot());
+ new DuplicationCrawler(session, duplicationMetric).visit(treeRootHolder.getRoot());
session.commit();
} finally {
MyBatis.closeQuietly(session);
}
}
- private class DuplicationVisitor extends DepthTraversalTypeAwareVisitor {
+ private class DuplicationCrawler extends DepthTraversalTypeAwareCrawler {
private final DbSession session;
private final MetricDto duplicationMetric;
- private DuplicationVisitor(DbSession session, MetricDto duplicationMetric) {
+ private DuplicationCrawler(DbSession session, MetricDto duplicationMetric) {
super(Component.Type.FILE, PRE_ORDER);
this.session = session;
this.duplicationMetric = duplicationMetric;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistEventsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistEventsStep.java
index a171a541f8e..0a6f75a775b 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistEventsStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistEventsStep.java
@@ -23,17 +23,17 @@ package org.sonar.server.computation.step;
import com.google.common.base.Function;
import javax.annotation.Nonnull;
import org.sonar.api.utils.System2;
-import org.sonar.db.event.EventDto;
+import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.MyBatis;
+import org.sonar.db.event.EventDto;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.computation.component.Component;
import org.sonar.server.computation.component.DbIdsRepository;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.event.Event;
import org.sonar.server.computation.event.EventRepository;
-import org.sonar.db.DbClient;
import static com.google.common.collect.Iterables.transform;
@@ -61,7 +61,7 @@ public class PersistEventsStep implements ComputationStep {
final DbSession session = dbClient.openSession(false);
try {
long analysisDate = reportReader.readMetadata().getAnalysisDate();
- new PersistEventComponentVisitor(session, analysisDate).visit(treeRootHolder.getRoot());
+ new PersistEventComponentCrawler(session, analysisDate).visit(treeRootHolder.getRoot());
session.commit();
} finally {
MyBatis.closeQuietly(session);
@@ -133,11 +133,11 @@ public class PersistEventsStep implements ComputationStep {
return "Persist component links";
}
- private class PersistEventComponentVisitor extends DepthTraversalTypeAwareVisitor {
+ private class PersistEventComponentCrawler extends DepthTraversalTypeAwareCrawler {
private final DbSession session;
private final long analysisDate;
- public PersistEventComponentVisitor(DbSession session, long analysisDate) {
+ public PersistEventComponentCrawler(DbSession session, long analysisDate) {
super(Component.Type.FILE, Order.PRE_ORDER);
this.session = session;
this.analysisDate = analysisDate;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java
index 2166e5bf42a..1880bcec4c6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java
@@ -34,11 +34,12 @@ import org.sonar.core.util.CloseableIterator;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.MyBatis;
+import org.sonar.db.protobuf.DbFileSources;
import org.sonar.db.source.FileSourceDto;
import org.sonar.db.source.FileSourceDto.Type;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.source.ComputeFileSourceData;
import org.sonar.server.computation.source.CoverageLineReader;
@@ -47,9 +48,8 @@ import org.sonar.server.computation.source.HighlightingLineReader;
import org.sonar.server.computation.source.LineReader;
import org.sonar.server.computation.source.ScmLineReader;
import org.sonar.server.computation.source.SymbolsLineReader;
-import org.sonar.db.protobuf.DbFileSources;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
public class PersistFileSourcesStep implements ComputationStep {
@@ -70,20 +70,20 @@ public class PersistFileSourcesStep implements ComputationStep {
// Don't use batch insert for file_sources since keeping all data in memory can produce OOM for big files
DbSession session = dbClient.openSession(false);
try {
- new FileSourceVisitor(session).visit(treeRootHolder.getRoot());
+ new FileSourceCrawler(session).visit(treeRootHolder.getRoot());
} finally {
MyBatis.closeQuietly(session);
}
}
- private class FileSourceVisitor extends DepthTraversalTypeAwareVisitor {
+ private class FileSourceCrawler extends DepthTraversalTypeAwareCrawler {
private final DbSession session;
private Map<String, FileSourceDto> previousFileSourcesByUuid = new HashMap<>();
private String projectUuid;
- private FileSourceVisitor(DbSession session) {
+ private FileSourceCrawler(DbSession session) {
super(Component.Type.FILE, PRE_ORDER);
this.session = session;
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java
index 516eb979ac0..e57968b5cea 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java
@@ -33,7 +33,7 @@ import org.sonar.db.DbSession;
import org.sonar.db.measure.MeasureDto;
import org.sonar.server.computation.component.Component;
import org.sonar.server.computation.component.DbIdsRepository;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.measure.BestValueOptimization;
import org.sonar.server.computation.measure.Measure;
@@ -46,7 +46,7 @@ import static com.google.common.collect.FluentIterable.from;
import static org.sonar.api.measures.CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION_KEY;
import static org.sonar.api.measures.CoreMetrics.FILE_COMPLEXITY_DISTRIBUTION_KEY;
import static org.sonar.api.measures.CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION_KEY;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
public class PersistMeasuresStep implements ComputationStep {
@@ -83,17 +83,17 @@ public class PersistMeasuresStep implements ComputationStep {
public void execute() {
DbSession dbSession = dbClient.openSession(true);
try {
- new MeasureVisitor(dbSession).visit(treeRootHolder.getRoot());
+ new MeasureCrawler(dbSession).visit(treeRootHolder.getRoot());
dbSession.commit();
} finally {
dbSession.close();
}
}
- private class MeasureVisitor extends DepthTraversalTypeAwareVisitor {
+ private class MeasureCrawler extends DepthTraversalTypeAwareCrawler {
private final DbSession session;
- private MeasureVisitor(DbSession session) {
+ private MeasureCrawler(DbSession session) {
super(Component.Type.FILE, PRE_ORDER);
this.session = session;
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStep.java
index e7404d50684..cd69f4d4f89 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStep.java
@@ -26,20 +26,20 @@ import javax.annotation.Nullable;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.utils.System2;
import org.sonar.batch.protocol.output.BatchReport;
-import org.sonar.db.measure.MeasureDto;
+import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.MyBatis;
+import org.sonar.db.measure.MeasureDto;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.computation.component.Component;
import org.sonar.server.computation.component.DbIdsRepository;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.metric.MetricRepository;
-import org.sonar.db.DbClient;
import org.sonar.server.source.index.SourceLineIndex;
import static com.google.common.base.Objects.firstNonNull;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
public class PersistNumberOfDaysSinceLastCommitStep implements ComputationStep {
@@ -71,7 +71,7 @@ public class PersistNumberOfDaysSinceLastCommitStep implements ComputationStep {
@Override
public void execute() {
- NumberOfDaysSinceLastCommitVisitor visitor = new NumberOfDaysSinceLastCommitVisitor();
+ NumberOfDaysSinceLastCommitCrawler visitor = new NumberOfDaysSinceLastCommitCrawler();
Component project = treeRootHolder.getRoot();
visitor.visit(project);
@@ -106,11 +106,11 @@ public class PersistNumberOfDaysSinceLastCommitStep implements ComputationStep {
}
}
- private class NumberOfDaysSinceLastCommitVisitor extends DepthTraversalTypeAwareVisitor {
+ private class NumberOfDaysSinceLastCommitCrawler extends DepthTraversalTypeAwareCrawler {
private long lastCommitTimestampFromReport = 0L;
- private NumberOfDaysSinceLastCommitVisitor() {
+ private NumberOfDaysSinceLastCommitCrawler() {
super(Component.Type.FILE, PRE_ORDER);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistProjectLinksStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistProjectLinksStep.java
index 0fabd53203b..b14e7a3a39a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistProjectLinksStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistProjectLinksStep.java
@@ -31,17 +31,17 @@ import javax.annotation.Nullable;
import org.sonar.api.i18n.I18n;
import org.sonar.batch.protocol.Constants;
import org.sonar.batch.protocol.output.BatchReport;
-import org.sonar.db.component.ComponentLinkDto;
+import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.MyBatis;
+import org.sonar.db.component.ComponentLinkDto;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
-import org.sonar.db.DbClient;
import static com.google.common.collect.Sets.newHashSet;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
/**
* Persist project and module links
@@ -72,18 +72,18 @@ public class PersistProjectLinksStep implements ComputationStep {
public void execute() {
DbSession session = dbClient.openSession(false);
try {
- new PorjectLinkVisitor(session).visit(treeRootHolder.getRoot());
+ new PorjectLinkCrawler(session).visit(treeRootHolder.getRoot());
session.commit();
} finally {
MyBatis.closeQuietly(session);
}
}
- private class PorjectLinkVisitor extends DepthTraversalTypeAwareVisitor {
+ private class PorjectLinkCrawler extends DepthTraversalTypeAwareCrawler {
private final DbSession session;
- private PorjectLinkVisitor(DbSession session) {
+ private PorjectLinkCrawler(DbSession session) {
super(Component.Type.FILE, PRE_ORDER);
this.session = session;
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistTestsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistTestsStep.java
index 7bc20137b80..5bbacc7f002 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistTestsStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistTestsStep.java
@@ -49,7 +49,7 @@ import org.sonar.db.source.FileSourceDto;
import org.sonar.db.source.FileSourceDto.Type;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
public class PersistTestsStep implements ComputationStep {
@@ -72,7 +72,7 @@ public class PersistTestsStep implements ComputationStep {
public void execute() {
DbSession session = dbClient.openSession(true);
try {
- TestDepthTraversalTypeAwareVisitor visitor = new TestDepthTraversalTypeAwareVisitor(session);
+ TestDepthTraversalTypeAwareCrawler visitor = new TestDepthTraversalTypeAwareCrawler(session);
visitor.visit(treeRootHolder.getRoot());
session.commit();
if (visitor.hasUnprocessedCoverageDetails) {
@@ -88,14 +88,14 @@ public class PersistTestsStep implements ComputationStep {
return "Persist tests";
}
- private class TestDepthTraversalTypeAwareVisitor extends DepthTraversalTypeAwareVisitor {
+ private class TestDepthTraversalTypeAwareCrawler extends DepthTraversalTypeAwareCrawler {
final DbSession session;
final Map<String, FileSourceDto> existingFileSourcesByUuid;
final String projectUuid;
final String projectKey;
boolean hasUnprocessedCoverageDetails = false;
- public TestDepthTraversalTypeAwareVisitor(DbSession session) {
+ public TestDepthTraversalTypeAwareCrawler(DbSession session) {
super(Component.Type.FILE, Order.PRE_ORDER);
this.session = session;
this.existingFileSourcesByUuid = new HashMap<>();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateEventsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateEventsStep.java
index 0fc25e9e58b..0e045ef70c8 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateEventsStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateEventsStep.java
@@ -26,7 +26,7 @@ import org.sonar.api.notifications.Notification;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.event.Event;
import org.sonar.server.computation.event.EventRepository;
@@ -61,7 +61,7 @@ public class QualityGateEventsStep implements ComputationStep {
@Override
public void execute() {
- new DepthTraversalTypeAwareVisitor(Component.Type.PROJECT, DepthTraversalTypeAwareVisitor.Order.PRE_ORDER) {
+ new DepthTraversalTypeAwareCrawler(Component.Type.PROJECT, DepthTraversalTypeAwareCrawler.Order.PRE_ORDER) {
@Override
public void visitProject(Component project) {
executeForProject(project);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateLoadingStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateLoadingStep.java
index 22e4f9787bc..1cbd1cde4f3 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateLoadingStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateLoadingStep.java
@@ -26,7 +26,7 @@ import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.server.computation.ReportQueue;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.ProjectSettingsRepository;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.qualitygate.MutableQualityGateHolder;
@@ -34,7 +34,7 @@ import org.sonar.server.computation.qualitygate.QualityGate;
import org.sonar.server.computation.qualitygate.QualityGateService;
import static org.sonar.server.computation.component.Component.Type.PROJECT;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
/**
* This step retrieves the QualityGate for the current {@link ReportQueue.Item} and stores it in
@@ -60,7 +60,7 @@ public class QualityGateLoadingStep implements ComputationStep {
@Override
public void execute() {
- new DepthTraversalTypeAwareVisitor(PROJECT, PRE_ORDER) {
+ new DepthTraversalTypeAwareCrawler(PROJECT, PRE_ORDER) {
@Override
public void visitProject(Component project) {
executeForProject(project);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateMeasuresStep.java
index bc9406c721a..9d65c9c1e0e 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityGateMeasuresStep.java
@@ -27,7 +27,7 @@ import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.measure.Measure;
import org.sonar.server.computation.measure.MeasureRepository;
@@ -44,7 +44,7 @@ import org.sonar.server.computation.qualitygate.QualityGate;
import org.sonar.server.computation.qualitygate.QualityGateHolder;
import static org.sonar.server.computation.component.Component.Type.PROJECT;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
/**
* This step:
@@ -77,7 +77,7 @@ public class QualityGateMeasuresStep implements ComputationStep {
@Override
public void execute() {
- new DepthTraversalTypeAwareVisitor(PROJECT, PRE_ORDER) {
+ new DepthTraversalTypeAwareCrawler(PROJECT, PRE_ORDER) {
@Override
public void visitProject(Component project) {
executeForProject(project);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java
index e8541194f51..003e044e533 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/QualityProfileEventsStep.java
@@ -31,7 +31,7 @@ import org.sonar.api.resources.Language;
import org.sonar.api.utils.KeyValueFormat;
import org.sonar.core.util.UtcDateUtils;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.event.Event;
import org.sonar.server.computation.event.EventRepository;
@@ -42,7 +42,7 @@ import org.sonar.server.computation.metric.MetricRepository;
import org.sonar.server.computation.qualityprofile.QPMeasureData;
import org.sonar.server.computation.qualityprofile.QualityProfile;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
/**
* Computation of quality profile events
@@ -68,7 +68,7 @@ public class QualityProfileEventsStep implements ComputationStep {
@Override
public void execute() {
- new DepthTraversalTypeAwareVisitor(Component.Type.PROJECT, POST_ORDER) {
+ new DepthTraversalTypeAwareCrawler(Component.Type.PROJECT, POST_ORDER) {
@Override
public void visitProject(Component tree) {
executeForProject(tree);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/SizeMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/SizeMeasuresStep.java
index 4d43c8dd408..373b5141bd2 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/SizeMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/SizeMeasuresStep.java
@@ -22,10 +22,10 @@ package org.sonar.server.computation.step;
import com.google.common.collect.ImmutableList;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.PathAwareVisitor;
+import org.sonar.server.computation.component.PathAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.formula.Formula;
-import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor;
+import org.sonar.server.computation.formula.FormulaExecutorComponentCrawler;
import org.sonar.server.computation.formula.SumFormula;
import org.sonar.server.computation.measure.MeasureRepository;
import org.sonar.server.computation.metric.Metric;
@@ -40,7 +40,7 @@ import static org.sonar.api.measures.CoreMetrics.LINES_KEY;
import static org.sonar.api.measures.CoreMetrics.NCLOC_KEY;
import static org.sonar.api.measures.CoreMetrics.STATEMENTS_KEY;
import static org.sonar.server.computation.component.Component.Type.FILE;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
import static org.sonar.server.computation.measure.Measure.newMeasureBuilder;
/**
@@ -74,9 +74,9 @@ public class SizeMeasuresStep implements ComputationStep {
Metric fileMetric = metricRepository.getByKey(CoreMetrics.FILES_KEY);
Metric directoryMetric = metricRepository.getByKey(CoreMetrics.DIRECTORIES_KEY);
- new FileAndDirectoryMeasureVisitor(directoryMetric, fileMetric)
+ new FileAndDirectoryMeasureCrawler(directoryMetric, fileMetric)
.visit(treeRootHolder.getRoot());
- FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(AGGREGATED_SIZE_MEASURE_FORMULAS)
.visit(treeRootHolder.getRoot());
}
@@ -86,11 +86,11 @@ public class SizeMeasuresStep implements ComputationStep {
return "File and Directory measures";
}
- private class FileAndDirectoryMeasureVisitor extends PathAwareVisitor<Counter> {
+ private class FileAndDirectoryMeasureCrawler extends PathAwareCrawler<Counter> {
private final Metric directoryMetric;
private final Metric fileMetric;
- public FileAndDirectoryMeasureVisitor(Metric directoryMetric, Metric fileMetric) {
+ public FileAndDirectoryMeasureCrawler(Metric directoryMetric, Metric fileMetric) {
super(FILE, POST_ORDER, COUNTER_STACK_ELEMENT_FACTORY);
this.directoryMetric = directoryMetric;
this.fileMetric = fileMetric;
@@ -142,7 +142,7 @@ public class SizeMeasuresStep implements ComputationStep {
}
- private static class CounterStackElementFactory extends PathAwareVisitor.SimpleStackElementFactory<Counter> {
+ private static class CounterStackElementFactory extends PathAwareCrawler.SimpleStackElementFactory<Counter> {
@Override
public Counter createForAny(Component component) {
return new Counter();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/SqaleMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/SqaleMeasuresStep.java
index 0a9ff1a8301..38fa3a2ab11 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/SqaleMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/SqaleMeasuresStep.java
@@ -22,7 +22,7 @@ package org.sonar.server.computation.step;
import com.google.common.base.Optional;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.PathAwareVisitor;
+import org.sonar.server.computation.component.PathAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.measure.Measure;
import org.sonar.server.computation.measure.MeasureRepository;
@@ -49,7 +49,7 @@ public class SqaleMeasuresStep implements ComputationStep {
@Override
public void execute() {
- new SqaleMeasuresVisitor().visit(treeRootHolder.getRoot());
+ new SqaleMeasuresCrawler().visit(treeRootHolder.getRoot());
}
@Override
@@ -57,13 +57,13 @@ public class SqaleMeasuresStep implements ComputationStep {
return "Compute Sqale related measures";
}
- private class SqaleMeasuresVisitor extends PathAwareVisitor<DevelopmentCost> {
+ private class SqaleMeasuresCrawler extends PathAwareCrawler<DevelopmentCost> {
private final Metric developmentCostMetric;
private final Metric technicalDebtMetric;
private final Metric debtRatioMetric;
private final Metric sqaleRatingMetric;
- public SqaleMeasuresVisitor() {
+ public SqaleMeasuresCrawler() {
super(Component.Type.FILE, Order.POST_ORDER, new SimpleStackElementFactory<DevelopmentCost>() {
@Override
public DevelopmentCost createForAny(Component component) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/UnitTestMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/UnitTestMeasuresStep.java
index becb1c0bb4f..c4ea162f3b5 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/UnitTestMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/UnitTestMeasuresStep.java
@@ -28,7 +28,7 @@ import org.sonar.server.computation.formula.Counter;
import org.sonar.server.computation.formula.CreateMeasureContext;
import org.sonar.server.computation.formula.FileAggregateContext;
import org.sonar.server.computation.formula.Formula;
-import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor;
+import org.sonar.server.computation.formula.FormulaExecutorComponentCrawler;
import org.sonar.server.computation.formula.SumCounter;
import org.sonar.server.computation.formula.SumFormula;
import org.sonar.server.computation.measure.Measure;
@@ -67,7 +67,7 @@ public class UnitTestMeasuresStep implements ComputationStep {
@Override
public void execute() {
- FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(FORMULAS)
.visit(treeRootHolder.getRoot());
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ValidateProjectStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ValidateProjectStep.java
index ba1dfc6acec..af6f3a24a35 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ValidateProjectStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ValidateProjectStep.java
@@ -42,7 +42,7 @@ import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.SnapshotDto;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import static org.sonar.api.utils.DateUtils.formatDateTime;
@@ -80,7 +80,7 @@ public class ValidateProjectStep implements ComputationStep {
try {
List<ComponentDto> baseModules = dbClient.componentDao().selectEnabledModulesFromProjectKey(session, treeRootHolder.getRoot().getKey());
Map<String, ComponentDto> baseModulesByKey = FluentIterable.from(baseModules).uniqueIndex(ComponentDtoToKey.INSTANCE);
- ValidateProjectsVisitor visitor = new ValidateProjectsVisitor(session, dbClient.componentDao(),
+ ValidateProjectsCrawler visitor = new ValidateProjectsCrawler(session, dbClient.componentDao(),
settings.getBoolean(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION), baseModulesByKey);
visitor.visit(treeRootHolder.getRoot());
@@ -97,7 +97,7 @@ public class ValidateProjectStep implements ComputationStep {
return "Validate project and modules keys";
}
- private class ValidateProjectsVisitor extends DepthTraversalTypeAwareVisitor {
+ private class ValidateProjectsCrawler extends DepthTraversalTypeAwareCrawler {
private final DbSession session;
private final ComponentDao componentDao;
private final boolean preventAutomaticProjectCreation;
@@ -106,7 +106,7 @@ public class ValidateProjectStep implements ComputationStep {
private Component rawProject;
- public ValidateProjectsVisitor(DbSession session, ComponentDao componentDao, boolean preventAutomaticProjectCreation, Map<String, ComponentDto> baseModulesByKey) {
+ public ValidateProjectsCrawler(DbSession session, ComponentDao componentDao, boolean preventAutomaticProjectCreation, Map<String, ComponentDto> baseModulesByKey) {
super(Component.Type.MODULE, Order.PRE_ORDER);
this.session = session;
this.componentDao = componentDao;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java
index f5fc2d96b05..5c3cc2e2c43 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java
@@ -26,11 +26,11 @@ import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.MutableTreeRootHolder;
import org.sonar.server.computation.component.TreeRootHolder;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
public class TreeRootHolderRule implements TestRule, MutableTreeRootHolder {
private Component root;
@@ -77,7 +77,7 @@ public class TreeRootHolderRule implements TestRule, MutableTreeRootHolder {
public TreeRootHolderRule setRoot(Component newRoot) {
this.root = Objects.requireNonNull(newRoot);
- new DepthTraversalTypeAwareVisitor(Component.Type.FILE, POST_ORDER) {
+ new DepthTraversalTypeAwareCrawler(Component.Type.FILE, POST_ORDER) {
@Override
public void visitAny(Component component) {
componentsByRef.put(component.getRef(), component);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareCrawlerTest.java
index 2ee69e3d78c..9d14c21c66f 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareVisitorTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PathAwareCrawlerTest.java
@@ -38,10 +38,10 @@ 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.ComponentVisitor.Order.POST_ORDER;
-import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
-public class PathAwareVisitorTest {
+public class PathAwareCrawlerTest {
private static final int ROOT_REF = 1;
private static final DumbComponent SOME_TREE_ROOT = DumbComponent.builder(PROJECT, ROOT_REF)
@@ -75,7 +75,7 @@ public class PathAwareVisitorTest {
@Test
public void verify_preOrder_visit_call_when_visit_tree_with_depth_FILE() {
- TestPathAwareVisitor underTest = new TestPathAwareVisitor(FILE, PRE_ORDER);
+ TestPathAwareCrawler underTest = new TestPathAwareCrawler(FILE, PRE_ORDER);
underTest.visit(SOME_TREE_ROOT);
Iterator<CallRecord> expected = of(
@@ -107,7 +107,7 @@ public class PathAwareVisitorTest {
@Test
public void verify_preOrder_visit_call_when_visit_tree_with_depth_DIRECTORY() {
- TestPathAwareVisitor underTest = new TestPathAwareVisitor(DIRECTORY, PRE_ORDER);
+ TestPathAwareCrawler underTest = new TestPathAwareCrawler(DIRECTORY, PRE_ORDER);
underTest.visit(SOME_TREE_ROOT);
Iterator<CallRecord> expected = of(
@@ -131,7 +131,7 @@ public class PathAwareVisitorTest {
@Test
public void verify_preOrder_visit_call_when_visit_tree_with_depth_MODULE() {
- TestPathAwareVisitor underTest = new TestPathAwareVisitor(MODULE, PRE_ORDER);
+ TestPathAwareCrawler underTest = new TestPathAwareCrawler(MODULE, PRE_ORDER);
underTest.visit(SOME_TREE_ROOT);
Iterator<CallRecord> expected = of(
@@ -149,7 +149,7 @@ public class PathAwareVisitorTest {
@Test
public void verify_preOrder_visit_call_when_visit_tree_with_depth_PROJECT() {
- TestPathAwareVisitor underTest = new TestPathAwareVisitor(PROJECT, PRE_ORDER);
+ TestPathAwareCrawler underTest = new TestPathAwareCrawler(PROJECT, PRE_ORDER);
underTest.visit(SOME_TREE_ROOT);
Iterator<CallRecord> expected = of(
@@ -161,7 +161,7 @@ public class PathAwareVisitorTest {
@Test
public void verify_postOrder_visit_call_when_visit_tree_with_depth_FILE() {
- TestPathAwareVisitor underTest = new TestPathAwareVisitor(FILE, POST_ORDER);
+ TestPathAwareCrawler underTest = new TestPathAwareCrawler(FILE, POST_ORDER);
underTest.visit(SOME_TREE_ROOT);
Iterator<CallRecord> expected = of(
@@ -193,7 +193,7 @@ public class PathAwareVisitorTest {
@Test
public void verify_postOrder_visit_call_when_visit_tree_with_depth_DIRECTORY() {
- TestPathAwareVisitor underTest = new TestPathAwareVisitor(DIRECTORY, POST_ORDER);
+ TestPathAwareCrawler underTest = new TestPathAwareCrawler(DIRECTORY, POST_ORDER);
underTest.visit(SOME_TREE_ROOT);
Iterator<CallRecord> expected = of(
@@ -217,7 +217,7 @@ public class PathAwareVisitorTest {
@Test
public void verify_postOrder_visit_call_when_visit_tree_with_depth_MODULE() {
- TestPathAwareVisitor underTest = new TestPathAwareVisitor(MODULE, POST_ORDER);
+ TestPathAwareCrawler underTest = new TestPathAwareCrawler(MODULE, POST_ORDER);
underTest.visit(SOME_TREE_ROOT);
Iterator<CallRecord> expected = of(
@@ -235,7 +235,7 @@ public class PathAwareVisitorTest {
@Test
public void verify_postOrder_visit_call_when_visit_tree_with_depth_PROJECT() {
- TestPathAwareVisitor underTest = new TestPathAwareVisitor(PROJECT, POST_ORDER);
+ TestPathAwareCrawler underTest = new TestPathAwareCrawler(PROJECT, POST_ORDER);
underTest.visit(SOME_TREE_ROOT);
Iterator<CallRecord> expected = of(
@@ -255,10 +255,10 @@ public class PathAwareVisitorTest {
return new CallRecord(method, currentRef, currentRef, parentRef, ROOT_REF, path);
}
- private static class TestPathAwareVisitor extends PathAwareVisitor<Integer> {
+ private static class TestPathAwareCrawler extends PathAwareCrawler<Integer> {
private final List<CallRecord> callsRecords = new ArrayList<>();
- public TestPathAwareVisitor(Component.Type maxDepth, ComponentVisitor.Order order) {
+ public TestPathAwareCrawler(Component.Type maxDepth, ComponentCrawler.Order order) {
super(maxDepth, order, new SimpleStackElementFactory<Integer>() {
@Override
public Integer createForAny(Component component) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareCrawlerTest.java
index 94ebd8fa8b2..1f0a0f08193 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareVisitorTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PostOrderDepthTraversalTypeAwareCrawlerTest.java
@@ -29,9 +29,9 @@ 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.ComponentVisitor.Order.POST_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.POST_ORDER;
-public class PostOrderDepthTraversalTypeAwareVisitorTest {
+public class PostOrderDepthTraversalTypeAwareCrawlerTest {
private static final Component FILE_5 = component(FILE, 5);
private static final Component FILE_6 = component(FILE, 6);
@@ -40,19 +40,19 @@ public class PostOrderDepthTraversalTypeAwareVisitorTest {
private static final Component MODULE_2 = component(MODULE, 2, MODULE_3);
private static final Component COMPONENT_TREE = component(PROJECT, 1, MODULE_2);
- private final DepthTraversalTypeAwareVisitor spyProjectVisitor = spy(new DepthTraversalTypeAwareVisitor(PROJECT, POST_ORDER) {
+ private final DepthTraversalTypeAwareCrawler spyProjectVisitor = spy(new DepthTraversalTypeAwareCrawler(PROJECT, POST_ORDER) {
});
- private final DepthTraversalTypeAwareVisitor spyModuleVisitor = spy(new DepthTraversalTypeAwareVisitor(MODULE, POST_ORDER) {
+ private final DepthTraversalTypeAwareCrawler spyModuleVisitor = spy(new DepthTraversalTypeAwareCrawler(MODULE, POST_ORDER) {
});
- private final DepthTraversalTypeAwareVisitor spyDirectoryVisitor = spy(new DepthTraversalTypeAwareVisitor(DIRECTORY, POST_ORDER) {
+ private final DepthTraversalTypeAwareCrawler spyDirectoryVisitor = spy(new DepthTraversalTypeAwareCrawler(DIRECTORY, POST_ORDER) {
});
- private final DepthTraversalTypeAwareVisitor spyFileVisitor = spy(new DepthTraversalTypeAwareVisitor(FILE, POST_ORDER) {
+ private final DepthTraversalTypeAwareCrawler spyFileVisitor = spy(new DepthTraversalTypeAwareCrawler(FILE, POST_ORDER) {
});
private final InOrder inOrder = inOrder(spyProjectVisitor, spyModuleVisitor, spyDirectoryVisitor, spyFileVisitor);
@Test(expected = NullPointerException.class)
public void non_null_max_depth_fast_fail() {
- new DepthTraversalTypeAwareVisitor(null, POST_ORDER) {
+ new DepthTraversalTypeAwareCrawler(null, POST_ORDER) {
};
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareCrawlerTest.java
index 8385d345cdd..d3650860a95 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareVisitorTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/component/PreOrderDepthTraversalTypeAwareCrawlerTest.java
@@ -29,9 +29,9 @@ 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.ComponentVisitor.Order.PRE_ORDER;
+import static org.sonar.server.computation.component.ComponentCrawler.Order.PRE_ORDER;
-public class PreOrderDepthTraversalTypeAwareVisitorTest {
+public class PreOrderDepthTraversalTypeAwareCrawlerTest {
private static final Component FILE_5 = component(FILE, 5);
private static final Component FILE_6 = component(FILE, 6);
@@ -40,19 +40,19 @@ public class PreOrderDepthTraversalTypeAwareVisitorTest {
private static final Component MODULE_2 = component(MODULE, 2, MODULE_3);
private static final Component COMPONENT_TREE = component(PROJECT, 1, MODULE_2);
- private final DepthTraversalTypeAwareVisitor spyProjectVisitor = spy(new DepthTraversalTypeAwareVisitor(PROJECT, PRE_ORDER) {
+ private final DepthTraversalTypeAwareCrawler spyProjectVisitor = spy(new DepthTraversalTypeAwareCrawler(PROJECT, PRE_ORDER) {
});
- private final DepthTraversalTypeAwareVisitor spyModuleVisitor = spy(new DepthTraversalTypeAwareVisitor(MODULE, PRE_ORDER) {
+ private final DepthTraversalTypeAwareCrawler spyModuleVisitor = spy(new DepthTraversalTypeAwareCrawler(MODULE, PRE_ORDER) {
});
- private final DepthTraversalTypeAwareVisitor spyDirectoryVisitor = spy(new DepthTraversalTypeAwareVisitor(DIRECTORY, PRE_ORDER) {
+ private final DepthTraversalTypeAwareCrawler spyDirectoryVisitor = spy(new DepthTraversalTypeAwareCrawler(DIRECTORY, PRE_ORDER) {
});
- private final DepthTraversalTypeAwareVisitor spyFileVisitor = spy(new DepthTraversalTypeAwareVisitor(FILE, PRE_ORDER) {
+ private final DepthTraversalTypeAwareCrawler spyFileVisitor = spy(new DepthTraversalTypeAwareCrawler(FILE, PRE_ORDER) {
});
private final InOrder inOrder = inOrder(spyProjectVisitor, spyModuleVisitor, spyDirectoryVisitor, spyFileVisitor);
@Test(expected = NullPointerException.class)
public void non_null_max_depth_fast_fail() {
- new DepthTraversalTypeAwareVisitor(null, PRE_ORDER) {
+ new DepthTraversalTypeAwareCrawler(null, PRE_ORDER) {
};
}
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 a7cb098dcb8..4d3435f4fb3 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
@@ -59,11 +59,11 @@ public class AverageFormulaExecutionTest {
@Rule
public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
- FormulaExecutorComponentVisitor underTest;
+ FormulaExecutorComponentCrawler underTest;
@Before
public void setUp() throws Exception {
- underTest = FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ underTest = FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(Lists.<Formula>newArrayList(
AverageFormula.Builder.newBuilder()
.setOutputMetricKey(FUNCTION_COMPLEXITY_KEY)
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 cfcf9fb9740..cf3d6d73760 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
@@ -51,11 +51,11 @@ public class DistributionFormulaExecutionTest {
@Rule
public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
- FormulaExecutorComponentVisitor underTest;
+ FormulaExecutorComponentCrawler underTest;
@Before
public void setUp() throws Exception {
- underTest = FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ underTest = FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(Lists.<Formula>newArrayList(new DistributionFormula(FUNCTION_COMPLEXITY_DISTRIBUTION_KEY)));
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawlerTest.java
index 37a70b4cdd9..fec938afcf1 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentVisitorTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/FormulaExecutorComponentCrawlerTest.java
@@ -51,7 +51,7 @@ 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 FormulaExecutorComponentVisitorTest {
+public class FormulaExecutorComponentCrawlerTest {
public static final DumbComponent BALANCED_COMPONENT_TREE = DumbComponent.builder(PROJECT, 1)
.addChildren(
DumbComponent.builder(MODULE, 11)
@@ -84,7 +84,7 @@ public class FormulaExecutorComponentVisitorTest {
public PeriodsHolderRule periodsHolder = new PeriodsHolderRule()
.setPeriods(new Period(2, "some mode", null, 95l, 756l), new Period(5, "some other mode", null, 756L, 956L));
- FormulaExecutorComponentVisitor underTest = FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler underTest = FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.withVariationSupport(periodsHolder)
.buildFor(ImmutableList.<Formula>of(new FakeFormula(), new FakeVariationFormula()));
@@ -117,7 +117,7 @@ public class FormulaExecutorComponentVisitorTest {
measureRepository.addRawMeasure(1112, LINES_KEY, newMeasureBuilder().create(8));
measureRepository.addRawMeasure(1211, LINES_KEY, newMeasureBuilder().create(2));
- FormulaExecutorComponentVisitor underTest = FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ FormulaExecutorComponentCrawler underTest = FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.withVariationSupport(periodsHolder)
.buildFor(ImmutableList.<Formula>of(new FakeMultiMetricFormula()));
underTest.visit(BALANCED_COMPONENT_TREE);
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 5701d65337b..5dd73ba9690 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
@@ -51,11 +51,11 @@ public class SumFormulaExecutionTest {
@Rule
public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
- FormulaExecutorComponentVisitor underTest;
+ FormulaExecutorComponentCrawler underTest;
@Before
public void setUp() throws Exception {
- underTest = FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
+ underTest = FormulaExecutorComponentCrawler.newBuilder(metricRepository, measureRepository)
.buildFor(Lists.<Formula>newArrayList(new SumFormula(LINES_KEY)));
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
index e3ab287dc6d..ea612d42e8d 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
@@ -33,8 +33,8 @@ import javax.annotation.Nullable;
import org.junit.rules.ExternalResource;
import org.sonar.db.rule.RuleDto;
import org.sonar.server.computation.component.Component;
-import org.sonar.server.computation.component.ComponentVisitor;
-import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
+import org.sonar.server.computation.component.ComponentCrawler;
+import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.debt.Characteristic;
import org.sonar.server.computation.metric.Metric;
@@ -386,7 +386,7 @@ public class MeasureRepositoryRule extends ExternalResource implements MeasureRe
private final Map<Integer, Component> componentsByRef = new HashMap<>();
public TreeComponentProvider(Component root) {
- new DepthTraversalTypeAwareVisitor(Component.Type.FILE, ComponentVisitor.Order.PRE_ORDER) {
+ new DepthTraversalTypeAwareCrawler(Component.Type.FILE, ComponentCrawler.Order.PRE_ORDER) {
@Override
public void visitAny(Component component) {
checkState(!componentsByRef.containsKey(component.getRef()), "Tree contains more than one component with ref " + component.getRef());