Package org.apache.archiva.admin.model.beans

Examples of org.apache.archiva.admin.model.beans.NetworkProxy


    public void addAndDeleteWithRemoteRepoLinked()
        throws Exception
    {
        mockAuditListener.clearEvents();
        int initialSize = networkProxyAdmin.getNetworkProxies().size();
        NetworkProxy networkProxy = getNetworkProxyTest( "foo" );

        networkProxyAdmin.addNetworkProxy( networkProxy, getFakeAuditInformation() );

        assertEquals( initialSize + 1, networkProxyAdmin.getNetworkProxies().size() );

        networkProxy = networkProxyAdmin.getNetworkProxy( "foo" );

        assertNotNull( networkProxy );

        RemoteRepository remoteRepository = getRemoteRepository();
        remoteRepository.setRemoteDownloadNetworkProxyId( networkProxy.getId() );

        remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getFakeAuditInformation() );

        networkProxyAdmin.deleteNetworkProxy( "foo", getFakeAuditInformation() );
View Full Code Here


    }


    protected NetworkProxy getNetworkProxyTest( String id )
    {
        NetworkProxy networkProxy = new NetworkProxy();
        networkProxy.setId( "foo" );
        networkProxy.setHost( "http://foo.com" );
        networkProxy.setPassword( "passwd" );
        networkProxy.setPort( 9090 );
        networkProxy.setUsername( "root" );
        networkProxy.setProtocol( "https" );
        return networkProxy;
    }
View Full Code Here

    public void deleteNetworkProxy( String networkProxyId, AuditInformation auditInformation )
        throws RepositoryAdminException
    {

        NetworkProxy networkProxy = getNetworkProxy( networkProxyId );
        if ( networkProxy == null )
        {
            throw new RepositoryAdminException(
                "cannot delete NetworkProxy with id " + networkProxyId + " as not exist" );
        }
        Configuration configuration = getArchivaConfiguration().getConfiguration();
        NetworkProxyConfiguration networkProxyConfiguration = getNetworkProxyConfiguration( networkProxy );
        configuration.removeNetworkProxy( networkProxyConfiguration );

        for ( RemoteRepositoryConfiguration rrc : configuration.getRemoteRepositories() )
        {
            if ( StringUtils.equals( rrc.getRemoteDownloadNetworkProxyId(), networkProxyId ) )
            {
                rrc.setRemoteDownloadNetworkProxyId( null );
            }
        }

        triggerAuditEvent( networkProxy.getId(), null, AuditEvent.DELETE_NETWORK_PROXY, auditInformation );

        saveConfiguration( configuration );
    }
View Full Code Here

            {
                for ( ProxyConnector proxyConnector : proxyConnectors )
                {
                    remoteRepositories.add( remoteRepositoryAdmin.getRemoteRepository( proxyConnector.getTargetRepoId() ) );

                    NetworkProxy networkProxyConfig = networkProxyAdmin.getNetworkProxy( proxyConnector.getProxyId() );

                    if ( networkProxyConfig != null )
                    {
                        // key/value: remote repo ID/proxy info
                        networkProxies.put( proxyConnector.getTargetRepoId(), networkProxyConfig );
View Full Code Here

        Wagon wagon = null;
        try
        {
            RepositoryURL repoUrl = remoteRepository.getURL();
            String protocol = repoUrl.getProtocol();
            NetworkProxy networkProxy = null;
            if ( StringUtils.isNotBlank( connector.getProxyId() ) )
            {
                networkProxy = networkProxyAdmin.getNetworkProxy( connector.getProxyId() );
            }
            WagonFactoryRequest wagonFactoryRequest = new WagonFactoryRequest( "wagon#" + protocol,
View Full Code Here

            if ( remoteRepository == null )
            {
                log.warn( "ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId );
                return;
            }
            NetworkProxy networkProxy = null;
            if ( StringUtils.isNotBlank( remoteRepository.getRemoteDownloadNetworkProxyId() ) )
            {
                networkProxy = networkProxyAdmin.getNetworkProxy( remoteRepository.getRemoteDownloadNetworkProxyId() );
                if ( networkProxy == null )
                {
View Full Code Here

        assertNotNull( getNetworkProxyService().getNetworkProxies() );
        assertFalse( getNetworkProxyService().getNetworkProxies().isEmpty() );
        assertEquals( 1, getNetworkProxyService().getNetworkProxies().size() );

        NetworkProxy networkProxy = getNetworkProxy( "foo" );
        networkProxy.setHost( "http://toto.com" );
        networkProxy.setPassword( "newpasswd" );
        networkProxy.setUsername( "newusername" );
        networkProxy.setPort( 9191 );

        getNetworkProxyService().updateNetworkProxy( networkProxy );

        assertEquals( networkProxy.getHost(), getNetworkProxyService().getNetworkProxy( "foo" ).getHost() );
        assertEquals( networkProxy.getPassword(), getNetworkProxyService().getNetworkProxy( "foo" ).getPassword() );
        assertEquals( networkProxy.getUsername(), getNetworkProxyService().getNetworkProxy( "foo" ).getUsername() );
        assertEquals( networkProxy.getPort(), getNetworkProxyService().getNetworkProxy( "foo" ).getPort() );

        getNetworkProxyService().deleteNetworkProxy( "foo" );

        assertNotNull( getNetworkProxyService().getNetworkProxies() );
        assertTrue( getNetworkProxyService().getNetworkProxies().isEmpty() );
View Full Code Here

    }

    NetworkProxy getNetworkProxy( String id )
    {

        NetworkProxy networkProxy = new NetworkProxy();
        networkProxy.setId( id );
        networkProxy.setHost( "http://foo.com" );
        networkProxy.setPassword( "passwd" );
        networkProxy.setUsername( "username" );
        networkProxy.setPort( 9090 );
        return networkProxy;
    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.admin.model.beans.NetworkProxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.