yeg
2026-08-29 7ab0e426264707fb85ee38d0a9a73caf41899635
ruoyi-admin/src/test/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorControllerTest.java
@@ -6,6 +6,7 @@
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;
@@ -95,6 +96,34 @@
    }
    @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))