use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshPropertyValidatorTest method knowHostsFileIsValidated.
@Test
public void knowHostsFileIsValidated() throws Exception {
MultipleJGitEnvironmentProperties sshUriProperties = new MultipleJGitEnvironmentProperties();
assertThat(validator.validate(sshUriProperties)).hasSize(0);
sshUriProperties.setKnownHostsFile("non-existing.file");
assertThat(validator.validate(sshUriProperties)).hasSize(1);
}
use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshPropertyValidatorTest method validatorNotRunIfHttpsUri.
@Test
public void validatorNotRunIfHttpsUri() throws Exception {
MultipleJGitEnvironmentProperties httpsUri = new MultipleJGitEnvironmentProperties();
httpsUri.setUri("https://somerepo.com/team/project.git");
httpsUri.setIgnoreLocalSshSettings(true);
httpsUri.setPrivateKey("invalid_key");
Set<ConstraintViolation<MultipleJGitEnvironmentProperties>> constraintViolations = validator.validate(httpsUri);
assertThat(constraintViolations).hasSize(0);
}
use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshPropertyValidatorTest method invalidPrivateKeyFails.
@Test
public void invalidPrivateKeyFails() throws Exception {
MultipleJGitEnvironmentProperties invalidKey = new MultipleJGitEnvironmentProperties();
invalidKey.setUri(SSH_URI);
invalidKey.setIgnoreLocalSshSettings(true);
invalidKey.setPrivateKey("invalid_key");
Set<ConstraintViolation<MultipleJGitEnvironmentProperties>> constraintViolations = validator.validate(invalidKey);
assertThat(constraintViolations).hasSize(1);
}
use of org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties in project spring-cloud-config by spring-cloud.
the class SshPropertyValidatorTest method algoWithMissingHostKeyFails.
@Test
public void algoWithMissingHostKeyFails() throws Exception {
MultipleJGitEnvironmentProperties missingHostKey = new MultipleJGitEnvironmentProperties();
missingHostKey.setUri(SSH_URI);
missingHostKey.setIgnoreLocalSshSettings(true);
missingHostKey.setPrivateKey(VALID_PRIVATE_KEY);
missingHostKey.setHostKeyAlgorithm("ssh-rsa");
Set<ConstraintViolation<MultipleJGitEnvironmentProperties>> constraintViolations = validator.validate(missingHostKey);
assertThat(constraintViolations).hasSize(1);
}
Aggregations