From cc1f07604727a966181334ef76b8445750ddadd2 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期日, 30 八月 2026 18:55:35 +0800
Subject: [PATCH] 修正模拟器开机后的异常状态同步
---
ruoyi-admin/src/test/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorControllerTest.java | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/ruoyi-admin/src/test/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorControllerTest.java b/ruoyi-admin/src/test/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorControllerTest.java
index e2b2284..c69665a 100644
--- a/ruoyi-admin/src/test/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorControllerTest.java
+++ b/ruoyi-admin/src/test/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorControllerTest.java
@@ -5,6 +5,8 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.net.InetAddress;
@@ -23,6 +25,7 @@
import com.ruoyi.device.model.ChannelIdentity;
import com.ruoyi.device.model.DeviceWorkStatus;
import com.ruoyi.web.config.BtsDevelopmentSimulatorWebConfig;
+import com.ruoyi.config.DevelopmentCollectorStatusSynchronizer;
class BtsDevelopmentSimulatorControllerTest
{
@@ -170,6 +173,21 @@
}
@Test
+ void powerChangeImmediatelyReconcilesCollectorStatus() throws Exception
+ {
+ try (BtsDevelopmentSimulator simulator = new BtsDevelopmentSimulator(0))
+ {
+ DevelopmentCollectorStatusSynchronizer synchronizer = mock(DevelopmentCollectorStatusSynchronizer.class);
+ BtsDevelopmentSimulatorController controller = new BtsDevelopmentSimulatorController(simulator,
+ new InMemoryDeviceDiscoveryCandidateStore(), synchronizer);
+
+ controller.setPower(new BtsDevelopmentSimulatorController.SimulatorPowerCommand(true));
+
+ verify(synchronizer).synchronizeOnlineStatus();
+ }
+ }
+
+ @Test
void simulatorPowerCommandRequiresExplicitState() throws Exception
{
try (BtsDevelopmentSimulator simulator = new BtsDevelopmentSimulator(0))
--
Gitblit v1.7.1