| | |
| | | import com.battery.business.service.ITTestService; |
| | | import com.battery.business.service.ITestLiveService.LiveState; |
| | | |
| | | /** 实时流客户端断连时应结束连接而不触发全局异常处理。 */ |
| | | /** 验证当前测量、实时提醒与历史待办独立,以及实时流断连后的资源清理。 */ |
| | | class TTestLiveServiceImplTest |
| | | { |
| | | @Test |
| | |
| | | for (Instant deviceTime : List.of(now.minusSeconds(1), now)) { |
| | | var measurement = new TestDataObservationAdapter.CollectorMeasurement("S-01", 1L, deviceTime, deviceTime.toString(), |
| | | now, "TEMPERATURE", new BigDecimal("38"), "℃"); |
| | | when(adapter.latestCollector("collector-7")).thenReturn(new TestDataObservationAdapter.CollectorRealtime( |
| | | when(adapter.latestCollector(org.mockito.ArgumentMatchers.nullable(String.class), org.mockito.ArgumentMatchers.eq("collector-7"))).thenReturn(new TestDataObservationAdapter.CollectorRealtime( |
| | | "collector-7", true, 1000, List.of(measurement), null)); |
| | | assertEquals(deviceTime.equals(now) ? 1 : 0, service.current(10L).exceptions().size()); |
| | | } |
| | |
| | | when(simulator.testPlan(any(ChannelIdentity.class))).thenReturn(plan); |
| | | if (mapper != null && test.getBatteries().get(0).getCollectorId() != null) { |
| | | when(mapper.selectCollectorCode(7L)).thenReturn("collector-7"); |
| | | when(simulator.latestCollector("collector-7")).thenReturn( |
| | | when(simulator.latestCollector(org.mockito.ArgumentMatchers.nullable(String.class), org.mockito.ArgumentMatchers.eq("collector-7"))).thenReturn( |
| | | new TestDataObservationAdapter.CollectorRealtime("collector-7", online, 1000, List.of(), null)); |
| | | } |
| | | |