maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ogusa...@apache.org
Subject svn commit: r702213 - /maven/sandbox/trunk/mercury/mercury-artifact/src/test/java/org/apache/maven/mercury/artifact/DependencyFilterTest.java
Date Mon, 06 Oct 2008 17:54:18 GMT
Author: ogusakov
Date: Mon Oct  6 10:54:17 2008
New Revision: 702213

URL: http://svn.apache.org/viewvc?rev=702213&view=rev
Log:
dependency metadata inc/exc test

Added:
    maven/sandbox/trunk/mercury/mercury-artifact/src/test/java/org/apache/maven/mercury/artifact/DependencyFilterTest.java

Added: maven/sandbox/trunk/mercury/mercury-artifact/src/test/java/org/apache/maven/mercury/artifact/DependencyFilterTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-artifact/src/test/java/org/apache/maven/mercury/artifact/DependencyFilterTest.java?rev=702213&view=auto
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-artifact/src/test/java/org/apache/maven/mercury/artifact/DependencyFilterTest.java
(added)
+++ maven/sandbox/trunk/mercury/mercury-artifact/src/test/java/org/apache/maven/mercury/artifact/DependencyFilterTest.java
Mon Oct  6 10:54:17 2008
@@ -0,0 +1,89 @@
+package org.apache.maven.mercury.artifact;
+
+import java.util.ArrayList;
+
+import org.apache.maven.mercury.artifact.version.VersionException;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public class DependencyFilterTest
+    extends TestCase
+{
+  ArtifactBasicMetadata a1;
+  ArtifactBasicMetadata a2;
+  ArtifactBasicMetadata a3;
+  ArtifactBasicMetadata a4;
+
+  ArrayList<ArtifactBasicMetadata> inc;
+  ArrayList<ArtifactBasicMetadata> exc;
+  
+  @Override
+  protected void setUp()
+  throws Exception
+  {
+    a1 = new ArtifactBasicMetadata("a:a:1.1");
+    a2 = new ArtifactBasicMetadata("a:a:2.1");
+    a3 = new ArtifactBasicMetadata("a:a:3.1");
+    a4 = new ArtifactBasicMetadata("a:a:4.1");
+    
+    inc = new ArrayList<ArtifactBasicMetadata>();
+    inc.add(  new ArtifactBasicMetadata("a:a") );
+    inc.add(  new ArtifactBasicMetadata("b:b:2.0.0") );
+    
+    exc = new ArrayList<ArtifactBasicMetadata>();
+    exc.add(  new ArtifactBasicMetadata("c:c") );
+    exc.add(  new ArtifactBasicMetadata("b:b:2.0.1") );
+    
+    a2.setInclusions( inc );
+    
+    a3.setExclusions( exc );
+    
+    a4.setInclusions( inc );
+    a4.setExclusions( exc );
+  }
+  
+  public void testNoFilter()
+  throws VersionException
+  {
+    assertTrue( a1.vetDependency( new ArtifactBasicMetadata("a:a:2.0.0") ) );
+    assertTrue( a1.vetDependency( new ArtifactBasicMetadata("b:b:1.0.0") ) );
+    assertTrue( a1.vetDependency( new ArtifactBasicMetadata("c:c:1.0.0") ) );
+  }
+  
+  public void testInclusionsFilter()
+  throws VersionException
+  {
+    assertTrue( a2.vetDependency( new ArtifactBasicMetadata("a:a:2.0.0") ) );
+    assertFalse( a2.vetDependency( new ArtifactBasicMetadata("b:b:1.0.0") ) );
+    assertTrue( a2.vetDependency( new ArtifactBasicMetadata("b:b:2.0.1") ) );
+    assertFalse( a2.vetDependency( new ArtifactBasicMetadata("c:c:1.0.0") ) );
+  }
+  
+  public void testExclusionsFilter()
+  throws VersionException
+  {
+    assertTrue( a3.vetDependency( new ArtifactBasicMetadata("a:a:2.0.0") ) );
+    assertTrue( a3.vetDependency( new ArtifactBasicMetadata("b:b:1.0.0") ) );
+    assertFalse( a3.vetDependency( new ArtifactBasicMetadata("b:b:2.0.1") ) );
+    assertFalse( a3.vetDependency( new ArtifactBasicMetadata("c:c:1.0.0") ) );
+  }
+  
+  public void testInclusionsExclusionsFilter()
+  throws VersionException
+  {
+    assertTrue( a4.vetDependency( new ArtifactBasicMetadata("a:a:2.0.0") ) );
+    assertFalse( a4.vetDependency( new ArtifactBasicMetadata("b:b:1.0.0") ) );
+    assertTrue( a4.vetDependency( new ArtifactBasicMetadata("b:b:2.0.0") ) );
+    assertFalse( a4.vetDependency( new ArtifactBasicMetadata("b:b:2.0.1") ) );
+    assertFalse( a4.vetDependency( new ArtifactBasicMetadata("b:b:3.0.1") ) );
+    assertFalse( a4.vetDependency( new ArtifactBasicMetadata("c:c:1.0.0") ) );
+  }
+
+}



Mime
View raw message