Examples of LocalRepository


Examples of org.apache.continuum.model.repository.LocalRepository

    {
        String name = "testAddLocalRepository";
        String directory = "testAddLocalRepositoryDirectory";
        String layout = "default";

        LocalRepository repository = createTestLocalRepository( name, directory, layout );

        LocalRepository copy = createTestLocalRepository( repository );
        localRepositoryDao.addLocalRepository( repository );
        copy.setId( repository.getId() );

        LocalRepository retrievedRepository = localRepositoryDao.getLocalRepository( repository.getId() );
        assertLocalRepositoryEquals( copy, retrievedRepository );
    }
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

    }

    public void testRemoveLocalRepository()
        throws Exception
    {
        LocalRepository repository = localRepositoryDao.getLocalRepositoryByName( testLocalRepository2.getName() );

        ProjectGroup projectGroup = projectGroupDao.getProjectGroupByGroupId( testProjectGroup2.getGroupId() );
        assertLocalRepositoryEquals( testLocalRepository2, projectGroup.getLocalRepository() );
        projectGroup.setLocalRepository( null );

        projectGroupDao.updateProjectGroup( projectGroup );

        projectGroup = projectGroupDao.getProjectGroup( testProjectGroup2.getId() );
        assertNull( "check local repository", projectGroup.getLocalRepository() );

        List<RepositoryPurgeConfiguration> repoPurgeList =
            repositoryPurgeConfigurationDao.getRepositoryPurgeConfigurationsByLocalRepository( repository.getId() );

        assertEquals( "check # repo purge config", 1, repoPurgeList.size() );
        repositoryPurgeConfigurationDao.removeRepositoryPurgeConfiguration( repoPurgeList.get( 0 ) );
        localRepositoryDao.removeLocalRepository( repository );
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

    }

    public void testAddRepositoryPurgeConfiguration()
        throws Exception
    {
        LocalRepository repository = localRepositoryDao.getLocalRepository( testLocalRepository3.getId() );
        Schedule schedule = scheduleDao.getSchedule( testSchedule1.getId() );

        RepositoryPurgeConfiguration repoPurge =
            createTestRepositoryPurgeConfiguration( true, 2, 100, false, schedule, true, repository );
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

    private TaskQueueManager taskQueueManager;

    public LocalRepository addLocalRepository( LocalRepository localRepository )
        throws RepositoryServiceException
    {
        LocalRepository repository = null;

        try
        {
            List<LocalRepository> repos = getAllLocalRepositories();
            for ( LocalRepository repo : repos )
            {
                if ( repo.getName().equals( localRepository.getName() ) )
                {
                    throw new RepositoryServiceException( "Local repository name must be unique" );
                }

                if ( repo.getLocation().equals( localRepository.getLocation() ) )
                {
                    throw new RepositoryServiceException( "Local repository location must be unique" );
                }
            }

            localRepository.setName( localRepository.getName().trim() );
            localRepository.setLocation( localRepository.getLocation().trim() );

            repository = localRepositoryDao.addLocalRepository( localRepository );

            log.info( "Added new local repository: " + repository.getName() );
        }
        catch ( ContinuumStoreException e )
        {
            throw new RepositoryServiceException( "Unable to add the requested local repository", e );
        }
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

    public void removeLocalRepository( int repositoryId )
        throws RepositoryServiceException
    {
        try
        {
            LocalRepository repository = getLocalRepository( repositoryId );

            if ( taskQueueManager.isRepositoryInUse( repositoryId ) )
            {
                return;
            }

            if ( taskQueueManager.isRepositoryInPurgeQueue( repositoryId ) )
            {
                taskQueueManager.removeRepositoryFromPurgeQueue( repositoryId );
            }

            log.info( "Remove purge configurations of " + repository.getName() );
            removePurgeConfigurationsOfRepository( repositoryId );

            List<ProjectGroup> groups = projectGroupDao.getProjectGroupByRepository( repositoryId );

            for ( ProjectGroup group : groups )
            {
                group.setLocalRepository( null );
                projectGroupDao.updateProjectGroup( group );
            }

            localRepositoryDao.removeLocalRepository( repository );

            log.info( "Removed local repository: " + repository.getName() );
        }
        catch ( TaskQueueManagerException e )
        {
            // swallow?
        }
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

    public void purgeRepository( RepositoryPurgeConfiguration repoPurge )
        throws ContinuumPurgeManagerException
    {
        try
        {
            LocalRepository repository = repoPurge.getRepository();

            // do not purge if repository is in use and if repository is already in purge queue
            if ( !taskQueueManager.isRepositoryInUse( repository.getId() ) &&
                 !taskQueueManager.isInPurgeQueue( repoPurge.getId() ) )
            {
                taskQueueManager.getPurgeQueue().put( new PurgeTask( repoPurge.getId() ) );
            }
        }
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

        projectGroup.setDescription( description );

        // [CONTINUUM-2228]. In select field can't select empty values.
        if ( repositoryId > 0 )
        {
            LocalRepository repository = getContinuum().getRepositoryService().getLocalRepository( repositoryId );
            projectGroup.setLocalRepository( repository );
        }

        getContinuum().updateProjectGroup( projectGroup );
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

                group.setGroupId( DEFAULT_PROJECT_GROUP_GROUP_ID );

                group.setDescription( "Contains all projects that do not have a group of their own" );

                LocalRepository localRepository = localRepositoryDao.getLocalRepositoryByName( "DEFAULT" );

                group.setLocalRepository( localRepository );

                group = projectGroupDao.addProjectGroup( group );
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

    }

    private void createDefaultLocalRepository()
        throws ContinuumStoreException, ContinuumInitializationException
    {
        LocalRepository repository;

        repository = localRepositoryDao.getLocalRepositoryByName( "DEFAULT" );

        Settings settings = getSettings();

        if ( repository == null )
        {
            log.info( "create Default Local Repository" );

            repository = new LocalRepository();

            repository.setName( "DEFAULT" );

            repository.setLocation( settings.getLocalRepository() );

            repository = localRepositoryDao.addLocalRepository( repository );

            createDefaultPurgeConfiguration( repository );
        }
        else if ( !repository.getLocation().equals( settings.getLocalRepository() ) )
        {
            log.info( "updating location of Default Local Repository" );

            repository.setLocation( settings.getLocalRepository() );

            localRepositoryDao.updateLocalRepository( repository );
        }
    }
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

        throws Exception
    {
        Continuum continuum = getContinuum();
        RepositoryService service = (RepositoryService) lookup( RepositoryService.ROLE );

        LocalRepository repository = new LocalRepository();
        repository.setName( "defaultRepo" );
        repository.setLocation( getTestFile( "target/default-repository" ).getAbsolutePath() );
        repository = service.addLocalRepository( repository );

        ProjectGroup group = new ProjectGroup();
        group.setGroupId( "testGroup" );
        group.setName( "testGroup" );
        group.setLocalRepository( repository );
        continuum.addProjectGroup( group );

        ProjectGroup retrievedDefaultProjectGroup = continuum.getProjectGroupByGroupId( "testGroup" );
        assertNotNull( retrievedDefaultProjectGroup.getLocalRepository() );

        continuum.removeProjectGroup( retrievedDefaultProjectGroup.getId() );

        try
        {
            continuum.getProjectGroupByGroupId( "testGroup" );
            fail( "project group was not deleted" );
        }
        catch ( Exception e )
        {
            // should fail. do nothing.
        }

        LocalRepository retrievedRepository = service.getLocalRepository( repository.getId() );
        assertNotNull( retrievedRepository );
        assertEquals( repository, retrievedRepository );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.