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 2008/11/28 22:29:31 UTC

svn commit: r721563 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/mng-3475/ resources/mng-3475/plugin/ resources/mng-3475/project/

Author: bentmann
Date: Fri Nov 28 13:29:31 2008
New Revision: 721563

URL: http://svn.apache.org/viewvc?rev=721563&view=rev
Log:
o Moved validation logic into test controller thereby accelerating test and decoupling from production plugins

Removed:
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3475/plugin/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3475/project/
Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0092Test.java
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3475/pom.xml

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0092Test.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0092Test.java?rev=721563&r1=721562&r2=721563&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0092Test.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0092Test.java Fri Nov 28 13:29:31 2008
@@ -31,7 +31,7 @@
 {
     
     /**
-     * Test that legacy repositories with legacy snapshots download correctly.
+     * Test that legacy repositories with legacy snapshots download correctly (c.f. MNG-2068).
      */
     public void testit0092()
         throws Exception

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java?rev=721563&r1=721562&r2=721563&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java Fri Nov 28 13:29:31 2008
@@ -23,36 +23,73 @@
 import org.apache.maven.it.util.ResourceExtractor;
 
 import java.io.File;
+import java.util.Properties;
 
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3475">MNG-3475</a> and
+ * <a href="http://jira.codehaus.org/browse/MNG-1927">MNG-1927</a>.
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
 public class MavenITmng3475BaseAlignedDirTest
     extends AbstractMavenIntegrationTestCase
 {
-    
+
     public MavenITmng3475BaseAlignedDirTest()
     {
-        super( "[2.1.0-M1,)"); // 2.1.0+ only
+        super( "(2.0.1,)");
     }
 
+    /**
+     * Verify that project directories are basedir aligned when inspected by plugins.
+     */
     public void testitMNG3475()
         throws Exception
     {
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
-                                                                 "/mng-3475" );
-
-        File pluginDir = new File( testDir, "plugin" );
-        Verifier verifier = new Verifier( pluginDir.getAbsolutePath() );
-
-        verifier.executeGoal( "install" );
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3475" );
 
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoal( "validate" );
         verifier.verifyErrorFreeLog();
         verifier.resetStreams();
 
-        File projectDir = new File( testDir, "project" );
-        verifier = new Verifier( projectDir.getAbsolutePath() );
+        /*
+         * NOTE: The script source directory is deliberately excluded from the checks due to MNG-3741.
+         */
 
-        verifier.executeGoal( "validate" );
-        verifier.verifyErrorFreeLog();
-        verifier.resetStreams();
+        Properties configProps = verifier.loadProperties( "target/config.properties" );
+        Properties modelProps = verifier.loadProperties( "target/model.properties" );
+
+        assertPathEquals( testDir, "target", configProps.getProperty( "mapParam.buildDirectory" ) );
+        assertPathEquals( testDir, "target", modelProps.getProperty( "project.build.directory" ) );
+
+        assertPathEquals( testDir, "target/classes", configProps.getProperty( "mapParam.buildOutputDirectory" ) );
+        assertPathEquals( testDir, "target/classes", modelProps.getProperty( "project.build.outputDirectory" ) );
+
+        assertPathEquals( testDir, "target/test-classes", configProps.getProperty( "mapParam.buildTestOutputDirectory" ) );
+        assertPathEquals( testDir, "target/test-classes", modelProps.getProperty( "project.build.testOutputDirectory" ) );
+
+        assertPathEquals( testDir, "src/main/java", configProps.getProperty( "mapParam.buildSourceDirectory" ) );
+        assertPathEquals( testDir, "src/main/java", modelProps.getProperty( "project.build.sourceDirectory" ) );
+
+        assertPathEquals( testDir, "src/test/java", configProps.getProperty( "mapParam.buildTestSourceDirectory" ) );
+        assertPathEquals( testDir, "src/test/java", modelProps.getProperty( "project.build.testSourceDirectory" ) );
+
+        if ( matchesVersionRange( "[2.1.0-M1,)" ) )
+        {
+            assertPathEquals( testDir, "target/site", configProps.getProperty( "mapParam.reportingOutputDirectory" ) );
+            assertPathEquals( testDir, "target/site", modelProps.getProperty( "project.reporting.outputDirectory" ) );
+        }
+    }
+
+    private void assertPathEquals( File basedir, String subdir, String path )
+    {
+        File actual = new File( path );
+        assertTrue( "path not absolute: " + actual, actual.isAbsolute() );
+        assertEquals( new File( basedir, subdir ), actual );
     }
 
 }

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3475/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3475/pom.xml?rev=721563&r1=721562&r2=721563&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3475/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3475/pom.xml Fri Nov 28 13:29:31 2008
@@ -18,15 +18,76 @@
 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.mng3475</groupId>
   <artifactId>mng3475</artifactId>
   <version>1.0</version>
   <packaging>pom</packaging>
-  <name>Apache Maven: mng3475</name>
-  <modules>
-    <module>plugin</module>
-    <module>project</module>
-  </modules>
+
+  <name>Maven Integration Test :: MNG-3475</name> 
+  <description>
+    Verify that project directories are basedir aligned when inspected by plugins.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <!-- This checks the project directories retrieved via plugin configuration -->
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-configuration</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <propertiesFile>target/config.properties</propertiesFile>
+          <mapParam>
+            <buildDirectory>${project.build.directory}</buildDirectory>
+            <buildOutputDirectory>${project.build.outputDirectory}</buildOutputDirectory>
+            <buildTestOutputDirectory>${project.build.testOutputDirectory}</buildTestOutputDirectory>
+            <buildSourceDirectory>${project.build.sourceDirectory}</buildSourceDirectory>
+            <buildTestSourceDirectory>${project.build.testSourceDirectory}</buildTestSourceDirectory>
+            <buildScriptSourceDirectory>${project.build.scriptSourceDirectory}</buildScriptSourceDirectory>
+            <reportingOutputDirectory>${project.reporting.outputDirectory}</reportingOutputDirectory>
+          </mapParam>
+        </configuration>
+        <executions>
+          <execution>
+            <id>interpolated-config</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>config</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <!-- This checks the project directories as retrieved via pure MavenProjet API -->
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-expression</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <outputFile>target/model.properties</outputFile>
+          <expressions>
+            <expression>project/build/directory</expression>
+            <expression>project/build/outputDirectory</expression>
+            <expression>project/build/testOutputDirectory</expression>
+            <expression>project/build/sourceDirectory</expression>
+            <expression>project/build/testSourceDirectory</expression>
+            <expression>project/build/scriptSourceDirectory</expression>
+            <expression>project/reporting/outputDirectory</expression>
+          </expressions>
+        </configuration>
+        <executions>
+          <execution>
+            <id>effective-model</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>eval</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 </project>