org.apache.maven.wagon.ConnectionException Java Examples

The following examples show how to use org.apache.maven.wagon.ConnectionException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@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();
    }
}
 
Example #2
Source File: WagonDelegate.java    From archiva with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings ("deprecation")
@Override
public void openConnection()
    throws ConnectionException, AuthenticationException
{
    delegate.openConnection();
}
 
Example #3
Source File: WagonUtils.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: RemoteExistsMojo.java    From exists-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void close() {
  try {
    wagon.disconnect();
  } catch (ConnectionException e) {
    getLog().debug("Error disconnecting wagon - ignored", e);
  }
}
 
Example #5
Source File: MockWagon.java    From archiva with Apache License 2.0 5 votes vote down vote up
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo,
                     ProxyInfoProvider proxyInfoProvider )
    throws ConnectionException, AuthenticationException
{

}
 
Example #6
Source File: MockWagon.java    From archiva with Apache License 2.0 5 votes vote down vote up
@Deprecated
@Override
public void openConnection()
    throws ConnectionException, AuthenticationException
{

}
 
Example #7
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void disconnectConnectionException() throws ConnectionException {
    doThrow(new ConnectionException("")).when(this.wagon).disconnectFromRepository();

    try {
        this.wagon.disconnect();
        fail();
    } catch (ConnectionException e) {
        verify(this.sessionListenerSupport).fireSessionDisconnecting();
        verify(this.sessionListenerSupport).fireSessionConnectionRefused();

    }
}
 
Example #8
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void disconnect() throws ConnectionException {
    this.wagon.disconnect();

    verify(this.sessionListenerSupport).fireSessionDisconnecting();
    verify(this.wagon).disconnectFromRepository();
    verify(this.sessionListenerSupport).fireSessionLoggedOff();
    verify(this.sessionListenerSupport).fireSessionDisconnected();
}
 
Example #9
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@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();
    }
}
 
Example #10
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@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();
}
 
Example #11
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@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();

}
 
Example #12
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@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();
}
 
Example #13
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@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();
}
 
Example #14
Source File: GitWagon.java    From opoopress with Apache License 2.0 5 votes vote down vote up
private void removeCheckoutDirectory() throws ConnectionException {
	if (checkoutDirectory == null) {
		return; // Silently return.
	}
	try {
		FileUtils.deleteDirectory(checkoutDirectory);
	} catch (IOException e) {
		throw new ConnectionException("Unable to cleanup checkout directory", e);
	}
}
 
Example #15
Source File: AbstractWagon.java    From lambadaframework with MIT License 5 votes vote down vote up
@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;
    }
}
 
Example #16
Source File: AbstractWagon.java    From lambadaframework with MIT License 5 votes vote down vote up
@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;
    }
}
 
Example #17
Source File: GitWagon.java    From opoopress with Apache License 2.0 5 votes vote down vote up
@Override
protected void openConnectionInternal() throws ConnectionException, AuthenticationException {
	if (checkoutDirectory == null) {
		checkoutDirectory = createCheckoutDirectory();
	}

	if (checkoutDirectory.exists() && safeCheckout) {
		removeCheckoutDirectory();
	}

	checkoutDirectory.mkdirs();
}
 
Example #18
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@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();
}
 
Example #19
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@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();
}
 
Example #20
Source File: MockWagon.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void disconnect()
    throws ConnectionException
{

}
 
Example #21
Source File: GitHubWagon.java    From opoopress with Apache License 2.0 4 votes vote down vote up
@Override
protected void openConnectionInternal() throws ConnectionException,
		AuthenticationException {
	fireSessionDebug("openConnectionInternal");
}
 
Example #22
Source File: GitWagon.java    From opoopress with Apache License 2.0 4 votes vote down vote up
@Override
protected void closeConnection() throws ConnectionException {
	if(safeCheckout){
		removeCheckoutDirectory();
	}
}
 
Example #23
Source File: GitHubWagon.java    From opoopress with Apache License 2.0 4 votes vote down vote up
@Override
public void closeConnection() throws ConnectionException {
	fireSessionDebug("closeConnection");
}
 
Example #24
Source File: MockWagon.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo )
    throws ConnectionException, AuthenticationException
{

}
 
Example #25
Source File: MockWagon.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo )
    throws ConnectionException, AuthenticationException
{

}
 
Example #26
Source File: MockWagon.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository repository, ProxyInfoProvider proxyInfoProvider )
    throws ConnectionException, AuthenticationException
{

}
 
Example #27
Source File: MockWagon.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository repository, ProxyInfo proxyInfo )
    throws ConnectionException, AuthenticationException
{

}
 
Example #28
Source File: MockWagon.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository repository )
    throws ConnectionException, AuthenticationException
{

}
 
Example #29
Source File: WagonDelegate.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void disconnect()
    throws ConnectionException
{
    delegate.disconnect();
}
 
Example #30
Source File: AbstractWagon.java    From lambadaframework with MIT License 4 votes vote down vote up
@Override
public final void connect(Repository source) throws ConnectionException, AuthenticationException {
    connect(source, null, (ProxyInfoProvider) null);
}