Search in sources :

Example 6 with WebappStructure

use of org.apache.maven.plugins.war.util.WebappStructure in project maven-plugins by apache.

the class WebappStructureTest method testRegisterSamePathTwiceForced.

public void testRegisterSamePathTwiceForced() {
    final String path = "WEB-INF/web.xml";
    final WebappStructure structure = new WebappStructure(new ArrayList<Dependency>());
    structure.registerFile("overlay1", path);
    assertEquals("overlay1", structure.getOwner(path));
    assertTrue("owner replacement should have returned true", structure.registerFileForced("currentBuild", path));
    assertEquals("currentBuild", structure.getOwner(path));
}
Also used : Dependency(org.apache.maven.model.Dependency) WebappStructure(org.apache.maven.plugins.war.util.WebappStructure)

Example 7 with WebappStructure

use of org.apache.maven.plugins.war.util.WebappStructure in project maven-plugins by apache.

the class WebappStructureTest method testRegisterSamePathTwice.

public void testRegisterSamePathTwice() {
    final WebappStructure structure = new WebappStructure(new ArrayList<Dependency>());
    structure.registerFile("overlay1", "WEB-INF/web.xml");
    assertFalse(structure.registerFile("currentBuild", "WEB-INF/web.xml"));
}
Also used : Dependency(org.apache.maven.model.Dependency) WebappStructure(org.apache.maven.plugins.war.util.WebappStructure)

Example 8 with WebappStructure

use of org.apache.maven.plugins.war.util.WebappStructure in project maven-plugins by apache.

the class WebappStructureTest method testDependencyAnalysisWithNewDependency.

public void testDependencyAnalysisWithNewDependency() {
    final List<Dependency> dependencies = new ArrayList<Dependency>();
    dependencies.add(createDependency("groupTest", "artifactTest", "1.0"));
    final WebappStructure cache = new WebappStructure(dependencies);
    final List<Dependency> newDependencies = new ArrayList<Dependency>(dependencies);
    final Dependency newDependency = createDependency("groupTest", "nexArtifact", "2.0");
    newDependencies.add(newDependency);
    final WebappStructure webappStructure = new WebappStructure(newDependencies, cache);
    webappStructure.analyseDependencies(new WebappStructure.DependenciesAnalysisCallback() {

        int count = 0;

        public void unchangedDependency(Dependency dependency) {
            if (count == 0) {
                count++;
            } else {
                fail("Should have called unchanged dependency only once");
            }
        }

        public void newDependency(Dependency dependency) {
            if (!newDependency.equals(dependency)) {
                fail("Called new dependency with an unexpected dependency " + dependency);
            }
        }

        public void removedDependency(Dependency dependency) {
            fail("Should have failed to trigger this callback");
        }

        public void updatedVersion(Dependency dependency, String previousVersion) {
            fail("Should have failed to trigger this callback");
        }

        public void updatedScope(Dependency dependency, String previousScope) {
            fail("Should have failed to trigger this callback");
        }

        public void updatedOptionalFlag(Dependency dependency, boolean previousOptional) {
            fail("Should have failed to trigger this callback");
        }

        public void updatedUnknown(Dependency dependency, Dependency previousDep) {
            fail("Should have failed to trigger this callback");
        }
    });
}
Also used : ArrayList(java.util.ArrayList) Dependency(org.apache.maven.model.Dependency) WebappStructure(org.apache.maven.plugins.war.util.WebappStructure)

Aggregations

WebappStructure (org.apache.maven.plugins.war.util.WebappStructure)8 Dependency (org.apache.maven.model.Dependency)7 ArrayList (java.util.ArrayList)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 OverlayManager (org.apache.maven.plugins.war.overlay.OverlayManager)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 MavenFilteringException (org.apache.maven.shared.filtering.MavenFilteringException)1 MavenResourcesExecution (org.apache.maven.shared.filtering.MavenResourcesExecution)1