You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ep...@apache.org on 2006/04/06 03:41:12 UTC

svn commit: r391875 - in /maven/plugins/trunk/maven-idea-plugin/src/test: java/org/apache/maven/plugin/idea/ java/org/apache/maven/plugin/idea/stubs/ module-plugin-configs/

Author: epunzalan
Date: Wed Apr  5 18:41:12 2006
New Revision: 391875

URL: http://svn.apache.org/viewcvs?rev=391875&view=rev
Log:
PR: MIDEA-43

Added tests for creation of idea modules dependencies

Added:
    maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithReactorDepStub.java
    maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/module-plugin-config.xml
Modified:
    maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java
    maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/ReactorMavenProjectStub.java
    maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/SimpleMavenProjectStub.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=391875&r1=391874&r2=391875&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 18:41:12 2006
@@ -273,6 +273,29 @@
         assertTrue( "All libraries are present", expectedLibs.size() == 0 );
     }
 
+    public void testProjectWithModulesConfigurations()
+        throws Exception
+    {
+        Document imlDocument = executeMojo( "src/test/module-plugin-configs/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 );
+    }
+
     protected Document executeMojo( String pluginXml )
         throws Exception
     {

Added: maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithReactorDepStub.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithReactorDepStub.java?rev=391875&view=auto
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithReactorDepStub.java (added)
+++ maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithReactorDepStub.java Wed Apr  5 18:41:12 2006
@@ -0,0 +1,39 @@
+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.ArrayList;
+import java.util.List;
+
+/**
+ * @author Edwin Punzalan
+ */
+public class MavenProjectWithReactorDepStub
+    extends SimpleMavenProjectStub
+{
+    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;
+    }
+}

Modified: maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/ReactorMavenProjectStub.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/ReactorMavenProjectStub.java?rev=391875&r1=391874&r2=391875&view=diff
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/ReactorMavenProjectStub.java (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/ReactorMavenProjectStub.java Wed Apr  5 18:41:12 2006
@@ -54,4 +54,9 @@
     {
         return "1.0";
     }
+
+    public static int getCurrentCount()
+    {
+        return reactorProjectCounter;
+    }
 }

Modified: maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/SimpleMavenProjectStub.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/SimpleMavenProjectStub.java?rev=391875&r1=391874&r2=391875&view=diff
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/SimpleMavenProjectStub.java (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/SimpleMavenProjectStub.java Wed Apr  5 18:41:12 2006
@@ -195,7 +195,7 @@
         return Collections.singletonList( src.getAbsolutePath() );
     }
 
-    private Artifact createArtifact( String groupId, String artifactId, String version )
+    protected Artifact createArtifact( String groupId, String artifactId, String version )
     {
         Artifact artifact = new IdeaArtifactStub();
 

Added: maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/module-plugin-config.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/module-plugin-config.xml?rev=391875&view=auto
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/module-plugin-config.xml (added)
+++ maven/plugins/trunk/maven-idea-plugin/src/test/module-plugin-configs/module-plugin-config.xml Wed Apr  5 18:41:12 2006
@@ -0,0 +1,30 @@
+<!--
+  ~  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.MavenProjectWithReactorDepStub"/>
+          <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