Author: brett
Date: Wed Jun 21 00:08:27 2006
New Revision: 415930
URL: http://svn.apache.org/viewvc?rev=415930&view=rev
Log:
add missing test
Added:
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/JarArtifactStub.java
(with props)
maven/plugins/trunk/maven-war-plugin/src/test/resources/unit/sample_wars/simple.jar
Modified:
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
Modified:
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java?rev=415930&r1=415929&r2=415930&view=diff
==============================================================================
---
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
(original)
+++
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
Wed Jun 21 00:08:27 2006
@@ -16,9 +16,12 @@
* limitations under the License.
*/
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.plugin.testing.stubs.ArtifactStub;
import org.apache.maven.plugin.war.stub.EJBArtifactStub;
import org.apache.maven.plugin.war.stub.EJBClientArtifactStub;
import org.apache.maven.plugin.war.stub.IncludeExcludeWarArtifactStub;
+import org.apache.maven.plugin.war.stub.JarArtifactStub;
import org.apache.maven.plugin.war.stub.MavenProjectArtifactsStub;
import org.apache.maven.plugin.war.stub.MavenProjectBasicStub;
import org.apache.maven.plugin.war.stub.PARArtifactStub;
@@ -236,6 +239,37 @@
assertTrue( "source files not found: " +
expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
assertTrue( "source files not found: " +
expectedWebSource2File.toString(), expectedWebSource2File.exists() );
assertTrue( "ejb artifact not found: " +
expectedEJBArtifact.toString(), expectedEJBArtifact.exists() );
+ }
+
+ public void testExplodedWarWithJar()
+ throws Exception
+ {
+ // setup test data
+ String testId = "ExplodedWarWithJar";
+ MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
+ File webAppDirectory = new File( getTestDirectory(), testId );
+ File webAppSource = createWebAppSource( testId );
+ File classesDir = createClassesDir( testId, true );
+ ArtifactHandler artifactHandler = (ArtifactHandler) lookup(
ArtifactHandler.ROLE, "jar" );
+ ArtifactStub jarArtifact = new JarArtifactStub( getBasedir(),
artifactHandler );
+ File jarFile = jarArtifact.getFile();
+
+ assertTrue( "jar not found: " + jarFile.toString(), jarFile.exists() );
+
+ // configure mojo
+ project.addArtifact( jarArtifact );
+ this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource,
webAppDirectory, project );
+ mojo.execute();
+
+ // validate operation
+ File expectedWebSourceFile = new File( webAppDirectory, "pansit.jsp" );
+ File expectedWebSource2File = new File( webAppDirectory,
"org/web/app/last-exile.jsp" );
+ // final name form is <artifactId>-<version>.<type>
+ File expectedJarArtifact = new File( webAppDirectory,
"WEB-INF/lib/jarartifact-0.0-Test.jar" );
+
+ assertTrue( "source files not found: " +
expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
+ assertTrue( "source files not found: " +
expectedWebSource2File.toString(), expectedWebSource2File.exists() );
+ assertTrue( "jar artifact not found: " +
expectedJarArtifact.toString(), expectedJarArtifact.exists() );
}
/**
Added:
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/JarArtifactStub.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/JarArtifactStub.java?rev=415930&view=auto
==============================================================================
---
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/JarArtifactStub.java
(added)
+++
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/JarArtifactStub.java
Wed Jun 21 00:08:27 2006
@@ -0,0 +1,72 @@
+package org.apache.maven.plugin.war.stub;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+
+import java.io.File;
+
+public class JarArtifactStub
+ extends AbstractArtifactStub
+{
+ protected String groupId;
+
+ private ArtifactHandler artifactHandler;
+
+ public JarArtifactStub( String basedir, ArtifactHandler artifactHandler )
+ {
+ super( basedir );
+ this.artifactHandler = artifactHandler;
+ }
+
+ public void setGroupId( String id )
+ {
+ groupId = id;
+ }
+
+ public String getGroupId()
+ {
+ if ( groupId != null )
+ {
+ return groupId;
+ }
+ else
+ {
+ return "org.sample.jar";
+ }
+ }
+
+ public String getType()
+ {
+ return "jar";
+ }
+
+ public String getArtifactId()
+ {
+ return "jarartifact";
+ }
+
+ public File getFile()
+ {
+ return new File( basedir,
"/target/test-classes/unit/sample_wars/simple.jar" );
+ }
+
+ public ArtifactHandler getArtifactHandler()
+ {
+ return artifactHandler;
+ }
+}
Propchange:
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/JarArtifactStub.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/JarArtifactStub.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-war-plugin/src/test/resources/unit/sample_wars/simple.jar
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/test/resources/unit/sample_wars/simple.jar?rev=415930&view=auto
==============================================================================
Binary files /tmp/tmpWsXH4Y and /tmp/tmpxQAgoL differ