diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-07-24 10:01:58 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-07-24 10:02:08 +0200 |
commit | 3d5c0f21706bd44755de23ead87e833f2a12db6f (patch) | |
tree | b6ed44b1a6bfedeff347987c55406a6e8bd5108e /sonar-batch/src | |
parent | c31cbfe24543d7e7e35380ef941e92cef9aac77c (diff) | |
download | sonarqube-3d5c0f21706bd44755de23ead87e833f2a12db6f.tar.gz sonarqube-3d5c0f21706bd44755de23ead87e833f2a12db6f.zip |
Add @deprecated and all formulas api and remove some decorator usage in test
Diffstat (limited to 'sonar-batch/src')
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java b/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java index 1ff8b82c9c4..7ef1d23673d 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java @@ -30,7 +30,6 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.CoreProperties; import org.sonar.api.batch.Decorator; -import org.sonar.api.batch.DecoratorContext; import org.sonar.api.batch.Initializer; import org.sonar.api.batch.PostJob; import org.sonar.api.batch.Sensor; @@ -48,7 +47,6 @@ import org.sonar.api.batch.events.SensorExecutionHandler.SensorExecutionEvent; import org.sonar.api.batch.events.SensorsPhaseHandler; import org.sonar.api.batch.events.SensorsPhaseHandler.SensorsPhaseEvent; import org.sonar.api.resources.Project; -import org.sonar.api.resources.Resource; import org.sonar.api.utils.System2; import org.sonar.batch.bootstrap.BootstrapProperties; import org.sonar.batch.events.BatchStepEvent; @@ -83,10 +81,8 @@ public class PhasesSumUpTimeProfilerTest { assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.INIT).getProfilingPerItem(new FakeInitializer()).totalTime()).isEqualTo(7L); assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.SENSOR).getProfilingPerItem(new FakeSensor()).totalTime()).isEqualTo(10L); - assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.DECORATOR).getProfilingPerItem(new FakeDecorator1()).totalTime()).isEqualTo(20L); assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.POSTJOB).getProfilingPerItem(new FakePostJob()).totalTime()).isEqualTo(30L); assertThat(profiler.currentModuleProfiling.getProfilingPerBatchStep("Free memory").totalTime()).isEqualTo(9L); - } @Test @@ -102,14 +98,10 @@ public class PhasesSumUpTimeProfilerTest { assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.INIT).getProfilingPerItem(new FakeInitializer()).totalTime()).isEqualTo(7L); assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.SENSOR).getProfilingPerItem(new FakeSensor()).totalTime()).isEqualTo(10L); - assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.DECORATOR).getProfilingPerItem(new FakeDecorator1()).totalTime()).isEqualTo(20L); - assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.DECORATOR).getProfilingPerItem(new FakeDecorator2()).totalTime()).isEqualTo(10L); assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.POSTJOB).getProfilingPerItem(new FakePostJob()).totalTime()).isEqualTo(30L); assertThat(profiler.totalProfiling.getProfilingPerPhase(Phase.INIT).getProfilingPerItem(new FakeInitializer()).totalTime()).isEqualTo(21L); assertThat(profiler.totalProfiling.getProfilingPerPhase(Phase.SENSOR).getProfilingPerItem(new FakeSensor()).totalTime()).isEqualTo(30L); - assertThat(profiler.totalProfiling.getProfilingPerPhase(Phase.DECORATOR).getProfilingPerItem(new FakeDecorator1()).totalTime()).isEqualTo(60L); - assertThat(profiler.totalProfiling.getProfilingPerPhase(Phase.DECORATOR).getProfilingPerItem(new FakeDecorator2()).totalTime()).isEqualTo(30L); assertThat(profiler.totalProfiling.getProfilingPerPhase(Phase.POSTJOB).getProfilingPerItem(new FakePostJob()).totalTime()).isEqualTo(90L); } @@ -156,42 +148,12 @@ public class PhasesSumUpTimeProfilerTest { profiler.onProjectAnalysis(projectEvent(module, true)); initializerPhase(profiler); sensorPhase(profiler); - decoratorPhase(profiler); postJobPhase(profiler); batchStep(profiler); // End of moduleA profiler.onProjectAnalysis(projectEvent(module, false)); } - private void decoratorPhase(PhasesSumUpTimeProfiler profiler) { - Decorator decorator1 = new FakeDecorator1(); - Decorator decorator2 = new FakeDecorator2(); - // Start of decorator phase - profiler.onDecoratorsPhase(decoratorsEvent(true)); - // Start of decorator 1 - profiler.onDecoratorExecution(decoratorEvent(decorator1, true)); - clock.sleep(10); - // End of decorator 1 - profiler.onDecoratorExecution(decoratorEvent(decorator1, false)); - // Start of decorator 2 - profiler.onDecoratorExecution(decoratorEvent(decorator2, true)); - clock.sleep(5); - // End of decorator 2 - profiler.onDecoratorExecution(decoratorEvent(decorator2, false)); - // Start of decorator 1 - profiler.onDecoratorExecution(decoratorEvent(decorator1, true)); - clock.sleep(10); - // End of decorator 1 - profiler.onDecoratorExecution(decoratorEvent(decorator1, false)); - // Start of decorator 2 - profiler.onDecoratorExecution(decoratorEvent(decorator2, true)); - clock.sleep(5); - // End of decorator 2 - profiler.onDecoratorExecution(decoratorEvent(decorator2, false)); - // End of decorator phase - profiler.onDecoratorsPhase(decoratorsEvent(false)); - } - private void batchStep(PhasesSumUpTimeProfiler profiler) { // Start of batch step profiler.onBatchStep(new BatchStepEvent("Free memory", true)); @@ -440,28 +402,6 @@ public class PhasesSumUpTimeProfilerTest { } } - public class FakeDecorator1 implements Decorator { - @Override - public void decorate(Resource resource, DecoratorContext context) { - } - - @Override - public boolean shouldExecuteOnProject(Project project) { - return true; - } - } - - public class FakeDecorator2 implements Decorator { - @Override - public void decorate(Resource resource, DecoratorContext context) { - } - - @Override - public boolean shouldExecuteOnProject(Project project) { - return true; - } - } - public class FakePostJob implements PostJob { @Override public void executeOn(Project project, SensorContext context) { |