1 package org.apache.maven.resolver.internal.ant;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.io.IOException;
24
25 import org.apache.maven.resolver.internal.ant.ProjectWorkspaceReader;
26 import org.eclipse.aether.artifact.Artifact;
27 import org.eclipse.aether.artifact.DefaultArtifact;
28
29 public class ReactorTest
30 extends AntBuildsTest
31 {
32
33 private Artifact artifact( String coords )
34 {
35 return new DefaultArtifact( coords );
36 }
37
38 public void testPom()
39 throws IOException
40 {
41 executeTarget( "testPom" );
42 ProjectWorkspaceReader reader = ProjectWorkspaceReader.getInstance();
43 File found = reader.findArtifact( artifact( "test:test:pom:0.1-SNAPSHOT" ) );
44 assertNotNull( found );
45 assertEquals( new File( projectDir, "pom1.xml" ), found.getAbsoluteFile() );
46 }
47
48 public void testArtifact()
49 throws IOException
50 {
51 executeTarget( "testArtifact" );
52 ProjectWorkspaceReader reader = ProjectWorkspaceReader.getInstance();
53 File found = reader.findArtifact( artifact( "test:test:pom:0.1-SNAPSHOT" ) );
54 assertNotNull( found );
55 assertEquals( new File( projectDir, "pom1.xml" ), found.getAbsoluteFile() );
56
57 found = reader.findArtifact( artifact( "test:test:xml:0.1-SNAPSHOT" ) );
58 assertNotNull( found );
59 assertEquals( new File( projectDir, "pom1.xml" ), found.getAbsoluteFile() );
60 }
61
62 public void testArtifactInMemoryPom()
63 throws IOException
64 {
65 executeTarget( "testArtifactInMemoryPom" );
66 ProjectWorkspaceReader reader = ProjectWorkspaceReader.getInstance();
67 File found = reader.findArtifact( artifact( "test:test:pom:0.1-SNAPSHOT" ) );
68 assertNull( found );
69
70 found = reader.findArtifact( artifact( "test:test:xml:0.1-SNAPSHOT" ) );
71 assertNotNull( found );
72 assertEquals( new File( projectDir, "pom1.xml" ), found.getAbsoluteFile() );
73 }
74
75 public void testResolveArtifact()
76 throws IOException
77 {
78 executeTarget( "testResolveArtifact" );
79 String prop = project.getProperty( "resolve.test:test:jar" );
80 assertEquals( new File( projectDir, "pom1.xml" ).getAbsolutePath(), prop );
81 }
82
83 public void testResolveArtifactInMemoryPom()
84 throws IOException
85 {
86 executeTarget( "testResolveArtifactInMemoryPom" );
87 String prop = project.getProperty( "resolve.test:test:jar" );
88 assertEquals( new File( projectDir, "pom1.xml" ).getAbsolutePath(), prop );
89 assertLogContaining( "The POM for test:test:jar:0.1-SNAPSHOT is missing, no dependency information available" );
90 }
91
92 public void testResolveVersionRange()
93 throws IOException
94 {
95 executeTarget( "testResolveVersionRange" );
96 String prop = project.getProperty( "resolve.test:test:jar" );
97 assertEquals( new File( projectDir, "pom1.xml" ).getAbsolutePath(), prop );
98 }
99
100 }