logArgs[5] = response.getRequestId(); logArgs[6] = response.getResponseTime(); logArgs[7] = response.getOperationsCount(); Throwable throwable = remoteCallReturn.getException(); logArgs[8] = throwable != null;
logArgs[5] = response.getRequestId(); logArgs[6] = response.getResponseTime(); logArgs[7] = response.getOperationsCount(); Throwable throwable = remoteCallReturn.getException(); logArgs[8] = throwable != null;
@Test public void testLogRequestSummary_success() { // Set up the request info mock. when(requestInfoLogger.isInfoEnabled()).thenReturn(true); loggerDelegate.logRequestSummary(remoteCallReturn); RequestInfo requestInfo = remoteCallReturn.getRequestInfo(); ResponseInfo responseInfo = remoteCallReturn.getResponseInfo(); verify(requestInfoLogger) .info( RemoteCallLoggerDelegate.SUMMARY_TEMPLATE, requestInfo.getServiceName(), requestInfo.getMethodName(), requestInfo.getContextName(), requestInfo.getContextValue(), requestInfo.getUrl(), responseInfo.getRequestId(), responseInfo.getResponseTime(), responseInfo.getOperationsCount(), false, null); }
@Test public void testLogRequestSummary_failure() { Throwable returnedException = new Throwable(); remoteCallReturn = new RemoteCallReturn.Builder() .withRequestInfo(remoteCallReturn.getRequestInfo()) .withResponseInfo(remoteCallReturn.getResponseInfo()) .withException(returnedException) .build(); when(requestInfoLogger.isWarnEnabled()).thenReturn(true); loggerDelegate.logRequestSummary(remoteCallReturn); RequestInfo requestInfo = remoteCallReturn.getRequestInfo(); ResponseInfo responseInfo = remoteCallReturn.getResponseInfo(); verify(requestInfoLogger) .warn( RemoteCallLoggerDelegate.SUMMARY_TEMPLATE, requestInfo.getServiceName(), requestInfo.getMethodName(), requestInfo.getContextName(), requestInfo.getContextValue(), requestInfo.getUrl(), responseInfo.getRequestId(), responseInfo.getResponseTime(), responseInfo.getOperationsCount(), true, returnedException.toString()); }