1 package org.apache.maven.project.canonical;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.List;
24
25 import org.apache.maven.model.Plugin;
26 import org.apache.maven.model.PluginExecution;
27 import org.apache.maven.project.AbstractMavenProjectTestCase;
28 import org.apache.maven.project.MavenProject;
29 import org.codehaus.plexus.util.xml.Xpp3Dom;
30
31
32
33
34 public class CanonicalProjectBuilderTest
35 extends AbstractMavenProjectTestCase
36 {
37 public void testProjectBuilder()
38 throws Exception
39 {
40 File f = getFileForClasspathResource( "canonical-pom.xml" );
41
42 MavenProject project = getProject( f );
43
44
45
46
47
48 assertEquals( "4.0.0", project.getModelVersion() );
49
50
51
52
53
54 List<Plugin> plugins = project.getBuildPlugins();
55
56
57
58 String key = "org.apache.maven.plugins:maven-plexus-plugin";
59
60 Plugin plugin = null;
61 for ( Plugin check : plugins )
62 {
63 if ( key.equals( check.getKey() ) )
64 {
65 plugin = check;
66 break;
67 }
68 }
69
70 assertNotNull( plugin );
71
72 assertEquals( "1.0", plugin.getVersion() );
73
74 Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
75
76 assertEquals( "src/conf/plexus.conf", configuration.getChild( "plexusConfiguration" ).getValue() );
77
78 assertEquals( "src/conf/plexus.properties",
79 configuration.getChild( "plexusConfigurationPropertiesFile" ).getValue() );
80
81 assertEquals( "Continuum", configuration.getChild( "plexusApplicationName" ).getValue() );
82
83
84
85
86
87 List<PluginExecution> executions = plugin.getExecutions();
88
89 PluginExecution execution = executions.get( 0 );
90
91 String g0 = execution.getGoals().get( 0 );
92
93 assertEquals( "plexus:runtime", g0 );
94
95 configuration = (Xpp3Dom) execution.getConfiguration();
96
97 assertEquals( "ContinuumPro", configuration.getChild( "plexusApplicationName" ).getValue() );
98
99
100 }
101 }