You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2022/05/18 20:36:11 UTC
[maven-war-plugin] 01/01: [MWAR-453] Require Java 8
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MWAR-543
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git
commit 47595a720722aaa41ecdaefb5a73345e9b5b76b0
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Wed May 18 22:34:05 2022 +0200
[MWAR-453] Require Java 8
---
pom.xml | 2 +-
.../apache/maven/plugins/war/AbstractWarMojo.java | 4 +-
.../java/org/apache/maven/plugins/war/Overlay.java | 8 +-
.../war/packaging/AbstractWarPackagingTask.java | 13 +-
.../war/packaging/WarProjectPackagingTask.java | 4 +-
.../plugins/war/AbstractWarExplodedMojoTest.java | 17 +-
.../maven/plugins/war/AbstractWarMojoTest.java | 2 +-
.../plugins/war/WarExplodedMojoFilteringTest.java | 8 +-
.../maven/plugins/war/WarExplodedMojoTest.java | 186 ++++++++++-----------
.../maven/plugins/war/WarInPlaceMojoTest.java | 6 +-
.../org/apache/maven/plugins/war/WarMojoTest.java | 26 +--
.../apache/maven/plugins/war/WarOverlaysTest.java | 14 +-
.../org/apache/maven/plugins/war/WarZipTest.java | 2 +-
.../war/stub/MavenProject4CopyConstructor.java | 17 +-
.../plugins/war/util/WebappStructureTest.java | 8 +-
15 files changed, 158 insertions(+), 159 deletions(-)
diff --git a/pom.xml b/pom.xml
index fe5e2c8..7634a01 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,7 +65,7 @@
<mavenArchiverVersion>3.5.1</mavenArchiverVersion>
<mavenFilteringVersion>3.2.0</mavenFilteringVersion>
<mavenVersion>3.2.5</mavenVersion>
- <javaVersion>7</javaVersion>
+ <javaVersion>8</javaVersion>
<project.build.outputTimestamp>2021-09-05T09:31:59Z</project.build.outputTimestamp>
</properties>
diff --git a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
index 2ab6047..766a48c 100644
--- a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
@@ -417,7 +417,7 @@ public abstract class AbstractWarMojo
excludeList.add( "**/" + META_INF + "/" + containerConfigXML.getName() );
}
- return excludeList.toArray( new String[excludeList.size()] );
+ return excludeList.toArray( new String[0] );
}
/**
@@ -638,7 +638,7 @@ public abstract class AbstractWarMojo
this.artifactFactory = artifactFactory;
this.filteringDeploymentDescriptors = filteringDeploymentDescriptors;
this.nonFilteredFileExtensions =
- nonFilteredFileExtensions == null ? Collections.<String>emptyList() : nonFilteredFileExtensions;
+ nonFilteredFileExtensions == null ? Collections.emptyList() : nonFilteredFileExtensions;
this.resourceEncoding = resourceEncoding;
this.propertiesEncoding = propertiesEncoding;
// This is kinda stupid but if we loop over the current overlays and we request the path structure
diff --git a/src/main/java/org/apache/maven/plugins/war/Overlay.java b/src/main/java/org/apache/maven/plugins/war/Overlay.java
index c42f1c7..beabf3b 100644
--- a/src/main/java/org/apache/maven/plugins/war/Overlay.java
+++ b/src/main/java/org/apache/maven/plugins/war/Overlay.java
@@ -358,8 +358,8 @@ public class Overlay
{
int result;
result = ( getId() != null ? getId().hashCode() : 0 );
- result = 31 * result + ( includes != null ? includes.hashCode() : 0 );
- result = 31 * result + ( excludes != null ? excludes.hashCode() : 0 );
+ result = 31 * result + ( includes != null ? Arrays.hashCode( includes ) : 0 );
+ result = 31 * result + ( excludes != null ? Arrays.hashCode( excludes ) : 0 );
return result;
}
@@ -368,7 +368,7 @@ public class Overlay
final List<String> result = new ArrayList<>();
if ( s == null )
{
- return result.toArray( new String[result.size()] );
+ return result.toArray( new String[0] );
}
else
{
@@ -377,7 +377,7 @@ public class Overlay
{
result.add( token.trim() );
}
- return result.toArray( new String[result.size()] );
+ return result.toArray( new String[0] );
}
}
diff --git a/src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java b/src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java
index d904fc5..171275f 100644
--- a/src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java
+++ b/src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java
@@ -21,6 +21,8 @@ package org.apache.maven.plugins.war.packaging;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.attribute.BasicFileAttributes;
import org.apache.commons.io.input.XmlStreamReader;
import org.apache.maven.artifact.Artifact;
@@ -342,14 +344,15 @@ public abstract class AbstractWarPackagingTask
{
context.addResource( targetFilename );
- if ( onlyIfModified && destination.lastModified() >= source.lastModified() )
+ BasicFileAttributes readAttributes = Files.readAttributes( source.toPath(), BasicFileAttributes.class );
+ if ( onlyIfModified && destination.lastModified() >= readAttributes.lastModifiedTime().toMillis() )
{
context.getLog().debug( " * " + targetFilename + " is up to date." );
return false;
}
else
{
- if ( source.isDirectory() )
+ if ( readAttributes.isDirectory() )
{
context.getLog().warn( " + " + targetFilename + " is packaged from the source folder" );
@@ -364,16 +367,14 @@ public abstract class AbstractWarPackagingTask
{
String msg = "Failed to create " + targetFilename;
context.getLog().error( msg, e );
- IOException ioe = new IOException( msg );
- ioe.initCause( e );
- throw ioe;
+ throw new IOException( msg, e );
}
}
else
{
FileUtils.copyFile( source.getCanonicalFile(), destination );
// preserve timestamp
- destination.setLastModified( source.lastModified() );
+ destination.setLastModified( readAttributes.lastModifiedTime().toMillis() );
context.getLog().debug( " + " + targetFilename + " has been copied." );
}
return true;
diff --git a/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java b/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
index 5993706..b70947d 100644
--- a/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
+++ b/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
@@ -360,7 +360,7 @@ public class WarProjectPackagingTask
scanner.setBasedir( resource.getDirectory() );
if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() )
{
- scanner.setIncludes( resource.getIncludes().toArray( new String[resource.getIncludes().size()] ) );
+ scanner.setIncludes( resource.getIncludes().toArray( new String[0] ) );
}
else
{
@@ -368,7 +368,7 @@ public class WarProjectPackagingTask
}
if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() )
{
- scanner.setExcludes( resource.getExcludes().toArray( new String[resource.getExcludes().size()] ) );
+ scanner.setExcludes( resource.getExcludes().toArray( new String[0] ) );
}
scanner.addDefaultExcludes();
diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java
index e562398..0a86fdc 100644
--- a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java
@@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
+import java.util.Objects;
/**
* @author Stephane Nicoll
@@ -109,7 +110,7 @@ public abstract class AbstractWarExplodedMojoTest
}
}
- configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "workDirectory", workDirectory );
return webAppDirectory;
@@ -156,8 +157,8 @@ public abstract class AbstractWarExplodedMojoTest
File expectedWebSourceFile = new File( webAppDirectory, "pansit.jsp" );
File expectedWebSource2File = new File( webAppDirectory, "org/web/app/last-exile.jsp" );
- assertTrue( "source file not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source file not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "source file not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source file not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
final List<File> content = new ArrayList<>();
content.add( expectedWebSourceFile );
@@ -175,7 +176,7 @@ public abstract class AbstractWarExplodedMojoTest
protected List<File> assertWebXml( File webAppDirectory )
{
File expectedWEBXMLFile = new File( webAppDirectory, "WEB-INF/web.xml" );
- assertTrue( "web xml not found: " + expectedWEBXMLFile.toString(), expectedWEBXMLFile.exists() );
+ assertTrue( "web xml not found: " + expectedWEBXMLFile, expectedWEBXMLFile.exists() );
final List<File> content = new ArrayList<>();
content.add( expectedWEBXMLFile );
@@ -199,11 +200,11 @@ public abstract class AbstractWarExplodedMojoTest
final File expectedFile = new File( webAppDirectory, filePath );
if ( customMessage != null )
{
- assertTrue( customMessage + " - " + expectedFile.toString(), expectedFile.exists() );
+ assertTrue( customMessage + " - " + expectedFile, expectedFile.exists() );
}
else
{
- assertTrue( "source file not found: " + expectedFile.toString(), expectedFile.exists() );
+ assertTrue( "source file not found: " + expectedFile, expectedFile.exists() );
}
content.add( expectedFile );
}
@@ -250,7 +251,7 @@ public abstract class AbstractWarExplodedMojoTest
{
final File[] files = dir.listFiles();
- for ( File file : files )
+ for ( File file : Objects.requireNonNull( files ) )
{
// Add the file if the filter is ok with it
if ( filter.accept( file ) )
@@ -267,7 +268,7 @@ public abstract class AbstractWarExplodedMojoTest
}
}
- class FileFilterImpl
+ static class FileFilterImpl
implements FileFilter
{
diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
index 3de518f..1e9204a 100644
--- a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
@@ -180,7 +180,7 @@ public abstract class AbstractWarMojoTest
{
if ( !dir.exists() )
{
- assertTrue( "can not create test dir: " + dir.toString(), dir.mkdirs() );
+ assertTrue( "can not create test dir: " + dir, dir.mkdirs() );
}
}
diff --git a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java
index 9997f4d..757358c 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java
@@ -99,10 +99,10 @@ public class WarExplodedMojoFilteringTest
File expectedResourceFile = new File( webAppDirectory, "custom-setting.cfg" );
File expectedResourceWDirFile = new File( webAppDirectory, "custom-config/custom-setting.cfg" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "resource file not found:" + expectedResourceFile.toString(), expectedResourceFile.exists() );
- assertTrue( "resource file with dir not found:" + expectedResourceWDirFile.toString(),
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "resource file not found:" + expectedResourceFile, expectedResourceFile.exists() );
+ assertTrue( "resource file with dir not found:" + expectedResourceWDirFile,
expectedResourceWDirFile.exists() );
// validate filtered file
diff --git a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java
index 22ff280..3f027e3 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java
@@ -80,7 +80,7 @@ public class WarExplodedMojoTest
// configure mojo
resources[0].setDirectory( webAppResource.getAbsolutePath() );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "webResources", resources );
mojo.execute();
@@ -91,8 +91,8 @@ public class WarExplodedMojoTest
File expectedWEBINFDir = new File( webAppDirectory, "WEB-INF" );
File expectedMETAINFDir = new File( webAppDirectory, "META-INF" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
assertTrue( "resources doesn't exist: " + expectedWebResourceFile, expectedWebResourceFile.exists() );
assertTrue( "WEB-INF not found", expectedWEBINFDir.exists() );
assertTrue( "META-INF not found", expectedMETAINFDir.exists() );
@@ -124,7 +124,7 @@ public class WarExplodedMojoTest
// configure mojo
resources[0].setDirectory( webAppResource.getAbsolutePath() );
resources[0].setTargetPath( "targetPath" );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "webResources", resources );
mojo.execute();
@@ -135,8 +135,8 @@ public class WarExplodedMojoTest
File expectedWEBINFDir = new File( webAppDirectory, "WEB-INF" );
File expectedMETAINFDir = new File( webAppDirectory, "META-INF" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
assertTrue( "resources doesn't exist: " + expectedWebResourceFile, expectedWebResourceFile.exists() );
assertTrue( "WEB-INF not found", expectedWEBINFDir.exists() );
assertTrue( "META-INF not found", expectedMETAINFDir.exists() );
@@ -162,7 +162,7 @@ public class WarExplodedMojoTest
File webAppDirectory = new File( getTestDirectory(), testId );
// configure mojo
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.setWebXml( new File( xmlSource, "web.xml" ) );
mojo.execute();
@@ -172,9 +172,9 @@ public class WarExplodedMojoTest
File expectedWEBXMLFile = new File( webAppDirectory, "WEB-INF/web.xml" );
File expectedMETAINFDir = new File( webAppDirectory, "META-INF" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "WEB XML not found: " + expectedWEBXMLFile.toString(), expectedWEBXMLFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "WEB XML not found: " + expectedWEBXMLFile, expectedWEBXMLFile.exists() );
assertTrue( "META-INF not found", expectedMETAINFDir.exists() );
assertEquals( "WEB XML not correct", mojo.getWebXml().toString(), FileUtils.fileRead( expectedWEBXMLFile ) );
@@ -200,7 +200,7 @@ public class WarExplodedMojoTest
File webAppDirectory = new File( getTestDirectory(), testId );
// configure mojo
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.setContainerConfigXML( new File( xmlSource, "config.xml" ) );
mojo.execute();
@@ -210,10 +210,10 @@ public class WarExplodedMojoTest
File expectedContainerConfigXMLFile = new File( webAppDirectory, "META-INF/config.xml" );
File expectedWEBINFDir = new File( webAppDirectory, "WEB-INF" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
assertTrue( "WEB-INF not found", expectedWEBINFDir.exists() );
- assertTrue( "Container Config XML not found:" + expectedContainerConfigXMLFile.toString(),
+ assertTrue( "Container Config XML not found:" + expectedContainerConfigXMLFile,
expectedContainerConfigXMLFile.exists() );
// house keeping
@@ -246,7 +246,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "workDirectory", workDirectory );
mojo.execute();
@@ -256,11 +256,11 @@ public class WarExplodedMojoTest
File expectedWEBXMLFile = new File( webAppDirectory, "WEB-INF/web.xml" );
File expectedWARFile = new File( webAppDirectory, "/org/sample/company/test.jsp" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
// check simple.war in the unit test dir under resources to verify the list of files
- assertTrue( "web xml not found: " + expectedWEBXMLFile.toString(), expectedWEBXMLFile.exists() );
- assertTrue( "war file not found: " + expectedWARFile.toString(), expectedWARFile.exists() );
+ assertTrue( "web xml not found: " + expectedWEBXMLFile, expectedWEBXMLFile.exists() );
+ assertTrue( "war file not found: " + expectedWARFile, expectedWARFile.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -293,14 +293,14 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "workDirectory", workDirectory );
mojo.execute();
// validate operation
File expectedFile = new File( webAppDirectory, "/org/sample/company/test.jsp" );
- assertTrue( "file not found: " + expectedFile.toString(), expectedFile.exists() );
+ assertTrue( "file not found: " + expectedFile, expectedFile.exists() );
assertEquals( "file incorrect", simpleJSP.toString(), FileUtils.fileRead( expectedFile ) );
// check when the merged war file is newer - so set an old time on the local file
@@ -309,11 +309,11 @@ public class WarExplodedMojoTest
expectedFile.setLastModified( time );
project.addArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "workDirectory", workDirectory );
mojo.execute();
- assertTrue( "file not found: " + expectedFile.toString(), expectedFile.exists() );
+ assertTrue( "file not found: " + expectedFile, expectedFile.exists() );
assertEquals( "file incorrect", simpleJSP.toString(), FileUtils.fileRead( expectedFile ) );
// house keeping
@@ -394,7 +394,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( ejbArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -404,9 +404,9 @@ public class WarExplodedMojoTest
File expectedEJBArtifact = new File( webAppDirectory, "WEB-INF/lib/ejbartifact-0.0-Test.jar" );
// File expectedEJBArtifact = new File( webAppDirectory, "WEB-INF/lib/ejbartifact-0.0-Test.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "ejb artifact not found: " + expectedEJBArtifact.toString(), expectedEJBArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "ejb artifact not found: " + expectedEJBArtifact, expectedEJBArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -431,7 +431,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( jarArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -440,9 +440,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedJarArtifact = new File( webAppDirectory, "WEB-INF/lib/jarartifact-0.0-Test.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "jar artifact not found: " + expectedJarArtifact.toString(), expectedJarArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "jar artifact not found: " + expectedJarArtifact, expectedJarArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -469,7 +469,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( ejbArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -478,9 +478,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedEJBArtifact = new File( webAppDirectory, "WEB-INF/lib/ejbclientartifact-0.0-Test-client.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "ejb artifact not found: " + expectedEJBArtifact.toString(), expectedEJBArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "ejb artifact not found: " + expectedEJBArtifact, expectedEJBArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -507,7 +507,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( tldArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -516,9 +516,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedTLDArtifact = new File( webAppDirectory, "WEB-INF/tld/tldartifact-0.0-Test.tld" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "tld artifact not found: " + expectedTLDArtifact.toString(), expectedTLDArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "tld artifact not found: " + expectedTLDArtifact, expectedTLDArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -545,7 +545,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( parartifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -554,9 +554,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedPARArtifact = new File( webAppDirectory, "WEB-INF/lib/parartifact-0.0-Test.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "par artifact not found: " + expectedPARArtifact.toString(), expectedPARArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "par artifact not found: " + expectedPARArtifact, expectedPARArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -585,7 +585,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( aarArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -594,9 +594,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedJarArtifact = new File( webAppDirectory, "WEB-INF/services/aarartifact-0.0-Test.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "jar artifact not found: " + expectedJarArtifact.toString(), expectedJarArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "jar artifact not found: " + expectedJarArtifact, expectedJarArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -625,7 +625,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( marArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -634,9 +634,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedJarArtifact = new File( webAppDirectory, "WEB-INF/modules/marartifact-0.0-Test.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "jar artifact not found: " + expectedJarArtifact.toString(), expectedJarArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "jar artifact not found: " + expectedJarArtifact, expectedJarArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -665,7 +665,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( xarArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -674,9 +674,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedJarArtifact = new File( webAppDirectory, "WEB-INF/extensions/xarartifact-0.0-Test.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "jar artifact not found: " + expectedJarArtifact.toString(), expectedJarArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "jar artifact not found: " + expectedJarArtifact, expectedJarArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -708,7 +708,7 @@ public class WarExplodedMojoTest
ejbArtifactDup.setGroupId( "org.dup.ejb" );
project.addArtifact( ejbArtifact );
project.addArtifact( ejbArtifactDup );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -718,10 +718,10 @@ public class WarExplodedMojoTest
File expectedEJBArtifact = new File( webAppDirectory, "WEB-INF/lib/org.sample.ejb-ejbartifact-0.0-Test.jar" );
File expectedEJBDupArtifact = new File( webAppDirectory, "WEB-INF/lib/org.dup.ejb-ejbartifact-0.0-Test.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "ejb artifact not found: " + expectedEJBArtifact.toString(), expectedEJBArtifact.exists() );
- assertTrue( "ejb dup artifact not found: " + expectedEJBDupArtifact.toString(), expectedEJBDupArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "ejb artifact not found: " + expectedEJBArtifact, expectedEJBArtifact.exists() );
+ assertTrue( "ejb dup artifact not found: " + expectedEJBDupArtifact, expectedEJBDupArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -760,7 +760,7 @@ public class WarExplodedMojoTest
project.addArtifact( ejbArtifact );
project.addArtifact( ejbArtifactDup );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -770,10 +770,10 @@ public class WarExplodedMojoTest
File expectedEJBArtifact = new File( webAppDirectory, "WEB-INF/lib/ejbartifact-0.0-Test.jar" );
File expectedEJBDupArtifact = new File( webAppDirectory, "WEB-INF/lib/ejbartifact-0.0-Test-classifier.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "ejb artifact not found: " + expectedEJBArtifact.toString(), expectedEJBArtifact.exists() );
- assertTrue( "ejb dup artifact not found: " + expectedEJBDupArtifact.toString(), expectedEJBDupArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "ejb artifact not found: " + expectedEJBArtifact, expectedEJBArtifact.exists() );
+ assertTrue( "ejb dup artifact not found: " + expectedEJBDupArtifact, expectedEJBDupArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -796,7 +796,7 @@ public class WarExplodedMojoTest
File classesDir = createClassesDir( testId, false );
// configure mojo
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -805,9 +805,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedClass = new File( webAppDirectory, "WEB-INF/classes/sample-servlet.class" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "classes not found: " + expectedClass.toString(), expectedClass.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "classes not found: " + expectedClass, expectedClass.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -829,7 +829,7 @@ public class WarExplodedMojoTest
File webAppDirectory = new File( getTestDirectory(), testId );
// configure mojo
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "warSourceIncludes", "**/*sit.jsp" );
setVariableValueToObject( mojo, "warSourceExcludes", "**/last*.*" );
mojo.execute();
@@ -840,9 +840,9 @@ public class WarExplodedMojoTest
File expectedWEBXMLDir = new File( webAppDirectory, "WEB-INF" );
File expectedMETAINFDir = new File( webAppDirectory, "META-INF" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertFalse( "source files found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "WEB XML not found: " + expectedWEBXMLDir.toString(), expectedWEBXMLDir.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertFalse( "source files found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "WEB XML not found: " + expectedWEBXMLDir, expectedWEBXMLDir.exists() );
assertTrue( "META-INF not found", expectedMETAINFDir.exists() );
// house keeping
@@ -874,7 +874,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( includeexcludeWarArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "dependentWarIncludes", "**/*Include.jsp,**/*.xml" );
setVariableValueToObject( mojo, "dependentWarExcludes", "**/*Exclude*,**/MANIFEST.MF" );
setVariableValueToObject( mojo, "workDirectory", workDirectory );
@@ -888,13 +888,13 @@ public class WarExplodedMojoTest
File expectedIncludedWARFile = new File( webAppDirectory, "/org/sample/company/testInclude.jsp" );
File expectedExcludedWarfile = new File( webAppDirectory, "/org/sample/companyExclude/test.jsp" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
// check include-exclude.war in the unit test dir under resources to verify the list of files
- assertTrue( "web xml not found: " + expectedWEBXMLFile.toString(), expectedWEBXMLFile.exists() );
- assertFalse( "manifest file found: " + expectedManifestFile.toString(), expectedManifestFile.exists() );
- assertTrue( "war file not found: " + expectedIncludedWARFile.toString(), expectedIncludedWARFile.exists() );
- assertFalse( "war file not found: " + expectedExcludedWarfile.toString(), expectedExcludedWarfile.exists() );
+ assertTrue( "web xml not found: " + expectedWEBXMLFile, expectedWEBXMLFile.exists() );
+ assertFalse( "manifest file found: " + expectedManifestFile, expectedManifestFile.exists() );
+ assertTrue( "war file not found: " + expectedIncludedWARFile, expectedIncludedWARFile.exists() );
+ assertFalse( "war file not found: " + expectedExcludedWarfile, expectedExcludedWarfile.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -919,7 +919,7 @@ public class WarExplodedMojoTest
File webAppDirectory = new File( getTestDirectory(), testId );
// configure mojo
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
// destination file is already created manually containing an "error" string
// source is newer than the destination file
@@ -932,14 +932,14 @@ public class WarExplodedMojoTest
File expectedWebSourceFile = new File( webAppDirectory, "pansit.jsp" );
File expectedWebSource2File = new File( webAppDirectory, "org/web/app/last-exile.jsp" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
assertTrue( "WEB-INF not found", expectedWEBINFDir.exists() );
assertTrue( "META-INF not found", expectedMETAINFDir.exists() );
// 1st phase destination is older than source
// destination starts with a value of error replaced with a blank source
- assertNotEquals( "source files not updated with new copy: " + expectedWebSourceFile.toString(),
+ assertNotEquals( "source files not updated with new copy: " + expectedWebSourceFile,
"error", FileUtils.fileRead( expectedWebSourceFile ) );
// TODO: uncomment when lastModified problem is resolved
@@ -982,7 +982,7 @@ public class WarExplodedMojoTest
// configure mojo
project.addArtifact( jarArtifact );
mojo.setOutputFileNameMapping( "@{artifactId}@.@{extension}@" );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -991,9 +991,9 @@ public class WarExplodedMojoTest
// final name form is <artifactId>-<version>.<type>
File expectedJarArtifact = new File( webAppDirectory, "WEB-INF/lib/jarartifact.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "jar artifact not found: " + expectedJarArtifact.toString(), expectedJarArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "jar artifact not found: " + expectedJarArtifact, expectedJarArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
@@ -1026,7 +1026,7 @@ public class WarExplodedMojoTest
project.addArtifact( ejbArtifact );
project.addArtifact( ejbArtifactDup );
mojo.setOutputFileNameMapping( "@{artifactId}@.@{extension}@" );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
mojo.execute();
// validate operation
@@ -1036,10 +1036,10 @@ public class WarExplodedMojoTest
File expectedEJBArtifact = new File( webAppDirectory, "WEB-INF/lib/org.sample.ejb-ejbartifact.jar" );
File expectedEJBDupArtifact = new File( webAppDirectory, "WEB-INF/lib/org.dup.ejb-ejbartifact.jar" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- assertTrue( "ejb artifact not found: " + expectedEJBArtifact.toString(), expectedEJBArtifact.exists() );
- assertTrue( "ejb dup artifact not found: " + expectedEJBDupArtifact.toString(), expectedEJBDupArtifact.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
+ assertTrue( "ejb artifact not found: " + expectedEJBArtifact, expectedEJBArtifact.exists() );
+ assertTrue( "ejb dup artifact not found: " + expectedEJBDupArtifact, expectedEJBDupArtifact.exists() );
// house keeping
expectedWebSourceFile.delete();
diff --git a/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java b/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java
index d93433c..68d3a74 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java
@@ -70,7 +70,7 @@ public class WarInPlaceMojoTest
// configure mojo
resources[0].setDirectory( webAppResource.getAbsolutePath() );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, null, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, null, project );
setVariableValueToObject( mojo, "webResources", resources );
mojo.execute();
@@ -81,8 +81,8 @@ public class WarInPlaceMojoTest
File expectedWEBINFDir = new File( webAppSource, "WEB-INF" );
File expectedMETAINFDir = new File( webAppSource, "META-INF" );
- assertTrue( "source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
- assertTrue( "source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "source files not found: " + expectedWebSourceFile, expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " + expectedWebSource2File, expectedWebSource2File.exists() );
assertTrue( "resources doesn't exist: " + expectedWebResourceFile, expectedWebResourceFile.exists() );
assertTrue( "WEB-INF not found", expectedWEBINFDir.exists() );
assertTrue( "META-INF not found", expectedMETAINFDir.exists() );
diff --git a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java
index 7a313ec..84a8ce8 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java
@@ -81,7 +81,7 @@ public class WarMojoTest
File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
mojo.setWebXml( new File( xmlSource, "web.xml" ) );
@@ -110,7 +110,7 @@ public class WarMojoTest
File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
mojo.setWebXml( new File( xmlSource, "web.xml" ) );
@@ -142,7 +142,7 @@ public class WarMojoTest
File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "projectHelper", projectHelper );
setVariableValueToObject( mojo, "classifier", "test-classifier" );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
@@ -175,7 +175,7 @@ public class WarMojoTest
warArtifact.setFile( new File( "error.war" ) );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "projectHelper", projectHelper );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
@@ -211,7 +211,7 @@ public class WarMojoTest
warArtifact.setFile( new File( "error.war" ) );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "projectHelper", projectHelper );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
@@ -245,7 +245,7 @@ public class WarMojoTest
createFile( configFile, "<config></config>" );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
mojo.setWebXml( new File( xmlSource, "web.xml" ) );
@@ -279,7 +279,7 @@ public class WarMojoTest
createFile( configFile, "<config></config>" );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
mojo.setWebXml( new File( xmlSource, "web.xml" ) );
@@ -310,7 +310,7 @@ public class WarMojoTest
File classesDir = createClassesDir( testId, true );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
mojo.setFailOnMissingWebXml( false );
@@ -341,7 +341,7 @@ public class WarMojoTest
File classesDir = createClassesDir( testId, true );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
mojo.setFailOnMissingWebXml( true );
@@ -378,7 +378,7 @@ public class WarMojoTest
project.setArtifact( warArtifact );
project.setFile( warArtifact.getFile() );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
@@ -410,7 +410,7 @@ public class WarMojoTest
project.setArtifact( warArtifact );
project.setFile( warArtifact.getFile() );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
@@ -440,7 +440,7 @@ public class WarMojoTest
File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
mojo.setWebXml( new File( xmlSource, "web.xml" ) );
@@ -469,7 +469,7 @@ public class WarMojoTest
File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
mojo.setWebXml( new File( xmlSource, "web.xml" ) );
diff --git a/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java b/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java
index aca9778..31ce469 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java
@@ -111,7 +111,7 @@ public class WarOverlaysTest
assertOverlayedFile( webAppDirectory, "overlay-one", "login.jsp" );
// Ok now check that there is no more files/directories
- final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] { MANIFEST_PATH } );
+ final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] {MANIFEST_PATH} );
assertWebAppContent( webAppDirectory, assertedFiles, filter );
}
finally
@@ -149,7 +149,7 @@ public class WarOverlaysTest
assertOverlayedFile( webAppDirectory, "overlay-two", "admin.jsp" );
// Ok now check that there is no more files/directories
- final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] { MANIFEST_PATH } );
+ final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] {MANIFEST_PATH} );
assertWebAppContent( webAppDirectory, assertedFiles, filter );
}
finally
@@ -293,7 +293,7 @@ public class WarOverlaysTest
assertOverlayedFile( webAppDirectory, "overlay-full-1", "WEB-INF/lib/c.jar" );
// Ok now check that there is no more files/directories
- final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] { MANIFEST_PATH } );
+ final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] {MANIFEST_PATH} );
assertWebAppContent( webAppDirectory, assertedFiles, filter );
}
finally
@@ -329,7 +329,7 @@ public class WarOverlaysTest
Overlay over4 = new DefaultOverlay( overlay2 );
- mojo.setOverlays( new LinkedList<Overlay>() );
+ mojo.setOverlays( new LinkedList<>() );
mojo.addOverlay( over1 );
mojo.addOverlay( over2 );
mojo.addOverlay( over3 );
@@ -362,7 +362,7 @@ public class WarOverlaysTest
assertOverlayedFile( webAppDirectory, "overlay-full-2", "WEB-INF/lib/c.jar" );
// Ok now check that there is no more files/directories
- final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] { MANIFEST_PATH } );
+ final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] {MANIFEST_PATH} );
assertWebAppContent( webAppDirectory, assertedFiles, filter );
}
finally
@@ -399,7 +399,7 @@ public class WarOverlaysTest
Overlay over4 = new DefaultOverlay( overlay2 );
- mojo.setOverlays( new LinkedList<Overlay>() );
+ mojo.setOverlays( new LinkedList<>() );
mojo.addOverlay( over1 );
mojo.addOverlay( over2 );
mojo.addOverlay( over3 );
@@ -432,7 +432,7 @@ public class WarOverlaysTest
assertOverlayedFile( webAppDirectory, "overlay-full-2", "WEB-INF/lib/c.jar" );
// Ok now check that there is no more files/directories
- final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] { MANIFEST_PATH } );
+ final FileFilter filter = new FileFilterImpl( webAppDirectory, new String[] {MANIFEST_PATH} );
assertWebAppContent( webAppDirectory, assertedFiles, filter );
}
finally
diff --git a/src/test/java/org/apache/maven/plugins/war/WarZipTest.java b/src/test/java/org/apache/maven/plugins/war/WarZipTest.java
index 88f6655..cc61d2e 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarZipTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarZipTest.java
@@ -80,7 +80,7 @@ public class WarZipTest
File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
project.setArtifact( warArtifact );
- this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
+ this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project );
setVariableValueToObject( mojo, "outputDirectory", outputDir );
setVariableValueToObject( mojo, "warName", warName );
setVariableValueToObject( mojo, "workDirectory", new File( getTestDirectory(), "work" ) );
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java b/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java
index e9a58ab..0d50ce9 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java
@@ -25,9 +25,6 @@ import java.util.LinkedList;
import java.util.List;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Profile;
-import org.apache.maven.project.MavenProject;
public class MavenProject4CopyConstructor
extends MavenProjectBasicStub
@@ -50,13 +47,13 @@ public class MavenProject4CopyConstructor
{
// the pom should be located in the isolated dummy root
super.setFile( new File( getBasedir(), "pom.xml" ) );
- super.setDependencyArtifacts( new HashSet<Artifact>() );
- super.setArtifacts( new HashSet<Artifact>() );
- super.setExtensionArtifacts( new HashSet<Artifact>() );
- super.setRemoteArtifactRepositories( new LinkedList<ArtifactRepository>() );
- super.setPluginArtifactRepositories( new LinkedList<ArtifactRepository>() );
- super.setCollectedProjects( new LinkedList<MavenProject>() );
- super.setActiveProfiles( new LinkedList<Profile>() );
+ super.setDependencyArtifacts( new HashSet<>() );
+ super.setArtifacts( new HashSet<>() );
+ super.setExtensionArtifacts( new HashSet<>() );
+ super.setRemoteArtifactRepositories( new LinkedList<>() );
+ super.setPluginArtifactRepositories( new LinkedList<>() );
+ super.setCollectedProjects( new LinkedList<>() );
+ super.setActiveProfiles( new LinkedList<>() );
super.setOriginalModel( null );
super.setExecutionProject( this );
super.setBuild( getBuild() );
diff --git a/src/test/java/org/apache/maven/plugins/war/util/WebappStructureTest.java b/src/test/java/org/apache/maven/plugins/war/util/WebappStructureTest.java
index 0e135de..3b2b185 100644
--- a/src/test/java/org/apache/maven/plugins/war/util/WebappStructureTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/util/WebappStructureTest.java
@@ -34,13 +34,13 @@ public class WebappStructureTest
{
public void testUnknownFileNotAvailable()
{
- final WebappStructure structure = new WebappStructure( new ArrayList<Dependency>() );
+ final WebappStructure structure = new WebappStructure( new ArrayList<>() );
assertFalse( structure.isRegistered( "/foo/bar.txt" ) );
}
public void testRegisterSamePathTwice()
{
- final WebappStructure structure = new WebappStructure( new ArrayList<Dependency>() );
+ final WebappStructure structure = new WebappStructure( new ArrayList<>() );
structure.registerFile( "overlay1", "WEB-INF/web.xml" );
assertFalse( structure.registerFile( "currentBuild", "WEB-INF/web.xml" ) );
}
@@ -48,7 +48,7 @@ public class WebappStructureTest
public void testRegisterForced()
{
final String path = "WEB-INF/web.xml";
- final WebappStructure structure = new WebappStructure( new ArrayList<Dependency>() );
+ final WebappStructure structure = new WebappStructure( new ArrayList<>() );
assertFalse("New file should return false",
structure.registerFileForced( "overlay1", path ));
assertEquals( "overlay1", structure.getOwner( path ) );
@@ -57,7 +57,7 @@ public class WebappStructureTest
public void testRegisterSamePathTwiceForced()
{
final String path = "WEB-INF/web.xml";
- final WebappStructure structure = new WebappStructure( new ArrayList<Dependency>() );
+ final WebappStructure structure = new WebappStructure( new ArrayList<>() );
structure.registerFile( "overlay1", path );
assertEquals( "overlay1", structure.getOwner( path ) );
assertTrue("owner replacement should have returned true",