1 package org.apache.maven.plugin.idea;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.dom4j.Document;
23 import org.dom4j.Element;
24
25
26
27
28 public class IdeaWorkspaceTest
29 extends AbstractIdeaTestCase
30 {
31 public void testMinConfig()
32 throws Exception
33 {
34 executeMojo( "src/test/workspace-plugin-configs/min-plugin-config.xml" );
35 }
36
37 public void testCvsScmConnectionConfig()
38 throws Exception
39 {
40 Document iwsDocument = executeMojo( "src/test/workspace-plugin-configs/cvs-connection-plugin-config.xml" );
41
42 Element component = findComponent( iwsDocument.getRootElement(), "VcsManagerConfiguration" );
43
44 Element element = findElementByNameAttribute( component, "option", "ACTIVE_VCS_NAME" );
45
46 assertEquals( "Test scm type from scm connection", "CVS", element.attributeValue( "value" ) );
47 }
48
49 public void testPerforceScmConnectionConfig()
50 throws Exception
51 {
52 Document iwsDocument = executeMojo( "src/test/workspace-plugin-configs/perforce-connection-plugin-config.xml" );
53
54 Element component = findComponent( iwsDocument.getRootElement(), "VcsManagerConfiguration" );
55
56 Element element = findElementByNameAttribute( component, "option", "ACTIVE_VCS_NAME" );
57
58 assertEquals( "Test scm type from scm connection", "Perforce", element.attributeValue( "value" ) );
59 }
60
61 public void testScmConnectionConfig()
62 throws Exception
63 {
64 Document iwsDocument = executeMojo( "src/test/workspace-plugin-configs/connection-plugin-config.xml" );
65
66 Element component = findComponent( iwsDocument.getRootElement(), "VcsManagerConfiguration" );
67
68 Element element = findElementByNameAttribute( component, "option", "ACTIVE_VCS_NAME" );
69
70 assertEquals( "Test scm type from scm connection", "type", element.attributeValue( "value" ) );
71 }
72
73 public void testScmConnectionWithPipeConfig()
74 throws Exception
75 {
76 Document iwsDocument = executeMojo( "src/test/workspace-plugin-configs/connection-with-pipe-plugin-config.xml" );
77
78 Element component = findComponent( iwsDocument.getRootElement(), "VcsManagerConfiguration" );
79
80 Element element = findElementByNameAttribute( component, "option", "ACTIVE_VCS_NAME" );
81
82 assertEquals( "Test scm type from scm connection", "type", element.attributeValue( "value" ) );
83 }
84
85 public void testScmDevConnectionConfig()
86 throws Exception
87 {
88 Document iwsDocument = executeMojo( "src/test/workspace-plugin-configs/devconnection-plugin-config.xml" );
89
90 Element component = findComponent( iwsDocument.getRootElement(), "VcsManagerConfiguration" );
91
92 Element element = findElementByNameAttribute( component, "option", "ACTIVE_VCS_NAME" );
93
94 assertEquals( "Test scm type from scm connection", "type", element.attributeValue( "value" ) );
95 }
96
97 public void testStarTeamScmConnectionConfig()
98 throws Exception
99 {
100 Document iwsDocument = executeMojo( "src/test/workspace-plugin-configs/starteam-connection-plugin-config.xml" );
101
102 Element component = findComponent( iwsDocument.getRootElement(), "VcsManagerConfiguration" );
103
104 Element element = findElementByNameAttribute( component, "option", "ACTIVE_VCS_NAME" );
105
106 assertEquals( "Test scm type from scm connection", "StarTeam", element.attributeValue( "value" ) );
107 }
108
109 public void testSvnScmConnectionConfig()
110 throws Exception
111 {
112 Document iwsDocument = executeMojo( "src/test/workspace-plugin-configs/svn-connection-plugin-config.xml" );
113
114 Element component = findComponent( iwsDocument.getRootElement(), "VcsManagerConfiguration" );
115
116 Element element = findElementByNameAttribute( component, "option", "ACTIVE_VCS_NAME" );
117
118 assertEquals( "Test scm type from scm connection", "svn", element.attributeValue( "value" ) );
119 }
120
121 public void testVssScmConnectionConfig()
122 throws Exception
123 {
124 Document iwsDocument = executeMojo( "src/test/workspace-plugin-configs/vss-connection-plugin-config.xml" );
125
126 Element component = findComponent( iwsDocument.getRootElement(), "VcsManagerConfiguration" );
127
128 Element element = findElementByNameAttribute( component, "option", "ACTIVE_VCS_NAME" );
129
130 assertEquals( "Test scm type from scm connection", "SourceSafe", element.attributeValue( "value" ) );
131 }
132
133 private Document executeMojo( String pluginXml )
134 throws Exception
135 {
136 return super.executeMojo( "workspace", pluginXml, "iws" );
137 }
138 }