Author: jdcasey
Date: Wed Jun  4 12:12:27 2008
New Revision: 663347

URL: http://svn.apache.org/viewvc?rev=663347&view=rev
Log:
[MNG-3530] Adding one more integration test, and renaming the directoy/unit 
test to make it more general. This new integration test concerns the 
interpolation of resource directories within the POM, before the Resource 
instances are used (as they would be by the maven-resources-plugin).

Added:
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530DynamicPOMInterpolationTest.java
      - copied, changed from r663339, 
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/
      - copied from r662909, 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/build-path/
      - copied from r663346, 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/pom-property/
      - copied from r663346, 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/mng3530/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/mng3530/ValidatePropertyMojo.java
   (with props)
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/tests/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/tests/App.java
   (with props)
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/tests/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/tests/AppTest.java
   (with props)
Removed:
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/plugin/
    
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/project/
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=663347&r1=663346&r2=663347&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
 Wed Jun  4 12:12:27 2008
@@ -67,7 +67,7 @@
 
         suite.addTestSuite( MavenITmng3581PluginUsesWagonDependency.class );
         suite.addTestSuite( MavenITmng3545ProfileDeactivation.class );
-        suite.addTestSuite( MavenITmng3530ChangedPathInterpolationTest.class );
+        suite.addTestSuite( MavenITmng3530DynamicPOMInterpolationTest.class );
         suite.addTestSuite( MavenITmng3498ForkToOtherMojoTest.class );
         suite.addTestSuite( MavenITmng3485OverrideWagonExtensionTest.class );
         suite.addTestSuite( MavenITmng3482DependencyPomInterpolationTest.class 
);

Copied: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530DynamicPOMInterpolationTest.java
 (from r663339, 
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java)
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530DynamicPOMInterpolationTest.java?p2=maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530DynamicPOMInterpolationTest.java&p1=maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java&r1=663339&r2=663347&rev=663347&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java
 (original)
+++ 
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530DynamicPOMInterpolationTest.java
 Wed Jun  4 12:12:27 2008
@@ -28,20 +28,18 @@
 /**
  * This is a test set for <a 
href="http://jira.codehaus.org/browse/MNG-3530";>MNG-3530</a>.
  *
- * Tests that a modification by one plugin of the project.build.directory (in 
the project instance)
- * will be reflected in the value given to subsequent plugins that use 
${project.build.directory}
- * in their configuration sections within the POM. If the changes are not 
propagated,
- * it represents an inconsistency between the project instance and the plugin 
configuration,
- * which is meant to reference that instance's state.
+ * Contains various tests for dynamism of interpolation expressions within the 
POM.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
  * @author jdcasey
  *
  */
-public class MavenITmng3530ChangedPathInterpolationTest
+public class MavenITmng3530DynamicPOMInterpolationTest
     extends AbstractMavenIntegrationTestCase
 {
-    public MavenITmng3530ChangedPathInterpolationTest()
+    private static final String BASEDIR = "/mng-3530-dynamicPOMInterpolation/";
+
+    public MavenITmng3530DynamicPOMInterpolationTest()
         throws InvalidVersionSpecificationException
     {
         super( "(2.0.9,)" ); // only test in 2.0.9+
@@ -50,8 +48,7 @@
     public void testitMNG3530_BuildPath()
         throws Exception
     {
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
-                                                                 
"/mng-3530-changedPathInterpolation/build-path" );
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
BASEDIR + "build-path" );
         File pluginDir = new File( testDir, "plugin" );
         File projectDir = new File( testDir, "project" );
 
@@ -77,15 +74,15 @@
     public void testitMNG3530_POMProperty()
         throws Exception
     {
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
-                                                                 
"/mng-3530-changedPathInterpolation/pom-property" );
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
BASEDIR
+                                                                             + 
"pom-property" );
         File pluginDir = new File( testDir, "plugin" );
         File projectDir = new File( testDir, "project" );
 
-        // First, install the plugin that modifies the project.build.directory 
and
+        // First, install the plugin that modifies the myDirectory and
         // validates that the modification propagated into the validation-mojo
         // configuration. Once this is installed, we can run a project build 
that
-        // uses it to see how Maven will respond to a modification in the 
project build directory.
+        // uses it to see how Maven will respond to a modification in the POM 
property.
         Verifier verifier = new Verifier( pluginDir.getAbsolutePath() );
         verifier.executeGoal( "install" );
 
@@ -93,7 +90,32 @@
         verifier.resetStreams();
 
         // Now, build the project. If the plugin configuration doesn't 
recognize
-        // the update to the project.build.directory, it will fail the build.
+        // the update to the myDirectory, it will fail the build.
+        verifier = new Verifier( projectDir.getAbsolutePath() );
+
+        verifier.executeGoal( "package" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+    }
+
+    public void testitMNG3530_ResourceDirectoryInterpolation()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
BASEDIR
+                                                                             + 
"resource-object" );
+        File pluginDir = new File( testDir, "plugin" );
+        File projectDir = new File( testDir, "project" );
+
+        // First, install the plugin which validates that all resource 
directory
+        // specifications have been interpolated.
+        Verifier verifier = new Verifier( pluginDir.getAbsolutePath() );
+        verifier.executeGoal( "install" );
+
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        // Now, build the project. If the plugin finds an uninterpolated 
resource
+        // directory, it will fail the build.
         verifier = new Verifier( projectDir.getAbsolutePath() );
 
         verifier.executeGoal( "package" );

Added: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/pom.xml?rev=663347&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/pom.xml
 Wed Jun  4 12:12:27 2008
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.its.mng3530</groupId>
+  <artifactId>resource-object-maven-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>1</version>
+  <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>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/mng3530/ValidatePropertyMojo.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/mng3530/ValidatePropertyMojo.java?rev=663347&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/mng3530/ValidatePropertyMojo.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/mng3530/ValidatePropertyMojo.java
 Wed Jun  4 12:12:27 2008
@@ -0,0 +1,57 @@
+package mng3530;
+
+import org.apache.maven.model.Resource;
+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.util.Iterator;
+import java.util.List;
+
+/**
+ * Validate that the current project's [EMAIL PROTECTED] Resource} instances 
don't contain
+ * uninterpolated expressions.
+ *
+ * @goal validate
+ * @phase package
+ */
+public class ValidatePropertyMojo
+    implements Mojo
+{
+
+    /**
+     * @parameter default-value="${project.resources}"
+     * @readonly
+     */
+    private List resources;
+
+    private Log log;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        for ( Iterator it = resources.iterator(); it.hasNext(); )
+        {
+            Resource resource = (Resource) it.next();
+
+            if ( resource.getDirectory().indexOf( "${project.build.directory}" 
) > -1 )
+            {
+                throw new MojoExecutionException( "Project resource-directory 
was not interpolated.\n\nFull directory is: " + resource.getDirectory() );
+            }
+        }
+
+        getLog().info( "Resource directory has been interpolated." );
+    }
+
+    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-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/mng3530/ValidatePropertyMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/plugin/src/main/java/mng3530/ValidatePropertyMojo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/pom.xml?rev=663347&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/pom.xml
 Wed Jun  4 12:12:27 2008
@@ -0,0 +1,45 @@
+<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.mng3530</groupId>
+  <artifactId>resource-object-project</artifactId>
+  <packaging>jar</packaging>
+  <version>1</version>
+  <name>project</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  <properties>
+    <myDirectory>something</myDirectory>
+  </properties>
+  
+  <build>
+    <resources>
+      <resource>
+        <directory>${project.build.directory}/myResources</directory>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.mng3530</groupId>
+        <artifactId>resource-object-maven-plugin</artifactId>
+        <version>1</version>
+        <executions>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/tests/App.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/tests/App.java?rev=663347&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/tests/App.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/tests/App.java
 Wed Jun  4 12:12:27 2008
@@ -0,0 +1,13 @@
+package tests;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/tests/App.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/main/java/tests/App.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/tests/AppTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/tests/AppTest.java?rev=663347&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/tests/AppTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/tests/AppTest.java
 Wed Jun  4 12:12:27 2008
@@ -0,0 +1,38 @@
+package tests;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/tests/AppTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation/resource-object/project/src/test/java/tests/AppTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"


Reply via email to