diff --git a/pom.xml b/pom.xml index 94af8952..1033d18e 100644 --- a/pom.xml +++ b/pom.xml @@ -201,14 +201,9 @@ under the License. verify ${project.build.directory}/local-repo src/it/settings.xml - true deploy - - - ${https.protocols} - diff --git a/src/it/attach-jar-checksum-release/pom.xml b/src/it/attach-jar-checksum-release/pom.xml deleted file mode 100644 index bda659d4..00000000 --- a/src/it/attach-jar-checksum-release/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - 4.0.0 - - org.apache.maven.its.deploy.ajc - test - 1.0 - jar - - - This test has been moved from maven-install-plugin to maven-deploy-plugin. - Tests the installation of a simple snapshot JAR with an attached artifact and checksums - - - - true - - - - it - file:///${basedir}/target/remoterepo - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - - org.apache.maven.plugins - maven-deploy-plugin - @project.version@ - - - - org.apache.maven.plugins - maven-install-plugin - 2.5.2 - - false - - - - org.apache.maven.plugins - maven-jar-plugin - 2.1 - - - org.apache.maven.plugins - maven-resources-plugin - 2.2 - - - org.apache.maven.plugins - maven-source-plugin - 2.0.4 - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.3.1 - - - - - diff --git a/src/it/attach-jar-checksum-release/setup.bsh b/src/it/attach-jar-checksum-release/setup.bsh deleted file mode 100644 index 4d739715..00000000 --- a/src/it/attach-jar-checksum-release/setup.bsh +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( basedir, "org/apache/maven/its/deploy/ajc" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/attach-jar-checksum-release/verify.groovy b/src/it/attach-jar-checksum-release/verify.groovy deleted file mode 100644 index ac362f81..00000000 --- a/src/it/attach-jar-checksum-release/verify.groovy +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.*; -import java.util.*; - -import org.apache.maven.plugins.deploy.Utils; - -def paths = -[ - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom.md5", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom.sha1", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar.md5", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar.sha1", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.md5", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.sha1", - "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml", - "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.md5", - "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.sha1", -] - -def cksumToCheckPaths = [ - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar", - "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar" -] - -// Check if artifacts have been uploaded to remote with checksums -def repository = new File (basedir, "target/remoterepo" ) -paths.each { path -> - //File file = new File( localRepositoryPath, path ); - File file = new File( repository, path ); - println "Checking for existence of ${file}" - if ( !file.isFile() ) - { - throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() ); - } - if ( cksumToCheckPaths.contains( path ) ) - { - println "Verifying ${file}" - Utils.verifyChecksum( file ); - } -} - -return true; diff --git a/src/it/attach-jar-checksum-snapshot/pom.xml b/src/it/attach-jar-checksum-snapshot/pom.xml deleted file mode 100644 index 89ddce78..00000000 --- a/src/it/attach-jar-checksum-snapshot/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - 4.0.0 - - org.apache.maven.its.deploy.ajc - test - 1.0-SNAPSHOT - jar - - - Tests the deployment of a simple SNAPSHOT JAR with an attached artifact and checksums - - - - true - - - - it - file:///${basedir}/target/remoterepo - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - - org.apache.maven.plugins - maven-deploy-plugin - @project.version@ - - - org.apache.maven.plugins - maven-jar-plugin - 2.1 - - - - org.apache.maven.plugins - maven-install-plugin - 2.5.2 - - false - - - - org.apache.maven.plugins - maven-resources-plugin - 2.2 - - - org.apache.maven.plugins - maven-source-plugin - 2.0.4 - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.3.1 - - - - - diff --git a/src/it/attach-jar-checksum-snapshot/setup.bsh b/src/it/attach-jar-checksum-snapshot/setup.bsh deleted file mode 100644 index 7d54f90e..00000000 --- a/src/it/attach-jar-checksum-snapshot/setup.bsh +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/attach-jar-checksum-snapshot/verify.groovy b/src/it/attach-jar-checksum-snapshot/verify.groovy deleted file mode 100644 index 0a4a14f9..00000000 --- a/src/it/attach-jar-checksum-snapshot/verify.groovy +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 org.apache.maven.plugins.deploy.Utils; - -def pathsInTargetDirectory = [ - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom\\.md5", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom\\.sha1", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar\\.md5", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar\\.sha1", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar\\.md5", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar\\.sha1", - //The following files will be generated. But they can't be check for the checksums - //cause they contain timestamps which means they change everytime. - "maven\\-metadata\\.xml", - "maven\\-metadata\\.xml\\.md5", - "maven\\-metadata\\.xml\\.sha1", -] - -def checkSumsToCheckPaths = [ - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar", - "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar", -] - -// All files are being deployed to that location. See pom.xml -def repository = new File (basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT" ) - -// Read all files from the target directory. -def filesInDirectory = [] -repository.eachFile() { file -> - filesInDirectory << file.getName() -} - -println "Size: ${filesInDirectory.size()} / ${pathsInTargetDirectory.size()}" - -// First Step is to check the number of files found in directory against -// the number of files we expect to find. -if (filesInDirectory.size() != pathsInTargetDirectory.size()) { - throw new Exception( "The number of files in filesInDirectory and the number of files in pathsInTargetDirectory are not equal" ); -} - -// The following will check for the existence of all given -// files based on the given regular expressions. -// This is needed cause the time stamp in the file name -// changes each time this test will be running. -filesInDirectory.each { existingFile -> - def result = false - pathsInTargetDirectory.each { searchItem -> - def expected = existingFile ==~ searchItem - println "existingFile: ${existingFile} ${searchItem} expeced:${expected}" - if (expected) { - result = true - } - } - - if (!result) { - throw new FileNotFoundException ( "Missing: ${existingFile}" ) - } -} - -// The following will check the existing checksums. -filesInDirectory.each { existingFile -> - def result = false - checkSumsToCheckPaths.each { searchItem -> - //search for the file name pattern.. - def expected = existingFile ==~ searchItem - if (expected) { - println "Verifying ${existingFile}" - Utils.verifyChecksum( new File(repository, existingFile) ); - } - } -} - -return true; - diff --git a/src/test/java/org/apache/maven/plugins/deploy/Utils.java b/src/test/java/org/apache/maven/plugins/deploy/Utils.java deleted file mode 100644 index 4df74424..00000000 --- a/src/test/java/org/apache/maven/plugins/deploy/Utils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.apache.maven.plugins.deploy; - -/* - * 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 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 null. - * @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 checksums = ChecksumUtils.calc( file, CHECKSUM_ALGORITHMS ); - for ( Map.Entry 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 ); - } - } - } - -}