Package org.apache.maven.scm.provider

Examples of org.apache.maven.scm.provider.ScmProviderRepositoryWithHost


    {
      final ScmRepository repository =
          scmInfo.getScmManager().makeScmRepository(scmConnection);
      if (repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost)
      {
        final ScmProviderRepositoryWithHost repositoryWithHost =
            (ScmProviderRepositoryWithHost) repository.getProviderRepository();
        final String host = createHostName(repositoryWithHost);
        credentials.configureByServer(host);
      }
    }
View Full Code Here


            providerRepository.setPassword( password );
        }

        if ( providerRepository instanceof ScmProviderRepositoryWithHost )
        {
            ScmProviderRepositoryWithHost providerRepo = (ScmProviderRepositoryWithHost) providerRepository;

            if ( StringUtils.isNotEmpty( privateKey ) )
            {
                providerRepo.setPrivateKey( privateKey );
            }

            if ( StringUtils.isNotEmpty( passphrase ) )
            {
                providerRepo.setPassphrase( passphrase );
            }
        }

        return scmRepository;
    }
View Full Code Here

    public void testEncryptedPasswordFromSettings()
        throws Exception
    {
        File pom = getTestFile( "src/test/resources/mojos/checkout/checkoutEncryptedPasswordFromSettings.xml" );
        CheckoutMojo mojo = (CheckoutMojo) lookupMojo( "checkout", pom );
        ScmProviderRepositoryWithHost repo =
            (ScmProviderRepositoryWithHost) mojo.getScmRepository().getProviderRepository();

        assertEquals( "testuser", repo.getUser() );
        assertEquals( "testpass", repo.getPassword() );
        assertEquals( "testphrase", repo.getPassphrase() );
    }
View Full Code Here

                server = settings.getServer( releaseDescriptor.getScmId() );
            }

            if ( server == null && repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost )
            {
                ScmProviderRepositoryWithHost repositoryWithHost =
                    (ScmProviderRepositoryWithHost) repository.getProviderRepository();
                String host = repositoryWithHost.getHost();

                int port = repositoryWithHost.getPort();

                if ( port > 0 )
                {
                    host += ":" + port;
                }

                // TODO: this is a bit dodgy - id is not host, but since we don't have a <host> field we make an assumption
                server = settings.getServer( host );
            }

            if ( server != null )
            {
                if ( username == null )
                {
                    username = server.getUsername();
                }

                if ( password == null )
                {
                    password = decrypt( server.getPassword(), server.getId() );
                }

                if ( privateKey == null )
                {
                    privateKey = server.getPrivateKey();
                }

                if ( passphrase == null )
                {
                    passphrase = decrypt( server.getPassphrase(), server.getId() );
                }
            }
        }

        if ( !StringUtils.isEmpty( username ) )
        {
            scmRepo.setUser( username );
        }
        if ( !StringUtils.isEmpty( password ) )
        {
            scmRepo.setPassword( password );
        }

        if ( scmRepo instanceof ScmProviderRepositoryWithHost )
        {
            ScmProviderRepositoryWithHost repositoryWithHost = (ScmProviderRepositoryWithHost) scmRepo;
            if ( !StringUtils.isEmpty( privateKey ) )
            {
                repositoryWithHost.setPrivateKey( privateKey );
            }

            if ( !StringUtils.isEmpty( passphrase ) )
            {
                repositoryWithHost.setPassphrase( passphrase );
            }
        }

        if ( "svn".equals( repository.getProvider() ) )
        {
View Full Code Here

        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
        releaseDescriptor.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/home/cvs:module" );

        ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, settings );

        ScmProviderRepositoryWithHost providerRepository =
            (ScmProviderRepositoryWithHost) repository.getProviderRepository();
        assertEquals( "check host", "localhost", providerRepository.getHost() );
        assertEquals( "check port", CVS_PORT, providerRepository.getPort() );
        assertEquals( "check username", "settings-username", providerRepository.getUser() );
        assertEquals( "check password", "settings-password", providerRepository.getPassword() );
        assertEquals( "check private key", "settings-private-key", providerRepository.getPrivateKey() );
        assertEquals( "check passphrase", "settings-passphrase", providerRepository.getPassphrase() );
    }
View Full Code Here

        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
        releaseDescriptor.setScmSourceUrl( "scm:svn:svn://localhost/repo" );

        ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, settings );

        ScmProviderRepositoryWithHost providerRepository =
            (ScmProviderRepositoryWithHost) repository.getProviderRepository();
        assertEquals( "check host", "localhost", providerRepository.getHost() );
        assertEquals( "check username", "testuser", providerRepository.getUser() );
        assertEquals( "check password", "testpass", providerRepository.getPassword() );
        assertEquals( "check passphrase", "testphrase", providerRepository.getPassphrase() );
    }
View Full Code Here

{
    /** {@inheritDoc} */
    public ScmRepository makeScmRepository( String string )
        throws ScmRepositoryException, NoSuchScmProviderException
    {
        ScmProviderRepositoryWithHost scmRepository = new ScmProviderRepositoryWithHost()
        {
            /** {@inheritDoc} */
            public String getHost()
            {
                return "scmHost";
View Full Code Here

                providerRepo.setPassword( password );
            }

            if ( repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost )
            {
                ScmProviderRepositoryWithHost repo = (ScmProviderRepositoryWithHost) repository.getProviderRepository();

                loadInfosFromSettings( repo );

                if ( !StringUtils.isEmpty( username ) )
                {
                    repo.setUser( username );
                }

                if ( !StringUtils.isEmpty( password ) )
                {
                    repo.setPassword( password );
                }

                if ( !StringUtils.isEmpty( privateKey ) )
                {
                    repo.setPrivateKey( privateKey );
                }

                if ( !StringUtils.isEmpty( passphrase ) )
                {
                    repo.setPassphrase( passphrase );
                }
            }

            if ( !StringUtils.isEmpty( tagBase ) && repository.getProvider().equals( "svn" ) )
            {
View Full Code Here

                providerRepo.setPassword( password );
            }

            if ( repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost )
            {
                ScmProviderRepositoryWithHost repo = (ScmProviderRepositoryWithHost) repository.getProviderRepository();

                loadInfosFromSettings( repo );

                if ( !StringUtils.isEmpty( username ) )
                {
                    repo.setUser( username );
                }

                if ( !StringUtils.isEmpty( password ) )
                {
                    repo.setPassword( password );
                }

                if ( !StringUtils.isEmpty( privateKey ) )
                {
                    repo.setPrivateKey( privateKey );
                }

                if ( !StringUtils.isEmpty( passphrase ) )
                {
                    repo.setPassphrase( passphrase );
                }
            }

            if ( !StringUtils.isEmpty( tagBase ) && repository.getProvider().equals( "svn" ) )
            {
View Full Code Here

    public void testEncryptedPasswordFromSettings()
        throws Exception
    {
        File pom = getTestFile( "src/test/resources/mojos/checkout/checkoutEncryptedPasswordFromSettings.xml" );
        CheckoutMojo mojo = (CheckoutMojo) lookupMojo( "checkout", pom );
        ScmProviderRepositoryWithHost repo =
            (ScmProviderRepositoryWithHost) mojo.getScmRepository().getProviderRepository();

        assertEquals( "testuser", repo.getUser() );
        assertEquals( "testpass", repo.getPassword() );
        assertEquals( "testphrase", repo.getPassphrase() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.provider.ScmProviderRepositoryWithHost

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.