diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/AssetServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/AssetServiceTest.java index 9ad8b42c21..b7f208b8c7 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/AssetServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/AssetServiceTest.java @@ -70,6 +70,7 @@ import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; @@ -134,7 +135,7 @@ public class AssetServiceTest extends AbstractServiceTest { } @Test - public void testAssetLimitOnTenantProfileLevel() { + public void testAssetLimitOnTenantProfileLevel() throws InterruptedException { TenantProfile tenantProfile = new TenantProfile(); tenantProfile.setName("Test profile"); tenantProfile.setDescription("Test"); @@ -161,6 +162,9 @@ public class AssetServiceTest extends AbstractServiceTest { long countByTenantId = assetService.countByTenantId(anotherTenantId); return countByTenantId == 5; }); + + Thread.sleep(2000); + assertThat(assetService.countByTenantId(anotherTenantId)).isEqualTo(5); } @Test diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/DeviceServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/DeviceServiceTest.java index 16bd851641..1ad1ec082a 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/DeviceServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/DeviceServiceTest.java @@ -83,6 +83,7 @@ import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; import static org.thingsboard.server.common.data.ota.OtaPackageType.FIRMWARE; @@ -156,7 +157,7 @@ public class DeviceServiceTest extends AbstractServiceTest { } @Test - public void testDeviceLimitOnTenantProfileLevel() { + public void testDeviceLimitOnTenantProfileLevel() throws InterruptedException { TenantProfile defaultTenantProfile = tenantProfileService.findDefaultTenantProfile(tenantId); defaultTenantProfile.getProfileData().setConfiguration(DefaultTenantProfileConfiguration.builder().maxDevices(5l).build()); tenantProfileService.saveTenantProfile(tenantId, defaultTenantProfile); @@ -175,6 +176,9 @@ public class DeviceServiceTest extends AbstractServiceTest { long countByTenantId = deviceService.countByTenantId(tenantId); return countByTenantId == 5; }); + + Thread.sleep(2000); + assertThat(deviceService.countByTenantId(tenantId)).isEqualTo(5); } @Test