use of org.apache.servicecomb.provider.springmvc.reference.UrlWithServiceNameClientHttpRequestFactory.UrlWithServiceNameClientHttpRequest in project incubator-servicecomb-java-chassis by apache.
the class TestUrlWithServiceNameClientHttpRequestFactory method invoke_checkPath.
@Test
public void invoke_checkPath(@Mocked Invocation invocation, @Mocked RequestMeta requestMeta) {
Map<String, String> handlerContext = new HashMap<>();
UrlWithServiceNameClientHttpRequest request = new UrlWithServiceNameClientHttpRequest(uri, HttpMethod.GET) {
@Override
protected Response doInvoke(Invocation invocation) {
return Response.ok(null);
}
};
new Expectations(InvocationFactory.class) {
{
invocation.getHandlerContext();
result = handlerContext;
InvocationFactory.forConsumer((ReferenceConfig) any, (OperationMeta) any, (Object[]) any);
result = invocation;
}
};
Deencapsulation.setField(request, "requestMeta", requestMeta);
Deencapsulation.setField(request, "path", request.findUriPath(uri));
Deencapsulation.invoke(request, "invoke", new Object[] { new Object[] {} });
Assert.assertEquals("/ms/v1/path?null", handlerContext.get(RestConst.REST_CLIENT_REQUEST_PATH));
}
use of org.apache.servicecomb.provider.springmvc.reference.UrlWithServiceNameClientHttpRequestFactory.UrlWithServiceNameClientHttpRequest in project incubator-servicecomb-java-chassis by apache.
the class TestUrlWithServiceNameClientHttpRequestFactory method findUriPath.
@Test
public void findUriPath() throws IOException {
UrlWithServiceNameClientHttpRequest request = (UrlWithServiceNameClientHttpRequest) factory.createRequest(uri, HttpMethod.GET);
Assert.assertEquals("/ms/v1/path", request.findUriPath(uri));
}
Aggregations