maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ogusa...@apache.org
Subject svn commit: r769124 - in /maven/mercury/trunk: mercury-core/src/main/java/org/apache/maven/mercury/metadata/ mercury-it/src/test/java/org/apache/maven/mercury/dependency/tests/
Date Mon, 27 Apr 2009 19:37:46 GMT
Author: ogusakov
Date: Mon Apr 27 19:37:46 2009
New Revision: 769124

URL: http://svn.apache.org/viewvc?rev=769124&view=rev
Log:
[MERCURY-114] added IT to DependencyTreeBuilderTest to managed versions

Modified:
    maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java
    maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
    maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/dependency/tests/DependencyTreeBuilderTest.java

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java?rev=769124&r1=769123&r2=769124&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java
(original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java
Mon Apr 27 19:37:46 2009
@@ -68,6 +68,8 @@
       return create( dependencyModel, repositories, null, null, null, null );
   }
   
+  // TODO: oleg: switch to request/response paradigm - too many parameters
+  //
   public static final DependencyBuilder create(
         String dependencyModel
       , Collection<Repository> repositories

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java?rev=769124&r1=769123&r2=769124&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
(original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
Mon Apr 27 19:37:46 2009
@@ -90,7 +90,7 @@
     
     private boolean _allowCircularDependencies = Boolean.parseBoolean( System.getProperty(
SYSTEM_PROPERTY_ALLOW_CIRCULAR_DEPENDENCIES, "false" ) );
     
-    /** mandated versions in the format G:A -> V */
+    /** mandated versions in the format G:A:T[:C] -> V */
     private Map<String, ArtifactMetadata> _versionMap;
     
     class TruckLoad

Modified: maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/dependency/tests/DependencyTreeBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/dependency/tests/DependencyTreeBuilderTest.java?rev=769124&r1=769123&r2=769124&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/dependency/tests/DependencyTreeBuilderTest.java
(original)
+++ maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/dependency/tests/DependencyTreeBuilderTest.java
Mon Apr 27 19:37:46 2009
@@ -21,6 +21,7 @@
 import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
@@ -314,5 +315,62 @@
 
   }
   //----------------------------------------------------------------------------------------------
+  // modify the resolution by demanding plexus-util:1.5.8, by default clean plugin 2.2 depends
on plexus-util:1.1 
+  public void testManagedVersionMap()
+  throws Exception
+  {
+      String centralUrl = "http://repo1.maven.org/maven2";
+
+      String artifactId = "org.apache.maven.plugins:maven-clean-plugin:2.2";
+      
+      reps.clear();
+      
+      File versionMapRepo = new File( "./target/repoVersionMap" );
+      localRepo = new LocalRepositoryM2( "testVersionMap", versionMapRepo, new MavenDependencyProcessor()
);
+      reps.add(  localRepo );
+
+      Server server = new Server( "id", new URL(centralUrl) );
+      remoteRepo = new RemoteRepositoryM2(server, new MavenDependencyProcessor());
+      remoteRepo.setUpdatePolicy( RepositoryUpdateIntervalPolicy.UPDATE_POLICY_NEVER );
+      reps.add( remoteRepo );
+      
+      ArtifactMetadata modifiedDep = new ArtifactMetadata("org.codehaus.plexus:plexus-utils:1.5.8");
+      Map<String, ArtifactMetadata> versionMap = new HashMap<String, ArtifactMetadata>(1);
+      String key = modifiedDep.toManagementString();
+      versionMap.put( key, modifiedDep );
+      
+      Map<String,Object> config = new HashMap<String, Object>(1);
+      config.put( DependencyBuilder.CONFIGURATION_PROPERTY_VERSION_MAP, versionMap );
+      
+      depBuilder = DependencyBuilderFactory.create( DependencyBuilderFactory.JAVA_DEPENDENCY_MODEL,
reps, null, null, null, config );
+//      depBuilder.register( new DumbListener() );
+      
+      ArtifactMetadata md = new ArtifactMetadata( artifactId );
+
+      MetadataTreeNode root = depBuilder.buildTree( md, ArtifactScopeEnum.compile );
+
+      assertNotNull( "null tree built", root );
+      
+//      assertTrue( "wrong tree size, expected gte 4", 4 <= root.countNodes() );
+
+      List<ArtifactMetadata> res = depBuilder.resolveConflicts( root );
+      
+      assertNotNull( res );
+      
+      assertTrue( res.size() > 1 );
+
+      showClasspath( res );
+      
+      for( ArtifactMetadata am : res )
+      {
+          if( 
+              "org.codehaus.plexus".equals( am.getGroupId() )
+              &&
+              "plexus-utils".equals( am.getArtifactId() )
+            )
+              assertEquals( "1.5.8", am.getVersion() );
+      }
+  }
+  //----------------------------------------------------------------------------------------------
   //----------------------------------------------------------------------------------------------
 }
\ No newline at end of file



Mime
View raw message