Skip to content

Commit 5e51734

Browse files
committed
[MGPG-94] Integration tests - convert and reformat bsh to groovy
1 parent 955ea0e commit 5e51734

File tree

21 files changed

+232
-303
lines changed

21 files changed

+232
-303
lines changed

pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ under the License.
189189
</excludes>
190190
</configuration>
191191
</plugin>
192+
<plugin>
193+
<groupId>org.apache.maven.plugins</groupId>
194+
<artifactId>maven-invoker-plugin</artifactId>
195+
<version>3.5.1</version>
196+
</plugin>
192197
</plugins>
193198
</pluginManagement>
194199
<plugins>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
def artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0")
20+
21+
def expectedFiles = [
22+
"test-1.0.pom",
23+
"test-1.0.pom.asc",
24+
"test-1.0-jdk15.jar",
25+
"test-1.0-jdk15.jar.asc"
26+
]
27+
28+
expectedFiles.each { expectedFile ->
29+
def file = new File(artifactDir, expectedFile)
30+
31+
println "Checking for existence of $file"
32+
33+
if (!file.isFile()) {
34+
throw new Exception("Missing file $file")
35+
}
36+
}
37+
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
@@ -18,23 +17,22 @@
1817
* under the License.
1918
*/
2019

21-
import java.io.*;
22-
23-
File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadnjp/test/1.0" );
20+
def artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0")
2421

25-
String[] expectedFiles = {
26-
"test-1.0-javadoc.jar",
27-
"test-1.0-javadoc.jar.asc",
28-
};
22+
def expectedFiles = [
23+
"test-1.0.pom",
24+
"test-1.0.pom.asc",
25+
"test-1.0-jdk15.jar",
26+
"test-1.0-jdk15.jar.asc"
27+
]
2928

30-
for ( String expectedFile : expectedFiles )
31-
{
32-
File file = new File( artifactDir, expectedFile );
29+
for (String expectedFile : expectedFiles) {
30+
def file = new File(artifactDir, expectedFile)
3331

34-
System.out.println( "Checking for existence of " + file );
32+
println "Checking for existence of $file"
3533

36-
if ( !file.isFile() )
37-
{
38-
throw new Exception( "Missing file " + file );
34+
if (!file.isFile()) {
35+
throw new Exception("Missing file $file")
3936
}
4037
}
38+

src/it/sign-and-deploy-file-without-pom/setup.bsh src/it/sign-and-deploy-file-with-extras/setup.groovy

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +17,6 @@
1817
* under the License.
1918
*/
2019

21-
import java.io.*;
22-
import org.codehaus.plexus.util.*;
20+
import org.codehaus.plexus.util.FileUtils
2321

24-
FileUtils.deleteDirectory( new File( basedir, "target" ) );
22+
FileUtils.deleteDirectory(new File(basedir, "target"))

src/it/sign-and-deploy-file-with-extras/verify.bsh

-46
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
def artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadfwe/test/1.0")
21+
22+
var expectedFiles = [
23+
"test-1.0.jar",
24+
"test-1.0.jar.asc",
25+
"test-1.0-sources.jar",
26+
"test-1.0-sources.jar.asc",
27+
"test-1.0-javadoc.jar",
28+
"test-1.0-javadoc.jar.asc",
29+
"test-1.0.pom",
30+
"test-1.0.pom.asc"
31+
]
32+
33+
for (String expectedFile : expectedFiles) {
34+
var file = new File(artifactDir, expectedFile)
35+
36+
println "Checking for existence of $file"
37+
38+
if (!file.isFile()) {
39+
throw new Exception("Missing file $file")
40+
}
41+
}
42+

src/it/sign-and-deploy-files/setup.bsh src/it/sign-and-deploy-file-with-pom/setup.groovy

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +17,7 @@
1817
* under the License.
1918
*/
2019

21-
import java.io.*;
22-
import org.codehaus.plexus.util.*;
2320

24-
FileUtils.deleteDirectory( new File( basedir, "target" ) );
21+
import org.codehaus.plexus.util.FileUtils
22+
23+
FileUtils.deleteDirectory(new File(basedir, "target"))
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
@@ -17,26 +16,21 @@
1716
* specific language governing permissions and limitations
1817
* under the License.
1918
*/
19+
var artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadfwp/test/1.0")
2020

21-
import java.io.*;
22-
23-
File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadfwp/test/1.0" );
24-
25-
String[] expectedFiles = {
21+
var expectedFiles = [
2622
"test-1.0.jar",
2723
"test-1.0.jar.asc",
2824
"test-1.0.pom",
29-
"test-1.0.pom.asc",
30-
};
25+
"test-1.0.pom.asc"
26+
]
3127

32-
for ( String expectedFile : expectedFiles )
33-
{
34-
File file = new File( artifactDir, expectedFile );
28+
for (String expectedFile : expectedFiles) {
29+
var file = new File(artifactDir, expectedFile)
3530

36-
System.out.println( "Checking for existence of " + file );
31+
println "Checking for existence of $file"
3732

38-
if ( !file.isFile() )
39-
{
40-
throw new Exception( "Missing file " + file );
33+
if (!file.isFile()) {
34+
throw new Exception("Missing file $file")
4135
}
4236
}

src/it/sign-and-deploy-file-with-extras/setup.bsh src/it/sign-and-deploy-file-without-pom/setup.groovy

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
@@ -17,8 +16,6 @@
1716
* specific language governing permissions and limitations
1817
* under the License.
1918
*/
19+
import org.codehaus.plexus.util.FileUtils
2020

21-
import java.io.*;
22-
import org.codehaus.plexus.util.*;
23-
24-
FileUtils.deleteDirectory( new File( basedir, "target" ) );
21+
FileUtils.deleteDirectory(new File(basedir, "target"))
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
@@ -17,26 +16,21 @@
1716
* specific language governing permissions and limitations
1817
* under the License.
1918
*/
19+
var artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadfwop/test/1.0")
2020

21-
import java.io.*;
22-
23-
File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadfwop/test/1.0" );
24-
25-
String[] expectedFiles = {
21+
var expectedFiles = [
2622
"test-1.0.jar",
2723
"test-1.0.jar.asc",
2824
"test-1.0.pom",
29-
"test-1.0.pom.asc",
30-
};
25+
"test-1.0.pom.asc"
26+
]
3127

32-
for ( String expectedFile : expectedFiles )
33-
{
34-
File file = new File( artifactDir, expectedFile );
28+
for (String expectedFile : expectedFiles) {
29+
var file = new File(artifactDir, expectedFile)
3530

36-
System.out.println( "Checking for existence of " + file );
31+
println "Checking for existence of $file"
3732

38-
if ( !file.isFile() )
39-
{
40-
throw new Exception( "Missing file " + file );
33+
if (!file.isFile()) {
34+
throw new Exception("Missing file $file")
4135
}
4236
}

src/it/sign-and-deploy-file-with-pom/setup.bsh src/it/sign-and-deploy-files/setup.groovy

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
@@ -17,8 +16,6 @@
1716
* specific language governing permissions and limitations
1817
* under the License.
1918
*/
19+
import org.codehaus.plexus.util.FileUtils
2020

21-
import java.io.*;
22-
import org.codehaus.plexus.util.*;
23-
24-
FileUtils.deleteDirectory( new File( basedir, "target" ) );
21+
FileUtils.deleteDirectory(new File(basedir, "target"))

src/it/sign-and-deploy-files/verify.bsh src/it/sign-and-deploy-files/verify.groovy

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
@@ -17,12 +16,9 @@
1716
* specific language governing permissions and limitations
1817
* under the License.
1918
*/
19+
var artifactDir = new File(basedir, "target/repo/org/apache/maven/its/gpg/sadfs/test/1.0")
2020

21-
import java.io.*;
22-
23-
File artifactDir = new File( basedir, "target/repo/org/apache/maven/its/gpg/sadfs/test/1.0" );
24-
25-
String[] expectedFiles = {
21+
var expectedFiles = [
2622
"test-1.0.jar",
2723
"test-1.0.jar.asc",
2824
"test-1.0-sources.jar",
@@ -36,17 +32,15 @@ String[] expectedFiles = {
3632
"test-1.0-src.tar.gz",
3733
"test-1.0-src.tar.gz.asc",
3834
"test-1.0.tar.gz",
39-
"test-1.0.tar.gz.asc",
40-
};
35+
"test-1.0.tar.gz.asc"
36+
]
4137

42-
for ( String expectedFile : expectedFiles )
43-
{
44-
File file = new File( artifactDir, expectedFile );
38+
for (String expectedFile : expectedFiles) {
39+
var file = new File(artifactDir, expectedFile)
4540

46-
System.out.println( "Checking for existence of " + file );
41+
println "Checking for existence of $file"
4742

48-
if ( !file.isFile() )
49-
{
50-
throw new Exception( "Missing file " + file );
43+
if (!file.isFile()) {
44+
throw new Exception("Missing file $file")
5145
}
5246
}

src/it/sign-and-deploy-not-jar-packaging/setup.bsh

-24
This file was deleted.

0 commit comments

Comments
 (0)