use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class PatternInclusionsDependencyFilterTest method acceptTestLessToken.
@Test
public void acceptTestLessToken() {
NodeBuilder builder = new NodeBuilder();
builder.groupId("com.example.test").artifactId("testArtifact").ext("jar").version("1.0.3");
DependencyNode node = builder.build();
assertEquals("com.example.test:testArtifact:jar", true, accept(node, "com.example.test:testArtifact:jar"));
assertEquals("com.example.test:testArtifact", true, accept(node, "com.example.test:testArtifact"));
assertEquals("com.example.test", true, accept(node, "com.example.test"));
assertEquals("com.example.foo", false, accept(node, "com.example.foo"));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class PatternInclusionsDependencyFilterTest method acceptTestRange.
@Test
public void acceptTestRange() {
NodeBuilder builder = new NodeBuilder();
builder.groupId("com.example.test").artifactId("testArtifact").ext("jar").version("1.0.3");
DependencyNode node = builder.build();
String prefix = "com.example.test:testArtifact:jar:";
assertTrue(prefix + "[1.0.3,1.0.4)", acceptVersionRange(node, prefix + "[1.0.3,1.0.4)"));
assertTrue(prefix + "[1.0.3,)", acceptVersionRange(node, prefix + "[1.0.3,)"));
assertTrue(prefix + "[1.0.3,]", acceptVersionRange(node, prefix + "[1.0.3,]"));
assertTrue(prefix + "(,1.0.3]", acceptVersionRange(node, prefix + "(,1.0.3]"));
assertTrue(prefix + "[1.0,]", acceptVersionRange(node, prefix + "[1.0,]"));
assertTrue(prefix + "[1,4]", acceptVersionRange(node, prefix + "[1,4]"));
assertTrue(prefix + "(1,4)", acceptVersionRange(node, prefix + "(1,4)"));
assertTrue(prefix + "(1.0.2,1.0.3]", acceptVersionRange(node, prefix + "(1.0.2,1.0.3]", prefix + "(1.1,)"));
assertFalse(prefix + "(1.0.3,2.0]", acceptVersionRange(node, prefix + "(1.0.3,2.0]"));
assertFalse(prefix + "(1,1.0.2]", acceptVersionRange(node, prefix + "(1,1.0.2]"));
assertFalse(prefix + "(1.0.2,1.0.3)", acceptVersionRange(node, prefix + "(1.0.2,1.0.3)", prefix + "(1.0.3,)"));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class DependencyFilterUtilsTest method testClasspathFilterUnknownScope.
@Test
public void testClasspathFilterUnknownScope() {
NodeBuilder builder = new NodeBuilder().artifactId("aid");
DependencyFilter filter = DependencyFilterUtils.classpathFilter("compile");
assertTrue(filter.accept(builder.scope("").build(), PARENTS));
assertTrue(filter.accept(builder.scope("unknown").build(), PARENTS));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class DependencyFilterUtilsTest method testClasspathFilterRuntimeCommaSystem.
@Test
public void testClasspathFilterRuntimeCommaSystem() {
NodeBuilder builder = new NodeBuilder().artifactId("aid");
DependencyFilter filter = DependencyFilterUtils.classpathFilter("runtime,system");
assertTrue(filter.accept(builder.scope("compile").build(), PARENTS));
assertTrue(filter.accept(builder.scope("system").build(), PARENTS));
assertFalse(filter.accept(builder.scope("provided").build(), PARENTS));
assertTrue(filter.accept(builder.scope("runtime").build(), PARENTS));
assertFalse(filter.accept(builder.scope("test").build(), PARENTS));
}
use of org.sonatype.aether.test.util.NodeBuilder 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)));
}
Aggregations