1 package org.apache.maven.ejb;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import org.apache.maven.MavenException;
21 import org.apache.maven.project.Project;
22 import org.apache.maven.repository.ArtifactTypeHandler;
23
24 import junit.framework.TestCase;
25
26 /***
27 * This will do until wagon debuts.
28 *
29 * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
30 * @version $Id: EJBArtifactTypeHandlerTest.java 232640 2005-08-14 20:46:54Z vmassol $
31 */
32 public class EJBArtifactTypeHandlerTest extends TestCase
33 {
34 private Project project;
35 private ArtifactTypeHandler handler;
36 private static final String VERSION = "VERSION";
37
38 public void setUp() throws Exception
39 {
40 project = new Project();
41 project.setGroupId("groupId");
42 project.setArtifactId("artifactId");
43 handler = new EJBArtifactTypeHandler();
44 }
45
46 public void testConstructRepositoryDirectoryPath() throws Exception
47 {
48 assertEquals("check artifact directory", "groupId/ejbs/",
49 handler.constructRepositoryDirectoryPath("ejb", project));
50 assertEquals("check artifact directory", "groupId/ejbs/",
51 handler.constructRepositoryDirectoryPath("ejb-client", project));
52 }
53
54 public void testConstructRepositoryFullPath() throws Exception
55 {
56 assertEquals("check artifact path", "groupId/ejbs/artifactId-VERSION.jar",
57 handler.constructRepositoryFullPath("ejb", project, VERSION));
58 assertEquals("check artifact path", "groupId/ejbs/artifactId-VERSION-client.jar",
59 handler.constructRepositoryFullPath("ejb-client", project, VERSION));
60 }
61
62 public void testConstructRepositoryFullPathWithInvalidType() throws Exception
63 {
64 try {
65 handler.constructRepositoryFullPath("foo", project, VERSION);
66 fail("expected exception");
67 }
68 catch (MavenException expected) {
69 assertEquals("Unrecognised ejb type (is foo)", expected.getMessage());
70 }
71 }
72 }