aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/test/java/org/sonar/batch/index
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2014-02-10 16:54:15 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2014-02-10 17:07:03 +0100
commit7f0b376d36e1211e5876011f31af2764f1483d56 (patch)
treea60f6ffe1f1cd4ba85db6489d3979e6b26de4bde /sonar-batch/src/test/java/org/sonar/batch/index
parent5eaa8f5ba79468354e84bb3fd9c8b8a581e65faa (diff)
downloadsonarqube-7f0b376d36e1211e5876011f31af2764f1483d56.tar.gz
sonarqube-7f0b376d36e1211e5876011f31af2764f1483d56.zip
SONAR-926 deprecate org.sonar.api.batch.ResourceFilter
Diffstat (limited to 'sonar-batch/src/test/java/org/sonar/batch/index')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java48
1 files changed, 10 insertions, 38 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java
index 68a085c6439..dd5da90948d 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java
@@ -19,30 +19,21 @@
*/
package org.sonar.batch.index;
-import org.apache.commons.lang.StringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.sonar.api.batch.ResourceFilter;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Measure;
import org.sonar.api.measures.MeasuresFilters;
import org.sonar.api.measures.MetricFinder;
import org.sonar.api.profiles.RulesProfile;
-import org.sonar.api.resources.Directory;
-import org.sonar.api.resources.File;
-import org.sonar.api.resources.Java;
-import org.sonar.api.resources.Library;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.resources.Resource;
+import org.sonar.api.resources.*;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleFinder;
import org.sonar.api.rules.Violation;
import org.sonar.api.violations.ViolationQuery;
import org.sonar.batch.ProjectTree;
-import org.sonar.batch.ResourceFilters;
import org.sonar.batch.issue.DeprecatedViolations;
import org.sonar.batch.issue.ModuleIssues;
import org.sonar.core.component.ScanGraph;
@@ -60,18 +51,14 @@ public class DefaultIndexTest {
@org.junit.Rule
public TemporaryFolder temp = new TemporaryFolder();
- private DefaultIndex index = null;
- private DeprecatedViolations deprecatedViolations;
- private Rule rule;
- private RuleFinder ruleFinder;
-
- private Project project;
-
- private Project moduleA;
-
- private Project moduleB;
-
- private Project moduleB1;
+ DefaultIndex index = null;
+ DeprecatedViolations deprecatedViolations;
+ Rule rule;
+ RuleFinder ruleFinder;
+ Project project;
+ Project moduleA;
+ Project moduleB;
+ Project moduleB1;
@Before
public void createIndex() throws IOException {
@@ -93,17 +80,11 @@ public class DefaultIndexTest {
moduleB1 = new Project("moduleB1").setParent(moduleB);
when(projectTree.getProjectDefinition(moduleB1)).thenReturn(ProjectDefinition.create().setBaseDir(new java.io.File(baseDir, "moduleB/moduleB1")));
- ResourceFilter filter = new ResourceFilter() {
-
- public boolean isIgnored(Resource resource) {
- return StringUtils.containsIgnoreCase(resource.getKey(), "excluded");
- }
- };
RulesProfile rulesProfile = RulesProfile.create();
rule = Rule.create("repoKey", "ruleKey", "Rule");
rule.setId(1);
rulesProfile.activateRule(rule, null);
- index.setCurrentProject(project, new ResourceFilters(new ResourceFilter[] {filter}), mock(ModuleIssues.class));
+ index.setCurrentProject(project, mock(ModuleIssues.class));
index.doStart(project);
}
@@ -165,15 +146,6 @@ public class DefaultIndexTest {
}
@Test
- public void shouldBeExcluded() {
- File file = File.create("src/org/foo/ExcludedBar.java", "org/foo/ExcludedBar.java", null, false);
- assertThat(index.index(file)).isFalse();
- assertThat(index.isIndexed(file, true)).isTrue();
- assertThat(index.isIndexed(file, false)).isFalse();
- assertThat(index.isExcluded(file)).isTrue();
- }
-
- @Test
public void shouldIndexResourceWhenAddingMeasure() {
Resource dir = Directory.create("src/org/foo", "org/foo");
index.addMeasure(dir, new Measure("ncloc").setValue(50.0));