-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORGE-1014: Webapp folder is no longer hard-coded
- Loading branch information
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...del-maven-tests/src/test/java/org/jboss/forge/maven/facets/MavenWebResourceFacetTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2012 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.jboss.forge.maven.facets; | ||
|
||
import java.io.File; | ||
|
||
import org.jboss.forge.maven.resources.MavenPomResource; | ||
import org.jboss.forge.project.Project; | ||
import org.jboss.forge.project.packaging.PackagingType; | ||
import org.jboss.forge.resources.DirectoryResource; | ||
import org.jboss.forge.test.AbstractShellTest; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class MavenWebResourceFacetTest extends AbstractShellTest | ||
{ | ||
@Test | ||
public void testDefaultWebappFolder() throws Exception | ||
{ | ||
Project project = initializeProject(PackagingType.WAR); | ||
MavenWebResourceFacet facet = project.getFacet(MavenWebResourceFacet.class); | ||
DirectoryResource expected = project.getProjectRoot().getChildDirectory( | ||
"src" + File.separator + "main" + File.separator + "webapp"); | ||
Assert.assertEquals(expected.getFullyQualifiedName(), facet.getWebRootDirectory().getFullyQualifiedName()); | ||
} | ||
|
||
@Test | ||
public void testCustomWebappFolder() throws Exception | ||
{ | ||
Project project = initializeProject(PackagingType.WAR); | ||
|
||
MavenPomResource pom = project.getProjectRoot().getChild("pom.xml").reify(MavenPomResource.class); | ||
|
||
pom.setContents("<project><modelVersion>4.0.0.</modelVersion><groupId>com.test</groupId><artifactId>testme</artifactId><version>1.0</version><build><plugins><plugin><artifactId>maven-war-plugin</artifactId><version>2.4</version><configuration><warSourceDirectory>WebContent</warSourceDirectory><failOnMissingWebXml>false</failOnMissingWebXml></configuration></plugin></plugins></build></project>"); | ||
|
||
MavenWebResourceFacet facet = project.getFacet(MavenWebResourceFacet.class); | ||
DirectoryResource expected = project.getProjectRoot().getChildDirectory( | ||
"WebContent"); | ||
Assert.assertEquals(expected.getFullyQualifiedName(), facet.getWebRootDirectory().getFullyQualifiedName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters