Author: epunzalan
Date: Wed Apr 5 23:00:48 2006
New Revision: 391908
URL: http://svn.apache.org/viewcvs?rev=391908&view=rev
Log:
PR: MIDEA-43
Added tests for war and ejb project with reactor dependencies
Added:
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/EjbWithModuleMavenProjectStub.java
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarWithModuleMavenProjectStub.java
maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/ejb-module-plugin-config.xml
maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/war-module-plugin-config.xml
Modified:
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java
Modified:
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java?rev=391908&r1=391907&r2=391908&view=diff
==============================================================================
---
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java
(original)
+++
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java
Wed Apr 5 23:00:48 2006
@@ -292,7 +292,6 @@
moduleFound = true;
}
}
-
assertTrue( "Test presence of idea module", moduleFound );
}
@@ -352,6 +351,102 @@
}
}
}
+ }
+
+ public void testWarProjectWithModulesConfigurations()
+ throws Exception
+ {
+ Document imlDocument = executeMojo(
"src/test/module-plugin-configs/war-module-plugin-config.xml" );
+
+ Element component = findComponent( imlDocument.getRootElement(),
"NewModuleRootManager" );
+
+ boolean moduleFound = false;
+ List orderEntryList = component.elements( "orderEntry" );
+ for ( Iterator orderEntries = orderEntryList.iterator();
orderEntries.hasNext(); )
+ {
+ Element orderEntry = (Element) orderEntries.next();
+ if ( "module".equals( orderEntry.attributeValue( "type" ) ) )
+ {
+ String moduleName = orderEntry.attributeValue( "module-name" );
+ assertTrue( "Test idea module name", moduleName.startsWith(
"plugin-reactor-project-" ) );
+ moduleFound = true;
+ }
+ }
+ assertTrue( "Test presence of idea module", moduleFound );
+
+ component = findComponent( imlDocument.getRootElement(),
"WebModuleProperties" );
+
+ boolean webModuleFound = false;
+ for( Iterator elements = component.elementIterator( "containerElement"
); elements.hasNext(); )
+ {
+ Element containerElement = (Element) elements.next();
+
+ if ( "module".equals( containerElement.attributeValue( "type" ) ) )
+ {
+ String name = containerElement.attributeValue( "name" );
+
+ assertTrue( "Module must be from reactor", name.indexOf(
"plugin-reactor-project-" ) >= 0 );
+
+ assertNull( "Library url for modules must not be present",
containerElement.element( "url" ) );
+
+ Element method = findElementByNameAttribute( containerElement,
"attribute", "method" );
+ assertEquals( "Test Library module method", "5",
method.attributeValue( "value" ) );
+
+ Element uri = findElementByNameAttribute( containerElement,
"attribute", "URI" );
+ assertEquals( "Test Library module method",
"/WEB-INF/classes", uri.attributeValue( "value" ) );
+
+ webModuleFound = true;
+ }
+ }
+ assertTrue( "Test WebModuleProperties for module library",
webModuleFound );
+ }
+
+ public void testEjbProjectWithModulesConfigurations()
+ throws Exception
+ {
+ Document imlDocument = executeMojo(
"src/test/module-plugin-configs/ejb-module-plugin-config.xml" );
+
+ Element component = findComponent( imlDocument.getRootElement(),
"NewModuleRootManager" );
+
+ boolean moduleFound = false;
+ List orderEntryList = component.elements( "orderEntry" );
+ for ( Iterator orderEntries = orderEntryList.iterator();
orderEntries.hasNext(); )
+ {
+ Element orderEntry = (Element) orderEntries.next();
+ if ( "module".equals( orderEntry.attributeValue( "type" ) ) )
+ {
+ String moduleName = orderEntry.attributeValue( "module-name" );
+ assertTrue( "Test idea module name", moduleName.startsWith(
"plugin-reactor-project-" ) );
+ moduleFound = true;
+ }
+ }
+ assertTrue( "Test presence of idea module", moduleFound );
+
+ component = findComponent( imlDocument.getRootElement(),
"EjbModuleProperties" );
+
+ boolean ejbModuleFound = false;
+ for( Iterator elements = component.elementIterator( "containerElement"
); elements.hasNext(); )
+ {
+ Element containerElement = (Element) elements.next();
+
+ if ( "module".equals( containerElement.attributeValue( "type" ) ) )
+ {
+ String name = containerElement.attributeValue( "name" );
+
+ assertTrue( "Module must be from reactor", name.indexOf(
"plugin-reactor-project-" ) >= 0 );
+
+ assertNull( "Library url for modules must not be present",
containerElement.element( "url" ) );
+
+ Element method = findElementByNameAttribute( containerElement,
"attribute", "method" );
+ assertEquals( "Test Library module method", "6",
method.attributeValue( "value" ) );
+
+ Element uri = findElementByNameAttribute( containerElement,
"attribute", "URI" );
+ assertEquals( "Test Library module method",
"/WEB-INF/classes", uri.attributeValue( "value" ) );
+
+ ejbModuleFound = true;
+ }
+ }
+ assertTrue( "Test EjbModuleProperties for module library",
ejbModuleFound );
}
protected Document executeMojo( String pluginXml )
Added:
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/EjbWithModuleMavenProjectStub.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/EjbWithModuleMavenProjectStub.java?rev=391908&view=auto
==============================================================================
---
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/EjbWithModuleMavenProjectStub.java
(added)
+++
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/EjbWithModuleMavenProjectStub.java
Wed Apr 5 23:00:48 2006
@@ -0,0 +1,41 @@
+package org.apache.maven.plugin.idea.stubs;
+
+/*
+ *
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Edwin Punzalan
+ */
+public class EjbWithModuleMavenProjectStub
+ extends EjbMavenProjectStub
+{
+ public List getTestArtifacts()
+ {
+ List artifacts = new ArrayList();
+
+ artifacts.addAll( super.getTestArtifacts() );
+
+ artifacts.add( createArtifact( "org.apache.maven.plugin.test",
"plugin-reactor-project-" +
+
ReactorMavenProjectStub.getCurrentCount(), "1.0" ) );
+
+ return artifacts;
+ }
+}
Added:
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarWithModuleMavenProjectStub.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarWithModuleMavenProjectStub.java?rev=391908&view=auto
==============================================================================
---
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarWithModuleMavenProjectStub.java
(added)
+++
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarWithModuleMavenProjectStub.java
Wed Apr 5 23:00:48 2006
@@ -0,0 +1,41 @@
+package org.apache.maven.plugin.idea.stubs;
+
+/*
+ *
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Edwin Punzalan
+ */
+public class WarWithModuleMavenProjectStub
+ extends WarMavenProjectStub
+{
+ public List getTestArtifacts()
+ {
+ List artifacts = new ArrayList();
+
+ artifacts.addAll( super.getTestArtifacts() );
+
+ artifacts.add( createArtifact( "org.apache.maven.plugin.test",
"plugin-reactor-project-" +
+
ReactorMavenProjectStub.getCurrentCount(), "1.0" ) );
+
+ return artifacts;
+ }
+}
\ No newline at end of file
Added:
maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/ejb-module-plugin-config.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/ejb-module-plugin-config.xml?rev=391908&view=auto
==============================================================================
---
maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/ejb-module-plugin-config.xml
(added)
+++
maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/ejb-module-plugin-config.xml
Wed Apr 5 23:00:48 2006
@@ -0,0 +1,44 @@
+<!--
+ ~
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <executedProject
implementation="org.apache.maven.plugin.idea.stubs.EjbWithModuleMavenProjectStub"/>
+ <localRepo>${localRepository}</localRepo>
+ <overwrite>false</overwrite>
+ <reactorProjects>
+ <reactorProject
implementation="org.apache.maven.plugin.idea.stubs.ReactorMavenProjectStub"/>
+ <reactorProject
implementation="org.apache.maven.plugin.idea.stubs.ReactorMavenProjectStub"/>
+ <reactorProject
implementation="org.apache.maven.plugin.idea.stubs.ReactorMavenProjectStub"/>
+ </reactorProjects>
+ <linkModules>true</linkModules>
+ <useFullNames>false</useFullNames>
+ <downloadSources>false</downloadSources>
+ <sourceClassifier>sources</sourceClassifier>
+ <downloadJavadocs>false</downloadJavadocs>
+ <javadocClassifier>javadoc</javadocClassifier>
+ <dependenciesAsLibraries>false</dependenciesAsLibraries>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added:
maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/war-module-plugin-config.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/war-module-plugin-config.xml?rev=391908&view=auto
==============================================================================
---
maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/war-module-plugin-config.xml
(added)
+++
maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/war-module-plugin-config.xml
Wed Apr 5 23:00:48 2006
@@ -0,0 +1,44 @@
+<!--
+ ~
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <executedProject
implementation="org.apache.maven.plugin.idea.stubs.WarWithModuleMavenProjectStub"/>
+ <localRepo>${localRepository}</localRepo>
+ <overwrite>false</overwrite>
+ <reactorProjects>
+ <reactorProject
implementation="org.apache.maven.plugin.idea.stubs.ReactorMavenProjectStub"/>
+ <reactorProject
implementation="org.apache.maven.plugin.idea.stubs.ReactorMavenProjectStub"/>
+ <reactorProject
implementation="org.apache.maven.plugin.idea.stubs.ReactorMavenProjectStub"/>
+ </reactorProjects>
+ <linkModules>true</linkModules>
+ <useFullNames>false</useFullNames>
+ <downloadSources>false</downloadSources>
+ <sourceClassifier>sources</sourceClassifier>
+ <downloadJavadocs>false</downloadJavadocs>
+ <javadocClassifier>javadoc</javadocClassifier>
+ <dependenciesAsLibraries>false</dependenciesAsLibraries>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file