1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.maven.plugins.site.deploy; 20 21 import org.apache.maven.plugin.testing.AbstractMojoTestCase; 22 import org.apache.maven.wagon.Wagon; 23 import org.junit.Before; 24 import org.junit.Test; 25 import org.junit.runner.RunWith; 26 import org.junit.runners.JUnit4; 27 28 /** 29 * @author <a href="mailto:cleclerc@xebia.fr">Cyrille Le Clerc</a> 30 */ 31 @RunWith(JUnit4.class) 32 public class SiteDeployMojoTest extends AbstractMojoTestCase { 33 private Wagon wagon; 34 35 // private Repository repository; 36 37 @Before 38 public void setUp() throws Exception { 39 super.setUp(); 40 // wagon = getContainer().lookup( Wagon.class, "scp" ); 41 // repository = new Repository( "my-repository", "scp://repository-host/var/maven2" ); 42 } 43 44 @Test 45 public void testFoo() { 46 // should not fail ;-) 47 assertTrue(true); 48 } 49 50 /** 51 * FIXME find a way to restore those tests as wagonManager.addProxy is not anymore available in maven 3. 52 * public void testGetProxyInfoNoProxyForRepositoryProtocol() 53 * { 54 * wagonManager.addProxy( "http", "proxy-host", 8080, "my-user", "my-password", null ); 55 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 56 * assertNull( "ProxyInfo must be null because http != scp", proxyInfo ); 57 * } 58 * 59 * public void testGetProxyInfoForRepositoryHostExactlyMatchesNonProxyHosts() 60 * { 61 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", 62 * "a-host,repository-host;another-host" ); 63 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 64 * assertNull( "ProxyInfo must be null because 'repository-host' in nonProxyHosts list", proxyInfo ); 65 * } 66 * 67 * public void testGetProxyInfoForRepositoryHostWildcardMatchNonProxyHosts1() 68 * { 69 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "a-host|repository*|another-host" ); 70 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 71 * assertNull( "ProxyInfo must be null because 'repository-host' in nonProxyHosts list", proxyInfo ); 72 * } 73 * 74 * public void testGetProxyInfoForRepositoryHostWildcardMatchNonProxyHosts2() 75 * { 76 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "*host" ); 77 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 78 * assertNull( "ProxyInfo must be null because 'repository-host' in nonProxyHosts list", proxyInfo ); 79 * } 80 * 81 * public void testGetProxyInfoForRepositoryHostWildcardMatchNonProxyHosts3() 82 * { 83 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "repository*host" ); 84 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 85 * assertNull( "ProxyInfo must be null because 'repository-host' in nonProxyHosts list", proxyInfo ); 86 * } 87 * 88 * public void testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts1() 89 * { 90 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "mycompany*" ); 91 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 92 * assertNotNull( "ProxyInfo must be found because 'repository-host' not in nonProxyHosts list", proxyInfo ); 93 * } 94 * 95 * public void testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts2() 96 * { 97 * wagonManager. 98 * 99 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "*mycompany" ); 100 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 101 * assertNotNull( "ProxyInfo must be found because 'repository-host' not in nonProxyHosts list", proxyInfo ); 102 * } 103 * 104 * public void testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts3() 105 * { 106 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "repository*mycompany" ); 107 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 108 * assertNotNull( "ProxyInfo must be found because 'repository-host' not in nonProxyHosts list", proxyInfo ); 109 * } 110 * 111 * public void testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts4() 112 * { 113 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "mycompany*host" ); 114 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 115 * assertNotNull( "ProxyInfo must be found because 'repository-host' not in nonProxyHosts list", proxyInfo ); 116 * } 117 * 118 * public void testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts5() 119 * { 120 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "mycompany*mycompany" ); 121 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 122 * assertNotNull( "ProxyInfo must be found because 'repository-host' not in nonProxyHosts list", proxyInfo ); 123 * } 124 * 125 * public void testGetProxyInfoFound() 126 * { 127 * wagonManager.addProxy( "scp", "localhost", 8080, "my-user", "my-password", "an-host|another-host" ); 128 * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager ); 129 * assertNotNull( "ProxyInfo must be found because 'repository-host' not in nonProxyHosts list", proxyInfo ); 130 * } 131 **/ 132 }