You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/09/01 20:07:07 UTC

[GitHub] [maven-gpg-plugin] Giovds opened a new pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Giovds opened a new pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14


   The command `mvn verify assembly:single gpg:sign` creates signed artifacts. It places the signed artifact alongside the original as long as the original artifact is stored in the project build directory. 
   
   However, if the original artifact is not stored in the project build directory, and depending on the `ascDirectory` (alias `outputDirectory`) in the pom configuration of the GPG plugin, this results in unexpected behaviour. For example, setting the `ascDirectory` to `target/tarball` results in the following directory structure `/path/to/project/target/gpg/target/tarball/`.
   
   This PR resolves the issue by checking whether the root directory - relative to the artifact - has been found and mostly adds integration tests to document this behaviour.
   
   ---
   
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MGPG-44) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[MGPG-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MGPG-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [x] You have run the integration tests successfully (`mvn -Prun-its clean verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] pzygielo commented on a change in pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
pzygielo commented on a change in pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#discussion_r704143106



##########
File path: src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
##########
@@ -0,0 +1,86 @@
+package org.apache.maven.plugins.gpg.it;
+
+/*
+ * 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.shared.invoker.InvocationRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.runners.Parameterized.*;
+
+@RunWith( Parameterized.class )
+public class GpgSignArtifactIT
+{
+    private final File mavenHome;
+    private final File localRepository;
+    private final File mavenUserSettings;
+    private final File gpgHome;
+
+    public GpgSignArtifactIT() throws Exception
+    {
+        this.mavenHome = new File( System.getProperty( "maven.home" ) );
+        this.localRepository = new File( System.getProperty( "localRepositoryPath" ) );
+        this.mavenUserSettings = InvokerTestUtils.getTestResource( "/it/settings-with-passphrase.xml" );
+        this.gpgHome = new File( System.getProperty( "gpg.homedir" ) );
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                { "/it/sign-release-with-artifact/pom.xml", "/target/gpg/tarballs/", new String[]{ "sign-release-with-artifact-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory/pom.xml", "/target/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory-root/pom.xml", "/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-root-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-same-directory/pom.xml", "/target/tarballs/", new String[]{ "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar", "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar.asc" } },
+        });
+    }
+
+    @Parameter
+    public String pomPath;
+    @Parameter(1)
+    public String expectedFileLocation;
+    @Parameter(2)
+    public String[] expectedFiles;
+
+    @Test
+    public void testPlacementOfArtifactInOutputDirectory() throws Exception
+    {
+        // given
+        final File pomFile = InvokerTestUtils.getTestResource( pomPath );
+        final InvocationRequest request = InvokerTestUtils.createRequest( pomFile, mavenUserSettings, gpgHome );
+        final File integrationTestRootDirectory = new File( pomFile.getParent());
+        final File expectedOutputDirectory = new File (integrationTestRootDirectory + expectedFileLocation );

Review comment:
       > I would've expected Checkstyle or something to break on the missing ` ` after the opening bracket.
   
   https://github.com/apache/maven-dependency-plugin/pull/47#discussion_r418956128
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] Giovds commented on a change in pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
Giovds commented on a change in pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#discussion_r703794993



##########
File path: src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
##########
@@ -0,0 +1,85 @@
+package org.apache.maven.plugins.gpg.it;
+
+/*
+ * 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.shared.invoker.InvocationRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.runners.Parameterized.*;
+
+@RunWith( Parameterized.class )
+public class GpgSignArtifactIT
+{
+    private final File mavenHome;
+    private final File localRepository;
+    private final File mavenUserSettings;
+    private final File gpgHome;
+
+    public GpgSignArtifactIT() throws Exception
+    {
+        this.mavenHome = new File( System.getProperty( "maven.home" ) );
+        this.localRepository = new File( System.getProperty( "localRepositoryPath" ) );
+        this.mavenUserSettings = InvokerTestUtils.getTestResource( "/it/settings-with-passphrase.xml" );
+        this.gpgHome = new File( System.getProperty( "gpg.homedir" ) );
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                { "/it/sign-release-with-artifact/pom.xml", "/target/gpg/tarballs/", new String[]{ "sign-release-with-artifact-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory/pom.xml", "/target/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory-root/pom.xml", "/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-root-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-same-directory/pom.xml", "/target/tarballs/", new String[]{ "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar", "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar.asc" } },
+        });
+    }
+
+    @Parameter
+    public String pomPath;
+    @Parameter(1)
+    public String expectedFileLocation;
+    @Parameter(2)
+    public String[] expectedFiles;
+
+    @Test
+    public void testFolderStructureWithArtifactAndDefaultOutputDirectory() throws Exception
+    {
+        // given
+        final File pomFile = InvokerTestUtils.getTestResource( pomPath );
+        final InvocationRequest request = InvokerTestUtils.createRequest( pomFile, mavenUserSettings, gpgHome );
+        final File integrationTestRootDirectory = new File( pomFile.getParent());
+        final File expectedOutputDirectory =  new File (integrationTestRootDirectory + expectedFileLocation );
+
+        // when
+        InvokerTestUtils.executeRequest( request, mavenHome, localRepository );
+
+        // then
+        assertThat( expectedOutputDirectory.exists(), equalTo( true ) );
+        assertThat( expectedOutputDirectory.list(), equalTo( expectedFiles ) );

Review comment:
       Good catch! I've pushed a change to make the test order agnostic.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] asfgit closed pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] mthmulders commented on a change in pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
mthmulders commented on a change in pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#discussion_r703202084



##########
File path: src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
##########
@@ -0,0 +1,85 @@
+package org.apache.maven.plugins.gpg.it;
+
+/*
+ * 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.shared.invoker.InvocationRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.runners.Parameterized.*;
+
+@RunWith( Parameterized.class )
+public class GpgSignArtifactIT
+{
+    private final File mavenHome;
+    private final File localRepository;
+    private final File mavenUserSettings;
+    private final File gpgHome;
+
+    public GpgSignArtifactIT() throws Exception
+    {
+        this.mavenHome = new File( System.getProperty( "maven.home" ) );
+        this.localRepository = new File( System.getProperty( "localRepositoryPath" ) );
+        this.mavenUserSettings = InvokerTestUtils.getTestResource( "/it/settings-with-passphrase.xml" );
+        this.gpgHome = new File( System.getProperty( "gpg.homedir" ) );
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                { "/it/sign-release-with-artifact/pom.xml", "/target/gpg/tarballs/", new String[]{ "sign-release-with-artifact-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory/pom.xml", "/target/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory-root/pom.xml", "/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-root-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-same-directory/pom.xml", "/target/tarballs/", new String[]{ "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar", "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar.asc" } },
+        });
+    }
+
+    @Parameter
+    public String pomPath;
+    @Parameter(1)
+    public String expectedFileLocation;
+    @Parameter(2)
+    public String[] expectedFiles;
+
+    @Test
+    public void testFolderStructureWithArtifactAndDefaultOutputDirectory() throws Exception
+    {
+        // given
+        final File pomFile = InvokerTestUtils.getTestResource( pomPath );
+        final InvocationRequest request = InvokerTestUtils.createRequest( pomFile, mavenUserSettings, gpgHome );
+        final File integrationTestRootDirectory = new File( pomFile.getParent());
+        final File expectedOutputDirectory =  new File (integrationTestRootDirectory + expectedFileLocation );
+
+        // when
+        InvokerTestUtils.executeRequest( request, mavenHome, localRepository );
+
+        // then
+        assertThat( expectedOutputDirectory.exists(), equalTo( true ) );
+        assertThat( expectedOutputDirectory.list(), equalTo( expectedFiles ) );

Review comment:
       A `List` is ordered, and as a result, this test can fail because the `expectedFiles` are ordered differently than the result of `expectedOutputDirectory.list()`. As a result, this is a potentially flaky test.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] mthmulders commented on a change in pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
mthmulders commented on a change in pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#discussion_r718215674



##########
File path: src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
##########
@@ -0,0 +1,86 @@
+package org.apache.maven.plugins.gpg.it;
+
+/*
+ * 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.shared.invoker.InvocationRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.runners.Parameterized.*;
+
+@RunWith( Parameterized.class )
+public class GpgSignArtifactIT
+{
+    private final File mavenHome;
+    private final File localRepository;
+    private final File mavenUserSettings;
+    private final File gpgHome;
+
+    public GpgSignArtifactIT() throws Exception
+    {
+        this.mavenHome = new File( System.getProperty( "maven.home" ) );
+        this.localRepository = new File( System.getProperty( "localRepositoryPath" ) );
+        this.mavenUserSettings = InvokerTestUtils.getTestResource( "/it/settings-with-passphrase.xml" );
+        this.gpgHome = new File( System.getProperty( "gpg.homedir" ) );
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                { "/it/sign-release-with-artifact/pom.xml", "/target/gpg/tarballs/", new String[]{ "sign-release-with-artifact-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory/pom.xml", "/target/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory-root/pom.xml", "/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-root-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-same-directory/pom.xml", "/target/tarballs/", new String[]{ "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar", "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar.asc" } },
+        });
+    }
+
+    @Parameter
+    public String pomPath;
+    @Parameter(1)
+    public String expectedFileLocation;
+    @Parameter(2)
+    public String[] expectedFiles;
+
+    @Test
+    public void testPlacementOfArtifactInOutputDirectory() throws Exception
+    {
+        // given
+        final File pomFile = InvokerTestUtils.getTestResource( pomPath );
+        final InvocationRequest request = InvokerTestUtils.createRequest( pomFile, mavenUserSettings, gpgHome );
+        final File integrationTestRootDirectory = new File( pomFile.getParent());
+        final File expectedOutputDirectory = new File (integrationTestRootDirectory + expectedFileLocation );

Review comment:
       Also, `new File ( null + "child-path" )` will most likely result in a failing test where the word "null" appears, which is a nice pointer :-)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] Giovds commented on a change in pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
Giovds commented on a change in pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#discussion_r705752442



##########
File path: src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
##########
@@ -0,0 +1,86 @@
+package org.apache.maven.plugins.gpg.it;
+
+/*
+ * 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.shared.invoker.InvocationRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.runners.Parameterized.*;
+
+@RunWith( Parameterized.class )
+public class GpgSignArtifactIT
+{
+    private final File mavenHome;
+    private final File localRepository;
+    private final File mavenUserSettings;
+    private final File gpgHome;
+
+    public GpgSignArtifactIT() throws Exception
+    {
+        this.mavenHome = new File( System.getProperty( "maven.home" ) );
+        this.localRepository = new File( System.getProperty( "localRepositoryPath" ) );
+        this.mavenUserSettings = InvokerTestUtils.getTestResource( "/it/settings-with-passphrase.xml" );
+        this.gpgHome = new File( System.getProperty( "gpg.homedir" ) );
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                { "/it/sign-release-with-artifact/pom.xml", "/target/gpg/tarballs/", new String[]{ "sign-release-with-artifact-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory/pom.xml", "/target/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory-root/pom.xml", "/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-root-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-same-directory/pom.xml", "/target/tarballs/", new String[]{ "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar", "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar.asc" } },
+        });
+    }
+
+    @Parameter
+    public String pomPath;
+    @Parameter(1)
+    public String expectedFileLocation;
+    @Parameter(2)
+    public String[] expectedFiles;
+
+    @Test
+    public void testPlacementOfArtifactInOutputDirectory() throws Exception
+    {
+        // given
+        final File pomFile = InvokerTestUtils.getTestResource( pomPath );
+        final InvocationRequest request = InvokerTestUtils.createRequest( pomFile, mavenUserSettings, gpgHome );
+        final File integrationTestRootDirectory = new File( pomFile.getParent());
+        final File expectedOutputDirectory = new File (integrationTestRootDirectory + expectedFileLocation );

Review comment:
       My personal preference goes to string concatenation, since this decreases the chance of a flaky test. That being said, whichever approach is preferred more is fine by me, as the chances of it happening are rather low.
   
   If the parent in `new File( parent, child )` is null then the new File instance is created as if by invoking the single-argument File constructor on the given child pathname string. In theory both approaches can pass, however I expect that ` new File ( null + "child-path" )` is less likely to pass, as this results in a path like `"nullchild-path"`, instead of `"child-path"`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] asfgit closed pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] mthmulders commented on pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
mthmulders commented on pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#issuecomment-929918613


   Failed because branch name is too long; renamed branch to something shorter and [trying again](https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-gpg-plugin/job/MGPG-44/).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] mthmulders commented on a change in pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
mthmulders commented on a change in pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#discussion_r704127075



##########
File path: src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
##########
@@ -0,0 +1,86 @@
+package org.apache.maven.plugins.gpg.it;
+
+/*
+ * 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.shared.invoker.InvocationRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.runners.Parameterized.*;
+
+@RunWith( Parameterized.class )
+public class GpgSignArtifactIT
+{
+    private final File mavenHome;
+    private final File localRepository;
+    private final File mavenUserSettings;
+    private final File gpgHome;
+
+    public GpgSignArtifactIT() throws Exception
+    {
+        this.mavenHome = new File( System.getProperty( "maven.home" ) );
+        this.localRepository = new File( System.getProperty( "localRepositoryPath" ) );
+        this.mavenUserSettings = InvokerTestUtils.getTestResource( "/it/settings-with-passphrase.xml" );
+        this.gpgHome = new File( System.getProperty( "gpg.homedir" ) );
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                { "/it/sign-release-with-artifact/pom.xml", "/target/gpg/tarballs/", new String[]{ "sign-release-with-artifact-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory/pom.xml", "/target/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory-root/pom.xml", "/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-root-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-same-directory/pom.xml", "/target/tarballs/", new String[]{ "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar", "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar.asc" } },
+        });
+    }
+
+    @Parameter
+    public String pomPath;
+    @Parameter(1)
+    public String expectedFileLocation;
+    @Parameter(2)
+    public String[] expectedFiles;
+
+    @Test
+    public void testPlacementOfArtifactInOutputDirectory() throws Exception
+    {
+        // given
+        final File pomFile = InvokerTestUtils.getTestResource( pomPath );
+        final InvocationRequest request = InvokerTestUtils.createRequest( pomFile, mavenUserSettings, gpgHome );
+        final File integrationTestRootDirectory = new File( pomFile.getParent());
+        final File expectedOutputDirectory = new File (integrationTestRootDirectory + expectedFileLocation );

Review comment:
       I would've expected Checkstyle or something to break on the missing ` ` after the opening bracket. Also, I believe it's better to not do String concatenation when constructing a `File` instance:
   
   ```suggestion
           final File expectedOutputDirectory = new File ( integrationTestRootDirectory, expectedFileLocation );
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] Giovds commented on a change in pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
Giovds commented on a change in pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#discussion_r705752442



##########
File path: src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
##########
@@ -0,0 +1,86 @@
+package org.apache.maven.plugins.gpg.it;
+
+/*
+ * 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.shared.invoker.InvocationRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.runners.Parameterized.*;
+
+@RunWith( Parameterized.class )
+public class GpgSignArtifactIT
+{
+    private final File mavenHome;
+    private final File localRepository;
+    private final File mavenUserSettings;
+    private final File gpgHome;
+
+    public GpgSignArtifactIT() throws Exception
+    {
+        this.mavenHome = new File( System.getProperty( "maven.home" ) );
+        this.localRepository = new File( System.getProperty( "localRepositoryPath" ) );
+        this.mavenUserSettings = InvokerTestUtils.getTestResource( "/it/settings-with-passphrase.xml" );
+        this.gpgHome = new File( System.getProperty( "gpg.homedir" ) );
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                { "/it/sign-release-with-artifact/pom.xml", "/target/gpg/tarballs/", new String[]{ "sign-release-with-artifact-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory/pom.xml", "/target/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory-root/pom.xml", "/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-root-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-same-directory/pom.xml", "/target/tarballs/", new String[]{ "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar", "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar.asc" } },
+        });
+    }
+
+    @Parameter
+    public String pomPath;
+    @Parameter(1)
+    public String expectedFileLocation;
+    @Parameter(2)
+    public String[] expectedFiles;
+
+    @Test
+    public void testPlacementOfArtifactInOutputDirectory() throws Exception
+    {
+        // given
+        final File pomFile = InvokerTestUtils.getTestResource( pomPath );
+        final InvocationRequest request = InvokerTestUtils.createRequest( pomFile, mavenUserSettings, gpgHome );
+        final File integrationTestRootDirectory = new File( pomFile.getParent());
+        final File expectedOutputDirectory = new File (integrationTestRootDirectory + expectedFileLocation );

Review comment:
       My personal preference goes to string concatenation, since this decreases the chance of a flaky test. That being said, whichever approach is preferred more is fine by me, as the chances of it happening are rather low.
   
   If the parent in `new File( parent, child )` is null then the new File instance is created as if by invoking the single-argument File constructor on the given child pathname string. In theory both approaches can pass, however I expect that
   ` new File ( null + "child-path" )` is less likely to pass, as this results in a path like `"nullchild-path"`, instead of 
   `"child-path"`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] mthmulders commented on pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
mthmulders commented on pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#issuecomment-929909504


   [Running through Jenkins](https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-gpg-plugin/job/MGPG-44-gpg-sign-remove-target-prefix-in-output-directory/)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] mthmulders commented on pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
mthmulders commented on pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#issuecomment-929909504






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-gpg-plugin] mthmulders commented on a change in pull request #14: [MGPG-44] gpg:sign fix non-default output directory

Posted by GitBox <gi...@apache.org>.
mthmulders commented on a change in pull request #14:
URL: https://github.com/apache/maven-gpg-plugin/pull/14#discussion_r718215674



##########
File path: src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
##########
@@ -0,0 +1,86 @@
+package org.apache.maven.plugins.gpg.it;
+
+/*
+ * 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.shared.invoker.InvocationRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.runners.Parameterized.*;
+
+@RunWith( Parameterized.class )
+public class GpgSignArtifactIT
+{
+    private final File mavenHome;
+    private final File localRepository;
+    private final File mavenUserSettings;
+    private final File gpgHome;
+
+    public GpgSignArtifactIT() throws Exception
+    {
+        this.mavenHome = new File( System.getProperty( "maven.home" ) );
+        this.localRepository = new File( System.getProperty( "localRepositoryPath" ) );
+        this.mavenUserSettings = InvokerTestUtils.getTestResource( "/it/settings-with-passphrase.xml" );
+        this.gpgHome = new File( System.getProperty( "gpg.homedir" ) );
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                { "/it/sign-release-with-artifact/pom.xml", "/target/gpg/tarballs/", new String[]{ "sign-release-with-artifact-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory/pom.xml", "/target/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-and-output-directory-root/pom.xml", "/signed-files/tarballs/", new String[]{ "sign-release-with-artifact-and-output-directory-root-1.0-jar-with-dependencies.jar.asc" } },
+                { "/it/sign-release-with-artifact-same-directory/pom.xml", "/target/tarballs/", new String[]{ "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar", "sign-release-with-artifact-same-directory-1.0-jar-with-dependencies.jar.asc" } },
+        });
+    }
+
+    @Parameter
+    public String pomPath;
+    @Parameter(1)
+    public String expectedFileLocation;
+    @Parameter(2)
+    public String[] expectedFiles;
+
+    @Test
+    public void testPlacementOfArtifactInOutputDirectory() throws Exception
+    {
+        // given
+        final File pomFile = InvokerTestUtils.getTestResource( pomPath );
+        final InvocationRequest request = InvokerTestUtils.createRequest( pomFile, mavenUserSettings, gpgHome );
+        final File integrationTestRootDirectory = new File( pomFile.getParent());
+        final File expectedOutputDirectory = new File (integrationTestRootDirectory + expectedFileLocation );

Review comment:
       Also, `new File ( null + "child-path" )` will most likely result in a failing test where the word "null" appears, which is a nice pointer :-)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org