-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
459 additions
and
96 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
arex-schedule-web-api/src/main/java/com/arextest/schedule/beans/ControllerException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.arextest.schedule.beans; | ||
|
||
import com.arextest.schedule.model.CommonResponse; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.ObjectError; | ||
import org.springframework.web.bind.MethodArgumentNotValidException; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@Slf4j | ||
@RestControllerAdvice | ||
public class ControllerException { | ||
|
||
@ExceptionHandler(MethodArgumentNotValidException.class) | ||
public ResponseEntity<CommonResponse> handleValidException(MethodArgumentNotValidException e) { | ||
// setting application/json;charset=UTF-8 | ||
HttpHeaders headers = new HttpHeaders(); | ||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); | ||
|
||
List<ObjectError> allErrors = e.getBindingResult().getAllErrors(); | ||
String message = allErrors.stream().map(s -> s.getDefaultMessage()) | ||
.collect(Collectors.joining(";")); | ||
|
||
return new ResponseEntity<>(CommonResponse.badResponse(message), headers, | ||
HttpStatus.BAD_REQUEST); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,5 +46,7 @@ public static class ReplayNoiseItemDao { | |
|
||
private Integer caseCount; | ||
|
||
private Integer status; | ||
|
||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...-api/src/main/java/com/arextest/schedule/model/noiseidentify/ExcludeNoiseRequestType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.arextest.schedule.model.noiseidentify; | ||
|
||
import com.arextest.diff.model.log.NodeEntity; | ||
import com.arextest.model.mock.MockCategoryType; | ||
import com.arextest.schedule.model.noiseidentify.QueryNoiseResponseType.InterfaceNoiseItem; | ||
import java.util.List; | ||
import javax.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
public class ExcludeNoiseRequestType { | ||
|
||
@NotBlank(message = "appId cannot be blank") | ||
private String appId; | ||
@NotBlank(message = "planId cannot be blank") | ||
private String planId; | ||
|
||
private List<InterfaceNoiseItem> interfaceNoiseItemList; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class InterfaceExcludeNoiseItem { | ||
private String operationId; | ||
private List<QueryNoiseResponseType.MockerNoiseItem> randomNoise; | ||
} | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class MockerExcludeNoiseItem { | ||
|
||
private MockCategoryType mockCategoryType; | ||
private String operationName; | ||
private String operationType; | ||
private List<QueryNoiseResponseType.NoiseItem> noiseItemList; | ||
} | ||
|
||
@Data | ||
public static class ExcludeNoiseItem { | ||
|
||
private String identifier; | ||
|
||
private List<NodeEntity> nodeEntity; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...le-web-api/src/main/java/com/arextest/schedule/model/noiseidentify/ReplayNoiseStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.arextest.schedule.model.noiseidentify; | ||
|
||
public interface ReplayNoiseStatus { | ||
|
||
int STATUS_NORMAL = 0; | ||
|
||
int STATUS_EXCLUDE = 1; | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...dule-web-api/src/main/java/com/arextest/schedule/model/noiseidentify/UpdateNoiseItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.arextest.schedule.model.noiseidentify; | ||
|
||
import java.util.Map; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class UpdateNoiseItem { | ||
|
||
private Map<String, Object> queryFields; | ||
|
||
private Map<String, Object> updateFields; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.