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