|
|
@@ -4,17 +4,10 @@ import cn.seecoder.common.util.SpringUtil;
|
|
|
import cn.seecoder.web.core.pipeline.Context;
|
|
|
import cn.seecoder.web.core.pipeline.PipelineException;
|
|
|
import cn.seecoder.web.service.APITest.APITestService;
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
-import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import lombok.Data;
|
|
|
import lombok.EqualsAndHashCode;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.http.HttpStatus;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import static cn.seecoder.web.core.pipeline.PipelineException.API_TEST_ID_RESOLVE_ERROR;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -39,21 +32,21 @@ public class ApiTestHandler extends AbstractHandler {
|
|
|
* 要自动执行的apiTest的json
|
|
|
* 格式 [1,2,3]
|
|
|
*/
|
|
|
- private String apiTestIds = "[]";
|
|
|
+ private Integer[] apiTestIds = new Integer[]{};
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public void process(Context context) throws PipelineException {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- List<Integer> ids;
|
|
|
- try {
|
|
|
- ids = objectMapper.readValue(apiTestIds, new TypeReference<List<Integer>>() {
|
|
|
- });
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
- throw new PipelineException(HttpStatus.SC_SERVICE_UNAVAILABLE,API_TEST_ID_RESOLVE_ERROR,e);
|
|
|
- }
|
|
|
- for (Integer testId : ids){
|
|
|
+// List<Integer> ids;
|
|
|
+// try {
|
|
|
+// ids = objectMapper.readValue(apiTestIds, new TypeReference<List<Integer>>() {
|
|
|
+// });
|
|
|
+// } catch (JsonProcessingException e) {
|
|
|
+// throw new PipelineException(HttpStatus.SC_SERVICE_UNAVAILABLE,API_TEST_ID_RESOLVE_ERROR,e);
|
|
|
+// }
|
|
|
+ for (Integer testId : apiTestIds){
|
|
|
try {
|
|
|
apiTestService.executeAPITest(testId);
|
|
|
} catch (InterruptedException e) {
|