|
|
@ -23,24 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.boot.test.mock.mockito.SpyBean; |
|
|
import org.springframework.boot.test.mock.mockito.SpyBean; |
|
|
import org.thingsboard.common.util.JacksonUtil; |
|
|
import org.thingsboard.common.util.JacksonUtil; |
|
|
import org.thingsboard.server.cache.TbTransactionalCache; |
|
|
import org.thingsboard.server.cache.TbTransactionalCache; |
|
|
import org.thingsboard.server.common.data.Customer; |
|
|
import org.thingsboard.server.common.data.*; |
|
|
import org.thingsboard.server.common.data.Dashboard; |
|
|
|
|
|
import org.thingsboard.server.common.data.DashboardInfo; |
|
|
|
|
|
import org.thingsboard.server.common.data.Device; |
|
|
|
|
|
import org.thingsboard.server.common.data.DeviceProfile; |
|
|
|
|
|
import org.thingsboard.server.common.data.DeviceProfileType; |
|
|
|
|
|
import org.thingsboard.server.common.data.DeviceTransportType; |
|
|
|
|
|
import org.thingsboard.server.common.data.EntityView; |
|
|
|
|
|
import org.thingsboard.server.common.data.OtaPackage; |
|
|
|
|
|
import org.thingsboard.server.common.data.OtaPackageInfo; |
|
|
|
|
|
import org.thingsboard.server.common.data.ResourceType; |
|
|
|
|
|
import org.thingsboard.server.common.data.StringUtils; |
|
|
|
|
|
import org.thingsboard.server.common.data.TbResource; |
|
|
|
|
|
import org.thingsboard.server.common.data.TbResourceInfo; |
|
|
|
|
|
import org.thingsboard.server.common.data.Tenant; |
|
|
|
|
|
import org.thingsboard.server.common.data.TenantInfo; |
|
|
|
|
|
import org.thingsboard.server.common.data.TenantProfile; |
|
|
|
|
|
import org.thingsboard.server.common.data.User; |
|
|
|
|
|
import org.thingsboard.server.common.data.asset.Asset; |
|
|
import org.thingsboard.server.common.data.asset.Asset; |
|
|
import org.thingsboard.server.common.data.device.profile.DeviceProfileData; |
|
|
import org.thingsboard.server.common.data.device.profile.DeviceProfileData; |
|
|
import org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration; |
|
|
import org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration; |
|
|
@ -54,8 +37,23 @@ import org.thingsboard.server.common.data.rule.RuleChain; |
|
|
import org.thingsboard.server.common.data.rule.RuleChainType; |
|
|
import org.thingsboard.server.common.data.rule.RuleChainType; |
|
|
import org.thingsboard.server.common.data.security.Authority; |
|
|
import org.thingsboard.server.common.data.security.Authority; |
|
|
import org.thingsboard.server.common.data.widget.WidgetsBundle; |
|
|
import org.thingsboard.server.common.data.widget.WidgetsBundle; |
|
|
|
|
|
import org.thingsboard.server.dao.asset.AssetService; |
|
|
|
|
|
import org.thingsboard.server.dao.customer.CustomerService; |
|
|
|
|
|
import org.thingsboard.server.dao.dashboard.DashboardService; |
|
|
|
|
|
import org.thingsboard.server.dao.device.DeviceProfileService; |
|
|
|
|
|
import org.thingsboard.server.dao.device.DeviceService; |
|
|
|
|
|
import org.thingsboard.server.dao.edge.EdgeService; |
|
|
|
|
|
import org.thingsboard.server.dao.entityview.EntityViewService; |
|
|
import org.thingsboard.server.dao.exception.DataValidationException; |
|
|
import org.thingsboard.server.dao.exception.DataValidationException; |
|
|
|
|
|
import org.thingsboard.server.dao.ota.OtaPackageService; |
|
|
|
|
|
import org.thingsboard.server.dao.resource.ResourceService; |
|
|
|
|
|
import org.thingsboard.server.dao.rpc.RpcService; |
|
|
|
|
|
import org.thingsboard.server.dao.rule.RuleChainService; |
|
|
import org.thingsboard.server.dao.tenant.TenantDao; |
|
|
import org.thingsboard.server.dao.tenant.TenantDao; |
|
|
|
|
|
import org.thingsboard.server.dao.tenant.TenantProfileService; |
|
|
|
|
|
import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; |
|
|
|
|
|
import org.thingsboard.server.dao.user.UserService; |
|
|
|
|
|
import org.thingsboard.server.dao.widget.WidgetsBundleService; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Collections; |
|
|
import java.util.Collections; |
|
|
@ -69,16 +67,45 @@ import static org.mockito.Mockito.verify; |
|
|
|
|
|
|
|
|
public abstract class BaseTenantServiceTest extends AbstractServiceTest { |
|
|
public abstract class BaseTenantServiceTest extends AbstractServiceTest { |
|
|
|
|
|
|
|
|
private IdComparator<Tenant> idComparator = new IdComparator<>(); |
|
|
|
|
|
|
|
|
|
|
|
@SpyBean |
|
|
@SpyBean |
|
|
protected TenantDao tenantDao; |
|
|
TenantDao tenantDao; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
protected TbTransactionalCache<TenantId, Tenant> cache; |
|
|
ApiUsageStateService apiUsageStateService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
AssetService assetService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
CustomerService customerService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
DashboardService dashboardService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
DeviceProfileService deviceProfileService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
DeviceService deviceService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
EdgeService edgeService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
EntityViewService entityViewService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
protected TbTransactionalCache<TenantId, Boolean> existsTenantCache; |
|
|
OtaPackageService otaPackageService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
ResourceService resourceService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
RpcService rpcService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
RuleChainService ruleChainService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
TbTransactionalCache<TenantId, Boolean> existsTenantCache; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
TbTransactionalCache<TenantId, Tenant> cache; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
TenantProfileService tenantProfileService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
UserService userService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
WidgetsBundleService widgetsBundleService; |
|
|
|
|
|
|
|
|
|
|
|
private final IdComparator<Tenant> idComparator = new IdComparator<>(); |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
public void testSaveTenant() { |
|
|
public void testSaveTenant() { |
|
|
|