| | |
| | | import static org.junit.jupiter.api.Assertions.assertArrayEquals; |
| | | import static org.junit.jupiter.api.Assertions.assertThrows; |
| | | import java.lang.reflect.Method; |
| | | import java.math.BigDecimal; |
| | | import java.net.InetAddress; |
| | | import java.time.Instant; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | @Test |
| | | void controllerExposesCollectorRealtimeAndPagedHistory() throws Exception |
| | | { |
| | | try (BtsDevelopmentSimulator simulator = new BtsDevelopmentSimulator(0)) |
| | | { |
| | | BtsDevelopmentSimulatorController controller = controller(simulator); |
| | | controller.configureCollectorSampling(1, |
| | | new BtsDevelopmentSimulatorController.CollectorSamplingCommand( |
| | | 100, List.of(), null, null, false)); |
| | | controller.configureCollectorChannel(1, "S-01", |
| | | new BtsDevelopmentSimulatorController.CollectorChannelCommand(List.of( |
| | | new BtsDevelopmentSimulatorController.CollectorMetricCommand( |
| | | "temperature", new BigDecimal("27.2"), "℃"), |
| | | new BtsDevelopmentSimulatorController.CollectorMetricCommand( |
| | | "custom_voltage", new BigDecimal("1.234"), "V")))); |
| | | simulator.advanceCollectors(Instant.parse("2026-08-29T01:00:00Z")); |
| | | |
| | | var realtime = controller.collectorRealtime(1); |
| | | var firstPage = controller.collectorHistory(1, 0, 2); |
| | | |
| | | assertTrue(realtime.online()); |
| | | assertTrue(realtime.measurements().stream().anyMatch(item -> item.metricCode().equals("custom_voltage"))); |
| | | assertEquals(2, firstPage.records().size()); |
| | | assertTrue(firstPage.hasMore()); |
| | | assertEquals(2, firstPage.nextOffset()); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | void virtualIpMustBeUniqueAcrossCabinetsAndCollectors() throws Exception |
| | | { |
| | | try (BtsDevelopmentSimulator simulator = new BtsDevelopmentSimulator(0)) |