1 package org.apache.maven.plugin.source;
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
24
25
26
27 public class SourceJarMojoTest
28 extends AbstractSourcePluginTestCase
29 {
30 protected String getGoal()
31 {
32 return "jar";
33 }
34
35 public void testDefaultConfiguration()
36 throws Exception
37 {
38 doTestProjectWithSourceArchive( "project-001",
39 new String[]{ "default-configuration.properties", "foo/project001/App.java",
40 "foo/project001/", "foo/", "META-INF/MANIFEST.MF", "META-INF/" },
41 "sources" );
42 }
43
44 public void testExcludes()
45 throws Exception
46 {
47 doTestProjectWithSourceArchive( "project-003",
48 new String[]{ "default-configuration.properties", "foo/project003/App.java",
49 "foo/project003/", "foo/", "META-INF/MANIFEST.MF", "META-INF/" },
50 "sources" );
51 }
52
53 public void testNoSources()
54 throws Exception
55 {
56 executeMojo( "project-005", "sources" );
57
58 final File expectedFile = getTestTargetDir( "project-005" );
59 assertFalse( "Source archive should not have been created[" + expectedFile.getAbsolutePath() + "]",
60 expectedFile.exists() );
61 }
62
63 public void testIncludes()
64 throws Exception
65 {
66 doTestProjectWithSourceArchive( "project-007", new String[]{ "templates/configuration-template.properties",
67 "foo/project007/App.java", "templates/", "foo/project007/", "foo/", "META-INF/MANIFEST.MF", "META-INF/"
68
69 }, "sources" );
70 }
71
72 public void testIncludePom()
73 throws Exception
74 {
75 doTestProjectWithSourceArchive( "project-009", new String[]{ "default-configuration.properties", "pom.xml",
76 "foo/project009/App.java", "foo/project009/", "foo/", "META-INF/MANIFEST.MF", "META-INF/" }, "sources" );
77 }
78 }