本文整理匯總了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));
}