aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-09-11 18:21:18 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-09-11 18:21:18 +0200
commitef12da86339cd8225b8b774c9cd8412ddd550421 (patch)
treeb83c24e944c419089ff5e95b275c5122cf38b7da /src/test
parent959d97841d2e36760bf9a4caa78bdfdd6e48abd2 (diff)
downloadsonar-scanner-cli-ef12da86339cd8225b8b774c9cd8412ddd550421.tar.gz
sonar-scanner-cli-ef12da86339cd8225b8b774c9cd8412ddd550421.zip
Move (again) Main to org.sonar.runner
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/sonar/runner/MainTest.java (renamed from src/test/java/org/sonar/runner/internal/MainTest.java)30
-rw-r--r--src/test/resources/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/project/sonar-project.properties (renamed from src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/project/sonar-project.properties)0
-rw-r--r--src/test/resources/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/runner/conf/sonar-runner.properties (renamed from src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/runner/conf/sonar-runner.properties)0
-rw-r--r--src/test/resources/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties (renamed from src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties)0
-rw-r--r--src/test/resources/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByHome/conf/sonar-runner.properties (renamed from src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByHome/conf/sonar-runner.properties)0
5 files changed, 13 insertions, 17 deletions
diff --git a/src/test/java/org/sonar/runner/internal/MainTest.java b/src/test/java/org/sonar/runner/MainTest.java
index 037d1f3..751fae5 100644
--- a/src/test/java/org/sonar/runner/internal/MainTest.java
+++ b/src/test/java/org/sonar/runner/MainTest.java
@@ -17,13 +17,9 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-
-package org.sonar.runner.internal;
-
-import org.sonar.runner.internal.Main;
+package org.sonar.runner;
import org.junit.Test;
-import org.sonar.runner.Runner;
import java.io.File;
import java.util.Properties;
@@ -36,13 +32,13 @@ public class MainTest {
@Test
public void shouldParseEmptyArguments() {
- Properties props = Main.parseArguments(new String[] {});
+ Properties props = new Main().parseArguments(new String[] {});
assertThat(props.isEmpty(), is(true));
}
@Test
public void shouldParseArguments() {
- Properties props = Main.parseArguments(new String[] {"-D", "foo=bar", "--define", "hello=world", "-Dboolean"});
+ Properties props = new Main().parseArguments(new String[] {"-D", "foo=bar", "--define", "hello=world", "-Dboolean"});
assertThat(props.size(), is(3));
assertThat(props.getProperty("foo"), is("bar"));
assertThat(props.getProperty("hello"), is("world"));
@@ -51,23 +47,23 @@ public class MainTest {
@Test
public void shouldEnableDebugMode() {
- Properties props = Main.parseArguments(new String[] {"-X"});
+ Properties props = new Main().parseArguments(new String[]{"-X"});
assertThat(props.getProperty(Runner.PROPERTY_VERBOSE), is("true"));
}
@Test
public void shouldDisableDebugModeByDefault() {
- Properties props = Main.parseArguments(new String[] {});
+ Properties props = new Main().parseArguments(new String[]{});
assertThat(props.getProperty(Runner.PROPERTY_VERBOSE), nullValue());
}
@Test
public void shouldLoadRunnerSettingsByHome() throws Exception {
- File home = new File(getClass().getResource("/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByHome/").toURI());
+ File home = new File(getClass().getResource("/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByHome/").toURI());
Properties args = new Properties();
args.setProperty("runner.home", home.getCanonicalPath());
- Properties props = Main.loadRunnerProperties(args);
+ Properties props = new Main().loadRunnerProperties(args);
assertThat(props.getProperty("sonar.host.url"), is("http://moon/sonar"));
}
@@ -75,26 +71,26 @@ public class MainTest {
@Test
public void shouldNotFailIfNoHome() throws Exception {
Properties args = new Properties();
- Properties props = Main.loadRunnerProperties(args);
+ Properties props = new Main().loadRunnerProperties(args);
assertThat(props.isEmpty(), is(true));
}
@Test
public void shouldLoadRunnerSettingsByDirectPath() throws Exception {
- File settings = new File(getClass().getResource("/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties").toURI());
+ File settings = new File(getClass().getResource("/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties").toURI());
Properties args = new Properties();
args.setProperty("runner.settings", settings.getCanonicalPath());
- Properties props = Main.loadRunnerProperties(args);
+ Properties props = new Main().loadRunnerProperties(args);
assertThat(props.getProperty("sonar.host.url"), is("http://other/sonar"));
}
@Test
public void shouldLoadCompleteConfiguration() throws Exception {
- File runnerHome = new File(getClass().getResource("/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/runner").toURI());
- File projectHome = new File(getClass().getResource("/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/project").toURI());
- Properties props = Main.loadProperties(new String[] {
+ File runnerHome = new File(getClass().getResource("/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/runner").toURI());
+ File projectHome = new File(getClass().getResource("/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/project").toURI());
+ Properties props = new Main().loadProperties(new String[]{
"-D", "runner.home=" + runnerHome.getCanonicalPath(),
"-D", "project.home=" + projectHome.getCanonicalPath()
});
diff --git a/src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/project/sonar-project.properties b/src/test/resources/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/project/sonar-project.properties
index 0d1e025..0d1e025 100644
--- a/src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/project/sonar-project.properties
+++ b/src/test/resources/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/project/sonar-project.properties
diff --git a/src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/runner/conf/sonar-runner.properties b/src/test/resources/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/runner/conf/sonar-runner.properties
index 7edfb99..7edfb99 100644
--- a/src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/runner/conf/sonar-runner.properties
+++ b/src/test/resources/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/runner/conf/sonar-runner.properties
diff --git a/src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties b/src/test/resources/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties
index 740a616..740a616 100644
--- a/src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties
+++ b/src/test/resources/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties
diff --git a/src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByHome/conf/sonar-runner.properties b/src/test/resources/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByHome/conf/sonar-runner.properties
index e7d5c09..e7d5c09 100644
--- a/src/test/resources/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByHome/conf/sonar-runner.properties
+++ b/src/test/resources/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByHome/conf/sonar-runner.properties