1 package org.apache.maven.plugins.ear.util;
2
3 import static org.junit.Assert.assertEquals;
4
5 import java.util.ArrayList;
6 import java.util.List;
7
8 import org.apache.maven.plugins.ear.AbstractEarTestBase;
9 import org.apache.maven.plugins.ear.EarModule;
10 import org.apache.maven.plugins.ear.EjbModule;
11 import org.junit.Test;
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 public class EarMavenArchiverTest
36 extends AbstractEarTestBase
37 {
38
39 private List<EarModule> modules = new ArrayList<EarModule>();
40
41 @Test
42 public void testSimpleEjbModule()
43 {
44 final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );
45 setUri( module, "foo-1.0.jar" );
46 modules.add( module );
47
48 final EarMavenArchiver archiver = new EarMavenArchiver( modules );
49 assertEquals( "foo-1.0.jar", archiver.generateClassPathEntry( "" ) );
50
51 }
52
53 @Test
54 public void testSimpleJarModuleWithCustomBundleDir()
55 {
56 final EarModule module = new EjbModule( createArtifact( "foo", "jar" ) );
57 setUri( module, "libs/foo-1.0.jar" );
58 modules.add( module );
59
60 final EarMavenArchiver archiver = new EarMavenArchiver( modules );
61 assertEquals( "libs/foo-1.0.jar", archiver.generateClassPathEntry( "" ) );
62
63 }
64
65 @Test
66 public void testTwoModules()
67 {
68 final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );
69 setUri( module, "foo-1.0.jar" );
70 modules.add( module );
71
72 final EarModule module2 = new EjbModule( createArtifact( "bar", "war" ) );
73 setUri( module2, "bar-2.0.1.war" );
74 modules.add( module2 );
75
76 final EarMavenArchiver archiver = new EarMavenArchiver( modules );
77 assertEquals( "foo-1.0.jar bar-2.0.1.war", archiver.generateClassPathEntry( "" ) );
78
79 }
80
81 }