You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ar...@apache.org on 2006/04/05 05:43:30 UTC
svn commit: r391473 - in /maven/plugins/trunk/maven-install-plugin: ./
src/test/java/org/apache/maven/plugin/install/
src/test/java/org/apache/maven/plugin/install/stubs/
src/test/resources/unit/basic-install-test/target/
Author: aramirez
Date: Tue Apr 4 20:43:28 2006
New Revision: 391473
URL: http://svn.apache.org/viewcvs?rev=391473&view=rev
Log:
PR: MASSEMBLY-16
-added testing harness dependency to the pom.xml
-added packaged test project
-refactored the InstallMojoTest
-refactored the InstallArtifactStub
Added:
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/target/
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/target/maven-install-test-1.0-SNAPSHOT.jar (with props)
Modified:
maven/plugins/trunk/maven-install-plugin/pom.xml
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java
Modified: maven/plugins/trunk/maven-install-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-install-plugin/pom.xml?rev=391473&r1=391472&r2=391473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-install-plugin/pom.xml Tue Apr 4 20:43:28 2006
@@ -31,5 +31,11 @@
<artifactId>maven-artifact</artifactId>
<version>2.0</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-testing-harness</artifactId>
+ <scope>test</scope>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
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=391473&r1=391472&r2=391473&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 Tue Apr 4 20:43:28 2006
@@ -53,9 +53,14 @@
assertNotNull( mojo );
- mojo.execute();
-
- artifact = new InstallArtifactStub();
+ 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();
String groupId = artifact.getGroupId().replace( '.', '/' );
@@ -68,7 +73,7 @@
assertTrue( installedArtifact.exists() );
}
-
+ /*
public void testBasicInstallWithAttachedArtifacts()
throws Exception
{
@@ -94,9 +99,8 @@
assertTrue( installedArtifact.exists() );
}
-
-
- public void testConfiguredParamsForInstall()
+ */
+ public void testUpdateReleaseParamSetToTrue()
throws Exception
{
File testPom = new File( getBasedir(),
@@ -106,30 +110,27 @@
assertNotNull( mojo );
- mojo.execute();
-
- artifact = new InstallArtifactStub();
-
- String groupId = artifact.getGroupId().replace( '.', '/' );
+ artifact = ( InstallArtifactStub ) getVariableValueFromObject( mojo, "artifact" );
- File installedArtifact = new File( System.getProperty( "localRepository" ) + "/" +
- groupId + "/" + artifact.getArtifactId() + "/" +
- artifact.getVersion() + "/" + artifact.getArtifactId() + "-" +
- artifact.getVersion() + "." + "pom" );
+ mojo.execute();
- assertTrue( installedArtifact.exists() );
+ assertTrue( artifact.isRelease() );
}
-
+
public void testInstallIfArtifactFileIsNull()
throws Exception
{
File testPom = new File( getBasedir(),
- "target/test-classes/unit/diff-artifact-install-test/plugin-config.xml" );
+ "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 );
+
try
{
mojo.execute();
Modified: maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java?rev=391473&r1=391472&r2=391473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java Tue Apr 4 20:43:28 2006
@@ -33,6 +33,10 @@
{
private Map metadataMap;
+ private File file;
+
+ private boolean release;
+
public String getArtifactId()
{
return "maven-install-test";
@@ -53,11 +57,13 @@
return getVersion();
}
+ public void setFile( File file )
+ {
+ this.file = file;
+ }
+
public File getFile()
{
- File file = new File( System.getProperty( "basedir" ) +
- "/target/test-classes/unit/basic-install-test/plugin-config.xml" );
-
return file;
}
@@ -93,5 +99,15 @@
public Collection getMetadataList()
{
return metadataMap == null ? Collections.EMPTY_LIST : metadataMap.values();
+ }
+
+ public boolean isRelease()
+ {
+ return release;
+ }
+
+ public void setRelease( boolean release )
+ {
+ this.release = release;
}
}
Added: maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/target/maven-install-test-1.0-SNAPSHOT.jar?rev=391473&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream