From 43e6929710c025f86bb47a59b8a478f4b9b00720 Mon Sep 17 00:00:00 2001
From: ZhouYixun <291028775@qq.com>
Date: Wed, 1 Dec 2021 01:23:45 +0800
Subject: [PATCH] save_beta3_1
---
docker-compose.yml | 2 +-
sonic-server-bus/pom.xml | 19 ++++++
sonic-server-controller/pom.xml | 2 +-
.../services/impl/TestSuitesServiceImpl.java | 66 +++++++++++--------
sonic-server-eureka/pom.xml | 20 ++++++
sonic-server-folder/pom.xml | 19 ++++++
sonic-server-gateway/pom.xml | 20 ++++++
sonic-server-task/pom.xml | 20 ++++++
sonic-server-transport/pom.xml | 20 ++++++
9 files changed, 159 insertions(+), 29 deletions(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index 94d17aee..c7848548 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -38,7 +38,7 @@ services:
ports:
- "8094:8094"
sonic-server-controller:
- image: "zhouyixun/sonic-server-controller:v1.2.0-beta2"
+ image: "zhouyixun/sonic-server-controller:v1.2.0-beta3"
environment:
- PROFILE=prod
- EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/
diff --git a/sonic-server-bus/pom.xml b/sonic-server-bus/pom.xml
index 4f69ce62..46268e17 100644
--- a/sonic-server-bus/pom.xml
+++ b/sonic-server-bus/pom.xml
@@ -42,4 +42,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sonic-server-controller/pom.xml b/sonic-server-controller/pom.xml
index b0da1fc1..9a14d635 100644
--- a/sonic-server-controller/pom.xml
+++ b/sonic-server-controller/pom.xml
@@ -10,7 +10,7 @@
4.0.0
sonic-server-controller
- v1.2.0-beta2
+ v1.2.0-beta3
jar
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/services/impl/TestSuitesServiceImpl.java b/sonic-server-controller/src/main/java/com/sonic/controller/services/impl/TestSuitesServiceImpl.java
index 791614ee..74b46e3d 100644
--- a/sonic-server-controller/src/main/java/com/sonic/controller/services/impl/TestSuitesServiceImpl.java
+++ b/sonic-server-controller/src/main/java/com/sonic/controller/services/impl/TestSuitesServiceImpl.java
@@ -96,6 +96,8 @@ public RespModel runSuite(int suiteId, String strike) {
}
int deviceIndex = 0;
if (testSuites.getCover() == CoverType.CASE) {
+ List suiteDetail = new ArrayList<>();
+ Set agentIds = new HashSet<>();
for (TestCases testCases : testSuites.getTestCases()) {
JSONObject suite = new JSONObject();
List steps = new ArrayList<>();
@@ -106,7 +108,7 @@ public RespModel runSuite(int suiteId, String strike) {
suite.put("steps", steps);
suite.put("cid", testCases.getId());
Devices devices = devicesList.get(deviceIndex);
- suite.put("device", devices);
+ suite.put("device", Arrays.asList(devices));
if (deviceIndex == devicesList.size() - 1) {
deviceIndex = 0;
} else {
@@ -124,15 +126,23 @@ public RespModel runSuite(int suiteId, String strike) {
}
suite.put("gp", gp);
suite.put("rid", results.getId());
- suite.put("wait", 0);
- suite.put("id", devices.getAgentId());
- RespModel testDataResp = transportFeignClient.sendTestData(suite);
- if (testDataResp.getCode() != 2000) {
- resultsService.subResultCount(results.getId());
- }
+ agentIds.add(devices.getAgentId());
+ suiteDetail.add(suite);
+ }
+ JSONObject result = new JSONObject();
+ result.put("cases", suiteDetail);
+ for (Integer id : agentIds) {
+ result.put("id", id);
+ transportFeignClient.sendTestData(result);
}
+// RespModel testDataResp = transportFeignClient.sendTestData(suite);
+// if (testDataResp.getCode() != 2000) {
+// resultsService.subResultCount(results.getId());
+// }
}
if (testSuites.getCover() == CoverType.DEVICE) {
+ List suiteDetail = new ArrayList<>();
+ Set agentIds = new HashSet<>();
for (TestCases testCases : testSuites.getTestCases()) {
JSONObject suite = new JSONObject();
List steps = new ArrayList<>();
@@ -141,28 +151,30 @@ public RespModel runSuite(int suiteId, String strike) {
steps.add(getStep(s));
}
for (Devices devices : devicesList) {
- suite.put("steps", steps);
- suite.put("cid", testCases.getId());
- suite.put("device", devices);
- //如果该字段的多参数数组还有,放入对象。否则去掉字段
- for (String k : valueMap.keySet()) {
- if (valueMap.get(k).size() > 0) {
- String v = valueMap.get(k).get(0);
- gp.put(k, v);
- valueMap.get(k).remove(0);
- } else {
- valueMap.remove(k);
- }
- }
- suite.put("gp", gp);
- suite.put("rid", results.getId());
- suite.put("wait", 0);
- suite.put("id", devices.getAgentId());
- RespModel testDataResp = transportFeignClient.sendTestData(suite);
- if (testDataResp.getCode() != 2000) {
- resultsService.subResultCount(results.getId());
+ agentIds.add(devices.getAgentId());
+ }
+ suite.put("steps", steps);
+ suite.put("cid", testCases.getId());
+ suite.put("device", devicesList);
+ //如果该字段的多参数数组还有,放入对象。否则去掉字段
+ for (String k : valueMap.keySet()) {
+ if (valueMap.get(k).size() > 0) {
+ String v = valueMap.get(k).get(0);
+ gp.put(k, v);
+ valueMap.get(k).remove(0);
+ } else {
+ valueMap.remove(k);
}
}
+ suite.put("gp", gp);
+ suite.put("rid", results.getId());
+ suiteDetail.add(suite);
+ }
+ JSONObject result = new JSONObject();
+ result.put("cases", suiteDetail);
+ for (Integer id : agentIds) {
+ result.put("id", id);
+ transportFeignClient.sendTestData(result);
}
}
return new RespModel(RespEnum.HANDLE_OK);
diff --git a/sonic-server-eureka/pom.xml b/sonic-server-eureka/pom.xml
index 35558aa5..023e5f90 100644
--- a/sonic-server-eureka/pom.xml
+++ b/sonic-server-eureka/pom.xml
@@ -37,4 +37,24 @@
spring-boot-starter-undertow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sonic-server-folder/pom.xml b/sonic-server-folder/pom.xml
index e863a1de..f6b50d15 100644
--- a/sonic-server-folder/pom.xml
+++ b/sonic-server-folder/pom.xml
@@ -32,4 +32,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sonic-server-gateway/pom.xml b/sonic-server-gateway/pom.xml
index f834ffcc..7ff46f74 100644
--- a/sonic-server-gateway/pom.xml
+++ b/sonic-server-gateway/pom.xml
@@ -48,4 +48,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sonic-server-task/pom.xml b/sonic-server-task/pom.xml
index 95330027..76b24833 100644
--- a/sonic-server-task/pom.xml
+++ b/sonic-server-task/pom.xml
@@ -63,4 +63,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sonic-server-transport/pom.xml b/sonic-server-transport/pom.xml
index d65d3ee7..d208063e 100644
--- a/sonic-server-transport/pom.xml
+++ b/sonic-server-transport/pom.xml
@@ -64,4 +64,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file