Search in sources :

Example 1 with DependencyGraphTransformationContext

use of org.sonatype.aether.collection.DependencyGraphTransformationContext in project sonatype-aether by sonatype.

the class ConflictMarkerTest method testRelocation3.

@Test
public void testRelocation3() throws Exception {
    NodeBuilder builder = new NodeBuilder();
    DependencyNode root = builder.build();
    root.getChildren().add(builder.artifactId("a").build());
    root.getChildren().add(builder.artifactId("b").build());
    root.getChildren().add(builder.artifactId("c").reloc("a").reloc("b").build());
    DependencyGraphTransformationContext context = newContext();
    assertSame(root, new ConflictMarker().transformGraph(root, context));
    Map<?, ?> ids = (Map<?, ?>) context.get(TransformationContextKeys.CONFLICT_IDS);
    assertNotNull(ids);
    assertNull(ids.get(root));
    assertNotNull(ids.get(root.getChildren().get(0)));
    assertNotNull(ids.get(root.getChildren().get(1)));
    assertNotNull(ids.get(root.getChildren().get(2)));
    assertSame(ids.get(root.getChildren().get(0)), ids.get(root.getChildren().get(1)));
    assertSame(ids.get(root.getChildren().get(1)), ids.get(root.getChildren().get(2)));
}
Also used : DependencyGraphTransformationContext(org.sonatype.aether.collection.DependencyGraphTransformationContext) DependencyNode(org.sonatype.aether.graph.DependencyNode) ConflictMarker(org.sonatype.aether.util.graph.transformer.ConflictMarker) NodeBuilder(org.sonatype.aether.test.util.NodeBuilder) Map(java.util.Map) Test(org.junit.Test)

Example 2 with DependencyGraphTransformationContext

use of org.sonatype.aether.collection.DependencyGraphTransformationContext in project sonatype-aether by sonatype.

the class ConflictMarkerTest method testRelocation2.

@Test
public void testRelocation2() throws Exception {
    NodeBuilder builder = new NodeBuilder();
    DependencyNode root = builder.build();
    root.getChildren().add(builder.artifactId("a").reloc("reloc").build());
    root.getChildren().add(builder.artifactId("a").build());
    DependencyGraphTransformationContext context = newContext();
    assertSame(root, new ConflictMarker().transformGraph(root, context));
    Map<?, ?> ids = (Map<?, ?>) context.get(TransformationContextKeys.CONFLICT_IDS);
    assertNotNull(ids);
    assertNull(ids.get(root));
    assertNotNull(ids.get(root.getChildren().get(0)));
    assertNotNull(ids.get(root.getChildren().get(1)));
    assertSame(ids.get(root.getChildren().get(0)), ids.get(root.getChildren().get(1)));
}
Also used : DependencyGraphTransformationContext(org.sonatype.aether.collection.DependencyGraphTransformationContext) DependencyNode(org.sonatype.aether.graph.DependencyNode) ConflictMarker(org.sonatype.aether.util.graph.transformer.ConflictMarker) NodeBuilder(org.sonatype.aether.test.util.NodeBuilder) Map(java.util.Map) Test(org.junit.Test)

Example 3 with DependencyGraphTransformationContext

use of org.sonatype.aether.collection.DependencyGraphTransformationContext in project sonatype-aether by sonatype.

the class ConflictMarkerTest method testRelocation1.

@Test
public void testRelocation1() throws Exception {
    NodeBuilder builder = new NodeBuilder();
    DependencyNode root = builder.build();
    root.getChildren().add(builder.artifactId("a").build());
    root.getChildren().add(builder.artifactId("a").reloc("reloc").build());
    DependencyGraphTransformationContext context = newContext();
    assertSame(root, new ConflictMarker().transformGraph(root, context));
    Map<?, ?> ids = (Map<?, ?>) context.get(TransformationContextKeys.CONFLICT_IDS);
    assertNotNull(ids);
    assertNull(ids.get(root));
    assertNotNull(ids.get(root.getChildren().get(0)));
    assertNotNull(ids.get(root.getChildren().get(1)));
    assertSame(ids.get(root.getChildren().get(0)), ids.get(root.getChildren().get(1)));
}
Also used : DependencyGraphTransformationContext(org.sonatype.aether.collection.DependencyGraphTransformationContext) DependencyNode(org.sonatype.aether.graph.DependencyNode) ConflictMarker(org.sonatype.aether.util.graph.transformer.ConflictMarker) NodeBuilder(org.sonatype.aether.test.util.NodeBuilder) Map(java.util.Map) Test(org.junit.Test)

Example 4 with DependencyGraphTransformationContext

use of org.sonatype.aether.collection.DependencyGraphTransformationContext in project sonatype-aether by sonatype.

the class ConflictMarkerTest method testSimple.

@Test
public void testSimple() throws Exception {
    NodeBuilder builder = new NodeBuilder();
    DependencyNode root = builder.build();
    root.getChildren().add(builder.artifactId("a").build());
    root.getChildren().add(builder.artifactId("b").build());
    DependencyGraphTransformationContext context = newContext();
    assertSame(root, new ConflictMarker().transformGraph(root, context));
    Map<?, ?> ids = (Map<?, ?>) context.get(TransformationContextKeys.CONFLICT_IDS);
    assertNotNull(ids);
    assertNull(ids.get(root));
    assertNotNull(ids.get(root.getChildren().get(0)));
    assertNotNull(ids.get(root.getChildren().get(1)));
    assertNotSame(ids.get(root.getChildren().get(0)), ids.get(root.getChildren().get(1)));
    assertFalse(ids.get(root.getChildren().get(0)).equals(ids.get(root.getChildren().get(1))));
}
Also used : DependencyGraphTransformationContext(org.sonatype.aether.collection.DependencyGraphTransformationContext) DependencyNode(org.sonatype.aether.graph.DependencyNode) ConflictMarker(org.sonatype.aether.util.graph.transformer.ConflictMarker) NodeBuilder(org.sonatype.aether.test.util.NodeBuilder) Map(java.util.Map) Test(org.junit.Test)

Aggregations

Map (java.util.Map)4 Test (org.junit.Test)4 DependencyGraphTransformationContext (org.sonatype.aether.collection.DependencyGraphTransformationContext)4 DependencyNode (org.sonatype.aether.graph.DependencyNode)4 NodeBuilder (org.sonatype.aether.test.util.NodeBuilder)4 ConflictMarker (org.sonatype.aether.util.graph.transformer.ConflictMarker)4