Author: maartenc
Date: Tue Mar 23 23:13:52 2010
New Revision: 926844
URL: http://svn.apache.org/viewvc?rev=926844&view=rev
Log:
Don't use ${user.home}/.ivy2/cache as the default Ivy cache for junit tests.
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java?rev=926844&r1=926843&r2=926844&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java Tue Mar 23
23:13:52 2010
@@ -23,11 +23,28 @@ import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.util.CacheCleaner;
import org.apache.ivy.util.MockMessageLogger;
import junit.framework.TestCase;
public class IvyTest extends TestCase {
+ private File cache;
+
+ protected void setUp() throws Exception {
+ createCache();
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
+ }
+
+ private void createCache() {
+ cache = new File("build/cache");
+ cache.mkdirs();
+ }
+
+ protected void tearDown() throws Exception {
+ CacheCleaner.deleteDir(cache);
+ }
+
public void testMultipleInstances() throws Exception {
// this test checks that IvyContext is properly set and unset when
using multiple instances
// of Ivy. We also check logging, because it heavily relies on
IvyContext.