use of org.apache.maven.plugins.war.overlay.InvalidOverlayConfigurationException in project maven-plugins by apache.
the class OverlayManagerTest method testSimpleOverlay.
public void testSimpleOverlay() throws Exception {
final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
final ArtifactStub first = newWarArtifact("test", "test-webapp");
project.addArtifact(first);
final List<Overlay> overlays = new ArrayList<Overlay>();
overlays.add(new DefaultOverlay(first));
try {
final Overlay currentProjectOverlay = Overlay.createInstance();
OverlayManager manager = new OverlayManager(overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, currentProjectOverlay);
assertNotNull(manager.getOverlays());
assertEquals(2, manager.getOverlays().size());
assertEquals(Overlay.createInstance(), manager.getOverlays().get(0));
assertEquals(overlays.get(0), 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.InvalidOverlayConfigurationException in project maven-plugins by apache.
the class OverlayManagerTest method testOverlaysWithSameArtifactAndGroupId.
public void testOverlaysWithSameArtifactAndGroupId() throws Exception {
final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
final ArtifactStub first = newWarArtifact("test", "test-webapp");
final ArtifactStub second = newWarArtifact("test", "test-webapp", "my-classifier");
project.addArtifact(first);
project.addArtifact(second);
final List<Overlay> overlays = new ArrayList<Overlay>();
overlays.add(new DefaultOverlay(first));
overlays.add(new DefaultOverlay(second));
try {
final Overlay currentProjectOverlay = Overlay.createInstance();
OverlayManager manager = new OverlayManager(overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, currentProjectOverlay);
assertNotNull(manager.getOverlays());
assertEquals(3, manager.getOverlays().size());
assertEquals(currentProjectOverlay, manager.getOverlays().get(0));
assertEquals(overlays.get(0), manager.getOverlays().get(1));
assertEquals(overlays.get(1), manager.getOverlays().get(2));
} 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.InvalidOverlayConfigurationException in project maven-plugins by apache.
the class OverlayManagerTest method testUnknonwnOverlay.
public void testUnknonwnOverlay() throws Exception {
final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
final ArtifactStub first = newWarArtifact("test", "test-webapp");
project.addArtifact(first);
final List<Overlay> overlays = new ArrayList<Overlay>();
overlays.add(new Overlay("test", "test-webapp-2"));
try {
final Overlay currentProjectOVerlay = Overlay.createInstance();
new OverlayManager(overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, currentProjectOVerlay);
fail("Should have failed to validate an unknown overlay");
} catch (InvalidOverlayConfigurationException e) {
// OK
}
}
use of org.apache.maven.plugins.war.overlay.InvalidOverlayConfigurationException 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.InvalidOverlayConfigurationException 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());
}
}
Aggregations