You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2008/12/18 00:47:30 UTC

svn commit: r727584 - /maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java

Author: jvanzyl
Date: Wed Dec 17 15:47:30 2008
New Revision: 727584

URL: http://svn.apache.org/viewvc?rev=727584&view=rev
Log:
o using jxpath to simplify the queries for testing the spec.

Modified:
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java?rev=727584&r1=727583&r2=727584&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java (original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java Wed Dec 17 15:47:30 2008
@@ -14,6 +14,7 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuilderConfiguration;
+import org.apache.maven.project.harness.PomTestWrapper;
 import org.codehaus.plexus.PlexusTestCase;
 
 public class PomConstructionTest
@@ -42,13 +43,7 @@
     {        
         Map<String,File> artifacts = new HashMap<String,File>();
                 
-        File nexusAggregator = new File( testDirectory, "nexus/pom.xml" );
-        File nexusParent = new File( testDirectory, "nexus/nexus-test-harness-parent/pom.xml" );
         File nexusLauncher = new File( testDirectory, "nexus/nexus-test-harness-launcher/pom.xml" );
-
-        artifacts.put( "nexus-test-harness-parent", nexusParent );
-        artifacts.put( "nexus-test-harness-launcher" , nexusLauncher );
-        artifacts.put( "nexus-test-harness", nexusAggregator );
         
         PomArtifactResolver resolver = new FileBasedPomArtifactResolver( new File( BASE_POM_DIR, "nexus" ) );
                 
@@ -56,21 +51,16 @@
         // not going to use mixins.
         PomClassicDomainModel model = projectBuilder.buildModel( nexusLauncher, null, resolver );  
         
+        // Make sure we actually processed our 3 POMs.
         assertEquals( 3, model.getLineageCount() );
         
-        // This will get extremely tedious unless we can shorten these into small expressions to
-        // retrieve the target values for testing.
-        
-        // model.build.plugins[0].executions
-        // model/build/plugins[0].executions
-        
-        Model m = model.getModel();
+        PomTestWrapper pom = new PomTestWrapper( model );
         
-        Plugin plugin = (Plugin) m.getBuild().getPlugins().get( 0 );
+        assertEquals( "maven-dependency-plugin", pom.getValue( "build/plugins[1]/artifactId" ) );
         
-        List executions = plugin.getExecutions();
-        
-        //assertEquals( 7, executions.size() );
+        List executions = (List) pom.getValue( "build/plugins[1]/executions" );
+                
+        assertEquals( 7, executions.size() );
     }
     
     // Need to get this to walk around a directory and automatically build up the artifact set. If we