From 079aeac3149b04a17ab318e2bb5d8bdba5bb20d2 Mon Sep 17 00:00:00 2001 From: "Edwin L. Punzalan" Date: Wed, 7 Dec 2005 07:06:30 +0000 Subject: [PATCH] updated files to build successfully git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@354743 13f79535-47bb-0310-9956-ffa450edef68 --- .../AbstractChecksumArtifactReporterTest.java | 45 +++++++++---------- .../test/{ => repository}/maven-metadata.xml | 0 2 files changed, 22 insertions(+), 23 deletions(-) rename maven-repository-reports-standard/src/test/{ => repository}/maven-metadata.xml (100%) diff --git a/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java b/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java index bc75e85d8..89b5fde0f 100644 --- a/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java +++ b/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java @@ -140,25 +140,25 @@ public class AbstractChecksumArtifactReporterTest //Initialize variables for creating jar files FileOutputStream f = null; JarOutputStream out = null; - String repoUrl = super.repository.getUrl(); + String repoUrl = super.repository.getBasedir(); try { String dirs = filename.replace( '-', '/' ); - String[] split1 = repoUrl.split( "file:/" ); - split1[1] = split1[1] + "/"; + //String[] split1 = repoUrl.split( "file:/" ); + //split1[1] = split1[1] + "/"; //create the group level directory of the artifact - File dirFiles = new File( split1[1] + relativePath + dirs ); + File dirFiles = new File( repoUrl + relativePath + dirs ); if ( dirFiles.mkdirs() ) { // create a jar file - f = new FileOutputStream( split1[1] + relativePath + dirs + "/" + filename + "." + type ); + f = new FileOutputStream( repoUrl + relativePath + dirs + "/" + filename + "." + type ); out = new JarOutputStream( new BufferedOutputStream( f ) ); // jar sample.txt - String filename1 = split1[1] + relativePath + dirs + "/sample.txt"; + String filename1 = repoUrl + relativePath + dirs + "/sample.txt"; boolean bool = createSampleFile( filename1 ); BufferedReader in = new BufferedReader( new FileReader( filename1 ) ); @@ -172,8 +172,8 @@ public class AbstractChecksumArtifactReporterTest out.close(); //Create md5 and sha-1 checksum files.. - byte[] md5chk = createChecksum( split1[1] + relativePath + dirs + "/" + filename + "." + type, "MD5" ); - byte[] sha1chk = createChecksum( split1[1] + relativePath + dirs + "/" + filename + "." + type, "SHA-1" ); + byte[] md5chk = createChecksum( repoUrl + relativePath + dirs + "/" + filename + "." + type, "MD5" ); + byte[] sha1chk = createChecksum( repoUrl + relativePath + dirs + "/" + filename + "." + type, "SHA-1" ); System.out.println( "----- CREATED MD5 checksum ::: " + byteArrayToHexStr( md5chk ) ); System.out.println( "----- CREATED SHA-1 checksum ::: " + byteArrayToHexStr( sha1chk ) ); @@ -181,7 +181,7 @@ public class AbstractChecksumArtifactReporterTest if ( md5chk != null ) { - file = new File( split1[1] + relativePath + dirs + "/" + filename + "." + type + ".md5" ); + file = new File( repoUrl + relativePath + dirs + "/" + filename + "." + type + ".md5" ); OutputStream os = new FileOutputStream( file ); OutputStreamWriter osw = new OutputStreamWriter( os ); if ( !isValid ) @@ -193,7 +193,7 @@ public class AbstractChecksumArtifactReporterTest if ( sha1chk != null ) { - file = new File( split1[1] + relativePath + dirs + "/" + filename + "." + type + ".sha1" ); + file = new File( repoUrl + relativePath + dirs + "/" + filename + "." + type + ".sha1" ); OutputStream os = new FileOutputStream( file ); OutputStreamWriter osw = new OutputStreamWriter( os ); if ( !isValid ) @@ -226,23 +226,22 @@ public class AbstractChecksumArtifactReporterTest try { //create checksum for the metadata file.. - String repoUrl = super.repository.getUrl(); + String repoUrl = repository.getBasedir(); + //System.out.println("repoUrl ---->>> " + repoUrl); - //System.out.println( "REPO URL :::: " + repoUrl ); - String[] split1 = repoUrl.split( "file:/" ); - split1[1] = split1[1] + "/"; + System.out.println( "REPO URL :::: " + repoUrl ); + // String[] split1 = repoUrl.split( "file:/" ); + // split1[1] = split1[1] + "/"; - // get the pre-created metadata file - String[] split = split1[1].split( "/repository" ); - String url = split[0] + "/" + filename + "." + type; - //System.out.println( "URL of maven-metadata file :: " + url ); + String url = repository.getBasedir() + "/" + filename + "." + type; - boolean copied = copyFile( url, split1[1] + relativePath + filename + "." + type ); + boolean copied = copyFile( url, repoUrl + relativePath + filename + "." + type ); + //FileUtils.copyFile( new File( url ), new File( repoUrl + relativePath + filename + "." + type ) ); //System.out.println( "META FILE COPIED ---->>> " + copied ); //Create md5 and sha-1 checksum files.. - byte[] md5chk = createChecksum( split1[1] + relativePath + filename + "." + type, "MD5" ); - byte[] sha1chk = createChecksum( split1[1] + relativePath + filename + "." + type, "SHA-1" ); + byte[] md5chk = createChecksum( repoUrl + relativePath + filename + "." + type, "MD5" ); + byte[] sha1chk = createChecksum( repoUrl + relativePath + filename + "." + type, "SHA-1" ); System.out.println( "----- CREATED MD5 checksum ::: " + byteArrayToHexStr( md5chk ) ); System.out.println( "----- CREATED SHA-1 checksum ::: " + byteArrayToHexStr( sha1chk ) ); @@ -250,7 +249,7 @@ public class AbstractChecksumArtifactReporterTest if ( md5chk != null ) { - file = new File( split1[1] + relativePath + filename + "." + type + ".md5" ); + file = new File( repoUrl + relativePath + filename + "." + type + ".md5" ); OutputStream os = new FileOutputStream( file ); OutputStreamWriter osw = new OutputStreamWriter( os ); if ( !isValid ) @@ -262,7 +261,7 @@ public class AbstractChecksumArtifactReporterTest if ( sha1chk != null ) { - file = new File( split1[1] + relativePath + filename + "." + type + ".sha1" ); + file = new File( repoUrl + relativePath + filename + "." + type + ".sha1" ); OutputStream os = new FileOutputStream( file ); OutputStreamWriter osw = new OutputStreamWriter( os ); if ( !isValid ) diff --git a/maven-repository-reports-standard/src/test/maven-metadata.xml b/maven-repository-reports-standard/src/test/repository/maven-metadata.xml similarity index 100% rename from maven-repository-reports-standard/src/test/maven-metadata.xml rename to maven-repository-reports-standard/src/test/repository/maven-metadata.xml