当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionException类代码示例

本文整理汇总了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;
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:44,代码来源:WagonUtils.java

示例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
  ));
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:17,代码来源:GSWagon.java

示例3: openConnection

import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@SuppressWarnings ("deprecation")
@Override
public void openConnection()
    throws ConnectionException, AuthenticationException
{
    delegate.openConnection();
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:8,代码来源:WagonDelegate.java

示例4: connect

import org.apache.maven.wagon.ConnectionException; //导入依赖的package包/类
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo,
                     ProxyInfoProvider proxyInfoProvider )
    throws ConnectionException, AuthenticationException
{

}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:8,代码来源:MockWagon.java

示例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);
  }
}
 
开发者ID:chonton,项目名称:exists-maven-plugin,代码行数:9,代码来源:RemoteExistsMojo.java

示例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;
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:15,代码来源:AbstractWagon.java

示例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;
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:13,代码来源:AbstractWagon.java

示例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();
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:11,代码来源:AbstractWagonTest.java

示例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();
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:12,代码来源:AbstractWagonTest.java

示例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();
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:11,代码来源:AbstractWagonTest.java

示例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();
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:11,代码来源:AbstractWagonTest.java

示例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();

}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:13,代码来源:AbstractWagonTest.java

示例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();
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:12,代码来源:AbstractWagonTest.java

示例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();
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:15,代码来源:AbstractWagonTest.java

示例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();
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:15,代码来源:AbstractWagonTest.java


注:本文中的org.apache.maven.wagon.ConnectionException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。