本文整理汇总了Java中com.nike.riposte.server.http.StandardEndpoint类的典型用法代码示例。如果您正苦于以下问题:Java StandardEndpoint类的具体用法?Java StandardEndpoint怎么用?Java StandardEndpoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandardEndpoint类属于com.nike.riposte.server.http包,在下文中一共展示了StandardEndpoint类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beforeMethod
import com.nike.riposte.server.http.StandardEndpoint; //导入依赖的package包/类
@Before
public void beforeMethod() {
stateMock = mock(HttpProcessingState.class);
ctxMock = mock(ChannelHandlerContext.class);
channelMock = mock(Channel.class);
stateAttrMock = mock(Attribute.class);
requestInfoMock = mock(RequestInfo.class);
endpointMock = mock(StandardEndpoint.class);
matcherMock = mock(Matcher.class);
endpoints = new ArrayList<>(Collections.singleton(endpointMock));
httpHeaders = new DefaultHttpHeaders();
maxRequestSizeInBytes = 10;
msg = mock(HttpRequest.class);
doReturn(channelMock).when(ctxMock).channel();
doReturn(stateAttrMock).when(channelMock).attr(ChannelAttributes.HTTP_PROCESSING_STATE_ATTRIBUTE_KEY);
doReturn(stateMock).when(stateAttrMock).get();
doReturn(endpointMock).when(stateMock).getEndpointForExecution();
doReturn(matcherMock).when(endpointMock).requestMatcher();
doReturn(Optional.of(defaultPath)).when(matcherMock).matchesPath(any(RequestInfo.class));
doReturn(true).when(matcherMock).matchesMethod(any(RequestInfo.class));
doReturn(requestInfoMock).when(stateMock).getRequestInfo();
doReturn(httpHeaders).when(msg).headers();
handlerSpy = spy(new RoutingHandler(endpoints, maxRequestSizeInBytes));
}
示例2: beforeMethod
import com.nike.riposte.server.http.StandardEndpoint; //导入依赖的package包/类
@Before
public void beforeMethod() {
stateMock = mock(HttpProcessingState.class);
proxyRouterStateMock = mock(ProxyRouterProcessingState.class);
ctxMock = mock(ChannelHandlerContext.class);
channelMock = mock(Channel.class);
stateAttrMock = mock(Attribute.class);
proxyRouterStateAttrMock = mock(Attribute.class);
requestInfo = RequestInfoImpl.dummyInstanceForUnknownRequests();
endpointMock = mock(StandardEndpoint.class);
longRunningTaskExecutorMock = mock(Executor.class);
responseFuture = new CompletableFuture<>();
stateWorkChainFutureSpy = spy(CompletableFuture.completedFuture(null));
eventLoopMock = mock(EventLoop.class);
eventExecutorMock = mock(EventExecutor.class);
doReturn(channelMock).when(ctxMock).channel();
doReturn(stateAttrMock).when(channelMock).attr(ChannelAttributes.HTTP_PROCESSING_STATE_ATTRIBUTE_KEY);
doReturn(stateMock).when(stateAttrMock).get();
doReturn(false).when(stateMock).isRequestHandled();
doReturn(proxyRouterStateAttrMock).when(channelMock).attr(ChannelAttributes.PROXY_ROUTER_PROCESSING_STATE_ATTRIBUTE_KEY);
doReturn(proxyRouterStateMock).when(proxyRouterStateAttrMock).get();
doReturn(endpointMock).when(stateMock).getEndpointForExecution();
doReturn(requestInfo).when(stateMock).getRequestInfo();
doReturn(responseFuture).when(endpointMock).execute(any(RequestInfo.class), any(Executor.class), any(ChannelHandlerContext.class));
doReturn(eventLoopMock).when(channelMock).eventLoop();
doReturn(eventExecutorMock).when(ctxMock).executor();
doReturn(true).when(eventExecutorMock).inEventLoop();
doReturn(true).when(channelMock).isActive();
doAnswer(invocation -> {
CompletableFuture actualFutureForAttaching = (CompletableFuture) invocation.callRealMethod();
futureThatWillBeAttachedToSpy = spy(actualFutureForAttaching);
return futureThatWillBeAttachedToSpy;
}).when(stateWorkChainFutureSpy).thenCompose(any(Function.class));
doReturn(stateWorkChainFutureSpy).when(stateMock).getPreEndpointExecutionWorkChain();
handlerSpy = spy(new NonblockingEndpointExecutionHandler(longRunningTaskExecutorMock, defaultCompletableFutureTimeoutMillis));
}