use of org.springframework.cloud.config.server.support.AwsCodeCommitCredentialProvider in project spring-cloud-config by spring-cloud.
the class JGitEnvironmentRepositoryTests method gitCredentialsProviderFactoryCreatesAwsCodeCommitProvider.
@Test
public void gitCredentialsProviderFactoryCreatesAwsCodeCommitProvider() throws Exception {
GitCredentialsProviderFactory credentialsFactory = new GitCredentialsProviderFactory();
Git mockGit = mock(Git.class);
MockCloneCommand mockCloneCommand = new MockCloneCommand(mockGit);
final String awsUri = "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/test";
JGitEnvironmentRepository envRepository = new JGitEnvironmentRepository(this.environment, new JGitEnvironmentProperties());
envRepository.setGitFactory(new MockGitFactory(mockGit, mockCloneCommand));
envRepository.setUri(awsUri);
envRepository.setGitCredentialsProvider(credentialsFactory.createFor(envRepository.getUri(), null, null, null));
envRepository.setCloneOnStart(true);
envRepository.afterPropertiesSet();
assertTrue(mockCloneCommand.getCredentialsProvider() instanceof AwsCodeCommitCredentialProvider);
}
use of org.springframework.cloud.config.server.support.AwsCodeCommitCredentialProvider in project spring-cloud-config by spring-cloud.
the class GitCredentialsProviderFactoryTests method testCreateForAwsWithUsername.
@Test
public void testCreateForAwsWithUsername() {
CredentialsProvider provider = factory.createFor(AWS_REPO, USER, PASSWORD, null);
assertNotNull(provider);
assertTrue(provider instanceof AwsCodeCommitCredentialProvider);
AwsCodeCommitCredentialProvider aws = (AwsCodeCommitCredentialProvider) provider;
assertEquals(USER, aws.getUsername());
assertEquals(PASSWORD, aws.getPassword());
}
use of org.springframework.cloud.config.server.support.AwsCodeCommitCredentialProvider in project spring-cloud-config by spring-cloud.
the class GitCredentialsProviderFactoryTests method testCreateForAwsNoUsername.
@Test
public void testCreateForAwsNoUsername() {
CredentialsProvider provider = factory.createFor(AWS_REPO, null, null, null);
assertNotNull(provider);
assertTrue(provider instanceof AwsCodeCommitCredentialProvider);
AwsCodeCommitCredentialProvider aws = (AwsCodeCommitCredentialProvider) provider;
assertNull(aws.getUsername());
assertNull(aws.getPassword());
}
Aggregations