You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/03/25 09:21:55 UTC

[GitHub] [servicecomb-java-chassis] Caixinyang opened a new issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter

Caixinyang opened a new issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter
URL: https://github.com/apache/servicecomb-java-chassis/issues/1663
 
 
   背景:程序使用ExceptionToProducerResponseConverter捕捉ConstraintViolationException参数异常并返回。
   ![image](https://user-images.githubusercontent.com/30398258/77521015-fd40a280-6ebc-11ea-8391-6f72daed3f85.png)
   
   现象:构造测试用例传递非法入参,用例直接返回4xx错误,不进入ExceptionToProducerResponseConverter。
   ![image](https://user-images.githubusercontent.com/30398258/77521059-0e89af00-6ebd-11ea-84b0-0d6522b27e70.png)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [servicecomb-java-chassis] Caixinyang commented on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter

Posted by GitBox <gi...@apache.org>.
Caixinyang commented on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter
URL: https://github.com/apache/servicecomb-java-chassis/issues/1663#issuecomment-604174394
 
 
   1、程序正常启动,API调用是可以正常进入ExceptionToProducerResponseConverter
   2、测试用例使用mockmvc执行则进不去,请问怎么看这个ProducerOperationHandler,controller的入口打点捕捉不到异常?
   ![image](https://user-images.githubusercontent.com/30398258/77600601-5fdc8180-6f43-11ea-9c70-0135f80e2edb.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter
URL: https://github.com/apache/servicecomb-java-chassis/issues/1663#issuecomment-604179612
 
 
   `ProducerOperationHandler` 是 java-chassis 的类。 不过看你的异常堆栈,不像是 java-chassis 抛出的异常, 处理过程不是 java-chassis 的处理过程。 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter
URL: https://github.com/apache/servicecomb-java-chassis/issues/1663#issuecomment-604171463
 
 
   可以先检查下异常从哪里抛出。 如果你使用的最新版本, 可以看看 ProducerOperationHandler 的 doInvoke 方法,是否异常从这里抛出,如果不是, 则不会走 `ExceptionToProducerResponseConverter`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [servicecomb-java-chassis] liubao68 edited a comment on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter

Posted by GitBox <gi...@apache.org>.
liubao68 edited a comment on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter
URL: https://github.com/apache/servicecomb-java-chassis/issues/1663#issuecomment-604179612
 
 
   `ProducerOperationHandler` 是 java-chassis 的类。 不过看你的异常堆栈,不像是 java-chassis 抛出的异常, 处理过程不是 java-chassis 的处理过程。 我没用过你说的 mock 工具, 可能这个工具自己 mock 了一个 HTTP 服务器, 并不是走的 java-chassis. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [servicecomb-java-chassis] Caixinyang commented on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter

Posted by GitBox <gi...@apache.org>.
Caixinyang commented on issue #1663: mockmvc测试接口异常现象,用例不进入ExceptionToProducerResponseConverter
URL: https://github.com/apache/servicecomb-java-chassis/issues/1663#issuecomment-604205977
 
 
   那请问,java-chassis是否有测试接口的类,类似mockmvc这样的工具。模拟restful请求。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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