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