mirror of https://github.com/apache/maven.git
Various model processors.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@751882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c3f3464a57
commit
e552b225fc
|
@ -0,0 +1,70 @@
|
|||
package org.apache.maven.project.processor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.model.CiManagement;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Notifier;
|
||||
|
||||
public class CiManagementProcessor
|
||||
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.getCiManagement() != null )
|
||||
{
|
||||
CiManagement childMng = c.getCiManagement();
|
||||
CiManagement mng = new CiManagement();
|
||||
|
||||
mng.setSystem( childMng.getSystem() );
|
||||
mng.setUrl( childMng.getUrl() );
|
||||
t.setCiManagement( mng );
|
||||
addNotifiers( c.getCiManagement().getNotifiers(), t.getCiManagement() );
|
||||
}
|
||||
else if ( p != null && p.getCiManagement() != null )
|
||||
{
|
||||
CiManagement parentMng = p.getCiManagement();
|
||||
CiManagement mng = new CiManagement();
|
||||
|
||||
mng.setSystem( parentMng.getSystem() );
|
||||
mng.setUrl( parentMng.getUrl() );
|
||||
t.setCiManagement( mng );
|
||||
addNotifiers( p.getCiManagement().getNotifiers(), t.getCiManagement() );
|
||||
}
|
||||
}
|
||||
|
||||
private static void addNotifiers( List<Notifier> notifiers, CiManagement ciManagement )
|
||||
{
|
||||
if ( notifiers == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<Notifier> n = new ArrayList<Notifier>();
|
||||
|
||||
for ( Notifier notifier : notifiers )
|
||||
{
|
||||
Notifier notifierCopy = new Notifier();
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.putAll( notifier.getConfiguration() );
|
||||
notifierCopy.setConfiguration( properties );
|
||||
|
||||
notifierCopy.setAddress( notifier.getAddress() );
|
||||
notifierCopy.setSendOnError( notifier.isSendOnError() );
|
||||
notifierCopy.setSendOnFailure( notifier.isSendOnFailure() );
|
||||
notifierCopy.setSendOnSuccess( notifier.isSendOnSuccess() );
|
||||
notifierCopy.setSendOnWarning( notifier.isSendOnWarning() );
|
||||
notifierCopy.setType( notifier.getType() );
|
||||
n.add( notifierCopy );
|
||||
|
||||
}
|
||||
ciManagement.getNotifiers().addAll( n );
|
||||
}
|
||||
}
|
|
@ -20,10 +20,10 @@ public class DependenciesProcessor
|
|||
{
|
||||
p = (Model) parent;
|
||||
}
|
||||
List<Dependency> dependencies = ((Model) target).getDependencies();
|
||||
List<Dependency> dependencies = ( (Model) target ).getDependencies();
|
||||
|
||||
DependencyProcessor processor = new DependencyProcessor();
|
||||
if ( ( p == null || p.getDependencies().isEmpty() ) && !c.getDependencies().isEmpty())
|
||||
if ( ( p == null || p.getDependencies().isEmpty() ) && !c.getDependencies().isEmpty() )
|
||||
{
|
||||
for ( Dependency dependency : c.getDependencies() )
|
||||
{
|
||||
|
@ -39,9 +39,9 @@ public class DependenciesProcessor
|
|||
{
|
||||
for ( Dependency d2 : p.getDependencies() )
|
||||
{
|
||||
if(match(d1, d2))
|
||||
if ( match( d1, d2 ) )
|
||||
{
|
||||
processor.process( d2, d1, dependencies, isChildMostSpecialized );//JOIN
|
||||
processor.process( d2, d1, dependencies, isChildMostSpecialized );// JOIN
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -51,14 +51,14 @@ public class DependenciesProcessor
|
|||
}
|
||||
}
|
||||
|
||||
for(Dependency d2 : parentDependencies)
|
||||
for ( Dependency d2 : parentDependencies )
|
||||
{
|
||||
processor.process( d2, null, dependencies, isChildMostSpecialized );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(Dependency d2 : p.getDependencies())
|
||||
for ( Dependency d2 : p.getDependencies() )
|
||||
{
|
||||
processor.process( d2, null, dependencies, isChildMostSpecialized );
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package org.apache.maven.project.processor;
|
||||
|
||||
public class DependencyManagementProcessor
|
||||
{
|
||||
|
||||
}
|
|
@ -5,7 +5,8 @@ import java.util.List;
|
|||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Exclusion;
|
||||
|
||||
public class DependencyProcessor extends BaseProcessor
|
||||
public class DependencyProcessor
|
||||
extends BaseProcessor
|
||||
{
|
||||
public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized )
|
||||
{
|
||||
|
@ -13,74 +14,75 @@ public class DependencyProcessor extends BaseProcessor
|
|||
|
||||
List<Dependency> t = (List<Dependency>) target;
|
||||
|
||||
if (parent == null && child == null)
|
||||
if ( parent == null && child == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if(parent == null && child != null)
|
||||
else if ( parent == null && child != null )
|
||||
{
|
||||
Dependency targetDependency = new Dependency();
|
||||
copy( (Dependency) child, targetDependency);
|
||||
copy( (Dependency) child, targetDependency );
|
||||
t.add( targetDependency );
|
||||
}
|
||||
else if( parent != null && child == null)
|
||||
else if ( parent != null && child == null )
|
||||
{
|
||||
Dependency targetDependency = new Dependency();
|
||||
copy( (Dependency) parent, targetDependency);
|
||||
copy( (Dependency) parent, targetDependency );
|
||||
t.add( targetDependency );
|
||||
}
|
||||
else //JOIN
|
||||
else
|
||||
// JOIN
|
||||
{
|
||||
Dependency targetDependency = new Dependency();
|
||||
copy( (Dependency) child, targetDependency);
|
||||
copy( (Dependency) parent, targetDependency);
|
||||
copy( (Dependency) child, targetDependency );
|
||||
copy( (Dependency) parent, targetDependency );
|
||||
t.add( targetDependency );
|
||||
}
|
||||
}
|
||||
|
||||
private static void copy(Dependency dependency, Dependency targetDependency)
|
||||
private static void copy( Dependency dependency, Dependency targetDependency )
|
||||
{
|
||||
if(targetDependency.getArtifactId() == null)
|
||||
if ( targetDependency.getArtifactId() == null )
|
||||
{
|
||||
targetDependency.setArtifactId( dependency.getArtifactId() );
|
||||
}
|
||||
|
||||
if(targetDependency.getClassifier() == null)
|
||||
if ( targetDependency.getClassifier() == null )
|
||||
{
|
||||
targetDependency.setClassifier( dependency.getClassifier() );
|
||||
}
|
||||
|
||||
if(targetDependency.getGroupId() == null)
|
||||
if ( targetDependency.getGroupId() == null )
|
||||
{
|
||||
targetDependency.setGroupId(dependency.getGroupId());
|
||||
targetDependency.setGroupId( dependency.getGroupId() );
|
||||
}
|
||||
|
||||
if( targetDependency.getScope() == null)
|
||||
if ( targetDependency.getScope() == null )
|
||||
{
|
||||
targetDependency.setScope( dependency.getScope() );
|
||||
}
|
||||
|
||||
if(targetDependency.getSystemPath() == null)
|
||||
if ( targetDependency.getSystemPath() == null )
|
||||
{
|
||||
targetDependency.setSystemPath( dependency.getSystemPath() );
|
||||
}
|
||||
|
||||
if( targetDependency.getType() == null )
|
||||
if ( targetDependency.getType() == null )
|
||||
{
|
||||
targetDependency.setType( dependency.getType() );
|
||||
}
|
||||
|
||||
if(targetDependency.getVersion() == null)
|
||||
if ( targetDependency.getVersion() == null )
|
||||
{
|
||||
targetDependency.setVersion( dependency.getVersion() );
|
||||
}
|
||||
|
||||
if(!dependency.getExclusions().isEmpty())
|
||||
if ( !dependency.getExclusions().isEmpty() )
|
||||
{
|
||||
List<Exclusion> targetExclusions = targetDependency.getExclusions();
|
||||
for(Exclusion e : dependency.getExclusions())
|
||||
for ( Exclusion e : dependency.getExclusions() )
|
||||
{
|
||||
if(!containsExclusion(e, targetExclusions))
|
||||
if ( !containsExclusion( e, targetExclusions ) )
|
||||
{
|
||||
Exclusion e1 = new Exclusion();
|
||||
e1.setArtifactId( e.getArtifactId() );
|
||||
|
@ -91,11 +93,12 @@ public class DependencyProcessor extends BaseProcessor
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean containsExclusion(Exclusion exclusion, List<Exclusion> exclusions)
|
||||
private static boolean containsExclusion( Exclusion exclusion, List<Exclusion> exclusions )
|
||||
{
|
||||
for(Exclusion e :exclusions)
|
||||
for ( Exclusion e : exclusions )
|
||||
{
|
||||
if(e.getGroupId().equals( exclusion.getGroupId() ) && e.getArtifactId().equals( exclusion.getArtifactId() ))
|
||||
if ( e.getGroupId().equals( exclusion.getGroupId() )
|
||||
&& e.getArtifactId().equals( exclusion.getArtifactId() ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ package org.apache.maven.project.processor;
|
|||
import org.apache.maven.model.IssueManagement;
|
||||
import org.apache.maven.model.Model;
|
||||
|
||||
public class IssueManagementProcessor extends BaseProcessor
|
||||
public class IssueManagementProcessor
|
||||
extends BaseProcessor
|
||||
{
|
||||
public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized )
|
||||
{
|
||||
|
@ -12,7 +13,7 @@ public class IssueManagementProcessor extends BaseProcessor
|
|||
Model c = (Model) child;
|
||||
Model p = (Model) parent;
|
||||
|
||||
if( c.getIssueManagement() != null)
|
||||
if ( c.getIssueManagement() != null )
|
||||
{
|
||||
IssueManagement childMng = c.getIssueManagement();
|
||||
IssueManagement mng = new IssueManagement();
|
||||
|
@ -21,13 +22,13 @@ public class IssueManagementProcessor extends BaseProcessor
|
|||
mng.setUrl( childMng.getUrl() );
|
||||
t.setIssueManagement( mng );
|
||||
}
|
||||
else if(p != null && p.getIssueManagement() != null)
|
||||
else if ( p != null && p.getIssueManagement() != null )
|
||||
{
|
||||
IssueManagement parentMng = p.getIssueManagement();
|
||||
IssueManagement mng = new IssueManagement();
|
||||
|
||||
mng.setSystem( parentMng .getSystem() );
|
||||
mng.setUrl( parentMng .getUrl() );
|
||||
mng.setSystem( parentMng.getSystem() );
|
||||
mng.setUrl( parentMng.getUrl() );
|
||||
t.setIssueManagement( mng );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package org.apache.maven.project.processor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.model.MailingList;
|
||||
import org.apache.maven.model.Model;
|
||||
|
||||
public class MailingListProcessor
|
||||
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.getMailingLists().isEmpty() )
|
||||
{
|
||||
copyMailingLists( c.getMailingLists(), t );
|
||||
}
|
||||
else if ( p != null && !p.getMailingLists().isEmpty() )
|
||||
{
|
||||
copyMailingLists( p.getMailingLists(), t );
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyMailingLists( List<MailingList> mailingLists, Model target )
|
||||
{
|
||||
List<MailingList> targetList = target.getMailingLists();
|
||||
for ( MailingList mailingList : mailingLists )
|
||||
{
|
||||
MailingList listCopy = new MailingList();
|
||||
listCopy.setArchive( mailingList.getArchive() );
|
||||
listCopy.setName( mailingList.getName() );
|
||||
listCopy.setOtherArchives( new ArrayList<String>( mailingList.getOtherArchives() ) );
|
||||
listCopy.setPost( mailingList.getPost() );
|
||||
listCopy.setSubscribe( mailingList.getSubscribe() );
|
||||
listCopy.setUnsubscribe( mailingList.getUnsubscribe() );
|
||||
targetList.add( listCopy );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,5 +64,13 @@ public class ModelProcessor
|
|||
t.setDescription( c.getDescription() );
|
||||
}
|
||||
|
||||
if ( c.getInceptionYear() != null )
|
||||
{
|
||||
t.setInceptionYear( c.getInceptionYear() );
|
||||
}
|
||||
else if ( p != null )
|
||||
{
|
||||
t.setInceptionYear( p.getInceptionYear() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package org.apache.maven.project.processor;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Organization;
|
||||
|
||||
public class OrganizationProcessor
|
||||
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.getOrganization() != null )
|
||||
{
|
||||
copy( c.getOrganization(), t );
|
||||
}
|
||||
else if ( p != null && p.getOrganization() != null )
|
||||
{
|
||||
copy( p.getOrganization(), t );
|
||||
}
|
||||
}
|
||||
|
||||
private static void copy( Organization source, Model target )
|
||||
{
|
||||
Organization o = new Organization();
|
||||
o.setName( source.getName() );
|
||||
o.setUrl( source.getUrl() );
|
||||
|
||||
target.setOrganization( o );
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ public class ParentProcessor
|
|||
super.process( parent, child, target, isChildMostSpecialized );
|
||||
Model t = (Model) target;
|
||||
Model c = (Model) child;
|
||||
if(c.getParent() != null)
|
||||
if ( c.getParent() != null )
|
||||
{
|
||||
Parent p = new Parent();
|
||||
p.setGroupId( c.getParent().getGroupId() );
|
||||
|
|
|
@ -3,7 +3,8 @@ package org.apache.maven.project.processor;
|
|||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Prerequisites;
|
||||
|
||||
public class PrerequisitesProcessor extends BaseProcessor
|
||||
public class PrerequisitesProcessor
|
||||
extends BaseProcessor
|
||||
{
|
||||
public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized )
|
||||
{
|
||||
|
@ -13,12 +14,12 @@ public class PrerequisitesProcessor extends BaseProcessor
|
|||
{
|
||||
Model t = (Model) target;
|
||||
Model c = (Model) child;
|
||||
if(c.getPrerequisites() == null)
|
||||
if ( c.getPrerequisites() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
Prerequisites prerequisites = new Prerequisites();
|
||||
prerequisites.setMaven( c.getPrerequisites().getMaven());
|
||||
prerequisites.setMaven( c.getPrerequisites().getMaven() );
|
||||
t.setPrerequisites( prerequisites );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ import java.util.Properties;
|
|||
|
||||
import org.apache.maven.model.Model;
|
||||
|
||||
public class PropertiesProcessor extends BaseProcessor
|
||||
public class PropertiesProcessor
|
||||
extends BaseProcessor
|
||||
{
|
||||
public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized )
|
||||
{
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package org.apache.maven.project.processor;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.maven.model.CiManagement;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Notifier;
|
||||
|
||||
public class CiManagementProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testChildCopy()
|
||||
{
|
||||
CiManagement mng = new CiManagement();
|
||||
mng.setSystem( "system" );
|
||||
mng.setUrl( "uri" );
|
||||
|
||||
Notifier notifier = new Notifier();
|
||||
notifier.setAddress( "address" );
|
||||
notifier.setType( "type" );
|
||||
Properties prop = new Properties();
|
||||
prop.put( "key", "value" );
|
||||
notifier.setConfiguration( prop );
|
||||
mng.addNotifier( notifier );
|
||||
|
||||
Model child = new Model();
|
||||
child.setCiManagement( mng );
|
||||
|
||||
Model target = new Model();
|
||||
|
||||
CiManagementProcessor proc = new CiManagementProcessor();
|
||||
proc.process( null, child, target, false );
|
||||
|
||||
assertEquals( "system", target.getCiManagement().getSystem() );
|
||||
assertEquals( "uri", target.getCiManagement().getUrl() );
|
||||
assertEquals( 1, target.getCiManagement().getNotifiers().size() );
|
||||
assertEquals( "address", target.getCiManagement().getNotifiers().get( 0 ).getAddress() );
|
||||
}
|
||||
}
|
|
@ -5,7 +5,8 @@ import org.apache.maven.model.Model;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class DependenciesProcessorTest extends TestCase
|
||||
public class DependenciesProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testCopyChild()
|
||||
{
|
||||
|
@ -20,8 +21,8 @@ public class DependenciesProcessorTest extends TestCase
|
|||
DependenciesProcessor processor = new DependenciesProcessor();
|
||||
processor.process( null, child, target, false );
|
||||
|
||||
assertEquals(1, target.getDependencies().size());
|
||||
assertEquals("aid", target.getDependencies().get( 0 ).getArtifactId());
|
||||
assertEquals( 1, target.getDependencies().size() );
|
||||
assertEquals( "aid", target.getDependencies().get( 0 ).getArtifactId() );
|
||||
}
|
||||
|
||||
public void testParentCopy()
|
||||
|
@ -39,8 +40,8 @@ public class DependenciesProcessorTest extends TestCase
|
|||
DependenciesProcessor processor = new DependenciesProcessor();
|
||||
processor.process( parent, child, target, false );
|
||||
|
||||
assertEquals(1, target.getDependencies().size());
|
||||
assertEquals("aid", target.getDependencies().get( 0 ).getArtifactId());
|
||||
assertEquals( 1, target.getDependencies().size() );
|
||||
assertEquals( "aid", target.getDependencies().get( 0 ).getArtifactId() );
|
||||
}
|
||||
|
||||
public void testDependencyOrder()
|
||||
|
@ -60,9 +61,9 @@ public class DependenciesProcessorTest extends TestCase
|
|||
DependenciesProcessor processor = new DependenciesProcessor();
|
||||
processor.process( parent, child, target, false );
|
||||
|
||||
assertEquals(2, target.getDependencies().size());
|
||||
assertEquals("aid1", target.getDependencies().get( 0 ).getArtifactId());
|
||||
assertEquals("aid", target.getDependencies().get( 1 ).getArtifactId());
|
||||
assertEquals( 2, target.getDependencies().size() );
|
||||
assertEquals( "aid1", target.getDependencies().get( 0 ).getArtifactId() );
|
||||
assertEquals( "aid", target.getDependencies().get( 1 ).getArtifactId() );
|
||||
}
|
||||
|
||||
public void testJoin_NullVersion()
|
||||
|
@ -71,14 +72,13 @@ public class DependenciesProcessorTest extends TestCase
|
|||
dependency1.setArtifactId( "aid-c" );
|
||||
dependency1.setGroupId( "gid-c" );
|
||||
|
||||
|
||||
Model child = new Model();
|
||||
child.addDependency( dependency1 );
|
||||
|
||||
Dependency dependency = new Dependency();
|
||||
dependency.setArtifactId( "aid-c" );
|
||||
dependency.setGroupId( "gid-c" );
|
||||
dependency.setSystemPath("sp");
|
||||
dependency.setSystemPath( "sp" );
|
||||
|
||||
Model parent = new Model();
|
||||
parent.addDependency( dependency );
|
||||
|
@ -88,8 +88,8 @@ public class DependenciesProcessorTest extends TestCase
|
|||
DependenciesProcessor processor = new DependenciesProcessor();
|
||||
processor.process( parent, child, target, false );
|
||||
|
||||
assertEquals(1, target.getDependencies().size());
|
||||
assertEquals("sp", target.getDependencies().get( 0 ).getSystemPath());
|
||||
assertEquals( 1, target.getDependencies().size() );
|
||||
assertEquals( "sp", target.getDependencies().get( 0 ).getSystemPath() );
|
||||
}
|
||||
|
||||
public void testJoin_DefaultType()
|
||||
|
@ -106,7 +106,7 @@ public class DependenciesProcessorTest extends TestCase
|
|||
dependency.setArtifactId( "aid-c" );
|
||||
dependency.setGroupId( "gid-c" );
|
||||
dependency.setVersion( "1.0" );
|
||||
dependency.setSystemPath("sp");
|
||||
dependency.setSystemPath( "sp" );
|
||||
|
||||
Model parent = new Model();
|
||||
parent.addDependency( dependency );
|
||||
|
@ -116,8 +116,8 @@ public class DependenciesProcessorTest extends TestCase
|
|||
DependenciesProcessor processor = new DependenciesProcessor();
|
||||
processor.process( parent, child, target, false );
|
||||
|
||||
assertEquals(1, target.getDependencies().size());
|
||||
assertEquals("sp", target.getDependencies().get( 0 ).getSystemPath());
|
||||
assertEquals( 1, target.getDependencies().size() );
|
||||
assertEquals( "sp", target.getDependencies().get( 0 ).getSystemPath() );
|
||||
}
|
||||
|
||||
public void testJoin_DifferentClassifiers()
|
||||
|
@ -145,7 +145,7 @@ public class DependenciesProcessorTest extends TestCase
|
|||
DependenciesProcessor processor = new DependenciesProcessor();
|
||||
processor.process( parent, child, target, false );
|
||||
|
||||
assertEquals(2, target.getDependencies().size());
|
||||
assertEquals( 2, target.getDependencies().size() );
|
||||
}
|
||||
|
||||
public void testJoin_DifferentVersions()
|
||||
|
@ -171,6 +171,6 @@ public class DependenciesProcessorTest extends TestCase
|
|||
DependenciesProcessor processor = new DependenciesProcessor();
|
||||
processor.process( parent, child, target, false );
|
||||
|
||||
assertEquals(2, target.getDependencies().size());
|
||||
assertEquals( 2, target.getDependencies().size() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ import org.apache.maven.model.Exclusion;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class DependencyProcessorTest extends TestCase
|
||||
public class DependencyProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testCopyChild()
|
||||
{
|
||||
|
@ -18,11 +19,11 @@ public class DependencyProcessorTest extends TestCase
|
|||
child.setArtifactId( "aid" );
|
||||
|
||||
processor.process( null, child, dependencies, false );
|
||||
assertEquals(1, dependencies.size());
|
||||
assertEquals( 1, dependencies.size() );
|
||||
|
||||
//Immutable
|
||||
// Immutable
|
||||
child.setArtifactId( "aid2" );
|
||||
assertEquals("aid", dependencies.get( 0 ).getArtifactId());
|
||||
assertEquals( "aid", dependencies.get( 0 ).getArtifactId() );
|
||||
}
|
||||
|
||||
public void testCopyParent()
|
||||
|
@ -33,11 +34,11 @@ public class DependencyProcessorTest extends TestCase
|
|||
parent.setArtifactId( "aid" );
|
||||
|
||||
processor.process( parent, null, dependencies, false );
|
||||
assertEquals(1, dependencies.size());
|
||||
assertEquals( 1, dependencies.size() );
|
||||
|
||||
//Immutable
|
||||
// Immutable
|
||||
parent.setArtifactId( "aid2" );
|
||||
assertEquals("aid", dependencies.get( 0 ).getArtifactId());
|
||||
assertEquals( "aid", dependencies.get( 0 ).getArtifactId() );
|
||||
}
|
||||
|
||||
public void testJoinChildOverridesParent()
|
||||
|
@ -51,13 +52,13 @@ public class DependencyProcessorTest extends TestCase
|
|||
parent.setArtifactId( "aid2" );
|
||||
|
||||
processor.process( parent, child, dependencies, false );
|
||||
assertEquals(1, dependencies.size());
|
||||
assertEquals( 1, dependencies.size() );
|
||||
|
||||
assertEquals("aid", dependencies.get( 0 ).getArtifactId());
|
||||
assertEquals( "aid", dependencies.get( 0 ).getArtifactId() );
|
||||
|
||||
//Immutable
|
||||
// Immutable
|
||||
child.setArtifactId( "aid3" );
|
||||
assertEquals("aid", dependencies.get( 0 ).getArtifactId());
|
||||
assertEquals( "aid", dependencies.get( 0 ).getArtifactId() );
|
||||
}
|
||||
|
||||
public void testJoinElements()
|
||||
|
@ -71,10 +72,10 @@ public class DependencyProcessorTest extends TestCase
|
|||
parent.setGroupId( "gid" );
|
||||
|
||||
processor.process( parent, child, dependencies, false );
|
||||
assertEquals(1, dependencies.size());
|
||||
assertEquals( 1, dependencies.size() );
|
||||
|
||||
assertEquals("aid", dependencies.get( 0 ).getArtifactId());
|
||||
assertEquals("gid", dependencies.get( 0 ).getGroupId());
|
||||
assertEquals( "aid", dependencies.get( 0 ).getArtifactId() );
|
||||
assertEquals( "gid", dependencies.get( 0 ).getGroupId() );
|
||||
|
||||
}
|
||||
|
||||
|
@ -97,8 +98,8 @@ public class DependencyProcessorTest extends TestCase
|
|||
parent.addExclusion( e1 );
|
||||
|
||||
processor.process( parent, child, dependencies, false );
|
||||
assertEquals(2, dependencies.get( 0 ).getExclusions().size());
|
||||
assertEquals("aid", dependencies.get( 0 ).getExclusions().get( 0 ).getArtifactId());
|
||||
assertEquals("aid1", dependencies.get( 0 ).getExclusions().get( 1 ).getArtifactId());
|
||||
assertEquals( 2, dependencies.get( 0 ).getExclusions().size() );
|
||||
assertEquals( "aid", dependencies.get( 0 ).getExclusions().get( 0 ).getArtifactId() );
|
||||
assertEquals( "aid1", dependencies.get( 0 ).getExclusions().get( 1 ).getArtifactId() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ import org.apache.maven.model.Model;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class IssueManagementProcessorTest extends TestCase
|
||||
public class IssueManagementProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testChildCopy()
|
||||
{
|
||||
|
@ -21,7 +22,56 @@ public class IssueManagementProcessorTest extends TestCase
|
|||
IssueManagementProcessor proc = new IssueManagementProcessor();
|
||||
proc.process( null, child, target, false );
|
||||
|
||||
assertEquals("system", target.getIssueManagement().getSystem());
|
||||
assertEquals("http://url", target.getIssueManagement().getUrl());
|
||||
assertEquals( "system", target.getIssueManagement().getSystem() );
|
||||
assertEquals( "http://url", target.getIssueManagement().getUrl() );
|
||||
}
|
||||
|
||||
/**
|
||||
* If child does not have issue management node, then use parent.
|
||||
*/
|
||||
public void testParentCopy()
|
||||
{
|
||||
IssueManagement mng = new IssueManagement();
|
||||
mng.setSystem( "system" );
|
||||
mng.setUrl( "http://url" );
|
||||
|
||||
Model child = new Model();
|
||||
|
||||
Model parent = new Model();
|
||||
;
|
||||
parent.setIssueManagement( mng );
|
||||
|
||||
Model target = new Model();
|
||||
|
||||
IssueManagementProcessor proc = new IssueManagementProcessor();
|
||||
proc.process( parent, child, target, false );
|
||||
|
||||
assertEquals( "system", target.getIssueManagement().getSystem() );
|
||||
assertEquals( "http://url", target.getIssueManagement().getUrl() );
|
||||
}
|
||||
|
||||
public void testChildCopy_DontInheritParent()
|
||||
{
|
||||
IssueManagement mng = new IssueManagement();
|
||||
mng.setSystem( "system" );
|
||||
mng.setUrl( "http://url" );
|
||||
|
||||
Model child = new Model();
|
||||
child.setIssueManagement( mng );
|
||||
|
||||
IssueManagement mng1 = new IssueManagement();
|
||||
Model parent = new Model();
|
||||
;
|
||||
mng1.setSystem( "system-1" );
|
||||
mng1.setUrl( "http://url-1" );
|
||||
parent.setIssueManagement( mng1 );
|
||||
|
||||
Model target = new Model();
|
||||
|
||||
IssueManagementProcessor proc = new IssueManagementProcessor();
|
||||
proc.process( parent, child, target, false );
|
||||
|
||||
assertEquals( "system", target.getIssueManagement().getSystem() );
|
||||
assertEquals( "http://url", target.getIssueManagement().getUrl() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package org.apache.maven.project.processor;
|
||||
|
||||
import org.apache.maven.model.MailingList;
|
||||
import org.apache.maven.model.Model;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class MailingListProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testChildCopy()
|
||||
{
|
||||
Model child = new Model();
|
||||
|
||||
MailingList list = new MailingList();
|
||||
list.setArchive( "archive" );
|
||||
list.setPost( "post" );
|
||||
|
||||
child.getMailingLists().add( list );
|
||||
|
||||
Model target = new Model();
|
||||
|
||||
MailingListProcessor proc = new MailingListProcessor();
|
||||
proc.process( null, child, target, false );
|
||||
|
||||
assertEquals( "archive", target.getMailingLists().get( 0 ).getArchive() );
|
||||
|
||||
list.setArchive( "aaa" );
|
||||
assertEquals( "archive", target.getMailingLists().get( 0 ).getArchive() );
|
||||
}
|
||||
|
||||
public void testParentCopy()
|
||||
{
|
||||
Model child = new Model();
|
||||
|
||||
Model parent = new Model();
|
||||
|
||||
MailingList list = new MailingList();
|
||||
list.setArchive( "archive" );
|
||||
list.setPost( "post" );
|
||||
|
||||
parent.getMailingLists().add( list );
|
||||
|
||||
Model target = new Model();
|
||||
|
||||
MailingListProcessor proc = new MailingListProcessor();
|
||||
proc.process( parent, child, target, false );
|
||||
|
||||
assertEquals( "archive", target.getMailingLists().get( 0 ).getArchive() );
|
||||
|
||||
list.setArchive( "aaa" );
|
||||
assertEquals( "archive", target.getMailingLists().get( 0 ).getArchive() );
|
||||
}
|
||||
}
|
|
@ -7,121 +7,153 @@ import junit.framework.TestCase;
|
|||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Parent;
|
||||
|
||||
public class ModelProcessorTest extends TestCase
|
||||
public class ModelProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testModelProcessorVersion()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setVersion("1.0");
|
||||
public void testModelProcessorVersion()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setVersion( "1.0" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertEquals("1.0", targetModel.getVersion());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertEquals( "1.0", targetModel.getVersion() );
|
||||
}
|
||||
|
||||
public void testModelProcessorVersionFromParent()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
public void testModelProcessorVersionFromParent()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
|
||||
Parent parent = new Parent();
|
||||
parent.setVersion("1.0");
|
||||
childModel.setParent(parent);
|
||||
Parent parent = new Parent();
|
||||
parent.setVersion( "1.0" );
|
||||
childModel.setParent( parent );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertEquals("1.0", targetModel.getVersion());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertEquals( "1.0", targetModel.getVersion() );
|
||||
}
|
||||
|
||||
public void testModelProcessorGroupId()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setGroupId("gid");
|
||||
public void testModelProcessorGroupId()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setGroupId( "gid" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertEquals("gid", targetModel.getGroupId());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertEquals( "gid", targetModel.getGroupId() );
|
||||
}
|
||||
|
||||
public void testModelProcessorGroupIdFromParent()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
public void testModelProcessorGroupIdFromParent()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
|
||||
Parent parent = new Parent();
|
||||
parent.setGroupId("gid");
|
||||
childModel.setParent(parent);
|
||||
Parent parent = new Parent();
|
||||
parent.setGroupId( "gid" );
|
||||
childModel.setParent( parent );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertEquals("gid", targetModel.getGroupId());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertEquals( "gid", targetModel.getGroupId() );
|
||||
}
|
||||
|
||||
public void testModelVersion()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setModelVersion("4.0");
|
||||
public void testModelVersion()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setModelVersion( "4.0" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertEquals("4.0", targetModel.getModelVersion());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertEquals( "4.0", targetModel.getModelVersion() );
|
||||
}
|
||||
|
||||
public void testPackaging()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setPackaging("pom");
|
||||
public void testPackaging()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setPackaging( "pom" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertEquals("pom", targetModel.getPackaging());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertEquals( "pom", targetModel.getPackaging() );
|
||||
}
|
||||
|
||||
public void testNameSpecialized()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setName("name");
|
||||
public void testNameSpecialized()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setName( "name" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, true);
|
||||
assertEquals("name", targetModel.getName());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, true );
|
||||
assertEquals( "name", targetModel.getName() );
|
||||
}
|
||||
|
||||
public void testNameNotSpecialized()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setName("name");
|
||||
public void testNameNotSpecialized()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setName( "name" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertNull (targetModel.getName());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertNull( targetModel.getName() );
|
||||
}
|
||||
|
||||
public void testDescriptionSpecialized()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setDescription("description");
|
||||
public void testDescriptionSpecialized()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setDescription( "description" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, true);
|
||||
assertEquals("description", targetModel.getDescription());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, true );
|
||||
assertEquals( "description", targetModel.getDescription() );
|
||||
}
|
||||
|
||||
public void testDescriptionNotSpecialized()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setDescription("description");
|
||||
public void testDescriptionNotSpecialized()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setDescription( "description" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>());
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertNull(targetModel.getDescription());
|
||||
}
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertNull( targetModel.getDescription() );
|
||||
}
|
||||
|
||||
public void testInceptionYearFromChild()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setInceptionYear( "2000" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertEquals( "2000", targetModel.getInceptionYear() );
|
||||
|
||||
childModel.setInceptionYear( "2001" );
|
||||
assertEquals( "2000", targetModel.getInceptionYear() );
|
||||
}
|
||||
|
||||
public void testInceptionYearFromParent()
|
||||
{
|
||||
Model targetModel = new Model();
|
||||
|
||||
Model childModel = new Model();
|
||||
|
||||
Model parentModel = new Model();
|
||||
parentModel.setInceptionYear( "2000" );
|
||||
|
||||
ModelProcessor mp = new ModelProcessor( new ArrayList<Processor>() );
|
||||
mp.process( parentModel, childModel, targetModel, false );
|
||||
assertEquals( "2000", targetModel.getInceptionYear() );
|
||||
|
||||
parentModel.setInceptionYear( "2001" );
|
||||
assertEquals( "2000", targetModel.getInceptionYear() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,49 +6,51 @@ import org.apache.maven.model.Model;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class ModuleTest extends TestCase {
|
||||
public class ModuleTest
|
||||
extends TestCase
|
||||
{
|
||||
|
||||
public void testIsMostSpecialized()
|
||||
{
|
||||
ModuleProcessor proc = new ModuleProcessor();
|
||||
public void testIsMostSpecialized()
|
||||
{
|
||||
ModuleProcessor proc = new ModuleProcessor();
|
||||
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setModules(Arrays.asList("m1", "m2"));
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setModules( Arrays.asList( "m1", "m2" ) );
|
||||
|
||||
proc.process(null, childModel, targetModel, true);
|
||||
proc.process( null, childModel, targetModel, true );
|
||||
|
||||
assertEquals(2, targetModel.getModules().size());
|
||||
assertEquals("m1", targetModel.getModules().get(0));
|
||||
assertEquals("m2", targetModel.getModules().get(1));
|
||||
}
|
||||
assertEquals( 2, targetModel.getModules().size() );
|
||||
assertEquals( "m1", targetModel.getModules().get( 0 ) );
|
||||
assertEquals( "m2", targetModel.getModules().get( 1 ) );
|
||||
}
|
||||
|
||||
public void testIsNotMostSpecialized()
|
||||
{
|
||||
ModuleProcessor proc = new ModuleProcessor();
|
||||
public void testIsNotMostSpecialized()
|
||||
{
|
||||
ModuleProcessor proc = new ModuleProcessor();
|
||||
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setModules(Arrays.asList("m1", "m2"));
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setModules( Arrays.asList( "m1", "m2" ) );
|
||||
|
||||
proc.process(null, childModel, targetModel, false);
|
||||
proc.process( null, childModel, targetModel, false );
|
||||
|
||||
assertEquals(0, targetModel.getModules().size());
|
||||
}
|
||||
assertEquals( 0, targetModel.getModules().size() );
|
||||
}
|
||||
|
||||
public void testImmutable()
|
||||
{
|
||||
ModuleProcessor proc = new ModuleProcessor();
|
||||
public void testImmutable()
|
||||
{
|
||||
ModuleProcessor proc = new ModuleProcessor();
|
||||
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setModules(Arrays.asList("m1", "m2"));
|
||||
Model targetModel = new Model();
|
||||
Model childModel = new Model();
|
||||
childModel.setModules( Arrays.asList( "m1", "m2" ) );
|
||||
|
||||
proc.process(null, childModel, targetModel, true);
|
||||
proc.process( null, childModel, targetModel, true );
|
||||
|
||||
childModel.getModules().set(0, "m0");
|
||||
childModel.getModules().set( 0, "m0" );
|
||||
|
||||
assertEquals("m1", targetModel.getModules().get(0));
|
||||
}
|
||||
assertEquals( "m1", targetModel.getModules().get( 0 ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package org.apache.maven.project.processor;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Organization;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OrganizationProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testChildCopy()
|
||||
{
|
||||
Model child = new Model();
|
||||
Organization org = new Organization();
|
||||
org.setName( "name" );
|
||||
org.setUrl( "url" );
|
||||
|
||||
child.setOrganization( org );
|
||||
|
||||
Model target = new Model();
|
||||
|
||||
OrganizationProcessor proc = new OrganizationProcessor();
|
||||
proc.process( null, child, target, false );
|
||||
|
||||
assertNotNull( target.getOrganization() );
|
||||
assertEquals( "name", target.getOrganization().getName() );
|
||||
assertEquals( "url", target.getOrganization().getUrl() );
|
||||
|
||||
org.setName( "new" );
|
||||
assertEquals( "name", target.getOrganization().getName() );
|
||||
}
|
||||
|
||||
public void testParentCopy()
|
||||
{
|
||||
Model child = new Model();
|
||||
Organization org = new Organization();
|
||||
org.setName( "name" );
|
||||
org.setUrl( "url" );
|
||||
|
||||
Model parent = new Model();
|
||||
parent.setOrganization( org );
|
||||
|
||||
Model target = new Model();
|
||||
|
||||
OrganizationProcessor proc = new OrganizationProcessor();
|
||||
proc.process( parent, child, target, false );
|
||||
|
||||
assertNotNull( target.getOrganization() );
|
||||
assertEquals( "name", target.getOrganization().getName() );
|
||||
assertEquals( "url", target.getOrganization().getUrl() );
|
||||
|
||||
org.setName( "new" );
|
||||
assertEquals( "name", target.getOrganization().getName() );
|
||||
}
|
||||
}
|
|
@ -5,7 +5,8 @@ import org.apache.maven.model.Parent;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class ParentProcessorTest extends TestCase
|
||||
public class ParentProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testVersion()
|
||||
{
|
||||
|
@ -13,10 +14,10 @@ public class ParentProcessorTest extends TestCase
|
|||
Model childModel = new Model();
|
||||
Parent parent = new Parent();
|
||||
parent.setVersion( "1.0" );
|
||||
childModel.setParent(parent);
|
||||
childModel.setParent( parent );
|
||||
|
||||
ParentProcessor mp = new ParentProcessor();
|
||||
mp.process(null, childModel, targetModel, false);
|
||||
assertEquals("1.0", targetModel.getParent().getVersion());
|
||||
mp.process( null, childModel, targetModel, false );
|
||||
assertEquals( "1.0", targetModel.getParent().getVersion() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ import org.apache.maven.model.Prerequisites;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class PrerequisitesProcessorTest extends TestCase
|
||||
public class PrerequisitesProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
|
||||
public void testMaven()
|
||||
|
@ -21,11 +22,11 @@ public class PrerequisitesProcessorTest extends TestCase
|
|||
PrerequisitesProcessor proc = new PrerequisitesProcessor();
|
||||
proc.process( null, child, target, true );
|
||||
|
||||
assertEquals("2.1", target.getPrerequisites().getMaven());
|
||||
assertEquals( "2.1", target.getPrerequisites().getMaven() );
|
||||
|
||||
//Immutable
|
||||
// Immutable
|
||||
prerequisites.setMaven( "2.2" );
|
||||
assertEquals("2.1", target.getPrerequisites().getMaven());
|
||||
assertEquals( "2.1", target.getPrerequisites().getMaven() );
|
||||
|
||||
}
|
||||
|
||||
|
@ -42,7 +43,7 @@ public class PrerequisitesProcessorTest extends TestCase
|
|||
PrerequisitesProcessor proc = new PrerequisitesProcessor();
|
||||
proc.process( parent, new Model(), target, false );
|
||||
|
||||
assertEquals(null, target.getPrerequisites());
|
||||
assertEquals( null, target.getPrerequisites() );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ import junit.framework.TestCase;
|
|||
|
||||
import org.apache.maven.model.Model;
|
||||
|
||||
public class PropertiesProcessorTest extends TestCase
|
||||
public class PropertiesProcessorTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testParentChildMerge()
|
||||
{
|
||||
|
@ -25,15 +26,14 @@ public class PropertiesProcessorTest extends TestCase
|
|||
PropertiesProcessor proc = new PropertiesProcessor();
|
||||
proc.process( parentModel, childModel, targetModel, false );
|
||||
|
||||
assertEquals(2, targetModel.getProperties().size());
|
||||
assertEquals( 2, targetModel.getProperties().size() );
|
||||
|
||||
//Test order of child first
|
||||
// Test order of child first
|
||||
/*
|
||||
ArrayList list = Collections.list( targetModel.getProperties().elements() );
|
||||
targetModel.getProperties().list( System.out );
|
||||
assertEquals("v1", list.get( 0 ));
|
||||
assertEquals("v2", list.get( 1 ));
|
||||
*/
|
||||
* ArrayList list = Collections.list( targetModel.getProperties().elements() );
|
||||
* targetModel.getProperties().list( System.out ); assertEquals("v1", list.get( 0 )); assertEquals("v2",
|
||||
* list.get( 1 ));
|
||||
*/
|
||||
}
|
||||
|
||||
public void testChildCopy()
|
||||
|
@ -48,7 +48,7 @@ public class PropertiesProcessorTest extends TestCase
|
|||
PropertiesProcessor proc = new PropertiesProcessor();
|
||||
proc.process( null, childModel, targetModel, false );
|
||||
|
||||
assertEquals(1, targetModel.getProperties().size());
|
||||
assertEquals( 1, targetModel.getProperties().size() );
|
||||
}
|
||||
|
||||
public void testParentCopy()
|
||||
|
@ -64,6 +64,6 @@ public class PropertiesProcessorTest extends TestCase
|
|||
PropertiesProcessor proc = new PropertiesProcessor();
|
||||
proc.process( parentModel, childModel, targetModel, false );
|
||||
|
||||
assertEquals(1, targetModel.getProperties().size());
|
||||
assertEquals( 1, targetModel.getProperties().size() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue