diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2013-10-21 11:17:16 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2013-10-21 11:17:55 +0200 |
commit | 8842c50c19054ced2809a8ebdde854a83312a8d2 (patch) | |
tree | 6c40289430c8dc4ec8cf82a1c5369abdb7b92a41 /sonar-batch | |
parent | eb321c1da9949532872a6a7c64be6d51e11affe4 (diff) | |
download | sonarqube-8842c50c19054ced2809a8ebdde854a83312a8d2.tar.gz sonarqube-8842c50c19054ced2809a8ebdde854a83312a8d2.zip |
SONAR-4748 Fix issues and regression for temp folders
Diffstat (limited to 'sonar-batch')
3 files changed, 7 insertions, 8 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java index abfd8de5fc2..13bb325e89d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java @@ -26,6 +26,7 @@ import org.sonar.api.platform.ComponentContainer; import org.sonar.api.platform.PluginMetadata; import org.sonar.api.utils.HttpDownloader; import org.sonar.api.utils.UriReader; +import org.sonar.api.utils.internal.TempFolderCleaner; import org.sonar.batch.components.PastMeasuresLoader; import org.sonar.batch.components.PastSnapshotFinder; import org.sonar.batch.components.PastSnapshotFinderByDate; @@ -88,6 +89,7 @@ public class BootstrapContainer extends ComponentContainer { ServerMetadata.class, org.sonar.batch.ServerMetadata.class, new TempFolderProvider(), + TempFolderCleaner.class, HttpDownloader.class, UriReader.class, new FileCacheProvider()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TempFolderProvider.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TempFolderProvider.java index fc773552216..ed0ea506615 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TempFolderProvider.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TempFolderProvider.java @@ -33,7 +33,7 @@ public class TempFolderProvider extends ProviderAdapter { public TempFolder provide(BootstrapSettings bootstrapSettings) { String workingDirPath = bootstrapSettings.property(CoreProperties.WORKING_DIRECTORY, CoreProperties.WORKING_DIRECTORY_DEFAULT_VALUE); File workingDir = new File(workingDirPath); - File tempDir = new File(workingDir, "tmp"); + File tempDir = new File(workingDir, ".sonartmp"); try { FileUtils.forceMkdir(tempDir); } catch (IOException e) { diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TempFolderProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TempFolderProviderTest.java index 8596dd33afd..adc744b8da8 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TempFolderProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TempFolderProviderTest.java @@ -26,7 +26,6 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.sonar.api.CoreProperties; import org.sonar.api.utils.TempFolder; -import org.sonar.api.utils.internal.DefaultTempFolder; import java.io.File; @@ -43,14 +42,12 @@ public class TempFolderProviderTest { @Test public void createTempFolder() throws Exception { File workingDir = temp.newFolder(); - TempFolder tempFolder = new TempFolderProvider().provide(new BootstrapSettings( + TempFolderProvider tempFolderProvider = new TempFolderProvider(); + TempFolder tempFolder = tempFolderProvider.provide(new BootstrapSettings( new BootstrapProperties(ImmutableMap.of(CoreProperties.WORKING_DIRECTORY, workingDir.getAbsolutePath())))); tempFolder.newDir(); tempFolder.newFile(); - assertThat(new File(workingDir, "tmp")).exists(); - assertThat(new File(workingDir, "tmp").list()).hasSize(2); - - ((DefaultTempFolder) tempFolder).stop(); - assertThat(new File(workingDir, "tmp")).doesNotExist(); + assertThat(new File(workingDir, ".sonartmp")).exists(); + assertThat(new File(workingDir, ".sonartmp").list()).hasSize(2); } } |