You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2008/04/03 22:56:27 UTC
svn commit: r644488 - in
/maven/core-integration-testing/trunk/core-integration-tests/src/test:
java/org/apache/maven/integrationtests/ resources/mng-3498/
resources/mng-3498/maven-mng3498-plugin/
resources/mng-3498/maven-mng3498-plugin/src/ resources/...
Author: jdcasey
Date: Thu Apr 3 13:56:26 2008
New Revision: 644488
URL: http://svn.apache.org/viewvc?rev=644488&view=rev
Log:
[MNG-3498] Adding integration test.
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MNG3498Test.java (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/pom.xml (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/CheckMojo.java (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/TouchMojo.java (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/mng-3498-project/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/mng-3498-project/pom.xml (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/readme.txt (with props)
Modified:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java?rev=644488&r1=644487&r2=644488&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Thu Apr 3 13:56:26 2008
@@ -65,6 +65,7 @@
* a fail fast technique as well.
*/
+ suite.addTestSuite( MNG3498Test.class );
suite.addTestSuite( MavenITmng3485OverrideWagonExtensionTest.class );
suite.addTestSuite( MavenITmng3473PluginReportCrash.class );
suite.addTestSuite( MavenITmng3428PluginDescriptorArtifactsIncompleteTest.class );
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MNG3498Test.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MNG3498Test.java?rev=644488&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MNG3498Test.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MNG3498Test.java Thu Apr 3 13:56:26 2008
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+package org.apache.maven.integrationtests;
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3498">MNG-3498</a>.
+ *
+ * @todo Fill in a better description of what this test verifies!
+ *
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @author jdcasey
+ *
+ */
+public class MNG3498Test
+ extends AbstractMavenIntegrationTestCase
+{
+// public MNG3498Test()
+// throws InvalidVersionSpecificationException
+// {
+// super( "(2.0.8,)" ); // only test in 2.0.9+
+// }
+
+ public void testitMNG3498 ()
+ throws Exception
+ {
+ // The testdir is computed from the location of this
+ // file.
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3498" );
+
+ File pluginDir = new File( testDir, "maven-mng3498-plugin" );
+ File projectDir = new File( testDir, "mng-3498-project" );
+
+ Verifier verifier = new Verifier( pluginDir.getAbsolutePath() );
+ verifier.deleteArtifact( "org.apache.maven.its.mng3498", "maven-mng3498-plugin", "1", "pom" );
+
+ verifier.executeGoal( "install" );
+
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ verifier = new Verifier( projectDir.getAbsolutePath() );
+
+ verifier.executeGoal( "validate" );
+
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MNG3498Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MNG3498Test.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/pom.xml?rev=644488&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/pom.xml Thu Apr 3 13:56:26 2008
@@ -0,0 +1,43 @@
+
+<!--
+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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng3498</groupId>
+ <artifactId>maven-mng3498-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <version>1</version>
+ <name>maven-mng3498-plugin Maven Mojo</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/CheckMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/CheckMojo.java?rev=644488&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/CheckMojo.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/CheckMojo.java Thu Apr 3 13:56:26 2008
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package plugin;
+
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+
+import java.io.File;
+
+/**
+ * @goal check
+ * @phase validate
+ * @execute goal="touch"
+ */
+public class CheckMojo
+ implements Mojo
+{
+
+ /**
+ * @parameter default-value="${project.build.directory}/touch.txt"
+ * @required
+ */
+ private File touchFile;
+
+ private Log log;
+
+ public void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( !touchFile.exists() )
+ {
+ throw new MojoExecutionException( "Touch file: " + touchFile + " has not been generated by forked mojo 'touch'." );
+ }
+ }
+
+ public Log getLog()
+ {
+ return log;
+ }
+
+ public void setLog( Log log )
+ {
+ this.log = log;
+ }
+
+}
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/CheckMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/CheckMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/TouchMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/TouchMojo.java?rev=644488&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/TouchMojo.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/TouchMojo.java Thu Apr 3 13:56:26 2008
@@ -0,0 +1,79 @@
+package plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Goal which touches a timestamp file.
+ *
+ * @goal touch
+ */
+public class TouchMojo
+ extends AbstractMojo
+{
+ /**
+ * Location of the file.
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private File outputDirectory;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ File f = outputDirectory;
+
+ if ( !f.exists() )
+ {
+ f.mkdirs();
+ }
+
+ File touch = new File( f, "touch.txt" );
+
+ FileWriter w = null;
+ try
+ {
+ w = new FileWriter( touch );
+
+ w.write( "touch.txt" );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error creating file " + touch, e );
+ }
+ finally
+ {
+ if ( w != null )
+ {
+ try
+ {
+ w.close();
+ }
+ catch ( IOException e )
+ {
+ // ignore
+ }
+ }
+ }
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/TouchMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/maven-mng3498-plugin/src/main/java/plugin/TouchMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/mng-3498-project/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/mng-3498-project/pom.xml?rev=644488&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/mng-3498-project/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/mng-3498-project/pom.xml Thu Apr 3 13:56:26 2008
@@ -0,0 +1,47 @@
+
+<!--
+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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng3498</groupId>
+ <artifactId>mng-3498-project</artifactId>
+ <packaging>jar</packaging>
+ <version>1</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>maven-mng3498-plugin</artifactId>
+ <version>1</version>
+ <executions>
+ <execution>
+ <id>check</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/mng-3498-project/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/mng-3498-project/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/readme.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/readme.txt?rev=644488&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/readme.txt (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/readme.txt Thu Apr 3 13:56:26 2008
@@ -0,0 +1,13 @@
+Tests mojos that fork to another mojo inside the same plugin.
+
+To run, execute the following steps:
+
+1. Build the plugin:
+
+ cd plugin
+ mvn clean install
+
+2. Build the test project:
+
+ cd project
+ mvn validte
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/readme.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3498/readme.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"