o fixed svn properties

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@628492 13f79535-47bb-0310-9956-ffa450edef68
master
Vincent Siveton 2008-02-17 15:12:38 +00:00
parent cc94792fbd
commit 2a64c902b4
9 changed files with 1656 additions and 1656 deletions

View File

@ -1,78 +1,78 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- <!--
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
distributed with this work for additional information distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the KIND, either express or implied. See the License for the
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
--> -->
<model> <model>
<id>pluginRequirements</id> <id>pluginRequirements</id>
<name>PluginRequirements</name> <name>PluginRequirements</name>
<description><![CDATA[Model to specify plugin requirements.]]></description> <description><![CDATA[Model to specify plugin requirements.]]></description>
<defaults> <defaults>
<default> <default>
<key>package</key> <key>package</key>
<value>org.apache.maven.plugin.plugin</value> <value>org.apache.maven.plugin.plugin</value>
</default> </default>
</defaults> </defaults>
<classes> <classes>
<class> <class>
<name>Requirements</name> <name>Requirements</name>
<description>Plugin requirements.</description> <description>Plugin requirements.</description>
<version>1.0.0</version> <version>1.0.0</version>
<fields> <fields>
<field> <field>
<name>maven</name> <name>maven</name>
<description>The minimum version of Maven to run this plugin.</description> <description>The minimum version of Maven to run this plugin.</description>
<version>1.0.0</version> <version>1.0.0</version>
<type>String</type> <type>String</type>
<identifier>true</identifier> <identifier>true</identifier>
<defaultValue>2.0</defaultValue> <defaultValue>2.0</defaultValue>
</field> </field>
<field> <field>
<name>jdk</name> <name>jdk</name>
<description>The minimum version of the JDK to run this plugin.</description> <description>The minimum version of the JDK to run this plugin.</description>
<version>1.0.0</version> <version>1.0.0</version>
<type>String</type> <type>String</type>
<identifier>true</identifier> <identifier>true</identifier>
</field> </field>
<field> <field>
<name>memory</name> <name>memory</name>
<description>The minimum memory needed to run this plugin.</description> <description>The minimum memory needed to run this plugin.</description>
<version>1.0.0</version> <version>1.0.0</version>
<type>String</type> <type>String</type>
</field> </field>
<field> <field>
<name>diskSpace</name> <name>diskSpace</name>
<description>The minimum diskSpace needed to run this plugin.</description> <description>The minimum diskSpace needed to run this plugin.</description>
<version>1.0.0</version> <version>1.0.0</version>
<type>String</type> <type>String</type>
</field> </field>
<field> <field>
<name>others</name> <name>others</name>
<description>Others requirements properties.</description> <description>Others requirements properties.</description>
<version>1.0.0</version> <version>1.0.0</version>
<type>Properties</type> <type>Properties</type>
<association xml.mapStyle="inline"> <association xml.mapStyle="inline">
<type>String</type> <type>String</type>
<multiplicity>*</multiplicity> <multiplicity>*</multiplicity>
</association> </association>
</field> </field>
</fields> </fields>
</class> </class>
</classes> </classes>
</model> </model>

View File

@ -1,484 +1,484 @@
package org.apache.maven.plugin.testing; package org.apache.maven.plugin.testing;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.plugin.testing.stubs.DefaultArtifactHandlerStub; import org.apache.maven.plugin.testing.stubs.DefaultArtifactHandlerStub;
import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.manager.ArchiverManager; import org.codehaus.plexus.archiver.manager.ArchiverManager;
import org.codehaus.plexus.archiver.manager.NoSuchArchiverException; import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
import org.codehaus.plexus.archiver.war.WarArchiver; import org.codehaus.plexus.archiver.war.WarArchiver;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.ReflectionUtils; import org.codehaus.plexus.util.ReflectionUtils;
import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.StringUtils;
/** /**
* This class creates artifacts to be used for testing purposes. It can optionally create actual files on the local disk * This class creates artifacts to be used for testing purposes. It can optionally create actual files on the local disk
* for things like copying. It can create these files as archives with named files inside to be used for testing things * for things like copying. It can create these files as archives with named files inside to be used for testing things
* like unpack. Also provided are some utility methods to quickly get a set of artifacts distinguished by various things * like unpack. Also provided are some utility methods to quickly get a set of artifacts distinguished by various things
* like group,artifact,type,scope, etc It was originally developed for the dependency plugin, but can be useful in other * like group,artifact,type,scope, etc It was originally developed for the dependency plugin, but can be useful in other
* plugins that need to simulate artifacts for unit tests. * plugins that need to simulate artifacts for unit tests.
* *
* @author <a href="mailto:brianf@apache.org">Brian Fox</a> * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
*/ */
public class ArtifactStubFactory public class ArtifactStubFactory
{ {
File workingDir; File workingDir;
boolean createFiles; boolean createFiles;
File srcFile; File srcFile;
boolean createUnpackableFile; boolean createUnpackableFile;
ArchiverManager archiverManager; ArchiverManager archiverManager;
/** /**
* Default constructor. This should be used only if real files aren't needed...just the artifact objects * Default constructor. This should be used only if real files aren't needed...just the artifact objects
*/ */
public ArtifactStubFactory() public ArtifactStubFactory()
{ {
this.workingDir = null; this.workingDir = null;
this.createFiles = false; this.createFiles = false;
} }
/** /**
* This constructor is to be used if files are needed and to set a working dir * This constructor is to be used if files are needed and to set a working dir
* *
* @param workingDir * @param workingDir
* @param createFiles * @param createFiles
*/ */
public ArtifactStubFactory( File workingDir, boolean createFiles ) public ArtifactStubFactory( File workingDir, boolean createFiles )
{ {
this.workingDir = new File( workingDir, "localTestRepo" ); this.workingDir = new File( workingDir, "localTestRepo" );
this.createFiles = createFiles; this.createFiles = createFiles;
} }
/** /**
* If set, the file will be created as a zip/jar/war with a file inside that can be checked to exist after * If set, the file will be created as a zip/jar/war with a file inside that can be checked to exist after
* unpacking. * unpacking.
* *
* @param archiverManager * @param archiverManager
*/ */
public void setUnpackableFile( ArchiverManager archiverManager ) public void setUnpackableFile( ArchiverManager archiverManager )
{ {
this.createUnpackableFile = true; this.createUnpackableFile = true;
this.archiverManager = archiverManager; this.archiverManager = archiverManager;
} }
public Artifact createArtifact( String groupId, String artifactId, String version ) public Artifact createArtifact( String groupId, String artifactId, String version )
throws IOException throws IOException
{ {
return createArtifact( groupId, artifactId, version, Artifact.SCOPE_COMPILE, "jar", "" ); return createArtifact( groupId, artifactId, version, Artifact.SCOPE_COMPILE, "jar", "" );
} }
public Artifact createArtifact( String groupId, String artifactId, String version, String scope ) public Artifact createArtifact( String groupId, String artifactId, String version, String scope )
throws IOException throws IOException
{ {
return createArtifact( groupId, artifactId, version, scope, "jar", "" ); return createArtifact( groupId, artifactId, version, scope, "jar", "" );
} }
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type, public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
String classifier ) String classifier )
throws IOException throws IOException
{ {
VersionRange vr = VersionRange.createFromVersion( version ); VersionRange vr = VersionRange.createFromVersion( version );
return createArtifact( groupId, artifactId, vr, scope, type, classifier, false ); return createArtifact( groupId, artifactId, vr, scope, type, classifier, false );
} }
public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String scope,
String type, String classifier, boolean optional ) String type, String classifier, boolean optional )
throws IOException throws IOException
{ {
ArtifactHandler ah = new DefaultArtifactHandlerStub( type, classifier ); ArtifactHandler ah = new DefaultArtifactHandlerStub( type, classifier );
Artifact artifact = Artifact artifact =
new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier, ah, optional ); new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier, ah, optional );
// i have no idea why this needs to be done manually when isSnapshot is able to figure it out. // i have no idea why this needs to be done manually when isSnapshot is able to figure it out.
artifact.setRelease( !artifact.isSnapshot() ); artifact.setRelease( !artifact.isSnapshot() );
if ( createFiles ) if ( createFiles )
{ {
setArtifactFile( artifact,this.workingDir,this.srcFile,this.createUnpackableFile ); setArtifactFile( artifact,this.workingDir,this.srcFile,this.createUnpackableFile );
} }
return artifact; return artifact;
} }
/** /**
* Creates a new empty file and attaches it to the artifact. * Creates a new empty file and attaches it to the artifact.
* *
* @param artifact to attach the file to. * @param artifact to attach the file to.
* @param workingDir where to locate the new file * @param workingDir where to locate the new file
* @throws IOException * @throws IOException
*/ */
public void setArtifactFile( Artifact artifact, File workingDir ) public void setArtifactFile( Artifact artifact, File workingDir )
throws IOException throws IOException
{ {
setArtifactFile( artifact, workingDir, null, false ); setArtifactFile( artifact, workingDir, null, false );
} }
/** /**
* Copyies the srcFile to the workingDir and then attaches it to the artifact. If srcFile is null, a new empty file * Copyies the srcFile to the workingDir and then attaches it to the artifact. If srcFile is null, a new empty file
* will be created. * will be created.
* *
* @param artifact to attach * @param artifact to attach
* @param workingDir where to copy the srcFile. * @param workingDir where to copy the srcFile.
* @param srcFile file to be attached. * @param srcFile file to be attached.
* @throws IOException * @throws IOException
*/ */
public void setArtifactFile( Artifact artifact, File workingDir, File srcFile ) public void setArtifactFile( Artifact artifact, File workingDir, File srcFile )
throws IOException throws IOException
{ {
setArtifactFile( artifact, workingDir, srcFile, false ); setArtifactFile( artifact, workingDir, srcFile, false );
} }
/** /**
* Creates an unpackable file (zip,jar etc) containing an empty file. * Creates an unpackable file (zip,jar etc) containing an empty file.
* *
* @param artifact to attach * @param artifact to attach
* @param workingDir where to create the file. * @param workingDir where to create the file.
* @throws IOException * @throws IOException
*/ */
public void setUnpackableArtifactFile( Artifact artifact, File workingDir ) public void setUnpackableArtifactFile( Artifact artifact, File workingDir )
throws IOException throws IOException
{ {
setArtifactFile( artifact, workingDir, null, true ); setArtifactFile( artifact, workingDir, null, true );
} }
/** /**
* Creates an unpackable file (zip,jar etc) containing the srcFile. If srcFile is null, a new empty file will be * Creates an unpackable file (zip,jar etc) containing the srcFile. If srcFile is null, a new empty file will be
* created. * created.
* *
* @param artifact to attach * @param artifact to attach
* @param workingDir where to create the file. * @param workingDir where to create the file.
* @throws IOException * @throws IOException
*/ */
public void setUnpackableArtifactFile( Artifact artifact, File workingDir, File srcFile ) public void setUnpackableArtifactFile( Artifact artifact, File workingDir, File srcFile )
throws IOException throws IOException
{ {
setArtifactFile( artifact, workingDir, srcFile, true ); setArtifactFile( artifact, workingDir, srcFile, true );
} }
/* /*
* Creates a file that can be copied or unpacked based on the passed in artifact * Creates a file that can be copied or unpacked based on the passed in artifact
*/ */
private void setArtifactFile( Artifact artifact, File workingDir, File srcFile, boolean createUnpackableFile ) private void setArtifactFile( Artifact artifact, File workingDir, File srcFile, boolean createUnpackableFile )
throws IOException throws IOException
{ {
if ( workingDir == null ) if ( workingDir == null )
{ {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"The workingDir must be set." ); "The workingDir must be set." );
} }
String fileName = getFormattedFileName( artifact, false ); String fileName = getFormattedFileName( artifact, false );
File theFile = new File( workingDir, fileName ); File theFile = new File( workingDir, fileName );
theFile.getParentFile().mkdirs(); theFile.getParentFile().mkdirs();
if ( srcFile == null ) if ( srcFile == null )
{ {
theFile.createNewFile(); theFile.createNewFile();
} }
else if ( createUnpackableFile ) else if ( createUnpackableFile )
{ {
try try
{ {
createUnpackableFile( artifact, theFile ); createUnpackableFile( artifact, theFile );
} }
catch ( NoSuchArchiverException e ) catch ( NoSuchArchiverException e )
{ {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
catch ( ArchiverException e ) catch ( ArchiverException e )
{ {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
catch ( IOException e ) catch ( IOException e )
{ {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
else else
{ {
FileUtils.copyFile( srcFile, theFile ); FileUtils.copyFile( srcFile, theFile );
} }
artifact.setFile( theFile ); artifact.setFile( theFile );
} }
static public String getUnpackableFileName( Artifact artifact ) static public String getUnpackableFileName( Artifact artifact )
{ {
return "" + artifact.getGroupId() + "-" + artifact.getArtifactId() + "-" + artifact.getVersion() + "-" + return "" + artifact.getGroupId() + "-" + artifact.getArtifactId() + "-" + artifact.getVersion() + "-" +
artifact.getClassifier() + "-" + artifact.getType() + ".txt"; artifact.getClassifier() + "-" + artifact.getType() + ".txt";
} }
public void createUnpackableFile( Artifact artifact, File destFile ) public void createUnpackableFile( Artifact artifact, File destFile )
throws NoSuchArchiverException, ArchiverException, IOException throws NoSuchArchiverException, ArchiverException, IOException
{ {
Archiver archiver = archiverManager.getArchiver( destFile ); Archiver archiver = archiverManager.getArchiver( destFile );
archiver.setDestFile( destFile ); archiver.setDestFile( destFile );
archiver.addFile( srcFile, getUnpackableFileName( artifact ) ); archiver.addFile( srcFile, getUnpackableFileName( artifact ) );
try try
{ {
setVariableValueToObject( archiver, "logger", new SilentLog() ); setVariableValueToObject( archiver, "logger", new SilentLog() );
} }
catch ( IllegalAccessException e ) catch ( IllegalAccessException e )
{ {
System.out.println( "Unable to override logger with silent log." ); System.out.println( "Unable to override logger with silent log." );
e.printStackTrace(); e.printStackTrace();
} }
if ( archiver instanceof WarArchiver ) if ( archiver instanceof WarArchiver )
{ {
WarArchiver war = (WarArchiver) archiver; WarArchiver war = (WarArchiver) archiver;
// the use of this is counter-intuitive: // the use of this is counter-intuitive:
// http://jira.codehaus.org/browse/PLX-286 // http://jira.codehaus.org/browse/PLX-286
war.setIgnoreWebxml( false ); war.setIgnoreWebxml( false );
} }
archiver.createArchive(); archiver.createArchive();
} }
public Artifact getReleaseArtifact() public Artifact getReleaseArtifact()
throws IOException throws IOException
{ {
return createArtifact( "testGroupId", "release", "1.0" ); return createArtifact( "testGroupId", "release", "1.0" );
} }
public Artifact getSnapshotArtifact() public Artifact getSnapshotArtifact()
throws IOException throws IOException
{ {
return createArtifact( "testGroupId", "snapshot", "2.0-SNAPSHOT" ); return createArtifact( "testGroupId", "snapshot", "2.0-SNAPSHOT" );
} }
public Set getReleaseAndSnapshotArtifacts() public Set getReleaseAndSnapshotArtifacts()
throws IOException throws IOException
{ {
Set set = new HashSet(); Set set = new HashSet();
set.add( getReleaseArtifact() ); set.add( getReleaseArtifact() );
set.add( getSnapshotArtifact() ); set.add( getSnapshotArtifact() );
return set; return set;
} }
public Set getScopedArtifacts() public Set getScopedArtifacts()
throws IOException throws IOException
{ {
Set set = new HashSet(); Set set = new HashSet();
set.add( createArtifact( "g", "compile", "1.0", Artifact.SCOPE_COMPILE ) ); set.add( createArtifact( "g", "compile", "1.0", Artifact.SCOPE_COMPILE ) );
set.add( createArtifact( "g", "provided", "1.0", Artifact.SCOPE_PROVIDED ) ); set.add( createArtifact( "g", "provided", "1.0", Artifact.SCOPE_PROVIDED ) );
set.add( createArtifact( "g", "test", "1.0", Artifact.SCOPE_TEST ) ); set.add( createArtifact( "g", "test", "1.0", Artifact.SCOPE_TEST ) );
set.add( createArtifact( "g", "runtime", "1.0", Artifact.SCOPE_RUNTIME ) ); set.add( createArtifact( "g", "runtime", "1.0", Artifact.SCOPE_RUNTIME ) );
set.add( createArtifact( "g", "system", "1.0", Artifact.SCOPE_SYSTEM ) ); set.add( createArtifact( "g", "system", "1.0", Artifact.SCOPE_SYSTEM ) );
return set; return set;
} }
public Set getTypedArtifacts() public Set getTypedArtifacts()
throws IOException throws IOException
{ {
Set set = new HashSet(); Set set = new HashSet();
set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) ); set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) );
set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) ); set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) );
set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "sources", null ) ); set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "sources", null ) );
set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) ); set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) );
set.add( createArtifact( "g", "e", "1.0", Artifact.SCOPE_COMPILE, "rar", null ) ); set.add( createArtifact( "g", "e", "1.0", Artifact.SCOPE_COMPILE, "rar", null ) );
return set; return set;
} }
public Set getClassifiedArtifacts() public Set getClassifiedArtifacts()
throws IOException throws IOException
{ {
Set set = new HashSet(); Set set = new HashSet();
set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "jar", "one" ) ); set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "jar", "one" ) );
set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", "two" ) ); set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", "two" ) );
set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "jar", "three" ) ); set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "jar", "three" ) );
set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "jar", "four" ) ); set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "jar", "four" ) );
return set; return set;
} }
public Set getTypedArchiveArtifacts() public Set getTypedArchiveArtifacts()
throws IOException throws IOException
{ {
Set set = new HashSet(); Set set = new HashSet();
set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) ); set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) );
set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) ); set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) );
set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) ); set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) );
set.add( createArtifact( "g", "e", "1.0", Artifact.SCOPE_COMPILE, "rar", null ) ); set.add( createArtifact( "g", "e", "1.0", Artifact.SCOPE_COMPILE, "rar", null ) );
return set; return set;
} }
public Set getArtifactArtifacts() public Set getArtifactArtifacts()
throws IOException throws IOException
{ {
Set set = new HashSet(); Set set = new HashSet();
set.add( createArtifact( "g", "one", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "g", "one", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
set.add( createArtifact( "g", "two", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "g", "two", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
set.add( createArtifact( "g", "three", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "g", "three", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
set.add( createArtifact( "g", "four", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "g", "four", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
return set; return set;
} }
public Set getGroupIdArtifacts() public Set getGroupIdArtifacts()
throws IOException throws IOException
{ {
Set set = new HashSet(); Set set = new HashSet();
set.add( createArtifact( "one", "group-one", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "one", "group-one", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
set.add( createArtifact( "two", "group-two", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "two", "group-two", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
set.add( createArtifact( "three", "group-three", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "three", "group-three", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
set.add( createArtifact( "four", "group-four", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "four", "group-four", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
return set; return set;
} }
public Set getMixedArtifacts() public Set getMixedArtifacts()
throws IOException throws IOException
{ {
Set set = new HashSet(); Set set = new HashSet();
set.addAll( getTypedArtifacts() ); set.addAll( getTypedArtifacts() );
set.addAll( getScopedArtifacts() ); set.addAll( getScopedArtifacts() );
set.addAll( getReleaseAndSnapshotArtifacts() ); set.addAll( getReleaseAndSnapshotArtifacts() );
return set; return set;
} }
/** /**
* @return Returns the createFiles. * @return Returns the createFiles.
*/ */
public boolean isCreateFiles() public boolean isCreateFiles()
{ {
return this.createFiles; return this.createFiles;
} }
/** /**
* @param createFiles The createFiles to set. * @param createFiles The createFiles to set.
*/ */
public void setCreateFiles( boolean createFiles ) public void setCreateFiles( boolean createFiles )
{ {
this.createFiles = createFiles; this.createFiles = createFiles;
} }
/** /**
* @return Returns the workingDir. * @return Returns the workingDir.
*/ */
public File getWorkingDir() public File getWorkingDir()
{ {
return this.workingDir; return this.workingDir;
} }
/** /**
* @param workingDir The workingDir to set. * @param workingDir The workingDir to set.
*/ */
public void setWorkingDir( File workingDir ) public void setWorkingDir( File workingDir )
{ {
this.workingDir = workingDir; this.workingDir = workingDir;
} }
/** /**
* @return Returns the srcFile. * @return Returns the srcFile.
*/ */
public File getSrcFile() public File getSrcFile()
{ {
return this.srcFile; return this.srcFile;
} }
/** /**
* @param srcFile The srcFile to set. * @param srcFile The srcFile to set.
*/ */
public void setSrcFile( File srcFile ) public void setSrcFile( File srcFile )
{ {
this.srcFile = srcFile; this.srcFile = srcFile;
} }
/** /**
* convience method to set values to variables in objects that don't have setters * convience method to set values to variables in objects that don't have setters
* *
* @param object * @param object
* @param variable * @param variable
* @param value * @param value
* @throws IllegalAccessException * @throws IllegalAccessException
*/ */
public static void setVariableValueToObject( Object object, String variable, Object value ) public static void setVariableValueToObject( Object object, String variable, Object value )
throws IllegalAccessException throws IllegalAccessException
{ {
Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses( variable, object.getClass() ); Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses( variable, object.getClass() );
field.setAccessible( true ); field.setAccessible( true );
field.set( object, value ); field.set( object, value );
} }
/** /**
* Builds the file name. If removeVersion is set, then the file name must be reconstructed from the artifactId, * Builds the file name. If removeVersion is set, then the file name must be reconstructed from the artifactId,
* Classifier (if used) and Type. Otherwise, this method returns the artifact file name. * Classifier (if used) and Type. Otherwise, this method returns the artifact file name.
* *
* @param artifact File to be formatted. * @param artifact File to be formatted.
* @param removeVersion Specifies if the version should be removed from the file name. * @param removeVersion Specifies if the version should be removed from the file name.
* @return Formatted file name in the format artifactId-[version]-[classifier].[type] * @return Formatted file name in the format artifactId-[version]-[classifier].[type]
*/ */
public static String getFormattedFileName( Artifact artifact, boolean removeVersion ) public static String getFormattedFileName( Artifact artifact, boolean removeVersion )
{ {
String destFileName = null; String destFileName = null;
// if there is a file and we aren't stripping the version, just get the // if there is a file and we aren't stripping the version, just get the
// name directly // name directly
if ( artifact.getFile() != null && !removeVersion ) if ( artifact.getFile() != null && !removeVersion )
{ {
destFileName = artifact.getFile().getName(); destFileName = artifact.getFile().getName();
} }
else else
// if offline // if offline
{ {
String versionString = null; String versionString = null;
if ( !removeVersion ) if ( !removeVersion )
{ {
versionString = "-" + artifact.getVersion(); versionString = "-" + artifact.getVersion();
} }
else else
{ {
versionString = ""; versionString = "";
} }
String classifierString = ""; String classifierString = "";
if ( StringUtils.isNotEmpty( artifact.getClassifier() ) ) if ( StringUtils.isNotEmpty( artifact.getClassifier() ) )
{ {
classifierString = "-" + artifact.getClassifier(); classifierString = "-" + artifact.getClassifier();
} }
destFileName = destFileName =
artifact.getArtifactId() + versionString + classifierString + "." + artifact.getArtifactId() + versionString + classifierString + "." +
artifact.getArtifactHandler().getExtension(); artifact.getArtifactHandler().getExtension();
} }
return destFileName; return destFileName;
} }
} }

View File

@ -1,328 +1,328 @@
package org.apache.maven.plugin.testing; package org.apache.maven.plugin.testing;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugin.logging.Log;
import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.Logger;
/** /**
* This logger implements both types of logs currently in use. It can be injected where needed * This logger implements both types of logs currently in use. It can be injected where needed
* to turn off logs during testing where they aren't desired. * to turn off logs during testing where they aren't desired.
* *
* @author <a href="mailto:brianf@apache.org">Brian Fox</a> * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id: SilentLog.java 546355 2007-06-12 02:00:02Z brianf $ * @version $Id$
*/ */
public class SilentLog public class SilentLog
implements Log, Logger implements Log, Logger
{ {
/** /**
* @return <code>false</code> * @return <code>false</code>
* @see org.apache.maven.plugin.logging.Log#isDebugEnabled() * @see org.apache.maven.plugin.logging.Log#isDebugEnabled()
*/ */
public boolean isDebugEnabled() public boolean isDebugEnabled()
{ {
return false; return false;
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence) * @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence)
*/ */
public void debug( CharSequence content ) public void debug( CharSequence content )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence, java.lang.Throwable) * @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence, java.lang.Throwable)
*/ */
public void debug( CharSequence content, Throwable error ) public void debug( CharSequence content, Throwable error )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#debug(java.lang.Throwable) * @see org.apache.maven.plugin.logging.Log#debug(java.lang.Throwable)
*/ */
public void debug( Throwable error ) public void debug( Throwable error )
{ {
// nop // nop
} }
/** /**
* @return <code>false</code> * @return <code>false</code>
* @see org.apache.maven.plugin.logging.Log#isInfoEnabled() * @see org.apache.maven.plugin.logging.Log#isInfoEnabled()
*/ */
public boolean isInfoEnabled() public boolean isInfoEnabled()
{ {
return false; return false;
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence) * @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence)
*/ */
public void info( CharSequence content ) public void info( CharSequence content )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence, java.lang.Throwable) * @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence, java.lang.Throwable)
*/ */
public void info( CharSequence content, Throwable error ) public void info( CharSequence content, Throwable error )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#info(java.lang.Throwable) * @see org.apache.maven.plugin.logging.Log#info(java.lang.Throwable)
*/ */
public void info( Throwable error ) public void info( Throwable error )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#isWarnEnabled() * @see org.apache.maven.plugin.logging.Log#isWarnEnabled()
*/ */
public boolean isWarnEnabled() public boolean isWarnEnabled()
{ {
// nop // nop
return false; return false;
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence) * @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence)
*/ */
public void warn( CharSequence content ) public void warn( CharSequence content )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence, java.lang.Throwable) * @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence, java.lang.Throwable)
*/ */
public void warn( CharSequence content, Throwable error ) public void warn( CharSequence content, Throwable error )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#warn(java.lang.Throwable) * @see org.apache.maven.plugin.logging.Log#warn(java.lang.Throwable)
*/ */
public void warn( Throwable error ) public void warn( Throwable error )
{ {
// nop // nop
} }
/** /**
* @return <code>false</code> * @return <code>false</code>
* @see org.apache.maven.plugin.logging.Log#isErrorEnabled() * @see org.apache.maven.plugin.logging.Log#isErrorEnabled()
*/ */
public boolean isErrorEnabled() public boolean isErrorEnabled()
{ {
return false; return false;
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence) * @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence)
*/ */
public void error( CharSequence content ) public void error( CharSequence content )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence, java.lang.Throwable) * @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence, java.lang.Throwable)
*/ */
public void error( CharSequence content, Throwable error ) public void error( CharSequence content, Throwable error )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.plugin.logging.Log#error(java.lang.Throwable) * @see org.apache.maven.plugin.logging.Log#error(java.lang.Throwable)
*/ */
public void error( Throwable error ) public void error( Throwable error )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#debug(java.lang.String) * @see org.codehaus.plexus.logging.Logger#debug(java.lang.String)
*/ */
public void debug( String message ) public void debug( String message )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#debug(java.lang.String, java.lang.Throwable) * @see org.codehaus.plexus.logging.Logger#debug(java.lang.String, java.lang.Throwable)
*/ */
public void debug( String message, Throwable throwable ) public void debug( String message, Throwable throwable )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#info(java.lang.String) * @see org.codehaus.plexus.logging.Logger#info(java.lang.String)
*/ */
public void info( String message ) public void info( String message )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#info(java.lang.String, java.lang.Throwable) * @see org.codehaus.plexus.logging.Logger#info(java.lang.String, java.lang.Throwable)
*/ */
public void info( String message, Throwable throwable ) public void info( String message, Throwable throwable )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#warn(java.lang.String) * @see org.codehaus.plexus.logging.Logger#warn(java.lang.String)
*/ */
public void warn( String message ) public void warn( String message )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#warn(java.lang.String, java.lang.Throwable) * @see org.codehaus.plexus.logging.Logger#warn(java.lang.String, java.lang.Throwable)
*/ */
public void warn( String message, Throwable throwable ) public void warn( String message, Throwable throwable )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#error(java.lang.String) * @see org.codehaus.plexus.logging.Logger#error(java.lang.String)
*/ */
public void error( String message ) public void error( String message )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#error(java.lang.String, java.lang.Throwable) * @see org.codehaus.plexus.logging.Logger#error(java.lang.String, java.lang.Throwable)
*/ */
public void error( String message, Throwable throwable ) public void error( String message, Throwable throwable )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#fatalError(java.lang.String) * @see org.codehaus.plexus.logging.Logger#fatalError(java.lang.String)
*/ */
public void fatalError( String message ) public void fatalError( String message )
{ {
// nop // nop
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.codehaus.plexus.logging.Logger#fatalError(java.lang.String, java.lang.Throwable) * @see org.codehaus.plexus.logging.Logger#fatalError(java.lang.String, java.lang.Throwable)
*/ */
public void fatalError( String message, Throwable throwable ) public void fatalError( String message, Throwable throwable )
{ {
// nop // nop
} }
/** /**
* @return <code>false</code> * @return <code>false</code>
* @see org.codehaus.plexus.logging.Logger#isFatalErrorEnabled() * @see org.codehaus.plexus.logging.Logger#isFatalErrorEnabled()
*/ */
public boolean isFatalErrorEnabled() public boolean isFatalErrorEnabled()
{ {
return false; return false;
} }
/** /**
* @return <code>null</code> * @return <code>null</code>
* @see org.codehaus.plexus.logging.Logger#getChildLogger(java.lang.String) * @see org.codehaus.plexus.logging.Logger#getChildLogger(java.lang.String)
*/ */
public Logger getChildLogger( String name ) public Logger getChildLogger( String name )
{ {
return null; return null;
} }
/** /**
* @return <code>0</code> * @return <code>0</code>
* @see org.codehaus.plexus.logging.Logger#getThreshold() * @see org.codehaus.plexus.logging.Logger#getThreshold()
*/ */
public int getThreshold() public int getThreshold()
{ {
return 0; return 0;
} }
/** /**
* @return <code>null</code> * @return <code>null</code>
* @see org.codehaus.plexus.logging.Logger#getName() * @see org.codehaus.plexus.logging.Logger#getName()
*/ */
public String getName() public String getName()
{ {
return null; return null;
} }
} }

View File

@ -1,210 +1,210 @@
package org.apache.maven.plugin.testing.stubs; package org.apache.maven.plugin.testing.stubs;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.ArtifactHandler;
/** /**
* Minimal artifact handler used by the stub factory to create unpackable archives. * Minimal artifact handler used by the stub factory to create unpackable archives.
* *
* @author <a href="mailto:brianf@apache.org">Brian Fox</a> * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id: $ * @version $Id$
*/ */
public class DefaultArtifactHandlerStub public class DefaultArtifactHandlerStub
implements ArtifactHandler implements ArtifactHandler
{ {
private String extension; private String extension;
private String type; private String type;
private String classifier; private String classifier;
private String directory; private String directory;
private String packaging; private String packaging;
private boolean includesDependencies; private boolean includesDependencies;
private String language; private String language;
private boolean addedToClasspath; private boolean addedToClasspath;
/** /**
* @param t the artifact handler type * @param t the artifact handler type
* @param c the artifact handler classifier * @param c the artifact handler classifier
*/ */
public DefaultArtifactHandlerStub( String t, String c ) public DefaultArtifactHandlerStub( String t, String c )
{ {
type = t; type = t;
classifier = c; classifier = c;
if ( t.equals( "test-jar" ) ) if ( t.equals( "test-jar" ) )
{ {
extension = "jar"; extension = "jar";
} }
} }
/** /**
* @param t the artifact handler type * @param t the artifact handler type
*/ */
public DefaultArtifactHandlerStub( String type ) public DefaultArtifactHandlerStub( String type )
{ {
this.type = type; this.type = type;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public String getExtension() public String getExtension()
{ {
if ( extension == null ) if ( extension == null )
{ {
extension = type; extension = type;
} }
return extension; return extension;
} }
/** /**
* @return the artifact handler type * @return the artifact handler type
*/ */
public String getType() public String getType()
{ {
return type; return type;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public String getClassifier() public String getClassifier()
{ {
return classifier; return classifier;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public String getDirectory() public String getDirectory()
{ {
if ( directory == null ) if ( directory == null )
{ {
directory = getPackaging() + "s"; directory = getPackaging() + "s";
} }
return directory; return directory;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public String getPackaging() public String getPackaging()
{ {
if ( packaging == null ) if ( packaging == null )
{ {
packaging = type; packaging = type;
} }
return packaging; return packaging;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public boolean isIncludesDependencies() public boolean isIncludesDependencies()
{ {
return includesDependencies; return includesDependencies;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public String getLanguage() public String getLanguage()
{ {
if ( language == null ) if ( language == null )
{ {
language = "none"; language = "none";
} }
return language; return language;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public boolean isAddedToClasspath() public boolean isAddedToClasspath()
{ {
return addedToClasspath; return addedToClasspath;
} }
/** /**
* @param theAddedToClasspath * @param theAddedToClasspath
* The addedToClasspath to set. * The addedToClasspath to set.
*/ */
public void setAddedToClasspath( boolean theAddedToClasspath ) public void setAddedToClasspath( boolean theAddedToClasspath )
{ {
this.addedToClasspath = theAddedToClasspath; this.addedToClasspath = theAddedToClasspath;
} }
/** /**
* @param theClassifier * @param theClassifier
* The classifier to set. * The classifier to set.
*/ */
public void setClassifier( String theClassifier ) public void setClassifier( String theClassifier )
{ {
this.classifier = theClassifier; this.classifier = theClassifier;
} }
/** /**
* @param theDirectory * @param theDirectory
* The directory to set. * The directory to set.
*/ */
public void setDirectory( String theDirectory ) public void setDirectory( String theDirectory )
{ {
this.directory = theDirectory; this.directory = theDirectory;
} }
/** /**
* @param theExtension * @param theExtension
* The extension to set. * The extension to set.
*/ */
public void setExtension( String theExtension ) public void setExtension( String theExtension )
{ {
this.extension = theExtension; this.extension = theExtension;
} }
/** /**
* @param theIncludesDependencies * @param theIncludesDependencies
* The includesDependencies to set. * The includesDependencies to set.
*/ */
public void setIncludesDependencies( boolean theIncludesDependencies ) public void setIncludesDependencies( boolean theIncludesDependencies )
{ {
this.includesDependencies = theIncludesDependencies; this.includesDependencies = theIncludesDependencies;
} }
/** /**
* @param theLanguage * @param theLanguage
* The language to set. * The language to set.
*/ */
public void setLanguage( String theLanguage ) public void setLanguage( String theLanguage )
{ {
this.language = theLanguage; this.language = theLanguage;
} }
/** /**
* @param thePackaging * @param thePackaging
* The packaging to set. * The packaging to set.
*/ */
public void setPackaging( String thePackaging ) public void setPackaging( String thePackaging )
{ {
this.packaging = thePackaging; this.packaging = thePackaging;
} }
/** /**
* @param theType * @param theType
* The type to set. * The type to set.
*/ */
public void setType( String theType ) public void setType( String theType )
{ {
this.type = theType; this.type = theType;
} }
} }

View File

@ -1,89 +1,89 @@
package org.apache.maven.plugin.testing.stubs; package org.apache.maven.plugin.testing.stubs;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactCollector; import org.apache.maven.artifact.resolver.ArtifactCollector;
import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.artifact.resolver.ResolutionNode;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
/** /**
* @author <a href="mailto:brianf@apache.org">Brian Fox</a> * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id: $ * @version $Id$
*/ */
public class StubArtifactCollector public class StubArtifactCollector
implements ArtifactCollector implements ArtifactCollector
{ {
/** /**
* Default constructor * Default constructor
*/ */
public StubArtifactCollector() public StubArtifactCollector()
{ {
super(); super();
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public ArtifactResolutionResult collect( Set theArtifacts, Artifact theOriginatingArtifact, public ArtifactResolutionResult collect( Set theArtifacts, Artifact theOriginatingArtifact,
ArtifactRepository theLocalRepository, List theRemoteRepositories, ArtifactRepository theLocalRepository, List theRemoteRepositories,
ArtifactMetadataSource theSource, ArtifactFilter theFilter, ArtifactMetadataSource theSource, ArtifactFilter theFilter,
List theListeners ) List theListeners )
throws ArtifactResolutionException throws ArtifactResolutionException
{ {
Set nodes = new HashSet(); Set nodes = new HashSet();
ArtifactResolutionResult arr = new ArtifactResolutionResult(); ArtifactResolutionResult arr = new ArtifactResolutionResult();
Iterator iter = theArtifacts.iterator(); Iterator iter = theArtifacts.iterator();
while ( iter.hasNext() ) while ( iter.hasNext() )
{ {
nodes.add( new ResolutionNode( (Artifact) iter.next(), theRemoteRepositories ) ); nodes.add( new ResolutionNode( (Artifact) iter.next(), theRemoteRepositories ) );
} }
arr.setArtifactResolutionNodes( nodes ); arr.setArtifactResolutionNodes( nodes );
return arr; return arr;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public ArtifactResolutionResult collect( Set theArtifacts, Artifact theOriginatingArtifact, Map theManagedVersions, public ArtifactResolutionResult collect( Set theArtifacts, Artifact theOriginatingArtifact, Map theManagedVersions,
ArtifactRepository theLocalRepository, List theRemoteRepositories, ArtifactRepository theLocalRepository, List theRemoteRepositories,
ArtifactMetadataSource theSource, ArtifactFilter theFilter, ArtifactMetadataSource theSource, ArtifactFilter theFilter,
List theListeners ) List theListeners )
throws ArtifactResolutionException throws ArtifactResolutionException
{ {
Set nodes = new HashSet(); Set nodes = new HashSet();
ArtifactResolutionResult arr = new ArtifactResolutionResult(); ArtifactResolutionResult arr = new ArtifactResolutionResult();
Iterator iter = theArtifacts.iterator(); Iterator iter = theArtifacts.iterator();
while ( iter.hasNext() ) while ( iter.hasNext() )
{ {
nodes.add( new ResolutionNode( (Artifact) iter.next(), theRemoteRepositories ) ); nodes.add( new ResolutionNode( (Artifact) iter.next(), theRemoteRepositories ) );
} }
arr.setArtifactResolutionNodes( nodes ); arr.setArtifactResolutionNodes( nodes );
return arr; return arr;
} }
} }

View File

@ -1,173 +1,173 @@
package org.apache.maven.plugin.testing.stubs; package org.apache.maven.plugin.testing.stubs;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
/** /**
* @author <a href="mailto:brianf@apache.org">Brian Fox</a> * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id: $ * @version $Id$
*/ */
public class StubArtifactRepository public class StubArtifactRepository
implements ArtifactRepository implements ArtifactRepository
{ {
String baseDir = null; String baseDir = null;
/** /**
* Default constructor * Default constructor
* *
* @param dir the basedir * @param dir the basedir
*/ */
public StubArtifactRepository( String dir ) public StubArtifactRepository( String dir )
{ {
baseDir = dir; baseDir = dir;
} }
/** /**
* @return the <code>artifactId</code>. * @return the <code>artifactId</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#pathOf(org.apache.maven.artifact.Artifact) * @see org.apache.maven.artifact.repository.ArtifactRepository#pathOf(org.apache.maven.artifact.Artifact)
*/ */
public String pathOf( Artifact artifact ) public String pathOf( Artifact artifact )
{ {
return artifact.getId(); return artifact.getId();
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#pathOfRemoteRepositoryMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata) * @see org.apache.maven.artifact.repository.ArtifactRepository#pathOfRemoteRepositoryMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata)
*/ */
public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata ) public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
{ {
return null; return null;
} }
/** /**
* @return the filename of this metadata on the local repository. * @return the filename of this metadata on the local repository.
* @see org.apache.maven.artifact.repository.ArtifactRepository#pathOfLocalRepositoryMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata, org.apache.maven.artifact.repository.ArtifactRepository) * @see org.apache.maven.artifact.repository.ArtifactRepository#pathOfLocalRepositoryMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata, org.apache.maven.artifact.repository.ArtifactRepository)
*/ */
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
{ {
return metadata.getLocalFilename( repository ); return metadata.getLocalFilename( repository );
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#getUrl() * @see org.apache.maven.artifact.repository.ArtifactRepository#getUrl()
*/ */
public String getUrl() public String getUrl()
{ {
return null; return null;
} }
/** /**
* @return <code>basedir</code>. * @return <code>basedir</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#getBasedir() * @see org.apache.maven.artifact.repository.ArtifactRepository#getBasedir()
*/ */
public String getBasedir() public String getBasedir()
{ {
return baseDir; return baseDir;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#getProtocol() * @see org.apache.maven.artifact.repository.ArtifactRepository#getProtocol()
*/ */
public String getProtocol() public String getProtocol()
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#getId() * @see org.apache.maven.artifact.repository.ArtifactRepository#getId()
*/ */
public String getId() public String getId()
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#getSnapshots() * @see org.apache.maven.artifact.repository.ArtifactRepository#getSnapshots()
*/ */
public ArtifactRepositoryPolicy getSnapshots() public ArtifactRepositoryPolicy getSnapshots()
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#getReleases() * @see org.apache.maven.artifact.repository.ArtifactRepository#getReleases()
*/ */
public ArtifactRepositoryPolicy getReleases() public ArtifactRepositoryPolicy getReleases()
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#getLayout() * @see org.apache.maven.artifact.repository.ArtifactRepository#getLayout()
*/ */
public ArtifactRepositoryLayout getLayout() public ArtifactRepositoryLayout getLayout()
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#getKey() * @see org.apache.maven.artifact.repository.ArtifactRepository#getKey()
*/ */
public String getKey() public String getKey()
{ {
return null; return null;
} }
/** /**
* @return <code>false</code>. * @return <code>false</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#isUniqueVersion() * @see org.apache.maven.artifact.repository.ArtifactRepository#isUniqueVersion()
*/ */
public boolean isUniqueVersion() public boolean isUniqueVersion()
{ {
return false; return false;
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.artifact.repository.ArtifactRepository#setBlacklisted(boolean) * @see org.apache.maven.artifact.repository.ArtifactRepository#setBlacklisted(boolean)
*/ */
public void setBlacklisted( boolean blackListed ) public void setBlacklisted( boolean blackListed )
{ {
// nop // nop
} }
/** /**
* @return <code>false</code>. * @return <code>false</code>.
* @see org.apache.maven.artifact.repository.ArtifactRepository#isBlacklisted() * @see org.apache.maven.artifact.repository.ArtifactRepository#isBlacklisted()
*/ */
public boolean isBlacklisted() public boolean isBlacklisted()
{ {
return false; return false;
} }
} }

View File

@ -1,188 +1,188 @@
package org.apache.maven.plugin.testing.stubs; package org.apache.maven.plugin.testing.stubs;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.plugin.testing.ArtifactStubFactory; import org.apache.maven.plugin.testing.ArtifactStubFactory;
/** /**
* Stub resolver. The constructor allows the specification of the exception to throw so that handling can be tested too. * Stub resolver. The constructor allows the specification of the exception to throw so that handling can be tested too.
* *
* @author <a href="mailto:brianf@apache.org">Brian Fox</a> * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id: $ * @version $Id$
*/ */
public class StubArtifactResolver public class StubArtifactResolver
implements ArtifactResolver implements ArtifactResolver
{ {
boolean throwArtifactResolutionException; boolean throwArtifactResolutionException;
boolean throwArtifactNotFoundException; boolean throwArtifactNotFoundException;
ArtifactStubFactory factory; ArtifactStubFactory factory;
/** /**
* Default constructor * Default constructor
* *
* @param factory * @param factory
* @param throwArtifactResolutionException * @param throwArtifactResolutionException
* @param throwArtifactNotFoundException * @param throwArtifactNotFoundException
*/ */
public StubArtifactResolver( ArtifactStubFactory factory, boolean throwArtifactResolutionException, public StubArtifactResolver( ArtifactStubFactory factory, boolean throwArtifactResolutionException,
boolean throwArtifactNotFoundException ) boolean throwArtifactNotFoundException )
{ {
this.throwArtifactNotFoundException = throwArtifactNotFoundException; this.throwArtifactNotFoundException = throwArtifactNotFoundException;
this.throwArtifactResolutionException = throwArtifactResolutionException; this.throwArtifactResolutionException = throwArtifactResolutionException;
this.factory = factory; this.factory = factory;
} }
/* /*
* Creates dummy file and sets it in the artifact to simulate resolution * Creates dummy file and sets it in the artifact to simulate resolution
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.apache.maven.artifact.resolver.ArtifactResolver#resolve(org.apache.maven.artifact.Artifact, * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolve(org.apache.maven.artifact.Artifact,
* java.util.List, * java.util.List,
* org.apache.maven.artifact.repository.ArtifactRepository) * org.apache.maven.artifact.repository.ArtifactRepository)
*/ */
public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
if ( !this.throwArtifactNotFoundException && !this.throwArtifactResolutionException ) if ( !this.throwArtifactNotFoundException && !this.throwArtifactResolutionException )
{ {
try try
{ {
if ( factory != null ) if ( factory != null )
{ {
factory.setArtifactFile( artifact, factory.getWorkingDir() ); factory.setArtifactFile( artifact, factory.getWorkingDir() );
} }
} }
catch ( IOException e ) catch ( IOException e )
{ {
throw new ArtifactResolutionException( "IOException: " + e.getMessage(), artifact, e ); throw new ArtifactResolutionException( "IOException: " + e.getMessage(), artifact, e );
} }
} }
else else
{ {
if ( throwArtifactResolutionException ) if ( throwArtifactResolutionException )
{ {
throw new ArtifactResolutionException( "Catch!", artifact ); throw new ArtifactResolutionException( "Catch!", artifact );
} }
throw new ArtifactNotFoundException( "Catch!", artifact ); throw new ArtifactNotFoundException( "Catch!", artifact );
} }
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository, org.apache.maven.artifact.metadata.ArtifactMetadataSource) * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository, org.apache.maven.artifact.metadata.ArtifactMetadataSource)
*/ */
public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
List remoteRepositories, ArtifactRepository localRepository, List remoteRepositories, ArtifactRepository localRepository,
ArtifactMetadataSource source ) ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository, org.apache.maven.artifact.metadata.ArtifactMetadataSource, java.util.List) * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository, org.apache.maven.artifact.metadata.ArtifactMetadataSource, java.util.List)
*/ */
public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
List remoteRepositories, ArtifactRepository localRepository, List remoteRepositories, ArtifactRepository localRepository,
ArtifactMetadataSource source, List listeners ) ArtifactMetadataSource source, List listeners )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter) * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter)
*/ */
public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
ArtifactRepository localRepository, List remoteRepositories, ArtifactRepository localRepository, List remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter ) ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource) * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource)
*/ */
public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
Map managedVersions, ArtifactRepository localRepository, Map managedVersions, ArtifactRepository localRepository,
List remoteRepositories, ArtifactMetadataSource source ) List remoteRepositories, ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter) * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter)
*/ */
public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
Map managedVersions, ArtifactRepository localRepository, Map managedVersions, ArtifactRepository localRepository,
List remoteRepositories, ArtifactMetadataSource source, List remoteRepositories, ArtifactMetadataSource source,
ArtifactFilter filter ) ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return null; return null;
} }
/** /**
* @return <code>null</code>. * @return <code>null</code>.
* @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter, java.util.List) * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter, java.util.List)
*/ */
public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
Map managedVersions, ArtifactRepository localRepository, Map managedVersions, ArtifactRepository localRepository,
List remoteRepositories, ArtifactMetadataSource source, List remoteRepositories, ArtifactMetadataSource source,
ArtifactFilter filter, List listeners ) ArtifactFilter filter, List listeners )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return null; return null;
} }
/** /**
* By default, do nothing. * By default, do nothing.
* *
* @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveAlways(org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository) * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveAlways(org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository)
*/ */
public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
// nop // nop
} }
} }

View File

@ -1,25 +1,25 @@
package org.apache.maven.plugin.testing; package org.apache.maven.plugin.testing;
import java.io.IOException; import java.io.IOException;
import junit.framework.TestCase; import junit.framework.TestCase;
public class ArtifactStubFactoryTest public class ArtifactStubFactoryTest
extends TestCase extends TestCase
{ {
public void testVersionChecks() throws IOException public void testVersionChecks() throws IOException
{ {
ArtifactStubFactory factory = new ArtifactStubFactory(); ArtifactStubFactory factory = new ArtifactStubFactory();
assertTrue(factory.getReleaseArtifact().isRelease()); assertTrue(factory.getReleaseArtifact().isRelease());
assertFalse(factory.getReleaseArtifact().isSnapshot()); assertFalse(factory.getReleaseArtifact().isSnapshot());
assertTrue(factory.getSnapshotArtifact().isSnapshot()); assertTrue(factory.getSnapshotArtifact().isSnapshot());
assertFalse(factory.getSnapshotArtifact().isRelease()); assertFalse(factory.getSnapshotArtifact().isRelease());
} }
public void testCreateFiles() throws IOException public void testCreateFiles() throws IOException
{ {
ArtifactStubFactory factory = new ArtifactStubFactory(); ArtifactStubFactory factory = new ArtifactStubFactory();
assertFalse(factory.isCreateFiles()); assertFalse(factory.isCreateFiles());
} }
} }

View File

@ -1,81 +1,81 @@
package org.apache.maven.plugin.testing; package org.apache.maven.plugin.testing;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugin.logging.Log;
import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.Logger;
public class TestSilentLog public class TestSilentLog
extends TestCase extends TestCase
{ {
public void testLog() public void testLog()
{ {
Log log = new SilentLog(); Log log = new SilentLog();
String text = new String( "Text" ); String text = new String( "Text" );
Throwable e = new RuntimeException(); Throwable e = new RuntimeException();
log.debug( text ); log.debug( text );
log.debug( text, e ); log.debug( text, e );
log.debug( e ); log.debug( e );
log.info( text ); log.info( text );
log.info( text, e ); log.info( text, e );
log.info( e ); log.info( e );
log.warn( text ); log.warn( text );
log.warn( text, e ); log.warn( text, e );
log.warn( e ); log.warn( e );
log.error( text ); log.error( text );
log.error( text, e ); log.error( text, e );
log.error( e ); log.error( e );
log.isDebugEnabled(); log.isDebugEnabled();
log.isErrorEnabled(); log.isErrorEnabled();
log.isWarnEnabled(); log.isWarnEnabled();
log.isInfoEnabled(); log.isInfoEnabled();
} }
public void testLogger() public void testLogger()
{ {
Logger log = new SilentLog(); Logger log = new SilentLog();
String text = new String( "Text" ); String text = new String( "Text" );
Throwable e = new RuntimeException(); Throwable e = new RuntimeException();
log.debug( text ); log.debug( text );
log.debug( text, e ); log.debug( text, e );
log.error( text ); log.error( text );
log.error( text, e ); log.error( text, e );
log.warn( text ); log.warn( text );
log.warn( text, e ); log.warn( text, e );
log.info( text ); log.info( text );
log.info( text, e ); log.info( text, e );
log.fatalError( text ); log.fatalError( text );
log.fatalError( text, e ); log.fatalError( text, e );
log.getChildLogger( text ); log.getChildLogger( text );
log.getName(); log.getName();
log.getThreshold(); log.getThreshold();
log.isDebugEnabled(); log.isDebugEnabled();
log.isErrorEnabled(); log.isErrorEnabled();
log.isFatalErrorEnabled(); log.isFatalErrorEnabled();
log.isInfoEnabled(); log.isInfoEnabled();
log.isWarnEnabled(); log.isWarnEnabled();
} }
} }