use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshUriPropertyProcessorTest method mainRepoPropertiesFixture.
private MultipleJGitEnvironmentProperties mainRepoPropertiesFixture() {
MultipleJGitEnvironmentProperties result = new MultipleJGitEnvironmentProperties();
result.setUri(URI1);
result.setHostKeyAlgorithm(ALGO1);
result.setHostKey(HOST_KEY1);
result.setPrivateKey(PRIVATE_KEY1);
return result;
}
use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshUriPropertyProcessorTest method testHttpsUriDoesNotAddEntry.
@Test
public void testHttpsUriDoesNotAddEntry() {
MultipleJGitEnvironmentProperties sshUriProperties = new MultipleJGitEnvironmentProperties();
sshUriProperties.setUri("https://user@github.com/proj/repo.git");
SshUriPropertyProcessor sshUriPropertyProcessor = new SshUriPropertyProcessor(sshUriProperties);
Map<String, JGitEnvironmentProperties> sshKeysByHostname = sshUriPropertyProcessor.getSshKeysByHostname();
assertThat(sshKeysByHostname.values()).hasSize(0);
}
use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshUriPropertyProcessorTest method testNoSshUriProperties.
@Test
public void testNoSshUriProperties() {
SshUriPropertyProcessor sshUriPropertyProcessor = new SshUriPropertyProcessor(new MultipleJGitEnvironmentProperties());
Map<String, JGitEnvironmentProperties> sshKeysByHostname = sshUriPropertyProcessor.getSshKeysByHostname();
assertThat(sshKeysByHostname.values()).hasSize(0);
}
use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshUriPropertyProcessorTest method testInvalidUriDoesNotAddEntry.
@Test
public void testInvalidUriDoesNotAddEntry() {
MultipleJGitEnvironmentProperties sshUriProperties = new MultipleJGitEnvironmentProperties();
sshUriProperties.setUri("invalid_uri");
SshUriPropertyProcessor sshUriPropertyProcessor = new SshUriPropertyProcessor(sshUriProperties);
Map<String, JGitEnvironmentProperties> sshKeysByHostname = sshUriPropertyProcessor.getSshKeysByHostname();
assertThat(sshKeysByHostname.values()).hasSize(0);
}
use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshUriPropertyProcessorTest method testMultipleSshUriPropertiess.
@Test
public void testMultipleSshUriPropertiess() {
MultipleJGitEnvironmentProperties sshUriProperties = mainRepoPropertiesFixture();
MultipleJGitEnvironmentProperties.PatternMatchingJGitEnvironmentProperties nestedSshUriProperties1;
nestedSshUriProperties1 = new MultipleJGitEnvironmentProperties.PatternMatchingJGitEnvironmentProperties();
nestedSshUriProperties1.setUri(URI2);
nestedSshUriProperties1.setPrivateKey(PRIVATE_KEY2);
MultipleJGitEnvironmentProperties.PatternMatchingJGitEnvironmentProperties nestedSshUriProperties2;
nestedSshUriProperties2 = new MultipleJGitEnvironmentProperties.PatternMatchingJGitEnvironmentProperties();
nestedSshUriProperties2.setUri(URI3);
nestedSshUriProperties2.setPrivateKey(PRIVATE_KEY3);
addRepoProperties(sshUriProperties, nestedSshUriProperties1, "repo2");
addRepoProperties(sshUriProperties, nestedSshUriProperties2, "repo3");
SshUriPropertyProcessor sshUriPropertyProcessor = new SshUriPropertyProcessor(sshUriProperties);
Map<String, JGitEnvironmentProperties> sshKeysByHostname = sshUriPropertyProcessor.getSshKeysByHostname();
assertThat(sshKeysByHostname.values()).hasSize(3);
JGitEnvironmentProperties sshKey1 = sshKeysByHostname.get(HOST1);
assertMainRepo(sshKey1);
JGitEnvironmentProperties sshKey2 = sshKeysByHostname.get(HOST2);
assertThat(SshUriPropertyProcessor.getHostname(sshKey2.getUri())).isEqualTo(HOST2);
assertThat(sshKey2.getHostKeyAlgorithm()).isNull();
assertThat(sshKey2.getHostKey()).isNull();
assertThat(sshKey2.getPrivateKey()).isEqualTo(PRIVATE_KEY2);
JGitEnvironmentProperties sshKey3 = sshKeysByHostname.get(HOST3);
assertThat(SshUriPropertyProcessor.getHostname(sshKey3.getUri())).isEqualTo(HOST3);
assertThat(sshKey3.getHostKeyAlgorithm()).isNull();
assertThat(sshKey3.getHostKey()).isNull();
assertThat(sshKey3.getPrivateKey()).isEqualTo(PRIVATE_KEY3);
}
Aggregations