From 5fe647ba116d3afce0890a6e76b0aaf466d92ce9 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Thu, 19 Oct 2006 20:47:22 +0000 Subject: [PATCH] o adding IT it0065 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@465839 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/resources/it0065/plugin/pom.xml | 34 +++++++++ .../maven/plugin/coreit/TestBasedirMojo.java | 76 +++++++++++++++++++ .../src/test/resources/it0065/pom.xml | 22 ++++++ .../test/resources/it0065/subproject/pom.xml | 28 +++++++ .../java/org/apache/maven/it0001/Person.java | 16 ++++ .../src/main/resources/it0001.properties | 1 + .../org/apache/maven/it0001/PersonTest.java | 16 ++++ .../apache/maven/it0001/PersonThreeTest.java | 16 ++++ .../apache/maven/it0001/PersonTwoTest.java | 16 ++++ 9 files changed, 225 insertions(+) create mode 100644 maven-core-integration-tests/src/test/resources/it0065/plugin/pom.xml create mode 100644 maven-core-integration-tests/src/test/resources/it0065/plugin/src/main/java/org/apache/maven/plugin/coreit/TestBasedirMojo.java create mode 100644 maven-core-integration-tests/src/test/resources/it0065/pom.xml create mode 100644 maven-core-integration-tests/src/test/resources/it0065/subproject/pom.xml create mode 100644 maven-core-integration-tests/src/test/resources/it0065/subproject/src/main/java/org/apache/maven/it0001/Person.java create mode 100644 maven-core-integration-tests/src/test/resources/it0065/subproject/src/main/resources/it0001.properties create mode 100644 maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonTest.java create mode 100644 maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonThreeTest.java create mode 100644 maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonTwoTest.java diff --git a/maven-core-integration-tests/src/test/resources/it0065/plugin/pom.xml b/maven-core-integration-tests/src/test/resources/it0065/plugin/pom.xml new file mode 100644 index 0000000000..ad6b0e2e34 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/plugin/pom.xml @@ -0,0 +1,34 @@ + + 4.0.0 + + org.apache.maven.it + maven-core-it0065 + 1.0 + + maven-it0065-plugin + maven-plugin + 1.0-SNAPSHOT + + + org.apache.maven + maven-plugin-api + 2.0-beta-1 + jar + compile + + + junit + junit + 3.8.1 + jar + test + + + + + central + Test Repository + file:/tmp/testRepo + + + diff --git a/maven-core-integration-tests/src/test/resources/it0065/plugin/src/main/java/org/apache/maven/plugin/coreit/TestBasedirMojo.java b/maven-core-integration-tests/src/test/resources/it0065/plugin/src/main/java/org/apache/maven/plugin/coreit/TestBasedirMojo.java new file mode 100644 index 0000000000..df031c708a --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/plugin/src/main/java/org/apache/maven/plugin/coreit/TestBasedirMojo.java @@ -0,0 +1,76 @@ +package org.apache.maven.plugin.coreit; + +/* + * Copyright 2001-2004 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 test-basedir + * @phase compile + */ +public class TestBasedirMojo + extends AbstractMojo +{ + private static final int DELETE_RETRY_SLEEP_MILLIS = 10; + + /** + * @parameter expression="${basedir}/target/child-basedir" + * @required + */ + private String childBasedir; + + /** + * @parameter expression="${project.parent.basedir}/parent-basedir" + * @required + */ + private String parentBasedir; + + public void execute() + throws MojoExecutionException + { + write( new File( childBasedir ) ); + + write( new File( parentBasedir ) ); + } + + private void write( File f ) + throws MojoExecutionException + { + if ( !f.getParentFile().exists() ) + { + f.getParentFile().mkdirs(); + } + + try + { + FileWriter w = new FileWriter( f ); + + w.write( f.getPath() ); + + w.close(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error writing verification file.", e ); + } + } +} diff --git a/maven-core-integration-tests/src/test/resources/it0065/pom.xml b/maven-core-integration-tests/src/test/resources/it0065/pom.xml new file mode 100644 index 0000000000..a0e7f75898 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/pom.xml @@ -0,0 +1,22 @@ + + 4.0.0 + org.apache.maven.it + maven-core-it0065 + Test that the basedir of the parent is set correctly. + pom + 1.0 + + + junit + junit + 3.8.1 + jar + test + + + + + plugin + subproject + + diff --git a/maven-core-integration-tests/src/test/resources/it0065/subproject/pom.xml b/maven-core-integration-tests/src/test/resources/it0065/subproject/pom.xml new file mode 100644 index 0000000000..5678f2f109 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/subproject/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + + org.apache.maven.it + maven-core-it0065 + 1.0 + + maven-core-it0065-subproject + jar + 1.0 + + + + + org.apache.maven.it + maven-it0065-plugin + 1.0-SNAPSHOT + + + + test-basedir + + + + + + + diff --git a/maven-core-integration-tests/src/test/resources/it0065/subproject/src/main/java/org/apache/maven/it0001/Person.java b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/main/java/org/apache/maven/it0001/Person.java new file mode 100644 index 0000000000..613e499ae0 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/main/java/org/apache/maven/it0001/Person.java @@ -0,0 +1,16 @@ +package org.apache.maven.it0001; + +public class Person +{ + private String name; + + public void setName( String name ) + { + this.name = name; + } + + public String getName() + { + return name; + } +} diff --git a/maven-core-integration-tests/src/test/resources/it0065/subproject/src/main/resources/it0001.properties b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/main/resources/it0001.properties new file mode 100644 index 0000000000..f54f8ab106 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/main/resources/it0001.properties @@ -0,0 +1 @@ +name = jason diff --git a/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonTest.java b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonTest.java new file mode 100644 index 0000000000..80014fa03b --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonTest.java @@ -0,0 +1,16 @@ +package org.apache.maven.it0001; + +import junit.framework.TestCase; + +public class PersonTest + extends TestCase +{ + public void testPerson() + { + Person person = new Person(); + + person.setName( "foo" ); + + assertEquals( "foo", person.getName() ); + } +} diff --git a/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonThreeTest.java b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonThreeTest.java new file mode 100644 index 0000000000..f1b23a1f41 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonThreeTest.java @@ -0,0 +1,16 @@ +package org.apache.maven.it0001; + +import junit.framework.TestCase; + +public class PersonThreeTest + extends TestCase +{ + public void testPerson() + { + Person person = new Person(); + + person.setName( "foo" ); + + assertEquals( "foo", person.getName() ); + } +} diff --git a/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonTwoTest.java b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonTwoTest.java new file mode 100644 index 0000000000..ccec93c557 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0065/subproject/src/test/java/org/apache/maven/it0001/PersonTwoTest.java @@ -0,0 +1,16 @@ +package org.apache.maven.it0001; + +import junit.framework.TestCase; + +public class PersonTwoTest + extends TestCase +{ + public void testPerson() + { + Person person = new Person(); + + person.setName( "foo" ); + + assertEquals( "foo", person.getName() ); + } +}