|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.maven.plugin.testing.ArtifactStubFactory
public class ArtifactStubFactory
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 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 plugins that need to simulate artifacts for unit tests.
Constructor Summary | |
---|---|
ArtifactStubFactory()
Default constructor. |
|
ArtifactStubFactory(File workingDir,
boolean createFiles)
This constructor is to be used if files are needed and to set a working dir |
Method Summary | |
---|---|
Artifact |
createArtifact(String groupId,
String artifactId,
String version)
|
Artifact |
createArtifact(String groupId,
String artifactId,
String version,
String scope)
|
Artifact |
createArtifact(String groupId,
String artifactId,
String version,
String scope,
String type,
String classifier)
|
Artifact |
createArtifact(String groupId,
String artifactId,
VersionRange versionRange,
String scope,
String type,
String classifier,
boolean optional)
|
void |
createUnpackableFile(Artifact artifact,
File destFile)
|
Set |
getArtifactArtifacts()
|
Set |
getClassifiedArtifacts()
|
static String |
getFormattedFileName(Artifact artifact,
boolean removeVersion)
Builds the file name. |
Set |
getGroupIdArtifacts()
|
Set |
getMixedArtifacts()
|
Set |
getReleaseAndSnapshotArtifacts()
|
Artifact |
getReleaseArtifact()
|
Set |
getScopedArtifacts()
|
Artifact |
getSnapshotArtifact()
|
File |
getSrcFile()
|
Set |
getTypedArchiveArtifacts()
|
Set |
getTypedArtifacts()
|
static String |
getUnpackableFileName(Artifact artifact)
|
File |
getWorkingDir()
|
boolean |
isCreateFiles()
|
void |
setArtifactFile(Artifact artifact)
|
void |
setCreateFiles(boolean createFiles)
|
void |
setSrcFile(File srcFile)
|
void |
setUnpackableFile(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager)
If set, the file will be created as a zip/jar/war with a file inside that can be checked to exist after unpacking. |
static void |
setVariableValueToObject(Object object,
String variable,
Object value)
convience method to set values to variables in objects that don't have setters |
void |
setWorkingDir(File workingDir)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArtifactStubFactory()
public ArtifactStubFactory(File workingDir, boolean createFiles)
workingDir
- createFiles
- Method Detail |
---|
public void setUnpackableFile(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager)
archiverManager
- public Artifact createArtifact(String groupId, String artifactId, String version) throws IOException
IOException
public Artifact createArtifact(String groupId, String artifactId, String version, String scope) throws IOException
IOException
public Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type, String classifier) throws IOException
IOException
public Artifact createArtifact(String groupId, String artifactId, VersionRange versionRange, String scope, String type, String classifier, boolean optional) throws IOException
IOException
public void setArtifactFile(Artifact artifact) throws IOException
IOException
public static String getUnpackableFileName(Artifact artifact)
public void createUnpackableFile(Artifact artifact, File destFile) throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException, org.codehaus.plexus.archiver.ArchiverException, IOException
org.codehaus.plexus.archiver.manager.NoSuchArchiverException
org.codehaus.plexus.archiver.ArchiverException
IOException
public Artifact getReleaseArtifact() throws IOException
IOException
public Artifact getSnapshotArtifact() throws IOException
IOException
public Set getReleaseAndSnapshotArtifacts() throws IOException
IOException
public Set getScopedArtifacts() throws IOException
IOException
public Set getTypedArtifacts() throws IOException
IOException
public Set getClassifiedArtifacts() throws IOException
IOException
public Set getTypedArchiveArtifacts() throws IOException
IOException
public Set getArtifactArtifacts() throws IOException
IOException
public Set getGroupIdArtifacts() throws IOException
IOException
public Set getMixedArtifacts() throws IOException
IOException
public boolean isCreateFiles()
public void setCreateFiles(boolean createFiles)
createFiles
- The createFiles to set.public File getWorkingDir()
public void setWorkingDir(File workingDir)
workingDir
- The workingDir to set.public File getSrcFile()
public void setSrcFile(File srcFile)
srcFile
- The srcFile to set.public static void setVariableValueToObject(Object object, String variable, Object value) throws IllegalAccessException
object
- variable
- value
-
IllegalAccessException
public static String getFormattedFileName(Artifact artifact, boolean removeVersion)
artifact
- File to be formatted.removeVersion
- Specifies if the version should be removed from the file name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |