1 package org.apache.its;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static org.apache.its.util.TestUtils.archivePathFromChild;
23 import static org.apache.its.util.TestUtils.archivePathFromProject;
24 import static org.apache.its.util.TestUtils.assertZipContents;
25 import static org.apache.its.util.TestUtils.getTestDir;
26
27 import org.apache.maven.it.VerificationException;
28 import org.apache.maven.it.Verifier;
29 import org.junit.Test;
30
31 import java.io.File;
32 import java.io.IOException;
33 import java.net.URISyntaxException;
34 import java.util.Collections;
35 import java.util.HashSet;
36 import java.util.Set;
37
38 import junit.framework.Assert;
39
40 public class IT_000_BasicArchiveCreation
41 {
42
43 private static final String BASENAME = "basics";
44 private static final String VERSION = "1";
45
46 @Test
47 public void execute()
48 throws VerificationException, IOException, URISyntaxException
49 {
50 File testDir = getTestDir( BASENAME );
51
52 Verifier verifier = new Verifier( testDir.getAbsolutePath() );
53
54 verifier.executeGoal( "package" );
55
56 verifier.verifyErrorFreeLog();
57 verifier.resetStreams();
58
59
60 File tarAssemblyFile = new File( testDir, "target/" + BASENAME + "-" + VERSION + "-source-release.tar.gz" );
61 Assert.assertFalse( "tar assembly should not have been created", tarAssemblyFile.exists() );
62
63 File assembly = new File( testDir, "target/" + BASENAME + "-" + VERSION + "-source-release.zip" );
64
65 Set<String> required = new HashSet<String>();
66
67 required.add( archivePathFromProject( BASENAME, VERSION, "/pom.xml" ) );
68 required.add( archivePathFromChild( BASENAME, VERSION, "child1", "pom.xml" ) );
69 required.add( archivePathFromChild( BASENAME, VERSION, "child2", "/pom.xml" ) );
70
71 required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/main/java/org/apache/assembly/it/App.java" ) );
72 required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/main/resources/META-INF/plexus/components.xml" ) );
73
74 required.add( archivePathFromChild( BASENAME, VERSION, "child2", "/src/main/java/org/apache/assembly/it/App.java" ) );
75
76 Set<String> banned = Collections.emptySet();
77
78 assertZipContents( required, banned, assembly );
79 }
80
81 }