|
|
|
@ -15,6 +15,7 @@ |
|
|
|
*/ |
|
|
|
package org.thingsboard.server.service.cf.ctx.state; |
|
|
|
|
|
|
|
import io.micrometer.core.instrument.simple.SimpleMeterRegistry; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -38,6 +39,7 @@ import org.thingsboard.server.common.data.id.DeviceId; |
|
|
|
import org.thingsboard.server.common.data.id.TenantId; |
|
|
|
import org.thingsboard.server.common.data.kv.DoubleDataEntry; |
|
|
|
import org.thingsboard.server.common.data.kv.LongDataEntry; |
|
|
|
import org.thingsboard.server.common.stats.DefaultStatsFactory; |
|
|
|
import org.thingsboard.server.dao.usagerecord.ApiLimitService; |
|
|
|
import org.thingsboard.server.service.cf.CalculatedFieldResult; |
|
|
|
|
|
|
|
@ -51,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.mockito.ArgumentMatchers.any; |
|
|
|
import static org.mockito.Mockito.when; |
|
|
|
|
|
|
|
@SpringBootTest(classes = DefaultTbelInvokeService.class) |
|
|
|
@SpringBootTest(classes = {SimpleMeterRegistry.class, DefaultStatsFactory.class, DefaultTbelInvokeService.class}) |
|
|
|
public class ScriptCalculatedFieldStateTest { |
|
|
|
|
|
|
|
private final TenantId TENANT_ID = TenantId.fromUUID(UUID.fromString("5b18e321-3327-4290-b996-d72a65e90382")); |
|
|
|
@ -72,6 +74,9 @@ public class ScriptCalculatedFieldStateTest { |
|
|
|
@MockBean |
|
|
|
private ApiLimitService apiLimitService; |
|
|
|
|
|
|
|
// @MockBean
|
|
|
|
// private MeterRegistry meterRegistry;
|
|
|
|
|
|
|
|
@BeforeEach |
|
|
|
void setUp() { |
|
|
|
when(apiLimitService.getLimit(any(), any())).thenReturn(1000L); |
|
|
|
|