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

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


    public Boolean addRepositoryToGroup( String repositoryGroupId, String repositoryId,
                                         AuditInformation auditInformation )
        throws RepositoryAdminException
    {
        RepositoryGroup repositoryGroup = getRepositoryGroup( repositoryGroupId );
        if ( repositoryGroup == null )
        {
            throw new RepositoryAdminException(
                "repositoryGroup with id " + repositoryGroupId + " doesn't not exists so cannot add repository to it" );
        }

        if ( repositoryGroup.getRepositories().contains( repositoryId ) )
        {
            throw new RepositoryAdminException(
                "repositoryGroup with id " + repositoryGroupId + " already contain repository with id" + repositoryId );
        }
        validateManagedRepositoriesExists( Arrays.asList( repositoryId ) );

        repositoryGroup.addRepository( repositoryId );
        updateRepositoryGroup( repositoryGroup, auditInformation, false );
        triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.ADD_REPO_TO_GROUP, auditInformation );
        return Boolean.TRUE;
    }
View Full Code Here


    public Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId,
                                              AuditInformation auditInformation )
        throws RepositoryAdminException
    {
        RepositoryGroup repositoryGroup = getRepositoryGroup( repositoryGroupId );
        if ( repositoryGroup == null )
        {
            throw new RepositoryAdminException( "repositoryGroup with id " + repositoryGroupId
                                                    + " doesn't not exists so cannot remove repository from it" );
        }

        if ( !repositoryGroup.getRepositories().contains( repositoryId ) )
        {
            throw new RepositoryAdminException(
                "repositoryGroup with id " + repositoryGroupId + " doesn't not contains repository with id"
                    + repositoryId );
        }

        repositoryGroup.removeRepository( repositoryId );
        updateRepositoryGroup( repositoryGroup, auditInformation, false );
        triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.DELETE_REPO_FROM_GROUP, auditInformation );
        return Boolean.TRUE;
    }
View Full Code Here

            timeout -= 500;
        }

        RepositoryGroupService repositoryGroupService = getRepositoryGroupService();

        RepositoryGroup repositoryGroup = new RepositoryGroup();
        repositoryGroup.setId( "test-group" );
        repositoryGroup.setRepositories( Arrays.asList( id ) );

        repositoryGroupService.addRepositoryGroup( repositoryGroup );

        // create a repo with a remote on the one with index
        id = Long.toString( System.currentTimeMillis() );
View Full Code Here

        {
            defaultManagedRepositoryAdmin.addManagedRepository(
                createManagedRepository( INTERNAL_REPO, new File( "target/test-classes/" + INTERNAL_REPO ).getPath(),
                                         "default" ), false, null );
        }
        RepositoryGroup repoGroupConfig = new RepositoryGroup();
        repoGroupConfig.setId( LOCAL_REPO_GROUP );
        repoGroupConfig.addRepository( RELEASES_REPO );
        repoGroupConfig.addRepository( INTERNAL_REPO );

        defaultRepositoryGroupAdmin.setArchivaConfiguration( archivaConfiguration );
        if ( defaultManagedRepositoryAdmin.getManagedRepository( LOCAL_REPO_GROUP ) == null )
        {
            defaultRepositoryGroupAdmin.addRepositoryGroup( repoGroupConfig, null );
View Full Code Here

        action.setRepoGroupId( REPO_GROUP_ID );

        action.prepare();
        assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
        RepositoryGroup repoGroup = action.getRepositoryGroup();
        assertNotNull( repoGroup );
        assertEquals( repoGroup.getId(), action.getRepoGroupId() );
        assertEquals( Collections.singletonList( origRepoGroup ), configuration.getRepositoryGroups() );
    }
View Full Code Here

        action.setRepoGroupId( REPO_GROUP_ID );

        action.prepare();
        assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
        RepositoryGroup repoGroup = action.getRepositoryGroup();
        assertNotNull( repoGroup );
        assertEquals( Collections.singletonList( repoGroup ),
                      action.getRepositoryGroupAdmin().getRepositoriesGroups() );

        String status = action.delete();
View Full Code Here

        action.setRepoGroupId( REPO_GROUP_ID );

        action.prepare();
        assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
        RepositoryGroup repoGroup = action.getRepositoryGroup();
        assertNotNull( repoGroup );

        String status = action.execute();
        assertEquals( Action.SUCCESS, status );
        assertEquals( Collections.singletonList( repoGroup ),
View Full Code Here

        archivaConfiguration.save( configuration );
        archivaConfigurationControl.replay();

        action.prepare();
        RepositoryGroup repositoryGroup = action.getRepositoryGroup();
        repositoryGroup.setId( REPO_GROUP_ID );

        String status = action.addRepositoryGroup();
        assertEquals( Action.SUCCESS, status );

        assertEquals( Collections.singletonList( repositoryGroup ),
View Full Code Here

        archivaConfiguration.save( configuration );

        archivaConfigurationControl.replay();

        action.prepare();
        RepositoryGroup repositoryGroup = action.getRepositoryGroup();
        repositoryGroup.setId( REPO_GROUP_ID );

        String status = action.addRepositoryGroup();
        assertEquals( Action.SUCCESS, status );

        assertEquals( Collections.singletonList( repositoryGroup ),
                      action.getRepositoryGroupAdmin().getRepositoriesGroups() );

        repositoryGroup.setId( REPO_GROUP_ID );
        status = action.addRepositoryGroup();

        assertEquals( Action.ERROR, status );
        assertEquals( Collections.singletonList( repositoryGroup ),
                      action.getRepositoryGroupAdmin().getRepositoriesGroups() );
View Full Code Here

        assertNotNull( action.getRepositoryGroups() );
        assertEquals( 1, action.getRepositoryGroups().size() );
        assertEquals( 2, action.getManagedRepositories().size() );

        RepositoryGroup 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 ) );
    }
View Full Code Here

TOP

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

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.