| | |
| | | } |
| | | |
| | | @Test |
| | | void rejectStationOutTaskLimitAboveDirectionalBufferCapacity() { |
| | | when(basStationService.getById(101)).thenReturn(station(101, 1, 2)); |
| | | void stationOutTaskLimitAllowsAboveBufferCapacityButRejectsOverStep() { |
| | | when(basStationService.getById(101)).thenReturn(station(101, 5, 3)); |
| | | |
| | | service.apply(request(true, command("station", "101", "outTaskLimit", "3"))); |
| | | service.apply(request(true, |
| | | command("station", "101", "outTaskLimit", "6"), |
| | | command("station", "101", "outTaskLimit", "9") |
| | | )); |
| | | |
| | | List<AiAutoTuneChange> changes = savedChanges(); |
| | | assertEquals("rejected", changes.get(0).getResultStatus()); |
| | | assertTrue(changes.get(0).getRejectReason().contains("0~2")); |
| | | assertEquals("dry_run", changes.get(0).getResultStatus()); |
| | | assertEquals("5", changes.get(0).getOldValue()); |
| | | assertEquals("6", changes.get(0).getRequestedValue()); |
| | | assertEquals("rejected", changes.get(1).getResultStatus()); |
| | | assertTrue(changes.get(1).getRejectReason().contains("步长不能超过 3")); |
| | | } |
| | | |
| | | @Test |
| | |
| | | } |
| | | |
| | | @Test |
| | | void rejectStationOutTaskLimitWithoutOutBufferCapacity() { |
| | | void allowStationOutTaskLimitWithoutOutBufferCapacity() { |
| | | when(basStationService.getById(101)).thenReturn(station(101, 0)); |
| | | |
| | | service.apply(request(true, command("station", "101", "outTaskLimit", "1"))); |
| | | AutoTuneApplyResult result = service.apply(request(true, command("station", "101", "outTaskLimit", "1"))); |
| | | |
| | | List<AiAutoTuneChange> changes = savedChanges(); |
| | | assertEquals("rejected", changes.get(0).getResultStatus()); |
| | | assertTrue(changes.get(0).getRejectReason().contains("缺少 outBufferCapacity")); |
| | | assertTrue(result.getSuccess()); |
| | | assertEquals("dry_run", changes.get(0).getResultStatus()); |
| | | assertEquals("1", changes.get(0).getRequestedValue()); |
| | | } |
| | | |
| | | @Test |
| | |
| | | |
| | | AutoTuneApplyResult result = service.apply(request(false, |
| | | command("sys_config", null, "conveyorStationTaskLimit", "15"), |
| | | command("station", "101", "outTaskLimit", "3") |
| | | command("station", "101", "outTaskLimit", "5") |
| | | )); |
| | | |
| | | List<AiAutoTuneChange> changes = savedChanges(); |