use of org.motechproject.admin.settings.Settings in project motech by motech.
the class SettingsServiceTest method shouldSaveNullSettingAsNullValue.
@Test
public void shouldSaveNullSettingAsNullValue() {
SettingsOption option = new SettingsOption(OPTION_KEY, null);
Settings settings = new Settings("section", singletonList(option));
settingsService.savePlatformSettings(settings);
verify(configurationService).setPlatformSetting(OPTION_KEY, null);
}
use of org.motechproject.admin.settings.Settings in project motech by motech.
the class SettingsControllerTest method testGetPlatformSettings.
@Test
public void testGetPlatformSettings() {
SettingsOption option = new SettingsOption(new AbstractMap.SimpleEntry<Object, Object>(ConfigurationConstants.LANGUAGE, "en"));
List<Settings> pSettingsList = new ArrayList<>();
pSettingsList.add(platformSettings);
AdminSettings adminSettings = new AdminSettings(pSettingsList, false);
when(settingsService.getSettings()).thenReturn(adminSettings);
when(platformSettings.getSettings()).thenReturn(Arrays.asList(option));
List<Settings> result = controller.getPlatformSettings().getSettingsList();
assertEquals(option.getKey(), result.get(0).getSettings().get(0).getKey());
assertEquals(option.getValue(), result.get(0).getSettings().get(0).getValue());
verify(settingsService).getSettings();
}
use of org.motechproject.admin.settings.Settings in project motech by motech.
the class SettingsServiceTest method testGetBundleSettings.
@Test
public void testGetBundleSettings() throws IOException {
List<Settings> bundleSettingsList = settingsService.getBundleSettings(BUNDLE_ID);
assertEquals(1, bundleSettingsList.size());
Settings bundleSettings = bundleSettingsList.get(0);
assertEquals(BUNDLE_FILENAME, bundleSettings.getSection());
List<SettingsOption> settingsOptions = bundleSettings.getSettings();
assertEquals(1, settingsOptions.size());
assertEquals(OPTION_KEY, settingsOptions.get(0).getKey());
assertEquals(OPTION_VALUE, settingsOptions.get(0).getValue());
}
use of org.motechproject.admin.settings.Settings in project motech by motech.
the class SettingsServiceTest method testSaveBundleSettings.
@Test
public void testSaveBundleSettings() throws IOException {
SettingsOption option = new SettingsOption(OPTION_KEY, OPTION_VALUE);
Settings settings = new Settings(BUNDLE_FILENAME, singletonList(option));
settingsService.saveBundleSettings(settings, BUNDLE_ID);
verify(configurationService).addOrUpdateProperties(BUNDLE_SYMBOLIC_NAME, "", BUNDLE_FILENAME, bundleProperty, null);
}
use of org.motechproject.admin.settings.Settings in project motech by motech.
the class SettingsServiceTest method testGetSettings.
@Test
public void testGetSettings() {
AdminSettings adminSettings = settingsService.getSettings();
assertNotNull(adminSettings);
List<Settings> platformSettingsList = adminSettings.getSettingsList();
assertEquals(false, adminSettings.isReadOnly());
assertEquals(3, platformSettingsList.size());
SettingsOption option = platformSettingsList.get(0).getSettings().get(0);
assertEquals(LANGUAGE, option.getKey());
assertEquals(LANGUAGE_VALUE, option.getValue());
verify(configurationService).getPlatformSettings();
}
Aggregations