use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminSettingsServiceTest method testSaveAdminSettings.
@Test
public void testSaveAdminSettings() throws Exception {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey("general");
JsonNode json = adminSettings.getJsonValue();
((ObjectNode) json).put("baseUrl", "http://myhost.org");
adminSettings.setJsonValue(json);
adminSettingsService.saveAdminSettings(adminSettings);
AdminSettings savedAdminSettings = adminSettingsService.findAdminSettingsByKey("general");
Assert.assertNotNull(savedAdminSettings);
Assert.assertEquals(adminSettings.getJsonValue(), savedAdminSettings.getJsonValue());
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminSettingsServiceTest method testFindAdminSettingsByKey.
@Test
public void testFindAdminSettingsByKey() {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey("general");
Assert.assertNotNull(adminSettings);
adminSettings = adminSettingsService.findAdminSettingsByKey("mail");
Assert.assertNotNull(adminSettings);
adminSettings = adminSettingsService.findAdminSettingsByKey("unknown");
Assert.assertNull(adminSettings);
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminSettingsServiceTest method testChangeAdminSettingsKey.
@Test(expected = DataValidationException.class)
public void testChangeAdminSettingsKey() {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey("mail");
adminSettings.setKey("newKey");
adminSettingsService.saveAdminSettings(adminSettings);
}
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(UUIDConverter.fromString(id)));
adminSettings.setCreatedTime(UUIDs.unixTimestamp(UUIDConverter.fromString(id)));
adminSettings.setKey(key);
adminSettings.setJsonValue(jsonValue);
return adminSettings;
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminControllerTest method testSendTestMail.
@Test
public void testSendTestMail() throws Exception {
loginSysAdmin();
AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class);
doPost("/api/admin/settings/testMail", adminSettings).andExpect(status().isOk());
}
Aggregations