You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2019/05/12 17:47:21 UTC

[maven-resolver] branch MRESOLVER-62_tests created (now ae26635)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch MRESOLVER-62_tests
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git.


      at ae26635  Add tests for MRESOLVER-62 (currently inversed)

This branch includes the following new commits:

     new ae26635  Add tests for MRESOLVER-62 (currently inversed)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-resolver] 01/01: Add tests for MRESOLVER-62 (currently inversed)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-62_tests
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit ae2663566283c31c719eca593e58ac468a125b5c
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun May 12 19:45:56 2019 +0200

    Add tests for MRESOLVER-62 (currently inversed)
---
 .../transformer/NearestVersionSelectorTest.java    | 33 ++++++++++++++++++++--
 .../cycle-underneath-removed-node.txt              | 20 +++++++++++++
 .../cycle-underneath-removed-node2.txt             | 17 +++++++++++
 3 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/maven-resolver-util/src/test/java/org/eclipse/aether/util/graph/transformer/NearestVersionSelectorTest.java b/maven-resolver-util/src/test/java/org/eclipse/aether/util/graph/transformer/NearestVersionSelectorTest.java
index b71adab..ab40650 100644
--- a/maven-resolver-util/src/test/java/org/eclipse/aether/util/graph/transformer/NearestVersionSelectorTest.java
+++ b/maven-resolver-util/src/test/java/org/eclipse/aether/util/graph/transformer/NearestVersionSelectorTest.java
@@ -8,9 +8,9 @@ package org.eclipse.aether.util.graph.transformer;
  * to you 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
@@ -82,6 +82,35 @@ public class NearestVersionSelectorTest
         assertEquals( 5, trail.size() );
     }
 
+    // This test must be assertTrue() as soon as MRESOLVER-62 is fixed
+    @Test
+    public void testCycleUnderneathRemovedNode()
+        throws Exception
+    {
+        DependencyNode root = parseResource("cycle-underneath-removed-node.txt" );
+
+        assertSame( root, transform( root ) );
+        List<DependencyNode> trail = find( root, "y" );
+        assertEquals( 6, trail.size() );
+
+        // Node y should have children removed
+        assertFalse( trail.get(0).getChildren().isEmpty() );
+    }
+
+    // This test must be assertFalse() as soon as MRESOLVER-62 is fixed
+    @Test
+    public void testCycleUnderneathRemovedNode2()
+        throws Exception
+    {
+        DependencyNode root = parseResource("cycle-underneath-removed-node2.txt" );
+
+        assertSame( root, transform( root ) );
+
+        // Node x should be present
+        List<DependencyNode> trail = find( root, "x" );
+        assertTrue( trail.isEmpty() );
+    }
+
     @Test
     public void testViolationOfHardConstraintFallsBackToNearestSeenNotFirstSeen()
         throws Exception
diff --git a/maven-resolver-util/src/test/resources/transformer/version-resolver/cycle-underneath-removed-node.txt b/maven-resolver-util/src/test/resources/transformer/version-resolver/cycle-underneath-removed-node.txt
new file mode 100644
index 0000000..5406c72
--- /dev/null
+++ b/maven-resolver-util/src/test/resources/transformer/version-resolver/cycle-underneath-removed-node.txt
@@ -0,0 +1,20 @@
+# This graph has a cycle (x <-> y) underneath a node that is removed from the tree (a:1).
+# However, this cycle also appears as a child of another cycle. Specifically, (q <-> p) depends on d, which depends on x.
+# When conflicts are resolved, the cycle between x and y should be broken.
+(null)
++- gid:a:1
+|  \- gid:x:1                  (x)
+|     \- gid:y:1
+|        \- ^x
++- gid:a:2
++- gid:b:1
+|  +- gid:c:1
+|     \- gid:d:1               (d)
+|        \- ^x
+\- gid:m:1
+   \- gid:n:1
+      +- gid:p:1
+      |  \- gid:q:1
+      \- gid:q:2
+         \- gid:p:2
+            \- ^d
\ No newline at end of file
diff --git a/maven-resolver-util/src/test/resources/transformer/version-resolver/cycle-underneath-removed-node2.txt b/maven-resolver-util/src/test/resources/transformer/version-resolver/cycle-underneath-removed-node2.txt
new file mode 100644
index 0000000..23e4a91
--- /dev/null
+++ b/maven-resolver-util/src/test/resources/transformer/version-resolver/cycle-underneath-removed-node2.txt
@@ -0,0 +1,17 @@
+# This graph has a cycle (x <-> y) underneath a node that is removed from the tree (a:1).
+# However, this cycle also appears as a child of another cycle.
+# Specifically, q:2 depends on x and is part of a cycle (p <-> q).
+# When conflicts are resolved, x should be included.
+(null)
++- gid:a:1
+|  \- gid:x:1                  (x)
+|     \- gid:y:1
+|        \- ^x
++- gid:a:2
+\- gid:m:1
+   \- gid:n:1
+      +- gid:p:1
+      |  \- gid:q:1
+      \- gid:q:2
+         |- gid:p:2
+         \- ^x
\ No newline at end of file