Browse Source

test improvements

pull/14206/head
dashevchenko 11 months ago
parent
commit
5b479e7298
  1. 6
      dao/src/test/java/org/thingsboard/server/dao/service/AssetServiceTest.java
  2. 6
      dao/src/test/java/org/thingsboard/server/dao/service/DeviceServiceTest.java

6
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

6
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

Loading…
Cancel
Save