Fix the device connectivity tests
This commit is contained in:
parent
d4eaac7711
commit
42311d3b17
@ -121,18 +121,47 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest {
|
||||
|
||||
loginSysAdmin();
|
||||
|
||||
AdminSettings adminSettings = doGet("/api/admin/settings/connectivity", AdminSettings.class);
|
||||
JsonNode connectivity = adminSettings.getJsonValue();
|
||||
ObjectNode config = JacksonUtil.newObjectNode();
|
||||
|
||||
((ObjectNode)connectivity.get("http")).put("port", 8080);
|
||||
((ObjectNode)connectivity.get("http")).put("enabled", true);
|
||||
((ObjectNode)connectivity.get("https")).put("enabled", true);
|
||||
((ObjectNode)connectivity.get("https")).put("port", 444);
|
||||
((ObjectNode)connectivity.get("mqtt")).put("enabled", true);
|
||||
((ObjectNode)connectivity.get("mqtts")).put("enabled", true);
|
||||
((ObjectNode)connectivity.get("coap")).put("enabled", true);
|
||||
((ObjectNode)connectivity.get("coaps")).put("enabled", true);
|
||||
doPost("/api/admin/settings", adminSettings);
|
||||
ObjectNode http = JacksonUtil.newObjectNode();
|
||||
http.put("enabled", true);
|
||||
http.put("host", "");
|
||||
http.put("port", 8080);
|
||||
config.set("http", http);
|
||||
|
||||
ObjectNode https = JacksonUtil.newObjectNode();
|
||||
https.put("enabled", true);
|
||||
https.put("host", "");
|
||||
https.put("port", 444);
|
||||
config.set("https", https);
|
||||
|
||||
ObjectNode mqtt = JacksonUtil.newObjectNode();
|
||||
mqtt.put("enabled", true);
|
||||
mqtt.put("host", "");
|
||||
mqtt.put("port", 1883);
|
||||
config.set("mqtt", mqtt);
|
||||
|
||||
ObjectNode mqtts = JacksonUtil.newObjectNode();
|
||||
mqtts.put("enabled", true);
|
||||
mqtts.put("host", "");
|
||||
mqtts.put("port", 8883);
|
||||
config.set("mqtts", mqtts);
|
||||
|
||||
ObjectNode coap = JacksonUtil.newObjectNode();
|
||||
coap.put("enabled", true);
|
||||
coap.put("host", "");
|
||||
coap.put("port", 5683);
|
||||
config.set("coap", coap);
|
||||
|
||||
ObjectNode coaps = JacksonUtil.newObjectNode();
|
||||
coaps.put("enabled", true);
|
||||
coaps.put("host", "");
|
||||
coaps.put("port", 5684);
|
||||
config.set("coaps", coaps);
|
||||
|
||||
AdminSettings adminSettings = doGet("/api/admin/settings/connectivity", AdminSettings.class);
|
||||
adminSettings.setJsonValue(config);
|
||||
doPost("/api/admin/settings", adminSettings).andExpect(status().isOk());
|
||||
|
||||
Tenant tenant = new Tenant();
|
||||
tenant.setTitle("My tenant");
|
||||
|
||||
@ -29,6 +29,7 @@ import org.mockito.Mockito;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.thingsboard.common.util.JacksonUtil;
|
||||
import org.thingsboard.common.util.ThingsBoardExecutors;
|
||||
import org.thingsboard.server.common.data.AdminSettings;
|
||||
import org.thingsboard.server.common.data.Device;
|
||||
@ -66,16 +67,47 @@ public class DeviceConnectivityControllerWithDefaultPortTest extends AbstractCon
|
||||
|
||||
loginSysAdmin();
|
||||
|
||||
AdminSettings adminSettings = doGet("/api/admin/settings/connectivity", AdminSettings.class);
|
||||
JsonNode connectivity = adminSettings.getJsonValue();
|
||||
ObjectNode config = JacksonUtil.newObjectNode();
|
||||
|
||||
((ObjectNode) connectivity.get("http")).put("port", 80);
|
||||
((ObjectNode) connectivity.get("https")).put("enabled", true);
|
||||
((ObjectNode) connectivity.get("mqtt")).put("enabled", false);
|
||||
((ObjectNode) connectivity.get("mqtts")).put("enabled", false);
|
||||
((ObjectNode) connectivity.get("coaps")).put("enabled", false);
|
||||
((ObjectNode) connectivity.get("coap")).put("enabled", false);
|
||||
doPost("/api/admin/settings", adminSettings);
|
||||
ObjectNode http = JacksonUtil.newObjectNode();
|
||||
http.put("enabled", true);
|
||||
http.put("host", "");
|
||||
http.put("port", 80);
|
||||
config.set("http", http);
|
||||
|
||||
ObjectNode https = JacksonUtil.newObjectNode();
|
||||
https.put("enabled", true);
|
||||
https.put("host", "");
|
||||
https.put("port", 443);
|
||||
config.set("https", https);
|
||||
|
||||
ObjectNode mqtt = JacksonUtil.newObjectNode();
|
||||
mqtt.put("enabled", false);
|
||||
mqtt.put("host", "");
|
||||
mqtt.put("port", 1883);
|
||||
config.set("mqtt", mqtt);
|
||||
|
||||
ObjectNode mqtts = JacksonUtil.newObjectNode();
|
||||
mqtts.put("enabled", false);
|
||||
mqtts.put("host", "");
|
||||
mqtts.put("port", 8883);
|
||||
config.set("mqtts", mqtts);
|
||||
|
||||
ObjectNode coap = JacksonUtil.newObjectNode();
|
||||
coap.put("enabled", false);
|
||||
coap.put("host", "");
|
||||
coap.put("port", 5683);
|
||||
config.set("coap", coap);
|
||||
|
||||
ObjectNode coaps = JacksonUtil.newObjectNode();
|
||||
coaps.put("enabled", false);
|
||||
coaps.put("host", "");
|
||||
coaps.put("port", 5684);
|
||||
config.set("coaps", coaps);
|
||||
|
||||
AdminSettings adminSettings = doGet("/api/admin/settings/connectivity", AdminSettings.class);
|
||||
adminSettings.setJsonValue(config);
|
||||
doPost("/api/admin/settings", adminSettings).andExpect(status().isOk());
|
||||
|
||||
Tenant tenant = new Tenant();
|
||||
tenant.setTitle("My tenant");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user