use of net.nemerosa.ontrack.extension.jenkins.JenkinsConfiguration in project ontrack by nemerosa.
the class JenkinsServiceTest method update_blank_password.
@Test
public void update_blank_password() {
when(encryptionService.encrypt("secret")).thenReturn("xxxxx");
when(encryptionService.decrypt("xxxxx")).thenReturn("secret");
when(configurationRepository.find(JenkinsConfiguration.class, "test")).thenReturn(Optional.of(new JenkinsConfiguration("test", "http://host", "user", "xxxxx")));
jenkinsService.updateConfiguration("test", new JenkinsConfiguration("test", "http://host", "user", ""));
verify(configurationRepository, times(1)).save(new JenkinsConfiguration("test", "http://host", "user", "xxxxx"));
}
use of net.nemerosa.ontrack.extension.jenkins.JenkinsConfiguration in project ontrack by nemerosa.
the class JenkinsConfigurationTest method obfuscate.
@Test
public void obfuscate() {
JenkinsConfiguration config = new JenkinsConfiguration("Test", "http://host", "user", "secret");
assertEquals("secret", config.getPassword());
config = config.obfuscate();
assertEquals("", config.getPassword());
}
use of net.nemerosa.ontrack.extension.jenkins.JenkinsConfiguration in project ontrack by nemerosa.
the class JenkinsServiceTest method update_new_password.
@Test
public void update_new_password() {
when(encryptionService.encrypt("pwd")).thenReturn("xxxxx");
when(configurationRepository.find(JenkinsConfiguration.class, "test")).thenReturn(Optional.of(new JenkinsConfiguration("test", "http://host", "user", "xxxxx")));
jenkinsService.updateConfiguration("test", new JenkinsConfiguration("test", "http://host", "user", "pwd"));
verify(configurationRepository, times(1)).save(new JenkinsConfiguration("test", "http://host", "user", "xxxxx"));
}
use of net.nemerosa.ontrack.extension.jenkins.JenkinsConfiguration in project ontrack by nemerosa.
the class JenkinsServiceTest method update_blank_password_for_different_user.
@Test
public void update_blank_password_for_different_user() {
when(encryptionService.encrypt("")).thenReturn("xxxxx");
when(configurationRepository.find(JenkinsConfiguration.class, "test")).thenReturn(Optional.of(new JenkinsConfiguration("test", "http://host", "user", "xxxxx")));
jenkinsService.updateConfiguration("test", new JenkinsConfiguration("test", "http://host", "user1", ""));
verify(configurationRepository, times(1)).save(new JenkinsConfiguration("test", "http://host", "user1", "xxxxx"));
}
Aggregations