maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r751810 - in /maven/components/trunk/maven-project/src: main/java/org/apache/maven/project/processor/ test/java/org/apache/maven/project/processor/
Date Mon, 09 Mar 2009 19:49:19 GMT
Author: sisbell
Date: Mon Mar  9 19:49:19 2009
New Revision: 751810

URL: http://svn.apache.org/viewvc?rev=751810&view=rev
Log:
Processors: IssueManagement, Prerequisites

Added:
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/IssueManagementProcessor.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PrerequisitesProcessor.java
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/IssueManagementProcessorTest.java
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/PrerequisitesProcessorTest.java
Modified:
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/BuildProcessor.java

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/BuildProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/BuildProcessor.java?rev=751810&r1=751809&r2=751810&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/BuildProcessor.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/BuildProcessor.java
Mon Mar  9 19:49:19 2009
@@ -13,6 +13,5 @@
     public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized
)
     {
         super.process( parent, child, target, isChildMostSpecialized );
-
     }
 }

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/IssueManagementProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/IssueManagementProcessor.java?rev=751810&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/IssueManagementProcessor.java
(added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/IssueManagementProcessor.java
Mon Mar  9 19:49:19 2009
@@ -0,0 +1,34 @@
+package org.apache.maven.project.processor;
+
+import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.Model;
+
+public class IssueManagementProcessor extends BaseProcessor
+{
+    public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized
)
+    {
+        super.process( parent, child, target, isChildMostSpecialized );
+        Model t = (Model) target;
+        Model c = (Model) child;
+        Model p = (Model) parent;
+        
+        if( c.getIssueManagement() != null)
+        {
+            IssueManagement childMng = c.getIssueManagement();
+            IssueManagement mng = new IssueManagement();
+            
+            mng.setSystem( childMng.getSystem() );
+            mng.setUrl( childMng.getUrl() );
+            t.setIssueManagement( mng );
+        } 
+        else if(p != null && p.getIssueManagement() != null)
+        {
+            IssueManagement parentMng = p.getIssueManagement();
+            IssueManagement mng = new IssueManagement();
+            
+            mng.setSystem( parentMng .getSystem() );
+            mng.setUrl( parentMng .getUrl() ); 
+            t.setIssueManagement( mng );
+        }
+    }
+}

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PrerequisitesProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PrerequisitesProcessor.java?rev=751810&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PrerequisitesProcessor.java
(added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PrerequisitesProcessor.java
Mon Mar  9 19:49:19 2009
@@ -0,0 +1,25 @@
+package org.apache.maven.project.processor;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Prerequisites;
+
+public class PrerequisitesProcessor extends BaseProcessor
+{
+    public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized
)
+    {
+        super.process( parent, child, target, isChildMostSpecialized );
+
+        if ( isChildMostSpecialized )
+        {
+            Model t = (Model) target;
+            Model c = (Model) child;
+            if(c.getPrerequisites() == null)
+            {
+                return;
+            }
+            Prerequisites prerequisites = new Prerequisites();
+            prerequisites.setMaven( c.getPrerequisites().getMaven());
+            t.setPrerequisites( prerequisites );
+        }
+    }
+}

Added: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/IssueManagementProcessorTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/IssueManagementProcessorTest.java?rev=751810&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/IssueManagementProcessorTest.java
(added)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/IssueManagementProcessorTest.java
Mon Mar  9 19:49:19 2009
@@ -0,0 +1,27 @@
+package org.apache.maven.project.processor;
+
+import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.Model;
+
+import junit.framework.TestCase;
+
+public class IssueManagementProcessorTest extends TestCase
+{
+    public void testChildCopy()
+    {
+        IssueManagement mng = new IssueManagement();
+        mng.setSystem( "system" );
+        mng.setUrl( "http://url" );
+        
+        Model child = new Model();
+        child.setIssueManagement( mng );
+        
+        Model target = new Model();
+        
+        IssueManagementProcessor proc = new IssueManagementProcessor();
+        proc.process( null, child, target, false );
+        
+        assertEquals("system", target.getIssueManagement().getSystem());
+        assertEquals("http://url", target.getIssueManagement().getUrl());
+    }
+}

Added: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/PrerequisitesProcessorTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/PrerequisitesProcessorTest.java?rev=751810&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/PrerequisitesProcessorTest.java
(added)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/processor/PrerequisitesProcessorTest.java
Mon Mar  9 19:49:19 2009
@@ -0,0 +1,49 @@
+package org.apache.maven.project.processor;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Prerequisites;
+
+import junit.framework.TestCase;
+
+public class PrerequisitesProcessorTest extends TestCase
+{
+
+    public void testMaven()
+    {
+        Prerequisites prerequisites = new Prerequisites();
+        prerequisites.setMaven( "2.1" );
+        
+        Model child = new Model();
+        child.setPrerequisites( prerequisites );
+        
+        Model target = new Model();
+        
+        PrerequisitesProcessor proc = new PrerequisitesProcessor();
+        proc.process( null, child, target, true );
+        
+        assertEquals("2.1", target.getPrerequisites().getMaven());
+        
+        //Immutable
+        prerequisites.setMaven( "2.2" );
+        assertEquals("2.1", target.getPrerequisites().getMaven());        
+        
+    }
+    
+    public void testMavenParent()
+    {
+        Prerequisites prerequisites = new Prerequisites();
+        prerequisites.setMaven( "2.1" );
+        
+        Model parent = new Model();
+        parent.setPrerequisites( prerequisites );
+        
+        Model target = new Model();
+        
+        PrerequisitesProcessor proc = new PrerequisitesProcessor();
+        proc.process( parent, new Model(), target, false );
+        
+        assertEquals(null, target.getPrerequisites());   
+        
+    }   
+  
+}



Mime
View raw message