From 794b829284b4d9cd59a8e6f769e75d6910d1003f Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Wed, 28 Jun 2006 08:26:49 +0000 Subject: [PATCH] use plexus copyDirectoryStructure (the other method was not overwriting files which is not acceptable in test cases as old state can be left behind) git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@417696 13f79535-47bb-0310-9956-ffa450edef68 --- .../converter/RepositoryConverterTest.java | 50 +------------------ 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java b/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java index 54c42b96b..21b199bc5 100644 --- a/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java +++ b/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java @@ -83,7 +83,7 @@ public class RepositoryConverterTest layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); File targetBase = getTestFile( "target/test-target-repository" ); - copyDirectoryStructure( getTestFile( "src/test/target-repository" ), targetBase ); + FileUtils.copyDirectoryStructure( getTestFile( "src/test/target-repository" ), targetBase ); targetRepository = factory.createArtifactRepository( "target", targetBase.toURL().toString(), layout, null, null ); @@ -930,52 +930,4 @@ public class RepositoryConverterTest sourceRepository = factory.createArtifactRepository( "source", sourceBase.toURL().toString(), layout, null, null ); } - - private void copyDirectoryStructure( File sourceDirectory, File destinationDirectory ) - throws IOException - { - if ( !sourceDirectory.exists() ) - { - throw new IOException( "Source directory doesn't exists (" + sourceDirectory.getAbsolutePath() + ")." ); - } - - File[] files = sourceDirectory.listFiles(); - - String sourcePath = sourceDirectory.getAbsolutePath(); - - for ( int i = 0; i < files.length; i++ ) - { - File file = files[i]; - - String dest = file.getAbsolutePath(); - - dest = dest.substring( sourcePath.length() + 1 ); - - File destination = new File( destinationDirectory, dest ); - - if ( file.isFile() ) - { - destination = destination.getParentFile(); - - FileUtils.copyFileToDirectory( file, destination ); - } - else if ( file.isDirectory() ) - { - if ( !".svn".equals( file.getName() ) ) - { - if ( !destination.exists() && !destination.mkdirs() ) - { - throw new IOException( - "Could not create destination directory '" + destination.getAbsolutePath() + "'." ); - } - - copyDirectoryStructure( file, destination ); - } - } - else - { - throw new IOException( "Unknown file type: " + file.getAbsolutePath() ); - } - } - } }