本文整理汇总了Java中org.apache.maven.wagon.ConnectionException类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionException类的具体用法?Java ConnectionException怎么用?Java ConnectionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionException类属于org.apache.maven.wagon包,在下文中一共展示了ConnectionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWagon
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
/**
* Convenience method to create a wagon.
*
* @param serverId The serverId to use if the wagonManager needs help.
* @param url The url to create a wagon for.
* @param wagonManager The wgaon manager to use.
* @param settings The settings to use.
* @param logger The logger to use.
* @return The wagon to connect to the url.
* @throws org.apache.maven.wagon.UnsupportedProtocolException
* if the protocol is not supported.
* @throws org.apache.maven.artifact.manager.WagonConfigurationException
* if the wagon cannot be configured.
* @throws org.apache.maven.wagon.ConnectionException
* If the connection cannot be established.
* @throws org.apache.maven.wagon.authentication.AuthenticationException
* If the connection cannot be authenticated.
*/
public static Wagon createWagon( String serverId, String url, WagonManager wagonManager, Settings settings,
Log logger )
throws UnsupportedProtocolException, WagonConfigurationException, ConnectionException, AuthenticationException
{
Repository repository = new Repository( serverId, url );
Wagon wagon = wagonManager.getWagon( repository );
if ( logger.isDebugEnabled() )
{
Debug debug = new Debug();
wagon.addSessionListener( debug );
wagon.addTransferListener( debug );
}
ProxyInfo proxyInfo = getProxyInfo( settings );
if ( proxyInfo != null )
{
wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ), proxyInfo );
}
else
{
wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ) );
}
return wagon;
}
示例2: openConnectionInternal
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected void openConnectionInternal() throws ConnectionException, AuthenticationException
{
final Repository repository = getRepository();
if (!"gs".equals(repository.getProtocol())) {
throw new IllegalArgumentException(String.format("Unsupported protocol [%s]", repository.getProtocol()));
}
final HttpClient client = buildClient();
swapAndCloseConnection(new ConnectionPOJO(
buildStorage(client),
BlobId.of(repository.getHost(), repository.getBasedir().substring(1)),
client
));
}
示例3: openConnection
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@SuppressWarnings ("deprecation")
@Override
public void openConnection()
throws ConnectionException, AuthenticationException
{
delegate.openConnection();
}
示例4: connect
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo,
ProxyInfoProvider proxyInfoProvider )
throws ConnectionException, AuthenticationException
{
}
示例5: close
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Override
public void close() {
try {
wagon.disconnect();
} catch (ConnectionException e) {
getLog().debug("Error disconnecting wagon - ignored", e);
}
}
示例6: connect
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Override
public final void connect(Repository source, AuthenticationInfo authenticationInfo,
ProxyInfoProvider proxyInfoProvider) throws ConnectionException, AuthenticationException {
this.repository = source;
this.sessionListenerSupport.fireSessionOpening();
try {
connectToRepository(source, authenticationInfo, proxyInfoProvider);
this.sessionListenerSupport.fireSessionLoggedIn();
this.sessionListenerSupport.fireSessionOpened();
} catch (ConnectionException | AuthenticationException e) {
this.sessionListenerSupport.fireSessionConnectionRefused();
throw e;
}
}
示例7: disconnect
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Override
public final void disconnect() throws ConnectionException {
this.sessionListenerSupport.fireSessionDisconnecting();
try {
disconnectFromRepository();
this.sessionListenerSupport.fireSessionLoggedOff();
this.sessionListenerSupport.fireSessionDisconnected();
} catch (ConnectionException e) {
this.sessionListenerSupport.fireSessionConnectionRefused();
throw e;
}
}
示例8: connectRepository
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Test
public void connectRepository() throws ConnectionException, AuthenticationException {
this.wagon.connect(this.repository);
assertEquals(this.repository, this.wagon.getRepository());
verify(this.sessionListenerSupport).fireSessionOpening();
verify(this.wagon).connectToRepository(this.repository, null, null);
verify(this.sessionListenerSupport).fireSessionLoggedIn();
verify(this.sessionListenerSupport).fireSessionOpened();
}
示例9: connectRepositoryProxyInfo
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Test
public void connectRepositoryProxyInfo() throws ConnectionException, AuthenticationException {
this.wagon.connect(this.repository, this.proxyInfo);
assertEquals(this.repository, this.wagon.getRepository());
verify(this.sessionListenerSupport).fireSessionOpening();
verify(this.wagon).connectToRepository(eq(this.repository), (AuthenticationInfo) isNull(),
any(NullProtectingProxyInfoProvider.class));
verify(this.sessionListenerSupport).fireSessionLoggedIn();
verify(this.sessionListenerSupport).fireSessionOpened();
}
示例10: connectRepositoryAuthenticationInfo
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Test
public void connectRepositoryAuthenticationInfo() throws ConnectionException, AuthenticationException {
this.wagon.connect(this.repository, this.authenticationInfo);
assertEquals(this.repository, this.wagon.getRepository());
verify(this.sessionListenerSupport).fireSessionOpening();
verify(this.wagon).connectToRepository(this.repository, this.authenticationInfo, null);
verify(this.sessionListenerSupport).fireSessionLoggedIn();
verify(this.sessionListenerSupport).fireSessionOpened();
}
示例11: connectRepositoryProxyInfoProvider
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Test
public void connectRepositoryProxyInfoProvider() throws ConnectionException, AuthenticationException {
this.wagon.connect(this.repository, this.proxyInfoProvider);
assertEquals(this.repository, this.wagon.getRepository());
verify(this.sessionListenerSupport).fireSessionOpening();
verify(this.wagon).connectToRepository(this.repository, null, this.proxyInfoProvider);
verify(this.sessionListenerSupport).fireSessionLoggedIn();
verify(this.sessionListenerSupport).fireSessionOpened();
}
示例12: connectRepositoryAuthenticationProxyInfo
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Test
public void connectRepositoryAuthenticationProxyInfo() throws ConnectionException, AuthenticationException {
this.wagon.connect(this.repository, this.authenticationInfo, this.proxyInfo);
assertEquals(this.repository, this.wagon.getRepository());
verify(this.sessionListenerSupport).fireSessionOpening();
verify(this.wagon).connectToRepository(eq(this.repository), eq(this.authenticationInfo),
any(NullProtectingProxyInfoProvider.class));
verify(this.sessionListenerSupport).fireSessionLoggedIn();
verify(this.sessionListenerSupport).fireSessionOpened();
}
示例13: connectRepositoryAuthenticationInfoProxyInfoProvider
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Test
public void connectRepositoryAuthenticationInfoProxyInfoProvider() throws ConnectionException,
AuthenticationException {
this.wagon.connect(this.repository, this.authenticationInfo, this.proxyInfoProvider);
assertEquals(this.repository, this.wagon.getRepository());
verify(this.sessionListenerSupport).fireSessionOpening();
verify(this.wagon).connectToRepository(this.repository, this.authenticationInfo, this.proxyInfoProvider);
verify(this.sessionListenerSupport).fireSessionLoggedIn();
verify(this.sessionListenerSupport).fireSessionOpened();
}
示例14: connectConnectionException
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Test
public void connectConnectionException() throws ConnectionException, AuthenticationException {
doThrow(new ConnectionException("")).when(this.wagon).connectToRepository(this.repository,
this.authenticationInfo, this.proxyInfoProvider);
try {
this.wagon.connect(this.repository, this.authenticationInfo, this.proxyInfoProvider);
fail();
} catch (ConnectionException e) {
assertEquals(this.repository, this.wagon.getRepository());
verify(this.sessionListenerSupport).fireSessionOpening();
verify(this.sessionListenerSupport).fireSessionConnectionRefused();
}
}
示例15: connectAuthenticationException
import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Test
public void connectAuthenticationException() throws ConnectionException, AuthenticationException {
doThrow(new AuthenticationException("")).when(this.wagon).connectToRepository(this.repository,
this.authenticationInfo, this.proxyInfoProvider);
try {
this.wagon.connect(this.repository, this.authenticationInfo, this.proxyInfoProvider);
fail();
} catch (AuthenticationException e) {
assertEquals(this.repository, this.wagon.getRepository());
verify(this.sessionListenerSupport).fireSessionOpening();
verify(this.sessionListenerSupport).fireSessionConnectionRefused();
}
}