]> source.dussan.org Git - sonarqube.git/commitdiff
Fix compatibility with FileFilter extensions
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 2 Oct 2012 08:07:46 +0000 (10:07 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 2 Oct 2012 08:08:04 +0000 (10:08 +0200)
sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectInitializer.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultProjectFileSystem.java
sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java

index f6ee4c48af904325e3a726962b05dece885d9cc7..f20751864cbebc738878bc06ac2da13ef367be35 100644 (file)
@@ -34,19 +34,16 @@ public class ProjectInitializer implements BatchComponent {
 
   private ResourceDao resourceDao;
   private DryRun dryRun;
-  private ProjectFileSystem fileSystem;
   private Languages languages;
 
-  public ProjectInitializer(ResourceDao resourceDao, DryRun dryRun, ProjectFileSystem fileSystem, Languages languages) {
+  public ProjectInitializer(ResourceDao resourceDao, DryRun dryRun, Languages languages) {
     this.resourceDao = resourceDao;
     this.dryRun = dryRun;
-    this.fileSystem = fileSystem;
     this.languages = languages;
   }
 
   public void execute(Project project, ProjectSettings settings) {
     initLanguage(project, settings);
-    initFileSystem(project);
   }
 
   private void initLanguage(Project project, ProjectSettings settings) {
@@ -63,11 +60,4 @@ public class ProjectInitializer implements BatchComponent {
     }
 
   }
-
-  private void initFileSystem(Project project) {
-    // TODO See http://jira.codehaus.org/browse/SONAR-2126
-    // previously MavenProjectBuilder was responsible for creation of ProjectFileSystem
-    project.setFileSystem(fileSystem);
-
-  }
 }
index 7afea1cad5720e1d7c2c7de7cd2379c303355b02..c7be30c73da70b68dd0fee53906e86bfd1daf088 100644 (file)
@@ -64,6 +64,9 @@ public class DefaultProjectFileSystem implements ProjectFileSystem {
   public DefaultProjectFileSystem(Project project, Languages languages) {
     this.project = project;
     this.languages = languages;
+    // TODO See http://jira.codehaus.org/browse/SONAR-2126
+    // previously MavenProjectBuilder was responsible for creation of ProjectFileSystem
+    project.setFileSystem(this);
   }
 
   public DefaultProjectFileSystem(Project project, Languages languages, FileFilter... fileFilters) {
index fd8f9304d534933bafea4d8030e3e4c49ce441a1..4d083fd21da0e8e3df31e6bd2163a8d681a8a194 100644 (file)
@@ -177,7 +177,7 @@ public class DefaultProjectFileSystemTest {
   public void resolvePathShouldReturnCanonicalFile() {
     MavenProject pom = mock(MavenProject.class);
     when(pom.getBasedir()).thenReturn(new File("/project"));
-    Project project = new Project("").setPom(pom);
+    Project project = new Project("foo").setPom(pom);
     DefaultProjectFileSystem fs = new DefaultProjectFileSystem(project, null);
 
     assertThat(fs.resolvePath(".").getAbsolutePath(), endsWith("project"));
@@ -236,7 +236,7 @@ public class DefaultProjectFileSystemTest {
   public void shouldExcludeDirectoriesStartingWithDot() {
     List<File> dirs = Arrays.asList(new File("test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src"));
 
-    List<InputFile> files = new DefaultProjectFileSystem(null, null).getFiles(dirs, Collections.<File>emptyList(), false);
+    List<InputFile> files = new DefaultProjectFileSystem(new Project("foo"), null).getFiles(dirs, Collections.<File>emptyList(), false);
     assertThat(files.size(), is(1));
     assertThat(files.get(0).getRelativePath(), is("org/sonar/Included.java"));
   }