REM:
1. 修改DisposeTask数据库字段功能完成
This commit is contained in:
HuangXin 2020-09-27 15:54:57 +08:00
parent f7599efa4b
commit fcd5f3b836
11 changed files with 37 additions and 27 deletions

View File

@ -177,7 +177,7 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
if (tDev.getDevCapacity().size() != 0) {
tDev.getDevCapacity().forEach(v -> {
v.setDeviceId(dev.getId());
v.setDeviceId(devId);
if (v.getIpType() == null) {
v.setIpType(IpAddrType.IPV4_IPV6);
}

View File

@ -74,12 +74,12 @@ public interface DisposeTaskMapper {
*
* @param deviceId the device id
* @param capType the cap type
* @param disposeIp the dispose ip
* @param disposeObject the dispose object
* @return the running task
*/
DisposeTask getRunningTask(@Param("deviceId") Long deviceId,
@Param("capType") DisposeCapacityType capType,
@Param("disposeIp") String disposeIp);
@Param("disposeObject") String disposeObject);
/**
* Gets new task.

View File

@ -568,12 +568,12 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
@Scheduled(fixedDelay = 1000)
public void scheduleRunnerThread() {
// 处理处置任务数据
disposeTaskManagerSchedule();
//disposeTaskManagerSchedule();
// 处置设备启动任务
deviceTaskRunnerSchedule();
//deviceTaskRunnerSchedule();
// 处置设备停止任务
deviceTaskStopSchedule();
//deviceTaskStopSchedule();
}
}

View File

@ -134,7 +134,7 @@
INSERT IGNORE INTO dispose_task(deviceId, accountId, disposeCapacity, disposeObject, objectType,
planEndTime, flowDirection, attackType, flowBandWidth,
currentStatus)
VALUES (#{deviceId}, #{accountId}, #{disposeCapacity}, #{disposeObject}, ${objectType},
VALUES (#{deviceId}, #{accountId}, #{disposeCapacity}, #{disposeObject}, #{objectType},
date_add(now(), interval #{planEndTime} MINUTE), #{flowDirection}, #{attackType},
#{flowBandWidth}, ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()})
</insert>

View File

@ -8,10 +8,8 @@ import org.junit.Test;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
@ -107,22 +105,22 @@ public class CryptoHelperTest {
String testEncValue1 = "P3mq9iSIvQcvfyfdWR8sAnfAadO";
String testEncValue2 = "h0K0_8u";
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
log.info("Version Information:");
while (true) {
String val = reader.readLine();
log.info("{}", val);
// BufferedReader reader = new BufferedReader(new InputStreamReader(is));
// log.info("Version Information:");
// while (true) {
// String val = reader.readLine();
// log.info("{}", val);
//
// if (val == null) {
// break;
// }
//
// if (val.startsWith("git.commit.id=")) {
// password = val.substring("git.commit.id=".length());
// }
// }
if (val == null) {
break;
}
if (val.startsWith("git.commit.id=")) {
password = val.substring("git.commit.id=".length());
}
}
password = password + "cmcc@10086!";
password = "63debfca1d2dc72af38014a7bb6f567202cc1345" + "cmcc@10086!";
byte[] encode = CryptoHelper.aes256Encryption(testEncValue.getBytes(StandardCharsets.UTF_8), password);
Assert.assertEquals(CryptoHelper.base64Encryption(encode), "Trf2LEETes3oKnY1CF7LINcm2KlJbJxHIyvERz2174CTzQEhJtuo+PnO+fR3eDf+");

View File

@ -2,6 +2,7 @@ package com.dispose.test.dev.manager;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeObjectType;
import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
@ -179,6 +180,7 @@ public class DisposeTaskManagerTest extends InitTestEnvironment {
.accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeObject("192.168.0.1")
.objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))

View File

@ -2,6 +2,7 @@ package com.dispose.test.dev.mapper;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeObjectType;
import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.NetflowDirection;
import com.dispose.mapper.DisposeDeviceMapper;
@ -77,6 +78,7 @@ public class DisposeTaskMapperTest extends InitTestEnvironment {
.accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeObject("192.168.0.1")
.objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))

View File

@ -2,6 +2,7 @@ package com.dispose.test.dev.service;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeObjectType;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
import com.dispose.manager.DisposeDeviceManager;
@ -99,6 +100,7 @@ public class DeviceTaskManagerServiceTest extends InitTestEnvironment {
.accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeObject("192.168.0.1")
.objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))

View File

@ -3,6 +3,7 @@ package com.dispose.test.dev.service;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeConfigValue;
import com.dispose.common.DisposeObjectType;
import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
@ -100,6 +101,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeObject("192.168.5.2")
.objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))
@ -138,6 +140,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeObject("192.168.5.2")
.objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))
@ -176,6 +179,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeObject("192.168.10.2")
.objectType(DisposeObjectType.IP)
.planEndTime("60")
.flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))

View File

@ -54,7 +54,7 @@ public class JsonTestCaseRun extends CommonRestfulJson implements TestCaseRun {
/**
* The constant jsonIdFilter.
*/
private static final Integer[] jsonIdFilter = new Integer[]{5};
private static final Integer[] jsonIdFilter = new Integer[]{};
/**
* The Spring method rule.
*/

View File

@ -2,6 +2,7 @@ package com.dispose.test.testcase.qa.v200;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeObjectType;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
import com.dispose.pojo.dto.protocol.task.GetTaskRsp;
@ -101,6 +102,7 @@ public class P2TaskList {
.accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeObject("192.168.0." + i)
.objectType(DisposeObjectType.IP)
.planEndTime("60")
.flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))