use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class IniWebEnvironmentTest method testGetGroupRolesMap_ifEmptyGroups.
@Test
public void testGetGroupRolesMap_ifEmptyGroups() {
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setExecRoleMemberOf(null);
settings.setIntegrationClientGroups(null);
Map<String, String> actual = iniWebEnvironment.getGroupRolesMap(settings);
assertTrue(actual.isEmpty());
}
use of com.artezio.arttime.config.Settings 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.Settings in project ART-TIME by Artezio.
the class SettingsServiceTest method testGetSettings_ifNotExists.
@Test
public void testGetSettings_ifNotExists() {
Settings actual = settingsService.getSettings();
assertNotNull(actual);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class SchedulerTest method testActualizeSettings_timeoutHasChanged.
@Test
public void testActualizeSettings_timeoutHasChanged() throws NoSuchFieldException {
scheduler = createMockBuilder(Scheduler.class).addMockedMethod("createIntervalTimer").createMock();
settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setTimerHoursInterval(200);
settings.setTimerMinutesInterval(500);
Settings newSettings = new Settings(new EnumMap<>(Setting.Name.class));
newSettings.setTimerHoursInterval(777);
newSettings.setTimerMinutesInterval(333);
setField(scheduler, "settings", settings);
setField(scheduler, "settingsService", settingsService);
expect(settingsService.getSettings()).andReturn(newSettings);
scheduler.createIntervalTimer();
expectLastCall().once();
replay(settingsService, scheduler);
scheduler.actualizeSettings();
verify(settingsService, scheduler);
}
use of com.artezio.arttime.config.Settings 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()));
}
Aggregations