diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2012-09-05 09:04:33 +0000 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2012-09-05 09:04:33 +0000 |
commit | c7bcceb0933561fbf90ccc39225e24b47822c5d4 (patch) | |
tree | 1205b78293e9955a2bd2272943caaf5372dcb769 /src/test/java/org/sonar/runner/LauncherTest.java | |
parent | b76a02be6822c6757463057b17f051b76a150e45 (diff) | |
download | sonar-scanner-cli-c7bcceb0933561fbf90ccc39225e24b47822c5d4.tar.gz sonar-scanner-cli-c7bcceb0933561fbf90ccc39225e24b47822c5d4.zip |
SONARPLUGINS-2202 Add multi-module support
Diffstat (limited to 'src/test/java/org/sonar/runner/LauncherTest.java')
-rw-r--r-- | src/test/java/org/sonar/runner/LauncherTest.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/test/java/org/sonar/runner/LauncherTest.java b/src/test/java/org/sonar/runner/LauncherTest.java index 515daa1..0cec5f5 100644 --- a/src/test/java/org/sonar/runner/LauncherTest.java +++ b/src/test/java/org/sonar/runner/LauncherTest.java @@ -22,61 +22,12 @@ package org.sonar.runner; import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.Configuration; import org.junit.Test; -import org.sonar.api.batch.bootstrap.ProjectDefinition; - -import java.io.File; -import java.util.Properties; import static org.fest.assertions.Assertions.assertThat; -import static org.junit.Assert.fail; public class LauncherTest { @Test - public void shouldFilterFiles() throws Exception { - File baseDir = new File(getClass().getResource("/org/sonar/runner/LauncherTest/shouldFilterFiles/").toURI()); - assertThat(Launcher.getLibraries(baseDir, "in*.txt").length).isEqualTo(1); - assertThat(Launcher.getLibraries(baseDir, "*.txt").length).isEqualTo(2); - assertThat(Launcher.getLibraries(baseDir.getParentFile(), "shouldFilterFiles/in*.txt").length).isEqualTo(1); - assertThat(Launcher.getLibraries(baseDir.getParentFile(), "shouldFilterFiles/*.txt").length).isEqualTo(2); - } - - @Test - public void shouldWorkWithAbsolutePath() throws Exception { - File baseDir = new File("not-exists"); - String absolutePattern = new File(getClass().getResource("/org/sonar/runner/LauncherTest/shouldFilterFiles/").toURI()).getAbsolutePath() + "/in*.txt"; - assertThat(Launcher.getLibraries(baseDir.getParentFile(), absolutePattern).length).isEqualTo(1); - } - - @Test - public void shouldThrowExceptionWhenNoFilesMatchingPattern() throws Exception { - File baseDir = new File(getClass().getResource("/org/sonar/runner/LauncherTest/shouldFilterFiles/").toURI()); - try { - Launcher.getLibraries(baseDir, "*.jar"); - fail("Exception expected"); - } catch (RunnerException e) { - assertThat(e.getMessage()).contains("No files matching pattern \"*.jar\" in directory"); - } - } - - @Test - public void shouldDefineProject() { - Properties conf = new Properties(); - conf.setProperty("sources", "src/main/java"); - conf.setProperty("tests", "src/test/java"); - conf.setProperty("binaries", "target/classes"); - conf.setProperty("libraries", "./*.xml"); - Runner runner = Runner.create(conf); - - Launcher launcher = new Launcher(runner); - ProjectDefinition projectDefinition = launcher.defineProject(); - assertThat(projectDefinition.getSourceDirs()).contains("src/main/java"); - assertThat(projectDefinition.getTestDirs()).contains("src/test/java"); - assertThat(projectDefinition.getBinaries()).contains("target/classes"); - assertThat(projectDefinition.getLibraries()).contains(new File("assembly.xml").getAbsolutePath(), new File("pom.xml").getAbsolutePath()); - } - - @Test public void testGetSqlLevel() throws Exception { Configuration conf = new BaseConfiguration(); |