Fix EDQS tests init

This commit is contained in:
ViacheslavKlimov 2025-04-09 12:43:35 +03:00
parent e967a99430
commit a91d9faad9
2 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,7 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.query.EntityCountQuery;
import org.thingsboard.server.common.data.query.EntityDataQuery;
import org.thingsboard.server.edqs.stats.DefaultEdqsStatsService;
import org.thingsboard.server.common.stats.EdqsStatsService;
import org.thingsboard.server.queue.edqs.EdqsComponent;
import java.util.concurrent.ConcurrentHashMap;
@ -41,7 +41,7 @@ import java.util.function.Predicate;
public class DefaultEdqsRepository implements EdqsRepository {
private final static ConcurrentMap<TenantId, TenantRepo> repos = new ConcurrentHashMap<>();
private final DefaultEdqsStatsService statsService;
private final EdqsStatsService statsService;
public TenantRepo get(TenantId tenantId) {
return repos.computeIfAbsent(tenantId, id -> new TenantRepo(id, statsService));

View File

@ -20,6 +20,7 @@ import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.TestExecutionListeners;
@ -58,6 +59,7 @@ import org.thingsboard.server.common.data.query.KeyFilter;
import org.thingsboard.server.common.data.query.StringFilterPredicate;
import org.thingsboard.server.common.data.relation.EntityRelation;
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
import org.thingsboard.server.common.stats.DummyEdqsStatsService;
import org.thingsboard.server.edqs.util.EdqsConverter;
import java.util.Collections;
@ -78,6 +80,8 @@ public abstract class AbstractEDQTest {
protected DefaultEdqsRepository repository;
@Autowired
protected EdqsConverter edqsConverter;
@MockBean
private DummyEdqsStatsService edqsStatsService;
protected final TenantId tenantId = TenantId.fromUUID(UUID.randomUUID());
protected final CustomerId customerId = new CustomerId(UUID.randomUUID());