servicecomb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] liubao68 commented on a change in pull request #627: [SCB-292] chassis support standard parameter validation
Date Mon, 16 Apr 2018 09:36:22 GMT
liubao68 commented on a change in pull request #627: [SCB-292] chassis support standard parameter
validation
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/627#discussion_r181674104
 
 

 ##########
 File path: demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/JaxrsClient.java
 ##########
 @@ -147,4 +169,85 @@ private static void testRawJsonParam(RestTemplate template, String cseUrlPrefix)
     TestMgr.check("hello Tom",
         template.postForObject(cseUrlPrefix + "/compute/testrawjson", jsonPerson, String.class));
   }
+
+  private static void testValidatorAddFail(RestTemplate template, String cseUrlPrefix) {
+    Map<String, String> params = new HashMap<>();
+    params.put("a", "5");
+    params.put("b", "3");
+    boolean isExcep = false;
+    try {
+      template.postForObject(cseUrlPrefix + "add", params, Integer.class);
+    } catch (InvocationException e) {
+      isExcep = true;
+      TestMgr.check(400, e.getStatus().getStatusCode());
+      TestMgr.check(Status.BAD_REQUEST, e.getReasonPhrase());
+      TestMgr.check(
+          "CommonExceptionData [message=[ConstraintViolationImpl{interpolatedMessage='must
be greater than or equal to 20', propertyPath=add.arg1, rootBeanClass=class org.apache.servicecomb.demo.jaxrs.server.Validator,
messageTemplate='{javax.validation.constraints.Min.message}'}]]",
 
 Review comment:
   I'll submit a new PR for this minor problem and merge this one.  https://issues.apache.org/jira/browse/SCB-496

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message