diff --git a/src/main/java/com/dispose/service/impl/DisposeNodeManagerImpl.java b/src/main/java/com/dispose/service/impl/DisposeNodeManagerImpl.java index f28c7147..4a89ff7f 100644 --- a/src/main/java/com/dispose/service/impl/DisposeNodeManagerImpl.java +++ b/src/main/java/com/dispose/service/impl/DisposeNodeManagerImpl.java @@ -50,6 +50,8 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager { */ @Override public void loadDisposeNodeFromDB() { + disposeDevMap.clear(); + List devList = disposeDeviceMapper.selectAll(); if (devList == null) { diff --git a/src/test/java/com/dispose/service/DisposeNodeManagerTest.java b/src/test/java/com/dispose/service/DisposeNodeManagerTest.java index 45c9669e..a7cdc330 100644 --- a/src/test/java/com/dispose/service/DisposeNodeManagerTest.java +++ b/src/test/java/com/dispose/service/DisposeNodeManagerTest.java @@ -27,8 +27,6 @@ import org.springframework.transaction.annotation.Transactional; @SpringBootTest @Slf4j @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Transactional -@Rollback public class DisposeNodeManagerTest extends InitTestEnvironment { /** * The Used ip addr. @@ -61,6 +59,7 @@ public class DisposeNodeManagerTest extends InitTestEnvironment { */ @Override public void userLogin() { + disposeNodeManager.loadDisposeNodeFromDB(); } /** @@ -114,8 +113,6 @@ public class DisposeNodeManagerTest extends InitTestEnvironment { Assert.assertEquals(disposeNodeManager.getAllDisposeDevice().size(), 0); disposeNodeManager.cleanupDisposeNodeCache(); } - - disposeNodeManager.loadDisposeNodeFromDB(); } @Test @@ -124,7 +121,5 @@ public class DisposeNodeManagerTest extends InitTestEnvironment { ErrorCode ret = disposeNodeManager.delDisposeDeviceByIp(v.getIpAddr()); Assert.assertEquals(ret, ErrorCode.ERR_OK); }); - - disposeNodeManager.loadDisposeNodeFromDB(); } }