You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/11/17 00:14:09 UTC
svn commit: r881038 - in
/maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test:
java/org/apache/maven/shared/test/plugin/ resources/ resources/projects/
resources/projects/basic/ resources/projects/basic/src/ resourc...
Author: bentmann
Date: Mon Nov 16 23:14:09 2009
New Revision: 881038
URL: http://svn.apache.org/viewvc?rev=881038&view=rev
Log:
o Fixed test setup to use static test POM and not the main project POM
Added:
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml (with props)
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java (with props)
Modified:
maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java
Modified: maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java
URL: http://svn.apache.org/viewvc/maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java?rev=881038&r1=881037&r2=881038&view=diff
==============================================================================
--- maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java (original)
+++ maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java Mon Nov 16 23:14:09 2009
@@ -20,6 +20,7 @@
*/
import java.io.File;
+import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
@@ -29,6 +30,7 @@
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
import org.apache.maven.shared.test.plugin.ProjectTool.PomInfo;
import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
/**
@@ -37,17 +39,29 @@
public class ProjectToolTest
extends PlexusTestCase
{
+
+ private File getPom( String test )
+ throws IOException
+ {
+ File src = new File( "src/test/resources/projects/" + test );
+ File dst = new File( "target/unit/projects/" + test );
+
+ FileUtils.copyDirectoryStructureIfModified( src, dst );
+
+ return new File( dst, "pom.xml" );
+ }
+
public void testManglePomForTesting_ShouldPopulateOutDirAndFinalName()
throws Exception
{
ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );
- File pomFile = new File( "pom.xml" );
+ File pomFile = getPom( "basic" );
PomInfo info = tool.manglePomForTesting( pomFile, "test", true );
assertEquals( "target"+File.separatorChar+"it-build-target", info.getBuildDirectory() );
- assertEquals( "maven-plugin-testing-tools-test.jar", info.getFinalName() );
+ assertEquals( "maven-it-plugin-test.jar", info.getFinalName() );
assertEquals( "target"+File.separatorChar+"it-build-target"+File.separatorChar+"classes",info.getBuildOutputDirectory() );
}
@@ -56,11 +70,11 @@
{
ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );
- File pomFile = new File( "pom.xml" );
+ File pomFile = getPom( "basic" );
MavenProject project = tool.packageProjectArtifact( pomFile, "test", true );
- String expectedPath = "target/it-build-target/maven-plugin-testing-tools-test.jar";
+ String expectedPath = "target/unit/projects/basic/target/it-build-target/maven-it-plugin-test.jar";
// be nice with windows
String actualPath = StringUtils.replace( project.getArtifact().getFile().getPath(), "\\", "/" );
@@ -73,14 +87,14 @@
{
ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );
- File pomFile = new File( "pom.xml" );
+ File pomFile = getPom( "basic" );
MavenProject project = tool.packageProjectArtifact( pomFile, "test", true );
Artifact artifact = project.getArtifact();
- assertEquals( "jar", artifact.getType() );
- assertTrue( artifact.getFile().exists() );
+ assertEquals( "maven-plugin", artifact.getType() );
+ assertTrue( "Missing " + artifact.getFile(), artifact.getFile().exists() );
Collection metadata = artifact.getMetadataList();
Added: maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml?rev=881038&view=auto
==============================================================================
--- maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml (added)
+++ maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml Mon Nov 16 23:14:09 2009
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>Maven IT Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ </dependencies>
+</project>
Propchange: maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java?rev=881038&view=auto
==============================================================================
--- maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java (added)
+++ maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java Mon Nov 16 23:14:09 2009
@@ -0,0 +1,14 @@
+import org.apache.maven.plugin.*;
+
+/**
+ * @goal it
+ */
+public class ItMojo
+ extends AbstractMojo
+{
+
+ public void execute()
+ {
+ }
+
+}
Propchange: maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-testing/branches/plugin-testing-mvn-3.x/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision