diff --git a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/SpringmvcClient.java b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/SpringmvcClient.java index 41fdbae612..6b195b7ea3 100644 --- a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/SpringmvcClient.java +++ b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/SpringmvcClient.java @@ -102,12 +102,20 @@ private static void runImpl() throws Exception { String microserviceName = "springmvc"; try { - // this test class is intended for retry hanging issue JAV-127 + // only works in rest, highway does not have name param, because not defined. templateUrlWithServiceName.getForObject(prefix + "/controller/sayhi?name=throwexception", String.class); TestMgr.check("true", "false"); } catch (Exception e) { TestMgr.check("true", "true"); } + try { + // only works in rest, highway does not have name param, because not defined. + templateUrlWithServiceName.getForObject(prefix + "/controller/sayhi?name=throwexception", String.class); + TestMgr.check("true", "false"); + } catch (Exception e) { + TestMgr.check("true", "true"); + } + testHandler(microserviceName); CodeFirstRestTemplateSpringmvc codeFirstClient = BeanUtils.getContext().getBean(CodeFirstRestTemplateSpringmvc.class); diff --git a/demo/demo-springmvc/springmvc-client/src/test/java/org/apache/servicecomb/demo/springmvc/SpringMvcIT.java b/demo/demo-springmvc/springmvc-client/src/test/java/org/apache/servicecomb/demo/springmvc/SpringMvcIT.java index 509ffa878d..c445ce1a64 100644 --- a/demo/demo-springmvc/springmvc-client/src/test/java/org/apache/servicecomb/demo/springmvc/SpringMvcIT.java +++ b/demo/demo-springmvc/springmvc-client/src/test/java/org/apache/servicecomb/demo/springmvc/SpringMvcIT.java @@ -18,6 +18,7 @@ package org.apache.servicecomb.demo.springmvc; import org.apache.servicecomb.demo.TestMgr; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -35,5 +36,6 @@ public void setUp() { @Test public void clientGetsNoError() { SpringmvcClient.run(); + Assertions.assertTrue(TestMgr.isSuccess()); } } diff --git a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ControllerImpl.java b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ControllerImpl.java index 0cd4db2dc3..3d49ba734f 100644 --- a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ControllerImpl.java +++ b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ControllerImpl.java @@ -19,6 +19,8 @@ import java.util.Arrays; +import org.apache.servicecomb.core.CoreConst; +import org.apache.servicecomb.core.annotation.Transport; import org.apache.servicecomb.demo.controller.Person; import org.apache.servicecomb.provider.rest.common.RestSchema; import org.apache.servicecomb.swagger.invocation.context.ContextUtils; @@ -60,7 +62,7 @@ public String saySomething(String prefix, @RequestBody Person user) { return prefix + " " + user.getName(); } - // Parameters defined in controller.yaml. The code definition do not have any parameters. + @Transport(name = CoreConst.RESTFUL) @RequestMapping(path = "/sayhi", method = RequestMethod.GET) public String sayHi(HttpServletRequest request) throws Exception { String addr = request.getRemoteAddr();