1. 更新前端界面和Nginx配置
2. 更新Dockerfile设置
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,8 +1,9 @@
|
|||||||
HELP.md
|
HELP.md
|
||||||
.gradle
|
.gradle
|
||||||
build/
|
build/
|
||||||
./log/
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
*.log
|
||||||
|
*.gz
|
||||||
!**/src/main/**/build/
|
!**/src/main/**/build/
|
||||||
!**/src/test/**/build/
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.realtime'
|
group = 'com.realtime'
|
||||||
version = '0.0.3-SNAPSHOT'
|
version = '1.0-SNAPSHOT'
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = '17'
|
sourceCompatibility = '17'
|
||||||
|
|||||||
8
docker-nginx/Dockerfile
Normal file
8
docker-nginx/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
FROM protection_ubuntu:latest
|
||||||
|
LABEL authors="Endera"
|
||||||
|
|
||||||
|
COPY realtime_protection realtime_protection
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
ENTRYPOINT ["bash", "realtime_protection/docker-nginx/start_nginx.sh"]
|
||||||
4
docker-nginx/Dockerfile.dockerignore
Normal file
4
docker-nginx/Dockerfile.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
../build
|
||||||
|
../.gradle
|
||||||
|
../gradle
|
||||||
|
../log
|
||||||
17
docker-nginx/prepare_nginx.sh
Normal file
17
docker-nginx/prepare_nginx.sh
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 初始化变量设定
|
||||||
|
export set BASEDIR="/root"
|
||||||
|
export set PROTECTION_DIR="$BASEDIR/realtime_protection"
|
||||||
|
export set PROTECTION_NGINX_DIR="$PROTECTION_DIR/src/main/resources/nginx"
|
||||||
|
export set PROJECT_NGINX_DIR="$BASEDIR/nginx"
|
||||||
|
export set GLOBAL_NGINX_DIR="/etc/nginx"
|
||||||
|
|
||||||
|
# 下载git仓库内容
|
||||||
|
echo https://EnderByEndera:8Bs8hxHtE-iq44g@git.mesalab.cn > $BASEDIR/.git-credentials
|
||||||
|
git config --global credential.helper store
|
||||||
|
git clone https://git.mesalab.cn/EnderByEndera/realtime_protection.git $BASEDIR/realtime_protection
|
||||||
|
|
||||||
|
# 拷贝Nginx配置到指定地址
|
||||||
|
cp -r $PROTECTION_NGINX_DIR $BASEDIR
|
||||||
|
cp $PROTECTION_NGINX_DIR/nginx.conf $GLOBAL_NGINX_DIR
|
||||||
18
docker-nginx/start_nginx.sh
Normal file
18
docker-nginx/start_nginx.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 初始化变量设定
|
||||||
|
export set BASEDIR="/root"
|
||||||
|
export set PROTECTION_DIR="$BASEDIR/realtime_protection"
|
||||||
|
export set PROTECTION_NGINX_DIR="$PROTECTION_DIR/src/main/resources/nginx"
|
||||||
|
export set PROJECT_NGINX_DIR="$BASEDIR/nginx"
|
||||||
|
export set GLOBAL_NGINX_DIR="/etc/nginx"
|
||||||
|
|
||||||
|
# 拷贝Nginx配置到指定地址
|
||||||
|
cp -r $PROTECTION_NGINX_DIR $BASEDIR
|
||||||
|
cp $PROTECTION_NGINX_DIR/nginx.conf $GLOBAL_NGINX_DIR
|
||||||
|
|
||||||
|
# 启动Nginx服务
|
||||||
|
service nginx start
|
||||||
|
|
||||||
|
# 控制Docker容器挂起
|
||||||
|
top -b
|
||||||
8
docker-springboot/Dockerfile
Normal file
8
docker-springboot/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
FROM protection_ubuntu:latest
|
||||||
|
LABEL authors="Endera"
|
||||||
|
|
||||||
|
COPY realtime_protection realtime_protection
|
||||||
|
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
ENTRYPOINT ["bash", "realtime_protection/docker-springboot/start_springboot.sh"]
|
||||||
3
docker-springboot/Dockerfile.dockerignore
Normal file
3
docker-springboot/Dockerfile.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
../build
|
||||||
|
../.gradle
|
||||||
|
../log
|
||||||
15
docker-springboot/prepare_springboot.sh
Normal file
15
docker-springboot/prepare_springboot.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 初始化变量设定
|
||||||
|
export set BASEDIR="/root"
|
||||||
|
export set PROTECTION_DIR="$BASEDIR/realtime_protection"
|
||||||
|
|
||||||
|
# 下载git仓库内容
|
||||||
|
echo https://EnderByEndera:8Bs8hxHtE-iq44g@git.mesalab.cn > $BASEDIR/.git-credentials
|
||||||
|
git config --global credential.helper store
|
||||||
|
git clone https://git.mesalab.cn/EnderByEndera/realtime_protection.git $BASEDIR/realtime_protection
|
||||||
|
|
||||||
|
# 启动gradle
|
||||||
|
cd $PROTECTION_DIR
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew clean
|
||||||
14
docker-springboot/start_springboot.sh
Normal file
14
docker-springboot/start_springboot.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 初始化变量设定
|
||||||
|
export set BASEDIR="/root"
|
||||||
|
export set PROTECTION_DIR="$BASEDIR/realtime_protection"
|
||||||
|
export set GRADLE_USER_HOME="$PROTECTION_DIR/gradle"
|
||||||
|
|
||||||
|
# 启动gradle,编译java
|
||||||
|
cd $PROTECTION_DIR
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew clean && ./gradlew build
|
||||||
|
|
||||||
|
# 启动SpringBoot服务
|
||||||
|
./gradlew bootRun --args="--spring.profiles.active=prod"
|
||||||
10
docker-ubuntu/Dockerfile
Normal file
10
docker-ubuntu/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
FROM ubuntu:latest
|
||||||
|
LABEL authors="Endera"
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
COPY prepare_ubuntu.sh prepare.sh
|
||||||
|
|
||||||
|
RUN bash prepare.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# 初始化变量设定
|
|
||||||
export set BASEDIR="/root"
|
|
||||||
export set PROTECTION_DIR="$BASEDIR/realtime_protection"
|
|
||||||
export set NGINX_DIR="$PROTECTION_DIR/src/main/resources/nginx"
|
|
||||||
|
|
||||||
# 下载必须依赖
|
# 下载必须依赖
|
||||||
bash -c "cat << EOF > /etc/apt/sources.list && apt update
|
bash -c "cat << EOF > /etc/apt/sources.list && apt update
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
||||||
@@ -18,17 +13,4 @@ deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted univers
|
|||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
||||||
EOF"
|
EOF"
|
||||||
apt install sudo vim git wget screen nginx -y
|
apt install sudo vim git wget screen openjdk-17-jdk nginx -y
|
||||||
|
|
||||||
# 下载git仓库内容
|
|
||||||
echo https://EnderByEndera:8Bs8hxHtE-iq44g@git.mesalab.cn > $BASEDIR/.git-credentials
|
|
||||||
git config --global credential.helper store
|
|
||||||
git clone https://git.mesalab.cn/EnderByEndera/realtime_protection.git $BASEDIR/realtime_protection
|
|
||||||
|
|
||||||
# 拷贝Nginx配置到指定地址
|
|
||||||
cd $NGINX_DIR
|
|
||||||
cp -r ../nginx /root/
|
|
||||||
cp nginx.conf /etc/nginx
|
|
||||||
|
|
||||||
# 启动Nginx服务
|
|
||||||
service nginx start
|
|
||||||
23
load_docker.sh
Normal file
23
load_docker.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 避免build等文件夹被上传引发问题
|
||||||
|
./gradlew clean
|
||||||
|
rm -rf log
|
||||||
|
rm -rf .gradle
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
docker stop nginx_frontend && docker rm nginx_frontend
|
||||||
|
docker stop springboot_backend && docker rm springboot_backend
|
||||||
|
docker image rm protection_springboot protection_nginx
|
||||||
|
echo "old containers and images are cleared"
|
||||||
|
|
||||||
|
docker load < realtime_protection/docker-ubuntu/protection_ubuntu.tar
|
||||||
|
|
||||||
|
docker build -t protection_nginx -f realtime_protection/docker-nginx/Dockerfile .
|
||||||
|
docker build -t protection_springboot -f realtime_protection/docker-springboot/Dockerfile .
|
||||||
|
echo "built frontend and backend servers"
|
||||||
|
|
||||||
|
docker run -itd --name nginx_frontend -p 80:80 protection_nginx
|
||||||
|
docker run -itd --name springboot_backend -p 8081:8081 protection_springboot
|
||||||
|
echo "started frontend and backend servers"
|
||||||
33
prepare.sh
33
prepare.sh
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# 初始化变量设定
|
|
||||||
export set BASEDIR="/root"
|
|
||||||
export set PROTECTION_DIR="$BASEDIR/realtime_protection"
|
|
||||||
|
|
||||||
# 下载必须依赖
|
|
||||||
bash -c "cat << EOF > /etc/apt/sources.list && apt update
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
|
||||||
EOF"
|
|
||||||
apt install sudo vim git wget screen openjdk-17-jdk -y
|
|
||||||
|
|
||||||
# 下载git仓库内容
|
|
||||||
echo https://EnderByEndera:8Bs8hxHtE-iq44g@git.mesalab.cn > $BASEDIR/.git-credentials
|
|
||||||
git config --global credential.helper store
|
|
||||||
git clone https://git.mesalab.cn/EnderByEndera/realtime_protection.git $BASEDIR/realtime_protection
|
|
||||||
|
|
||||||
# 启动gradle,编译java
|
|
||||||
cd $PROTECTION_DIR
|
|
||||||
chmod +x ./gradlew
|
|
||||||
./gradlew clean && ./gradlew build
|
|
||||||
|
|
||||||
# 启动SpringBoot开启服务
|
|
||||||
java -jar $PROTECTION_DIR/build/libs/protection-0.0.3-SNAPSHOT.jar --spring.profiles.active=prod
|
|
||||||
@@ -39,7 +39,7 @@ public class ProtectObjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<ProtectObject> protectObjectBatch = ListUtils.newArrayListWithExpectedSize(batchSize);
|
List<ProtectObject> protectObjectBatch = ListUtils.newArrayListWithExpectedSize(batchSize);
|
||||||
for (ProtectObject protectObject : protectObjectList) {
|
for (ProtectObject protectObject : list) {
|
||||||
protectObjectBatch.add(protectObject);
|
protectObjectBatch.add(protectObject);
|
||||||
if (protectObjectBatch.size() < batchSize) {
|
if (protectObjectBatch.size() < batchSize) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class StateChangeService {
|
|||||||
return !Objects.equals(originalState, StateEnum.GENERATING.getState());
|
return !Objects.equals(originalState, StateEnum.GENERATING.getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/2 * * * ?")
|
@Scheduled(cron = "0 0/10 * * * ?")
|
||||||
@Async
|
@Async
|
||||||
protected void finishTasks() {
|
protected void finishTasks() {
|
||||||
List<Long> finishedTaskIds = taskService.getFinishedTasks();
|
List<Long> finishedTaskIds = taskService.getFinishedTasks();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
server {
|
server {
|
||||||
listen 8080;
|
listen 80;
|
||||||
server_name 192.168.107.89;
|
server_name 192.168.107.89;
|
||||||
location / {
|
location / {
|
||||||
root /root/nginx/defense;
|
root /root/nginx/defense;
|
||||||
@@ -23,11 +23,13 @@ server {
|
|||||||
add_header 'Content-Length' 0;
|
add_header 'Content-Length' 0;
|
||||||
return 204;
|
return 204;
|
||||||
}
|
}
|
||||||
proxy_pass http://192.168.107.89:8081/api/v1/;
|
|
||||||
proxy_set_header Host $host:$server_port;
|
proxy_set_header Host $host:$server_port;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_connect_timeout 5;
|
proxy_connect_timeout 5;
|
||||||
|
|
||||||
|
proxy_pass http://192.168.107.89:8081/api/v1/;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/main/resources/nginx/defense/css/app.dd66d164.css
Normal file
1
src/main/resources/nginx/defense/css/app.dd66d164.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
#userPower{height:calc(100vh - 83px);background:#fff}#userPower .ant-card-body{padding:0!important}#userPower .ant-table-empty{border-bottom:none}#userPower .leftBox{display:inline-block;vertical-align:top;width:20%;height:100%;border:1px solid #e8e8e8;background:#fff;overflow:auto}#userPower .leftBox .search-head{position:relative;height:57px;border-bottom:1px solid #e8e8e8;padding:12px 35px 0 12px}#userPower .leftBox .search-head>i{position:absolute;right:8px;top:18px;font-size:20px;color:#1890ff;cursor:pointer}#userPower .leftBox .companyItem{position:relative;padding:3px 10px 5px 20px;cursor:pointer}#userPower .leftBox .companyItem:hover{background:#f8f8f8}#userPower .leftBox .companyItem:hover .companyDelete,#userPower .leftBox .companyItem:hover .companyEdit{display:block}#userPower .leftBox .companyItem.active{background:#1890ff}#userPower .leftBox .companyItem.active p{color:#fff}#userPower .leftBox .companyItem.active .companyDelete,#userPower .leftBox .companyItem.active .companyEdit{color:#1890ff;background:#fff}#userPower .leftBox .companyItem.active .companyIcon{background:url(../assets/company2.33b66bf6.svg) no-repeat}#userPower .leftBox .companyItem p{margin-bottom:0;width:98%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#userPower .leftBox .companyItem p:first-child{font-size:16px;font-weight:600;margin-bottom:0}#userPower .leftBox .companyItem .companyDelete,#userPower .leftBox .companyItem .companyEdit{display:none;position:absolute;width:24px;height:24px;right:10px;top:18px;font-size:14px;color:#fff;cursor:pointer;text-align:center;line-height:26px;background:#1890ff;border-radius:50%}#userPower .leftBox .companyItem .companyDelete{top:55px}#userPower .leftBox .companyItem .companyIcon{display:inline-block;width:16px;height:16px;margin-right:5px;margin-bottom:-2px;background:url(../assets/company1.b48b661f.svg) no-repeat}#userPower .leftBox .companyItem:nth-child(6n){border-bottom:none;padding:5px 10px 3px 20px}#userPower .leftBox .ant-list-item-content{margin:0}#userPower .leftBox .ant-list-pagination{margin:14px 10px 15px 0}#userPower .leftBox .ant-spin-container{border-bottom:1px solid #e8e8e8;overflow:auto}#userPower .leftBox .ant-pagination-item:not(.ant-pagination-item-active){display:none}#userPower .rightBox{display:inline-block;width:80%;height:100%}#userPower .rightBox .ant-card-bordered{border-bottom:none;border-left:none}#userPower .rightBox .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userPower .rightBox .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userPower .rightBox .ant-table-body{overflow-y:auto!important}#userPower .ant-table-thead>tr>th{color:#000}#userPower .table-page-search-wrapper .ant-form-inline .ant-form-item,#userPower .table-page-search-wrapper .table-page-search-submitButtons{margin:5px 12px 5px 12px}#userPower .ant-form-item-label{width:75px}.wwx_userType,.wwx_userType:focus,.wwx_userType:hover{text-decoration:none}.wwx_userType li{color:#5f5f5f;line-height:30px;text-align:center}.wwx_userType li:hover{background:#e6f7ff}#userShow{height:calc(100vh - 83px);background:#fff}#userShow .ant-card-body{padding:0!important}#userShow .ant-card-bordered{border-bottom:none;border-left:none}#userShow .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userShow .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userShow .ant-table-body{overflow:auto!important}#userShow .ant-table-empty{border-bottom:none}#userShow .ant-table-thead>tr>th{color:#000}.wwx_addmodal .ant-modal-body{padding:10px 15px 5px 15px}.wwx_addmodal .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}.wwx_addmodal .ant-table-body{overflow:auto!important}#userAudit{height:calc(100vh - 83px);background:#fff}#userAudit .ant-card-body{padding:0!important}#userAudit .ant-card-bordered{border-bottom:none;border-left:none;border-top:none}#userAudit .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userAudit .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userAudit .ant-table-body{overflow:auto!important}#userAudit .ant-table-empty{border-bottom:none}#userAudit .ant-table-thead>tr>th{color:#000}.spstyle{width:160px;word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}[data-v-103dc642] .fangyu-form .ant-form-item label{display:inline-block;width:120px}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#userPower{height:calc(100vh - 83px);background:#fff}#userPower .ant-card-body{padding:0!important}#userPower .ant-table-empty{border-bottom:none}#userPower .leftBox{display:inline-block;vertical-align:top;width:20%;height:100%;border:1px solid #e8e8e8;background:#fff;overflow:auto}#userPower .leftBox .search-head{position:relative;height:57px;border-bottom:1px solid #e8e8e8;padding:12px 35px 0 12px}#userPower .leftBox .search-head>i{position:absolute;right:8px;top:18px;font-size:20px;color:#1890ff;cursor:pointer}#userPower .leftBox .companyItem{position:relative;padding:3px 10px 5px 20px;cursor:pointer}#userPower .leftBox .companyItem:hover{background:#f8f8f8}#userPower .leftBox .companyItem:hover .companyDelete,#userPower .leftBox .companyItem:hover .companyEdit{display:block}#userPower .leftBox .companyItem.active{background:#1890ff}#userPower .leftBox .companyItem.active p{color:#fff}#userPower .leftBox .companyItem.active .companyDelete,#userPower .leftBox .companyItem.active .companyEdit{color:#1890ff;background:#fff}#userPower .leftBox .companyItem.active .companyIcon{background:url(../assets/company2.33b66bf6.svg) no-repeat}#userPower .leftBox .companyItem p{margin-bottom:0;width:98%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#userPower .leftBox .companyItem p:first-child{font-size:16px;font-weight:600;margin-bottom:0}#userPower .leftBox .companyItem .companyDelete,#userPower .leftBox .companyItem .companyEdit{display:none;position:absolute;width:24px;height:24px;right:10px;top:18px;font-size:14px;color:#fff;cursor:pointer;text-align:center;line-height:26px;background:#1890ff;border-radius:50%}#userPower .leftBox .companyItem .companyDelete{top:55px}#userPower .leftBox .companyItem .companyIcon{display:inline-block;width:16px;height:16px;margin-right:5px;margin-bottom:-2px;background:url(../assets/company1.b48b661f.svg) no-repeat}#userPower .leftBox .companyItem:nth-child(6n){border-bottom:none;padding:5px 10px 3px 20px}#userPower .leftBox .ant-list-item-content{margin:0}#userPower .leftBox .ant-list-pagination{margin:14px 10px 15px 0}#userPower .leftBox .ant-spin-container{border-bottom:1px solid #e8e8e8;overflow:auto}#userPower .leftBox .ant-pagination-item:not(.ant-pagination-item-active){display:none}#userPower .rightBox{display:inline-block;width:80%;height:100%}#userPower .rightBox .ant-card-bordered{border-bottom:none;border-left:none}#userPower .rightBox .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userPower .rightBox .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userPower .rightBox .ant-table-body{overflow-y:auto!important}#userPower .ant-table-thead>tr>th{color:#000}#userPower .table-page-search-wrapper .ant-form-inline .ant-form-item,#userPower .table-page-search-wrapper .table-page-search-submitButtons{margin:5px 12px 5px 12px}#userPower .ant-form-item-label{width:75px}.wwx_userType,.wwx_userType:focus,.wwx_userType:hover{text-decoration:none}.wwx_userType li{color:#5f5f5f;line-height:30px;text-align:center}.wwx_userType li:hover{background:#e6f7ff}#userShow{height:calc(100vh - 83px);background:#fff}#userShow .ant-card-body{padding:0!important}#userShow .ant-card-bordered{border-bottom:none;border-left:none}#userShow .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userShow .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userShow .ant-table-body{overflow:auto!important}#userShow .ant-table-empty{border-bottom:none}#userShow .ant-table-thead>tr>th{color:#000}.wwx_addmodal .ant-modal-body{padding:10px 15px 5px 15px}.wwx_addmodal .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}.wwx_addmodal .ant-table-body{overflow:auto!important}#userAudit{height:calc(100vh - 83px);background:#fff}#userAudit .ant-card-body{padding:0!important}#userAudit .ant-card-bordered{border-bottom:none;border-left:none;border-top:none}#userAudit .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userAudit .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userAudit .ant-table-body{overflow:auto!important}#userAudit .ant-table-empty{border-bottom:none}#userAudit .ant-table-thead>tr>th{color:#000}.spstyle{width:160px;word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}[data-v-7ab90e50] .fangyu-form .ant-form-item label{display:inline-block;width:90px}[data-v-7ab90e50] .addform .ant-form-item label{display:inline-block;width:95px}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#userPower{height:calc(100vh - 83px);background:#fff}#userPower .ant-card-body{padding:0!important}#userPower .ant-table-empty{border-bottom:none}#userPower .leftBox{display:inline-block;vertical-align:top;width:20%;height:100%;border:1px solid #e8e8e8;background:#fff;overflow:auto}#userPower .leftBox .search-head{position:relative;height:57px;border-bottom:1px solid #e8e8e8;padding:12px 35px 0 12px}#userPower .leftBox .search-head>i{position:absolute;right:8px;top:18px;font-size:20px;color:#1890ff;cursor:pointer}#userPower .leftBox .companyItem{position:relative;padding:3px 10px 5px 20px;cursor:pointer}#userPower .leftBox .companyItem:hover{background:#f8f8f8}#userPower .leftBox .companyItem:hover .companyDelete,#userPower .leftBox .companyItem:hover .companyEdit{display:block}#userPower .leftBox .companyItem.active{background:#1890ff}#userPower .leftBox .companyItem.active p{color:#fff}#userPower .leftBox .companyItem.active .companyDelete,#userPower .leftBox .companyItem.active .companyEdit{color:#1890ff;background:#fff}#userPower .leftBox .companyItem.active .companyIcon{background:url(../assets/company2.33b66bf6.svg) no-repeat}#userPower .leftBox .companyItem p{margin-bottom:0;width:98%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#userPower .leftBox .companyItem p:first-child{font-size:16px;font-weight:600;margin-bottom:0}#userPower .leftBox .companyItem .companyDelete,#userPower .leftBox .companyItem .companyEdit{display:none;position:absolute;width:24px;height:24px;right:10px;top:18px;font-size:14px;color:#fff;cursor:pointer;text-align:center;line-height:26px;background:#1890ff;border-radius:50%}#userPower .leftBox .companyItem .companyDelete{top:55px}#userPower .leftBox .companyItem .companyIcon{display:inline-block;width:16px;height:16px;margin-right:5px;margin-bottom:-2px;background:url(../assets/company1.b48b661f.svg) no-repeat}#userPower .leftBox .companyItem:nth-child(6n){border-bottom:none;padding:5px 10px 3px 20px}#userPower .leftBox .ant-list-item-content{margin:0}#userPower .leftBox .ant-list-pagination{margin:14px 10px 15px 0}#userPower .leftBox .ant-spin-container{border-bottom:1px solid #e8e8e8;overflow:auto}#userPower .leftBox .ant-pagination-item:not(.ant-pagination-item-active){display:none}#userPower .rightBox{display:inline-block;width:80%;height:100%}#userPower .rightBox .ant-card-bordered{border-bottom:none;border-left:none}#userPower .rightBox .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userPower .rightBox .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userPower .rightBox .ant-table-body{overflow-y:auto!important}#userPower .ant-table-thead>tr>th{color:#000}#userPower .table-page-search-wrapper .ant-form-inline .ant-form-item,#userPower .table-page-search-wrapper .table-page-search-submitButtons{margin:5px 12px 5px 12px}#userPower .ant-form-item-label{width:75px}.wwx_userType,.wwx_userType:focus,.wwx_userType:hover{text-decoration:none}.wwx_userType li{color:#5f5f5f;line-height:30px;text-align:center}.wwx_userType li:hover{background:#e6f7ff}#userShow{height:calc(100vh - 83px);background:#fff}#userShow .ant-card-body{padding:0!important}#userShow .ant-card-bordered{border-bottom:none;border-left:none}#userShow .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userShow .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userShow .ant-table-body{overflow:auto!important}#userShow .ant-table-empty{border-bottom:none}#userShow .ant-table-thead>tr>th{color:#000}.wwx_addmodal .ant-modal-body{padding:10px 15px 5px 15px}.wwx_addmodal .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}.wwx_addmodal .ant-table-body{overflow:auto!important}#userAudit{height:calc(100vh - 83px);background:#fff}#userAudit .ant-card-body{padding:0!important}#userAudit .ant-card-bordered{border-bottom:none;border-left:none;border-top:none}#userAudit .table-page-search-wrapper .ant-form-inline>div>div{padding-left:14px!important;padding-right:14px!important}#userAudit .ant-table-fixed-header .ant-table-scroll .ant-table-header{overflow:hidden!important;padding-bottom:0!important;margin-bottom:0!important}#userAudit .ant-table-body{overflow:auto!important}#userAudit .ant-table-empty{border-bottom:none}#userAudit .ant-table-thead>tr>th{color:#000}.spstyle{width:160px;word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}[data-v-3920198d] .fangyu-form .ant-form-item label{display:inline-block;width:90px}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang="zh-cmn-Hans"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>主动防御与处置系统</title><style>#loading-mask{position:fixed;left:0;top:0;height:100%;width:100%;background:#fff;user-select:none;z-index:9999;overflow:hidden}.loading-wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-100%)}.loading-dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:64px;width:64px;height:64px;box-sizing:border-box}.loading-dot i{width:22px;height:22px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.loading-dot i:nth-child(1){top:0;left:0}.loading-dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.loading-dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.loading-dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style><link href="/css/chunk-095e1288.e17630d8.css" rel="prefetch"><link href="/css/chunk-175a0c03.6722db87.css" rel="prefetch"><link href="/css/chunk-24fcb8fe.79f21866.css" rel="prefetch"><link href="/css/chunk-5d084aec.490bdaf4.css" rel="prefetch"><link href="/css/user.34bb7f05.css" rel="prefetch"><link href="/js/chunk-095e1288.4c51f6d9.js" rel="prefetch"><link href="/js/chunk-175a0c03.796e41cd.js" rel="prefetch"><link href="/js/chunk-24fcb8fe.7042b60a.js" rel="prefetch"><link href="/js/chunk-2d0baa90.6ca1b4cd.js" rel="prefetch"><link href="/js/chunk-2d0db458.9632c4ed.js" rel="prefetch"><link href="/js/chunk-2d0f11ad.6714dc8e.js" rel="prefetch"><link href="/js/chunk-2d21ed86.03ebd19f.js" rel="prefetch"><link href="/js/chunk-2d22b936.c47efb44.js" rel="prefetch"><link href="/js/chunk-5d084aec.d7599036.js" rel="prefetch"><link href="/js/fail.3290eb38.js" rel="prefetch"><link href="/js/user.dbc83141.js" rel="prefetch"><link href="/css/app.edd5ad5b.css" rel="preload" as="style"><link href="/css/chunk-vendors.4013be7d.css" rel="preload" as="style"><link href="/js/app.f80fffa5.js" rel="preload" as="script"><link href="/js/chunk-vendors.e4286aa8.js" rel="preload" as="script"><link href="/css/chunk-vendors.4013be7d.css" rel="stylesheet"><link href="/css/app.edd5ad5b.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><div id="loading-mask"><div class="loading-wrapper"><span class="loading-dot loading-dot-spin"><i></i><i></i><i></i><i></i></span></div></div></div><script src="/js/chunk-vendors.e4286aa8.js"></script><script src="/js/app.f80fffa5.js"></script></body></html>
|
<!DOCTYPE html><html lang="zh-cmn-Hans"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>主动防御与处置系统</title><style>#loading-mask{position:fixed;left:0;top:0;height:100%;width:100%;background:#fff;user-select:none;z-index:9999;overflow:hidden}.loading-wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-100%)}.loading-dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:64px;width:64px;height:64px;box-sizing:border-box}.loading-dot i{width:22px;height:22px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.loading-dot i:nth-child(1){top:0;left:0}.loading-dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.loading-dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.loading-dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style><link href="/css/chunk-095e1288.e17630d8.css" rel="prefetch"><link href="/css/chunk-201885d7.f87b6c99.css" rel="prefetch"><link href="/css/chunk-2b492edc.f46eb8e2.css" rel="prefetch"><link href="/css/chunk-32db9202.0d3c934c.css" rel="prefetch"><link href="/css/chunk-3ecd8d86.2e6aaa43.css" rel="prefetch"><link href="/css/chunk-71dd125f.02be3d78.css" rel="prefetch"><link href="/css/user.34bb7f05.css" rel="prefetch"><link href="/js/chunk-095e1288.4c51f6d9.js" rel="prefetch"><link href="/js/chunk-201885d7.8442cec0.js" rel="prefetch"><link href="/js/chunk-2b492edc.ea9db535.js" rel="prefetch"><link href="/js/chunk-32db9202.ebb9923a.js" rel="prefetch"><link href="/js/chunk-3ecd8d86.fb22be1f.js" rel="prefetch"><link href="/js/chunk-71dd125f.b61cef91.js" rel="prefetch"><link href="/js/fail.3290eb38.js" rel="prefetch"><link href="/js/user.dbc83141.js" rel="prefetch"><link href="/css/app.dd66d164.css" rel="preload" as="style"><link href="/css/chunk-vendors.4013be7d.css" rel="preload" as="style"><link href="/js/app.c33f4cc4.js" rel="preload" as="script"><link href="/js/chunk-vendors.ae8e2410.js" rel="preload" as="script"><link href="/css/chunk-vendors.4013be7d.css" rel="stylesheet"><link href="/css/app.dd66d164.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><div id="loading-mask"><div class="loading-wrapper"><span class="loading-dot loading-dot-spin"><i></i><i></i><i></i><i></i></span></div></div></div><script src="/js/chunk-vendors.ae8e2410.js"></script><script src="/js/app.c33f4cc4.js"></script></body></html>
|
||||||
1
src/main/resources/nginx/defense/js/app.c33f4cc4.js
Normal file
1
src/main/resources/nginx/defense/js/app.c33f4cc4.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -56,6 +57,29 @@ class ProtectObjectServiceTest extends ProtectionApplicationTests {
|
|||||||
assertTrue(success);
|
assertTrue(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void queryProtectObject() {
|
||||||
|
List<ProtectObject> protectObjects = new ArrayList<>();
|
||||||
|
String testName = "xxx" + LocalDateTime.now();
|
||||||
|
protectObject.setProtectObjectName(testName);
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
protectObject.setProtectObjectId(null);
|
||||||
|
protectObjectService.newProtectObject(protectObject);
|
||||||
|
protectObjects.add(protectObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protectObjects.forEach(protectObject -> {
|
||||||
|
assertNotNull(protectObjectService.queryProtectObject(protectObject.getProtectObjectId()));
|
||||||
|
assertNotNull(protectObjectService.queryProtectObjects(null,
|
||||||
|
protectObject.getProtectObjectId(), 1, 1));
|
||||||
|
});
|
||||||
|
|
||||||
|
assertEquals(100,
|
||||||
|
protectObjectService.queryProtectObjects(testName, null, 1, 1000).size());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void updateProtectObject() {
|
void updateProtectObject() {
|
||||||
List<ProtectObject> protectObjects = protectObjectService.queryProtectObjects(null, null, 1, 1);
|
List<ProtectObject> protectObjects = protectObjectService.queryProtectObjects(null, null, 1, 1);
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ import org.junit.jupiter.api.BeforeEach;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.cglib.core.Local;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -89,8 +91,48 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testQueryTasks() {
|
void testQueryTasks() {
|
||||||
|
String testName = "test query";
|
||||||
|
String testCreateName = "xxx query";
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
task.setTaskName(testName);
|
||||||
|
task.setTaskCreateUsername(testCreateName);
|
||||||
|
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(
|
||||||
|
null, null, null, null, 1, 5);
|
||||||
|
List<Integer> staticRuleIds = new ArrayList<>();
|
||||||
|
staticRuleObjects.forEach(staticRuleObject ->
|
||||||
|
staticRuleIds.add(staticRuleObject.getStaticRuleId()));
|
||||||
|
task.setStaticRuleIds(staticRuleIds);
|
||||||
|
|
||||||
|
List<DynamicRuleObject> dynamicRuleObjects = dynamicRuleService.queryDynamicRuleObject(
|
||||||
|
null, null, null, null, 1, 5
|
||||||
|
);
|
||||||
|
List<Integer> dynamicRuleIds = new ArrayList<>();
|
||||||
|
dynamicRuleObjects.forEach(dynamicRuleObject ->
|
||||||
|
dynamicRuleIds.add(dynamicRuleObject.getDynamicRuleId()));
|
||||||
|
task.setDynamicRuleIds(dynamicRuleIds);
|
||||||
|
|
||||||
|
assertDoesNotThrow(() -> {
|
||||||
|
Long taskId = taskService.newTask(task);
|
||||||
|
assertTrue(taskId > 0);
|
||||||
|
});
|
||||||
|
assertTrue(task.getTaskId() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<Task> tasks = taskService.queryTasks(null, null, null, null, 1, 10);
|
List<Task> tasks = taskService.queryTasks(null, null, null, null, 1, 10);
|
||||||
assertTrue(tasks.get(0).getTaskId() > 0);
|
assertEquals(10, tasks.size());
|
||||||
|
|
||||||
|
tasks = taskService.queryTasks(0, null, null, null, 1, 10);
|
||||||
|
assertEquals(10, tasks.size());
|
||||||
|
tasks.forEach(task -> assertEquals(0, task.getTaskStatus()));
|
||||||
|
|
||||||
|
tasks = taskService.queryTasks(null, 0, null, null, 1, 10);
|
||||||
|
assertEquals(0, tasks.size());
|
||||||
|
|
||||||
|
tasks = taskService.queryTasks(null, null, testName, null, 1, 10);
|
||||||
|
assertEquals(10, tasks.size());
|
||||||
|
tasks.forEach(task -> assertEquals(testName, task.getTaskName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -117,7 +159,7 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
.get(0).getTaskId();
|
.get(0).getTaskId();
|
||||||
|
|
||||||
assertTrue(taskService.deleteTask(testNum));
|
assertTrue(taskService.deleteTask(testNum));
|
||||||
assertFalse(taskService.deleteTask(235235L));
|
assertFalse(taskService.deleteTask(235156235L)); // 尝试一个不可能达到的数字
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ package com.realtime.protection.server.task.status;
|
|||||||
import com.alibaba.excel.util.ListUtils;
|
import com.alibaba.excel.util.ListUtils;
|
||||||
import com.realtime.protection.ProtectionApplicationTests;
|
import com.realtime.protection.ProtectionApplicationTests;
|
||||||
import com.realtime.protection.configuration.entity.task.FiveTupleWithMask;
|
import com.realtime.protection.configuration.entity.task.FiveTupleWithMask;
|
||||||
|
import com.realtime.protection.configuration.entity.task.Task;
|
||||||
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
||||||
import com.realtime.protection.server.command.CommandService;
|
import com.realtime.protection.server.command.CommandService;
|
||||||
|
import com.realtime.protection.server.task.TaskService;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -21,23 +23,26 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
class CommandServiceTest extends ProtectionApplicationTests {
|
class CommandServiceTest extends ProtectionApplicationTests {
|
||||||
|
|
||||||
private final CommandService commandService;
|
private final CommandService commandService;
|
||||||
|
private final TaskService taskService;
|
||||||
private TaskCommandInfo taskCommandInfo;
|
private TaskCommandInfo taskCommandInfo;
|
||||||
|
|
||||||
private Long startTime;
|
private Long startTime;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CommandServiceTest(CommandService commandService) {
|
CommandServiceTest(CommandService commandService, TaskService taskService) {
|
||||||
this.commandService = commandService;
|
this.commandService = commandService;
|
||||||
|
this.taskService = taskService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void mockCommand() {
|
void mockCommand() {
|
||||||
|
Task task = taskService.queryTasks(null, null, null, null, 1, 1).get(0);
|
||||||
FiveTupleWithMask fiveTupleWithMask = new FiveTupleWithMask();
|
FiveTupleWithMask fiveTupleWithMask = new FiveTupleWithMask();
|
||||||
fiveTupleWithMask.setMaskSourceIP("192.168.155.24");
|
fiveTupleWithMask.setMaskSourceIP("192.168.155.24");
|
||||||
|
|
||||||
taskCommandInfo = new TaskCommandInfo();
|
taskCommandInfo = new TaskCommandInfo();
|
||||||
taskCommandInfo.setFrequency(30);
|
taskCommandInfo.setFrequency(30);
|
||||||
taskCommandInfo.setTaskId(30L);
|
taskCommandInfo.setTaskId(task.getTaskId());
|
||||||
taskCommandInfo.setFiveTupleWithMask(fiveTupleWithMask);
|
taskCommandInfo.setFiveTupleWithMask(fiveTupleWithMask);
|
||||||
taskCommandInfo.setTaskAct("阻断");
|
taskCommandInfo.setTaskAct("阻断");
|
||||||
taskCommandInfo.setStartTime(LocalDateTime.now().plusDays(10));
|
taskCommandInfo.setStartTime(LocalDateTime.now().plusDays(10));
|
||||||
@@ -61,11 +66,12 @@ class CommandServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void createCommands() {
|
void createCommands() {
|
||||||
List<TaskCommandInfo> taskCommandInfos = ListUtils.newArrayListWithExpectedSize(100);
|
List<TaskCommandInfo> taskCommandInfos = ListUtils.newArrayListWithExpectedSize(100);
|
||||||
|
Task task = taskService.queryTasks(null, null, null, null, 1, 1).get(0);
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
int port = i + 1000;
|
int port = i + 1000;
|
||||||
TaskCommandInfo taskCommandInfo = new TaskCommandInfo();
|
TaskCommandInfo taskCommandInfo = new TaskCommandInfo();
|
||||||
taskCommandInfo.setFiveTupleWithMask(new FiveTupleWithMask());
|
taskCommandInfo.setFiveTupleWithMask(new FiveTupleWithMask());
|
||||||
taskCommandInfo.setTaskId(30L);
|
taskCommandInfo.setTaskId(task.getTaskId());
|
||||||
taskCommandInfo.setTaskAct("阻断");
|
taskCommandInfo.setTaskAct("阻断");
|
||||||
taskCommandInfo.getFiveTupleWithMask().setSourcePort(Integer.toString(port));
|
taskCommandInfo.getFiveTupleWithMask().setSourcePort(Integer.toString(port));
|
||||||
taskCommandInfo.setStartTime(LocalDateTime.now().plusDays(5));
|
taskCommandInfo.setStartTime(LocalDateTime.now().plusDays(5));
|
||||||
@@ -86,7 +92,8 @@ class CommandServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void queryCommandInfos() {
|
void queryCommandInfos() {
|
||||||
List<TaskCommandInfo> taskCommandInfos = commandService.queryCommandInfos(30L,
|
Task task = taskService.queryTasks(null, null, null, null, 1, 1).get(0);
|
||||||
|
List<TaskCommandInfo> taskCommandInfos = commandService.queryCommandInfos(task.getTaskId(),
|
||||||
null, null, null, null,1, 5);
|
null, null, null, null,1, 5);
|
||||||
assertTrue(taskCommandInfos != null && !taskCommandInfos.isEmpty());
|
assertTrue(taskCommandInfos != null && !taskCommandInfos.isEmpty());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user