use of org.apache.maven.plugins.war.overlay.DefaultOverlay in project maven-plugins by apache.
the class WarZipTest method testOneZipWithNoSkip.
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 foo = new File(webAppDirectory, "foo.txt");
assertTrue("foo.txt not exists", foo.exists());
assertTrue("foo.txt not a file", foo.isFile());
File barDirectory = new File(webAppDirectory, "bar");
assertTrue("bar directory not exists", barDirectory.exists());
assertTrue("bar not a directory", barDirectory.isDirectory());
File bar = new File(barDirectory, "bar.txt");
assertTrue("bar/bar.txt not exists", bar.exists());
assertTrue("bar/bar.txt not a file", bar.isFile());
}
use of org.apache.maven.plugins.war.overlay.DefaultOverlay in project maven-plugins by apache.
the class OverlayManagerTest method testAutodetectSimpleOverlay.
public void testAutodetectSimpleOverlay(Overlay currentProjectOverlay) throws Exception {
final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
final ArtifactStub first = newWarArtifact("test", "test-webapp");
project.addArtifact(first);
final List<Overlay> overlays = new ArrayList<Overlay>();
try {
final Overlay overlay = currentProjectOverlay;
OverlayManager manager = new OverlayManager(overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, overlay);
assertNotNull(manager.getOverlays());
assertEquals(2, manager.getOverlays().size());
assertEquals(overlay, manager.getOverlays().get(0));
assertEquals(new DefaultOverlay(first), manager.getOverlays().get(1));
} catch (InvalidOverlayConfigurationException e) {
e.printStackTrace();
fail("Should not have failed to validate a valid overlay config " + e.getMessage());
}
}
use of org.apache.maven.plugins.war.overlay.DefaultOverlay 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());
}
}
Aggregations