REM:
1.停止清洗任务时,将任务id的数量限定在20以下
This commit is contained in:
chenlinghy 2020-09-11 17:58:41 +08:00
parent eeb6aff0a5
commit 4e8faab230
3 changed files with 7 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import com.dispose.common.DisposeConfigValue;
import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
import com.dispose.common.ObjectStatus;
import com.dispose.common.ProtoCryptoType;
import com.dispose.mapper.DisposeTaskMapper;
import com.dispose.pojo.dto.protocol.base.IdArraysReq;
@ -47,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
@ -218,7 +220,10 @@ public class DisposeTaskControllerTest extends InitTestEnvironment {
List<String> taskIds = new ArrayList<>();
List<String> runTaskIds = new ArrayList<>();
disposeTaskMapper.selectAll().forEach(v -> taskIds.add(String.valueOf(v.getId())));
List<DisposeTask> devices = disposeTaskMapper.selectAll().stream().limit(20)
.collect(Collectors.toList());
devices.forEach(v -> taskIds.add(String.valueOf(v.getId())));
disposeTaskMapper.selectAll().forEach(v -> {
if (v.getCurrentStatus() == DisposeTaskStatus.TASK_NEW ||

View File

@ -158,8 +158,6 @@ public class DisposeCapacityMapperTest {
Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
Assert.assertNotEquals(disposeCapacityMapper.delDeviceDisposeCapacity(newCapList.get(0).getDeviceId()), 0);
Assert.assertEquals(0, disposeCapacityMapper.selectAll().size());
}
/**
@ -195,8 +193,6 @@ public class DisposeCapacityMapperTest {
List<DisposeCapacity> capList = disposeCapacityMapper.getDeviceDisposeCapacity(newCapList.get(0).getDeviceId());
Assert.assertEquals(capList.size(), caps.size() + newCapList.size());
log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
}
}

View File

@ -112,7 +112,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
Assert.assertNotNull(ret.getSecondParam());
Assert.assertEquals(String.valueOf(ret.getSecondParam().getDisposeCapacity()), String.valueOf(DisposeCapacityType.CLEANUP.getValue()));
Assert.assertEquals(String.valueOf(ret.getSecondParam().getDisposeCapacity()), String.valueOf(DisposeCapacityType.CLEANUP));
} else {
Assert.assertNotEquals(ret.getFirstParam().getCode(), ErrorCode.ERR_OK.getCode());
}