diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..c2ed5060 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# +# 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. +# +*.jsp text eol=lf \ No newline at end of file diff --git a/pom.xml b/pom.xml index 59add894..d5b84148 100644 --- a/pom.xml +++ b/pom.xml @@ -208,12 +208,6 @@ ${mavenVersion} test - - junit - junit - 4.13.2 - test - org.junit.jupiter junit-jupiter-api @@ -250,6 +244,7 @@ ! No possibilities to add license information into a MANIFEST --> src/it/MWAR-167/src/main/resources/MANIFEST.MF + src/test/resources/** diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java deleted file mode 100644 index 50e97127..00000000 --- a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java +++ /dev/null @@ -1,260 +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. - */ -package org.apache.maven.plugins.war; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.apache.maven.plugin.testing.stubs.ArtifactStub; -import org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub; -import org.codehaus.plexus.util.FileUtils; - -/** - * @author Stephane Nicoll - */ -public abstract class AbstractWarExplodedMojoTest extends AbstractWarMojoTest { - - protected WarExplodedMojo mojo; - - public void setUp() throws Exception { - super.setUp(); - mojo = lookupMojo("exploded", getPomFile()); - } - - /** - * Returns the pom configuration to use. - * - * @return the pom configuration - */ - protected abstract File getPomFile(); - - /** - * Returns the test directory to use. - * - * @return the test directory - */ - protected abstract File getTestDirectory(); - - /** - * Configures the exploded mojo for the specified test. - * - * If the {@code sourceFiles} parameter is {@code null}, sample JSPs are created by default. - * - * @param testId the id of the test - * @param artifactStubs the dependencies (may be null) - * @param sourceFiles the source files to create (may be null) - * @return the webapp directory - * @throws Exception if an error occurs while configuring the mojo - */ - protected File setUpMojo(final String testId, ArtifactStub[] artifactStubs, String[] sourceFiles) throws Exception { - final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - final File webAppDirectory = new File(getTestDirectory(), testId); - - // Create the webapp sources - File webAppSource; - if (sourceFiles == null) { - webAppSource = createWebAppSource(testId); - } else { - webAppSource = createWebAppSource(testId, false); - for (String sourceFile : sourceFiles) { - File sample = new File(webAppSource, sourceFile); - createFile(sample); - } - } - - final File classesDir = createClassesDir(testId, true); - final File workDirectory = new File(getTestDirectory(), "/war/work-" + testId); - createDir(workDirectory); - - if (artifactStubs != null) { - for (ArtifactStub artifactStub : artifactStubs) { - project.addArtifact(artifactStub); - } - } - - configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "workDirectory", workDirectory); - - return webAppDirectory; - } - - /** - * Configures the exploded mojo for the specified test. - * - * @param testId the id of the test - * @param artifactStubs the dependencies (may be null) - * @return the webapp directory - * @throws Exception if an error occurs while configuring the mojo - */ - protected File setUpMojo(final String testId, ArtifactStub[] artifactStubs) throws Exception { - return setUpMojo(testId, artifactStubs, null); - } - - /** - * Cleans up a directory. - * - * @param directory the directory to remove - * @throws IOException if an error occurred while removing the directory - */ - protected void cleanDirectory(File directory) throws IOException { - if (directory != null && directory.isDirectory() && directory.exists()) { - FileUtils.deleteDirectory(directory); - } - } - - /** - * Asserts the default content of the war based on the specified webapp directory. - * - * @param webAppDirectory the webapp directory - * @return a list of File objects that have been asserted - */ - protected List assertDefaultContent(File webAppDirectory) { - // Validate content of the webapp - 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()); - - final List content = new ArrayList<>(); - content.add(expectedWebSourceFile); - content.add(expectedWebSource2File); - - return content; - } - - /** - * Asserts the web.xml file of the war based on the specified webapp directory. - * - * @param webAppDirectory the webapp directory - * @return a list with the web.xml File object - */ - protected List assertWebXml(File webAppDirectory) { - File expectedWEBXMLFile = new File(webAppDirectory, "WEB-INF/web.xml"); - assertTrue("web xml not found: " + expectedWEBXMLFile.toString(), expectedWEBXMLFile.exists()); - - final List content = new ArrayList<>(); - content.add(expectedWEBXMLFile); - - return content; - } - - /** - * Asserts custom content of the war based on the specified webapp directory. - * - * @param webAppDirectory the webapp directory - * @param filePaths an array of file paths relative to the webapp directory - * @param customMessage a custom message if an assertion fails - * @return a list of File objects that have been inspected - */ - protected List assertCustomContent(File webAppDirectory, String[] filePaths, String customMessage) { - final List content = new ArrayList<>(); - for (String filePath : filePaths) { - final File expectedFile = new File(webAppDirectory, filePath); - if (customMessage != null) { - assertTrue(customMessage + " - " + expectedFile.toString(), expectedFile.exists()); - } else { - assertTrue("source file not found: " + expectedFile.toString(), expectedFile.exists()); - } - content.add(expectedFile); - } - return content; - } - - /** - * Asserts that the webapp contains only the specified files. - * - * @param webAppDirectory the webapp directory - * @param expectedFiles the expected files - * @param filter an optional filter to ignore some resources - */ - protected void assertWebAppContent(File webAppDirectory, List expectedFiles, FileFilter filter) { - final List webAppContent = new ArrayList<>(); - if (filter != null) { - buildFilesList(webAppDirectory, filter, webAppContent); - } else { - buildFilesList(webAppDirectory, new FileFilterImpl(webAppDirectory, null), webAppContent); - } - - // Now we have the files, sort them. - Collections.sort(expectedFiles); - Collections.sort(webAppContent); - assertEquals( - "Invalid webapp content, expected " + expectedFiles.size() + "file(s) " + expectedFiles + " but got " - + webAppContent.size() + " file(s) " + webAppContent, - expectedFiles, - webAppContent); - } - - /** - * Builds the list of files and directories from the specified dir. - * - * Note that the filter is not used the usual way. If the filter does not accept the current file, it's not added - * but yet the subdirectories are added if any. - * - * @param dir the base directory - * @param filter the filter - * @param content the current content, updated recursively - */ - private void buildFilesList(final File dir, FileFilter filter, final List content) { - final File[] files = dir.listFiles(); - - for (File file : files) { - // Add the file if the filter is ok with it - if (filter.accept(file)) { - content.add(file); - } - - // Even if the file is not accepted and is a directory, add it - if (file.isDirectory()) { - buildFilesList(file, filter, content); - } - } - } - - class FileFilterImpl implements FileFilter { - - private final List rejectedFilePaths; - - private final int webAppDirIndex; - - FileFilterImpl(File webAppDirectory, String[] rejectedFilePaths) { - if (rejectedFilePaths != null) { - this.rejectedFilePaths = Arrays.asList(rejectedFilePaths); - } else { - this.rejectedFilePaths = new ArrayList<>(); - } - this.webAppDirIndex = webAppDirectory.getAbsolutePath().length() + 1; - } - - public boolean accept(File file) { - String effectiveRelativePath = buildRelativePath(file); - return !(rejectedFilePaths.contains(effectiveRelativePath) || file.isDirectory()); - } - - private String buildRelativePath(File f) { - return f.getAbsolutePath().substring(webAppDirIndex); - } - } -} diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java deleted file mode 100644 index 217e754c..00000000 --- a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java +++ /dev/null @@ -1,298 +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. - */ -package org.apache.maven.plugins.war; - -import java.io.File; -import java.io.IOException; -import java.util.Date; - -import org.apache.maven.execution.DefaultMavenExecutionRequest; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.testing.AbstractMojoTestCase; -import org.apache.maven.plugin.testing.stubs.ArtifactStub; -import org.apache.maven.plugins.war.stub.MavenProjectBasicStub; -import org.apache.maven.plugins.war.stub.WarOverlayStub; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.archiver.ArchiverException; -import org.codehaus.plexus.archiver.jar.JarArchiver; -import org.codehaus.plexus.util.FileUtils; -import org.eclipse.aether.RepositorySystemSession; - -public abstract class AbstractWarMojoTest extends AbstractMojoTestCase { - - protected static final File OVERLAYS_TEMP_DIR = new File(getBasedir(), "target/test-overlays/"); - - protected static final File OVERLAYS_ROOT_DIR = new File(getBasedir(), "target/test-classes/overlays/"); - - protected static final String MANIFEST_PATH = "META-INF" + File.separator + "MANIFEST.MF"; - - protected abstract File getTestDirectory() throws Exception; - - protected void setUp() throws Exception { - super.setUp(); - - MavenExecutionRequest request = new DefaultMavenExecutionRequest() - .setSystemProperties(System.getProperties()) - .setStartTime(new Date()); - - MavenSession mavenSession = - new MavenSession((PlexusContainer) null, (RepositorySystemSession) null, request, null); - getContainer().addComponent(mavenSession, MavenSession.class.getName()); - } - /** - * initialize required parameters - * - * @param mojo The mojo to be tested. - * @param classesDir The classes' directory. - * @param webAppSource The webAppSource. - * @param webAppDir The webAppDir folder. - * @param project The Maven project. - * @throws Exception in case of errors - */ - protected void configureMojo( - AbstractWarMojo mojo, File classesDir, File webAppSource, File webAppDir, MavenProjectBasicStub project) - throws Exception { - setVariableValueToObject(mojo, "outdatedCheckPath", "WEB-INF/lib/"); - mojo.setClassesDirectory(classesDir); - mojo.setWarSourceDirectory(webAppSource); - mojo.setWebappDirectory(webAppDir); - mojo.setProject(project); - } - - /** - * create an isolated xml dir - * - * @param id The id. - * @param xmlFiles array of xml files. - * @return The created file. - * @throws Exception in case of errors. - */ - protected File createXMLConfigDir(String id, String[] xmlFiles) throws Exception { - File xmlConfigDir = new File(getTestDirectory(), "/" + id + "-test-data/xml-config"); - File xmlFile; - - createDir(xmlConfigDir); - - if (xmlFiles != null) { - for (String o : xmlFiles) { - xmlFile = new File(xmlConfigDir, o); - createFile(xmlFile); - } - } - - return xmlConfigDir; - } - - /** - * Returns the webapp source directory for the specified id. - * - * @param id the id of the test - * @return the source directory for that test - * @throws Exception if an exception occurs - */ - protected File getWebAppSource(String id) throws Exception { - return new File(getTestDirectory(), "/" + id + "-test-data/source"); - } - - /** - * create an isolated web source with a sample jsp file - * - * @param id The id. - * @param createSamples Create example files yes or no. - * @return The created file. - * @throws Exception in case of errors. - */ - protected File createWebAppSource(String id, boolean createSamples) throws Exception { - File webAppSource = getWebAppSource(id); - if (createSamples) { - File simpleJSP = new File(webAppSource, "pansit.jsp"); - File jspFile = new File(webAppSource, "org/web/app/last-exile.jsp"); - - createFile(simpleJSP); - createFile(jspFile); - } - return webAppSource; - } - - protected File createWebAppSource(String id) throws Exception { - return createWebAppSource(id, true); - } - - /** - * create a class directory with or without a sample class - * - * @param id The id. - * @param empty true to create a class files false otherwise. - * @return The created class file. - * @throws Exception in case of errors. - */ - protected File createClassesDir(String id, boolean empty) throws Exception { - File classesDir = new File(getTestDirectory() + "/" + id + "-test-data/classes/"); - - createDir(classesDir); - - if (!empty) { - createFile(new File(classesDir + "/sample-servlet.clazz")); - } - - return classesDir; - } - - protected void createDir(File dir) { - if (!dir.exists()) { - assertTrue("can not create test dir: " + dir.toString(), dir.mkdirs()); - } - } - - protected void createFile(File testFile, String body) throws Exception { - createDir(testFile.getParentFile()); - FileUtils.fileWrite(testFile.toString(), body); - - assertTrue("could not create file: " + testFile, testFile.exists()); - } - - protected void createFile(File testFile) throws Exception { - createFile(testFile, testFile.toString()); - } - - /** - * Generates test war. - * Generates war with such a structure: - *
    - *
  • jsp - *
      - *
    • d - *
        - *
      • a.jsp
      • - *
      • b.jsp
      • - *
      • c.jsp
      • - *
      - *
    • - *
    • a.jsp
    • - *
    • b.jsp
    • - *
    • c.jsp
    • - *
    - *
  • - *
  • WEB-INF - *
      - *
    • classes - *
        - *
      • a.clazz
      • - *
      • b.clazz
      • - *
      • c.clazz
      • - *
      - *
    • - *
    • lib - *
        - *
      • a.jar
      • - *
      • b.jar
      • - *
      • c.jar
      • - *
      - *
    • - *
    • web.xml
    • - *
    - *
  • - *
- * Each of the files will contain: id+'-'+path - * - * @param id the id of the overlay containing the full structure - * @return the war file - * @throws Exception if an error occurs - */ - protected File generateFullOverlayWar(String id) throws Exception { - final File destFile = new File(OVERLAYS_TEMP_DIR, id + ".war"); - if (destFile.exists()) { - return destFile; - } - - // Archive was not yet created for that id so let's create it - final File rootDir = new File(OVERLAYS_ROOT_DIR, id); - rootDir.mkdirs(); - String[] filePaths = new String[] { - "jsp/d/a.jsp", - "jsp/d/b.jsp", - "jsp/d/c.jsp", - "jsp/a.jsp", - "jsp/b.jsp", - "jsp/c.jsp", - "WEB-INF/classes/a.clazz", - "WEB-INF/classes/b.clazz", - "WEB-INF/classes/c.clazz", - "WEB-INF/lib/a.jar", - "WEB-INF/lib/b.jar", - "WEB-INF/lib/c.jar", - "WEB-INF/web.xml" - }; - - for (String filePath : filePaths) { - createFile(new File(rootDir, filePath), id + "-" + filePath); - } - - createArchive(rootDir, destFile); - return destFile; - } - - // Overlay utilities - - /** - * Builds a test overlay. - * - * @param id the id of the overlay (see test/resources/overlays) - * @return a test war artifact with the content of the given test overlay - */ - protected ArtifactStub buildWarOverlayStub(String id) { - // Create war file - final File destFile = new File(OVERLAYS_TEMP_DIR, id + ".war"); - if (!destFile.exists()) { - createArchive(new File(OVERLAYS_ROOT_DIR, id), destFile); - } - - return new WarOverlayStub(getBasedir(), id, destFile); - } - - protected File getOverlayFile(String id, String filePath) { - final File overlayDir = new File(OVERLAYS_ROOT_DIR, id); - final File file = new File(overlayDir, filePath); - - // Make sure the file exists - assertTrue( - "Overlay file " + filePath + " does not exist for overlay " + id + " at " + file.getAbsolutePath(), - file.exists()); - return file; - } - - protected void createArchive(final File directory, final File destinationFile) { - try { - JarArchiver archiver = new JarArchiver(); - - archiver.setDestFile(destinationFile); - archiver.addDirectory(directory); - - archiver.createArchive(); - - } catch (ArchiverException e) { - e.printStackTrace(); - fail("Failed to create overlay archive " + e.getMessage()); - } catch (IOException e) { - e.printStackTrace(); - fail("Unexpected exception " + e.getMessage()); - } - } -} 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 abff3213..9c6b750d 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java @@ -18,122 +18,140 @@ */ package org.apache.maven.plugins.war; +/* + * 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 javax.inject.Inject; + import java.io.BufferedReader; import java.io.File; import java.io.StringReader; -import java.util.LinkedList; -import java.util.List; - +import java.util.Properties; + +import org.apache.maven.api.di.Provides; +import org.apache.maven.api.plugin.testing.Basedir; +import org.apache.maven.api.plugin.testing.InjectMojo; +import org.apache.maven.api.plugin.testing.MojoExtension; +import org.apache.maven.api.plugin.testing.MojoParameter; +import org.apache.maven.api.plugin.testing.MojoTest; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugins.war.stub.MavenProjectBasicStub; import org.apache.maven.plugins.war.stub.ResourceStub; +import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.FileUtils; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.when; /** * @author Olivier Lamy * @since 21 juil. 2008 */ -public class WarExplodedMojoFilteringTest extends AbstractWarExplodedMojoTest { +@MojoTest +public class WarExplodedMojoFilteringTest { - protected File getPomFile() { - return new File(getBasedir(), "/target/test-classes/unit/warexplodedmojo/plugin-config.xml"); - } + @Inject + private MavenProject project; - protected File getTestDirectory() { - return new File(getBasedir(), "target/test-classes/unit/warexplodedmojo/test-dir"); - } + @Inject + private MavenSession mavenSession; - /** - * @throws Exception in case of an error. - */ - @SuppressWarnings("checkstyle:MethodLength") - public void testExplodedWarWithResourceFiltering() throws Exception { - // setup test data - String testId = "ExplodedWarWithResourceFiltering"; + @Provides + MavenProject project() throws Exception { MavenProjectBasicStub project = new MavenProjectBasicStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, false); - File webAppResource = new File(getTestDirectory(), testId + "-test-data/resources"); - File sampleResource = new File(webAppResource, "custom-setting.cfg"); - File sampleResourceWDir = new File(webAppResource, "custom-config/custom-setting.cfg"); - List filterList = new LinkedList<>(); - ResourceStub[] resources = new ResourceStub[] {new ResourceStub()}; + project.addProperty("is_this_simple", "i_think_so"); + return project; + } - createFile(sampleResource); - createFile(sampleResourceWDir); + @SuppressWarnings("checkstyle:MethodLength") + @InjectMojo(goal = "exploded", pom = "plugin-config.xml") + @Basedir("src/test/resources/unit/warexplodedmojo/") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithResourceFiltering") + @MojoParameter(name = "outdatedCheckPath", value = "WEB-INF/lib/") + @Test + public void testExplodedWarWithResourceFiltering(WarExplodedMojo mojo) throws Exception { + Properties systemProperties = System.getProperties(); + systemProperties.put("system.property", "system-property-value"); + when(mavenSession.getSystemProperties()).thenReturn(systemProperties); - String ls = System.getProperty("line.separator"); - final String comment = "# this is comment created by author@somewhere@"; - // prepare web resources - String content = comment + ls; - content += "system_key_1=${user.dir}" + ls; - content += "system_key_2=@user.dir@" + ls; - content += "project_key_1=${is_this_simple}" + ls; - content += "project_key_2=@is_this_simple@" + ls; - content += "project_name_1=${project.name}" + ls; - content += "project_name_2=@project.name@" + ls; - content += "system_property_1=${system.property}" + ls; - content += "system_property_2=@system.property@" + ls; - FileUtils.fileWrite(sampleResourceWDir.getAbsolutePath(), content); - FileUtils.fileWrite(sampleResource.getAbsolutePath(), content); - - lookup(MavenSession.class).getSystemProperties().setProperty("system.property", "system-property-value"); - - // configure mojo - project.addProperty("is_this_simple", "i_think_so"); - resources[0].setDirectory(webAppResource.getAbsolutePath()); + ResourceStub[] resources = new ResourceStub[] {new ResourceStub()}; + resources[0].setDirectory( + MojoExtension.getBasedir() + "/ExplodedWarWithResourceFiltering-test-data/resources/"); resources[0].setFiltering(true); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "webResources", resources); - setVariableValueToObject(mojo, "filters", filterList); - + mojo.setWebResources(resources); mojo.execute(); // validate operation - File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); - File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); - 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(), - expectedResourceWDirFile.exists()); + File expectedWebSourceFile = new File(mojo.getWebappDirectory(), "pansit.jsp"); + File expectedWebSource2File = new File(mojo.getWebappDirectory(), "org/web/app/last-exile.jsp"); + File expectedResourceFile = new File(mojo.getWebappDirectory(), "custom-setting.cfg"); + File expectedResourceWDirFile = new File(mojo.getWebappDirectory(), "custom-config/custom-setting.cfg"); + + assertTrue(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedResourceFile.exists(), "resource file not found:" + expectedResourceFile); + assertTrue(expectedResourceWDirFile.exists(), "resource file with dir not found:" + expectedResourceWDirFile); // validate filtered file - content = FileUtils.fileRead(expectedResourceWDirFile); + String content = FileUtils.fileRead(expectedResourceWDirFile); BufferedReader reader = new BufferedReader(new StringReader(content)); - - assertEquals("error in filtering using System Properties", comment, reader.readLine()); + final String comment = "# this is comment created by author@somewhere@"; + assertEquals(comment, reader.readLine(), "error in filtering using System Properties"); String line = reader.readLine(); + System.out.println(" line " + line); + System.out.println(" need " + System.getProperty("user.dir")); assertEquals( - "error in filtering using System properties", "system_key_1=" + System.getProperty("user.dir"), line); + "system_key_1=" + System.getProperty("user.dir"), line, "error in filtering using System properties"); line = reader.readLine(); + System.out.println(" line " + line); assertEquals( - "error in filtering using System properties", "system_key_2=" + System.getProperty("user.dir"), line); + "system_key_2=" + System.getProperty("user.dir"), line, "error in filtering using System properties"); - assertEquals("error in filtering using project properties", "project_key_1=i_think_so", reader.readLine()); - assertEquals("error in filtering using project properties", "project_key_2=i_think_so", reader.readLine()); + assertEquals("project_key_1=i_think_so", reader.readLine(), "error in filtering using project properties"); + assertEquals("project_key_2=i_think_so", reader.readLine(), "error in filtering using project properties"); - assertEquals("error in filtering using project properties", "project_name_1=Test Project ", reader.readLine()); - assertEquals("error in filtering using project properties", "project_name_2=Test Project ", reader.readLine()); + assertEquals("project_name_1=Test Project ", reader.readLine(), "error in filtering using project properties"); + assertEquals("project_name_2=Test Project ", reader.readLine(), "error in filtering using project properties"); assertEquals( - "error in filtering using System properties", "system_property_1=system-property-value", - reader.readLine()); + reader.readLine(), + "error in filtering using System properties"); assertEquals( - "error in filtering using System properties", "system_property_2=system-property-value", - reader.readLine()); + reader.readLine(), + "error in filtering using System properties"); // update property, and generate again - lookup(MavenSession.class).getSystemProperties().setProperty("system.property", "new-system-property-value"); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + systemProperties.put("system.property", "new-system-property-value"); + when(mavenSession.getSystemProperties()).thenReturn(systemProperties); mojo.execute(); @@ -141,83 +159,100 @@ public void testExplodedWarWithResourceFiltering() throws Exception { content = FileUtils.fileRead(expectedResourceWDirFile); reader = new BufferedReader(new StringReader(content)); - assertEquals("error in filtering using System Properties", comment, reader.readLine()); + assertEquals(comment, reader.readLine(), "error in filtering using System Properties"); assertEquals( - "error in filtering using System properties", "system_key_1=" + System.getProperty("user.dir"), - reader.readLine()); + reader.readLine(), + "error in filtering using System properties"); assertEquals( - "error in filtering using System properties", "system_key_2=" + System.getProperty("user.dir"), - reader.readLine()); + reader.readLine(), + "error in filtering using System properties"); - assertEquals("error in filtering using project properties", "project_key_1=i_think_so", reader.readLine()); - assertEquals("error in filtering using project properties", "project_key_2=i_think_so", reader.readLine()); + assertEquals("project_key_1=i_think_so", reader.readLine(), "error in filtering using project properties"); + assertEquals("project_key_2=i_think_so", reader.readLine(), "error in filtering using project properties"); - assertEquals("error in filtering using project properties", "project_name_1=Test Project ", reader.readLine()); - assertEquals("error in filtering using project properties", "project_name_2=Test Project ", reader.readLine()); + assertEquals("project_name_1=Test Project ", reader.readLine(), "error in filtering using project properties"); + assertEquals("project_name_2=Test Project ", reader.readLine(), "error in filtering using project properties"); assertEquals( - "error in filtering using System properties", "system_property_1=new-system-property-value", - reader.readLine()); + reader.readLine(), + "error in filtering using System properties"); assertEquals( - "error in filtering using System properties", "system_property_2=new-system-property-value", - reader.readLine()); + reader.readLine(), + "error in filtering using System properties"); + } - // update property, and generate again - File filterFile = new File(getTestDirectory(), testId + "-test-data/filters/filter.properties"); - createFile(filterFile); - filterList.add(filterFile.getAbsolutePath()); - content += "resource_key_1=${resource_value_1}\n"; - content += "resource_key_2=@resource_value_2@\n" + content; - FileUtils.fileWrite(sampleResourceWDir.getAbsolutePath(), content); - FileUtils.fileWrite(sampleResource.getAbsolutePath(), content); - String filterContent = "resource_value_1=this_is_filtered\n"; - filterContent += "resource_value_2=this_is_filtered"; - FileUtils.fileWrite(filterFile.getAbsolutePath(), filterContent); + @SuppressWarnings("checkstyle:MethodLength") + @InjectMojo(goal = "exploded", pom = "plugin-config.xml") + @Basedir("src/test/resources/unit/warexplodedmojo/") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering") + @MojoParameter(name = "outdatedCheckPath", value = "WEB-INF/lib/") + @MojoParameter( + name = "filters", + value = + "target/test-classes/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/filters/filter.properties") + @Test + public void testExplodedWarWithResourceFileFiltering(WarExplodedMojo mojo) throws Exception { + Properties systemProperties = System.getProperties(); + systemProperties.put("system.property", "system-property-value"); + when(mavenSession.getSystemProperties()).thenReturn(systemProperties); + + ResourceStub[] resources = new ResourceStub[] {new ResourceStub()}; + resources[0].setDirectory( + MojoExtension.getBasedir() + "/ExplodedWarWithResourceFileFiltering-test-data/resources/"); + resources[0].setFiltering(true); + mojo.setWebResources(resources); mojo.execute(); + File expectedResourceWDirFile = new File(mojo.getWebappDirectory(), "custom-config/custom-setting.cfg"); + assertTrue(expectedResourceWDirFile.exists(), "resource file with dir not found:" + expectedResourceWDirFile); + // validate filtered file + String content = FileUtils.fileRead(expectedResourceWDirFile); content = FileUtils.fileRead(expectedResourceWDirFile); - reader = new BufferedReader(new StringReader(content)); + BufferedReader reader = new BufferedReader(new StringReader(content)); - assertEquals("error in filtering using System Properties", comment, reader.readLine()); + final String comment = "# this is comment created by author@somewhere@"; + assertEquals(comment, reader.readLine(), "error in filtering using System Properties"); assertEquals( - "error in filtering using System properties", "system_key_1=" + System.getProperty("user.dir"), - reader.readLine()); + reader.readLine(), + "error in filtering using System properties"); assertEquals( - "error in filtering using System properties", "system_key_2=" + System.getProperty("user.dir"), - reader.readLine()); + reader.readLine(), + "error in filtering using System properties"); - assertEquals("error in filtering using project properties", "project_key_1=i_think_so", reader.readLine()); - assertEquals("error in filtering using project properties", "project_key_2=i_think_so", reader.readLine()); + assertEquals("project_key_1=i_think_so", reader.readLine(), "error in filtering using project properties"); + assertEquals("project_key_2=i_think_so", reader.readLine(), "error in filtering using project properties"); - assertEquals("error in filtering using project properties", "project_name_1=Test Project ", reader.readLine()); - assertEquals("error in filtering using project properties", "project_name_2=Test Project ", reader.readLine()); + assertEquals("project_name_1=Test Project ", reader.readLine(), "error in filtering using project properties"); + assertEquals("project_name_2=Test Project ", reader.readLine(), "error in filtering using project properties"); assertEquals( - "error in filtering using System properties", - "system_property_1=new-system-property-value", - reader.readLine()); + "system_property_1=system-property-value", + reader.readLine(), + "error in filtering using System properties"); assertEquals( - "error in filtering using System properties", - "system_property_2=new-system-property-value", - reader.readLine()); - - assertEquals("error in filtering using filter files", "resource_key_1=this_is_filtered", reader.readLine()); - assertEquals("error in filtering using filter files", "resource_key_2=this_is_filtered", reader.readLine()); + "system_property_2=system-property-value", + reader.readLine(), + "error in filtering using System properties"); - // house-keeping - expectedWebSourceFile.delete(); - expectedWebSource2File.delete(); - expectedResourceFile.delete(); - expectedResourceWDirFile.delete(); + assertEquals("resource_key_1=this_is_filtered", reader.readLine(), "error in filtering using filter files"); + assertEquals("resource_key_2=this_is_filtered", reader.readLine(), "error in filtering using filter files"); } } 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 1fb2b047..fda13e50 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java @@ -22,7 +22,11 @@ import java.text.SimpleDateFormat; import java.util.Locale; -import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.api.plugin.testing.InjectMojo; +import org.apache.maven.api.plugin.testing.MojoExtension; +import org.apache.maven.api.plugin.testing.MojoParameter; +import org.apache.maven.api.plugin.testing.MojoTest; +import org.apache.maven.artifact.handler.DefaultArtifactHandler; import org.apache.maven.plugin.testing.stubs.ArtifactStub; import org.apache.maven.plugins.war.stub.AarArtifactStub; import org.apache.maven.plugins.war.stub.EJBArtifactStub; @@ -39,57 +43,48 @@ import org.apache.maven.plugins.war.stub.WarArtifactStub; import org.apache.maven.plugins.war.stub.XarArtifactStub; import org.codehaus.plexus.util.FileUtils; - -import static org.junit.Assert.assertNotEquals; - -public class WarExplodedMojoTest extends AbstractWarExplodedMojoTest { - - @Override - protected File getPomFile() { - return new File(getBasedir(), "/target/test-classes/unit/warexplodedmojo/plugin-config.xml"); - } - - @Override - protected File getTestDirectory() { - return new File(getBasedir(), "target/test-classes/unit/warexplodedmojo/test-dir"); - } - - /** - * @throws Exception in case of an error. - */ - public void testSimpleExplodedWar() throws Exception { - // setup test data - String testId = "SimpleExplodedWar"; +import org.junit.jupiter.api.Test; + +import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@MojoTest +public class WarExplodedMojoTest { + + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/SimpleExplodedWar-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/SimpleExplodedWar-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/SimpleExplodedWar") + @Test + public void testSimpleExplodedWar(WarExplodedMojo mojo) throws Exception { MavenProjectBasicStub project = new MavenProjectBasicStub(); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, false); - File webAppResource = new File(getTestDirectory(), testId + "-resources"); - File webAppDirectory = new File(getTestDirectory(), testId); - File sampleResource = new File(webAppResource, "pix/panis_na.jpg"); + mojo.setProject(project); ResourceStub[] resources = new ResourceStub[] {new ResourceStub()}; - - createFile(sampleResource); - - assertTrue("sampeResource not found", sampleResource.exists()); - - // configure mojo - resources[0].setDirectory(webAppResource.getAbsolutePath()); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "webResources", resources); + resources[0].setDirectory(MojoExtension.getBasedir() + + "/target/test-classes/unit/warexplodedmojo/SimpleExplodedWar-test-data/resources/"); + mojo.setWebResources(resources); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); File expectedWebResourceFile = new File(webAppDirectory, "pix/panis_na.jpg"); 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("resources doesn't exist: " + expectedWebResourceFile, expectedWebResourceFile.exists()); - assertTrue("WEB-INF not found", expectedWEBINFDir.exists()); - assertTrue("META-INF not found", expectedMETAINFDir.exists()); + assertTrue(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedWebResourceFile.exists(), "resources doesn't exist: " + expectedWebResourceFile); + assertTrue(expectedWEBINFDir.exists(), "WEB-INF not found"); + assertTrue(expectedMETAINFDir.exists(), "META-INF not found"); // housekeeping expectedWebSourceFile.delete(); @@ -97,41 +92,39 @@ public void testSimpleExplodedWar() throws Exception { expectedWebResourceFile.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testSimpleExplodedWarWTargetPath() throws Exception { - // setup test data - String testId = "SimpleExplodedWar"; - MavenProjectBasicStub project = new MavenProjectBasicStub(); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, false); - File webAppResource = new File(getTestDirectory(), "resources"); - File webAppDirectory = new File(getTestDirectory(), testId); - File sampleResource = new File(webAppResource, "pix/panis_na.jpg"); + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/SimpleExplodedWar-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/SimpleExplodedWar-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/SimpleExplodedWar") + @Test + public void testSimpleExplodedWarWTargetPath(WarExplodedMojo mojo) throws Exception { ResourceStub[] resources = new ResourceStub[] {new ResourceStub()}; - - createFile(sampleResource); - - // configure mojo - resources[0].setDirectory(webAppResource.getAbsolutePath()); + resources[0].setDirectory(MojoExtension.getBasedir() + + "/target/test-classes/unit/warexplodedmojo/SimpleExplodedWar-test-data/resources/"); resources[0].setTargetPath("targetPath"); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "webResources", resources); + mojo.setWebResources(resources); + + MavenProjectBasicStub project = new MavenProjectBasicStub(); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); File expectedWebResourceFile = new File(webAppDirectory, "targetPath/pix/panis_na.jpg"); 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("resources doesn't exist: " + expectedWebResourceFile, expectedWebResourceFile.exists()); - assertTrue("WEB-INF not found", expectedWEBINFDir.exists()); - assertTrue("META-INF not found", expectedMETAINFDir.exists()); + assertTrue(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedWebResourceFile.exists(), "resources doesn't exist: " + expectedWebResourceFile); + assertTrue(expectedWEBINFDir.exists(), "WEB-INF not found"); + assertTrue(expectedMETAINFDir.exists(), "META-INF not found"); // housekeeping expectedWebSourceFile.delete(); @@ -139,34 +132,39 @@ public void testSimpleExplodedWarWTargetPath() throws Exception { expectedWebResourceFile.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithCustomWebXML() throws Exception { - // setup test data - String testId = "ExplodedWarWithCustomWebXML"; - MavenProjectBasicStub project = new MavenProjectBasicStub(); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/source/") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/xml-config/web.xml") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithCustomWebXML") + @Test + public void testExplodedWarWithCustomWebXML(WarExplodedMojo mojo) throws Exception { // configure mojo - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - mojo.setWebXml(new File(xmlSource, "web.xml")); + MavenProjectBasicStub project = new MavenProjectBasicStub(); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); 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("META-INF not found", expectedMETAINFDir.exists()); - assertEquals("WEB XML not correct", mojo.getWebXml().toString(), FileUtils.fileRead(expectedWEBXMLFile)); + assertTrue(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedWEBXMLFile.exists(), "WEB XML not found: " + expectedWEBXMLFile); + assertTrue(expectedMETAINFDir.exists(), "META-INF not found"); + assertEquals(mojo.getWebXml().getName(), FileUtils.fileRead(expectedWEBXMLFile), "WEB XML not correct"); // housekeeping expectedWebSourceFile.delete(); @@ -175,35 +173,40 @@ public void testExplodedWarWithCustomWebXML() throws Exception { expectedMETAINFDir.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithContainerConfigXML() throws Exception { - // setup test data - String testId = "ExplodedWarWithContainerConfigXML"; - MavenProjectBasicStub project = new MavenProjectBasicStub(); - File classesDir = createClassesDir(testId, true); - File webAppSource = createWebAppSource(testId); - File xmlSource = createXMLConfigDir(testId, new String[] {"config.xml"}); - File webAppDirectory = new File(getTestDirectory(), testId); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/source/") + @MojoParameter( + name = "containerConfigXML", + value = + "target/test-classes/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/xml-config/config.xml") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML") + @Test + public void testExplodedWarWithContainerConfigXML(WarExplodedMojo mojo) throws Exception { // configure mojo - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - mojo.setContainerConfigXML(new File(xmlSource, "config.xml")); + MavenProjectBasicStub project = new MavenProjectBasicStub(); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); 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("WEB-INF not found", expectedWEBINFDir.exists()); + assertTrue(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedWEBINFDir.exists(), "WEB-INF not found"); assertTrue( - "Container Config XML not found:" + expectedContainerConfigXMLFile.toString(), - expectedContainerConfigXMLFile.exists()); + expectedContainerConfigXMLFile.exists(), + "Container Config XML not found:" + expectedContainerConfigXMLFile); // housekeeping expectedWebSourceFile.delete(); @@ -215,39 +218,40 @@ public void testExplodedWarWithContainerConfigXML() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWarWithSimpleExternalWARFile() throws Exception { - // setup test data - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); - - String testId = "ExplodedWarWithSimpleExternalWARFile"; - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File workDirectory = new File(getTestDirectory(), "/war/work-" + testId); - File simpleWarFile = warArtifact.getFile(); - - assertTrue("simple war not found: " + simpleWarFile.toString(), simpleWarFile.exists()); - - createDir(workDirectory); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile") + @MojoParameter( + name = "workDirectory", + value = "target/test-classes/unit/warexplodedmojo/test-dir/war/work-ExplodedWarWithSimpleExternalWARFile") + @Test + public void testExplodedWarWithSimpleExternalWARFile(WarExplodedMojo mojo) throws Exception { // configure mojo + WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); project.addArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "workDirectory", workDirectory); + mojo.setProject(project); mojo.execute(); // validate operation - META-INF is automatically excluded so remove the file from the list + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); // 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(expectedWEBXMLFile.exists(), "web xml not found: " + expectedWEBXMLFile); + assertTrue(expectedWARFile.exists(), "war file not found: " + expectedWARFile); // housekeeping expectedWebSourceFile.delete(); @@ -260,81 +264,79 @@ public void testExplodedWarWithSimpleExternalWARFile() throws Exception { * Merge a dependent WAR when a file in the war source directory overrides one found in the WAR. * @throws Exception in case of an error. */ - public void testExplodedWarMergeWarLocalFileOverride() throws Exception { - // setup test data - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); - - String testId = "testExplodedWarMergeWarLocalFileOverride"; - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = getWebAppSource(testId); - File simpleJSP = new File(webAppSource, "org/sample/company/test.jsp"); - createFile(simpleJSP); - - File workDirectory = new File(getTestDirectory(), "/war/work-" + testId); - createDir(workDirectory); - - File classesDir = createClassesDir(testId, true); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarMergeWarLocalFileOverride-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarMergeWarLocalFileOverride-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarMergeWarLocalFileOverride") + @MojoParameter( + name = "workDirectory", + value = "target/test-classes/unit/warexplodedmojo/test-dir/war/work-ExplodedWarMergeWarLocalFileOverride") + @Test + public void testExplodedWarMergeWarLocalFileOverride(WarExplodedMojo mojo) throws Exception { // configure mojo + WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); project.addArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "workDirectory", workDirectory); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedFile = new File(webAppDirectory, "/org/sample/company/test.jsp"); - assertTrue("file not found: " + expectedFile.toString(), expectedFile.exists()); - assertEquals("file incorrect", simpleJSP.toString(), FileUtils.fileRead(expectedFile)); + assertTrue(expectedFile.exists(), "file not found: " + expectedFile); + assertEquals("org/sample/company/test.jsp", FileUtils.fileRead(expectedFile), "file incorrect"); // check when the merged war file is newer - so set an old time on the local file + File simpleJSP = new File( + MojoExtension.getBasedir(), + "target/test-classes/unit/warexplodedmojo/testExplodedWarMergeWarLocalFileOverride-test-data/source/org/sample/company/test.jsp"); long time = new SimpleDateFormat("yyyy-MM-dd", Locale.US).parse("2005-1-1").getTime(); simpleJSP.setLastModified(time); - expectedFile.setLastModified(time); - - project.addArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "workDirectory", workDirectory); mojo.execute(); - assertTrue("file not found: " + expectedFile.toString(), expectedFile.exists()); - assertEquals("file incorrect", simpleJSP.toString(), FileUtils.fileRead(expectedFile)); + expectedFile.setLastModified(time); + assertTrue(expectedFile.exists(), "file not found: " + expectedFile); + assertEquals("org/sample/company/test.jsp", FileUtils.fileRead(expectedFile), "file incorrect"); // housekeeping expectedFile.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithEJB() throws Exception { - // setup test data - String testId = "ExplodedWarWithEJB"; + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithEJB") + @Test + public void testExplodedWarWithEJB(WarExplodedMojo mojo) throws Exception { + // configure mojo MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); EJBArtifactStub ejbArtifact = new EJBArtifactStub(getBasedir()); - File ejbFile = ejbArtifact.getFile(); - - assertTrue("ejb jar not found: " + ejbFile.toString(), ejbFile.exists()); - - // configure mojo project.addArtifact(ejbArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedEJBArtifact.exists(), "ejb artifact not found: " + expectedEJBArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -342,33 +344,33 @@ public void testExplodedWarWithEJB() throws Exception { expectedEJBArtifact.delete(); } - public void testExplodedWarWithJar() throws Exception { - // setup test data - String testId = "ExplodedWarWithJar"; - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar"); - ArtifactStub jarArtifact = new JarArtifactStub(getBasedir(), artifactHandler); - File jarFile = jarArtifact.getFile(); - - assertTrue("jar not found: " + jarFile.toString(), jarFile.exists()); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithJar-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithJar-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithJar") + @Test + public void testExplodedWarWithJar(WarExplodedMojo mojo) throws Exception { // configure mojo + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); + ArtifactStub jarArtifact = new JarArtifactStub(getBasedir(), new DefaultArtifactHandler("jar")); project.addArtifact(jarArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedJarArtifact.exists(), "jar artifact not found: " + expectedJarArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -379,32 +381,33 @@ public void testExplodedWarWithJar() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWarWithEJBClient() throws Exception { - // setup test data - String testId = "ExplodedWarWithEJB"; + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithEJB") + @Test + public void testExplodedWarWithEJBClient(WarExplodedMojo mojo) throws Exception { + // configure mojo MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); EJBClientArtifactStub ejbArtifact = new EJBClientArtifactStub(getBasedir()); - File ejbFile = ejbArtifact.getFile(); - - assertTrue("ejb jar not found: " + ejbFile.toString(), ejbFile.exists()); - - // configure mojo project.addArtifact(ejbArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedEJBArtifact.exists(), "ejb artifact not found: " + expectedEJBArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -415,32 +418,33 @@ public void testExplodedWarWithEJBClient() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWarWithTLD() throws Exception { - // setup test data - String testId = "ExplodedWarWithTLD"; + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithTLD-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithTLD-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithTLD") + @Test + public void testExplodedWarWithTLD(WarExplodedMojo mojo) throws Exception { + // configure mojo MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); TLDArtifactStub tldArtifact = new TLDArtifactStub(getBasedir()); - File tldFile = tldArtifact.getFile(); - - assertTrue("tld jar not found: " + tldFile.getAbsolutePath(), tldFile.exists()); - - // configure mojo project.addArtifact(tldArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedTLDArtifact.exists(), "tld artifact not found: " + expectedTLDArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -448,35 +452,33 @@ public void testExplodedWarWithTLD() throws Exception { expectedTLDArtifact.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithPAR() throws Exception { - // setup test data - String testId = "ExplodedWarWithPAR"; + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithPAR-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithPAR-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithPAR") + @Test + public void testExplodedWarWithPAR(WarExplodedMojo mojo) throws Exception { + // configure mojo MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); PARArtifactStub parartifact = new PARArtifactStub(getBasedir()); - File parFile = parartifact.getFile(); - - assertTrue("par not found: " + parFile.getAbsolutePath(), parFile.exists()); - - // configure mojo project.addArtifact(parartifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedPARArtifact.exists(), "par artifact not found: " + expectedPARArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -484,37 +486,33 @@ public void testExplodedWarWithPAR() throws Exception { expectedPARArtifact.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithAar() throws Exception { - // setup test data - String testId = "ExplodedWarWithAar"; - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - // Fake here since the aar artifact handler does not exist: no biggie - ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar"); - ArtifactStub aarArtifact = new AarArtifactStub(getBasedir(), artifactHandler); - File aarFile = aarArtifact.getFile(); - - assertTrue("jar not found: " + aarFile.toString(), aarFile.exists()); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithAar-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithAar-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithAar") + @Test + public void testExplodedWarWithAar(WarExplodedMojo mojo) throws Exception { // configure mojo + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); + ArtifactStub aarArtifact = new AarArtifactStub(getBasedir(), new DefaultArtifactHandler("jar")); project.addArtifact(aarArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedJarArtifact.exists(), "jar artifact not found: " + expectedJarArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -522,37 +520,33 @@ public void testExplodedWarWithAar() throws Exception { expectedJarArtifact.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithMar() throws Exception { - // setup test data - String testId = "ExplodedWarWithMar"; - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - // Fake here since the mar artifact handler does not exist: no biggie - ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar"); - ArtifactStub marArtifact = new MarArtifactStub(getBasedir(), artifactHandler); - File marFile = marArtifact.getFile(); - - assertTrue("jar not found: " + marFile.toString(), marFile.exists()); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithMar-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithMar-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithMar") + @Test + public void testExplodedWarWithMar(WarExplodedMojo mojo) throws Exception { // configure mojo + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); + ArtifactStub marArtifact = new MarArtifactStub(getBasedir(), new DefaultArtifactHandler("jar")); project.addArtifact(marArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedJarArtifact.exists(), "jar artifact not found: " + expectedJarArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -560,37 +554,33 @@ public void testExplodedWarWithMar() throws Exception { expectedJarArtifact.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithXar() throws Exception { - // setup test data - String testId = "ExplodedWarWithXar"; - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - // Fake here since the xar artifact handler does not exist: no biggie - ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar"); - ArtifactStub xarArtifact = new XarArtifactStub(getBasedir(), artifactHandler); - File xarFile = xarArtifact.getFile(); - - assertTrue("jar not found: " + xarFile.toString(), xarFile.exists()); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithXar-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithXar-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithXar") + @Test + public void testExplodedWarWithXar(WarExplodedMojo mojo) throws Exception { // configure mojo + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); + ArtifactStub xarArtifact = new XarArtifactStub(getBasedir(), new DefaultArtifactHandler("jar")); project.addArtifact(xarArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedJarArtifact.exists(), "jar artifact not found: " + expectedJarArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -598,42 +588,41 @@ public void testExplodedWarWithXar() throws Exception { expectedJarArtifact.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithDuplicateDependencies() throws Exception { - // setup test data - String testId = "ExplodedWarWithDuplicateDependencies"; - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - EJBArtifactStub ejbArtifact = new EJBArtifactStub(getBasedir()); - EJBArtifactStub ejbArtifactDup = new EJBArtifactStub(getBasedir()); - File ejbFile = ejbArtifact.getFile(); - - // ejbArtifact has a hard coded file, only one assert is needed - assertTrue("ejb not found: " + ejbFile.getAbsolutePath(), ejbFile.exists()); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies") + @Test + public void testExplodedWarWithDuplicateDependencies(WarExplodedMojo mojo) throws Exception { // configure mojo + EJBArtifactStub ejbArtifact = new EJBArtifactStub(getBasedir()); ejbArtifact.setGroupId("org.sample.ejb"); + EJBArtifactStub ejbArtifactDup = new EJBArtifactStub(getBasedir()); ejbArtifactDup.setGroupId("org.dup.ejb"); + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); project.addArtifact(ejbArtifact); project.addArtifact(ejbArtifactDup); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedEJBArtifact.exists(), "ejb artifact not found: " + expectedEJBArtifact); + assertTrue(expectedEJBDupArtifact.exists(), "ejb dup artifact not found: " + expectedEJBDupArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -645,45 +634,42 @@ public void testExplodedWarWithDuplicateDependencies() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWarDuplicateWithClassifier() throws Exception { - // setup test data - String testId = "ExplodedWarDuplicateWithClassifier"; + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier") + @Test + public void testExplodedWarDuplicateWithClassifier(WarExplodedMojo mojo) throws Exception { + // configure mojo MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); EJBArtifactStub ejbArtifact = new EJBArtifactStub(getBasedir()); - EJBArtifactStubWithClassifier ejbArtifactDup = new EJBArtifactStubWithClassifier(getBasedir()); - - File ejbFile = ejbArtifact.getFile(); - - // ejbArtifact has a hard coded file, only one assert is needed - assertTrue("ejb not found: " + ejbFile.getAbsolutePath(), ejbFile.exists()); - - // configure mojo - ejbArtifact.setGroupId("org.sample.ejb"); + EJBArtifactStubWithClassifier ejbArtifactDup = new EJBArtifactStubWithClassifier(getBasedir()); ejbArtifactDup.setGroupId("org.sample.ejb"); - ejbArtifactDup.setClassifier("classifier"); - project.addArtifact(ejbArtifact); project.addArtifact(ejbArtifactDup); - - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedEJBArtifact.exists(), "ejb artifact not found: " + expectedEJBArtifact); + assertTrue(expectedEJBDupArtifact.exists(), "ejb dup artifact not found: " + expectedEJBDupArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -695,27 +681,31 @@ public void testExplodedWarDuplicateWithClassifier() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWarWithClasses() throws Exception { - // setup test data - String testId = "ExplodedWarWithClasses"; - MavenProjectBasicStub project = new MavenProjectBasicStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, false); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithClasses") + @Test + public void testExplodedWarWithClasses(WarExplodedMojo mojo) throws Exception { // configure mojo - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + MavenProjectBasicStub project = new MavenProjectBasicStub(); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. File expectedClass = new File(webAppDirectory, "WEB-INF/classes/sample-servlet.clazz"); - 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedClass.exists(), "classes not found: " + expectedClass); // housekeeping expectedWebSourceFile.delete(); @@ -723,33 +713,36 @@ public void testExplodedWarWithClasses() throws Exception { expectedClass.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithSourceIncludeExclude() throws Exception { - // setup test data - String testId = "ExplodedWarWithSourceIncludeExclude"; - MavenProjectBasicStub project = new MavenProjectBasicStub(); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File webAppDirectory = new File(getTestDirectory(), testId); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude") + @MojoParameter(name = "warSourceIncludes", value = "**/*sit.jsp") + @MojoParameter(name = "warSourceExcludes", value = "**/last*.*") + @Test + public void testExplodedWarWithSourceIncludeExclude(WarExplodedMojo mojo) throws Exception { // configure mojo - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "warSourceIncludes", "**/*sit.jsp"); - setVariableValueToObject(mojo, "warSourceExcludes", "**/last*.*"); + MavenProjectBasicStub project = new MavenProjectBasicStub(); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); 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("META-INF not found", expectedMETAINFDir.exists()); + assertTrue(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertFalse(expectedWebSource2File.exists(), "source files found: " + expectedWebSource2File); + assertTrue(expectedWEBXMLDir.exists(), "WEB XML not found: " + expectedWEBXMLDir); + assertTrue(expectedMETAINFDir.exists(), "META-INF not found"); // housekeeping expectedWebSourceFile.delete(); @@ -758,33 +751,35 @@ public void testExplodedWarWithSourceIncludeExclude() throws Exception { expectedMETAINFDir.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithWarDependencyIncludeExclude() throws Exception { - // setup test data - String testId = "ExplodedWarWithWarDependencyIncludeExclude"; + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = + "target/test-classes/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = + "target/test-classes/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude") + @MojoParameter(name = "dependentWarIncludes", value = "**/*Include.jsp,**/*.xml") + @MojoParameter(name = "dependentWarExcludes", value = "**/*Exclude*,**/MANIFEST.MF") + @MojoParameter( + name = "workDirectory", + value = + "target/test-classes/unit/warexplodedmojo/test-dir/war/work-ExplodedWarWithWarDependencyIncludeExclude") + @Test + public void testExplodedWarWithWarDependencyIncludeExclude(WarExplodedMojo mojo) throws Exception { + // configure mojo MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); IncludeExcludeWarArtifactStub includeexcludeWarArtifact = new IncludeExcludeWarArtifactStub(getBasedir()); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File workDirectory = new File(getTestDirectory(), "/war/work-" + testId); - File includeExcludeWarFile = includeexcludeWarArtifact.getFile(); - - assertTrue("war not found: " + includeExcludeWarFile.toString(), includeExcludeWarFile.exists()); - - createDir(workDirectory); - - // configure mojo project.addArtifact(includeexcludeWarArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "dependentWarIncludes", "**/*Include.jsp,**/*.xml"); - setVariableValueToObject(mojo, "dependentWarExcludes", "**/*Exclude*,**/MANIFEST.MF"); - setVariableValueToObject(mojo, "workDirectory", workDirectory); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); File expectedManifestFile = new File(webAppDirectory, "META-INF/MANIFEST.MF"); @@ -792,13 +787,13 @@ public void testExplodedWarWithWarDependencyIncludeExclude() throws Exception { 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); // 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(expectedWEBXMLFile.exists(), "web xml not found: " + expectedWEBXMLFile); + assertFalse(expectedManifestFile.exists(), "manifest file found: " + expectedManifestFile); + assertTrue(expectedIncludedWARFile.exists(), "war file not found: " + expectedIncludedWARFile); + assertFalse(expectedExcludedWarfile.exists(), "war file not found: " + expectedExcludedWarfile); // housekeeping expectedWebSourceFile.delete(); @@ -809,42 +804,45 @@ public void testExplodedWarWithWarDependencyIncludeExclude() throws Exception { expectedExcludedWarfile.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithSourceModificationCheck() throws Exception { - // setup test data - String testId = "ExplodedWarWithSourceModificationCheck"; - MavenProjectBasicStub project = new MavenProjectBasicStub(); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, false); - File webAppDirectory = new File(getTestDirectory(), testId); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = + "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck") + @Test + public void testExplodedWarWithSourceModificationCheck(WarExplodedMojo mojo) throws Exception { // configure mojo - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + MavenProjectBasicStub project = new MavenProjectBasicStub(); + mojo.setProject(project); // destination file is already created manually containing an "error" string // source is newer than the destination file mojo.execute(); // validate operation - + File webAppDirectory = mojo.getWebappDirectory(); File expectedWEBINFDir = new File(webAppDirectory, "WEB-INF"); File expectedMETAINFDir = new File(webAppDirectory, "META-INF"); 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("WEB-INF not found", expectedWEBINFDir.exists()); - assertTrue("META-INF not found", expectedMETAINFDir.exists()); + assertTrue(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedWEBINFDir.exists(), "WEB-INF not found"); + assertTrue(expectedMETAINFDir.exists(), "META-INF not found"); // 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(), "error", - FileUtils.fileRead(expectedWebSourceFile)); + FileUtils.fileRead(expectedWebSourceFile), + "source files not updated with new copy: " + expectedWebSourceFile); // housekeeping expectedWEBINFDir.delete(); @@ -853,37 +851,36 @@ public void testExplodedWarWithSourceModificationCheck() throws Exception { expectedWebSource2File.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithOutputFileNameMapping() throws Exception { - // setup test data - String testId = "ExplodedWarWithFileNameMapping"; - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar"); - ArtifactStub jarArtifact = new JarArtifactStub(getBasedir(), artifactHandler); - File jarFile = jarArtifact.getFile(); - - assertTrue("jar not found: " + jarFile.toString(), jarFile.exists()); - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithFileNameMapping-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithFileNameMapping-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithFileNameMapping") + @MojoParameter(name = "outputFileNameMapping", value = "@{artifactId}@.@{extension}@") + @Test + public void testExplodedWarWithOutputFileNameMapping(WarExplodedMojo mojo) throws Exception { // configure mojo + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); + ArtifactStub jarArtifact = new JarArtifactStub(getBasedir(), new DefaultArtifactHandler("jar")); project.addArtifact(jarArtifact); - mojo.setOutputFileNameMapping("@{artifactId}@.@{extension}@"); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedJarArtifact.exists(), "jar artifact not found: " + expectedJarArtifact); // housekeeping expectedWebSourceFile.delete(); @@ -891,43 +888,45 @@ public void testExplodedWarWithOutputFileNameMapping() throws Exception { expectedJarArtifact.delete(); } - /** - * @throws Exception in case of an error. - */ - public void testExplodedWarWithOutputFileNameMappingAndDuplicateDependencies() throws Exception { - // setup test data - String testId = "ExplodedWarWithFileNameMappingAndDuplicateDependencies"; + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/warexplodedmojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = + "target/test-classes/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = + "target/test-classes/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies") + @MojoParameter(name = "outputFileNameMapping", value = "@{artifactId}@.@{extension}@") + @Test + public void testExplodedWarWithOutputFileNameMappingAndDuplicateDependencies(WarExplodedMojo mojo) + throws Exception { + // configure mojo MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - File webAppDirectory = new File(getTestDirectory(), testId); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); EJBArtifactStub ejbArtifact = new EJBArtifactStub(getBasedir()); - EJBArtifactStub ejbArtifactDup = new EJBArtifactStub(getBasedir()); - File ejbFile = ejbArtifact.getFile(); - - // ejbArtifact has a hard coded file, only one assert is needed - assertTrue("ejb not found: " + ejbFile.getAbsolutePath(), ejbFile.exists()); - - // configure mojo ejbArtifact.setGroupId("org.sample.ejb"); + EJBArtifactStub ejbArtifactDup = new EJBArtifactStub(getBasedir()); ejbArtifactDup.setGroupId("org.dup.ejb"); project.addArtifact(ejbArtifact); project.addArtifact(ejbArtifactDup); - mojo.setOutputFileNameMapping("@{artifactId}@.@{extension}@"); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppDirectory = mojo.getWebappDirectory(); File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); // final name form is -. 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(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedEJBArtifact.exists(), "ejb artifact not found: " + expectedEJBArtifact); + assertTrue(expectedEJBDupArtifact.exists(), "ejb dup artifact not found: " + expectedEJBDupArtifact); // housekeeping 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 41b563f4..787ef1fa 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java @@ -20,55 +20,52 @@ import java.io.File; +import org.apache.maven.api.plugin.testing.InjectMojo; +import org.apache.maven.api.plugin.testing.MojoParameter; +import org.apache.maven.api.plugin.testing.MojoTest; import org.apache.maven.plugins.war.stub.MavenProjectBasicStub; import org.apache.maven.plugins.war.stub.ResourceStub; +import org.junit.jupiter.api.Test; -public class WarInPlaceMojoTest extends AbstractWarMojoTest { - protected static final String POM_FILE_PATH = - getBasedir() + "/target/test-classes/unit/warexplodedinplacemojo/plugin-config.xml"; +import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir; +import static org.junit.jupiter.api.Assertions.assertTrue; - protected File getTestDirectory() throws Exception { - return new File(getBasedir(), "target/test-classes/unit/warexplodedinplacemojo/test-dir"); - } - - private WarInPlaceMojo mojo; - - public void setUp() throws Exception { - super.setUp(); - - mojo = (WarInPlaceMojo) lookupMojo("inplace", POM_FILE_PATH); - assertNotNull(mojo); - } - - public void testSimpleExplodedInplaceWar() throws Exception { - // setup test data - String testId = "SimpleExplodedInplaceWar"; - MavenProjectBasicStub project = new MavenProjectBasicStub(); - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File webAppResource = new File(getTestDirectory(), "resources"); - File sampleResource = new File(webAppResource, "pix/panis_na.jpg"); - ResourceStub[] resources = new ResourceStub[] {new ResourceStub()}; - - createFile(sampleResource); +@MojoTest +public class WarInPlaceMojoTest { + @InjectMojo(goal = "inplace", pom = "src/test/resources/unit/warexplodedinplacemojo/plugin-config.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar") + @Test + public void testSimpleExplodedInplaceWar(WarInPlaceMojo mojo) throws Exception { // configure mojo - resources[0].setDirectory(webAppResource.getAbsolutePath()); - this.configureMojo(mojo, classesDir, webAppSource, null, project); - setVariableValueToObject(mojo, "webResources", resources); + ResourceStub[] resources = new ResourceStub[] {new ResourceStub()}; + resources[0].setDirectory(getBasedir() + + "/target/test-classes/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/resources"); + mojo.setWebResources(resources); + MavenProjectBasicStub project = new MavenProjectBasicStub(); + mojo.setProject(project); mojo.execute(); // validate operation + File webAppSource = mojo.getWarSourceDirectory(); File expectedWebSourceFile = new File(webAppSource, "pansit.jsp"); File expectedWebSource2File = new File(webAppSource, "org/web/app/last-exile.jsp"); File expectedWebResourceFile = new File(webAppSource, "pix/panis_na.jpg"); 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("resources doesn't exist: " + expectedWebResourceFile, expectedWebResourceFile.exists()); - assertTrue("WEB-INF not found", expectedWEBINFDir.exists()); - assertTrue("META-INF not found", expectedMETAINFDir.exists()); + assertTrue(expectedWebSourceFile.exists(), "source files not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source files not found: " + expectedWebSource2File); + assertTrue(expectedWebResourceFile.exists(), "resources doesn't exist: " + expectedWebResourceFile); + assertTrue(expectedWEBINFDir.exists(), "WEB-INF not found"); + assertTrue(expectedMETAINFDir.exists(), "META-INF not found"); } } 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 2443fd13..195f4808 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java @@ -26,54 +26,57 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; +import org.apache.maven.api.plugin.testing.InjectMojo; +import org.apache.maven.api.plugin.testing.MojoExtension; +import org.apache.maven.api.plugin.testing.MojoParameter; +import org.apache.maven.api.plugin.testing.MojoTest; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.artifact.handler.DefaultArtifactHandler; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.war.stub.JarArtifactStub; import org.apache.maven.plugins.war.stub.MavenProject4CopyConstructor; import org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub; -import org.apache.maven.plugins.war.stub.ProjectHelperStub; import org.apache.maven.plugins.war.stub.WarArtifact4CCStub; import org.codehaus.plexus.util.IOUtil; +import org.junit.jupiter.api.Test; + +import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * comprehensive test on buildExplodedWebApp is done on WarExplodedMojoTest */ -public class WarMojoTest extends AbstractWarMojoTest { - WarMojo mojo; - - private static File pomFile = - new File(getBasedir(), "target/test-classes/unit/warmojotest/plugin-config-primary-artifact.xml"); - - protected File getTestDirectory() { - return new File(getBasedir(), "target/test-classes/unit/warmojotest"); - } - - public void setUp() throws Exception { - super.setUp(); - mojo = (WarMojo) lookupMojo("war", pomFile); - } - - public void testSimpleWar() throws Exception { - String testId = "SimpleWar"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); +@MojoTest +public class WarMojoTest { + + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWar-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWar-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/SimpleWar") + @MojoParameter(name = "outputDirectory", value = "target/test-classes/unit/warmojotest/SimpleWar-output") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/SimpleWar-test-data/xml-config/web.xml") + @Test + public void testSimpleWar(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); - + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple.war"); assertJarContent( expectedJarFile, @@ -85,31 +88,41 @@ public void testSimpleWar() throws Exception { "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, - new String[] {null, mojo.getWebXml().toString(), null, null, null, null}); + new String[] {null, mojo.getWebXml().getName(), null, null, null, null}); } - public void testSimpleWarPackagingExcludeWithIncludesRegEx() throws Exception { - String testId = "SimpleWarPackagingExcludeWithIncludesRegEx"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); - WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = + "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-output") + @MojoParameter( + name = "webXml", + value = + "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/xml-config/web.xml") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "packagingIncludes", value = "%regex[(.(?!exile))+]") + @Test + public void testSimpleWarPackagingExcludeWithIncludesRegEx(WarMojo mojo) throws Exception { + WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); - setVariableValueToObject(mojo, "packagingIncludes", "%regex[(.(?!exile))+]"); - // setVariableValueToObject( mojo, "packagingIncludes", "%regex" ); - + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple.war"); assertJarContent( expectedJarFile, @@ -121,32 +134,42 @@ public void testSimpleWarPackagingExcludeWithIncludesRegEx() throws Exception { "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { - null, mojo.getWebXml().toString(), null, null, null, + null, mojo.getWebXml().getName(), null, null, null, }, new String[] {"org/web/app/last-exile.jsp"}); } - public void testSimpleWarPackagingExcludesWithRegEx() throws Exception { - String testId = "SimpleWarPackagingExcludesWithRegEx"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-output") + @MojoParameter( + name = "webXml", + value = + "target/test-classes/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/xml-config/web.xml") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "packagingExcludes", value = "%regex[.+/last-exile.+]") + @Test + public void testSimpleWarPackagingExcludesWithRegEx(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); - setVariableValueToObject(mojo, "packagingExcludes", "%regex[.+/last-exile.+]"); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple.war"); assertJarContent( expectedJarFile, @@ -158,34 +181,37 @@ public void testSimpleWarPackagingExcludesWithRegEx() throws Exception { "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { - null, mojo.getWebXml().toString(), null, null, null, + null, mojo.getWebXml().getName(), null, null, null, }, new String[] {"org/web/app/last-exile.jsp"}); } - public void testClassifier() throws Exception { - String testId = "Classifier"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/Classifier-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/Classifier-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/Classifier") + @MojoParameter(name = "outputDirectory", value = "target/test-classes/unit/warmojotest/Classifier-output") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/Classifier-test-data/xml-config/web.xml") + @MojoParameter(name = "classifier", value = "test-classifier") + @MojoParameter(name = "warName", value = "simple") + @Test + public void testClassifier(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - ProjectHelperStub projectHelper = new ProjectHelperStub(); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "projectHelper", projectHelper); - setVariableValueToObject(mojo, "classifier", "test-classifier"); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple-test-classifier.war"); assertJarContent( expectedJarFile, @@ -197,32 +223,35 @@ public void testClassifier() throws Exception { "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, - new String[] {null, mojo.getWebXml().toString(), null, null, null, null}); + new String[] {null, mojo.getWebXml().getName(), null, null, null, null}); } - public void testPrimaryArtifact() throws Exception { - String testId = "PrimaryArtifact"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/PrimaryArtifact-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/PrimaryArtifact-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/PrimaryArtifact") + @MojoParameter(name = "outputDirectory", value = "target/test-classes/unit/warmojotest/PrimaryArtifact-output") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/PrimaryArtifact-test-data/xml-config/web.xml") + @MojoParameter(name = "warName", value = "simple") + @Test + public void testPrimaryArtifact(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - ProjectHelperStub projectHelper = new ProjectHelperStub(); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - warArtifact.setFile(new File("error.war")); + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "projectHelper", projectHelper); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple.war"); assertJarContent( expectedJarFile, @@ -234,36 +263,35 @@ public void testPrimaryArtifact() throws Exception { "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, - new String[] {null, mojo.getWebXml().toString(), null, null, null, null}); + new String[] {null, mojo.getWebXml().getName(), null, null, null, null}); } - public void testNotPrimaryArtifact() throws Exception { - // use a different pom - File pom = new File(getBasedir(), "target/test-classes/unit/warmojotest/not-primary-artifact.xml"); - mojo = (WarMojo) lookupMojo("war", pom); - - String testId = "NotPrimaryArtifact"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/not-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/NotPrimaryArtifact-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/NotPrimaryArtifact-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/NotPrimaryArtifact") + @MojoParameter(name = "outputDirectory", value = "target/test-classes/unit/warmojotest/NotPrimaryArtifact-output") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/NotPrimaryArtifact-test-data/xml-config/web.xml") + @MojoParameter(name = "warName", value = "simple") + @Test + public void testNotPrimaryArtifact(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - ProjectHelperStub projectHelper = new ProjectHelperStub(); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - warArtifact.setFile(new File("error.war")); + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "projectHelper", projectHelper); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple.war"); assertJarContent( expectedJarFile, @@ -275,33 +303,36 @@ public void testNotPrimaryArtifact() throws Exception { "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, - new String[] {null, mojo.getWebXml().toString(), null, null, null, null}); + new String[] {null, mojo.getWebXml().getName(), null, null, null, null}); } - public void testMetaInfContent() throws Exception { - String testId = "SimpleWarWithMetaInfContent"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/SimpleWarWithMetaInfContent") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarWithMetaInfContent-output") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/xml-config/web.xml") + @MojoParameter(name = "warName", value = "simple") + @Test + public void testMetaInfContent(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - - // Create the sample config.xml - final File configFile = new File(webAppSource, "META-INF/config.xml"); - createFile(configFile, ""); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple.war"); assertJarContent( expectedJarFile, @@ -314,34 +345,42 @@ public void testMetaInfContent() throws Exception { "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, - new String[] {null, null, mojo.getWebXml().toString(), null, null, null, null}); + new String[] {null, null, mojo.getWebXml().getName(), null, null, null, null}); } - public void testMetaInfContentWithContainerConfig() throws Exception { - String testId = "SimpleWarWithContainerConfig"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarWithContainerConfig-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarWithContainerConfig") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarWithContainerConfig-output") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/SimpleWarWithContainerConfig-test-data/xml-config/web.xml") + @MojoParameter( + name = "containerConfigXML", + value = + "target/test-classes/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/META-INF/config.xml") + @MojoParameter(name = "warName", value = "simple") + @Test + public void testMetaInfContentWithContainerConfig(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - - // Create the sample config.xml - final File configFile = new File(webAppSource, "META-INF/config.xml"); - createFile(configFile, ""); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); - mojo.setContainerConfigXML(configFile); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple.war"); assertJarContent( expectedJarFile, @@ -354,28 +393,36 @@ public void testMetaInfContentWithContainerConfig() throws Exception { "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, - new String[] {null, null, mojo.getWebXml().toString(), null, null, null, null}); + new String[] {null, null, mojo.getWebXml().getName(), null, null, null, null}); } - public void testFailOnMissingWebXmlFalse() throws Exception { - - String testId = "SimpleWarMissingWebXmlFalse"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlFalse") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlFalse-output") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/xml-config/web.xml") + @MojoParameter(name = "failOnMissingWebXml", value = "false") + @MojoParameter(name = "warName", value = "simple") + @Test + public void testFailOnMissingWebXmlFalse(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setFailOnMissingWebXml(false); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple.war"); final Map jarContent = assertJarContent( expectedJarFile, @@ -388,25 +435,29 @@ public void testFailOnMissingWebXmlFalse() throws Exception { }, new String[] {null, null, null, null, null}); - assertFalse("web.xml should be missing", jarContent.containsKey("WEB-INF/web.xml")); + assertFalse(jarContent.containsKey("WEB-INF/web.xml"), "web.xml should be missing"); } - public void testFailOnMissingWebXmlTrue() throws Exception { + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlTrue") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlTrue-output") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "failOnMissingWebXml", value = "true") + @Test + public void testFailOnMissingWebXmlTrue(WarMojo mojo) throws Exception { - String testId = "SimpleWarMissingWebXmlTrue"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setFailOnMissingWebXml(true); + mojo.setProject(project); try { mojo.execute(); @@ -416,32 +467,33 @@ public void testFailOnMissingWebXmlTrue() throws Exception { } } - public void testFailOnMissingWebXmlNotSpecifiedAndServlet30Used() throws Exception { - String testId = "SimpleWarUnderServlet30"; - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarUnderServlet30-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/SimpleWarUnderServlet30") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarUnderServlet30-output") + @MojoParameter(name = "warName", value = "simple") + @Test + public void testFailOnMissingWebXmlNotSpecifiedAndServlet30Used(WarMojo mojo) throws Exception { + JarArtifactStub jarArtifactStub = createServletApi3JarArtifact(); WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - - final ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar"); - JarArtifactStub jarArtifactStub = new JarArtifactStub(getBasedir(), artifactHandler); - jarArtifactStub.setFile( - new File(getBasedir(), "/target/test-classes/unit/sample_wars/javax.servlet-api-3.0.1.jar")); - jarArtifactStub.setScope(Artifact.SCOPE_PROVIDED); + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); project.addArtifact(jarArtifactStub); - project.setArtifact(warArtifact); project.setFile(warArtifact.getFile()); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); + mojo.setProject(project); mojo.execute(); // validate war file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedWarFile = new File(outputDir, "simple.war"); final Map jarContent = assertJarContent( expectedWarFile, @@ -454,24 +506,38 @@ public void testFailOnMissingWebXmlNotSpecifiedAndServlet30Used() throws Excepti }, new String[] {null, null, null, null, null}); - assertFalse("web.xml should be missing", jarContent.containsKey("WEB-INF/web.xml")); + assertFalse(jarContent.containsKey("WEB-INF/web.xml"), "web.xml should be missing"); } - public void testFailOnMissingWebXmlNotSpecifiedAndServlet30NotUsed() throws Exception { - String testId = "SimpleWarNotUnderServlet30"; - MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); - WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); + private JarArtifactStub createServletApi3JarArtifact() { + DefaultArtifactHandler jarArtifactHandler = new DefaultArtifactHandler("jar"); + jarArtifactHandler.setAddedToClasspath(true); + JarArtifactStub jarArtifactStub = new JarArtifactStub(getBasedir(), jarArtifactHandler); + jarArtifactStub.setFile( + new File(getBasedir(), "/target/test-classes/unit/sample_wars/javax.servlet-api-3.0.1.jar")); + jarArtifactStub.setScope(Artifact.SCOPE_PROVIDED); + return jarArtifactStub; + } + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/SimpleWarNotUnderServlet30") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/SimpleWarNotUnderServlet30-output") + @MojoParameter(name = "warName", value = "simple") + @Test + public void testFailOnMissingWebXmlNotSpecifiedAndServlet30NotUsed(WarMojo mojo) throws Exception { + WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); + MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); project.setArtifact(warArtifact); project.setFile(warArtifact.getFile()); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); + mojo.setProject(project); try { mojo.execute(); @@ -482,100 +548,114 @@ public void testFailOnMissingWebXmlNotSpecifiedAndServlet30NotUsed() throws Exce } } - public void testAttachClasses() throws Exception { - String testId = "AttachClasses"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/AttachClasses-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/AttachClasses-test-data/source/") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/AttachClasses-test-data/xml-config/web.xml") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warmojotest/AttachClasses") + @MojoParameter(name = "outputDirectory", value = "target/test-classes/unit/warmojotest/AttachClasses-output") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "attachClasses", value = "true") + @MojoParameter(name = "classesClassifier", value = "classes") + @Test + public void testAttachClasses(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, false); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); - mojo.setAttachClasses(true); - mojo.setClassesClassifier("classes"); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple-classes.jar"); assertJarContent( expectedJarFile, new String[] {"META-INF/MANIFEST.MF", "sample-servlet.clazz"}, new String[] {null, null }); } - public void testAttachClassesWithCustomClassifier() throws Exception { - String testId = "AttachClassesCustomClassifier"; - MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); - String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; - File webAppDirectory = new File(getTestDirectory(), testId); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warmojotest/plugin-config-primary-artifact.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warmojotest/AttachClassesCustomClassifier-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warmojotest/AttachClassesCustomClassifier-test-data/xml-config/web.xml") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/warmojotest/AttachClassesCustomClassifier") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warmojotest/AttachClassesCustomClassifier-output") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "attachClasses", value = "true") + @MojoParameter(name = "classesClassifier", value = "mystuff") + @Test + public void testAttachClassesWithCustomClassifier(WarMojo mojo) throws Exception { WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, false); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); project.setArtifact(warArtifact); - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - mojo.setWebXml(new File(xmlSource, "web.xml")); - mojo.setAttachClasses(true); - mojo.setClassesClassifier("mystuff"); + mojo.setProject(project); mojo.execute(); // validate jar file + String outputDir = MojoExtension.getVariableValueFromObject(mojo, "outputDirectory") + .toString(); File expectedJarFile = new File(outputDir, "simple-mystuff.jar"); assertJarContent( expectedJarFile, new String[] {"META-INF/MANIFEST.MF", "sample-servlet.clazz"}, new String[] {null, null }); } - protected Map assertJarContent( + private Map assertJarContent( final File expectedJarFile, final String[] files, final String[] filesContent) throws IOException { return assertJarContent(expectedJarFile, files, filesContent, null); } - protected Map assertJarContent( + private Map assertJarContent( final File expectedJarFile, final String[] files, final String[] filesContent, final String[] mustNotBeInJar) throws IOException { // Sanity check - assertEquals("Could not test, files and filesContent length does not match", files.length, filesContent.length); + assertEquals(files.length, filesContent.length, "Could not test, files and filesContent length does not match"); - assertTrue("war file not created: " + expectedJarFile.toString(), expectedJarFile.exists()); + assertTrue(expectedJarFile.exists(), "war file not created: " + expectedJarFile.toString()); final Map jarContent = new HashMap<>(); try (JarFile jarFile = new JarFile(expectedJarFile)) { Enumeration enumeration = jarFile.entries(); while (enumeration.hasMoreElements()) { JarEntry entry = enumeration.nextElement(); Object previousValue = jarContent.put(entry.getName(), entry); - assertNull("Duplicate Entry in Jar File: " + entry.getName(), previousValue); + assertNull(previousValue, "Duplicate Entry in Jar File: " + entry.getName()); } for (int i = 0; i < files.length; i++) { String file = files[i]; - assertTrue("File[" + file + "] not found in archive", jarContent.containsKey(file)); + assertTrue(jarContent.containsKey(file), "File[" + file + "] not found in archive"); if (filesContent[i] != null) { assertEquals( - "Content of file[" + file + "] does not match", filesContent[i], - IOUtil.toString(jarFile.getInputStream(jarContent.get(file)))); + IOUtil.toString(jarFile.getInputStream(jarContent.get(file))), + "Content of file[" + file + "] does not match"); } } if (mustNotBeInJar != null) { for (String file : mustNotBeInJar) { - assertFalse("File[" + file + "] found in archive", jarContent.containsKey(file)); + assertFalse(jarContent.containsKey(file), "File[" + file + "] found in archive"); } } return jarContent; 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 991711f8..7cb6163b 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java @@ -22,112 +22,140 @@ import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.LinkedList; import java.util.List; +import org.apache.maven.api.plugin.testing.InjectMojo; +import org.apache.maven.api.plugin.testing.MojoExtension; +import org.apache.maven.api.plugin.testing.MojoParameter; +import org.apache.maven.api.plugin.testing.MojoTest; import org.apache.maven.plugin.testing.stubs.ArtifactStub; import org.apache.maven.plugins.war.overlay.DefaultOverlay; +import org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub; +import org.apache.maven.plugins.war.stub.WarOverlayStub; +import org.codehaus.plexus.archiver.ArchiverException; +import org.codehaus.plexus.archiver.jar.JarArchiver; import org.codehaus.plexus.util.FileUtils; +import org.junit.jupiter.api.Test; + +import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir; +import static org.apache.maven.api.plugin.testing.MojoExtension.getVariableValueFromObject; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * @author Stephane Nicoll */ -public class WarOverlaysTest extends AbstractWarExplodedMojoTest { - - private static File pomFile = new File(getBasedir(), "target/test-classes/unit/waroverlays/default.xml"); - - public void setUp() throws Exception { - super.setUp(); - generateFullOverlayWar("overlay-full-1"); - generateFullOverlayWar("overlay-full-2"); - generateFullOverlayWar("overlay-full-3"); - } - - protected File getPomFile() { - return pomFile; - } - - protected File getTestDirectory() { - return new File(getBasedir(), "target/test-classes/unit/waroverlays"); +@MojoTest +public class WarOverlaysTest { + + private static final File OVERLAYS_TEMP_DIR = + new File(getBasedir(), "target/test-classes/unit/waroverlays/test-overlays/"); + private static final File OVERLAYS_ROOT_DIR = new File(getBasedir(), "target/test-classes/overlays/"); + private static final String MANIFEST_PATH = "META-INF" + File.separator + "MANIFEST.MF"; + + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/waroverlays/default.xml") + @MojoParameter(name = "workDirectory", value = "target/test-classes/unit/waroverlays/war/work-no-overlay") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/waroverlays/no-overlay-test-data/classes") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/waroverlays/no-overlay-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/waroverlays/no-overlay") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/waroverlays/no-overlay-test-data/xml-config/web.xml") + @Test + public void testNoOverlay(WarExplodedMojo mojo) throws Exception { + mojo.setProject(new MavenProjectArtifactsStub()); + mojo.execute(); + + // Validate content of the webapp + assertDefaultContent((File) getVariableValueFromObject(mojo, "webappDirectory")); + assertWebXml((File) getVariableValueFromObject(mojo, "webappDirectory")); } - public void testNoOverlay() throws Exception { - // setup test data - final String testId = "no-overlay"; - final File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); - - final File webAppDirectory = setUpMojo(testId, null); - try { - mojo.setWebXml(new File(xmlSource, "web.xml")); - mojo.execute(); - - // Validate content of the webapp - assertDefaultContent(webAppDirectory); - assertWebXml(webAppDirectory); - } finally { - cleanDirectory(webAppDirectory); + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/waroverlays/default.xml") + @MojoParameter(name = "workDirectory", value = "target/test-classes/unit/waroverlays/war/work-default-overlay") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/waroverlays/default-overlay-test-data/classes") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/waroverlays/default-overlay-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/waroverlays/default-overlay") + @Test + public void testDefaultOverlay(WarExplodedMojo mojo) throws Exception { + // Create war file + final File destFile = new File(OVERLAYS_TEMP_DIR, "overlay-one" + ".war"); + if (!destFile.exists()) { + createArchive(new File(OVERLAYS_ROOT_DIR, "overlay-one"), destFile); } - } - public void testDefaultOverlay() throws Exception { - // setup test data - final String testId = "default-overlay"; + final ArtifactStub overlay = new WarOverlayStub(MojoExtension.getBasedir(), "overlay-one", destFile); + final MavenProjectArtifactsStub project = createProjectWithOverlays(overlay); - // Add an overlay - final ArtifactStub overlay = buildWarOverlayStub("overlay-one"); + mojo.setProject(project); + + mojo.execute(); - final File webAppDirectory = setUpMojo(testId, new ArtifactStub[] {overlay}); final List assertedFiles = new ArrayList<>(); - try { - mojo.execute(); - assertedFiles.addAll(assertDefaultContent(webAppDirectory)); - assertedFiles.addAll(assertWebXml(webAppDirectory)); - assertedFiles.addAll(assertCustomContent( - webAppDirectory, new String[] {"index.jsp", "login.jsp"}, "overlay file not found")); - - // index and login come from overlay1 - assertOverlayedFile(webAppDirectory, "overlay-one", "index.jsp"); - 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}); - assertWebAppContent(webAppDirectory, assertedFiles, filter); - } finally { - cleanDirectory(webAppDirectory); - } + File webAppDirectory = (File) getVariableValueFromObject(mojo, "webappDirectory"); + assertedFiles.addAll(assertDefaultContent(webAppDirectory)); + assertedFiles.addAll(assertWebXml(webAppDirectory)); + assertedFiles.addAll(assertCustomContent( + webAppDirectory, new String[] {"index.jsp", "login.jsp"}, "overlay file not found")); + + // index and login come from overlay1 + assertOverlayedFile(webAppDirectory, "overlay-one", "index.jsp"); + 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}); + assertWebAppContent(webAppDirectory, assertedFiles, filter); } - public void testDefaultOverlays() throws Exception { - // setup test data - final String testId = "default-overlays"; - - // Add an overlay + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/waroverlays/default.xml") + @MojoParameter(name = "workDirectory", value = "target/test-classes/unit/waroverlays/war/work-default-overlays") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/waroverlays/default-overlays-test-data/classes") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/waroverlays/default-overlays-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/waroverlays/default-overlays") + @Test + public void testDefaultOverlays(WarExplodedMojo mojo) throws Exception { final ArtifactStub overlay = buildWarOverlayStub("overlay-one"); final ArtifactStub overlay2 = buildWarOverlayStub("overlay-two"); + final MavenProjectArtifactsStub project = createProjectWithOverlays(overlay, overlay2); + + mojo.setProject(project); - final File webAppDirectory = setUpMojo(testId, new ArtifactStub[] {overlay, overlay2}); + mojo.execute(); + + File webAppDirectory = (File) getVariableValueFromObject(mojo, "webappDirectory"); final List assertedFiles = new ArrayList<>(); - try { - mojo.execute(); - assertedFiles.addAll(assertDefaultContent(webAppDirectory)); - assertedFiles.addAll(assertWebXml(webAppDirectory)); - assertedFiles.addAll(assertCustomContent( - webAppDirectory, new String[] {"index.jsp", "login.jsp", "admin.jsp"}, "overlay file not found")); - - // index and login come from overlay1 - assertOverlayedFile(webAppDirectory, "overlay-one", "index.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-one", "login.jsp"); - - // admin comes from overlay2 - // index and login comes from overlay1 - 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}); - assertWebAppContent(webAppDirectory, assertedFiles, filter); - } finally { - cleanDirectory(webAppDirectory); - } + assertedFiles.addAll(assertDefaultContent(webAppDirectory)); + assertedFiles.addAll(assertWebXml(webAppDirectory)); + assertedFiles.addAll(assertCustomContent( + webAppDirectory, new String[] {"index.jsp", "login.jsp", "admin.jsp"}, "overlay file not found")); + + // index and login come from overlay1 + assertOverlayedFile(webAppDirectory, "overlay-one", "index.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-one", "login.jsp"); + + // admin comes from overlay2 + // index and login comes from overlay1 + 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}); + assertWebAppContent(webAppDirectory, assertedFiles, filter); } /** @@ -137,20 +165,34 @@ public void testDefaultOverlays() throws Exception { * * @throws Exception if any error occurs */ - public void testScenarioOneWithDefaulSettings() throws Exception { - // setup test data - final String testId = "scenario-one-default-settings"; - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/waroverlays/default.xml") + @MojoParameter( + name = "workDirectory", + value = "target/test-classes/unit/waroverlays/war/work-scenario-one-default-settings") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/waroverlays/scenario-one-default-settings-test-data/classes") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/waroverlays/scenario-one-default-settings-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/waroverlays/scenario-one-default-settings") + @Test + public void testScenarioOneWithDefaulSettings(WarExplodedMojo mojo) throws Exception { // Add an overlay final ArtifactStub overlay1 = buildWarOverlayStub("overlay-full-1"); final ArtifactStub overlay2 = buildWarOverlayStub("overlay-full-2"); final ArtifactStub overlay3 = buildWarOverlayStub("overlay-full-3"); - final File webAppDirectory = setUpMojo(testId, new ArtifactStub[] {overlay1, overlay2, overlay3}, new String[] { - "org/sample/company/test.jsp", "jsp/b.jsp" - }); + final MavenProjectArtifactsStub project = createProjectWithOverlays(overlay1, overlay2, overlay3); + + mojo.setProject(project); - assertScenariOne(testId, webAppDirectory); + mojo.execute(); + + File webAppDirectory = (File) getVariableValueFromObject(mojo, "webappDirectory"); + assertScenariOne("scenario-one-default-settings", webAppDirectory); } /** @@ -160,18 +202,28 @@ public void testScenarioOneWithDefaulSettings() throws Exception { * * @throws Exception if an error occurs */ - public void testScenarioOneWithOverlaySettings() throws Exception { - // setup test data - final String testId = "scenario-one-overlay-settings"; - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/waroverlays/default.xml") + @MojoParameter( + name = "workDirectory", + value = "target/test-classes/unit/waroverlays/war/work-scenario-one-overlay-settings") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/waroverlays/scenario-one-overlay-settings-test-data/classes") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/waroverlays/scenario-one-overlay-settings-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/waroverlays/scenario-one-overlay-settings") + @Test + public void testScenarioOneWithOverlaySettings(WarExplodedMojo mojo) throws Exception { // Add an overlay final ArtifactStub overlay1 = buildWarOverlayStub("overlay-full-1"); final ArtifactStub overlay2 = buildWarOverlayStub("overlay-full-2"); final ArtifactStub overlay3 = buildWarOverlayStub("overlay-full-3"); - final File webAppDirectory = setUpMojo(testId, new ArtifactStub[] {overlay1, overlay2, overlay3}, new String[] { - "org/sample/company/test.jsp", "jsp/b.jsp" - }); + final MavenProjectArtifactsStub project = createProjectWithOverlays(overlay1, overlay2, overlay3); + mojo.setProject(project); // Add the tags final List overlays = new ArrayList<>(); @@ -180,8 +232,10 @@ public void testScenarioOneWithOverlaySettings() throws Exception { overlays.add(new DefaultOverlay(overlay3)); mojo.setOverlays(overlays); - // current project ignored. Should be on top of the list - assertScenariOne(testId, webAppDirectory); + mojo.execute(); + + File webAppDirectory = (File) getVariableValueFromObject(mojo, "webappDirectory"); + assertScenariOne("scenario-one-overlay-settings", webAppDirectory); } /** @@ -191,33 +245,41 @@ public void testScenarioOneWithOverlaySettings() throws Exception { * * @throws Exception if an error occurs */ - public void testScenarioOneWithFullSettings() throws Exception { - // setup test data - final String testId = "scenario-one-full-settings"; - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/waroverlays/default.xml") + @MojoParameter( + name = "workDirectory", + value = "target/test-classes/unit/waroverlays/war/work-scenario-one-full-settings") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/waroverlays/scenario-one-full-settings-test-data/classes") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/waroverlays/scenario-one-full-settings-test-data/source/") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/waroverlays/scenario-one-full-settings") + @Test + public void testScenarioOneWithFullSettings(WarExplodedMojo mojo) throws Exception { // Add an overlay final ArtifactStub overlay1 = buildWarOverlayStub("overlay-full-1"); final ArtifactStub overlay2 = buildWarOverlayStub("overlay-full-2"); final ArtifactStub overlay3 = buildWarOverlayStub("overlay-full-3"); - final File webAppDirectory = setUpMojo(testId, new ArtifactStub[] {overlay1, overlay2, overlay3}, new String[] { - "org/sample/company/test.jsp", "jsp/b.jsp" - }); + final MavenProjectArtifactsStub project = createProjectWithOverlays(overlay1, overlay2, overlay3); + mojo.setProject(project); // Add the tags final List overlays = new ArrayList<>(); - // Add the default project explicitely overlays.add(mojo.getCurrentProjectOverlay()); - // Other overlays overlays.add(new DefaultOverlay(overlay1)); overlays.add(new DefaultOverlay(overlay2)); overlays.add(new DefaultOverlay(overlay3)); mojo.setOverlays(overlays); - // current project ignored. Should be on top of the list - assertScenariOne(testId, webAppDirectory); + mojo.execute(); + + File webAppDirectory = (File) getVariableValueFromObject(mojo, "webappDirectory"); + assertScenariOne("scenario-one-full-settings", webAppDirectory); } /** @@ -229,66 +291,71 @@ public void testScenarioOneWithFullSettings() throws Exception { */ private void assertScenariOne(String testId, File webAppDirectory) throws Exception { final List assertedFiles = new ArrayList<>(); - try { - mojo.execute(); - assertedFiles.addAll(assertWebXml(webAppDirectory)); - assertedFiles.addAll(assertCustomContent( - webAppDirectory, - new String[] { - "jsp/a.jsp", - "jsp/b.jsp", - "jsp/c.jsp", - "jsp/d/a.jsp", - "jsp/d/b.jsp", - "jsp/d/c.jsp", - "org/sample/company/test.jsp", - "WEB-INF/classes/a.clazz", - "WEB-INF/classes/b.clazz", - "WEB-INF/classes/c.clazz", - "WEB-INF/lib/a.jar", - "WEB-INF/lib/b.jar", - "WEB-INF/lib/c.jar" - }, - "overlay file not found")); - - // Those files should come from the source webapp without any config - assertDefaultFileContent(testId, webAppDirectory, "jsp/b.jsp"); - assertDefaultFileContent(testId, webAppDirectory, "org/sample/company/test.jsp"); - - // Everything else comes from overlay1 (order of addition in the dependencies) - assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/a.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/c.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/a.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/b.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/c.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/web.xml"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/classes/a.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/classes/b.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/classes/c.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/lib/a.jar"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/lib/b.jar"); - 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}); - assertWebAppContent(webAppDirectory, assertedFiles, filter); - } finally { - cleanDirectory(webAppDirectory); - } + assertedFiles.addAll(assertWebXml(webAppDirectory)); + assertedFiles.addAll(assertCustomContent( + webAppDirectory, + new String[] { + "jsp/a.jsp", + "jsp/b.jsp", + "jsp/c.jsp", + "jsp/d/a.jsp", + "jsp/d/b.jsp", + "jsp/d/c.jsp", + "org/sample/company/test.jsp", + "WEB-INF/classes/a.clazz", + "WEB-INF/classes/b.clazz", + "WEB-INF/classes/c.clazz", + "WEB-INF/lib/a.jar", + "WEB-INF/lib/b.jar", + "WEB-INF/lib/c.jar" + }, + "overlay file not found")); + + // Those files should come from the source webapp without any config + assertDefaultFileContent(testId, webAppDirectory, "jsp/b.jsp"); + assertDefaultFileContent(testId, webAppDirectory, "org/sample/company/test.jsp"); + + // Everything else comes from overlay1 (order of addition in the dependencies) + assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/a.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/c.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/a.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/b.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/c.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/web.xml"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/classes/a.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/classes/b.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/classes/c.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/lib/a.jar"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "WEB-INF/lib/b.jar"); + 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}); + assertWebAppContent(webAppDirectory, assertedFiles, filter); } - public void testOverlaysIncludesExcludesWithMultipleDefinitions() throws Exception { - // setup test data - final String testId = "overlays-includes-excludes-multiple-defs"; - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/waroverlays/default.xml") + @MojoParameter( + name = "workDirectory", + value = "target/test-classes/unit/waroverlays/war/work-overlays-includes-excludes-multiple-defs") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/classes") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/waroverlays/overlays-includes-excludes-multiple-defs") + @Test + public void testOverlaysIncludesExcludesWithMultipleDefinitions(WarExplodedMojo mojo) throws Exception { // Add an overlay final ArtifactStub overlay1 = buildWarOverlayStub("overlay-full-1"); final ArtifactStub overlay2 = buildWarOverlayStub("overlay-full-2"); final ArtifactStub overlay3 = buildWarOverlayStub("overlay-full-3"); - final File webAppDirectory = setUpMojo(testId, new ArtifactStub[] {overlay1, overlay2, overlay3}, new String[] { - "org/sample/company/test.jsp", "jsp/b.jsp" - }); + final MavenProjectArtifactsStub project = createProjectWithOverlays(overlay1, overlay2, overlay3); + mojo.setProject(project); Overlay over1 = new DefaultOverlay(overlay3); over1.setExcludes("**/a.*,**/c.*,**/*.xml"); @@ -309,64 +376,73 @@ public void testOverlaysIncludesExcludesWithMultipleDefinitions() throws Excepti mojo.addOverlay(mojo.getCurrentProjectOverlay()); mojo.addOverlay(over4); + mojo.execute(); + + File webAppDirectory = (File) getVariableValueFromObject(mojo, "webappDirectory"); final List assertedFiles = new ArrayList<>(); - try { - mojo.execute(); - assertedFiles.addAll(assertWebXml(webAppDirectory)); - assertedFiles.addAll(assertCustomContent( - webAppDirectory, - new String[] { - "jsp/a.jsp", - "jsp/b.jsp", - "jsp/c.jsp", - "jsp/d/a.jsp", - "jsp/d/b.jsp", - "jsp/d/c.jsp", - "org/sample/company/test.jsp", - "WEB-INF/classes/a.clazz", - "WEB-INF/classes/b.clazz", - "WEB-INF/classes/c.clazz", - "WEB-INF/lib/a.jar", - "WEB-INF/lib/b.jar", - "WEB-INF/lib/c.jar" - }, - "overlay file not found")); - - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/a.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/b.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/c.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/d/a.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/d/b.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/c.jsp"); - assertDefaultFileContent(testId, webAppDirectory, "org/sample/company/test.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/web.xml"); - assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/classes/a.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "WEB-INF/classes/b.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/classes/c.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/lib/a.jar"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "WEB-INF/lib/b.jar"); - 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}); - assertWebAppContent(webAppDirectory, assertedFiles, filter); - } finally { - cleanDirectory(webAppDirectory); - } + assertedFiles.addAll(assertWebXml(webAppDirectory)); + assertedFiles.addAll(assertCustomContent( + webAppDirectory, + new String[] { + "jsp/a.jsp", + "jsp/b.jsp", + "jsp/c.jsp", + "jsp/d/a.jsp", + "jsp/d/b.jsp", + "jsp/d/c.jsp", + "org/sample/company/test.jsp", + "WEB-INF/classes/a.clazz", + "WEB-INF/classes/b.clazz", + "WEB-INF/classes/c.clazz", + "WEB-INF/lib/a.jar", + "WEB-INF/lib/b.jar", + "WEB-INF/lib/c.jar" + }, + "overlay file not found")); + + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/a.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/b.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/c.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/d/a.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/d/b.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/c.jsp"); + assertDefaultFileContent( + "overlays-includes-excludes-multiple-defs", webAppDirectory, "org/sample/company/test.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/web.xml"); + assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/classes/a.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "WEB-INF/classes/b.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/classes/c.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/lib/a.jar"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "WEB-INF/lib/b.jar"); + 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}); + assertWebAppContent(webAppDirectory, assertedFiles, filter); } - public void testOverlaysIncludesExcludesWithMultipleDefinitions2() throws Exception { - // setup test data - final String testId = "overlays-includes-excludes-multiple-defs2"; - + @InjectMojo(goal = "exploded", pom = "src/test/resources/unit/waroverlays/default.xml") + @MojoParameter( + name = "workDirectory", + value = "target/test-classes/unit/waroverlays/war/work-overlays-includes-excludes-multiple-defs2") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/waroverlays/overlays-includes-excludes-multiple-defs2-test-data/classes") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/waroverlays/overlays-includes-excludes-multiple-defs2-test-data/source/") + @MojoParameter( + name = "webappDirectory", + value = "target/test-classes/unit/waroverlays/overlays-includes-excludes-multiple-defs2") + @Test + public void testOverlaysIncludesExcludesWithMultipleDefinitions2(WarExplodedMojo mojo) throws Exception { // Add an overlay final ArtifactStub overlay1 = buildWarOverlayStub("overlay-full-1"); final ArtifactStub overlay2 = buildWarOverlayStub("overlay-full-2"); final ArtifactStub overlay3 = buildWarOverlayStub("overlay-full-3"); - final File webAppDirectory = setUpMojo(testId, new ArtifactStub[] {overlay1, overlay2, overlay3}, new String[] { - "org/sample/company/test.jsp", "jsp/b.jsp" - }); + final MavenProjectArtifactsStub project = createProjectWithOverlays(overlay1, overlay2, overlay3); + mojo.setProject(project); Overlay over1 = new DefaultOverlay(overlay3); over1.setExcludes("**/a.*,**/c.*,**/*.xml,jsp/b.jsp"); @@ -388,54 +464,61 @@ public void testOverlaysIncludesExcludesWithMultipleDefinitions2() throws Except mojo.addOverlay(mojo.getCurrentProjectOverlay()); mojo.addOverlay(over4); + mojo.execute(); + + File webAppDirectory = (File) getVariableValueFromObject(mojo, "webappDirectory"); final List assertedFiles = new ArrayList<>(); - try { - mojo.execute(); - assertedFiles.addAll(assertWebXml(webAppDirectory)); - assertedFiles.addAll(assertCustomContent( - webAppDirectory, - new String[] { - "jsp/a.jsp", - "jsp/b.jsp", - "jsp/c.jsp", - "jsp/d/a.jsp", - "jsp/d/b.jsp", - "jsp/d/c.jsp", - "org/sample/company/test.jsp", - "WEB-INF/classes/a.clazz", - "WEB-INF/classes/b.clazz", - "WEB-INF/classes/c.clazz", - "WEB-INF/lib/a.jar", - "WEB-INF/lib/b.jar", - "WEB-INF/lib/c.jar" - }, - "overlay file not found")); - - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/a.jsp"); - assertDefaultFileContent(testId, webAppDirectory, "jsp/b.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/c.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/d/a.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/d/b.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/c.jsp"); - assertDefaultFileContent(testId, webAppDirectory, "org/sample/company/test.jsp"); - assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/web.xml"); - assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/classes/a.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "WEB-INF/classes/b.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/classes/c.clazz"); - assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/lib/a.jar"); - assertOverlayedFile(webAppDirectory, "overlay-full-3", "WEB-INF/lib/b.jar"); - 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}); - assertWebAppContent(webAppDirectory, assertedFiles, filter); - } finally { - cleanDirectory(webAppDirectory); - } + assertedFiles.addAll(assertWebXml(webAppDirectory)); + assertedFiles.addAll(assertCustomContent( + webAppDirectory, + new String[] { + "jsp/a.jsp", + "jsp/b.jsp", + "jsp/c.jsp", + "jsp/d/a.jsp", + "jsp/d/b.jsp", + "jsp/d/c.jsp", + "org/sample/company/test.jsp", + "WEB-INF/classes/a.clazz", + "WEB-INF/classes/b.clazz", + "WEB-INF/classes/c.clazz", + "WEB-INF/lib/a.jar", + "WEB-INF/lib/b.jar", + "WEB-INF/lib/c.jar" + }, + "overlay file not found")); + + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/a.jsp"); + assertDefaultFileContent("overlays-includes-excludes-multiple-defs2", webAppDirectory, "jsp/b.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/c.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/d/a.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "jsp/d/b.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-1", "jsp/d/c.jsp"); + assertDefaultFileContent( + "overlays-includes-excludes-multiple-defs2", webAppDirectory, "org/sample/company/test.jsp"); + assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/web.xml"); + assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/classes/a.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "WEB-INF/classes/b.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/classes/c.clazz"); + assertOverlayedFile(webAppDirectory, "overlay-full-2", "WEB-INF/lib/a.jar"); + assertOverlayedFile(webAppDirectory, "overlay-full-3", "WEB-INF/lib/b.jar"); + 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}); + assertWebAppContent(webAppDirectory, assertedFiles, filter); } // Helpers + private MavenProjectArtifactsStub createProjectWithOverlays(ArtifactStub... artifactStubs) throws Exception { + final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); + for (ArtifactStub artifactStub : artifactStubs) { + project.addArtifact(artifactStub); + } + return project; + } + /** * Asserts that the content of an overlayed file is correct. * @@ -447,13 +530,13 @@ public void testOverlaysIncludesExcludesWithMultipleDefinitions2() throws Except * @param filePath the relative path * @throws IOException if an error occurred while reading the files */ - protected void assertOverlayedFile(File webAppDirectory, String overlayId, String filePath) throws IOException { + private void assertOverlayedFile(File webAppDirectory, String overlayId, String filePath) throws IOException { final File webAppFile = new File(webAppDirectory, filePath); final File overlayFile = getOverlayFile(overlayId, filePath); assertEquals( - "Wrong content for overlayed file " + filePath, FileUtils.fileRead(overlayFile), - FileUtils.fileRead(webAppFile)); + FileUtils.fileRead(webAppFile), + "Wrong content for overlayed file " + filePath); } /** @@ -467,10 +550,190 @@ protected void assertOverlayedFile(File webAppDirectory, String overlayId, Strin * @param filePath the relative path * @throws IOException if an error occurred while reading the files */ - protected void assertDefaultFileContent(String testId, File webAppDirectory, String filePath) throws Exception { + private void assertDefaultFileContent(String testId, File webAppDirectory, String filePath) throws Exception { final File webAppFile = new File(webAppDirectory, filePath); - final File sourceFile = new File(getWebAppSource(testId), filePath); - final String expectedContent = sourceFile.toString(); - assertEquals("Wrong content for file " + filePath, expectedContent, FileUtils.fileRead(webAppFile)); + // final File sourceFile = new File(getWebAppSource(testId), filePath); + final String expectedContent = filePath; + assertEquals(expectedContent, FileUtils.fileRead(webAppFile), "Wrong content for file " + filePath); + } + + /** + * Asserts the default content of the war based on the specified webapp directory. + * + * @param webAppDirectory the webapp directory + * @return a list of File objects that have been asserted + */ + private List assertDefaultContent(File webAppDirectory) { + // Validate content of the webapp + File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp"); + File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp"); + + assertTrue(expectedWebSourceFile.exists(), "source file not found: " + expectedWebSourceFile); + assertTrue(expectedWebSource2File.exists(), "source file not found: " + expectedWebSource2File); + + final List content = new ArrayList<>(); + content.add(expectedWebSourceFile); + content.add(expectedWebSource2File); + + return content; + } + + /** + * Asserts the web.xml file of the war based on the specified webapp directory. + * + * @param webAppDirectory the webapp directory + * @return a list with the web.xml File object + */ + private List assertWebXml(File webAppDirectory) { + File expectedWEBXMLFile = new File(webAppDirectory, "WEB-INF/web.xml"); + assertTrue(expectedWEBXMLFile.exists(), "web xml not found: " + expectedWEBXMLFile); + + final List content = new ArrayList<>(); + content.add(expectedWEBXMLFile); + + return content; + } + + /** + * Asserts custom content of the war based on the specified webapp directory. + * + * @param webAppDirectory the webapp directory + * @param filePaths an array of file paths relative to the webapp directory + * @param customMessage a custom message if an assertion fails + * @return a list of File objects that have been inspected + */ + private List assertCustomContent(File webAppDirectory, String[] filePaths, String customMessage) { + final List content = new ArrayList<>(); + for (String filePath : filePaths) { + final File expectedFile = new File(webAppDirectory, filePath); + if (customMessage != null) { + assertTrue(expectedFile.exists(), customMessage + " - " + expectedFile); + } else { + assertTrue(expectedFile.exists(), "source file not found: " + expectedFile); + } + content.add(expectedFile); + } + return content; + } + + /** + * Asserts that the webapp contains only the specified files. + * + * @param webAppDirectory the webapp directory + * @param expectedFiles the expected files + * @param filter an optional filter to ignore some resources + */ + private void assertWebAppContent(File webAppDirectory, List expectedFiles, FileFilter filter) { + final List webAppContent = new ArrayList<>(); + if (filter != null) { + buildFilesList(webAppDirectory, filter, webAppContent); + } else { + buildFilesList(webAppDirectory, new FileFilterImpl(webAppDirectory, null), webAppContent); + } + + // Now we have the files, sort them. + Collections.sort(expectedFiles); + Collections.sort(webAppContent); + assertEquals( + expectedFiles, + webAppContent, + "Invalid webapp content, expected " + expectedFiles.size() + "file(s) " + expectedFiles + " but got " + + webAppContent.size() + " file(s) " + webAppContent); + } + + /** + * Builds the list of files and directories from the specified dir. + * + * Note that the filter is not used the usual way. If the filter does not accept the current file, it's not added + * but yet the subdirectories are added if any. + * + * @param dir the base directory + * @param filter the filter + * @param content the current content, updated recursively + */ + private void buildFilesList(final File dir, FileFilter filter, final List content) { + final File[] files = dir.listFiles(); + + for (File file : files) { + // Add the file if the filter is ok with it + if (filter.accept(file)) { + content.add(file); + } + + // Even if the file is not accepted and is a directory, add it + if (file.isDirectory()) { + buildFilesList(file, filter, content); + } + } + } + + /** + * Builds a test overlay. + * + * @param id the id of the overlay (see test/resources/overlays) + * @return a test war artifact with the content of the given test overlay + */ + private ArtifactStub buildWarOverlayStub(String id) { + // Create war file + final File destFile = new File(OVERLAYS_TEMP_DIR, id + ".war"); + if (!destFile.exists()) { + createArchive(new File(OVERLAYS_ROOT_DIR, id), destFile); + } + + return new WarOverlayStub(getBasedir(), id, destFile); + } + + private File getOverlayFile(String id, String filePath) { + final File overlayDir = new File(OVERLAYS_ROOT_DIR, id); + final File file = new File(overlayDir, filePath); + + // Make sure the file exists + assertTrue( + file.exists(), + "Overlay file " + filePath + " does not exist for overlay " + id + " at " + file.getAbsolutePath()); + return file; + } + + private void createArchive(final File directory, final File destinationFile) { + try { + JarArchiver archiver = new JarArchiver(); + + archiver.setDestFile(destinationFile); + archiver.addDirectory(directory); + + archiver.createArchive(); + + } catch (ArchiverException e) { + e.printStackTrace(); + fail("Failed to create overlay archive " + e.getMessage()); + } catch (IOException e) { + e.printStackTrace(); + fail("Unexpected exception " + e.getMessage()); + } + } + + class FileFilterImpl implements FileFilter { + + private final List rejectedFilePaths; + + private final int webAppDirIndex; + + FileFilterImpl(File webAppDirectory, String[] rejectedFilePaths) { + if (rejectedFilePaths != null) { + this.rejectedFilePaths = Arrays.asList(rejectedFilePaths); + } else { + this.rejectedFilePaths = new ArrayList<>(); + } + this.webAppDirIndex = webAppDirectory.getAbsolutePath().length() + 1; + } + + public boolean accept(File file) { + String effectiveRelativePath = buildRelativePath(file); + return !(rejectedFilePaths.contains(effectiveRelativePath) || file.isDirectory()); + } + + private String buildRelativePath(File f) { + return f.getAbsolutePath().substring(webAppDirIndex); + } } } 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 a68d2784..33da0f3a 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarZipTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarZipTest.java @@ -18,143 +18,196 @@ */ package org.apache.maven.plugins.war; +import javax.inject.Inject; + import java.io.File; +import org.apache.maven.api.plugin.testing.InjectMojo; +import org.apache.maven.api.plugin.testing.MojoExtension; +import org.apache.maven.api.plugin.testing.MojoParameter; +import org.apache.maven.api.plugin.testing.MojoTest; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.plugins.war.overlay.DefaultOverlay; import org.apache.maven.plugins.war.stub.MavenZipProject; import org.apache.maven.plugins.war.stub.WarArtifactStub; import org.apache.maven.plugins.war.stub.ZipArtifactStub; -import org.codehaus.plexus.util.FileUtils; +import org.junit.jupiter.api.Test; + +import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Olivier Lamy * @since 7 Oct 07 */ -public class WarZipTest extends AbstractWarMojoTest { - WarMojo mojo; - - private static File pomFile = new File(getBasedir(), "src/test/resources/unit/warziptest/war-with-zip.xml"); - - protected File getTestDirectory() { - return new File(getBasedir(), "target/test-classes/unit/warziptest"); - } - - public void setUp() throws Exception { - super.setUp(); - mojo = (WarMojo) lookupMojo("war", pomFile); - } - - private Artifact buildZipArtifact() throws Exception { - ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar"); - File zipFile = new File(getTestDirectory(), "foobar.zip"); - return new ZipArtifactStub("src/test/resources/unit/warziptest", artifactHandler, zipFile); - } +@MojoTest +public class WarZipTest { + @Inject + private ArtifactHandler artifactHandler; + + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warziptest/war-with-zip.xml") + @MojoParameter(name = "classesDirectory", value = "target/test-classes/unit/warziptest/one-zip-test-data/classes/") + @MojoParameter(name = "warSourceDirectory", value = "target/test-classes/unit/warziptest/one-zip-test-data/source/") + @MojoParameter(name = "webXml", value = "target/test-classes/unit/warziptest/one-zip-test-data/xml-config/web.xml") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warziptest/one-zip") + @MojoParameter(name = "outputDirectory", value = "target/test-classes/unit/warziptest/one-zip-output") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "workDirectory", value = "target/test-classes/unit/warziptest/work") + @Test + public void testOneZipWithNoSkip(WarMojo mojo) throws Exception { + Overlay overlay = new DefaultOverlay(buildZipArtifact()); + overlay.setType("zip"); + mojo.addOverlay(overlay); - private File configureMojo(String testId) throws Exception { - MavenZipProject project = new MavenZipProject(); - String outputDir = getTestDirectory().getAbsolutePath() + File.separatorChar + testId + "-output"; - // clean up - File outputDirFile = new File(outputDir); - if (outputDirFile.exists()) { - FileUtils.deleteDirectory(outputDirFile); - } - File webAppDirectory = new File(getTestDirectory(), testId); WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); - String warName = "simple"; - File webAppSource = createWebAppSource(testId); - File classesDir = createClassesDir(testId, true); - File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); + MavenZipProject project = new MavenZipProject(); project.setArtifact(warArtifact); - - this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); - setVariableValueToObject(mojo, "outputDirectory", outputDir); - setVariableValueToObject(mojo, "warName", warName); - setVariableValueToObject(mojo, "workDirectory", new File(getTestDirectory(), "work")); - mojo.setWebXml(new File(xmlSource, "web.xml")); - project.getArtifacts().add(buildZipArtifact()); + mojo.setProject(project); - return webAppDirectory; - } - - public void testOneZipWithNoSkip() throws Exception { - File webAppDirectory = configureMojo("one-zip"); - - Overlay overlay = new DefaultOverlay(buildZipArtifact()); - // overlay.setSkip( false ); - overlay.setType("zip"); - mojo.addOverlay(overlay); mojo.execute(); + File webAppDirectory = mojo.getWebappDirectory(); File foo = new File(webAppDirectory, "foo.txt"); - assertTrue("foo.txt not exists", foo.exists()); - assertTrue("foo.txt not a file", foo.isFile()); + assertTrue(foo.exists(), "foo.txt not exists"); + assertTrue(foo.isFile(), "foo.txt not a file"); File barDirectory = new File(webAppDirectory, "bar"); - assertTrue("bar directory not exists", barDirectory.exists()); - assertTrue("bar not a directory", barDirectory.isDirectory()); + assertTrue(barDirectory.exists(), "bar directory not exists"); + assertTrue(barDirectory.isDirectory(), "bar not a directory"); File bar = new File(barDirectory, "bar.txt"); - assertTrue("bar/bar.txt not exists", bar.exists()); - assertTrue("bar/bar.txt not a file", bar.isFile()); + assertTrue(bar.exists(), "bar/bar.txt not exists"); + assertTrue(bar.isFile(), "bar/bar.txt not a file"); } - public void testOneZipWithTargetPathOverlay() throws Exception { - File webAppDirectory = configureMojo("one-zip-overlay-targetPath"); - + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warziptest/war-with-zip.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warziptest/one-zip-overlay-targetPath-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warziptest/one-zip-overlay-targetPath-test-data/source/") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warziptest/one-zip-overlay-targetPath-test-data/xml-config/web.xml") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warziptest/one-zip-overlay-targetPath") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warziptest/one-zip-overlay-targetPath-output") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "workDirectory", value = "target/test-classes/unit/warziptest/work") + @Test + public void testOneZipWithTargetPathOverlay(WarMojo mojo) throws Exception { Overlay overlay = new DefaultOverlay(buildZipArtifact()); overlay.setSkip(false); overlay.setType("zip"); overlay.setTargetPath("overridePath"); mojo.addOverlay(overlay); + WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); + MavenZipProject project = new MavenZipProject(); + project.setArtifact(warArtifact); + project.getArtifacts().add(buildZipArtifact()); + mojo.setProject(project); + mojo.execute(); + File webAppDirectory = mojo.getWebappDirectory(); File foo = new File(webAppDirectory.getPath() + File.separatorChar + "overridePath", "foo.txt"); - assertTrue("foo.txt not exists", foo.exists()); - assertTrue("foo.txt not a file", foo.isFile()); + assertTrue(foo.exists(), "foo.txt not exists"); + assertTrue(foo.isFile(), "foo.txt not a file"); File barDirectory = new File(webAppDirectory.getPath() + File.separatorChar + "overridePath", "bar"); - assertTrue("bar directory not exists", barDirectory.exists()); - assertTrue("bar not a directory", barDirectory.isDirectory()); + assertTrue(barDirectory.exists(), "bar directory not exists"); + assertTrue(barDirectory.isDirectory(), "bar not a directory"); File bar = new File(barDirectory, "bar.txt"); - assertTrue("bar/bar.txt not exists", bar.exists()); - assertTrue("bar/bar.txt not a file", bar.isFile()); + assertTrue(bar.exists(), "bar/bar.txt not exists"); + assertTrue(bar.isFile(), "bar/bar.txt not a file"); } - public void testOneZipDefaultSkip() throws Exception { - File webAppDirectory = configureMojo("one-zip-overlay-skip"); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warziptest/war-with-zip.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warziptest/one-zip-overlay-skip-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warziptest/one-zip-overlay-skip-test-data/source/") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warziptest/one-zip-overlay-skip-test-data/xml-config/web.xml") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warziptest/one-zip-overlay-skip") + @MojoParameter(name = "outputDirectory", value = "target/test-classes/unit/warziptest/one-zip-overlay-skip-output") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "workDirectory", value = "target/test-classes/unit/warziptest/work") + @Test + public void testOneZipDefaultSkip(WarMojo mojo) throws Exception { + WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); + MavenZipProject project = new MavenZipProject(); + project.setArtifact(warArtifact); + project.getArtifacts().add(buildZipArtifact()); + mojo.setProject(project); mojo.execute(); - assertZipContentNotHere(webAppDirectory); + assertZipContentNotHere(mojo.getWebappDirectory()); } - public void testOneZipWithForceSkip() throws Exception { - File webAppDirectory = configureMojo("one-zip-overlay-skip"); + @InjectMojo(goal = "war", pom = "src/test/resources/unit/warziptest/war-with-zip.xml") + @MojoParameter( + name = "classesDirectory", + value = "target/test-classes/unit/warziptest/one-zip-overlay-skip-test-data/classes/") + @MojoParameter( + name = "warSourceDirectory", + value = "target/test-classes/unit/warziptest/one-zip-overlay-skip-test-data/source/") + @MojoParameter( + name = "webXml", + value = "target/test-classes/unit/warziptest/one-zip-overlay-skip-test-data/xml-config/web.xml") + @MojoParameter(name = "webappDirectory", value = "target/test-classes/unit/warziptest/one-zip-overlay-skip") + @MojoParameter( + name = "outputDirectory", + value = "target/test-classes/unit/warziptest/one-zip-overlay-force-skip-output") + @MojoParameter(name = "warName", value = "simple") + @MojoParameter(name = "workDirectory", value = "target/test-classes/unit/warziptest/work") + @Test + public void testOneZipWithForceSkip(WarMojo mojo) throws Exception { + + WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); + MavenZipProject project = new MavenZipProject(); + project.setArtifact(warArtifact); + project.getArtifacts().add(buildZipArtifact()); + mojo.setProject(project); + Overlay overlay = new DefaultOverlay(buildZipArtifact()); overlay.setSkip(true); overlay.setType("zip"); mojo.addOverlay(overlay); mojo.execute(); - assertZipContentNotHere(webAppDirectory); + + assertZipContentNotHere(mojo.getWebappDirectory()); + } + + private Artifact buildZipArtifact() throws Exception { + File zipFile = + new File(new File(MojoExtension.getBasedir(), "target/test-classes/unit/warziptest"), "foobar.zip"); + return new ZipArtifactStub("src/test/resources/unit/warziptest", artifactHandler, zipFile); } - protected void assertZipContentNotHere(File webAppDirectory) { + private void assertZipContentNotHere(File webAppDirectory) { File foo = new File(webAppDirectory.getPath() + File.separatorChar + "overridePath", "foo.txt"); - assertFalse("foo.txt exists", foo.exists()); - assertFalse("foo.txt a file", foo.isFile()); + assertFalse(foo.exists(), "foo.txt exists"); + assertFalse(foo.isFile(), "foo.txt a file"); File barDirectory = new File(webAppDirectory.getPath() + File.separatorChar + "overridePath", "bar"); - assertFalse("bar directory exists", barDirectory.exists()); - assertFalse("bar is a directory", barDirectory.isDirectory()); + assertFalse(barDirectory.exists(), "bar directory exists"); + assertFalse(barDirectory.isDirectory(), "bar is a directory"); File bar = new File(barDirectory, "bar.txt"); - assertFalse("bar/bar.txt exists", bar.exists()); - assertFalse("bar/bar.txt is a file", bar.isFile()); + assertFalse(bar.exists(), "bar/bar.txt exists"); + assertFalse(bar.isFile(), "bar/bar.txt is a file"); } } diff --git a/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/a.clazz b/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/a.clazz new file mode 100644 index 00000000..833a1f77 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/a.clazz @@ -0,0 +1 @@ +overlay-full-1-WEB-INF/classes/a.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/b.clazz b/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/b.clazz new file mode 100644 index 00000000..8abf8486 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/b.clazz @@ -0,0 +1 @@ +overlay-full-1-WEB-INF/classes/b.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/c.clazz b/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/c.clazz new file mode 100644 index 00000000..72edfee9 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/WEB-INF/classes/c.clazz @@ -0,0 +1 @@ +overlay-full-1-WEB-INF/classes/c.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/a.jar b/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/a.jar new file mode 100644 index 00000000..6c817050 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/a.jar @@ -0,0 +1 @@ +overlay-full-1-WEB-INF/lib/a.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/b.jar b/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/b.jar new file mode 100644 index 00000000..ab750a03 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/b.jar @@ -0,0 +1 @@ +overlay-full-1-WEB-INF/lib/b.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/c.jar b/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/c.jar new file mode 100644 index 00000000..84171a8c --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/WEB-INF/lib/c.jar @@ -0,0 +1 @@ +overlay-full-1-WEB-INF/lib/c.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/WEB-INF/web.xml b/src/test/resources/overlays/overlay-full-1/WEB-INF/web.xml new file mode 100644 index 00000000..4ad46bcc --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/WEB-INF/web.xml @@ -0,0 +1 @@ +overlay-full-1-WEB-INF/web.xml \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/jsp/a.jsp b/src/test/resources/overlays/overlay-full-1/jsp/a.jsp new file mode 100644 index 00000000..ef0c4af6 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/jsp/a.jsp @@ -0,0 +1 @@ +overlay-full-1-jsp/a.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/jsp/b.jsp b/src/test/resources/overlays/overlay-full-1/jsp/b.jsp new file mode 100644 index 00000000..f0a05c5c --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/jsp/b.jsp @@ -0,0 +1 @@ +overlay-full-1-jsp/b.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/jsp/c.jsp b/src/test/resources/overlays/overlay-full-1/jsp/c.jsp new file mode 100644 index 00000000..1347a94c --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/jsp/c.jsp @@ -0,0 +1 @@ +overlay-full-1-jsp/c.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/jsp/d/a.jsp b/src/test/resources/overlays/overlay-full-1/jsp/d/a.jsp new file mode 100644 index 00000000..da976ba4 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/jsp/d/a.jsp @@ -0,0 +1 @@ +overlay-full-1-jsp/d/a.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/jsp/d/b.jsp b/src/test/resources/overlays/overlay-full-1/jsp/d/b.jsp new file mode 100644 index 00000000..7609ccaa --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/jsp/d/b.jsp @@ -0,0 +1 @@ +overlay-full-1-jsp/d/b.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-1/jsp/d/c.jsp b/src/test/resources/overlays/overlay-full-1/jsp/d/c.jsp new file mode 100644 index 00000000..49fa1a22 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-1/jsp/d/c.jsp @@ -0,0 +1 @@ +overlay-full-1-jsp/d/c.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/a.clazz b/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/a.clazz new file mode 100644 index 00000000..77320848 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/a.clazz @@ -0,0 +1 @@ +overlay-full-2-WEB-INF/classes/a.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/b.clazz b/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/b.clazz new file mode 100644 index 00000000..f2012525 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/b.clazz @@ -0,0 +1 @@ +overlay-full-2-WEB-INF/classes/b.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/c.clazz b/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/c.clazz new file mode 100644 index 00000000..9d4a0724 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/WEB-INF/classes/c.clazz @@ -0,0 +1 @@ +overlay-full-2-WEB-INF/classes/c.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/a.jar b/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/a.jar new file mode 100644 index 00000000..0778aee3 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/a.jar @@ -0,0 +1 @@ +overlay-full-2-WEB-INF/lib/a.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/b.jar b/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/b.jar new file mode 100644 index 00000000..29721d4a --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/b.jar @@ -0,0 +1 @@ +overlay-full-2-WEB-INF/lib/b.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/c.jar b/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/c.jar new file mode 100644 index 00000000..31b8bb4f --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/WEB-INF/lib/c.jar @@ -0,0 +1 @@ +overlay-full-2-WEB-INF/lib/c.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/WEB-INF/web.xml b/src/test/resources/overlays/overlay-full-2/WEB-INF/web.xml new file mode 100644 index 00000000..56b5cf2b --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/WEB-INF/web.xml @@ -0,0 +1 @@ +overlay-full-2-WEB-INF/web.xml \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/jsp/a.jsp b/src/test/resources/overlays/overlay-full-2/jsp/a.jsp new file mode 100644 index 00000000..c6c7fe8e --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/jsp/a.jsp @@ -0,0 +1 @@ +overlay-full-2-jsp/a.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/jsp/b.jsp b/src/test/resources/overlays/overlay-full-2/jsp/b.jsp new file mode 100644 index 00000000..b2122c75 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/jsp/b.jsp @@ -0,0 +1 @@ +overlay-full-2-jsp/b.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/jsp/c.jsp b/src/test/resources/overlays/overlay-full-2/jsp/c.jsp new file mode 100644 index 00000000..bb474c11 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/jsp/c.jsp @@ -0,0 +1 @@ +overlay-full-2-jsp/c.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/jsp/d/a.jsp b/src/test/resources/overlays/overlay-full-2/jsp/d/a.jsp new file mode 100644 index 00000000..ace22e52 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/jsp/d/a.jsp @@ -0,0 +1 @@ +overlay-full-2-jsp/d/a.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/jsp/d/b.jsp b/src/test/resources/overlays/overlay-full-2/jsp/d/b.jsp new file mode 100644 index 00000000..a52148b8 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/jsp/d/b.jsp @@ -0,0 +1 @@ +overlay-full-2-jsp/d/b.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-2/jsp/d/c.jsp b/src/test/resources/overlays/overlay-full-2/jsp/d/c.jsp new file mode 100644 index 00000000..71fcda2a --- /dev/null +++ b/src/test/resources/overlays/overlay-full-2/jsp/d/c.jsp @@ -0,0 +1 @@ +overlay-full-2-jsp/d/c.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/a.clazz b/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/a.clazz new file mode 100644 index 00000000..420cc767 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/a.clazz @@ -0,0 +1 @@ +overlay-full-3-WEB-INF/classes/a.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/b.clazz b/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/b.clazz new file mode 100644 index 00000000..9b99907f --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/b.clazz @@ -0,0 +1 @@ +overlay-full-3-WEB-INF/classes/b.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/c.clazz b/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/c.clazz new file mode 100644 index 00000000..375bb5cb --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/WEB-INF/classes/c.clazz @@ -0,0 +1 @@ +overlay-full-3-WEB-INF/classes/c.clazz \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/a.jar b/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/a.jar new file mode 100644 index 00000000..58d33d62 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/a.jar @@ -0,0 +1 @@ +overlay-full-3-WEB-INF/lib/a.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/b.jar b/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/b.jar new file mode 100644 index 00000000..06c4ef1f --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/b.jar @@ -0,0 +1 @@ +overlay-full-3-WEB-INF/lib/b.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/c.jar b/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/c.jar new file mode 100644 index 00000000..f7f92e69 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/WEB-INF/lib/c.jar @@ -0,0 +1 @@ +overlay-full-3-WEB-INF/lib/c.jar \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/WEB-INF/web.xml b/src/test/resources/overlays/overlay-full-3/WEB-INF/web.xml new file mode 100644 index 00000000..214df434 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/WEB-INF/web.xml @@ -0,0 +1 @@ +overlay-full-3-WEB-INF/web.xml \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/jsp/a.jsp b/src/test/resources/overlays/overlay-full-3/jsp/a.jsp new file mode 100644 index 00000000..e6e59e7c --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/jsp/a.jsp @@ -0,0 +1 @@ +overlay-full-3-jsp/a.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/jsp/b.jsp b/src/test/resources/overlays/overlay-full-3/jsp/b.jsp new file mode 100644 index 00000000..3911b1c7 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/jsp/b.jsp @@ -0,0 +1 @@ +overlay-full-3-jsp/b.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/jsp/c.jsp b/src/test/resources/overlays/overlay-full-3/jsp/c.jsp new file mode 100644 index 00000000..473a3fd1 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/jsp/c.jsp @@ -0,0 +1 @@ +overlay-full-3-jsp/c.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/jsp/d/a.jsp b/src/test/resources/overlays/overlay-full-3/jsp/d/a.jsp new file mode 100644 index 00000000..1b7236d0 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/jsp/d/a.jsp @@ -0,0 +1 @@ +overlay-full-3-jsp/d/a.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/jsp/d/b.jsp b/src/test/resources/overlays/overlay-full-3/jsp/d/b.jsp new file mode 100644 index 00000000..e5aea58b --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/jsp/d/b.jsp @@ -0,0 +1 @@ +overlay-full-3-jsp/d/b.jsp \ No newline at end of file diff --git a/src/test/resources/overlays/overlay-full-3/jsp/d/c.jsp b/src/test/resources/overlays/overlay-full-3/jsp/d/c.jsp new file mode 100644 index 00000000..8d451808 --- /dev/null +++ b/src/test/resources/overlays/overlay-full-3/jsp/d/c.jsp @@ -0,0 +1 @@ +overlay-full-3-jsp/d/c.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/resources/pix/panis_na.jpg b/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/resources/pix/panis_na.jpg new file mode 100644 index 00000000..6d8d698d --- /dev/null +++ b/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/resources/pix/panis_na.jpg @@ -0,0 +1 @@ +/home/sparsick/dev/workspace/m-war-plugin-master/target/test-classes/unit/warexplodedinplacemojo/test-dir/resources/pix/panis_na.jpg \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/pix/panis_na.jpg b/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/pix/panis_na.jpg new file mode 100644 index 00000000..6d8d698d --- /dev/null +++ b/src/test/resources/unit/warexplodedinplacemojo/SimpleExplodedInplaceWar-test-data/source/pix/panis_na.jpg @@ -0,0 +1 @@ +/home/sparsick/dev/workspace/m-war-plugin-master/target/test-classes/unit/warexplodedinplacemojo/test-dir/resources/pix/panis_na.jpg \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarDuplicateWithClassifier-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarMergeWarLocalFileOverride-test-data/source/org/sample/company/test.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarMergeWarLocalFileOverride-test-data/source/org/sample/company/test.jsp new file mode 100644 index 00000000..48214ce0 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarMergeWarLocalFileOverride-test-data/source/org/sample/company/test.jsp @@ -0,0 +1 @@ +org/sample/company/test.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithAar-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithAar-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithAar-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithAar-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithAar-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithAar-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/classes/sample-servlet.clazz b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/classes/sample-servlet.clazz new file mode 100644 index 00000000..6840e3fd --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/classes/sample-servlet.clazz @@ -0,0 +1 @@ +sample-servlet.clazz \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithClasses-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..3f13f97f --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithContainerConfigXML-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/source/pansit.jsp new file mode 100644 index 00000000..23d675d6 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithContainerConfigXML-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/xml-config/config.xml b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/xml-config/config.xml new file mode 100644 index 00000000..22885586 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithContainerConfigXML-test-data/xml-config/config.xml @@ -0,0 +1 @@ +config.xml \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..4cbadb6e --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithCustomWebXML-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/source/pansit.jsp new file mode 100644 index 00000000..f9d4cd96 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithCustomWebXML-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/xml-config/web.xml b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithCustomWebXML-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithDuplicateDependencies-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithEJB-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMapping-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMapping-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..80d44d3a --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMapping-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithFileNameMapping-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMapping-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMapping-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMapping-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithFileNameMappingAndDuplicateDependencies-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithJar-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithJar-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithJar-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithJar-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithJar-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithJar-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithMar-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithMar-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithMar-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithMar-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithMar-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithMar-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithPAR-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithPAR-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithPAR-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithPAR-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithPAR-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithPAR-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/classes/sample-servlet.clazz b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/classes/sample-servlet.clazz new file mode 100644 index 00000000..10a158f7 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/classes/sample-servlet.clazz @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithResourceFiltering-test-data/classes/sample-servlet.clazz \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/filters/filter.properties b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/filters/filter.properties new file mode 100644 index 00000000..98329225 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/filters/filter.properties @@ -0,0 +1,2 @@ +resource_value_1=this_is_filtered +resource_value_2=this_is_filtered \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/resources/custom-config/custom-setting.cfg b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/resources/custom-config/custom-setting.cfg new file mode 100644 index 00000000..032d0e8d --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/resources/custom-config/custom-setting.cfg @@ -0,0 +1,11 @@ +# this is comment created by author@somewhere@ +system_key_1=${user.dir} +system_key_2=@user.dir@ +project_key_1=${is_this_simple} +project_key_2=@is_this_simple@ +project_name_1=${project.name} +project_name_2=@project.name@ +system_property_1=${system.property} +system_property_2=@system.property@ +resource_key_1=${resource_value_1} +resource_key_2=@resource_value_2@ diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/resources/custom-setting.cfg b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/resources/custom-setting.cfg new file mode 100644 index 00000000..2dff87b3 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/resources/custom-setting.cfg @@ -0,0 +1,11 @@ +# this is comment created by author@somewhere@ +system_key_1=${user.dir} +system_key_2=@user.dir@ +project_key_1=${is_this_simple} +project_key_2=@is_this_simple@ +project_name_1=${project.name} +project_name_2=@project.name@ +system_property_1=${system.property} +system_property_2=@system.property@ +resource_key_1=${resource_value_1} +resource_key_2=@resource_value_2@ \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..7ad2efbb --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithResourceFiltering-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/source/pansit.jsp new file mode 100644 index 00000000..2ad87bd4 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFileFiltering-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithResourceFiltering-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/classes/sample-servlet.clazz b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/classes/sample-servlet.clazz new file mode 100644 index 00000000..10a158f7 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/classes/sample-servlet.clazz @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithResourceFiltering-test-data/classes/sample-servlet.clazz \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/resources/custom-config/custom-setting.cfg b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/resources/custom-config/custom-setting.cfg new file mode 100644 index 00000000..df8f4150 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/resources/custom-config/custom-setting.cfg @@ -0,0 +1,9 @@ +# this is comment created by author@somewhere@ +system_key_1=${user.dir} +system_key_2=@user.dir@ +project_key_1=${is_this_simple} +project_key_2=@is_this_simple@ +project_name_1=${project.name} +project_name_2=@project.name@ +system_property_1=${system.property} +system_property_2=@system.property@ diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/resources/custom-setting.cfg b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/resources/custom-setting.cfg new file mode 100644 index 00000000..df8f4150 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/resources/custom-setting.cfg @@ -0,0 +1,9 @@ +# this is comment created by author@somewhere@ +system_key_1=${user.dir} +system_key_2=@user.dir@ +project_key_1=${is_this_simple} +project_key_2=@is_this_simple@ +project_name_1=${project.name} +project_name_2=@project.name@ +system_property_1=${system.property} +system_property_2=@system.property@ diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..7ad2efbb --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithResourceFiltering-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/source/pansit.jsp new file mode 100644 index 00000000..2ad87bd4 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithResourceFiltering-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/ExplodedWarWithResourceFiltering-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSimpleExternalWARFile-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceIncludeExclude-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/classes/sample-servlet.clazz b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/classes/sample-servlet.clazz new file mode 100644 index 00000000..6840e3fd --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/classes/sample-servlet.clazz @@ -0,0 +1 @@ +sample-servlet.clazz \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithSourceModificationCheck-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithTLD-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithTLD-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithTLD-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithTLD-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithTLD-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithTLD-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithWarDependencyIncludeExclude-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithXar-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithXar-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..dabd1956 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithXar-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/ExplodedWarWithXar-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithXar-test-data/source/pansit.jsp new file mode 100644 index 00000000..27b3fb80 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/ExplodedWarWithXar-test-data/source/pansit.jsp @@ -0,0 +1 @@ +pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/classes/sample-servlet.clazz b/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/classes/sample-servlet.clazz new file mode 100644 index 00000000..3e3777cb --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/classes/sample-servlet.clazz @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/SimpleExplodedWar-test-data/classes/sample-servlet.clazz \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/resources/pix/panis_na.jpg b/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/resources/pix/panis_na.jpg new file mode 100644 index 00000000..d4ccd920 --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/resources/pix/panis_na.jpg @@ -0,0 +1 @@ +/home/sparsick/dev/workspace/m-war-plugin-master/target/test-classes/unit/warexplodedmojo/test-dir/SimpleExplodedWar-resources/pix/panis_na.jpg \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..e74b72fb --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/SimpleExplodedWar-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/source/pansit.jsp b/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/source/pansit.jsp new file mode 100644 index 00000000..76bf48ce --- /dev/null +++ b/src/test/resources/unit/warexplodedmojo/SimpleExplodedWar-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warexplodedmojo/test-dir/SimpleExplodedWar-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/AttachClasses-test-data/classes/sample-servlet.clazz b/src/test/resources/unit/warmojotest/AttachClasses-test-data/classes/sample-servlet.clazz new file mode 100644 index 00000000..536dc9f6 --- /dev/null +++ b/src/test/resources/unit/warmojotest/AttachClasses-test-data/classes/sample-servlet.clazz @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/AttachClasses-test-data/classes/sample-servlet.clazz \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/AttachClasses-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/AttachClasses-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..cd9000ee --- /dev/null +++ b/src/test/resources/unit/warmojotest/AttachClasses-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/AttachClasses-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/AttachClasses-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/AttachClasses-test-data/source/pansit.jsp new file mode 100644 index 00000000..eecac692 --- /dev/null +++ b/src/test/resources/unit/warmojotest/AttachClasses-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/AttachClasses-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/AttachClasses-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/AttachClasses-test-data/xml-config/web.xml new file mode 100644 index 00000000..b56e8b50 --- /dev/null +++ b/src/test/resources/unit/warmojotest/AttachClasses-test-data/xml-config/web.xml @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/AttachClasses-test-data/xml-config/web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/classes/sample-servlet.clazz b/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/classes/sample-servlet.clazz new file mode 100644 index 00000000..63cf1e02 --- /dev/null +++ b/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/classes/sample-servlet.clazz @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/AttachClassesCustomClassifier-test-data/classes/sample-servlet.clazz \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..cce64211 --- /dev/null +++ b/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/pansit.jsp new file mode 100644 index 00000000..decfdc12 --- /dev/null +++ b/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/AttachClassesCustomClassifier-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/xml-config/web.xml new file mode 100644 index 00000000..667973a8 --- /dev/null +++ b/src/test/resources/unit/warmojotest/AttachClassesCustomClassifier-test-data/xml-config/web.xml @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/AttachClassesCustomClassifier-test-data/xml-config/web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/Classifier-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/Classifier-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..a3762798 --- /dev/null +++ b/src/test/resources/unit/warmojotest/Classifier-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/Classifier-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/Classifier-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/Classifier-test-data/source/pansit.jsp new file mode 100644 index 00000000..93a2fa92 --- /dev/null +++ b/src/test/resources/unit/warmojotest/Classifier-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/Classifier-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/Classifier-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/Classifier-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warmojotest/Classifier-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..7a64fcf1 --- /dev/null +++ b/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/NotPrimaryArtifact-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/source/pansit.jsp new file mode 100644 index 00000000..8646727c --- /dev/null +++ b/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/NotPrimaryArtifact-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warmojotest/NotPrimaryArtifact-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..5c665dd8 --- /dev/null +++ b/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/PrimaryArtifact-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/source/pansit.jsp new file mode 100644 index 00000000..89806759 --- /dev/null +++ b/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/PrimaryArtifact-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warmojotest/PrimaryArtifact-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWar-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWar-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..12c099d4 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWar-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWar-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWar-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWar-test-data/source/pansit.jsp new file mode 100644 index 00000000..bf51217d --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWar-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWar-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWar-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/SimpleWar-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWar-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..c36f8207 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/pansit.jsp new file mode 100644 index 00000000..9c314580 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlFalse-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..cf9cdf30 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/pansit.jsp new file mode 100644 index 00000000..5b8df294 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarMissingWebXmlTrue-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..3612a543 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/pansit.jsp new file mode 100644 index 00000000..adedc9a4 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarNotUnderServlet30-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..5e582fe7 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/pansit.jsp new file mode 100644 index 00000000..13f36f85 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludeWithIncludesRegEx-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..91e5d05d --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/pansit.jsp new file mode 100644 index 00000000..03820336 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarPackagingExcludesWithRegEx-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..4abef2bd --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/pansit.jsp new file mode 100644 index 00000000..4854fd6d --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarUnderServlet30-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/META-INF/config.xml b/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/META-INF/config.xml new file mode 100644 index 00000000..bf3a57c3 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/META-INF/config.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..c1b9eea9 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/pansit.jsp new file mode 100644 index 00000000..3477e685 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarWithContainerConfig-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarWithContainerConfig-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/META-INF/config.xml b/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/META-INF/config.xml new file mode 100644 index 00000000..bf3a57c3 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/META-INF/config.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..337be7a2 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/pansit.jsp b/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/pansit.jsp new file mode 100644 index 00000000..cf418910 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/xml-config/web.xml b/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/xml-config/web.xml new file mode 100644 index 00000000..d188dff5 --- /dev/null +++ b/src/test/resources/unit/warmojotest/SimpleWarWithMetaInfContent-test-data/xml-config/web.xml @@ -0,0 +1 @@ +web.xml \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/default-overlay-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/waroverlays/default-overlay-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..c9fcb4f7 --- /dev/null +++ b/src/test/resources/unit/waroverlays/default-overlay-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/waroverlays/default-overlay-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/default-overlay-test-data/source/pansit.jsp b/src/test/resources/unit/waroverlays/default-overlay-test-data/source/pansit.jsp new file mode 100644 index 00000000..fb28db4f --- /dev/null +++ b/src/test/resources/unit/waroverlays/default-overlay-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/waroverlays/default-overlay-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/default-overlays-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/waroverlays/default-overlays-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..93eef701 --- /dev/null +++ b/src/test/resources/unit/waroverlays/default-overlays-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/waroverlays/default-overlays-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/default-overlays-test-data/source/pansit.jsp b/src/test/resources/unit/waroverlays/default-overlays-test-data/source/pansit.jsp new file mode 100644 index 00000000..bce1d623 --- /dev/null +++ b/src/test/resources/unit/waroverlays/default-overlays-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/waroverlays/default-overlays-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/no-overlay-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/waroverlays/no-overlay-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..a8781fd1 --- /dev/null +++ b/src/test/resources/unit/waroverlays/no-overlay-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +target/test-classes/unit/waroverlays/no-overlay-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/no-overlay-test-data/source/pansit.jsp b/src/test/resources/unit/waroverlays/no-overlay-test-data/source/pansit.jsp new file mode 100644 index 00000000..32708211 --- /dev/null +++ b/src/test/resources/unit/waroverlays/no-overlay-test-data/source/pansit.jsp @@ -0,0 +1 @@ +target/test-classes/unit/waroverlays/no-overlay-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/no-overlay-test-data/xml-config/web.xml b/src/test/resources/unit/waroverlays/no-overlay-test-data/xml-config/web.xml new file mode 100644 index 00000000..fc10e9de --- /dev/null +++ b/src/test/resources/unit/waroverlays/no-overlay-test-data/xml-config/web.xml @@ -0,0 +1 @@ +target/test-classes/unit/waroverlays/no-overlay-test-data/xml-config/web.xml \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/source/jsp/b.jsp b/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/source/jsp/b.jsp new file mode 100644 index 00000000..0f7cc91d --- /dev/null +++ b/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/source/jsp/b.jsp @@ -0,0 +1 @@ +target/test-classes/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/source/jsp/b.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/source/org/sample/company/test.jsp b/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/source/org/sample/company/test.jsp new file mode 100644 index 00000000..48214ce0 --- /dev/null +++ b/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs-test-data/source/org/sample/company/test.jsp @@ -0,0 +1 @@ +org/sample/company/test.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs2-test-data/source/jsp/b.jsp b/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs2-test-data/source/jsp/b.jsp new file mode 100644 index 00000000..43edc7e6 --- /dev/null +++ b/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs2-test-data/source/jsp/b.jsp @@ -0,0 +1 @@ +jsp/b.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs2-test-data/source/org/sample/company/test.jsp b/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs2-test-data/source/org/sample/company/test.jsp new file mode 100644 index 00000000..48214ce0 --- /dev/null +++ b/src/test/resources/unit/waroverlays/overlays-includes-excludes-multiple-defs2-test-data/source/org/sample/company/test.jsp @@ -0,0 +1 @@ +org/sample/company/test.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/scenario-one-default-settings-test-data/source/jsp/b.jsp b/src/test/resources/unit/waroverlays/scenario-one-default-settings-test-data/source/jsp/b.jsp new file mode 100644 index 00000000..43edc7e6 --- /dev/null +++ b/src/test/resources/unit/waroverlays/scenario-one-default-settings-test-data/source/jsp/b.jsp @@ -0,0 +1 @@ +jsp/b.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/scenario-one-default-settings-test-data/source/org/sample/company/test.jsp b/src/test/resources/unit/waroverlays/scenario-one-default-settings-test-data/source/org/sample/company/test.jsp new file mode 100644 index 00000000..48214ce0 --- /dev/null +++ b/src/test/resources/unit/waroverlays/scenario-one-default-settings-test-data/source/org/sample/company/test.jsp @@ -0,0 +1 @@ +org/sample/company/test.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/scenario-one-full-settings-test-data/source/jsp/b.jsp b/src/test/resources/unit/waroverlays/scenario-one-full-settings-test-data/source/jsp/b.jsp new file mode 100644 index 00000000..43edc7e6 --- /dev/null +++ b/src/test/resources/unit/waroverlays/scenario-one-full-settings-test-data/source/jsp/b.jsp @@ -0,0 +1 @@ +jsp/b.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/scenario-one-full-settings-test-data/source/org/sample/company/test.jsp b/src/test/resources/unit/waroverlays/scenario-one-full-settings-test-data/source/org/sample/company/test.jsp new file mode 100644 index 00000000..48214ce0 --- /dev/null +++ b/src/test/resources/unit/waroverlays/scenario-one-full-settings-test-data/source/org/sample/company/test.jsp @@ -0,0 +1 @@ +org/sample/company/test.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/scenario-one-overlay-settings-test-data/source/jsp/b.jsp b/src/test/resources/unit/waroverlays/scenario-one-overlay-settings-test-data/source/jsp/b.jsp new file mode 100644 index 00000000..43edc7e6 --- /dev/null +++ b/src/test/resources/unit/waroverlays/scenario-one-overlay-settings-test-data/source/jsp/b.jsp @@ -0,0 +1 @@ +jsp/b.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/scenario-one-overlay-settings-test-data/source/org/sample/company/test.jsp b/src/test/resources/unit/waroverlays/scenario-one-overlay-settings-test-data/source/org/sample/company/test.jsp new file mode 100644 index 00000000..48214ce0 --- /dev/null +++ b/src/test/resources/unit/waroverlays/scenario-one-overlay-settings-test-data/source/org/sample/company/test.jsp @@ -0,0 +1 @@ +org/sample/company/test.jsp \ No newline at end of file diff --git a/src/test/resources/unit/waroverlays/test-overlays/overlay-full-1.war b/src/test/resources/unit/waroverlays/test-overlays/overlay-full-1.war new file mode 100644 index 00000000..f2682509 Binary files /dev/null and b/src/test/resources/unit/waroverlays/test-overlays/overlay-full-1.war differ diff --git a/src/test/resources/unit/waroverlays/test-overlays/overlay-full-2.war b/src/test/resources/unit/waroverlays/test-overlays/overlay-full-2.war new file mode 100644 index 00000000..d9d5f53d Binary files /dev/null and b/src/test/resources/unit/waroverlays/test-overlays/overlay-full-2.war differ diff --git a/src/test/resources/unit/waroverlays/test-overlays/overlay-full-3.war b/src/test/resources/unit/waroverlays/test-overlays/overlay-full-3.war new file mode 100644 index 00000000..9637a9bc Binary files /dev/null and b/src/test/resources/unit/waroverlays/test-overlays/overlay-full-3.war differ diff --git a/src/test/resources/unit/waroverlays/test-overlays/overlay-one.war b/src/test/resources/unit/waroverlays/test-overlays/overlay-one.war new file mode 100644 index 00000000..070d1bd3 Binary files /dev/null and b/src/test/resources/unit/waroverlays/test-overlays/overlay-one.war differ diff --git a/src/test/resources/unit/waroverlays/test-overlays/overlay-two.war b/src/test/resources/unit/waroverlays/test-overlays/overlay-two.war new file mode 100644 index 00000000..7da1c1ba Binary files /dev/null and b/src/test/resources/unit/waroverlays/test-overlays/overlay-two.war differ diff --git a/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..7453d86e --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +one-zip-overlay-skip-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/source/pansit.jsp b/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/source/pansit.jsp new file mode 100644 index 00000000..60538912 --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/source/pansit.jsp @@ -0,0 +1 @@ +one-zip-overlay-skip-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/xml-config/web.xml b/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/xml-config/web.xml new file mode 100644 index 00000000..80d42e3a --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-overlay-skip-test-data/xml-config/web.xml @@ -0,0 +1 @@ +one-zip-overlay-skip-test-data/xml-config/web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..820d8d48 --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +one-zip-overlay-targetPath-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/source/pansit.jsp b/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/source/pansit.jsp new file mode 100644 index 00000000..f17b1b9b --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/source/pansit.jsp @@ -0,0 +1 @@ +one-zip-overlay-targetPath-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/xml-config/web.xml b/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/xml-config/web.xml new file mode 100644 index 00000000..e23d626b --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-overlay-targetPath-test-data/xml-config/web.xml @@ -0,0 +1 @@ +one-zip-overlay-targetPath-test-data/xml-config/web.xml \ No newline at end of file diff --git a/src/test/resources/unit/warziptest/one-zip-test-data/source/org/web/app/last-exile.jsp b/src/test/resources/unit/warziptest/one-zip-test-data/source/org/web/app/last-exile.jsp new file mode 100644 index 00000000..bcdcc58f --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-test-data/source/org/web/app/last-exile.jsp @@ -0,0 +1 @@ +one-zip-test-data/source/org/web/app/last-exile.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warziptest/one-zip-test-data/source/pansit.jsp b/src/test/resources/unit/warziptest/one-zip-test-data/source/pansit.jsp new file mode 100644 index 00000000..cd4513e5 --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-test-data/source/pansit.jsp @@ -0,0 +1 @@ +one-zip-test-data/source/pansit.jsp \ No newline at end of file diff --git a/src/test/resources/unit/warziptest/one-zip-test-data/xml-config/web.xml b/src/test/resources/unit/warziptest/one-zip-test-data/xml-config/web.xml new file mode 100644 index 00000000..f3689c2b --- /dev/null +++ b/src/test/resources/unit/warziptest/one-zip-test-data/xml-config/web.xml @@ -0,0 +1 @@ +one-zip-test-data/xml-config/web.xml \ No newline at end of file