aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-10-15 17:14:44 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-10-16 15:25:41 +0200
commit18a4c15b060d1b56f08826bf6006d08eaf2625ec (patch)
tree03cc1afb062054a3d3d74849bf18e7a6485ab05c /plugins/sonar-core-plugin
parent3f946fc11c49585f8cdf003c54f19c322a4aab29 (diff)
downloadsonarqube-18a4c15b060d1b56f08826bf6006d08eaf2625ec.tar.gz
sonarqube-18a4c15b060d1b56f08826bf6006d08eaf2625ec.zip
SONAR-4748 Introduce a new extension for managing temp files/folders.
Diffstat (limited to 'plugins/sonar-core-plugin')
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/InitialOpenIssuesStackTest.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/InitialOpenIssuesStackTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/InitialOpenIssuesStackTest.java
index 51c8597b778..6a6d8c140a8 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/InitialOpenIssuesStackTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/InitialOpenIssuesStackTest.java
@@ -20,24 +20,45 @@
package org.sonar.plugins.core.issue;
+import edu.emory.mathcs.backport.java.util.Collections;
import org.junit.After;
import org.junit.Before;
+import org.junit.ClassRule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.sonar.api.CoreProperties;
+import org.sonar.batch.bootstrap.BatchTempUtils;
+import org.sonar.batch.bootstrap.BootstrapProperties;
+import org.sonar.batch.bootstrap.BootstrapSettings;
import org.sonar.batch.index.Caches;
import org.sonar.core.issue.db.IssueDto;
+import java.io.IOException;
import java.util.List;
-import static com.google.common.collect.Lists.newArrayList;
import static org.fest.assertions.Assertions.assertThat;
public class InitialOpenIssuesStackTest {
+ @ClassRule
+ public static TemporaryFolder temp = new TemporaryFolder();
+
+ public static Caches createCacheOnTemp(TemporaryFolder temp) {
+ BootstrapSettings bootstrapSettings = new BootstrapSettings(new BootstrapProperties(Collections.emptyMap()));
+ try {
+ bootstrapSettings.properties().put(CoreProperties.WORKING_DIRECTORY, temp.newFolder().getAbsolutePath());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return new Caches(new BatchTempUtils(bootstrapSettings));
+ }
+
InitialOpenIssuesStack stack;
- Caches caches = new Caches();
+ Caches caches;
@Before
- public void setUp() {
+ public void setUp() throws Exception {
+ caches = createCacheOnTemp(temp);
caches.start();
stack = new InitialOpenIssuesStack(caches);
}