@Test(expectedExceptions = NullPointerException.class) public void nullMessageNotOK() throws FMSException { callback().execute(null); }
@Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CallbackHandlerInterceptor..."); CallbackMessage callbackMessage = intuitMessage.getResponseElements().getCallbackMessage(); Response response = intuitMessage.getResponseElements().getResponse(); if (response != null) { IntuitResponse intuitResponse = (IntuitResponse) response; JAXBElement<? extends IntuitEntity> intuitObject = intuitResponse.getIntuitObject(); if (intuitObject != null) { LOG.debug("CallbackHandlerInterceptor setting IntuitObject..."); callbackMessage.setEntity((IEntity) intuitObject.getValue()); } QueryResponse queryResponse = intuitResponse.getQueryResponse(); if (queryResponse != null) { LOG.debug("CallbackHandlerInterceptor setting QueryResponse..."); QueryResult queryResult = getQueryResult(queryResponse); callbackMessage.setQueryResult(queryResult); } List<CDCResponse> cdcResponses = intuitResponse.getCDCResponse(); if (cdcResponses != null) { LOG.debug("CallbackHandlerInterceptor setting CDCQueryResponse..."); List<CDCQueryResult> cdcQueryResults = getCDCQueryResult(cdcResponses); callbackMessage.setCDCQueryResults(cdcQueryResults); } List<AttachableResponse> attachableResponses = intuitResponse.getAttachableResponse(); if (attachableResponses != null) { LOG.debug("CallbackHandlerInterceptor setting AttachableResponse..."); callbackMessage.setAttachableResponse(attachableResponses); } List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { LOG.debug("CallbackHandlerInterceptor setting BatchItemResponse..."); BatchOperation batchOperation = intuitMessage.getRequestElements().getBatchOperation(); int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } callbackMessage.setBatchOperation(batchOperation); } } else if (isDownload(intuitMessage.getRequestElements().getAction())) { LOG.debug("CallbackHandlerInterceptor setting downloadedFile..."); callbackMessage.setDownloadedFile(getDownloadedFile(intuitMessage.getResponseElements().getDecompressedData())); } else if (isDownloadPDF(intuitMessage.getRequestElements().getRequestParameters())) { LOG.debug("CallbackHandlerInterceptor setting binary content for PDF..."); callbackMessage.setDownloadedFile(intuitMessage.getResponseElements().getResponseBytes()); } intuitMessage.getRequestElements().getCallbackHandler().execute(callbackMessage); LOG.debug("Exit CallbackHandlerInterceptor."); }
CallbackHandlerInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CallbackHandlerInterceptor..."); CallbackMessage callbackMessage = intuitMessage.getResponseElements().getCallbackMessage(); Response response = intuitMessage.getResponseElements().getResponse(); if (response != null) { IntuitResponse intuitResponse = (IntuitResponse) response; JAXBElement<? extends IntuitEntity> intuitObject = intuitResponse.getIntuitObject(); if (intuitObject != null) { LOG.debug("CallbackHandlerInterceptor setting IntuitObject..."); callbackMessage.setEntity((IEntity) intuitObject.getValue()); } QueryResponse queryResponse = intuitResponse.getQueryResponse(); if (queryResponse != null) { LOG.debug("CallbackHandlerInterceptor setting QueryResponse..."); QueryResult queryResult = getQueryResult(queryResponse); callbackMessage.setQueryResult(queryResult); } List<CDCResponse> cdcResponses = intuitResponse.getCDCResponse(); if (cdcResponses != null) { LOG.debug("CallbackHandlerInterceptor setting CDCQueryResponse..."); List<CDCQueryResult> cdcQueryResults = getCDCQueryResult(cdcResponses); callbackMessage.setCDCQueryResults(cdcQueryResults); } List<AttachableResponse> attachableResponses = intuitResponse.getAttachableResponse(); if (attachableResponses != null) { LOG.debug("CallbackHandlerInterceptor setting AttachableResponse..."); callbackMessage.setAttachableResponse(attachableResponses); } List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { LOG.debug("CallbackHandlerInterceptor setting BatchItemResponse..."); BatchOperation batchOperation = intuitMessage.getRequestElements().getBatchOperation(); int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } callbackMessage.setBatchOperation(batchOperation); } } else if (isDownload(intuitMessage.getRequestElements().getAction())) { LOG.debug("CallbackHandlerInterceptor setting downloadedFile..."); callbackMessage.setDownloadedFile(getDownloadedFile(intuitMessage.getResponseElements().getDecompressedData())); } else if (isDownloadPDF(intuitMessage.getRequestElements().getRequestParameters())) { LOG.debug("CallbackHandlerInterceptor setting binary content for PDF..."); callbackMessage.setDownloadedFile(intuitMessage.getResponseElements().getResponseBytes()); } intuitMessage.getRequestElements().getCallbackHandler().execute(callbackMessage); LOG.debug("Exit CallbackHandlerInterceptor."); } }
CallbackHandlerInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CallbackHandlerInterceptor..."); CallbackMessage callbackMessage = intuitMessage.getResponseElements().getCallbackMessage(); Response response = intuitMessage.getResponseElements().getResponse(); if (response != null) { IntuitResponse intuitResponse = (IntuitResponse) response; JAXBElement<? extends IntuitEntity> intuitObject = intuitResponse.getIntuitObject(); if (intuitObject != null) { LOG.debug("CallbackHandlerInterceptor setting IntuitObject..."); callbackMessage.setEntity((IEntity) intuitObject.getValue()); } QueryResponse queryResponse = intuitResponse.getQueryResponse(); if (queryResponse != null) { LOG.debug("CallbackHandlerInterceptor setting QueryResponse..."); QueryResult queryResult = getQueryResult(queryResponse); callbackMessage.setQueryResult(queryResult); } List<CDCResponse> cdcResponses = intuitResponse.getCDCResponse(); if (cdcResponses != null) { LOG.debug("CallbackHandlerInterceptor setting CDCQueryResponse..."); List<CDCQueryResult> cdcQueryResults = getCDCQueryResult(cdcResponses); callbackMessage.setCDCQueryResults(cdcQueryResults); } List<AttachableResponse> attachableResponses = intuitResponse.getAttachableResponse(); if (attachableResponses != null) { LOG.debug("CallbackHandlerInterceptor setting AttachableResponse..."); callbackMessage.setAttachableResponse(attachableResponses); } List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { LOG.debug("CallbackHandlerInterceptor setting BatchItemResponse..."); BatchOperation batchOperation = intuitMessage.getRequestElements().getBatchOperation(); int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } callbackMessage.setBatchOperation(batchOperation); } } else if (isDownload(intuitMessage.getRequestElements().getAction())) { LOG.debug("CallbackHandlerInterceptor setting downloadedFile..."); callbackMessage.setDownloadedFile(getDownloadedFile(intuitMessage.getResponseElements().getDecompressedData())); } else if (isDownloadPDF(intuitMessage.getRequestElements().getRequestParameters())) { LOG.debug("CallbackHandlerInterceptor setting binary content for PDF..."); callbackMessage.setDownloadedFile(intuitMessage.getResponseElements().getResponseBytes()); } intuitMessage.getRequestElements().getCallbackHandler().execute(callbackMessage); LOG.debug("Exit CallbackHandlerInterceptor."); }  }
CallbackHandlerInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CallbackHandlerInterceptor..."); CallbackMessage callbackMessage = intuitMessage.getResponseElements().getCallbackMessage(); Response response = intuitMessage.getResponseElements().getResponse(); if (response != null) { IntuitResponse intuitResponse = (IntuitResponse) response; JAXBElement<? extends IntuitEntity> intuitObject = intuitResponse.getIntuitObject(); if (intuitObject != null) { LOG.debug("CallbackHandlerInterceptor setting IntuitObject..."); callbackMessage.setEntity((IEntity) intuitObject.getValue()); } QueryResponse queryResponse = intuitResponse.getQueryResponse(); if (queryResponse != null) { LOG.debug("CallbackHandlerInterceptor setting QueryResponse..."); QueryResult queryResult = getQueryResult(queryResponse); callbackMessage.setQueryResult(queryResult); } List<CDCResponse> cdcResponses = intuitResponse.getCDCResponse(); if (cdcResponses != null) { LOG.debug("CallbackHandlerInterceptor setting CDCQueryResponse..."); List<CDCQueryResult> cdcQueryResults = getCDCQueryResult(cdcResponses); callbackMessage.setCDCQueryResults(cdcQueryResults); } List<AttachableResponse> attachableResponses = intuitResponse.getAttachableResponse(); if (attachableResponses != null) { LOG.debug("CallbackHandlerInterceptor setting AttachableResponse..."); callbackMessage.setAttachableResponse(attachableResponses); } List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { LOG.debug("CallbackHandlerInterceptor setting BatchItemResponse..."); BatchOperation batchOperation = intuitMessage.getRequestElements().getBatchOperation(); int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } callbackMessage.setBatchOperation(batchOperation); } } else if (isDownload(intuitMessage.getRequestElements().getAction())) { LOG.debug("CallbackHandlerInterceptor setting downloadedFile..."); callbackMessage.setDownloadedFile(getDownloadedFile(intuitMessage.getResponseElements().getDecompressedData())); } else if (isDownloadPDF(intuitMessage.getRequestElements().getRequestParameters())) { LOG.debug("CallbackHandlerInterceptor setting binary content for PDF..."); callbackMessage.setDownloadedFile(intuitMessage.getResponseElements().getResponseBytes()); } intuitMessage.getRequestElements().getCallbackHandler().execute(callbackMessage); LOG.debug("Exit CallbackHandlerInterceptor."); }  @Override void execute(IntuitMessage intuitMessage); }
CallbackHandlerInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CallbackHandlerInterceptor..."); CallbackMessage callbackMessage = intuitMessage.getResponseElements().getCallbackMessage(); Response response = intuitMessage.getResponseElements().getResponse(); if (response != null) { IntuitResponse intuitResponse = (IntuitResponse) response; JAXBElement<? extends IntuitEntity> intuitObject = intuitResponse.getIntuitObject(); if (intuitObject != null) { LOG.debug("CallbackHandlerInterceptor setting IntuitObject..."); callbackMessage.setEntity((IEntity) intuitObject.getValue()); } QueryResponse queryResponse = intuitResponse.getQueryResponse(); if (queryResponse != null) { LOG.debug("CallbackHandlerInterceptor setting QueryResponse..."); QueryResult queryResult = getQueryResult(queryResponse); callbackMessage.setQueryResult(queryResult); } List<CDCResponse> cdcResponses = intuitResponse.getCDCResponse(); if (cdcResponses != null) { LOG.debug("CallbackHandlerInterceptor setting CDCQueryResponse..."); List<CDCQueryResult> cdcQueryResults = getCDCQueryResult(cdcResponses); callbackMessage.setCDCQueryResults(cdcQueryResults); } List<AttachableResponse> attachableResponses = intuitResponse.getAttachableResponse(); if (attachableResponses != null) { LOG.debug("CallbackHandlerInterceptor setting AttachableResponse..."); callbackMessage.setAttachableResponse(attachableResponses); } List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { LOG.debug("CallbackHandlerInterceptor setting BatchItemResponse..."); BatchOperation batchOperation = intuitMessage.getRequestElements().getBatchOperation(); int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } callbackMessage.setBatchOperation(batchOperation); } } else if (isDownload(intuitMessage.getRequestElements().getAction())) { LOG.debug("CallbackHandlerInterceptor setting downloadedFile..."); callbackMessage.setDownloadedFile(getDownloadedFile(intuitMessage.getResponseElements().getDecompressedData())); } else if (isDownloadPDF(intuitMessage.getRequestElements().getRequestParameters())) { LOG.debug("CallbackHandlerInterceptor setting binary content for PDF..."); callbackMessage.setDownloadedFile(intuitMessage.getResponseElements().getResponseBytes()); } intuitMessage.getRequestElements().getCallbackHandler().execute(callbackMessage); LOG.debug("Exit CallbackHandlerInterceptor."); }  @Override void execute(IntuitMessage intuitMessage);  }