001/** 002 * Copyright 2010-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.common.util; 017 018import org.junit.Assert; 019import org.junit.Test; 020import org.slf4j.Logger; 021import org.slf4j.LoggerFactory; 022 023@Deprecated 024public class RepositoryUtilsTest { 025 026 private static final Logger logger = LoggerFactory.getLogger(RepositoryUtilsTest.class); 027 028 @Test 029 public void testArtifact() { 030 Artifact a = new Artifact(); 031 a.setGroupId("org.kuali.common"); 032 a.setArtifactId("kuali-util"); 033 a.setVersion("1.0.0"); 034 a.setClassifier("webapp"); 035 a.setType("jar"); 036 String gav1 = RepositoryUtils.toString(a); 037 Artifact parsed = RepositoryUtils.parseArtifact(gav1); 038 String gav2 = RepositoryUtils.toString(parsed); 039 logger.info("gav1={}", gav1); 040 logger.info("gav2={}", gav2); 041 Assert.assertEquals(gav1, gav2); 042 } 043 044 @Test 045 public void testEmptyArtifact() { 046 Artifact a = new Artifact(); 047 String gav1 = RepositoryUtils.toString(a); 048 Artifact parsed = RepositoryUtils.parseArtifact(gav1); 049 String gav2 = RepositoryUtils.toString(parsed); 050 logger.info("gav1={}", gav1); 051 logger.info("gav2={}", gav2); 052 Assert.assertEquals(gav1, gav2); 053 } 054 055 @Test 056 public void testGroupIdArtifact() { 057 Artifact a = new Artifact(); 058 a.setGroupId("org.kuali.common"); 059 String gav1 = RepositoryUtils.toString(a); 060 Artifact parsed = RepositoryUtils.parseArtifact(gav1); 061 String gav2 = RepositoryUtils.toString(parsed); 062 logger.info("gav1={}", gav1); 063 logger.info("gav2={}", gav2); 064 Assert.assertEquals(gav1, gav2); 065 } 066 067 @Test 068 public void testTypeArtifact() { 069 Artifact a = new Artifact(); 070 a.setType("jar"); 071 String gav1 = RepositoryUtils.toString(a); 072 Artifact parsed = RepositoryUtils.parseArtifact(gav1); 073 String gav2 = RepositoryUtils.toString(parsed); 074 logger.info("gav1={}", gav1); 075 logger.info("gav2={}", gav2); 076 Assert.assertEquals(gav1, gav2); 077 } 078}