use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class DefaultMailService method updateMailConfiguration.
@Override
public void updateMailConfiguration() {
AdminSettings settings = adminSettingsService.findAdminSettingsByKey("mail");
if (settings != null) {
JsonNode jsonConfig = settings.getJsonValue();
mailSender = createMailSender(jsonConfig);
mailFrom = jsonConfig.get("mailFrom").asText();
} else {
throw new IncorrectParameterException("Failed to date mail configuration. Settings not found!");
}
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class AdminSettingsEntity method toData.
@Override
public AdminSettings toData() {
AdminSettings adminSettings = new AdminSettings(new AdminSettingsId(id));
adminSettings.setCreatedTime(UUIDs.unixTimestamp(id));
adminSettings.setKey(key);
adminSettings.setJsonValue(jsonValue);
return adminSettings;
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminSettingsServiceTest method testFindAdminSettingsById.
@Test
public void testFindAdminSettingsById() {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey("general");
AdminSettings foundAdminSettings = adminSettingsService.findAdminSettingsById(adminSettings.getId());
Assert.assertNotNull(foundAdminSettings);
Assert.assertEquals(adminSettings, foundAdminSettings);
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminSettingsServiceTest method testSaveAdminSettingsWithEmptyKey.
@Test(expected = DataValidationException.class)
public void testSaveAdminSettingsWithEmptyKey() {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey("mail");
adminSettings.setKey(null);
adminSettingsService.saveAdminSettings(adminSettings);
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminSettingsServiceTest method testSaveAdminSettingsWithNonTextValue.
@Test(expected = DataValidationException.class)
public void testSaveAdminSettingsWithNonTextValue() throws Exception {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey("mail");
JsonNode json = adminSettings.getJsonValue();
((ObjectNode) json).put("timeout", 10000L);
adminSettings.setJsonValue(json);
adminSettingsService.saveAdminSettings(adminSettings);
}
Aggregations