From ae0c5e87c4522c0cf818f8fe0e57f35f512ece8c Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Wed, 31 Jan 2024 16:01:33 +0200 Subject: [PATCH] Fix Edge tests --- .../service/entitiy/tenant/DefaultTbTenantService.java | 2 -- .../org/thingsboard/server/msa/edge/AlarmClientTest.java | 9 ++++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/entitiy/tenant/DefaultTbTenantService.java b/application/src/main/java/org/thingsboard/server/service/entitiy/tenant/DefaultTbTenantService.java index 33789537b9..99896ae2da 100644 --- a/application/src/main/java/org/thingsboard/server/service/entitiy/tenant/DefaultTbTenantService.java +++ b/application/src/main/java/org/thingsboard/server/service/entitiy/tenant/DefaultTbTenantService.java @@ -51,13 +51,11 @@ public Tenant save(Tenant tenant) throws Exception { Tenant oldTenant = !created ? tenantService.findTenantById(tenant.getId()) : null; Tenant savedTenant = checkNotNull(tenantService.saveTenant(tenant)); - /* edge: DefaultRuleChains and DefaultEdgeRuleChains are configured on Cloud if (created) { installScripts.createDefaultRuleChains(savedTenant.getId()); installScripts.createDefaultEdgeRuleChains(savedTenant.getId()); installScripts.createDefaultTenantDashboards(savedTenant.getId(), null); } - */ tenantProfileCache.evict(savedTenant.getId()); notificationEntityService.notifyCreateOrUpdateTenant(savedTenant, created ? ComponentLifecycleEvent.CREATED : ComponentLifecycleEvent.UPDATED); diff --git a/msa/edge-black-box-tests/src/test/java/org/thingsboard/server/msa/edge/AlarmClientTest.java b/msa/edge-black-box-tests/src/test/java/org/thingsboard/server/msa/edge/AlarmClientTest.java index 686143ca81..89a25aeefe 100644 --- a/msa/edge-black-box-tests/src/test/java/org/thingsboard/server/msa/edge/AlarmClientTest.java +++ b/msa/edge-black-box-tests/src/test/java/org/thingsboard/server/msa/edge/AlarmClientTest.java @@ -19,7 +19,6 @@ import lombok.extern.slf4j.Slf4j; import org.awaitility.Awaitility; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.springframework.http.ResponseEntity; import org.thingsboard.common.util.JacksonUtil; @@ -56,8 +55,8 @@ public void testAlarms() throws Exception { JsonObject telemetry = new JsonObject(); telemetry.addProperty("temperature", 100); - ResponseEntity deviceTelemetryResponse = edgeRestClient.getRestTemplate() - .postForEntity(edgeUrl + "/api/v1/{credentialsId}/telemetry", + ResponseEntity deviceTelemetryResponse = cloudRestClient.getRestTemplate() + .postForEntity(tbUrl + "/api/v1/{credentialsId}/telemetry", JacksonUtil.OBJECT_MAPPER.readTree(telemetry.toString()), ResponseEntity.class, accessToken); @@ -132,8 +131,8 @@ public void sendAlarmToCloud() { JsonObject telemetry = new JsonObject(); telemetry.addProperty("temperature", 100); - ResponseEntity deviceTelemetryResponse = edgeRestClient.getRestTemplate() - .postForEntity(edgeUrl + "/api/v1/" + accessToken + "/telemetry", + ResponseEntity deviceTelemetryResponse = cloudRestClient.getRestTemplate() + .postForEntity(tbUrl + "/api/v1/" + accessToken + "/telemetry", JacksonUtil.toJsonNode(telemetry.toString()), ResponseEntity.class); Assert.assertTrue(deviceTelemetryResponse.getStatusCode().is2xxSuccessful());