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