1 package org.apache.maven.project.canonical; 2 3 18 19 import org.apache.maven.model.Plugin; 20 import org.apache.maven.model.PluginExecution; 21 import org.apache.maven.project.AbstractMavenProjectTestCase; 22 import org.apache.maven.project.MavenProject; 23 import org.codehaus.plexus.util.xml.Xpp3Dom; 24 25 import java.io.File ; 26 import java.util.Iterator ; 27 import java.util.List ; 28 29 33 public class CanonicalProjectBuilderTest 34 extends AbstractMavenProjectTestCase 35 { 36 public void testProjectBuilder() 37 throws Exception 38 { 39 File f = getFileForClasspathResource( "canonical-pom.xml" ); 40 41 MavenProject project = getProject( f ); 42 43 47 assertEquals( "4.0.0", project.getModelVersion() ); 48 49 53 List plugins = project.getBuildPlugins(); 54 55 57 String key = "org.apache.maven.plugins:maven-plexus-plugin"; 58 59 Plugin plugin = null; 60 for ( Iterator it = plugins.iterator(); it.hasNext(); ) 61 { 62 Plugin check = (Plugin) it.next(); 63 64 if ( key.equals( check.getKey() ) ) 65 { 66 plugin = check; 67 break; 68 } 69 } 70 71 assertNotNull( plugin ); 72 73 assertEquals( "1.0", plugin.getVersion() ); 74 75 Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); 76 77 assertEquals( "src/conf/plexus.conf", configuration.getChild( "plexusConfiguration" ).getValue() ); 78 79 assertEquals( "src/conf/plexus.properties", 80 configuration.getChild( "plexusConfigurationPropertiesFile" ).getValue() ); 81 82 assertEquals( "Continuum", configuration.getChild( "plexusApplicationName" ).getValue() ); 83 84 88 List executions = plugin.getExecutions(); 89 90 PluginExecution execution = (PluginExecution) executions.get( 0 ); 91 92 String g0 = (String ) execution.getGoals().get( 0 ); 93 94 assertEquals( "plexus:runtime", g0 ); 95 96 configuration = (Xpp3Dom) execution.getConfiguration(); 97 98 assertEquals( "ContinuumPro", configuration.getChild( "plexusApplicationName" ).getValue() ); 99 100 } 102 } 103 | Popular Tags |