From ad39008ac5154e57190ea021dbdae8e8a84e3cee Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Sun, 24 Feb 2008 04:41:38 +0000 Subject: [PATCH] MRM-709: Use commons-io instead of Plexus Utils * migrating FileUtils from plexus-utils to commons-io git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@630586 13f79535-47bb-0310-9956-ffa450edef68 --- .../ArchivaConfigurationTest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java index 03fd89498..631e455e9 100644 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java +++ b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java @@ -19,9 +19,9 @@ package org.apache.maven.archiva.configuration; * under the License. */ +import org.apache.commons.io.FileUtils; import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.registry.RegistryException; -import org.codehaus.plexus.util.FileUtils; import org.custommonkey.xmlunit.XMLAssert; import org.easymock.MockControl; @@ -169,7 +169,7 @@ public class ArchivaConfigurationTest // TODO: remove with commons-configuration 1.4 file.getParentFile().mkdirs(); - FileUtils.fileWrite( file.getAbsolutePath(), "" ); + FileUtils.writeStringToFile( file, "", null ); DefaultArchivaConfiguration archivaConfiguration = (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save" ); @@ -224,7 +224,7 @@ public class ArchivaConfigurationTest assertFalse( userFile.exists() ); userFile.getParentFile().mkdirs(); - FileUtils.fileWrite( userFile.getAbsolutePath(), "" ); + FileUtils.writeStringToFile( userFile, "", null ); ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); @@ -310,7 +310,7 @@ public class ArchivaConfigurationTest assertFalse( userFile.exists() ); baseFile.getParentFile().mkdirs(); - FileUtils.fileWrite( baseFile.getAbsolutePath(), "" ); + FileUtils.writeStringToFile( baseFile, "", null ); ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); @@ -342,10 +342,10 @@ public class ArchivaConfigurationTest assertFalse( userFile.exists() ); baseFile.getParentFile().mkdirs(); - FileUtils.fileWrite( baseFile.getAbsolutePath(), "" ); + FileUtils.writeStringToFile( baseFile, "", null ); userFile.getParentFile().mkdirs(); - FileUtils.fileWrite( userFile.getAbsolutePath(), "" ); + FileUtils.writeStringToFile( userFile, "", null ); ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); @@ -359,10 +359,10 @@ public class ArchivaConfigurationTest assertTrue( "Check file exists", baseFile.exists() ); assertEquals( "Check base file is unchanged", "", - FileUtils.fileRead( baseFile.getAbsolutePath() ) ); + FileUtils.readFileToString( baseFile, null ) ); assertTrue( "Check file exists", userFile.exists() ); assertFalse( "Check base file is changed", - "".equals( FileUtils.fileRead( userFile.getAbsolutePath() ) ) ); + "".equals( FileUtils.readFileToString( userFile, null ) ) ); // check it configuration = archivaConfiguration.getConfiguration(); @@ -384,7 +384,7 @@ public class ArchivaConfigurationTest FileUtils.copyFile( getTestFile( "src/test/conf/conf-user.xml" ), userFile ); baseFile.getParentFile().mkdirs(); - FileUtils.fileWrite( baseFile.getAbsolutePath(), "" ); + FileUtils.writeStringToFile( baseFile, "", null ); ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); @@ -398,10 +398,10 @@ public class ArchivaConfigurationTest assertTrue( "Check file exists", baseFile.exists() ); assertEquals( "Check base file is unchanged", "", - FileUtils.fileRead( baseFile.getAbsolutePath() ) ); + FileUtils.readFileToString( baseFile, null ) ); assertTrue( "Check file exists", userFile.exists() ); assertFalse( "Check base file is changed", - "".equals( FileUtils.fileRead( userFile.getAbsolutePath() ) ) ); + "".equals( FileUtils.readFileToString( userFile, null ) ) ); // check it configuration = archivaConfiguration.getConfiguration(); @@ -423,7 +423,7 @@ public class ArchivaConfigurationTest FileUtils.copyFile( getTestFile( "src/test/conf/conf-base.xml" ), baseFile ); userFile.getParentFile().mkdirs(); - FileUtils.fileWrite( userFile.getAbsolutePath(), "" ); + FileUtils.writeStringToFile( userFile, "", null ); ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); @@ -552,7 +552,7 @@ public class ArchivaConfigurationTest assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositoriesAsMap().size() ); assertEquals( "check v1 repositories size.", 0, configuration.getRepositories().size() ); - String actualXML = FileUtils.fileRead( userFile ); + String actualXML = FileUtils.readFileToString( userFile, null ); XMLAssert.assertXpathNotExists( "//configuration/repositories/repository", actualXML ); XMLAssert.assertXpathNotExists( "//configuration/repositories", actualXML ); } @@ -606,7 +606,7 @@ public class ArchivaConfigurationTest FileUtils.copyFile( getTestFile( "src/test/conf/escape-cron-expressions.xml" ), baseFile ); userFile.getParentFile().mkdirs(); - FileUtils.fileWrite( userFile.getAbsolutePath(), "" ); + FileUtils.writeStringToFile( userFile, "", null ); ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-cron-expressions" ); -- 2.39.5