ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1578266 - /ant/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntEngineTest.java
Date Mon, 17 Mar 2014 08:00:29 GMT
Author: jlboudart
Date: Mon Mar 17 08:00:29 2014
New Revision: 1578266

URL: http://svn.apache.org/r1578266
Log:
Make easyantEngine test less dependent on environment (was failing if personnal easyant-ivysettings.xml
was present in user.home)

Modified:
    ant/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntEngineTest.java

Modified: ant/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntEngineTest.java
URL: http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntEngineTest.java?rev=1578266&r1=1578265&r2=1578266&view=diff
==============================================================================
--- ant/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntEngineTest.java (original)
+++ ant/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntEngineTest.java Mon
Mar 17 08:00:29 2014
@@ -69,9 +69,13 @@ public class EasyAntEngineTest {
     public void setUp() throws IOException {
         File cache = temporaryFolder.newFolder("build-cache");
         project.setProperty("ivy.cache.dir", cache.getAbsolutePath());
+
+    }
+
+    private void configureEasyAntIvyInstanceForTests() {
         easyAntConfiguration.setEasyantIvySettingsUrl(this.getClass().getResource(
                 "/repositories/easyant-ivysettings-test.xml"));
-
+        project.setProperty(EasyAntMagicNames.IGNORE_USER_IVYSETTINGS, "true");
     }
 
     @Test
@@ -149,6 +153,7 @@ public class EasyAntEngineTest {
 
     @Test
     public void shouldConfigureEasyAnt() {
+        configureEasyAntIvyInstanceForTests();
         easyantEngine.configureEasyAnt(project);
         assertThat(Thread.currentThread().getPriority(), is(Thread.NORM_PRIORITY));
         assertThat(easyAntConfiguration.getCoreLoader(), nullValue());
@@ -158,6 +163,7 @@ public class EasyAntEngineTest {
 
     @Test
     public void shouldConfigureEasyAntWithCustomPriority() {
+        configureEasyAntIvyInstanceForTests();
         easyAntConfiguration.setThreadPriority(10);
         easyantEngine.configureEasyAnt(project);
         assertThat(Thread.currentThread().getPriority(), is(easyAntConfiguration.getThreadPriority()));
@@ -166,6 +172,7 @@ public class EasyAntEngineTest {
 
     @Test
     public void shouldConfigureEasyAntWithCustomCoreLoader() {
+        configureEasyAntIvyInstanceForTests();
         easyAntConfiguration.setCoreLoader(this.getClass().getClassLoader());
         easyantEngine.configureEasyAnt(project);
         assertEasyAntIsConfigured();
@@ -174,6 +181,7 @@ public class EasyAntEngineTest {
 
     @Test
     public void shouldConfigureEasyAntWhenKeepGoingModeIsTrue() {
+        configureEasyAntIvyInstanceForTests();
         easyAntConfiguration.setKeepGoingMode(true);
         easyantEngine.configureEasyAnt(project);
         assertEasyAntIsConfigured();
@@ -181,6 +189,7 @@ public class EasyAntEngineTest {
 
     @Test
     public void shouldEasyAntProjectWhenProxyIsTrue() {
+        configureEasyAntIvyInstanceForTests();
         String oldValue = System.getProperty(ProxySetup.USE_SYSTEM_PROXIES);
         System.getProperties().remove(ProxySetup.USE_SYSTEM_PROXIES);
 
@@ -247,7 +256,6 @@ public class EasyAntEngineTest {
 
     @Test
     public void shouldReturnNullGlobalEasyAntIvySettingsLocationIfNoDefaultGlobalExists()
throws MalformedURLException {
-        easyAntConfiguration.setEasyantIvySettingsUrl((String)null);
         // configure default global to missing directory
         project.setNewProperty(EasyAntMagicNames.EASYANT_HOME, "/fake/path");
         URL globalEasyAntIvySettings = easyantEngine.getGlobalEasyAntIvySettings(project);
@@ -256,7 +264,6 @@ public class EasyAntEngineTest {
 
     @Test
     public void shouldReturnDefaultGlobalEasyAntIvySettingsLocationIfExists() throws IOException
{
-        easyAntConfiguration.setEasyantIvySettingsUrl((String)null);
         File f = temporaryFolder.newFile("easyant-ivysettings.xml");
         FileOutputStream fos = null;
         try {
@@ -275,7 +282,6 @@ public class EasyAntEngineTest {
 
     @Test
     public void shouldReturnGlobalEasyAntIvySettingsLocationSpecifiedByConfigurationFile()
throws MalformedURLException {
-        easyAntConfiguration.setEasyantIvySettingsUrl((String)null);
         easyAntConfiguration.setEasyantIvySettingsFile("/path/to/fake/easyantIvySettingsFile.xml");
         URL globalEasyAntIvySettings = easyantEngine.getGlobalEasyAntIvySettings(project);
         assertThat(globalEasyAntIvySettings.toString(), endsWith(easyAntConfiguration.getEasyantIvySettingsFile()));



Mime
View raw message