use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminSettingsServiceTest method testSaveAdminSettingsWithNewJsonStructure.
@Test(expected = DataValidationException.class)
public void testSaveAdminSettingsWithNewJsonStructure() throws Exception {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey("mail");
JsonNode json = adminSettings.getJsonValue();
((ObjectNode) json).put("newKey", "my new value");
adminSettings.setJsonValue(json);
adminSettingsService.saveAdminSettings(adminSettings);
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminControllerTest method testSaveAdminSettingsWithNonTextValue.
@Test
public void testSaveAdminSettingsWithNonTextValue() throws Exception {
loginSysAdmin();
AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class);
JsonNode json = adminSettings.getJsonValue();
((ObjectNode) json).put("timeout", 10000L);
adminSettings.setJsonValue(json);
doPost("/api/admin/settings", adminSettings).andExpect(status().isBadRequest()).andExpect(statusReason(containsString("Provided json structure can't contain non-text values")));
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminControllerTest method testSaveAdminSettings.
@Test
public void testSaveAdminSettings() throws Exception {
loginSysAdmin();
AdminSettings adminSettings = doGet("/api/admin/settings/general", AdminSettings.class);
JsonNode jsonValue = adminSettings.getJsonValue();
((ObjectNode) jsonValue).put("baseUrl", "http://myhost.org");
adminSettings.setJsonValue(jsonValue);
doPost("/api/admin/settings", adminSettings).andExpect(status().isOk());
doGet("/api/admin/settings/general").andExpect(status().isOk()).andExpect(content().contentType(contentType)).andExpect(jsonPath("$.jsonValue.baseUrl", is("http://myhost.org")));
((ObjectNode) jsonValue).put("baseUrl", "http://localhost:8080");
adminSettings.setJsonValue(jsonValue);
doPost("/api/admin/settings", adminSettings).andExpect(status().isOk());
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminControllerTest method testSaveAdminSettingsWithEmptyKey.
@Test
public void testSaveAdminSettingsWithEmptyKey() throws Exception {
loginSysAdmin();
AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class);
adminSettings.setKey(null);
doPost("/api/admin/settings", adminSettings).andExpect(status().isBadRequest()).andExpect(statusReason(containsString("Key should be specified")));
}
use of org.thingsboard.server.common.data.AdminSettings in project thingsboard by thingsboard.
the class BaseAdminControllerTest method testChangeAdminSettingsKey.
@Test
public void testChangeAdminSettingsKey() throws Exception {
loginSysAdmin();
AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class);
adminSettings.setKey("newKey");
doPost("/api/admin/settings", adminSettings).andExpect(status().isBadRequest()).andExpect(statusReason(containsString("is prohibited")));
}
Aggregations