1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util;
17
18 import junit.framework.Assert;
19
20 import org.junit.Test;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
23
24 public class RepositoryUtilsTest {
25
26 private static final Logger logger = LoggerFactory.getLogger(RepositoryUtilsTest.class);
27
28 @Test
29 public void testArtifact() {
30 Artifact a = new Artifact();
31 a.setGroupId("org.kuali.common");
32 a.setArtifactId("kuali-util");
33 a.setVersion("1.0.0");
34 a.setClassifier("webapp");
35 a.setType("jar");
36 String gav1 = RepositoryUtils.toString(a);
37 Artifact parsed = RepositoryUtils.parseArtifact(gav1);
38 String gav2 = RepositoryUtils.toString(parsed);
39 logger.info("gav1={}", gav1);
40 logger.info("gav2={}", gav2);
41 Assert.assertEquals(gav1, gav2);
42 }
43
44 @Test
45 public void testEmptyArtifact() {
46 Artifact a = new Artifact();
47 String gav1 = RepositoryUtils.toString(a);
48 Artifact parsed = RepositoryUtils.parseArtifact(gav1);
49 String gav2 = RepositoryUtils.toString(parsed);
50 logger.info("gav1={}", gav1);
51 logger.info("gav2={}", gav2);
52 Assert.assertEquals(gav1, gav2);
53 }
54
55 @Test
56 public void testGroupIdArtifact() {
57 Artifact a = new Artifact();
58 a.setGroupId("org.kuali.common");
59 String gav1 = RepositoryUtils.toString(a);
60 Artifact parsed = RepositoryUtils.parseArtifact(gav1);
61 String gav2 = RepositoryUtils.toString(parsed);
62 logger.info("gav1={}", gav1);
63 logger.info("gav2={}", gav2);
64 Assert.assertEquals(gav1, gav2);
65 }
66
67 @Test
68 public void testTypeArtifact() {
69 Artifact a = new Artifact();
70 a.setType("jar");
71 String gav1 = RepositoryUtils.toString(a);
72 Artifact parsed = RepositoryUtils.parseArtifact(gav1);
73 String gav2 = RepositoryUtils.toString(parsed);
74 logger.info("gav1={}", gav1);
75 logger.info("gav2={}", gav2);
76 Assert.assertEquals(gav1, gav2);
77 }
78 }