You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2020/06/11 12:53:22 UTC
[maven-install-plugin] branch warn updated: remove checksum code
that was commented out
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch warn
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git
The following commit(s) were added to refs/heads/warn by this push:
new 2123d3d remove checksum code that was commented out
2123d3d is described below
commit 2123d3d4c39fbb7e911b1ac340769837c8b5d7bf
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Thu Jun 11 08:53:08 2020 -0400
remove checksum code that was commented out
---
.../maven/plugins/install/InstallFileMojoTest.java | 2 +-
.../maven/plugins/install/InstallMojoTest.java | 33 +-----------
.../org/apache/maven/plugins/install/Utils.java | 63 ----------------------
3 files changed, 2 insertions(+), 96 deletions(-)
diff --git a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
index e954623..8b3b070 100644
--- a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
@@ -234,7 +234,7 @@ public class InstallFileMojoTest
assertEquals( 4, FileUtils.getFiles( new File( LOCAL_REPO ), null, null ).size() );
}
- public void testInstallFileWithChecksum()
+ public void testInstallFile()
throws Exception
{
File testPom =
diff --git a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
index e211a18..63ac6fa 100644
--- a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
@@ -58,14 +58,7 @@ public class InstallMojoTest
{
super.setUp();
- System.out.println( ">>>Cleaning local repo " + getBasedir() + "/" + LOCAL_REPO + "..." );
-
FileUtils.deleteDirectory( new File( getBasedir() + "/" + LOCAL_REPO ) );
-
-// LegacySupport legacySupport = lookup( LegacySupport.class );
-// RepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
-// MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest();
-// legacySupport.setSession( new MavenSession( getContainer(), repositorySession, executionRequest, null ) );
}
public void testInstallTestEnvironment()
@@ -250,7 +243,7 @@ public class InstallMojoTest
assertEquals( 4, FileUtils.getFiles( new File( LOCAL_REPO ), null, null ).size() );
}
- public void testBasicInstallAndCreateChecksumIsTrue()
+ public void testBasicInstallAndCreate()
throws Exception
{
File testPom = new File( getBasedir(), "target/test-classes/unit/basic-install-checksum/plugin-config.xml" );
@@ -270,10 +263,6 @@ public class InstallMojoTest
artifact = (InstallArtifactStub) project.getArtifact();
-// boolean createChecksum = (Boolean) getVariableValueFromObject( mojo, "createChecksum" );
-//
-// assertTrue( createChecksum );
-
artifact.setFile( file );
mojo.execute();
@@ -302,31 +291,11 @@ public class InstallMojoTest
String localPath = getBasedir() + "/" + LOCAL_REPO + groupId + "/" + artifact.getArtifactId() + "/" +
artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion();
- //get the actual checksum of the pom
-// Map<String, Object> csums = ChecksumUtils.calc( pom, Utils.CHECKSUM_ALGORITHMS );
-// for (Map.Entry<String, Object> csum : csums.entrySet()) {
-// Object actualPomSum = csum.getValue();
-// File pomSum = new File( localPath + ".pom." + csum.getKey().toLowerCase().replace( "-", "" ) );
-// assertTrue( pomSum.exists() );
-// String generatedPomSum = FileUtils.fileRead( pomSum, "UTF-8" );
-// assertEquals( actualPomSum, generatedPomSum );
-// }
-
- //get the actual checksum of the artifact
-// csums = ChecksumUtils.calc( file, Utils.CHECKSUM_ALGORITHMS );
-// for (Map.Entry<String, Object> csum : csums.entrySet()) {
-// Object actualSum = csum.getValue();
-// File sum = new File( localPath + "." + packaging + "." + csum.getKey().toLowerCase().replace( "-", "" ) );
-// assertTrue( sum.exists() );
-// String generatedSum = FileUtils.fileRead( sum, "UTF-8" );
-// assertEquals( actualSum, generatedSum );
-// }
File installedArtifact = new File( localPath + "." + packaging );
assertTrue( installedArtifact.exists() );
-// assertEquals( 9, FileUtils.getFiles( new File( LOCAL_REPO ), null, null ).size() );
assertEquals( 5, FileUtils.getFiles( new File( LOCAL_REPO ), null, null ).size() );
}
diff --git a/src/test/java/org/apache/maven/plugins/install/Utils.java b/src/test/java/org/apache/maven/plugins/install/Utils.java
deleted file mode 100644
index 33c262c..0000000
--- a/src/test/java/org/apache/maven/plugins/install/Utils.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.maven.plugins.install;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.sonatype.aether.util.ChecksumUtils;
-
-/**
- * A utility class to assist testing.
- *
- * @author Benjamin Bentmann
- */
-public class Utils
-{
-
- public static final List<String> CHECKSUM_ALGORITHMS = Arrays.asList( "MD5", "SHA-1" );
-
- /**
- * Verifies the checksum files in the local repo for the given file.
- *
- * @param file The file to verify its checksum with, must not be <code>null</code>.
- * @throws MojoExecutionException In case the checksums were incorrect.
- * @throws IOException If the files couldn't be read.
- */
- public static void verifyChecksum( File file )
- throws MojoExecutionException, IOException
- {
- Map<String, Object> checksums = ChecksumUtils.calc( file, CHECKSUM_ALGORITHMS );
- for ( Map.Entry<String, Object> entry : checksums.entrySet() )
- {
- File cksumFile = new File( file + "." + entry.getKey().toLowerCase().replace( "-", "" ) );
- String actualChecksum = ChecksumUtils.read( cksumFile );
- if ( !actualChecksum.equals( entry.getValue() ) )
- {
- throw new MojoExecutionException( "Incorrect " + entry.getKey() + " checksum for file: " + file );
- }
- }
- }
-
-}