Package org.apache.maven.wagon.repository

Examples of org.apache.maven.wagon.repository.Repository


        throws MojoExecutionException, MojoFailureException
    {
        stagingSiteURL = getStagingSiteURL( project, reactorProjects, stagingSiteURL );
        getLog().info( "Using this URL for staging: " + stagingSiteURL );

        Repository repository = new Repository( stagingRepositoryId, stagingSiteURL );

        Wagon wagon;
        try
        {
            wagon = wagonManager.getWagon( repository );
            SiteDeployMojo.configureWagon( wagon, stagingRepositoryId, settings, plexusContainer, getLog() );
            wagon.connect( repository );
        }
        catch ( UnsupportedProtocolException e )
        {
            throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e );
        }
        catch ( WagonConfigurationException e )
        {
            throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e );
        } catch (AuthenticationException e)
        {
            throw new MojoExecutionException( "AuthenticationException : Unable to connect Wagon to repository : '" + repository.getProtocol() + "'", e );
        }
        catch ( ConnectionException e )
        {
            throw new MojoExecutionException( "Unable to connect Wagon to repository : '" + repository.getProtocol() + "'", e );
        }

        if ( !wagon.supportsDirectoryCopy() )
        {
            throw new MojoExecutionException(
                "Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying" );
        }
      
        try
        {
            Debug debug = new Debug();
           

            wagon.addSessionListener( debug );

            wagon.addTransferListener( debug );

            /*
            ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository, wagonManager );
            if ( proxyInfo != null )
            {
                wagon.connect( repository, wagonManager.getAuthenticationInfo( stagingRepositoryId ), proxyInfo );
            }
            else
            {
                wagon.connect( repository, wagonManager.getAuthenticationInfo( stagingRepositoryId ) );
            }
            */
            wagon.connect( repository );
            wagon.putDirectory( new File( stagingDirectory, getStructure( project, false ) ), "." );

            getLog().debug( "putDirectory end ok " );
            if ( chmod && wagon instanceof CommandExecutor )
            {
                CommandExecutor exec = (CommandExecutor) wagon;
                exec.executeCommand( "chmod " + chmodOptions + " " + chmodMode + " " + repository.getBasedir() );
            }
        }
        catch ( ResourceDoesNotExistException e )
        {
            throw new MojoExecutionException( "Error uploading site", e );
View Full Code Here


    public void testSessionEventProperties()
        throws ConnectionException, AuthenticationException
    {

        final Wagon wagon = (Wagon) MockControl.createControl( Wagon.class ).getMock();
        final Repository repo = new Repository();

        wagon.connect( repo );

        final long timestamp = System.currentTimeMillis();
        final Exception exception = new AuthenticationException( "dummy" );
View Full Code Here

        // ----------------------------------------------------------------------
        // Create the test repository for the wagon we are testing.
        // ----------------------------------------------------------------------

        testRepository = new Repository();

        testRepository.setUrl( getTestRepositoryUrl() );

        testRepository.setPermissions( getPermissions() );
View Full Code Here

    {
        File path = new File( url.substring( 7 ) );

        path.mkdirs();

        Repository repository = new Repository();

        repository.setUrl( url );

        return repository;
    }
View Full Code Here

    public void testErrorInCommandExecuted()
        throws Exception
    {
        CommandExecutor exec = (CommandExecutor) lookup( CommandExecutor.ROLE );

        Repository repository = getTestRepository();

        AuthenticationInfo authenticationInfo = new AuthenticationInfo();
        authenticationInfo.setUserName( System.getProperty( "user.name" ) );

        exec.connect( repository, authenticationInfo );
View Full Code Here

    public void testIgnoreFailuresInCommandExecuted()
        throws Exception
    {
        CommandExecutor exec = (CommandExecutor) lookup( CommandExecutor.ROLE );

        Repository repository = getTestRepository();

        AuthenticationInfo authenticationInfo = new AuthenticationInfo();
        authenticationInfo.setUserName( System.getProperty( "user.name" ) );

        exec.connect( repository, authenticationInfo );
View Full Code Here

    public void testExecuteSuccessfulCommand()
        throws Exception
    {
        CommandExecutor exec = (CommandExecutor) lookup( CommandExecutor.ROLE );

        Repository repository = getTestRepository();

        AuthenticationInfo authenticationInfo = new AuthenticationInfo();
        authenticationInfo.setUserName( System.getProperty( "user.name" ) );

        exec.connect( repository, authenticationInfo );
View Full Code Here

    public void testNullFileWagon() throws ConnectionException, AuthenticationException
    {
        Wagon wagon = new FileWagon();
        Resource resource = new Resource();
        resource.setContentLength( 100000 );
        Repository repository = new Repository();
        wagon.connect( repository );
    }
View Full Code Here

        throws Exception
    {
        String url = "file://" + getBasedir();
       
        Wagon wagon = new FileWagon();
        Repository repository = new Repository( "someID", url );
        wagon.connect( repository );
       
        assertTrue( wagon.resourceExists( "target" ) );
        assertTrue( wagon.resourceExists( "target/" ) );
        assertTrue( wagon.resourceExists( "pom.xml" ) );
View Full Code Here

        server.setHandler( handler );
        addConnectors( server );
        server.start();

        wagon.connect(
            new Repository( "id", getProtocol() + "://localhost:" + server.getConnectors()[0].getLocalPort() ) );

        wagon.getToStream( "resource", new StringOutputStream() );

        wagon.disconnect();
View Full Code Here

TOP

Related Classes of org.apache.maven.wagon.repository.Repository

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.