001package org.apache.maven.wagon.repository; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import junit.framework.TestCase; 023 024import org.apache.maven.wagon.WagonConstants; 025 026/** 027 * @author <a href="mailto:jvanzyl@maven.org">Jason van Zyl</a> 028 * 029 */ 030public class RepositoryTest 031 extends TestCase 032{ 033 public RepositoryTest( final String name ) 034 { 035 super( name ); 036 } 037 038 public void setUp() 039 throws Exception 040 { 041 super.setUp(); 042 } 043 044 public void tearDown() 045 throws Exception 046 { 047 super.tearDown(); 048 } 049 050 public void testRepositoryProperties() 051 throws Exception 052 { 053 Repository repository = new Repository(); 054 055 repository.setBasedir( "directory" ); 056 057 assertEquals( "directory", repository.getBasedir() ); 058 059 repository.setName( "name" ); 060 061 assertEquals( "name", repository.getName() ); 062 063 repository.setPort( 0 ); 064 065 assertEquals( 0, repository.getPort() ); 066 067 assertEquals( "localhost", repository.getHost() ); 068 069 repository.setUrl( "http://www.ibiblio.org" ); 070 071 assertEquals( "http://www.ibiblio.org", repository.getUrl() ); 072 073 assertEquals( "http", repository.getProtocol() ); 074 075 assertEquals( "www.ibiblio.org", repository.getHost() ); 076 077 assertEquals( "/", repository.getBasedir() ); 078 079 assertEquals( WagonConstants.UNKNOWN_PORT, repository.getPort() ); 080 081 repository.setUrl( "https://www.ibiblio.org:100/maven" ); 082 083 assertEquals( "https://www.ibiblio.org:100/maven", repository.getUrl() ); 084 085 assertEquals( "https", repository.getProtocol() ); 086 087 assertEquals( "www.ibiblio.org", repository.getHost() ); 088 089 assertEquals( "/maven", repository.getBasedir() ); 090 091 assertEquals( 100, repository.getPort() ); 092 093 assertEquals( "www.ibiblio.org", repository.getHost() ); 094 095 repository.setBasedir( "basedir" ); 096 097 assertEquals( "basedir", repository.getBasedir() ); 098 099 repository.setUrl( "http://brett:porter@www.ibiblio.org" ); 100 101 assertEquals( "http://www.ibiblio.org", repository.getUrl() ); 102 103 repository.setUrl( "http://brett@www.ibiblio.org" ); 104 105 assertEquals( "http://www.ibiblio.org", repository.getUrl() ); 106 107 } 108}