View Javadoc

1   package org.apache.maven.plugin.ear.util;
2   
3   import org.apache.maven.plugin.ear.AbstractEarTest;
4   import org.apache.maven.plugin.ear.EarModule;
5   import org.apache.maven.plugin.ear.EjbModule;
6   
7   import java.util.ArrayList;
8   import java.util.List;
9   
10  /*
11   * Licensed to the Apache Software Foundation (ASF) under one
12   * or more contributor license agreements.  See the NOTICE file
13   * distributed with this work for additional information
14   * regarding copyright ownership.  The ASF licenses this file
15   * to you under the Apache License, Version 2.0 (the
16   * "License"); you may not use this file except in compliance
17   * with the License.  You may obtain a copy of the License at
18   *
19   *  http://www.apache.org/licenses/LICENSE-2.0
20   *
21   * Unless required by applicable law or agreed to in writing,
22   * software distributed under the License is distributed on an
23   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
24   * KIND, either express or implied.  See the License for the
25   * specific language governing permissions and limitations
26   * under the License.
27   */
28  
29  /**
30   * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
31   */
32  public class EarMavenArchiverTest
33      extends AbstractEarTest
34  {
35  
36  
37      public void testSimpleEjbModule()
38      {
39          final List<EarModule> modules = new ArrayList<EarModule>();
40          final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );
41          setUri( module, "foo-1.0.jar" );
42          modules.add( module );
43  
44          final EarMavenArchiver archiver = new EarMavenArchiver( modules );
45          assertEquals( "foo-1.0.jar", archiver.generateClassPathEntry( "" ) );
46  
47      }
48  
49      public void testSimpleJarModuleWithCustomBundleDir()
50      {
51          final List<EarModule> modules = new ArrayList<EarModule>();
52          final EarModule module = new EjbModule( createArtifact( "foo", "jar" ) );
53          setUri( module, "libs/foo-1.0.jar" );
54          modules.add( module );
55  
56          final EarMavenArchiver archiver = new EarMavenArchiver( modules );
57          assertEquals( "libs/foo-1.0.jar", archiver.generateClassPathEntry( "" ) );
58  
59      }
60  
61      public void testTwoModules()
62      {
63          final List<EarModule> modules = new ArrayList<EarModule>();
64          final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );
65          setUri( module, "foo-1.0.jar" );
66          modules.add( module );
67  
68          final EarModule module2 = new EjbModule( createArtifact( "bar", "war" ) );
69          setUri( module2, "bar-2.0.1.war" );
70          modules.add( module2 );
71  
72          final EarMavenArchiver archiver = new EarMavenArchiver( modules );
73          assertEquals( "foo-1.0.jar bar-2.0.1.war", archiver.generateClassPathEntry( "" ) );
74  
75      }
76  
77  }