You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2006/05/04 05:55:06 UTC
svn commit: r399531 - in /maven/plugins/branches/MASSEMBLY-14/src:
main/java/org/apache/maven/plugin/assembly/
test/java/org/apache/maven/plugin/assembly/ test/plugin-configs/assembly/
test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/
Author: jdcasey
Date: Wed May 3 20:55:04 2006
New Revision: 399531
URL: http://svn.apache.org/viewcvs?rev=399531&view=rev
Log:
Fixing some of the tests.
Modified:
maven/plugins/branches/MASSEMBLY-14/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java
maven/plugins/branches/MASSEMBLY-14/src/test/java/org/apache/maven/plugin/assembly/BasicAbstractAssemblyMojoFeaturesTest.java
maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/MASSEMBLY-14-test-case.xml
maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/min-plugin-config.xml
maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMapping-pluginConfig.xml
maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMappingWithTwoDependencySets-pluginConfig.xml
Modified: maven/plugins/branches/MASSEMBLY-14/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/branches/MASSEMBLY-14/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java?rev=399531&r1=399530&r2=399531&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-14/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java (original)
+++ maven/plugins/branches/MASSEMBLY-14/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java Wed May 3 20:55:04 2006
@@ -55,6 +55,7 @@
try
{
+ System.out.println( "archiver manager is: " + archiverManager );
Archiver archiver = this.archiverManager.getArchiver( "dir" );
createArchive( archiver, assembly, fullName );
Modified: maven/plugins/branches/MASSEMBLY-14/src/test/java/org/apache/maven/plugin/assembly/BasicAbstractAssemblyMojoFeaturesTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/branches/MASSEMBLY-14/src/test/java/org/apache/maven/plugin/assembly/BasicAbstractAssemblyMojoFeaturesTest.java?rev=399531&r1=399530&r2=399531&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-14/src/test/java/org/apache/maven/plugin/assembly/BasicAbstractAssemblyMojoFeaturesTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-14/src/test/java/org/apache/maven/plugin/assembly/BasicAbstractAssemblyMojoFeaturesTest.java Wed May 3 20:55:04 2006
@@ -15,6 +15,7 @@
import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
@@ -28,66 +29,70 @@
/**
* Test common features of all assembly mojos.
*
- * @todo Switch to use test-only mojos, once we can generate descriptors for those...
+ * @todo Switch to use test-only mojos, once we can generate descriptors for
+ * those...
*/
public class BasicAbstractAssemblyMojoFeaturesTest
extends AbstractMojoTestCase
{
-
+
public void testOutputFileNameMapping() throws Exception
{
String pluginConfig = "outputFileNameMapping-pluginConfig.xml";
-
+
List requiredDependencies = new ArrayList();
-
+
requiredDependencies.add( "dependencies/test.jar" );
requiredDependencies.add( "dependencies/test2.jar" );
-
+
testDependencyMapping( pluginConfig, requiredDependencies );
}
public void testOutputFileNameMappingWithTwoDependencySets() throws Exception
{
String pluginConfig = "outputFileNameMappingWithTwoDependencySets-pluginConfig.xml";
-
+
List requiredDependencies = new ArrayList();
-
+
requiredDependencies.add( "dependencies/test.jar" );
requiredDependencies.add( "dependencies/test2.jar" );
requiredDependencies.add( "dependencies/test3-3.jar" );
requiredDependencies.add( "dependencies/test4-4.jar" );
-
+
testDependencyMapping( pluginConfig, requiredDependencies );
}
private void testDependencyMapping( String pluginConfig, List requiredDependencies ) throws Exception
{
ClassLoader cloader = Thread.currentThread().getContextClassLoader();
-
+
String pluginConfigResource = "basicAbstractAssemblyMojoFeaturesTest/" + pluginConfig;
-
+
URL resource = cloader.getResource( pluginConfigResource );
-
- assertNotNull( "Cannot find plugin-configuration: \'" + pluginConfigResource + "\' in context-classloader\'s classpath.", resource );
-
+
+ assertNotNull( "Cannot find plugin-configuration: \'" + pluginConfigResource
+ + "\' in context-classloader\'s classpath.", resource );
+
// TODO: Need to replace this with test-only mojos...
DirectoryMojo mojo = (DirectoryMojo) lookupMojo( "directory", resource.getPath() );
- FileLoggingArchiverManagerStub archiverManager = (FileLoggingArchiverManagerStub) getVariableValueFromObject( mojo, "archiverManager" );
+ FileLoggingArchiverManagerStub archiverManager = (FileLoggingArchiverManagerStub) getVariableValueFromObject(
+ mojo, "archiverManager" );
archiverManager.clearArchiver();
-
+
mojo.execute();
FileLoggingArchiverStub archiver = (FileLoggingArchiverStub) archiverManager.getArchiver( null );
-
+
Set addedFiles = archiver.getAddedFiles();
-
- System.out.println( "The following files were added to the test assembly:\n" + addedFiles.toString().replace(',', '\n' ) );
-
+
+ System.out.println( "The following files were added to the test assembly:\n"
+ + addedFiles.toString().replace( ',', '\n' ) );
+
for ( Iterator it = requiredDependencies.iterator(); it.hasNext(); )
{
String targetPath = (String) it.next();
-
+
assertTrue( "Required dependency path missing: \'" + targetPath + "\'", addedFiles.contains( targetPath ) );
}
}
@@ -106,7 +111,7 @@
return archiverStub;
}
-
+
void clearArchiver()
{
archiverStub = null;
@@ -119,6 +124,10 @@
private Set files = new LinkedHashSet();
+ public void createArchive() throws ArchiverException, IOException
+ {
+ }
+
public void addFile( File file, String targetPath, int mode ) throws ArchiverException
{
files.add( targetPath );
@@ -140,47 +149,61 @@
extends MavenProjectStub
{
private String groupId = "org.test.project";
+
private String artifactId = "test-project";
+
private String version = "1";
+
private String packaging = "jar";
+
private String scope = "compile";
-
+
private String depOneArtifactId;
+
private String depOneGroupId;
+
private String depOneVersion;
+
private String depOneType = "jar";
+
private String depOneScope = "compile";
-
+
private String depTwoArtifactId;
+
private String depTwoGroupId;
+
private String depTwoVersion;
+
private String depTwoType = "jar";
+
private String depTwoScope = "compile";
-
+
public Set getArtifacts()
{
Set artifacts = new LinkedHashSet();
-
- artifacts.add( new HandlerEquippedArtifactStub( depOneGroupId, depOneArtifactId, depOneVersion, depOneType, depOneScope ) );
- artifacts.add( new HandlerEquippedArtifactStub( depTwoGroupId, depTwoArtifactId, depTwoVersion, depTwoType, depTwoScope ) );
-
+
+ artifacts.add( new HandlerEquippedArtifactStub( depOneGroupId, depOneArtifactId, depOneVersion, depOneType,
+ depOneScope ) );
+ artifacts.add( new HandlerEquippedArtifactStub( depTwoGroupId, depTwoArtifactId, depTwoVersion, depTwoType,
+ depTwoScope ) );
+
return artifacts;
}
-
+
public Artifact getArtifact()
{
return new HandlerEquippedArtifactStub( groupId, artifactId, version, packaging, scope );
}
-
+
public TwoDependencyReactorProjectStub()
{
Model model = getModel();
- if( model == null )
+ if ( model == null )
{
- model = new Model();
- setModel( model );
+ model = new Model();
+ setModel( model );
}
-
+
Properties props = model.getProperties();
if ( props == null )
{
@@ -189,8 +212,9 @@
}
}
}
-
- public static final class HandlerEquippedArtifactStub extends ArtifactStub
+
+ public static final class HandlerEquippedArtifactStub
+ extends ArtifactStub
{
private final String type;
@@ -203,8 +227,7 @@
public ArtifactHandler getArtifactHandler()
{
- ArtifactHandler handler = new ArtifactHandler()
- {
+ ArtifactHandler handler = new ArtifactHandler() {
public String getClassifier()
{
@@ -240,9 +263,9 @@
{
return true;
}
-
+
};
-
+
return handler;
}
}
Modified: maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/MASSEMBLY-14-test-case.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/MASSEMBLY-14-test-case.xml?rev=399531&r1=399530&r2=399531&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/MASSEMBLY-14-test-case.xml (original)
+++ maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/MASSEMBLY-14-test-case.xml Wed May 3 20:55:04 2006
@@ -29,7 +29,7 @@
<classifier></classifier>
<project implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
<descriptorRefs>
- <descriptorRef>simple</descriptorRef>
+ <descriptorRef>bin</descriptorRef>
</descriptorRefs>
<tarLongFileMode>warn</tarLongFileMode>
<basedir>${basedir}</basedir>
Modified: maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/min-plugin-config.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/min-plugin-config.xml?rev=399531&r1=399530&r2=399531&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/min-plugin-config.xml (original)
+++ maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/assembly/min-plugin-config.xml Wed May 3 20:55:04 2006
@@ -30,7 +30,7 @@
<project implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
<executedProject implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
<descriptorRefs>
- <descriptorRef>simple</descriptorRef>
+ <descriptorRef>bin</descriptorRef>
</descriptorRefs>
<tarLongFileMode>warn</tarLongFileMode>
<basedir>${basedir}</basedir>
Modified: maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMapping-pluginConfig.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMapping-pluginConfig.xml?rev=399531&r1=399530&r2=399531&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMapping-pluginConfig.xml (original)
+++ maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMapping-pluginConfig.xml Wed May 3 20:55:04 2006
@@ -28,6 +28,14 @@
<depTwoGroupId>org.test.2</depTwoGroupId>
<depTwoVersion>2</depTwoVersion>
</project>
+ <executedProject implementation="org.apache.maven.plugin.assembly.BasicAbstractAssemblyMojoFeaturesTest$TwoDependencyReactorProjectStub">
+ <depOneArtifactId>test</depOneArtifactId>
+ <depOneGroupId>org.test</depOneGroupId>
+ <depOneVersion>1</depOneVersion>
+ <depTwoArtifactId>test2</depTwoArtifactId>
+ <depTwoGroupId>org.test.2</depTwoGroupId>
+ <depTwoVersion>2</depTwoVersion>
+ </executedProject>
<descriptors>
<descriptor>${basedir}/src/test/resources/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMapping-assemblyDescriptor.xml</descriptor>
</descriptors>
Modified: maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMappingWithTwoDependencySets-pluginConfig.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMappingWithTwoDependencySets-pluginConfig.xml?rev=399531&r1=399530&r2=399531&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMappingWithTwoDependencySets-pluginConfig.xml (original)
+++ maven/plugins/branches/MASSEMBLY-14/src/test/plugin-configs/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMappingWithTwoDependencySets-pluginConfig.xml Wed May 3 20:55:04 2006
@@ -30,6 +30,14 @@
<depTwoGroupId>org.test.2</depTwoGroupId>
<depTwoVersion>2</depTwoVersion>
</project>
+ <executedProject implementation="org.apache.maven.plugin.assembly.BasicAbstractAssemblyMojoFeaturesTest$TwoDependencyReactorProjectStub">
+ <depOneArtifactId>test</depOneArtifactId>
+ <depOneGroupId>org.test</depOneGroupId>
+ <depOneVersion>1</depOneVersion>
+ <depTwoArtifactId>test2</depTwoArtifactId>
+ <depTwoGroupId>org.test.2</depTwoGroupId>
+ <depTwoVersion>2</depTwoVersion>
+ </executedProject>
<descriptors>
<descriptor>${basedir}/src/test/resources/basicAbstractAssemblyMojoFeaturesTest/outputFileNameMappingWithTwoDependencySets-assemblyDescriptor.xml</descriptor>
</descriptors>
@@ -61,7 +69,6 @@
<depTwoVersion>4</depTwoVersion>
</reactorProject>
</reactorProjects>
- <classifier></classifier>
</configuration>
</plugin>
</plugins>