Package org.apache.maven.archiva.configuration

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


       
        assertNotNull( action.getRepositoryGroups() );
        assertEquals( 1, action.getRepositoryGroups().size() );
        assertEquals( 2, action.getManagedRepositories().size() );
       
        RepositoryGroupConfiguration repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID );
        assertEquals( 1 , repoGroup.getRepositories().size() );
        assertEquals( REPO1_ID, repoGroup.getRepositories().get( 0 ) );
       
        assertNotNull( action.getGroupToRepositoryMap() );
        assertEquals( 1, action.getGroupToRepositoryMap().size() );
       
        List<String> repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
        assertEquals( 1, repos.size() );
        assertEquals( REPO2_ID, repos.get( 0 ) );
       
        action.setRepoGroupId( REPO_GROUP_ID );
        action.setRepoId( REPO1_ID );
View Full Code Here


       
        assertNotNull( action.getRepositoryGroups() );
        assertEquals( 1, action.getRepositoryGroups().size() );
        assertEquals( 2, action.getManagedRepositories().size() );
       
        RepositoryGroupConfiguration repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID );
        assertEquals( 1 , repoGroup.getRepositories().size() );
        assertEquals( REPO1_ID, repoGroup.getRepositories().get( 0 ) );
       
        assertNotNull( action.getGroupToRepositoryMap() );
        assertEquals( 1, action.getGroupToRepositoryMap().size() );
       
        List<String> repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
        assertEquals( 1, repos.size() );
        assertEquals( REPO2_ID, repos.get( 0 ) );
       
        action.setRepoGroupId( REPO_GROUP_ID );
        action.setRepoId( REPO2_ID );
View Full Code Here

        ManagedRepositoryConfiguration managedRepo2 = new ManagedRepositoryConfiguration();
        managedRepo2.setId( REPO2_ID );
       
        config.addManagedRepository( managedRepo2 );
       
        RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
        repoGroup.setId( REPO_GROUP_ID );
        repoGroup.addRepository( REPO1_ID );
   
        config.addRepositoryGroup( repoGroup );
   
        return config;
    }
View Full Code Here

        config.addManagedRepository( createManagedRepository( INTERNAL_REPO, new File( getBasedir(),
                                                                                       "target/test-classes/" +
                                                                                           INTERNAL_REPO ).getPath(),
                                                              "default" ) );

        RepositoryGroupConfiguration repoGroupConfig = new RepositoryGroupConfiguration();
        repoGroupConfig.setId( LOCAL_REPO_GROUP );
        repoGroupConfig.addRepository( RELEASES_REPO );
        repoGroupConfig.addRepository( INTERNAL_REPO );

        config.addRepositoryGroup( repoGroupConfig );

        repoContentFactoryControl = MockClassControl.createControl( RepositoryContentFactory.class );
        repoFactory = (RepositoryContentFactory) repoContentFactoryControl.getMock();
View Full Code Here

            new ArchivaDavResourceLocator( "", "/repository/" + LOCAL_REPO_GROUP +
                "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP,
                                           new ArchivaDavLocatorFactory() );

        List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>();
        RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
        repoGroup.setId( LOCAL_REPO_GROUP );
        repoGroup.addRepository( INTERNAL_REPO );
        repoGroup.addRepository( RELEASES_REPO );

        repoGroups.add( repoGroup );

        config.setRepositoryGroups( repoGroups );
View Full Code Here

                                                              new File( getBasedir(),
                                                                        "target/test-classes/local-mirror" ).getPath(),
                                                              "default" ) );

        List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>();
        RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
        repoGroup.setId( LOCAL_REPO_GROUP );
        repoGroup.addRepository( INTERNAL_REPO );
        repoGroup.addRepository( LOCAL_MIRROR_REPO );

        repoGroups.add( repoGroup );

        config.setRepositoryGroups( repoGroups );
View Full Code Here

        return connector;
    }

    private RepositoryGroupConfiguration createRepoGroup( List<String> repoIds, String repoGroupId )
    {
        RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
        repoGroup.setId( repoGroupId );
        repoGroup.setRepositories( repoIds );
       
        return repoGroup;
    }
View Full Code Here

                                       final DavServletResponse response )
        throws DavException
    {
        ArchivaDavResourceLocator archivaLocator = checkLocatorIsInstanceOfRepositoryLocator( locator );

        RepositoryGroupConfiguration repoGroupConfig =
            archivaConfiguration.getConfiguration().getRepositoryGroupsAsMap().get( archivaLocator.getRepositoryId() );

        String activePrincipal = getActivePrincipal( request );

        List<String> resourcesInAbsolutePath = new ArrayList<String>();

        boolean readMethod = WebdavMethodUtil.isReadMethod( request.getMethod() );
        DavResource resource;
        if ( repoGroupConfig != null )
        {
            if ( !readMethod )
            {
                throw new DavException( HttpServletResponse.SC_METHOD_NOT_ALLOWED,
                                        "Write method not allowed for repository groups." );
            }
           
            log.debug( "Repository group '" + repoGroupConfig.getId() + "' accessed by '" + activePrincipal + "'" );

            // handle browse requests for virtual repos
            if ( RepositoryPathUtil.getLogicalResource( archivaLocator.getOrigResourcePath() ).endsWith( "/" ) )
            {
                return getResource( request, repoGroupConfig.getRepositories(), archivaLocator );
            }
            else
            {
                resource =
                    processRepositoryGroup( request, archivaLocator, repoGroupConfig.getRepositories(),
                                            activePrincipal, resourcesInAbsolutePath );
            }
        }
        else
        {
            ManagedRepositoryContent managedRepository = null;

            try
            {
                managedRepository = repositoryFactory.getManagedRepositoryContent( archivaLocator.getRepositoryId() );
            }
            catch ( RepositoryNotFoundException e )
            {
                throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Invalid repository: "
                    + archivaLocator.getRepositoryId() );
            }
            catch ( RepositoryException e )
            {
                throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
            }

            log.debug( "Managed repository '" + managedRepository.getId() + "' accessed by '" + activePrincipal + "'" );

            resource = processRepository( request, archivaLocator, activePrincipal, managedRepository );

            String logicalResource = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() );
            resourcesInAbsolutePath.add( new File( managedRepository.getRepoRoot(), logicalResource ).getAbsolutePath() );
        }

        String requestedResource = request.getRequestURI();

        // MRM-872 : merge all available metadata
        // merge metadata only when requested via the repo group
        if ( ( repositoryRequest.isMetadata( requestedResource ) || ( requestedResource.endsWith( "metadata.xml.sha1" ) || requestedResource.endsWith( "metadata.xml.md5" ) ) )
            && repoGroupConfig != null )
        {
            // this should only be at the project level not version level!
            if ( isProjectReference( requestedResource ) )
            {
                String artifactId = StringUtils.substringBeforeLast( requestedResource.replace( '\\', '/' ), "/" );
                artifactId = StringUtils.substringAfterLast( artifactId, "/" );

                ArchivaDavResource res = (ArchivaDavResource) resource;
                String filePath =
                    StringUtils.substringBeforeLast( res.getLocalResource().getAbsolutePath().replace( '\\', '/' ), "/" );
                filePath = filePath + "/maven-metadata-" + repoGroupConfig.getId() + ".xml";

                // for MRM-872 handle checksums of the merged metadata files
                if ( repositoryRequest.isSupportFile( requestedResource ) )
                {
                    File metadataChecksum =
View Full Code Here

        assertEquals( "Should have been an 405/Method Not Allowed response code.", HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getResponseCode() );
    }

    protected RepositoryGroupConfiguration createRepositoryGroup( String id, List<String> repositories )
    {
        RepositoryGroupConfiguration repoGroupConfiguration = new RepositoryGroupConfiguration();
        repoGroupConfiguration.setId( id );
        repoGroupConfiguration.setRepositories( repositories );
        return repoGroupConfiguration;
    }
View Full Code Here

                int count = 0;
                for ( Iterator iter = value.getRepositoryGroups().iterator(); iter.hasNext(); count++ )
                {
                    String name = "repositoryGroups.repositoryGroup(" + count + ")";
                    RepositoryGroupConfiguration o = ( RepositoryGroupConfiguration ) iter.next();
                    writeRepositoryGroupConfiguration( prefix + name + ".", o, registry );
                }
            }
            if ( value.getManagedRepositories() != null && value.getManagedRepositories().size() > 0
)
View Full Code Here

TOP

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

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.