From: Simon Brandhof Date: Sun, 11 Jan 2015 21:31:05 +0000 (+0100) Subject: Remove unused method AnalysisReportService#deleteDirectory() X-Git-Tag: latest-silver-master-#65~258 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=51b9b2e462425ae99ed08613362d8da789bde277;p=sonarqube.git Remove unused method AnalysisReportService#deleteDirectory() --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java index a6c943305a1..6a2af749f04 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java @@ -23,7 +23,6 @@ package org.sonar.server.computation; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.collect.Iterables; -import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,8 +38,6 @@ import org.sonar.batch.protocol.output.component.ReportComponents; import org.sonar.batch.protocol.output.issue.ReportIssue; import org.sonar.core.issue.db.IssueStorage; -import javax.annotation.Nullable; - import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -153,16 +150,4 @@ public class AnalysisReportService implements ServerComponent { return issue; } - - public void deleteDirectory(@Nullable File directory) { - if (directory == null) { - return; - } - - try { - FileUtils.deleteDirectory(directory); - } catch (IOException e) { - LOG.warn(String.format("Failed to delete directory '%s'", directory.getPath()), e); - } - } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java index 875ace20192..feb7a2449d3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java @@ -21,7 +21,6 @@ package org.sonar.server.computation; import com.google.common.collect.Lists; -import org.apache.commons.io.FileUtils; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -55,23 +54,6 @@ public class AnalysisReportServiceTest { sut = new AnalysisReportService(issueStorageFactory); } - @Test - public void clean_null_directory_does_not_throw_any_exception() throws Exception { - sut.deleteDirectory(null); - } - - @Test - public void clean_temp_folder() throws Exception { - File origin = new File(getClass().getResource("/org/sonar/server/computation/AnalysisReportServiceTest/report-folder").getFile()); - File destination = new File("target/tmp/report-folder-to-delete"); - FileUtils.copyDirectory(origin, destination); - assertThat(destination.exists()).isTrue(); - - sut.deleteDirectory(destination); - - assertThat(destination.exists()).isFalse(); - } - @Test public void load_resources() throws Exception { File dir = new File(getClass().getResource("/org/sonar/server/computation/AnalysisReportServiceTest/report-folder").getFile());