Package org.apache.maven.archiva.configuration

Examples of org.apache.maven.archiva.configuration.RepositoryScanningConfiguration


        repoConfig.setLocation( testRepo.getPath() );
        repoConfig.setName( REPOSITORY_ID );
        repoConfig.setBlockRedeployments( true );
        config.addManagedRepository( repoConfig );

        RepositoryScanningConfiguration repoScanning = new RepositoryScanningConfiguration();
        repoScanning.setKnownContentConsumers( new ArrayList<String>() );
        config.setRepositoryScanning( repoScanning );
    }
View Full Code Here


     *
     * @return the list of consumer ids that have been selected by the configuration.
     */
    public List<String> getSelectedKnownConsumerIds()
    {
        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
        return scanning.getKnownContentConsumers();
    }
View Full Code Here

     *
     * @return the list of consumer ids that have been selected by the configuration.
     */
    public List<String> getSelectedInvalidConsumerIds()
    {
        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
        return scanning.getInvalidContentConsumers();
    }
View Full Code Here

    }
   
    public void testConfigureValidRepositoryConsumer()
        throws Exception
    {  
        RepositoryScanningConfiguration repoScanning = new RepositoryScanningConfiguration();
        repoScanning.addKnownContentConsumer( "index-artifact" );
        repoScanning.addKnownContentConsumer( "index-pom" );
        repoScanning.addInvalidContentConsumer( "check-pom" );       
       
     // test enable "check-metadata" consumer
        recordRepoConsumers();
       
        archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
        configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
       
        config.setRepositoryScanning( repoScanning );               
        configControl.setMatcher( MockControl.ALWAYS_MATCHER );
        configControl.setVoidCallable();
       
        archivaConfig.save( config );
        archivaConfigControl.setVoidCallable();
               
        repoConsumerUtilsControl.replay();
        knownContentConsumerControl.replay();
        invalidContentConsumerControl.replay();
        archivaConfigControl.replay();
        configControl.replay();       
       
        try
        {
            boolean success = service.configureRepositoryConsumer( null, "check-metadata", true );
            assertTrue( success );
        }
        catch ( Exception e )
        {
            fail( "An exception should not have been thrown." );
        }
       
        repoConsumerUtilsControl.verify();
        knownContentConsumerControl.verify();
        invalidContentConsumerControl.verify();       
        archivaConfigControl.verify();
        configControl.verify();
               
     // test disable "check-metadata" consumer
        repoConsumerUtilsControl.reset();
        knownContentConsumerControl.reset();
        invalidContentConsumerControl.reset();       
        archivaConfigControl.reset();
        configControl.reset();
       
        repoScanning.addInvalidContentConsumer( "check-metadata" );

        recordRepoConsumers();
       
        archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
        configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
View Full Code Here

        {
            throw new Exception( "Invalid repository consumer." );
        }
       
        Configuration config = archivaConfiguration.getConfiguration();
        RepositoryScanningConfiguration repoScanningConfig = config.getRepositoryScanning();
       
        if( isKnownContentConsumer )
        {
            repoScanningConfig.addKnownContentConsumer( consumerId );
        }
        else
        {
            repoScanningConfig.addInvalidContentConsumer( consumerId );
        }
       
        config.setRepositoryScanning( repoScanningConfig );       
        saveConfiguration( config );
       
View Full Code Here

        repoConfig.setLayout( "default" );
        repoConfig.setLocation( testRepo.getPath() );
        repoConfig.setName( REPOSITORY_ID );
        config.addManagedRepository( repoConfig );
       
        RepositoryScanningConfiguration repoScanning = new RepositoryScanningConfiguration();
        repoScanning.setKnownContentConsumers( new ArrayList<String>() );
        config.setRepositoryScanning( repoScanning );
    }
View Full Code Here

    public void prepare()
        throws Exception
    {
        Configuration config = archivaConfiguration.getConfiguration();
        RepositoryScanningConfiguration reposcanning = config.getRepositoryScanning();

        FiletypeToMapClosure filetypeToMapClosure = new FiletypeToMapClosure();

        CollectionUtils.forAllDo( reposcanning.getFileTypes(), filetypeToMapClosure );
        fileTypeMap = filetypeToMapClosure.getMap();

        AddAdminRepoConsumerClosure addAdminRepoConsumer;

        addAdminRepoConsumer = new AddAdminRepoConsumerClosure( reposcanning.getKnownContentConsumers() );
        CollectionUtils.forAllDo( repoconsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer );
        this.knownContentConsumers = addAdminRepoConsumer.getList();
        Collections.sort( knownContentConsumers, AdminRepositoryConsumerComparator.getInstance() );

        addAdminRepoConsumer = new AddAdminRepoConsumerClosure( reposcanning.getInvalidContentConsumers() );
        CollectionUtils.forAllDo( repoconsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer );
        this.invalidContentConsumers = addAdminRepoConsumer.getList();
        Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() );

        fileTypeIds = new ArrayList<String>();
View Full Code Here

        return saveConfiguration();
    }

    private FileType findFileType( String id )
    {
        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
        return (FileType) CollectionUtils.find( scanning.getFileTypes(), new FiletypeSelectionPredicate( id ) );
    }
View Full Code Here

        {
            LegacyArtifactPath v = readLegacyArtifactPath( "", (Registry) i.next() );
            legacyArtifactPaths.add( v );
        }
        value.setLegacyArtifactPaths( legacyArtifactPaths );
        RepositoryScanningConfiguration repositoryScanning = readRepositoryScanningConfiguration( prefix + "repositoryScanning.", registry );
        value.setRepositoryScanning( repositoryScanning );
        DatabaseScanningConfiguration databaseScanning = readDatabaseScanningConfiguration( prefix + "databaseScanning.", registry );
        value.setDatabaseScanning( databaseScanning );
        WebappConfiguration webapp = readWebappConfiguration( prefix + "webapp.", registry );
        value.setWebapp( webapp );
View Full Code Here

        return value;
    }
   
    private RepositoryScanningConfiguration readRepositoryScanningConfiguration( String prefix, Registry registry )
    {
        RepositoryScanningConfiguration value = new RepositoryScanningConfiguration();

        java.util.List fileTypes = new java.util.ArrayList/*<FileType>*/();
        List fileTypesSubsets = registry.getSubsetList( prefix + "fileTypes.fileType" );
        for ( Iterator i = fileTypesSubsets.iterator(); i.hasNext(); )
        {
            FileType v = readFileType( "", (Registry) i.next() );
            fileTypes.add( v );
        }
        value.setFileTypes( fileTypes );
        java.util.List knownContentConsumers = new java.util.ArrayList/*<String>*/();
        knownContentConsumers.addAll( registry.getList( prefix + "knownContentConsumers.knownContentConsumer" ) );
        value.setKnownContentConsumers( knownContentConsumers );
        java.util.List invalidContentConsumers = new java.util.ArrayList/*<String>*/();
        invalidContentConsumers.addAll( registry.getList( prefix + "invalidContentConsumers.invalidContentConsumer" ) );
        value.setInvalidContentConsumers( invalidContentConsumers );

        return value;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.configuration.RepositoryScanningConfiguration

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.