Package org.apache.archiva.rest.api.services

Examples of org.apache.archiva.rest.api.services.RepositoriesService


    {
        File targetRepo = initSnapshotRepo();
        try
        {

            RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
            //repositoriesService.scanRepositoryDirectoriesNow( SNAPSHOT_REPO_ID );

            BrowseService browseService = getBrowseService( authorizationHeader, false );
            List<Artifact> artifacts =
                browseService.getArtifactDownloadInfos( "org.apache.archiva.redback.components", "spring-quartz",
                                                        "2.0-SNAPSHOT", SNAPSHOT_REPO_ID );

            log.info( "artifacts: {}", artifacts );

            Assertions.assertThat( artifacts ).isNotNull().isNotEmpty().hasSize( 10 );

            File artifactFile = new File( targetRepo,
                                          "org/apache/archiva/redback/components/spring-quartz/2.0-SNAPSHOT/spring-quartz-2.0-20120618.214127-1.jar" );

            File artifactFilemd5 = new File( targetRepo,
                                             "org/apache/archiva/redback/components/spring-quartz/2.0-SNAPSHOT/spring-quartz-2.0-20120618.214127-1.jar.md5" );

            File artifactFilepom = new File( targetRepo,
                                             "org/apache/archiva/redback/components/spring-quartz/2.0-SNAPSHOT/spring-quartz-2.0-20120618.214127-1.pom" );

            Assertions.assertThat( artifactFile ).exists();
            Assertions.assertThat( artifactFilemd5 ).exists();
            Assertions.assertThat( artifactFilepom ).exists();

            // we delete only one snapshot
            Artifact artifact =
                new Artifact( "org.apache.archiva.redback.components", "spring-quartz", "2.0-20120618.214127-1" );
            artifact.setPackaging( "jar" );
            artifact.setRepositoryId( SNAPSHOT_REPO_ID );
            artifact.setContext( SNAPSHOT_REPO_ID );

            repositoriesService.deleteArtifact( artifact );

            artifacts =
                browseService.getArtifactDownloadInfos( "org.apache.archiva.redback.components", "spring-quartz",
                                                        "2.0-SNAPSHOT", SNAPSHOT_REPO_ID );
View Full Code Here


        repo = service.getManagedRepository( repo.getId() );
        assertNotNull( repo );

        assertEquals( getTestManagedRepository().getDescription(), repo.getDescription() );

        RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );

        int timeout = 20000;
        while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
        {
            Thread.sleep( 500 );
            timeout -= 500;
        }
View Full Code Here

            service.deleteManagedRepository( repo.getId(), true );
            assertNull( service.getManagedRepository( repo.getId() ) );
        }
        service.addManagedRepository( repo );

        RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );

        int timeout = 20000;
        while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
        {
            Thread.sleep( 500 );
            timeout -= 500;
        }

        repo = service.getManagedRepository( repo.getId() );
        assertNotNull( repo );
        assertEquals( "test", repo.getName() );
        // toto is foo in French :-)
        repo.setName( "toto" );

        service.updateManagedRepository( repo );

        repo = service.getManagedRepository( repo.getId() );
        assertNotNull( repo );
        assertEquals( "toto", repo.getName() );

        timeout = 20000;
        while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
        {
            Thread.sleep( 500 );
            timeout -= 500;
        }
View Full Code Here

        if ( getUserService( authorizationHeader ).getGuestUser() == null )
        {
            assertNotNull( getUserService( authorizationHeader ).createGuestUser() );
        }

        RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );

        createAndIndexRepo( testRepoId,
                            new File( System.getProperty( "basedir" ), "src/test/repo-with-osgi" ).getAbsolutePath() );

        repositoriesService.scanRepositoryDirectoriesNow( testRepoId );

        int timeout = 20000;
        while ( timeout > 0 && repositoriesService.alreadyScanning( testRepoId ) )
        {
            Thread.sleep( 500 );
            timeout -= 500;
        }
View Full Code Here

            artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" );
            artifactTransferRequest.setVersion( "2.2.2" );
            artifactTransferRequest.setRepositoryId( SOURCE_REPO_ID );
            artifactTransferRequest.setTargetRepositoryId( TARGET_REPO_ID );
            // retrieve the service
            RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
            // copy the artifact
            Boolean res = repositoriesService.copyArtifact( artifactTransferRequest );
            // END SNIPPET: copy-artifact
            assertTrue( res );

            String targetRepoPath = getManagedRepositoriesService( authorizationHeader ).getManagedRepository(
                TARGET_REPO_ID ).getLocation();
View Full Code Here

            artifactTransferRequest.setGroupId( "org.apache.karaf.features" );
            artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" );
            artifactTransferRequest.setVersion( "3.0.6552" );
            artifactTransferRequest.setRepositoryId( SOURCE_REPO_ID );
            artifactTransferRequest.setTargetRepositoryId( TARGET_REPO_ID );
            RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );

            Boolean res = repositoriesService.copyArtifact( artifactTransferRequest );
        }
        catch ( ServerWebApplicationException e )
        {
            assertTrue( StringUtils.contains( e.getMessage(), "cannot find artifact" ) );
            throw e;
View Full Code Here

    protected void createStagedNeededRepo( String testRepoId, String repoPath, boolean scan )
        throws Exception
    {
        createAndIndexRepo( testRepoId, repoPath, scan, true );
        RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
        repositoriesService.scanRepositoryDirectoriesNow( testRepoId );
        if ( scan )
        {
            repositoriesService.scanRepositoryNow( testRepoId + "-stage", true );
            repositoriesService.scanRepositoryDirectoriesNow( testRepoId + "-stage" );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.rest.api.services.RepositoriesService

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.