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

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


        return service;
    }

    protected RemoteRepositoriesService getRemoteRepositoriesService()
    {
        RemoteRepositoriesService service =
            JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
                                       RemoteRepositoriesService.class );

        WebClient.client( service ).header( "Authorization", authorizationHeader );
        WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
View Full Code Here


    @Test( expected = ServerWebApplicationException.class )
    public void listRemoteRepositoriesKarmaFailed()
        throws Exception
    {
        RemoteRepositoriesService service = getRemoteRepositoriesService();
        try
        {
            assertFalse( service.getRemoteRepositories().isEmpty() );
        }
        catch ( ServerWebApplicationException e )
        {
            assertEquals( 403, e.getStatus() );
            throw e;
View Full Code Here

    @Test
    public void listRemoteRepositoriesKarma()
        throws Exception
    {
        RemoteRepositoriesService service = getRemoteRepositoriesService();

        WebClient.client( service ).header( "Authorization", authorizationHeader );
        WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
        List<RemoteRepository> repos = service.getRemoteRepositories();
        assertFalse( repos.isEmpty() );
        log.info( "repos {}", repos );

    }
View Full Code Here

    @Test
    public void addAndDeleteRemoteRepository()
        throws Exception
    {
        RemoteRepositoriesService service = getRemoteRepositoriesService();

        WebClient.client( service ).header( "Authorization", authorizationHeader );

        int initialSize = service.getRemoteRepositories().size();

        service.addRemoteRepository( getRemoteRepository() );

        assertNotNull( service.getRemoteRepository( "id-new" ) );

        assertEquals( getRemoteRepository().getName(), service.getRemoteRepository( "id-new" ).getName() );
        assertEquals( getRemoteRepository().getUrl(), service.getRemoteRepository( "id-new" ).getUrl() );
        assertEquals( getRemoteRepository().getLayout(), service.getRemoteRepository( "id-new" ).getLayout() );
        assertEquals( getRemoteRepository().getUserName(), service.getRemoteRepository( "id-new" ).getUserName() );
        assertEquals( getRemoteRepository().getPassword(), service.getRemoteRepository( "id-new" ).getPassword() );
        assertEquals( getRemoteRepository().getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() );

        assertEquals( initialSize + 1, service.getRemoteRepositories().size() );

        service.deleteRemoteRepository( "id-new" );

        assertNull( service.getRemoteRepository( "id-new" ) );

        assertEquals( initialSize, service.getRemoteRepositories().size() );

    }
View Full Code Here

    @Test
    public void addAndUpdateAndDeleteRemoteRepository()
        throws Exception
    {
        RemoteRepositoriesService service = getRemoteRepositoriesService();

        WebClient.client( service ).header( "Authorization", authorizationHeader );

        int initialSize = service.getRemoteRepositories().size();

        service.addRemoteRepository( getRemoteRepository() );

        assertNotNull( service.getRemoteRepository( "id-new" ) );

        assertEquals( getRemoteRepository().getName(), service.getRemoteRepository( "id-new" ).getName() );
        assertEquals( getRemoteRepository().getUrl(), service.getRemoteRepository( "id-new" ).getUrl() );
        assertEquals( getRemoteRepository().getLayout(), service.getRemoteRepository( "id-new" ).getLayout() );
        assertEquals( getRemoteRepository().getUserName(), service.getRemoteRepository( "id-new" ).getUserName() );
        assertEquals( getRemoteRepository().getPassword(), service.getRemoteRepository( "id-new" ).getPassword() );
        assertEquals( getRemoteRepository().getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() );

        assertEquals( initialSize + 1, service.getRemoteRepositories().size() );

        RemoteRepository repo = getRemoteRepository();
        repo.setName( "name changed" );
        repo.setPassword( "new password" );
        repo.setUserName( "new username" );
        repo.setUrl( "http://foo.new.org" );

        service.updateRemoteRepository( repo );

        assertEquals( repo.getName(), service.getRemoteRepository( "id-new" ).getName() );
        assertEquals( repo.getUrl(), service.getRemoteRepository( "id-new" ).getUrl() );
        assertEquals( repo.getLayout(), service.getRemoteRepository( "id-new" ).getLayout() );
        assertEquals( repo.getUserName(), service.getRemoteRepository( "id-new" ).getUserName() );
        assertEquals( repo.getPassword(), service.getRemoteRepository( "id-new" ).getPassword() );
        assertEquals( repo.getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() );

        service.deleteRemoteRepository( "id-new" );

        assertNull( service.getRemoteRepository( "id-new" ) );

        assertEquals( initialSize, service.getRemoteRepositories().size() );

    }
View Full Code Here

        return service;
    }

    protected RemoteRepositoriesService getRemoteRepositoriesService()
    {
        RemoteRepositoriesService service =
            JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
                                       RemoteRepositoriesService.class,
                                       Collections.singletonList( new JacksonJaxbJsonProvider() ) );

        WebClient.client( service ).header( "Authorization", authorizationHeader );
View Full Code Here

        Server repoServer =
            buildStaticServer( new File( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" ) );
        repoServer.start();

        RemoteRepositoriesService service = getRemoteRepositoriesService();

        WebClient.client( service ).header( "Authorization", authorizationHeader );

        try
        {

            int repoServerPort = repoServer.getConnectors()[0].getLocalPort();

            RemoteRepository repo = getRemoteRepository();

            repo.setUrl( "http://localhost:" + repoServerPort );

            service.addRemoteRepository( repo );

            assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isTrue();
        }
        finally
        {
            service.deleteRemoteRepository( "id-new" );
            repoServer.stop();
        }
    }
View Full Code Here

        File tmpDir = Files.createTempDirectory( "test" ).toFile();
        Server repoServer = buildStaticServer( tmpDir );
        repoServer.start();

        RemoteRepositoriesService service = getRemoteRepositoriesService();

        WebClient.client( service ).header( "Authorization", authorizationHeader );

        try
        {

            int repoServerPort = repoServer.getConnectors()[0].getLocalPort();

            RemoteRepository repo = getRemoteRepository();

            repo.setUrl( "http://localhost:" + repoServerPort );

            service.addRemoteRepository( repo );

            assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isTrue();
        }
        finally
        {
            service.deleteRemoteRepository( "id-new" );
            FileUtils.deleteQuietly( tmpDir );
            repoServer.stop();
        }
    }
View Full Code Here

    @Test
    public void checkRemoteConnectivityFail()
        throws Exception
    {

        RemoteRepositoriesService service = getRemoteRepositoriesService();

        WebClient.client( service ).header( "Authorization", authorizationHeader );

        try
        {

            RemoteRepository repo = getRemoteRepository();

            repo.setUrl( "http://localhost:8956" );

            service.addRemoteRepository( repo );

            assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isFalse();
        }
        finally
        {
            service.deleteRemoteRepository( "id-new" );

        }
    }
View Full Code Here

    @Test (expected = ServerWebApplicationException.class)
    public void listRemoteRepositoriesKarmaFailed()
        throws Exception
    {
        RemoteRepositoriesService service = getRemoteRepositoriesService();
        try
        {
            assertFalse( service.getRemoteRepositories().isEmpty() );
        }
        catch ( ServerWebApplicationException e )
        {
            assertEquals( 403, e.getStatus() );
            throw e;
View Full Code Here

TOP

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

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.