View Javadoc

1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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  @Deprecated
25  public class RepositoryUtilsTest {
26  
27  	private static final Logger logger = LoggerFactory.getLogger(RepositoryUtilsTest.class);
28  
29  	@Test
30  	public void testArtifact() {
31  		Artifact a = new Artifact();
32  		a.setGroupId("org.kuali.common");
33  		a.setArtifactId("kuali-util");
34  		a.setVersion("1.0.0");
35  		a.setClassifier("webapp");
36  		a.setType("jar");
37  		String gav1 = RepositoryUtils.toString(a);
38  		Artifact parsed = RepositoryUtils.parseArtifact(gav1);
39  		String gav2 = RepositoryUtils.toString(parsed);
40  		logger.info("gav1={}", gav1);
41  		logger.info("gav2={}", gav2);
42  		Assert.assertEquals(gav1, gav2);
43  	}
44  
45  	@Test
46  	public void testEmptyArtifact() {
47  		Artifact a = new Artifact();
48  		String gav1 = RepositoryUtils.toString(a);
49  		Artifact parsed = RepositoryUtils.parseArtifact(gav1);
50  		String gav2 = RepositoryUtils.toString(parsed);
51  		logger.info("gav1={}", gav1);
52  		logger.info("gav2={}", gav2);
53  		Assert.assertEquals(gav1, gav2);
54  	}
55  
56  	@Test
57  	public void testGroupIdArtifact() {
58  		Artifact a = new Artifact();
59  		a.setGroupId("org.kuali.common");
60  		String gav1 = RepositoryUtils.toString(a);
61  		Artifact parsed = RepositoryUtils.parseArtifact(gav1);
62  		String gav2 = RepositoryUtils.toString(parsed);
63  		logger.info("gav1={}", gav1);
64  		logger.info("gav2={}", gav2);
65  		Assert.assertEquals(gav1, gav2);
66  	}
67  
68  	@Test
69  	public void testTypeArtifact() {
70  		Artifact a = new Artifact();
71  		a.setType("jar");
72  		String gav1 = RepositoryUtils.toString(a);
73  		Artifact parsed = RepositoryUtils.parseArtifact(gav1);
74  		String gav2 = RepositoryUtils.toString(parsed);
75  		logger.info("gav1={}", gav1);
76  		logger.info("gav2={}", gav2);
77  		Assert.assertEquals(gav1, gav2);
78  	}
79  }