From 4bab89867b0484fa9d21d0d54e6d7687d2b2f5bf Mon Sep 17 00:00:00 2001 From: David Gageot Date: Tue, 12 May 2015 10:33:55 +0200 Subject: [PATCH] Dead code --- .../org/sonar/server/tester/ServerTester.java | 25 ------------------- .../batch/mediumtest/BatchMediumTester.java | 8 ------ .../org/sonar/batch/mediumtest/Benchmark.java | 6 ----- .../mediumtest/preview/EmptyFileTest.java | 12 --------- .../preview/IncrementalModeMediumTest.java | 1 - .../batch/mediumtest/scm/ScmMediumTest.java | 8 +++--- 6 files changed, 3 insertions(+), 57 deletions(-) diff --git a/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java b/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java index 0015c8fb34e..b7c43a31c05 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java +++ b/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java @@ -19,7 +19,6 @@ */ package org.sonar.server.tester; -import com.google.common.base.Preconditions; import com.google.common.base.Throwables; import com.google.common.collect.Lists; import org.apache.commons.io.FileUtils; @@ -159,18 +158,6 @@ public class ServerTester extends ExternalResource { return this; } - public ServerTester addPluginJar(File jar) { - Preconditions.checkArgument(jar.exists() && jar.isFile(), "Plugin JAR file does not exist: " + jar.getAbsolutePath()); - try { - File pluginsDir = new File(homeDir, "extensions/plugins"); - FileUtils.forceMkdir(pluginsDir); - FileUtils.copyFileToDirectory(jar, pluginsDir); - return this; - } catch (Exception e) { - throw new IllegalStateException("Fail to copy plugin JAR file: " + jar.getAbsolutePath(), e); - } - } - /** * Set a property available for startup. Must be called before {@link #start()}. Does not affect * Elasticsearch server. @@ -222,18 +209,6 @@ public class ServerTester extends ExternalResource { } } - private void checkInSafeMode() { - if (platform == null || !platform.isInSafeMode()) { - throw new IllegalStateException("Not in safe mode"); - } - } - - private void checkNotInSafeMode() { - if (platform != null && platform.isInSafeMode()) { - throw new IllegalStateException("Already in safe mode"); - } - } - public static class Xoo implements Language { public static final String KEY = "xoo"; diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java index 743c1e887bc..9f92432a026 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java @@ -145,14 +145,6 @@ public class BatchMediumTester { serverLineHashes.byKey.put(fileKey, lineHashes); return this; } - - public BatchMediumTesterBuilder registerMetrics(List metrics) { - for (Metric m : metrics) { - registerMetric(m); - } - return this; - } - } public void start() { diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/Benchmark.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/Benchmark.java index 49d0ff34f35..d77a811e46d 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/Benchmark.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/Benchmark.java @@ -34,12 +34,6 @@ public class Benchmark extends ErrorCollector { } } - public void expectBetween(String label, long val, long min, long max) { - if (ENABLED) { - checkThat(label, val, Matchers.allOf(Matchers.greaterThan(min), Matchers.lessThan(max))); - } - } - public void expectLessThanOrEqualTo(String label, long val, long max) { if (ENABLED) { checkThat(label, val, Matchers.lessThan(max)); diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/EmptyFileTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/EmptyFileTest.java index ac5d983c1e9..385023ec1e3 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/EmptyFileTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/EmptyFileTest.java @@ -33,8 +33,6 @@ import org.sonar.batch.protocol.input.ActiveRule; import org.sonar.xoo.XooPlugin; import java.io.File; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.Date; import static org.assertj.core.api.Assertions.assertThat; @@ -47,16 +45,6 @@ public class EmptyFileTest { @Rule public LogTester logTester = new LogTester(); - private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - - private static Long date(String date) { - try { - return sdf.parse(date).getTime(); - } catch (ParseException e) { - throw new IllegalStateException(e); - } - } - public BatchMediumTester tester = BatchMediumTester.builder() .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_PREVIEW)) .registerPlugin("xoo", new XooPlugin()) diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/IncrementalModeMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/IncrementalModeMediumTest.java index 6bffe47ace2..1f1539388f3 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/IncrementalModeMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/IncrementalModeMediumTest.java @@ -144,7 +144,6 @@ public class IncrementalModeMediumTest { int openIssues = 0; int resolvedIssue = 0; for (Issue issue : result.issues()) { - System.out.println(issue.key() + " " + issue.line() + " " + issue.status()); if (issue.isNew()) { newIssues++; } else if (issue.resolution() != null) { diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/scm/ScmMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/scm/ScmMediumTest.java index 7b6d86c8f11..24484442e70 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/scm/ScmMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/scm/ScmMediumTest.java @@ -30,7 +30,6 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.sonar.batch.mediumtest.BatchMediumTester; import org.sonar.batch.mediumtest.BatchMediumTester.TaskBuilder; -import org.sonar.batch.mediumtest.TaskResult; import org.sonar.batch.protocol.input.FileData; import org.sonar.batch.protocol.output.BatchReport; import org.sonar.batch.protocol.output.BatchReport.Changesets.Changeset; @@ -74,7 +73,7 @@ public class ScmMediumTest { File baseDir = prepareProject(); - TaskResult result = tester.newTask() + tester.newTask() .properties(ImmutableMap.builder() .put("sonar.task", "scan") .put("sonar.projectBaseDir", baseDir.getAbsolutePath()) @@ -126,7 +125,7 @@ public class ScmMediumTest { // Clear file content FileUtils.write(new File(baseDir, "src/sample.xoo"), ""); - TaskResult result = tester.newTask() + tester.newTask() .properties(ImmutableMap.builder() .put("sonar.task", "scan") .put("sonar.projectBaseDir", baseDir.getAbsolutePath()) @@ -142,7 +141,6 @@ public class ScmMediumTest { BatchReport.Changesets changesets = getChangesets(baseDir, 0); assertThat(changesets).isNull(); - } @Test @@ -277,7 +275,7 @@ public class ScmMediumTest { File baseDir = prepareProject(); - TaskResult result = tester.newTask() + tester.newTask() .properties(ImmutableMap.builder() .put("sonar.task", "scan") .put("sonar.projectBaseDir", baseDir.getAbsolutePath()) -- 2.39.5