Author: aramirez
Date: Thu Apr 6 22:41:24 2006
New Revision: 392191
URL: http://svn.apache.org/viewcvs?rev=392191&view=rev
Log:
PR: MINSTALL-17
Submitted by: Arik Kfir
-fix the tests failure when the basedir is in maven-plugins level.
Modified:
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java
Modified:
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java?rev=392191&r1=392190&r2=392191&view=diff
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
(original)
+++
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
Thu Apr 6 22:41:24 2006
@@ -76,7 +76,7 @@
mojo.execute();
- File installedArtifact = new File( LOCAL_REPO +
+ File installedArtifact = new File( getBasedir(), LOCAL_REPO +
groupId + "/" + artifactId + "/" +
version + "/" + artifactId + "-" +
version + "." + packaging );
@@ -98,7 +98,7 @@
mojo.execute();
- File installedArtifact = new File( LOCAL_REPO +
+ File installedArtifact = new File( getBasedir(), LOCAL_REPO +
groupId + "/" + artifactId + "/" +
version + "/" + artifactId + "-" +
version + "." + packaging );
@@ -107,7 +107,7 @@
assertTrue( installedArtifact.exists() );
- File installedPom = new File( LOCAL_REPO +
+ File installedPom = new File( getBasedir(), LOCAL_REPO +
groupId + "/" + artifactId + "/" +
version + "/" + artifactId + "-" +
version + "." + "pom" );
@@ -143,14 +143,14 @@
assertTrue( pomFile.exists() );
- File installedArtifact = new File( LOCAL_REPO +
+ File installedArtifact = new File( getBasedir(), LOCAL_REPO +
groupId + "/" + artifactId + "/" +
version + "/" + artifactId + "-" +
version + "." + packaging );
assertTrue( installedArtifact.exists() );
- File installedPom = new File( LOCAL_REPO +
+ File installedPom = new File( getBasedir(), LOCAL_REPO +
groupId + "/" + artifactId + "/" +
version + "/" + artifactId + "-" +
version + "." + "pom" );
@@ -177,11 +177,11 @@
mojo.execute();
- File installedPom = new File( LOCAL_REPO +
+ File installedPom = new File( getBasedir(), LOCAL_REPO +
groupId + "/" + artifactId + "/" +
version + "/" + artifactId + "-" +
- version + "." + "pom" );
-
+ version + "." + "pom" );
+
assertTrue( installedPom.exists() );
}
Modified:
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java?rev=392191&r1=392190&r2=392191&view=diff
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java
(original)
+++
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java
Thu Apr 6 22:41:24 2006
@@ -34,73 +34,73 @@
public class InstallMojoTest
extends AbstractMojoTestCase
{
-
- InstallArtifactStub artifact;
-
+
+ InstallArtifactStub artifact;
+
private final String LOCAL_REPO = "target/local-repo/";
-
+
public void setUp()
throws Exception
{
super.setUp();
-
+
System.out.println( ">>>Cleaning local repo " + getBasedir() + "/" +
LOCAL_REPO + "..." );
-
+
FileUtils.deleteDirectory( new File( getBasedir() + "/" + LOCAL_REPO )
);
}
-
+
public void testInstallTestEnvironment()
throws Exception
{
- File testPom = new File( getBasedir(),
+ File testPom = new File( getBasedir(),
"target/test-classes/unit/basic-install-test/plugin-config.xml" );
-
+
InstallMojo mojo = ( InstallMojo ) lookupMojo( "install", testPom );
-
+
assertNotNull( mojo );
}
-
+
public void testBasicInstall()
throws Exception
{
- File testPom = new File( getBasedir(),
+ File testPom = new File( getBasedir(),
"target/test-classes/unit/basic-install-test/plugin-config.xml" );
-
+
InstallMojo mojo = ( InstallMojo ) lookupMojo( "install", testPom );
-
+
assertNotNull( mojo );
- File file = new File( getBasedir(),
+ File file = new File( getBasedir(),
"target/test-classes/unit/basic-install-test/target/" +
"maven-install-test-1.0-SNAPSHOT.jar" );
-
+
artifact = ( InstallArtifactStub ) getVariableValueFromObject( mojo,
"artifact" );
-
+
artifact.setFile( file );
-
- mojo.execute();
-
+
+ mojo.execute();
+
String groupId = dotToSlashReplacer( artifact.getGroupId() );
-
+
String packaging = getVariableValueFromObject( mojo, "packaging"
).toString();
-
- File installedArtifact = new File( LOCAL_REPO +
+
+ File installedArtifact = new File( getBasedir(), LOCAL_REPO +
groupId + "/" +
artifact.getArtifactId() + "/" +
artifact.getVersion() + "/" +
artifact.getArtifactId() + "-" +
artifact.getVersion() + "." +
packaging );
assertTrue( installedArtifact.exists() );
}
-
+
public void testBasicInstallWithAttachedArtifacts()
throws Exception
{
- File testPom = new File( getBasedir(),
+ File testPom = new File( getBasedir(),
"target/test-classes/unit/basic-install-test-with-attached-artifacts/" +
"plugin-config.xml" );
-
+
InstallMojo mojo = ( InstallMojo ) lookupMojo( "install", testPom );
-
+
assertNotNull( mojo );
List attachedArtifacts = ( ArrayList ) getVariableValueFromObject(
mojo, "attachedArtifacts" );
@@ -108,67 +108,67 @@
mojo.execute();
String packaging = getVariableValueFromObject( mojo, "packaging"
).toString();
-
+
String groupId = "";
-
+
for( Iterator iter=attachedArtifacts.iterator(); iter.hasNext(); )
{
AttachedArtifactStub0 attachedArtifact = ( AttachedArtifactStub0 )
iter.next();
-
- groupId = dotToSlashReplacer( attachedArtifact.getGroupId() );
-
- File installedArtifact = new File( LOCAL_REPO +
+
+ groupId = dotToSlashReplacer( attachedArtifact.getGroupId() );
+
+ File installedArtifact = new File( getBasedir(), LOCAL_REPO +
groupId + "/" +
attachedArtifact.getArtifactId() + "/" +
attachedArtifact.getVersion() +
"/" + attachedArtifact.getArtifactId() + "-" +
attachedArtifact.getVersion() +
"." + packaging );
-
+
assertTrue( installedArtifact.exists() );
}
}
-
+
public void testUpdateReleaseParamSetToTrue()
throws Exception
{
- File testPom = new File( getBasedir(),
+ File testPom = new File( getBasedir(),
"target/test-classes/unit/configured-install-test/plugin-config.xml" );
-
+
InstallMojo mojo = ( InstallMojo ) lookupMojo( "install", testPom );
-
+
assertNotNull( mojo );
- File file = new File( getBasedir(),
-
"target/test-classes/unit/configured-install-test/target/" +
- "maven-install-test-1.0-SNAPSHOT.jar" );
-
+ File file = new File( getBasedir(),
+
"target/test-classes/unit/configured-install-test/target/" +
+ "maven-install-test-1.0-SNAPSHOT.jar" );
+
artifact = ( InstallArtifactStub ) getVariableValueFromObject( mojo,
"artifact" );
-
+
artifact.setFile( file );
mojo.execute();
- assertTrue( artifact.isRelease() );
+ assertTrue( artifact.isRelease() );
}
-
+
public void testInstallIfArtifactFileIsNull()
throws Exception
{
- File testPom = new File( getBasedir(),
+ File testPom = new File( getBasedir(),
"target/test-classes/unit/basic-install-test/plugin-config.xml" );
-
+
InstallMojo mojo = ( InstallMojo ) lookupMojo( "install", testPom );
-
+
assertNotNull( mojo );
artifact = ( InstallArtifactStub ) getVariableValueFromObject( mojo,
"artifact" );
-
- artifact.setFile( null );
-
+
+ artifact.setFile( null );
+
assertNull( artifact.getFile() );
-
+
try
{
mojo.execute();
-
+
fail( "Did not throw mojo execution exception" );
}
catch( MojoExecutionException e )
@@ -176,36 +176,36 @@
//expected
}
}
-
+
public void testInstallIfPackagingIsPom()
throws Exception
{
- File testPom = new File( getBasedir(),
+ File testPom = new File( getBasedir(),
"target/test-classes/unit/basic-install-test-packaging-pom/" +
"plugin-config.xml" );
-
+
InstallMojo mojo = ( InstallMojo ) lookupMojo( "install", testPom );
-
+
assertNotNull( mojo );
-
+
String packaging = ( String ) getVariableValueFromObject( mojo,
"packaging" );
-
+
assertEquals( "pom", packaging );
-
+
artifact = ( InstallArtifactStub ) getVariableValueFromObject( mojo,
"artifact" );
-
+
mojo.execute();
-
+
String groupId = dotToSlashReplacer( artifact.getGroupId() );
-
- File installedArtifact = new File( LOCAL_REPO +
- groupId + "/" +
artifact.getArtifactId() + "/" +
- artifact.getVersion() + "/" +
artifact.getArtifactId() + "-" +
- artifact.getVersion() + "." + "jar"
);
-
+
+ File installedArtifact = new File( getBasedir(), LOCAL_REPO +
+ groupId + "/" +
artifact.getArtifactId() + "/" +
+ artifact.getVersion() + "/" +
artifact.getArtifactId() + "-" +
+ artifact.getVersion() + "." +
"jar" );
+
assertTrue( installedArtifact.exists() );
}
-
+
private String dotToSlashReplacer( String parameter )
{
return parameter.replace( '.', '/' );