Search in sources :

Example 1 with WorkDirectoryCleaner

use of org.sonar.scanner.scan.WorkDirectoryCleaner in project sonarqube by SonarSource.

the class WorkDirectoryCleanerTest method setUp.

@Before
public void setUp() throws IOException {
    // create files to clean
    temp.newFile();
    File newFolder = temp.newFolder();
    File fileInFolder = new File(newFolder, "test");
    fileInFolder.createNewFile();
    File lock = new File(temp.getRoot(), DirectoryLock.LOCK_FILE_NAME);
    lock.createNewFile();
    // mock project
    ProjectReactor projectReactor = mock(ProjectReactor.class);
    ProjectDefinition projectDefinition = mock(ProjectDefinition.class);
    when(projectReactor.getRoot()).thenReturn(projectDefinition);
    when(projectDefinition.getWorkDir()).thenReturn(temp.getRoot());
    assertThat(temp.getRoot().list().length).isGreaterThan(1);
    cleaner = new WorkDirectoryCleaner(projectReactor);
}
Also used : File(java.io.File) WorkDirectoryCleaner(org.sonar.scanner.scan.WorkDirectoryCleaner) ProjectReactor(org.sonar.api.batch.bootstrap.ProjectReactor) ProjectDefinition(org.sonar.api.batch.bootstrap.ProjectDefinition) Before(org.junit.Before)

Aggregations

File (java.io.File)1 Before (org.junit.Before)1 ProjectDefinition (org.sonar.api.batch.bootstrap.ProjectDefinition)1 ProjectReactor (org.sonar.api.batch.bootstrap.ProjectReactor)1 WorkDirectoryCleaner (org.sonar.scanner.scan.WorkDirectoryCleaner)1