Skip to content

Commit

Permalink
Fixed TenantClienTest
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-babak committed Dec 21, 2024
1 parent c003b9e commit ce59287
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,6 @@ public PageData<CloudEvent> 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);
Expand All @@ -602,9 +598,6 @@ public PageData<CloudEvent> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<EdgeEvent> highPriorityQueue = new ConcurrentLinkedQueue<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit ce59287

Please sign in to comment.