Search in sources :

Example 26 with ArtifactStub

use of org.apache.maven.plugin.testing.stubs.ArtifactStub in project maven-plugins by apache.

the class OverlayManagerTest method testCustomCurrentProject.

public void testCustomCurrentProject() throws Exception {
    final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
    final ArtifactStub first = newWarArtifact("test", "test-webapp");
    final ArtifactStub second = newWarArtifact("test", "test-webapp-2");
    project.addArtifact(first);
    project.addArtifact(second);
    final List<Overlay> overlays = new ArrayList<Overlay>();
    overlays.add(new DefaultOverlay(first));
    final Overlay currentProjectOverlay = Overlay.createInstance();
    overlays.add(currentProjectOverlay);
    try {
        OverlayManager manager = new OverlayManager(overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, currentProjectOverlay);
        assertNotNull(manager.getOverlays());
        assertEquals(3, manager.getOverlays().size());
        assertEquals(overlays.get(0), manager.getOverlays().get(0));
        assertEquals(currentProjectOverlay, manager.getOverlays().get(1));
        assertEquals(new DefaultOverlay(second), manager.getOverlays().get(2));
    } catch (InvalidOverlayConfigurationException e) {
        e.printStackTrace();
        fail("Should not have failed to validate a valid overlay config " + e.getMessage());
    }
}
Also used : DefaultOverlay(org.apache.maven.plugins.war.overlay.DefaultOverlay) OverlayManager(org.apache.maven.plugins.war.overlay.OverlayManager) MavenProjectArtifactsStub(org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub) ArrayList(java.util.ArrayList) ArtifactStub(org.apache.maven.plugin.testing.stubs.ArtifactStub) WarArtifactStub(org.apache.maven.plugins.war.stub.WarArtifactStub) Overlay(org.apache.maven.plugins.war.Overlay) DefaultOverlay(org.apache.maven.plugins.war.overlay.DefaultOverlay) InvalidOverlayConfigurationException(org.apache.maven.plugins.war.overlay.InvalidOverlayConfigurationException)

Aggregations

ArtifactStub (org.apache.maven.plugin.testing.stubs.ArtifactStub)26 File (java.io.File)17 ArrayList (java.util.ArrayList)13 Overlay (org.apache.maven.plugins.war.Overlay)11 DefaultOverlay (org.apache.maven.plugins.war.overlay.DefaultOverlay)11 MavenProjectArtifactsStub (org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub)11 WarArtifactStub (org.apache.maven.plugins.war.stub.WarArtifactStub)10 ArtifactHandler (org.apache.maven.artifact.handler.ArtifactHandler)9 JarArtifactStub (org.apache.maven.plugins.war.stub.JarArtifactStub)9 FileFilter (java.io.FileFilter)6 InvalidOverlayConfigurationException (org.apache.maven.plugins.war.overlay.InvalidOverlayConfigurationException)5 OverlayManager (org.apache.maven.plugins.war.overlay.OverlayManager)5 AarArtifactStub (org.apache.maven.plugins.war.stub.AarArtifactStub)5 EJBArtifactStub (org.apache.maven.plugins.war.stub.EJBArtifactStub)5 EJBClientArtifactStub (org.apache.maven.plugins.war.stub.EJBClientArtifactStub)5 IncludeExcludeWarArtifactStub (org.apache.maven.plugins.war.stub.IncludeExcludeWarArtifactStub)5 MarArtifactStub (org.apache.maven.plugins.war.stub.MarArtifactStub)5 PARArtifactStub (org.apache.maven.plugins.war.stub.PARArtifactStub)5 TLDArtifactStub (org.apache.maven.plugins.war.stub.TLDArtifactStub)5 XarArtifactStub (org.apache.maven.plugins.war.stub.XarArtifactStub)5