From ce59287d84ec08cec676859fa6c6e383ccd12a94 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Sat, 21 Dec 2024 12:43:59 +0200 Subject: [PATCH] Fixed TenantClienTest --- .../org/thingsboard/server/controller/BaseController.java | 4 ---- .../org/thingsboard/server/controller/EdgeController.java | 7 ------- .../server/service/edge/rpc/EdgeGrpcSession.java | 2 +- .../org/thingsboard/server/msa/edge/TenantClientTest.java | 7 ++++--- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/BaseController.java b/application/src/main/java/org/thingsboard/server/controller/BaseController.java index ff5855e92a..41b23a8d33 100644 --- a/application/src/main/java/org/thingsboard/server/controller/BaseController.java +++ b/application/src/main/java/org/thingsboard/server/controller/BaseController.java @@ -362,10 +362,6 @@ public abstract class BaseController { @Getter protected boolean edgesEnabled; - @Value("${queue.type}") - @Getter - protected String queueType; - @ExceptionHandler(Exception.class) public void handleControllerException(Exception e, HttpServletResponse response) { ThingsboardException thingsboardException = handleException(e); diff --git a/application/src/main/java/org/thingsboard/server/controller/EdgeController.java b/application/src/main/java/org/thingsboard/server/controller/EdgeController.java index 1b91ae96ed..b1eabc32e4 100644 --- a/application/src/main/java/org/thingsboard/server/controller/EdgeController.java +++ b/application/src/main/java/org/thingsboard/server/controller/EdgeController.java @@ -579,10 +579,6 @@ public PageData getCloudEvents( @RequestParam(required = false) String sortOrder, @RequestParam(required = false) Long startTime, @RequestParam(required = false) Long endTime) throws ThingsboardException { - if (queueType.equals("kafka")) { - throw new UnsupportedOperationException("getCloudEvents not supported for queue type - kafka"); - } - try { TenantId tenantId = getCurrentUser().getTenantId(); TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime); @@ -602,9 +598,6 @@ public PageData getTimeseriesCloudEvents( @RequestParam(required = false) String sortOrder, @RequestParam(required = false) Long startTime, @RequestParam(required = false) Long endTime) throws ThingsboardException { - if (queueType.equals("kafka")) { - throw new UnsupportedOperationException("getTimeseriesCloudEvents not supported for queue type - kafka"); - } try { TenantId tenantId = getCurrentUser().getTenantId(); TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index 262fa086dc..4782464c48 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -114,7 +114,7 @@ public abstract class EdgeGrpcSession implements Closeable { private static final String QUEUE_START_SEQ_ID_ATTR_KEY = "queueStartSeqId"; private static final int MAX_DOWNLINK_ATTEMPTS = 3; - private static final String RATE_LIMIT_REACHED = "Rate limit reached"; + public static final String RATE_LIMIT_REACHED = "Rate limit reached"; protected static final ConcurrentLinkedQueue highPriorityQueue = new ConcurrentLinkedQueue<>(); diff --git a/msa/edge-black-box-tests/src/test/java/org/thingsboard/server/msa/edge/TenantClientTest.java b/msa/edge-black-box-tests/src/test/java/org/thingsboard/server/msa/edge/TenantClientTest.java index 44dd4c5611..5150bc432a 100644 --- a/msa/edge-black-box-tests/src/test/java/org/thingsboard/server/msa/edge/TenantClientTest.java +++ b/msa/edge-black-box-tests/src/test/java/org/thingsboard/server/msa/edge/TenantClientTest.java @@ -41,20 +41,21 @@ private void _testUpdateTenant() { String originalCountry = tenant.getCountry(); // update tenant - tenant.setCountry("Edge Update country: Ukraine"); + String updatedCountry = "Edge Update country: Ukraine"; + tenant.setCountry(updatedCountry); cloudRestClient.saveTenant(tenant); Awaitility.await() .pollInterval(500, TimeUnit.MILLISECONDS) .atMost(30, TimeUnit.SECONDS) - .until(() -> "Edge Update country: Ukraine".equals(edgeRestClient.getTenantById(tenant.getId()).get().getCountry())); + .until(() -> updatedCountry.equals(edgeRestClient.getTenantById(tenant.getId()).get().getCountry())); // create new tenant profile TenantProfile tenantProfile = new TenantProfile(); tenantProfile.setName("New Tenant Profile"); TenantProfile saveTenantProfile = cloudRestClient.saveTenantProfile(tenantProfile); - TenantProfileId originalTenantProfileId = edgeRestClient.getTenantProfileById(tenant.getTenantProfileId()).get().getId(); + TenantProfileId originalTenantProfileId = new TenantProfileId(tenant.getTenantProfileId().getId()); // update tenant with new tenant profile tenant.setTenantProfileId(saveTenantProfile.getId());