aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/test/java
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-01-23 12:14:00 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2015-01-26 10:19:38 +0100
commit2ccd693c8ccefb423ab10368ac93fff2eccc1b1f (patch)
tree184f873261933129c1dd37f382554f54d53cd78f /sonar-batch/src/test/java
parent8d2ca3f7e43a01289734ed7a652904adb5c76527 (diff)
downloadsonarqube-2ccd693c8ccefb423ab10368ac93fff2eccc1b1f.tar.gz
sonarqube-2ccd693c8ccefb423ab10368ac93fff2eccc1b1f.zip
SONAR-6060 Move HTML report into the core
Diffstat (limited to 'sonar-batch/src/test/java')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalSettingsTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java23
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java10
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/ProjectSettingsTest.java10
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionFactoryTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java4
7 files changed, 42 insertions, 21 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalSettingsTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalSettingsTest.java
index eb605d9c3bf..47bdb3e1db6 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalSettingsTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalSettingsTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.batch.protocol.input.GlobalReferentials;
+import org.sonar.batch.protocol.input.GlobalRepositories;
import java.util.Collections;
@@ -37,7 +37,7 @@ public class GlobalSettingsTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
- GlobalReferentials globalRef;
+ GlobalRepositories globalRef;
ProjectDefinition project = ProjectDefinition.create().setKey("struts");
BootstrapProperties bootstrapProps;
@@ -45,7 +45,7 @@ public class GlobalSettingsTest {
@Before
public void prepare() {
- globalRef = new GlobalReferentials();
+ globalRef = new GlobalRepositories();
bootstrapProps = new BootstrapProperties(Collections.<String, String>emptyMap());
mode = mock(AnalysisMode.class);
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java
index 701ef85d02d..10726e7b33f 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java
@@ -45,6 +45,7 @@ public class ReportsMediumTest {
.addDefaultQProfile("xoo", "Sonar Way")
.activateRule(new ActiveRule("xoo", "OneIssuePerLine", "One issue per line", "MAJOR", "OneIssuePerLine.internal", "xoo"))
.bootstrapProperties(ImmutableMap.of("sonar.analysis.mode", "sensor"))
+ // Existing issue
.addPreviousIssue(new PreviousIssue().setKey("xyz")
.setComponentKey("sample:xources/hello/HelloJava.xoo")
.setRuleKey("xoo", "OneIssuePerLine")
@@ -52,6 +53,14 @@ public class ReportsMediumTest {
.setSeverity("MAJOR")
.setChecksum(DigestUtils.md5Hex("packagehello;"))
.setStatus("OPEN"))
+ // Resolved issue
+ .addPreviousIssue(new PreviousIssue().setKey("resolved")
+ .setComponentKey("sample:xources/hello/HelloJava.xoo")
+ .setRuleKey("xoo", "OneIssuePerLine")
+ .setLine(1)
+ .setOverriddenSeverity("MAJOR")
+ .setChecksum(DigestUtils.md5Hex("dontexist"))
+ .setStatus("OPEN"))
.build();
@Before
@@ -73,7 +82,19 @@ public class ReportsMediumTest {
.property("sonar.issuesReport.console.enable", "true")
.start();
- assertThat(result.issues()).hasSize(14);
+ assertThat(result.issues()).hasSize(15);
+ }
+
+ @Test
+ public void testHtmlReport() throws Exception {
+ File projectDir = new File(ReportsMediumTest.class.getResource("/mediumtest/xoo/sample").toURI());
+
+ TaskResult result = tester
+ .newScanTask(new File(projectDir, "sonar-project.properties"))
+ .property("sonar.issuesReport.html.enable", "true")
+ .start();
+
+ assertThat(result.issues()).hasSize(15);
}
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java
index 2c03cd472f4..7215d7b1940 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java
@@ -29,7 +29,7 @@ import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.utils.MessageException;
import org.sonar.batch.bootstrap.AnalysisMode;
import org.sonar.batch.bootstrap.GlobalSettings;
-import org.sonar.batch.protocol.input.ProjectRepository;
+import org.sonar.batch.protocol.input.ProjectRepositories;
import java.util.List;
@@ -42,12 +42,12 @@ public class ModuleSettingsTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
- ProjectRepository projectRef;
+ ProjectRepositories projectRef;
private AnalysisMode mode;
@Before
public void before() {
- projectRef = new ProjectRepository();
+ projectRef = new ProjectRepositories();
mode = mock(AnalysisMode.class);
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java
index 3326102185e..bbfa7acefd4 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java
@@ -42,8 +42,8 @@ import org.sonar.batch.bootstrap.ExtensionInstaller;
import org.sonar.batch.bootstrap.GlobalSettings;
import org.sonar.batch.bootstrap.TaskProperties;
import org.sonar.batch.profiling.PhasesSumUpTimeProfiler;
-import org.sonar.batch.protocol.input.GlobalReferentials;
-import org.sonar.batch.protocol.input.ProjectRepository;
+import org.sonar.batch.protocol.input.GlobalRepositories;
+import org.sonar.batch.protocol.input.ProjectRepositories;
import org.sonar.batch.scan.maven.MavenPluginExecutor;
import java.util.Collections;
@@ -70,13 +70,13 @@ public class ProjectScanContainerTest {
parentContainer.add(System2.INSTANCE);
parentContainer.add(bootstrapProperties);
parentContainer.add(analysisMode);
- GlobalReferentials globalRef = new GlobalReferentials();
+ GlobalRepositories globalRef = new GlobalRepositories();
settings = new GlobalSettings(bootstrapProperties, new PropertyDefinitions(), globalRef, analysisMode);
parentContainer.add(settings);
ProjectRepositoriesLoader projectReferentialsLoader = new ProjectRepositoriesLoader() {
@Override
- public ProjectRepository load(ProjectReactor reactor, TaskProperties taskProperties) {
- return new ProjectRepository();
+ public ProjectRepositories load(ProjectReactor reactor, TaskProperties taskProperties) {
+ return new ProjectRepositories();
}
};
parentContainer.add(projectReferentialsLoader);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectSettingsTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectSettingsTest.java
index 69db0207a8b..58ade46e025 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectSettingsTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectSettingsTest.java
@@ -32,8 +32,8 @@ import org.sonar.api.utils.MessageException;
import org.sonar.batch.bootstrap.AnalysisMode;
import org.sonar.batch.bootstrap.BootstrapProperties;
import org.sonar.batch.bootstrap.GlobalSettings;
-import org.sonar.batch.protocol.input.GlobalReferentials;
-import org.sonar.batch.protocol.input.ProjectRepository;
+import org.sonar.batch.protocol.input.GlobalRepositories;
+import org.sonar.batch.protocol.input.ProjectRepositories;
import java.util.Collections;
@@ -46,7 +46,7 @@ public class ProjectSettingsTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
- ProjectRepository projectRef;
+ ProjectRepositories projectRef;
ProjectDefinition project = ProjectDefinition.create().setKey("struts");
GlobalSettings bootstrapProps;
@@ -54,9 +54,9 @@ public class ProjectSettingsTest {
@Before
public void prepare() {
- projectRef = new ProjectRepository();
+ projectRef = new ProjectRepositories();
mode = mock(AnalysisMode.class);
- bootstrapProps = new GlobalSettings(new BootstrapProperties(Collections.<String, String>emptyMap()), new PropertyDefinitions(), new GlobalReferentials(), mode);
+ bootstrapProps = new GlobalSettings(new BootstrapProperties(Collections.<String, String>emptyMap()), new PropertyDefinitions(), new GlobalRepositories(), mode);
}
@Test
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionFactoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionFactoryTest.java
index ddc9d1d376b..53f5db28651 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionFactoryTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionFactoryTest.java
@@ -20,7 +20,7 @@
package org.sonar.batch.scan.filesystem;
import org.junit.Test;
-import org.sonar.batch.protocol.input.ProjectRepository;
+import org.sonar.batch.protocol.input.ProjectRepositories;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -28,7 +28,7 @@ import static org.mockito.Mockito.mock;
public class StatusDetectionFactoryTest {
@Test
public void testCreate() throws Exception {
- StatusDetectionFactory factory = new StatusDetectionFactory(mock(ProjectRepository.class));
+ StatusDetectionFactory factory = new StatusDetectionFactory(mock(ProjectRepositories.class));
StatusDetection detection = factory.create();
assertThat(detection).isNotNull();
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java
index ca3282fc393..261ff3b8a2c 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java
@@ -22,14 +22,14 @@ package org.sonar.batch.scan.filesystem;
import org.junit.Test;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.batch.protocol.input.FileData;
-import org.sonar.batch.protocol.input.ProjectRepository;
+import org.sonar.batch.protocol.input.ProjectRepositories;
import static org.assertj.core.api.Assertions.assertThat;
public class StatusDetectionTest {
@Test
public void detect_status() throws Exception {
- ProjectRepository ref = new ProjectRepository();
+ ProjectRepositories ref = new ProjectRepositories();
ref.addFileData("foo", "src/Foo.java", new FileData("ABCDE", true, null, null, null));
ref.addFileData("foo", "src/Bar.java", new FileData("FGHIJ", true, null, null, null));
StatusDetection statusDetection = new StatusDetection(ref);