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

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


        // Prepare Test.
        action.setSource( TEST_SOURCE_ID );
        action.setTarget( TEST_TARGET_ID );
        action.prepare();
        ProxyConnector connector = action.getConnector();
        assertInitialProxyConnector( connector );

        // Add some arbitrary properties.
        connector.addProperty( "username", "general-tso" );
        connector.addProperty( "password", "chicken" );

        // Perform Test w/no property key.
        preRequest( action );
        String status = action.removeProperty();
        assertEquals( Action.INPUT, status );

        // Should have returned an error, with no properties removed.
        assertHasErrors( action );
        assertEquals( 2, connector.getProperties().size() );

        // Perform test w/invalid (non-existant) property key to remove.
        preRequest( action );
        action.setPropertyKey( "slurm" );
        status = action.removeProperty();
        assertEquals( Action.INPUT, status );

        // Should have returned an error, with no properties removed.
        assertHasErrors( action );
        assertEquals( 2, connector.getProperties().size() );

        // Try again, but now with a valid property to remove.
        preRequest( action );
        action.setPropertyKey( "password" );
        status = action.removeProperty();
        assertEquals( Action.INPUT, status );

        // Should have no error, and 1 property left.
        assertNoErrors( action );
        assertEquals( 1, connector.getProperties().size() );
        assertEquals( "Should have left 1 property", "general-tso", connector.getProperties().get( "username" ) );
    }
View Full Code Here


        // Prepare Test.
        action.setSource( TEST_SOURCE_ID );
        action.setTarget( TEST_TARGET_ID );
        action.prepare();
        ProxyConnector connector = action.getConnector();
        assertInitialProxyConnector( connector );

        // Add some arbitrary whitelist patterns.
        connector.addWhiteListPattern( "javax/**/*" );
        connector.addWhiteListPattern( "com/sun/**/*" );

        // Perform Test w/no pattern value.
        preRequest( action );
        String status = action.removeWhiteListPattern();
        assertEquals( Action.INPUT, status );

        // Should have returned an error, with no whitelist pattern removed.
        assertHasErrors( action );
        assertEquals( 2, connector.getWhiteListPatterns().size() );

        // Perform test w/invalid (non-existant) pattern value to remove.
        preRequest( action );
        action.setPattern( "**/*oops*" );
        status = action.removeWhiteListPattern();
        assertEquals( Action.INPUT, status );

        // Should have returned an error, with no whitelist pattern removed.
        assertHasErrors( action );
        assertEquals( 2, connector.getWhiteListPatterns().size() );

        // Try again, but now with a valid pattern to remove.
        action.setPattern( "com/sun/**/*" );
        preRequest( action );
        status = action.removeWhiteListPattern();
        assertEquals( Action.INPUT, status );

        // Should have no error, and 1 whitelist pattern left.
        assertNoErrors( action );
        assertEquals( 1, connector.getWhiteListPatterns().size() );
        assertEquals( "Should have left 1 whitelist pattern", "javax/**/*", connector.getWhiteListPatterns().get( 0 ) );
    }
View Full Code Here

        Map<String, List<ProxyConnector>> proxyConnectorMap = new HashMap<String, java.util.List<ProxyConnector>>();

        Iterator<ProxyConnector> it = getProxyConnectors().iterator();
        while ( it.hasNext() )
        {
            ProxyConnector proxyConfig = it.next();
            String key = proxyConfig.getSourceRepoId();

            List<ProxyConnector> connectors = proxyConnectorMap.get( key );
            if ( connectors == null )
            {
                connectors = new ArrayList<ProxyConnector>();
View Full Code Here

        }

        getRemoteRepositoriesService().addRemoteRepository( remoteRepository );

        ProxyConnectorService proxyConnectorService = getProxyConnectorService();
        ProxyConnector proxyConnector = new ProxyConnector();
        proxyConnector.setProxyId( "foo-bar1" );
        proxyConnector.setSourceRepoId( id );
        proxyConnector.setTargetRepoId( "all-merged" );
        proxyConnectorService.addProxyConnector( proxyConnector );

        repositoriesService.scheduleDownloadRemoteIndex( "all-merged", true, true );

        // wait a bit
View Full Code Here

        remoteRepository.setPassword( FakeCreateAdminService.ADMIN_TEST_PWD );

        getRemoteRepositoriesService().addRemoteRepository( remoteRepository );

        ProxyConnectorService proxyConnectorService = getProxyConnectorService();
        ProxyConnector proxyConnector = new ProxyConnector();
        proxyConnector.setProxyId( "foo-bar2" );
        proxyConnector.setSourceRepoId( id );
        proxyConnector.setTargetRepoId( remoteId );
        proxyConnectorService.addProxyConnector( proxyConnector );

        repositoriesService.scheduleDownloadRemoteIndex( remoteId, true, true );

        // wait a bit
View Full Code Here

        Map<String, List<ProxyConnector>> proxyConnectorMap = new HashMap<>();

        Iterator<ProxyConnector> it = getProxyConnectors().iterator();
        while ( it.hasNext() )
        {
            ProxyConnector proxyConfig = it.next();
            String key = proxyConfig.getSourceRepoId();

            List<ProxyConnector> connectors = proxyConnectorMap.get( key );
            if ( connectors == null )
            {
                connectors = new ArrayList<>( 1 );
View Full Code Here

    @Override
    public Boolean removeProxyConnector( String sourceRepoId, String targetRepoId )
        throws ArchivaRestServiceException
    {
        ProxyConnector proxyConnector = getProxyConnector( sourceRepoId, targetRepoId );
        if ( proxyConnector == null )
        {
            throw new ArchivaRestServiceException(
                "proxyConnector with sourceRepoId:" + sourceRepoId + " and targetRepoId:" + targetRepoId
                    + " not exists", null );
View Full Code Here

    {
        boolean satisfies = false;

        if ( object instanceof ProxyConnector )
        {
            ProxyConnector connector = (ProxyConnector) object;
            return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) && StringUtils.equals( targetId,
                                                                                                        connector.getTargetRepoId() ) );
        }

        return satisfies;
    }
View Full Code Here

        Map<String, List<ProxyConnector>> proxyConnectorMap = new HashMap<>();

        Iterator<ProxyConnector> it = getProxyConnectors().iterator();
        while ( it.hasNext() )
        {
            ProxyConnector proxyConfig = it.next();
            String key = proxyConfig.getSourceRepoId();

            List<ProxyConnector> connectors = proxyConnectorMap.get( key );
            if ( connectors == null )
            {
                connectors = new ArrayList<>( 1 );
View Full Code Here

    {
        mockAuditListener.clearEvents();
        assertEquals( "not proxyConnectors 1 " + proxyConnectorAdmin.getProxyConnectors(), 1,
                      proxyConnectorAdmin.getProxyConnectors().size() );
        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
        ProxyConnector proxyConnector = new ProxyConnector();
        proxyConnector.setSourceRepoId( "snapshots" );
        proxyConnector.setTargetRepoId( "central" );
        proxyConnectorAdmin.addProxyConnector( proxyConnector, getFakeAuditInformation() );

        assertFalse( proxyConnectorAdmin.getProxyConnectors().isEmpty() );
        assertEquals( 2, proxyConnectorAdmin.getProxyConnectors().size() );
View Full Code Here

TOP

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

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.