Search in sources :

Example 6 with ApiUsageState

use of org.thingsboard.server.common.data.ApiUsageState in project thingsboard by thingsboard.

the class BaseApiUsageStateServiceTest method testFindApiUsageStateByTenantId.

@Test
public void testFindApiUsageStateByTenantId() {
    ApiUsageState apiUsageState = apiUsageStateService.findTenantApiUsageState(tenantId);
    Assert.assertNotNull(apiUsageState);
}
Also used : ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) Test(org.junit.Test)

Example 7 with ApiUsageState

use of org.thingsboard.server.common.data.ApiUsageState in project thingsboard by thingsboard.

the class BaseApiUsageStateServiceTest method testUpdateApiUsageState.

@Test
public void testUpdateApiUsageState() {
    ApiUsageState apiUsageState = apiUsageStateService.findTenantApiUsageState(tenantId);
    Assert.assertNotNull(apiUsageState);
    Assert.assertTrue(apiUsageState.isTransportEnabled());
    apiUsageState.setTransportState(ApiUsageStateValue.DISABLED);
    apiUsageState = apiUsageStateService.update(apiUsageState);
    Assert.assertNotNull(apiUsageState);
    apiUsageState = apiUsageStateService.findTenantApiUsageState(tenantId);
    Assert.assertNotNull(apiUsageState);
    Assert.assertFalse(apiUsageState.isTransportEnabled());
}
Also used : ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) Test(org.junit.Test)

Example 8 with ApiUsageState

use of org.thingsboard.server.common.data.ApiUsageState in project thingsboard by thingsboard.

the class DefaultTransportService method processToTransportMsg.

protected void processToTransportMsg(TransportProtos.ToTransportMsg toSessionMsg) {
    UUID sessionId = new UUID(toSessionMsg.getSessionIdMSB(), toSessionMsg.getSessionIdLSB());
    SessionMetaData md = sessions.get(sessionId);
    if (md != null) {
        log.trace("[{}] Processing notification: {}", sessionId, toSessionMsg);
        SessionMsgListener listener = md.getListener();
        transportCallbackExecutor.submit(() -> {
            if (toSessionMsg.hasGetAttributesResponse()) {
                listener.onGetAttributesResponse(toSessionMsg.getGetAttributesResponse());
            }
            if (toSessionMsg.hasAttributeUpdateNotification()) {
                listener.onAttributeUpdate(sessionId, toSessionMsg.getAttributeUpdateNotification());
            }
            if (toSessionMsg.hasSessionCloseNotification()) {
                listener.onRemoteSessionCloseCommand(sessionId, toSessionMsg.getSessionCloseNotification());
            }
            if (toSessionMsg.hasToTransportUpdateCredentialsNotification()) {
                listener.onToTransportUpdateCredentials(toSessionMsg.getToTransportUpdateCredentialsNotification());
            }
            if (toSessionMsg.hasToDeviceRequest()) {
                listener.onToDeviceRpcRequest(sessionId, toSessionMsg.getToDeviceRequest());
            }
            if (toSessionMsg.hasToServerResponse()) {
                String requestId = sessionId + "-" + toSessionMsg.getToServerResponse().getRequestId();
                toServerRpcPendingMap.remove(requestId);
                listener.onToServerRpcResponse(toSessionMsg.getToServerResponse());
            }
        });
        if (md.getSessionType() == TransportProtos.SessionType.SYNC) {
            deregisterSession(md.getSessionInfo());
        }
    } else {
        log.trace("Processing broadcast notification: {}", toSessionMsg);
        if (toSessionMsg.hasEntityUpdateMsg()) {
            TransportProtos.EntityUpdateMsg msg = toSessionMsg.getEntityUpdateMsg();
            EntityType entityType = EntityType.valueOf(msg.getEntityType());
            if (EntityType.DEVICE_PROFILE.equals(entityType)) {
                DeviceProfile deviceProfile = deviceProfileCache.put(msg.getData());
                if (deviceProfile != null) {
                    log.info("On device profile update: {}", deviceProfile);
                    onProfileUpdate(deviceProfile);
                }
            } else if (EntityType.TENANT_PROFILE.equals(entityType)) {
                rateLimitService.update(tenantProfileCache.put(msg.getData()));
            } else if (EntityType.TENANT.equals(entityType)) {
                Optional<Tenant> profileOpt = dataDecodingEncodingService.decode(msg.getData().toByteArray());
                if (profileOpt.isPresent()) {
                    Tenant tenant = profileOpt.get();
                    boolean updated = tenantProfileCache.put(tenant.getId(), tenant.getTenantProfileId());
                    if (updated) {
                        rateLimitService.update(tenant.getId());
                    }
                }
            } else if (EntityType.API_USAGE_STATE.equals(entityType)) {
                Optional<ApiUsageState> stateOpt = dataDecodingEncodingService.decode(msg.getData().toByteArray());
                if (stateOpt.isPresent()) {
                    ApiUsageState apiUsageState = stateOpt.get();
                    rateLimitService.update(apiUsageState.getTenantId(), apiUsageState.isTransportEnabled());
                // TODO: if transport is disabled, we should close all sessions and not to check credentials.
                }
            } else if (EntityType.DEVICE.equals(entityType)) {
                Optional<Device> deviceOpt = dataDecodingEncodingService.decode(msg.getData().toByteArray());
                deviceOpt.ifPresent(device -> {
                    onDeviceUpdate(device);
                    eventPublisher.publishEvent(new DeviceUpdatedEvent(device));
                });
            }
        } else if (toSessionMsg.hasEntityDeleteMsg()) {
            TransportProtos.EntityDeleteMsg msg = toSessionMsg.getEntityDeleteMsg();
            EntityType entityType = EntityType.valueOf(msg.getEntityType());
            UUID entityUuid = new UUID(msg.getEntityIdMSB(), msg.getEntityIdLSB());
            if (EntityType.DEVICE_PROFILE.equals(entityType)) {
                deviceProfileCache.evict(new DeviceProfileId(new UUID(msg.getEntityIdMSB(), msg.getEntityIdLSB())));
            } else if (EntityType.TENANT_PROFILE.equals(entityType)) {
                tenantProfileCache.remove(new TenantProfileId(entityUuid));
            } else if (EntityType.TENANT.equals(entityType)) {
                rateLimitService.remove(TenantId.fromUUID(entityUuid));
            } else if (EntityType.DEVICE.equals(entityType)) {
                rateLimitService.remove(new DeviceId(entityUuid));
                onDeviceDeleted(new DeviceId(entityUuid));
            }
        } else if (toSessionMsg.hasResourceUpdateMsg()) {
            TransportProtos.ResourceUpdateMsg msg = toSessionMsg.getResourceUpdateMsg();
            TenantId tenantId = TenantId.fromUUID(new UUID(msg.getTenantIdMSB(), msg.getTenantIdLSB()));
            ResourceType resourceType = ResourceType.valueOf(msg.getResourceType());
            String resourceId = msg.getResourceKey();
            transportResourceCache.update(tenantId, resourceType, resourceId);
            sessions.forEach((id, mdRez) -> {
                log.trace("ResourceUpdate - [{}] [{}]", id, mdRez);
                transportCallbackExecutor.submit(() -> mdRez.getListener().onResourceUpdate(msg));
            });
        } else if (toSessionMsg.hasResourceDeleteMsg()) {
            TransportProtos.ResourceDeleteMsg msg = toSessionMsg.getResourceDeleteMsg();
            TenantId tenantId = TenantId.fromUUID(new UUID(msg.getTenantIdMSB(), msg.getTenantIdLSB()));
            ResourceType resourceType = ResourceType.valueOf(msg.getResourceType());
            String resourceId = msg.getResourceKey();
            transportResourceCache.evict(tenantId, resourceType, resourceId);
            sessions.forEach((id, mdRez) -> {
                log.warn("ResourceDelete - [{}] [{}]", id, mdRez);
                transportCallbackExecutor.submit(() -> mdRez.getListener().onResourceDelete(msg));
            });
        } else {
            // TODO: should we notify the device actor about missed session?
            log.debug("[{}] Missing session.", sessionId);
        }
    }
}
Also used : TbTransportComponent(org.thingsboard.server.queue.util.TbTransportComponent) RpcStatus(org.thingsboard.server.common.data.rpc.RpcStatus) TenantId(org.thingsboard.server.common.data.id.TenantId) GetOrCreateDeviceFromGatewayResponse(org.thingsboard.server.common.transport.auth.GetOrCreateDeviceFromGatewayResponse) Map(java.util.Map) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) DeviceTransportType(org.thingsboard.server.common.data.DeviceTransportType) TransportToDeviceActorMsg(org.thingsboard.server.gen.transport.TransportProtos.TransportToDeviceActorMsg) DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) StringUtils(org.thingsboard.server.common.data.StringUtils) Set(java.util.Set) Executors(java.util.concurrent.Executors) AsyncCallbackTemplate(org.thingsboard.server.queue.common.AsyncCallbackTemplate) Slf4j(lombok.extern.slf4j.Slf4j) TransportProtos(org.thingsboard.server.gen.transport.TransportProtos) ProvisionDeviceResponseMsg(org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceResponseMsg) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) TbQueueConsumer(org.thingsboard.server.queue.TbQueueConsumer) TopicPartitionInfo(org.thingsboard.server.common.msg.queue.TopicPartitionInfo) TransportApiResponseMsg(org.thingsboard.server.gen.transport.TransportProtos.TransportApiResponseMsg) TbMsg(org.thingsboard.server.common.msg.TbMsg) TransportServiceCallback(org.thingsboard.server.common.transport.TransportServiceCallback) Device(org.thingsboard.server.common.data.Device) TransportTenantProfileCache(org.thingsboard.server.common.transport.TransportTenantProfileCache) Scheduled(org.springframework.scheduling.annotation.Scheduled) DataDecodingEncodingService(org.thingsboard.server.common.transport.util.DataDecodingEncodingService) Value(org.springframework.beans.factory.annotation.Value) LinkedHashMap(java.util.LinkedHashMap) SessionMsgListener(org.thingsboard.server.common.transport.SessionMsgListener) Service(org.springframework.stereotype.Service) ToCoreMsg(org.thingsboard.server.gen.transport.TransportProtos.ToCoreMsg) TbApiUsageClient(org.thingsboard.server.queue.usagestats.TbApiUsageClient) AfterStartUp(org.thingsboard.server.queue.util.AfterStartUp) ExecutionException(java.util.concurrent.ExecutionException) ToTransportMsg(org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg) Futures(com.google.common.util.concurrent.Futures) DeviceUpdatedEvent(org.thingsboard.server.common.transport.DeviceUpdatedEvent) PowerMode(org.thingsboard.server.common.data.device.data.PowerMode) TenantProfileId(org.thingsboard.server.common.data.id.TenantProfileId) ResourceType(org.thingsboard.server.common.data.ResourceType) TbQueueMsgMetadata(org.thingsboard.server.queue.TbQueueMsgMetadata) JsonUtils(org.thingsboard.server.common.transport.util.JsonUtils) JsonObject(com.google.gson.JsonObject) TransportResourceCache(org.thingsboard.server.common.transport.TransportResourceCache) ScheduledFuture(java.util.concurrent.ScheduledFuture) ApiUsageRecordKey(org.thingsboard.server.common.data.ApiUsageRecordKey) TbQueueRequestTemplate(org.thingsboard.server.queue.TbQueueRequestTemplate) DeviceProfileId(org.thingsboard.server.common.data.id.DeviceProfileId) Random(java.util.Random) StatsFactory(org.thingsboard.server.common.stats.StatsFactory) TbMsgMetaData(org.thingsboard.server.common.msg.TbMsgMetaData) PreDestroy(javax.annotation.PreDestroy) SessionMsgType(org.thingsboard.server.common.msg.session.SessionMsgType) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Gson(com.google.gson.Gson) TransportRateLimitService(org.thingsboard.server.common.transport.limits.TransportRateLimitService) EntityType(org.thingsboard.server.common.data.EntityType) TbServiceInfoProvider(org.thingsboard.server.queue.discovery.TbServiceInfoProvider) TbTransportQueueFactory(org.thingsboard.server.queue.provider.TbTransportQueueFactory) TbQueueCallback(org.thingsboard.server.queue.TbQueueCallback) TbQueueProducer(org.thingsboard.server.queue.TbQueueProducer) TransportDeviceInfo(org.thingsboard.server.common.transport.auth.TransportDeviceInfo) DeviceId(org.thingsboard.server.common.data.id.DeviceId) ProvisionDeviceRequestMsg(org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceRequestMsg) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) TransportApiRequestMsg(org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg) ThingsBoardThreadFactory(org.thingsboard.common.util.ThingsBoardThreadFactory) UUID(java.util.UUID) TransportDeviceProfileCache(org.thingsboard.server.common.transport.TransportDeviceProfileCache) TransportService(org.thingsboard.server.common.transport.TransportService) Collectors(java.util.stream.Collectors) TbQueueProducerProvider(org.thingsboard.server.queue.provider.TbQueueProducerProvider) ByteString(com.google.protobuf.ByteString) List(java.util.List) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ValidateDeviceCredentialsResponse(org.thingsboard.server.common.transport.auth.ValidateDeviceCredentialsResponse) CustomerId(org.thingsboard.server.common.data.id.CustomerId) PartitionService(org.thingsboard.server.queue.discovery.PartitionService) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) TbRateLimitsException(org.thingsboard.server.common.msg.tools.TbRateLimitsException) Tenant(org.thingsboard.server.common.data.Tenant) ConcurrentMap(java.util.concurrent.ConcurrentMap) HashSet(java.util.HashSet) ServiceType(org.thingsboard.server.common.msg.queue.ServiceType) EntityId(org.thingsboard.server.common.data.id.EntityId) SchedulerComponent(org.thingsboard.server.queue.scheduler.SchedulerComponent) ExecutorService(java.util.concurrent.ExecutorService) ThingsBoardExecutors(org.thingsboard.common.util.ThingsBoardExecutors) StatsType(org.thingsboard.server.common.stats.StatsType) MessagesStats(org.thingsboard.server.common.stats.MessagesStats) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) TimeUnit(java.util.concurrent.TimeUnit) ServiceQueue(org.thingsboard.server.common.msg.queue.ServiceQueue) ToRuleEngineMsg(org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg) TbProtoQueueMsg(org.thingsboard.server.queue.common.TbProtoQueueMsg) Collections(java.util.Collections) DeviceId(org.thingsboard.server.common.data.id.DeviceId) ByteString(com.google.protobuf.ByteString) DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) DeviceUpdatedEvent(org.thingsboard.server.common.transport.DeviceUpdatedEvent) SessionMsgListener(org.thingsboard.server.common.transport.SessionMsgListener) Tenant(org.thingsboard.server.common.data.Tenant) TenantProfileId(org.thingsboard.server.common.data.id.TenantProfileId) UUID(java.util.UUID) Optional(java.util.Optional) Device(org.thingsboard.server.common.data.Device) TransportProtos(org.thingsboard.server.gen.transport.TransportProtos) ResourceType(org.thingsboard.server.common.data.ResourceType) EntityType(org.thingsboard.server.common.data.EntityType) TenantId(org.thingsboard.server.common.data.id.TenantId) DeviceProfileId(org.thingsboard.server.common.data.id.DeviceProfileId) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState)

Example 9 with ApiUsageState

use of org.thingsboard.server.common.data.ApiUsageState in project thingsboard by thingsboard.

the class DefaultTransportTenantProfileCache method getTenantProfile.

private TenantProfile getTenantProfile(TenantId tenantId) {
    TenantProfile profile = null;
    TenantProfileId tenantProfileId = tenantIds.get(tenantId);
    if (tenantProfileId != null) {
        profile = profiles.get(tenantProfileId);
    }
    if (profile == null) {
        tenantProfileFetchLock.lock();
        try {
            tenantProfileId = tenantIds.get(tenantId);
            if (tenantProfileId != null) {
                profile = profiles.get(tenantProfileId);
            }
            if (profile == null) {
                TransportProtos.GetEntityProfileRequestMsg msg = TransportProtos.GetEntityProfileRequestMsg.newBuilder().setEntityType(EntityType.TENANT.name()).setEntityIdMSB(tenantId.getId().getMostSignificantBits()).setEntityIdLSB(tenantId.getId().getLeastSignificantBits()).build();
                TransportProtos.GetEntityProfileResponseMsg entityProfileMsg = transportService.getEntityProfile(msg);
                Optional<TenantProfile> profileOpt = dataDecodingEncodingService.decode(entityProfileMsg.getData().toByteArray());
                if (profileOpt.isPresent()) {
                    profile = profileOpt.get();
                    TenantProfile existingProfile = profiles.get(profile.getId());
                    if (existingProfile != null) {
                        profile = existingProfile;
                    } else {
                        profiles.put(profile.getId(), profile);
                    }
                    tenantProfileIds.computeIfAbsent(profile.getId(), id -> ConcurrentHashMap.newKeySet()).add(tenantId);
                    tenantIds.put(tenantId, profile.getId());
                } else {
                    log.warn("[{}] Can't decode tenant profile: {}", tenantId, entityProfileMsg.getData());
                    throw new RuntimeException("Can't decode tenant profile!");
                }
                Optional<ApiUsageState> apiStateOpt = dataDecodingEncodingService.decode(entityProfileMsg.getApiState().toByteArray());
                apiStateOpt.ifPresent(apiUsageState -> rateLimitService.update(tenantId, apiUsageState.isTransportEnabled()));
            }
        } finally {
            tenantProfileFetchLock.unlock();
        }
    }
    return profile;
}
Also used : TbTransportComponent(org.thingsboard.server.queue.util.TbTransportComponent) ReentrantLock(java.util.concurrent.locks.ReentrantLock) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Autowired(org.springframework.beans.factory.annotation.Autowired) TransportTenantProfileCache(org.thingsboard.server.common.transport.TransportTenantProfileCache) Set(java.util.Set) TransportService(org.thingsboard.server.common.transport.TransportService) TenantId(org.thingsboard.server.common.data.id.TenantId) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) DataDecodingEncodingService(org.thingsboard.server.common.transport.util.DataDecodingEncodingService) ConcurrentMap(java.util.concurrent.ConcurrentMap) ByteString(com.google.protobuf.ByteString) Slf4j(lombok.extern.slf4j.Slf4j) Component(org.springframework.stereotype.Component) Lock(java.util.concurrent.locks.Lock) TenantProfile(org.thingsboard.server.common.data.TenantProfile) TenantProfileId(org.thingsboard.server.common.data.id.TenantProfileId) TransportRateLimitService(org.thingsboard.server.common.transport.limits.TransportRateLimitService) EntityType(org.thingsboard.server.common.data.EntityType) TransportProtos(org.thingsboard.server.gen.transport.TransportProtos) Optional(java.util.Optional) Lazy(org.springframework.context.annotation.Lazy) TenantProfileUpdateResult(org.thingsboard.server.common.transport.profile.TenantProfileUpdateResult) Collections(java.util.Collections) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) TenantProfileId(org.thingsboard.server.common.data.id.TenantProfileId) TransportProtos(org.thingsboard.server.gen.transport.TransportProtos) TenantProfile(org.thingsboard.server.common.data.TenantProfile)

Example 10 with ApiUsageState

use of org.thingsboard.server.common.data.ApiUsageState in project thingsboard by thingsboard.

the class ApiUsageStateServiceImpl method createDefaultApiUsageState.

@Override
public ApiUsageState createDefaultApiUsageState(TenantId tenantId, EntityId entityId) {
    entityId = Objects.requireNonNullElse(entityId, tenantId);
    log.trace("Executing createDefaultUsageRecord [{}]", entityId);
    validateId(tenantId, INCORRECT_TENANT_ID + tenantId);
    ApiUsageState apiUsageState = new ApiUsageState();
    apiUsageState.setTenantId(tenantId);
    apiUsageState.setEntityId(entityId);
    apiUsageState.setTransportState(ApiUsageStateValue.ENABLED);
    apiUsageState.setReExecState(ApiUsageStateValue.ENABLED);
    apiUsageState.setJsExecState(ApiUsageStateValue.ENABLED);
    apiUsageState.setDbStorageState(ApiUsageStateValue.ENABLED);
    apiUsageState.setSmsExecState(ApiUsageStateValue.ENABLED);
    apiUsageState.setEmailExecState(ApiUsageStateValue.ENABLED);
    apiUsageState.setAlarmExecState(ApiUsageStateValue.ENABLED);
    apiUsageStateValidator.validate(apiUsageState, ApiUsageState::getTenantId);
    ApiUsageState saved = apiUsageStateDao.save(apiUsageState.getTenantId(), apiUsageState);
    List<TsKvEntry> apiUsageStates = new ArrayList<>();
    apiUsageStates.add(new BasicTsKvEntry(saved.getCreatedTime(), new StringDataEntry(ApiFeature.TRANSPORT.getApiStateKey(), ApiUsageStateValue.ENABLED.name())));
    apiUsageStates.add(new BasicTsKvEntry(saved.getCreatedTime(), new StringDataEntry(ApiFeature.DB.getApiStateKey(), ApiUsageStateValue.ENABLED.name())));
    apiUsageStates.add(new BasicTsKvEntry(saved.getCreatedTime(), new StringDataEntry(ApiFeature.RE.getApiStateKey(), ApiUsageStateValue.ENABLED.name())));
    apiUsageStates.add(new BasicTsKvEntry(saved.getCreatedTime(), new StringDataEntry(ApiFeature.JS.getApiStateKey(), ApiUsageStateValue.ENABLED.name())));
    apiUsageStates.add(new BasicTsKvEntry(saved.getCreatedTime(), new StringDataEntry(ApiFeature.EMAIL.getApiStateKey(), ApiUsageStateValue.ENABLED.name())));
    apiUsageStates.add(new BasicTsKvEntry(saved.getCreatedTime(), new StringDataEntry(ApiFeature.SMS.getApiStateKey(), ApiUsageStateValue.ENABLED.name())));
    apiUsageStates.add(new BasicTsKvEntry(saved.getCreatedTime(), new StringDataEntry(ApiFeature.ALARM.getApiStateKey(), ApiUsageStateValue.ENABLED.name())));
    tsService.save(tenantId, saved.getId(), apiUsageStates, 0L);
    if (entityId.getEntityType() == EntityType.TENANT && !entityId.equals(TenantId.SYS_TENANT_ID)) {
        tenantId = (TenantId) entityId;
        Tenant tenant = tenantDao.findById(tenantId, tenantId.getId());
        TenantProfile tenantProfile = tenantProfileDao.findById(tenantId, tenant.getTenantProfileId().getId());
        TenantProfileConfiguration configuration = tenantProfile.getProfileData().getConfiguration();
        List<TsKvEntry> profileThresholds = new ArrayList<>();
        for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) {
            profileThresholds.add(new BasicTsKvEntry(saved.getCreatedTime(), new LongDataEntry(key.getApiLimitKey(), configuration.getProfileThreshold(key))));
        }
        tsService.save(tenantId, saved.getId(), profileThresholds, 0L);
    }
    return saved;
}
Also used : BasicTsKvEntry(org.thingsboard.server.common.data.kv.BasicTsKvEntry) TsKvEntry(org.thingsboard.server.common.data.kv.TsKvEntry) Tenant(org.thingsboard.server.common.data.Tenant) TenantProfileConfiguration(org.thingsboard.server.common.data.tenant.profile.TenantProfileConfiguration) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) BasicTsKvEntry(org.thingsboard.server.common.data.kv.BasicTsKvEntry) StringDataEntry(org.thingsboard.server.common.data.kv.StringDataEntry) ArrayList(java.util.ArrayList) LongDataEntry(org.thingsboard.server.common.data.kv.LongDataEntry) TenantProfile(org.thingsboard.server.common.data.TenantProfile) ApiUsageRecordKey(org.thingsboard.server.common.data.ApiUsageRecordKey)

Aggregations

ApiUsageState (org.thingsboard.server.common.data.ApiUsageState)10 Test (org.junit.Test)3 ApiUsageRecordKey (org.thingsboard.server.common.data.ApiUsageRecordKey)3 EntityType (org.thingsboard.server.common.data.EntityType)3 TenantProfile (org.thingsboard.server.common.data.TenantProfile)3 TenantId (org.thingsboard.server.common.data.id.TenantId)3 ByteString (com.google.protobuf.ByteString)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 Optional (java.util.Optional)2 Set (java.util.Set)2 UUID (java.util.UUID)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 ExecutionException (java.util.concurrent.ExecutionException)2 Slf4j (lombok.extern.slf4j.Slf4j)2 Tenant (org.thingsboard.server.common.data.Tenant)2 RuleChainId (org.thingsboard.server.common.data.id.RuleChainId)2 TenantProfileId (org.thingsboard.server.common.data.id.TenantProfileId)2 BasicTsKvEntry (org.thingsboard.server.common.data.kv.BasicTsKvEntry)2