1 package org.apache.maven.plugin.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.plugin.ear.AbstractEarTestBase;
9 import org.apache.maven.plugin.ear.EarModule;
10 import org.apache.maven.plugin.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 @Test
40 public void testSimpleEjbModule()
41 {
42 final List<EarModule> modules = new ArrayList<EarModule>();
43 final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );
44 setUri( module, "foo-1.0.jar" );
45 modules.add( module );
46
47 final EarMavenArchiver archiver = new EarMavenArchiver( modules );
48 assertEquals( "foo-1.0.jar", archiver.generateClassPathEntry( "" ) );
49
50 }
51
52 @Test
53 public void testSimpleJarModuleWithCustomBundleDir()
54 {
55 final List<EarModule> modules = new ArrayList<EarModule>();
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 List<EarModule> modules = new ArrayList<EarModule>();
69 final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );
70 setUri( module, "foo-1.0.jar" );
71 modules.add( module );
72
73 final EarModule module2 = new EjbModule( createArtifact( "bar", "war" ) );
74 setUri( module2, "bar-2.0.1.war" );
75 modules.add( module2 );
76
77 final EarMavenArchiver archiver = new EarMavenArchiver( modules );
78 assertEquals( "foo-1.0.jar bar-2.0.1.war", archiver.generateClassPathEntry( "" ) );
79
80 }
81
82 }