use of com.artezio.arttime.config.Setting in project ART-TIME by Artezio.
the class SettingsServiceTest method testUpdateAdminPassword.
@Test
public void testUpdateAdminPassword() {
Setting passwordSetting = new Setting(Setting.Name.ADMIN_PASSWORD, "old_password");
entityManager.persist(passwordSetting);
Settings settings = settingsService.getSettings();
DefaultPasswordService defaultPasswordService = new DefaultPasswordService();
Settings actual = settingsService.update(settings, "new_password");
assertNotNull(actual.getAdminPassword());
assertNotEquals("new_password", actual.getAdminPassword());
assertTrue(defaultPasswordService.passwordsMatch("new_password", actual.getAdminPassword()));
}
use of com.artezio.arttime.config.Setting in project ART-TIME by Artezio.
the class SettingsServiceTest method testGetSettings.
@Test
public void testGetSettings() {
Setting setting1 = new Setting(Setting.Name.APPLICATION_BASE_URL, "abc");
Setting setting2 = new Setting(Setting.Name.HELP_PAGE_URL, null);
entityManager.persist(setting1);
entityManager.persist(setting2);
entityManager.flush();
System.out.println("+++++++++++++++++++++++++++++++++++++++++++++");
Settings actual = settingsService.getSettings();
settingsService.getSettings();
settingsService.getSettings();
settingsService.getSettings();
settingsService.getSettings();
settingsService.getSettings();
settingsService.getSettings();
System.out.println("+++++++++++++++++++++++++++++++++++++++++++++");
assertNotNull(actual);
assertTrue(actual.getValuesBySettingNames().containsKey(Setting.Name.APPLICATION_BASE_URL));
assertTrue(actual.getValuesBySettingNames().containsKey(Setting.Name.HELP_PAGE_URL));
assertEquals(setting1.getValue(), actual.getValuesBySettingNames().get(setting1.getName()));
assertEquals(setting2.getValue(), actual.getValuesBySettingNames().get(setting2.getName()));
}
use of com.artezio.arttime.config.Setting in project ART-TIME by Artezio.
the class SettingsServiceTest method testUpdateSettings.
@Test
public void testUpdateSettings() {
Setting setting1 = new Setting(Setting.Name.LDAP_BIND_CREDENTIALS, "old_value1");
Setting setting2 = new Setting(Setting.Name.SMTP_HOST_NAME, "old_value2");
entityManager.persist(setting1);
entityManager.persist(setting2);
entityManager.flush();
Settings settings = settingsService.getSettings();
settings.setLdapBindCredentials("new_value");
settings.setSmtpHostName(null);
settingsService.update(settings);
Settings newSettings = settingsService.getSettings();
assertTrue(newSettings.getLdapBindCredentials().equals("new_value"));
assertNull(newSettings.getSmtpHostName());
}
Aggregations