aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/Cli.java4
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/Main.java10
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java (renamed from src/main/java/org/sonarsource/scanner/cli/RunnerFactory.java)12
-rw-r--r--src/test/java/org/sonarsource/scanner/cli/MainTest.java12
-rw-r--r--src/test/java/org/sonarsource/scanner/cli/ScannerFactoryTest.java (renamed from src/test/java/org/sonarsource/scanner/cli/RunnerFactoryTest.java)17
5 files changed, 28 insertions, 27 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Cli.java b/src/main/java/org/sonarsource/scanner/cli/Cli.java
index f8f1fb8..6544cc2 100644
--- a/src/main/java/org/sonarsource/scanner/cli/Cli.java
+++ b/src/main/java/org/sonarsource/scanner/cli/Cli.java
@@ -20,7 +20,7 @@
package org.sonarsource.scanner.cli;
import java.util.Properties;
-import org.sonar.runner.api.RunnerProperties;
+import org.sonarsource.scanner.api.ScannerProperties;
class Cli {
@@ -63,7 +63,7 @@ class Cli {
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (i == 0 && arg.charAt(0) != '-') {
- props.setProperty(RunnerProperties.TASK, arg);
+ props.setProperty(ScannerProperties.TASK, arg);
} else if ("-h".equals(arg) || "--help".equals(arg)) {
printUsage();
diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java
index 7ea4f30..0f6c1eb 100644
--- a/src/main/java/org/sonarsource/scanner/cli/Main.java
+++ b/src/main/java/org/sonarsource/scanner/cli/Main.java
@@ -24,7 +24,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Properties;
-import org.sonar.runner.api.EmbeddedRunner;
+import org.sonarsource.scanner.api.EmbeddedScanner;
/**
* Arguments :
@@ -43,12 +43,12 @@ public class Main {
private final Shutdown shutdown;
private final Cli cli;
private final Conf conf;
- private EmbeddedRunner runner;
+ private EmbeddedScanner runner;
private BufferedReader inputReader;
- private RunnerFactory runnerFactory;
+ private ScannerFactory runnerFactory;
private Logs logger;
- Main(Shutdown shutdown, Cli cli, Conf conf, RunnerFactory runnerFactory, Logs logger) {
+ Main(Shutdown shutdown, Cli cli, Conf conf, ScannerFactory runnerFactory, Logs logger) {
this.shutdown = shutdown;
this.cli = cli;
this.conf = conf;
@@ -62,7 +62,7 @@ public class Main {
Cli cli = new Cli(exit, logs).parse(args);
cli.verify();
Shutdown shutdown = new Shutdown(exit, cli.isInteractive());
- Main main = new Main(shutdown, cli, new Conf(cli, logs), new RunnerFactory(logs), logs);
+ Main main = new Main(shutdown, cli, new Conf(cli, logs), new ScannerFactory(logs), logs);
main.execute();
}
diff --git a/src/main/java/org/sonarsource/scanner/cli/RunnerFactory.java b/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java
index 4bc1dce..c8144d7 100644
--- a/src/main/java/org/sonarsource/scanner/cli/RunnerFactory.java
+++ b/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java
@@ -20,19 +20,19 @@
package org.sonarsource.scanner.cli;
import java.util.Properties;
-import org.sonar.runner.api.EmbeddedRunner;
-import org.sonar.runner.api.LogOutput;
+import org.sonarsource.scanner.api.EmbeddedScanner;
+import org.sonarsource.scanner.api.LogOutput;
-class RunnerFactory {
+class ScannerFactory {
private final Logs logger;
- public RunnerFactory(Logs logger) {
+ public ScannerFactory(Logs logger) {
this.logger = logger;
}
- EmbeddedRunner create(Properties props) {
- return EmbeddedRunner.create(new DefaultLogOutput()).addGlobalProperties(props);
+ EmbeddedScanner create(Properties props) {
+ return EmbeddedScanner.create(new DefaultLogOutput()).addGlobalProperties(props);
}
class DefaultLogOutput implements LogOutput {
diff --git a/src/test/java/org/sonarsource/scanner/cli/MainTest.java b/src/test/java/org/sonarsource/scanner/cli/MainTest.java
index c0fbd65..4e5da4e 100644
--- a/src/test/java/org/sonarsource/scanner/cli/MainTest.java
+++ b/src/test/java/org/sonarsource/scanner/cli/MainTest.java
@@ -32,7 +32,7 @@ import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.sonar.runner.api.EmbeddedRunner;
+import org.sonarsource.scanner.api.EmbeddedScanner;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.any;
@@ -54,9 +54,9 @@ public class MainTest {
@Mock
private Properties properties;
@Mock
- private RunnerFactory runnerFactory;
+ private ScannerFactory runnerFactory;
@Mock
- private EmbeddedRunner runner;
+ private EmbeddedScanner runner;
@Mock
private Logs logs;
@@ -82,7 +82,7 @@ public class MainTest {
@Test
public void should_stop_on_error() {
- EmbeddedRunner runner = mock(EmbeddedRunner.class);
+ EmbeddedScanner runner = mock(EmbeddedScanner.class);
Exception e = new NullPointerException("NPE");
e = new IllegalStateException("Error", e);
doThrow(e).when(runner).runAnalysis(any(Properties.class));
@@ -126,7 +126,7 @@ public class MainTest {
when(cli.isDebugEnabled()).thenReturn(debugEnabled);
when(cli.isDisplayStackTrace()).thenReturn(stackTraceEnabled);
- EmbeddedRunner runner = mock(EmbeddedRunner.class);
+ EmbeddedScanner runner = mock(EmbeddedScanner.class);
doThrow(e).when(runner).runAnalysis(any(Properties.class));
when(runnerFactory.create(any(Properties.class))).thenReturn(runner);
@@ -140,7 +140,7 @@ public class MainTest {
@Test
public void should_not_stop_on_error_in_interactive_mode() throws Exception {
- EmbeddedRunner runner = mock(EmbeddedRunner.class);
+ EmbeddedScanner runner = mock(EmbeddedScanner.class);
doThrow(new IllegalStateException("Error")).when(runner).runAnalysis(any(Properties.class));
when(runnerFactory.create(any(Properties.class))).thenReturn(runner);
when(cli.isInteractive()).thenReturn(true);
diff --git a/src/test/java/org/sonarsource/scanner/cli/RunnerFactoryTest.java b/src/test/java/org/sonarsource/scanner/cli/ScannerFactoryTest.java
index 5807952..2e60e81 100644
--- a/src/test/java/org/sonarsource/scanner/cli/RunnerFactoryTest.java
+++ b/src/test/java/org/sonarsource/scanner/cli/ScannerFactoryTest.java
@@ -19,10 +19,11 @@
*/
package org.sonarsource.scanner.cli;
-import org.sonar.runner.api.LogOutput.Level;
+import org.sonarsource.scanner.api.EmbeddedScanner;
+import org.sonarsource.scanner.api.LogOutput;
+import org.sonarsource.scanner.api.LogOutput.Level;
import org.sonarsource.scanner.cli.Logs;
-import org.sonarsource.scanner.cli.RunnerFactory;
-import org.sonar.runner.api.LogOutput;
+import org.sonarsource.scanner.cli.ScannerFactory;
import org.junit.Before;
import java.util.Properties;
@@ -33,10 +34,10 @@ import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.mock;
import org.junit.Test;
-import org.sonar.runner.api.EmbeddedRunner;
+
import static org.fest.assertions.Assertions.assertThat;
-public class RunnerFactoryTest {
+public class ScannerFactoryTest {
Properties props = new Properties();
Logs logs;
@@ -49,15 +50,15 @@ public class RunnerFactoryTest {
@Test
public void should_create_embedded_runner() {
props.setProperty("foo", "bar");
- EmbeddedRunner runner = new RunnerFactory(logs).create(props);
+ EmbeddedScanner runner = new ScannerFactory(logs).create(props);
- assertThat(runner).isInstanceOf(EmbeddedRunner.class);
+ assertThat(runner).isInstanceOf(EmbeddedScanner.class);
assertThat(runner.globalProperties().get("foo")).isEqualTo("bar");
}
@Test
public void should_fwd_logs() {
- LogOutput logOutput = new RunnerFactory(logs).new DefaultLogOutput();
+ LogOutput logOutput = new ScannerFactory(logs).new DefaultLogOutput();
String msg = "test";