Search in sources :

Example 6 with OverlayManager

use of org.apache.maven.plugins.war.overlay.OverlayManager in project maven-plugins by apache.

the class OverlayManagerTest method testEmptyProject.

public void testEmptyProject() throws Exception {
    final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
    final List<Overlay> overlays = new ArrayList<Overlay>();
    try {
        final Overlay currentProjectOVerlay = Overlay.createInstance();
        OverlayManager manager = new OverlayManager(overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, currentProjectOVerlay);
        assertNotNull(manager.getOverlays());
        assertEquals(1, manager.getOverlays().size());
        assertEquals(currentProjectOVerlay, manager.getOverlays().get(0));
    } catch (InvalidOverlayConfigurationException e) {
        e.printStackTrace();
        fail("Should not have failed to validate a valid overly config " + e.getMessage());
    }
}
Also used : OverlayManager(org.apache.maven.plugins.war.overlay.OverlayManager) MavenProjectArtifactsStub(org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub) ArrayList(java.util.ArrayList) Overlay(org.apache.maven.plugins.war.Overlay) DefaultOverlay(org.apache.maven.plugins.war.overlay.DefaultOverlay) InvalidOverlayConfigurationException(org.apache.maven.plugins.war.overlay.InvalidOverlayConfigurationException)

Example 7 with OverlayManager

use of org.apache.maven.plugins.war.overlay.OverlayManager 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

OverlayManager (org.apache.maven.plugins.war.overlay.OverlayManager)7 ArrayList (java.util.ArrayList)6 Overlay (org.apache.maven.plugins.war.Overlay)6 DefaultOverlay (org.apache.maven.plugins.war.overlay.DefaultOverlay)6 InvalidOverlayConfigurationException (org.apache.maven.plugins.war.overlay.InvalidOverlayConfigurationException)6 MavenProjectArtifactsStub (org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub)6 ArtifactStub (org.apache.maven.plugin.testing.stubs.ArtifactStub)5 WarArtifactStub (org.apache.maven.plugins.war.stub.WarArtifactStub)5 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 WarPackagingContext (org.apache.maven.plugins.war.packaging.WarPackagingContext)1 WarPackagingTask (org.apache.maven.plugins.war.packaging.WarPackagingTask)1 WarPostPackagingTask (org.apache.maven.plugins.war.packaging.WarPostPackagingTask)1 WebappStructure (org.apache.maven.plugins.war.util.WebappStructure)1 MavenFilteringException (org.apache.maven.shared.filtering.MavenFilteringException)1 MavenResourcesExecution (org.apache.maven.shared.filtering.MavenResourcesExecution)1