1 package org.apache.maven.plugin.resources.remote.it;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.it.VerificationException;
23 import org.apache.maven.it.Verifier;
24 import org.apache.maven.plugin.resources.remote.it.support.TestUtils;
25 import org.codehaus.plexus.util.FileUtils;
26
27 import java.io.File;
28 import java.io.IOException;
29 import java.net.URISyntaxException;
30
31
32
33
34 public class IT_RunOnlyAtExecutionRoot
35 extends AbstractIT
36 {
37
38 public void test()
39 throws IOException, URISyntaxException, VerificationException
40 {
41 File dir = TestUtils.getTestDir( "run-only-at-execution-root" );
42
43 Verifier verifier;
44
45 verifier = new Verifier( new File( dir, "resource-projects" ).getAbsolutePath() );
46 verifier.executeGoal( "deploy" );
47 verifier.verifyErrorFreeLog();
48 verifier.resetStreams();
49
50 verifier = new Verifier( dir.getAbsolutePath() );
51
52 verifier.deleteArtifacts( "org.apache.maven.plugin.rresource.it.mrr41" );
53
54 verifier.executeGoal( "generate-resources" );
55 verifier.verifyErrorFreeLog();
56 verifier.resetStreams();
57
58 String depResource = "target/maven-shared-archive-resources/DEPENDENCIES";
59 File output = new File( dir, depResource );
60 assertTrue( output.exists() );
61
62 assertFalse( new File( dir, "child1/" + depResource ).exists() );
63 assertFalse( new File( dir, "child2/" + depResource ).exists() );
64
65 String content = FileUtils.fileRead( output );
66
67 assertTrue( content.indexOf( "Dependency Id: org.apache.maven.plugin.rresource.it.mrr41:release:1.0" ) >= 0 );
68 assertTrue( content.indexOf( "Dependency Id: org.apache.maven.plugin.rresource.it.mrr41:snapshot:1.0-SNAPSHOT" ) >= 0 );
69 }
70
71 }