From 5e51734d22f4541fcbf2d03aae24f7501b67abe1 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sat, 15 Apr 2023 02:47:43 +0200 Subject: [PATCH] [MGPG-94] Integration tests - convert and reformat bsh to groovy --- pom.xml | 5 ++ .../alternative-secret-keyring/verify.groovy | 37 ++++++++++++ .../verify.groovy} | 28 +++++---- .../setup.groovy} | 6 +- .../verify.bsh | 46 --------------- .../verify.groovy | 42 ++++++++++++++ .../setup.groovy} | 7 +-- .../{verify.bsh => verify.groovy} | 24 +++----- .../setup.groovy} | 7 +-- .../{verify.bsh => verify.groovy} | 24 +++----- .../setup.groovy} | 7 +-- .../{verify.bsh => verify.groovy} | 24 +++----- .../setup.bsh | 24 -------- .../setup.groovy | 21 +++++++ .../verify.groovy | 34 +++++++++++ src/it/sign-release-with-excludes/verify.bsh | 58 ------------------- .../verify.groovy} | 32 +++++----- .../{verify.bsh => verify.groovy} | 19 +++--- .../verify.bsh => sign-release/verify.groovy} | 24 ++++---- .../verify.bsh | 42 -------------- .../verify.groovy} | 24 +++----- 21 files changed, 232 insertions(+), 303 deletions(-) create mode 100644 src/it/alternative-secret-keyring/verify.groovy rename src/it/{sign-and-deploy-not-jar-packaging/verify.bsh => no-main-artifact/verify.groovy} (64%) rename src/it/{sign-and-deploy-file-without-pom/setup.bsh => sign-and-deploy-file-with-extras/setup.groovy} (87%) delete mode 100644 src/it/sign-and-deploy-file-with-extras/verify.bsh create mode 100644 src/it/sign-and-deploy-file-with-extras/verify.groovy rename src/it/{sign-and-deploy-files/setup.bsh => sign-and-deploy-file-with-pom/setup.groovy} (87%) rename src/it/sign-and-deploy-file-with-pom/{verify.bsh => verify.groovy} (67%) rename src/it/{sign-and-deploy-file-with-extras/setup.bsh => sign-and-deploy-file-without-pom/setup.groovy} (87%) rename src/it/sign-and-deploy-file-without-pom/{verify.bsh => verify.groovy} (67%) rename src/it/{sign-and-deploy-file-with-pom/setup.bsh => sign-and-deploy-files/setup.groovy} (87%) rename src/it/sign-and-deploy-files/{verify.bsh => verify.groovy} (73%) delete mode 100644 src/it/sign-and-deploy-not-jar-packaging/setup.bsh create mode 100644 src/it/sign-and-deploy-not-jar-packaging/setup.groovy create mode 100644 src/it/sign-and-deploy-not-jar-packaging/verify.groovy delete mode 100644 src/it/sign-release-with-excludes/verify.bsh rename src/it/{sign-release/verify.bsh => sign-release-with-excludes/verify.groovy} (62%) rename src/it/sign-release-without-passphrase/{verify.bsh => verify.groovy} (66%) rename src/it/{alternative-secret-keyring/verify.bsh => sign-release/verify.groovy} (69%) delete mode 100644 src/it/sign-with-passphase-from-maven-settings/verify.bsh rename src/it/{no-main-artifact/verify.bsh => sign-with-passphase-from-maven-settings/verify.groovy} (67%) diff --git a/pom.xml b/pom.xml index aa8aa25..6a3e857 100644 --- a/pom.xml +++ b/pom.xml @@ -189,6 +189,11 @@ under the License. + + org.apache.maven.plugins + maven-invoker-plugin + 3.5.1 + diff --git a/src/it/alternative-secret-keyring/verify.groovy b/src/it/alternative-secret-keyring/verify.groovy new file mode 100644 index 0000000..652827c --- /dev/null +++ b/src/it/alternative-secret-keyring/verify.groovy @@ -0,0 +1,37 @@ +/* + * 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. + */ +def artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0") + +def expectedFiles = [ + "test-1.0.pom", + "test-1.0.pom.asc", + "test-1.0-jdk15.jar", + "test-1.0-jdk15.jar.asc" +] + +expectedFiles.each { expectedFile -> + def file = new File(artifactDir, expectedFile) + + println "Checking for existence of $file" + + if (!file.isFile()) { + throw new Exception("Missing file $file") + } +} + diff --git a/src/it/sign-and-deploy-not-jar-packaging/verify.bsh b/src/it/no-main-artifact/verify.groovy similarity index 64% rename from src/it/sign-and-deploy-not-jar-packaging/verify.bsh rename to src/it/no-main-artifact/verify.groovy index e52bdcb..8dc2d1b 100644 --- a/src/it/sign-and-deploy-not-jar-packaging/verify.bsh +++ b/src/it/no-main-artifact/verify.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,23 +17,22 @@ * under the License. */ -import java.io.*; - -File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadnjp/test/1.0" ); +def artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0") -String[] expectedFiles = { - "test-1.0-javadoc.jar", - "test-1.0-javadoc.jar.asc", -}; +def expectedFiles = [ + "test-1.0.pom", + "test-1.0.pom.asc", + "test-1.0-jdk15.jar", + "test-1.0-jdk15.jar.asc" +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); +for (String expectedFile : expectedFiles) { + def file = new File(artifactDir, expectedFile) - System.out.println( "Checking for existence of " + file ); + println "Checking for existence of $file" - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); + if (!file.isFile()) { + throw new Exception("Missing file $file") } } + diff --git a/src/it/sign-and-deploy-file-without-pom/setup.bsh b/src/it/sign-and-deploy-file-with-extras/setup.groovy similarity index 87% rename from src/it/sign-and-deploy-file-without-pom/setup.bsh rename to src/it/sign-and-deploy-file-with-extras/setup.groovy index 03bc9f0..a842ab6 100644 --- a/src/it/sign-and-deploy-file-without-pom/setup.bsh +++ b/src/it/sign-and-deploy-file-with-extras/setup.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,7 +17,6 @@ * under the License. */ -import java.io.*; -import org.codehaus.plexus.util.*; +import org.codehaus.plexus.util.FileUtils -FileUtils.deleteDirectory( new File( basedir, "target" ) ); +FileUtils.deleteDirectory(new File(basedir, "target")) diff --git a/src/it/sign-and-deploy-file-with-extras/verify.bsh b/src/it/sign-and-deploy-file-with-extras/verify.bsh deleted file mode 100644 index 1e1752b..0000000 --- a/src/it/sign-and-deploy-file-with-extras/verify.bsh +++ /dev/null @@ -1,46 +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.*; - -File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadfwe/test/1.0" ); - -String[] expectedFiles = { - "test-1.0.jar", - "test-1.0.jar.asc", - "test-1.0-sources.jar", - "test-1.0-sources.jar.asc", - "test-1.0-javadoc.jar", - "test-1.0-javadoc.jar.asc", - "test-1.0.pom", - "test-1.0.pom.asc", -}; - -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); - - System.out.println( "Checking for existence of " + file ); - - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); - } -} diff --git a/src/it/sign-and-deploy-file-with-extras/verify.groovy b/src/it/sign-and-deploy-file-with-extras/verify.groovy new file mode 100644 index 0000000..9023ee2 --- /dev/null +++ b/src/it/sign-and-deploy-file-with-extras/verify.groovy @@ -0,0 +1,42 @@ +/* + * 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. + */ + +def artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadfwe/test/1.0") + +var expectedFiles = [ + "test-1.0.jar", + "test-1.0.jar.asc", + "test-1.0-sources.jar", + "test-1.0-sources.jar.asc", + "test-1.0-javadoc.jar", + "test-1.0-javadoc.jar.asc", + "test-1.0.pom", + "test-1.0.pom.asc" +] + +for (String expectedFile : expectedFiles) { + var file = new File(artifactDir, expectedFile) + + println "Checking for existence of $file" + + if (!file.isFile()) { + throw new Exception("Missing file $file") + } +} + diff --git a/src/it/sign-and-deploy-files/setup.bsh b/src/it/sign-and-deploy-file-with-pom/setup.groovy similarity index 87% rename from src/it/sign-and-deploy-files/setup.bsh rename to src/it/sign-and-deploy-file-with-pom/setup.groovy index 03bc9f0..a879aef 100644 --- a/src/it/sign-and-deploy-files/setup.bsh +++ b/src/it/sign-and-deploy-file-with-pom/setup.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,7 +17,7 @@ * under the License. */ -import java.io.*; -import org.codehaus.plexus.util.*; -FileUtils.deleteDirectory( new File( basedir, "target" ) ); +import org.codehaus.plexus.util.FileUtils + +FileUtils.deleteDirectory(new File(basedir, "target")) diff --git a/src/it/sign-and-deploy-file-with-pom/verify.bsh b/src/it/sign-and-deploy-file-with-pom/verify.groovy similarity index 67% rename from src/it/sign-and-deploy-file-with-pom/verify.bsh rename to src/it/sign-and-deploy-file-with-pom/verify.groovy index 909ce13..19bb184 100644 --- a/src/it/sign-and-deploy-file-with-pom/verify.bsh +++ b/src/it/sign-and-deploy-file-with-pom/verify.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,26 +16,21 @@ * specific language governing permissions and limitations * under the License. */ +var artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadfwp/test/1.0") -import java.io.*; - -File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadfwp/test/1.0" ); - -String[] expectedFiles = { +var expectedFiles = [ "test-1.0.jar", "test-1.0.jar.asc", "test-1.0.pom", - "test-1.0.pom.asc", -}; + "test-1.0.pom.asc" +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); +for (String expectedFile : expectedFiles) { + var file = new File(artifactDir, expectedFile) - System.out.println( "Checking for existence of " + file ); + println "Checking for existence of $file" - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); + if (!file.isFile()) { + throw new Exception("Missing file $file") } } diff --git a/src/it/sign-and-deploy-file-with-extras/setup.bsh b/src/it/sign-and-deploy-file-without-pom/setup.groovy similarity index 87% rename from src/it/sign-and-deploy-file-with-extras/setup.bsh rename to src/it/sign-and-deploy-file-without-pom/setup.groovy index 03bc9f0..b642e65 100644 --- a/src/it/sign-and-deploy-file-with-extras/setup.bsh +++ b/src/it/sign-and-deploy-file-without-pom/setup.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +16,6 @@ * specific language governing permissions and limitations * under the License. */ +import org.codehaus.plexus.util.FileUtils -import java.io.*; -import org.codehaus.plexus.util.*; - -FileUtils.deleteDirectory( new File( basedir, "target" ) ); +FileUtils.deleteDirectory(new File(basedir, "target")) diff --git a/src/it/sign-and-deploy-file-without-pom/verify.bsh b/src/it/sign-and-deploy-file-without-pom/verify.groovy similarity index 67% rename from src/it/sign-and-deploy-file-without-pom/verify.bsh rename to src/it/sign-and-deploy-file-without-pom/verify.groovy index 7019730..ac475df 100644 --- a/src/it/sign-and-deploy-file-without-pom/verify.bsh +++ b/src/it/sign-and-deploy-file-without-pom/verify.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,26 +16,21 @@ * specific language governing permissions and limitations * under the License. */ +var artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadfwop/test/1.0") -import java.io.*; - -File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadfwop/test/1.0" ); - -String[] expectedFiles = { +var expectedFiles = [ "test-1.0.jar", "test-1.0.jar.asc", "test-1.0.pom", - "test-1.0.pom.asc", -}; + "test-1.0.pom.asc" +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); +for (String expectedFile : expectedFiles) { + var file = new File(artifactDir, expectedFile) - System.out.println( "Checking for existence of " + file ); + println "Checking for existence of $file" - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); + if (!file.isFile()) { + throw new Exception("Missing file $file") } } diff --git a/src/it/sign-and-deploy-file-with-pom/setup.bsh b/src/it/sign-and-deploy-files/setup.groovy similarity index 87% rename from src/it/sign-and-deploy-file-with-pom/setup.bsh rename to src/it/sign-and-deploy-files/setup.groovy index 03bc9f0..b642e65 100644 --- a/src/it/sign-and-deploy-file-with-pom/setup.bsh +++ b/src/it/sign-and-deploy-files/setup.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +16,6 @@ * specific language governing permissions and limitations * under the License. */ +import org.codehaus.plexus.util.FileUtils -import java.io.*; -import org.codehaus.plexus.util.*; - -FileUtils.deleteDirectory( new File( basedir, "target" ) ); +FileUtils.deleteDirectory(new File(basedir, "target")) diff --git a/src/it/sign-and-deploy-files/verify.bsh b/src/it/sign-and-deploy-files/verify.groovy similarity index 73% rename from src/it/sign-and-deploy-files/verify.bsh rename to src/it/sign-and-deploy-files/verify.groovy index 38b8919..d680001 100644 --- a/src/it/sign-and-deploy-files/verify.bsh +++ b/src/it/sign-and-deploy-files/verify.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,12 +16,9 @@ * specific language governing permissions and limitations * under the License. */ +var artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadfs/test/1.0") -import java.io.*; - -File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadfs/test/1.0" ); - -String[] expectedFiles = { +var expectedFiles = [ "test-1.0.jar", "test-1.0.jar.asc", "test-1.0-sources.jar", @@ -36,17 +32,15 @@ String[] expectedFiles = { "test-1.0-src.tar.gz", "test-1.0-src.tar.gz.asc", "test-1.0.tar.gz", - "test-1.0.tar.gz.asc", -}; + "test-1.0.tar.gz.asc" +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); +for (String expectedFile : expectedFiles) { + var file = new File(artifactDir, expectedFile) - System.out.println( "Checking for existence of " + file ); + println "Checking for existence of $file" - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); + if (!file.isFile()) { + throw new Exception("Missing file $file") } } diff --git a/src/it/sign-and-deploy-not-jar-packaging/setup.bsh b/src/it/sign-and-deploy-not-jar-packaging/setup.bsh deleted file mode 100644 index 03bc9f0..0000000 --- a/src/it/sign-and-deploy-not-jar-packaging/setup.bsh +++ /dev/null @@ -1,24 +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 org.codehaus.plexus.util.*; - -FileUtils.deleteDirectory( new File( basedir, "target" ) ); diff --git a/src/it/sign-and-deploy-not-jar-packaging/setup.groovy b/src/it/sign-and-deploy-not-jar-packaging/setup.groovy new file mode 100644 index 0000000..b642e65 --- /dev/null +++ b/src/it/sign-and-deploy-not-jar-packaging/setup.groovy @@ -0,0 +1,21 @@ +/* + * 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.codehaus.plexus.util.FileUtils + +FileUtils.deleteDirectory(new File(basedir, "target")) diff --git a/src/it/sign-and-deploy-not-jar-packaging/verify.groovy b/src/it/sign-and-deploy-not-jar-packaging/verify.groovy new file mode 100644 index 0000000..d086cb4 --- /dev/null +++ b/src/it/sign-and-deploy-not-jar-packaging/verify.groovy @@ -0,0 +1,34 @@ +/* + * 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. + */ +var artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadnjp/test/1.0") + +var expectedFiles = [ + "test-1.0-javadoc.jar", + "test-1.0-javadoc.jar.asc" +] + +for (String expectedFile : expectedFiles) { + var file = new File(artifactDir, expectedFile) + + println "Checking for existence of $file" + + if (!file.isFile()) { + throw new Exception("Missing file $file") + } +} diff --git a/src/it/sign-release-with-excludes/verify.bsh b/src/it/sign-release-with-excludes/verify.bsh deleted file mode 100644 index b464464..0000000 --- a/src/it/sign-release-with-excludes/verify.bsh +++ /dev/null @@ -1,58 +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.File; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.List; -import org.codehaus.plexus.util.FileUtils; - -File artifactDir = new File( localRepositoryPath, "org/apache/maven/its/gpg/srwe/test/1.0" ); - -String[] expectedFiles = { - "_remote.repositories", - "test-1.0.pom", - "test-1.0.pom.asc", - "test-1.0.jar", - "test-1.0.jar.asc", - "test-1.0-sources.jar", - "test-1.0-sources.jar.asc", -}; - -for ( File file : artifactDir.listFiles() ) -{ - String fileName = file.getName(); - System.out.println( "Checking if file is expected: " + fileName ); - - boolean expected = false; - for ( String expectedFile : expectedFiles ) - { - if ( expectedFile.equals( fileName ) ) - { - expected = true; - break; - } - } - - if ( !expected ) - { - throw new Exception( "Unexpected file " + file ); - } -} diff --git a/src/it/sign-release/verify.bsh b/src/it/sign-release-with-excludes/verify.groovy similarity index 62% rename from src/it/sign-release/verify.bsh rename to src/it/sign-release-with-excludes/verify.groovy index 495669e..a19f510 100644 --- a/src/it/sign-release/verify.bsh +++ b/src/it/sign-release-with-excludes/verify.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,28 +16,31 @@ * specific language governing permissions and limitations * under the License. */ +var artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/srwe/test/1.0") -import java.io.*; - -File artifactDir = new File( localRepositoryPath, "org/apache/maven/its/gpg/sr/test/1.0" ); - -String[] expectedFiles = { +var expectedFiles = [ + "_remote.repositories", "test-1.0.pom", "test-1.0.pom.asc", "test-1.0.jar", "test-1.0.jar.asc", "test-1.0-sources.jar", - "test-1.0-sources.jar.asc", -}; + "test-1.0-sources.jar.asc" +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); +for (File file : artifactDir.listFiles()) { + var fileName = file.getName() + println "Checking if file is expected: $file" - System.out.println( "Checking for existence of " + file ); + var expected = false; + for (String expectedFile : expectedFiles) { + if (expectedFile == fileName) { + expected = true + break + } + } - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); + if (!expected) { + throw new Exception("Unexpected file $file") } } diff --git a/src/it/sign-release-without-passphrase/verify.bsh b/src/it/sign-release-without-passphrase/verify.groovy similarity index 66% rename from src/it/sign-release-without-passphrase/verify.bsh rename to src/it/sign-release-without-passphrase/verify.groovy index 8ff268c..eaeee90 100644 --- a/src/it/sign-release-without-passphrase/verify.bsh +++ b/src/it/sign-release-without-passphrase/verify.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +17,19 @@ * under the License. */ -import java.io.*; -import org.codehaus.plexus.util.FileUtils; -File buildLog = new File( basedir, "build.log" ); -String logContent = FileUtils.fileRead(buildLog); +import org.codehaus.plexus.util.FileUtils + +var buildLog = new File(basedir, "build.log") +var logContent = FileUtils.fileRead(buildLog) // assert that the Maven build properly failed and did not time out -if ( !logContent.contains( "Total time: " ) || !logContent.contains( "Finished at: " ) ) -{ - throw new Exception( "Maven build did not fail, but timed out" ); +if (!logContent.contains("Total time: ") || !logContent.contains("Finished at: ")) { + throw new Exception("Maven build did not fail, but timed out") } // assert that the Maven build failed, because pinentry is not allowed in non-interactive mode -if ( !logContent.contains( "[GNUPG:] FAILURE sign 67108949" ) ) -{ - throw new Exception( "Maven build did not fail in consequence of pinentry not being available to GPG" ); +if (!logContent.contains("[GNUPG:] FAILURE sign 67108949")) { + throw new Exception("Maven build did not fail in consequence of pinentry not being available to GPG") } diff --git a/src/it/alternative-secret-keyring/verify.bsh b/src/it/sign-release/verify.groovy similarity index 69% rename from src/it/alternative-secret-keyring/verify.bsh rename to src/it/sign-release/verify.groovy index 4cde67d..489b1b3 100644 --- a/src/it/alternative-secret-keyring/verify.bsh +++ b/src/it/sign-release/verify.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,26 +16,23 @@ * specific language governing permissions and limitations * under the License. */ +var artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/sr/test/1.0") -import java.io.*; - -File artifactDir = new File( localRepositoryPath, "org/apache/maven/its/gpg/ask/test/1.0" ); - -String[] expectedFiles = { +var expectedFiles = [ "test-1.0.pom", "test-1.0.pom.asc", "test-1.0.jar", "test-1.0.jar.asc", -}; + "test-1.0-sources.jar", + "test-1.0-sources.jar.asc" +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); +for (String expectedFile : expectedFiles) { + var file = new File(artifactDir, expectedFile) - System.out.println( "Checking for existence of " + file ); + println "Checking for existence of $file" - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); + if (!file.isFile()) { + throw new Exception("Missing file $file") } } diff --git a/src/it/sign-with-passphase-from-maven-settings/verify.bsh b/src/it/sign-with-passphase-from-maven-settings/verify.bsh deleted file mode 100644 index ee9dddb..0000000 --- a/src/it/sign-with-passphase-from-maven-settings/verify.bsh +++ /dev/null @@ -1,42 +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.*; - -File artifactDir = new File( localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0" ); - -String[] expectedFiles = { - "test-1.0.pom", - "test-1.0.pom.asc", - "test-1.0-jdk15.jar", - "test-1.0-jdk15.jar.asc", -}; - -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); - - System.out.println( "Checking for existence of " + file ); - - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); - } -} diff --git a/src/it/no-main-artifact/verify.bsh b/src/it/sign-with-passphase-from-maven-settings/verify.groovy similarity index 67% rename from src/it/no-main-artifact/verify.bsh rename to src/it/sign-with-passphase-from-maven-settings/verify.groovy index efa0463..49b5553 100644 --- a/src/it/no-main-artifact/verify.bsh +++ b/src/it/sign-with-passphase-from-maven-settings/verify.groovy @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,26 +16,21 @@ * specific language governing permissions and limitations * under the License. */ +var artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0") -import java.io.*; - -File artifactDir = new File( localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0" ); - -String[] expectedFiles = { +var expectedFiles = [ "test-1.0.pom", "test-1.0.pom.asc", "test-1.0-jdk15.jar", - "test-1.0-jdk15.jar.asc", -}; + "test-1.0-jdk15.jar.asc" +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( artifactDir, expectedFile ); +for (String expectedFile : expectedFiles) { + var file = new File(artifactDir, expectedFile) - System.out.println( "Checking for existence of " + file ); + println "Checking for existence of $file" - if ( !file.isFile() ) - { - throw new Exception( "Missing file " + file ); + if (!file.isFile()) { + throw new Exception("Missing file $file") } }