@Test public void testCheckTouchlessExecution() throws FMSException { message.getResponseElements().setContentTypeHeader("application/pdf"); IntuitResponse response = new IntuitResponse(); response.setStatus("example"); message.getResponseElements().setResponse(response); instance.execute(message); Assert.assertEquals(message.getResponseElements().getResponse(), null); }
@Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter DeserializeInterceptor..."); Response response = null; ResponseElements responseElements = intuitMessage.getResponseElements(); String contentType = responseElements.getContentTypeHeader(); if (contentType != null) { String[] contentTypes = contentType.split(";"); for (String contentTypePart : contentTypes) { if (contentTypePart.matches("(.*)/(.*)")) { String serializeFormat = contentTypePart.substring(contentTypePart.lastIndexOf("/") + 1, contentTypePart.length()); LOG.debug("HttpResponse content-type (deserialization format) : " + serializeFormat); if (StringUtils.hasText(serializeFormat) && (serializeFormat.equalsIgnoreCase(ContentTypes.XML.name()) || serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name()))) { IEntitySerializer serializer = SerializerFactory.getSerializer(serializeFormat); if (intuitMessage.getRequestElements().getObjectToSerialize() instanceof TaxService && serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name())) { response = serializer.deserialize(responseElements.getDecompressedData(), TaxService.class); } else if (intuitMessage.isEntitlementService()) { if (StringUtils.hasText(responseElements.getDecompressedData())) { response = serializer.deserializeEntitlements(responseElements.getDecompressedData(), EntitlementsResponse.class); } else { response = responseElements.getResponse(); } } else { response = serializer.deserialize(responseElements.getDecompressedData(), IntuitResponse.class); } } else if (serializeFormat.equalsIgnoreCase(ContentTypes.PDF.name()) || serializeFormat.equalsIgnoreCase("plain") || serializeFormat.equalsIgnoreCase("octet-stream")) { LOG.info("PDF or plain content has been received"); } else { LOG.info("Invalid Content Type" + serializeFormat); LOG.debug("Decompressed Data" + responseElements.getDecompressedData()); LOG.error("Decompressed Data" + responseElements.getDecompressedData()); throw new FMSException(responseElements.getDecompressedData()); } } } } responseElements.setResponse(response); LOG.debug("Exit DeserializeInterceptor."); }
DeserializeInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter DeserializeInterceptor..."); Response response = null; ResponseElements responseElements = intuitMessage.getResponseElements(); String contentType = responseElements.getContentTypeHeader(); if (contentType != null) { String[] contentTypes = contentType.split(";"); for (String contentTypePart : contentTypes) { if (contentTypePart.matches("(.*)/(.*)")) { String serializeFormat = contentTypePart.substring(contentTypePart.lastIndexOf("/") + 1, contentTypePart.length()); LOG.debug("HttpResponse content-type (deserialization format) : " + serializeFormat); if (StringUtils.hasText(serializeFormat) && (serializeFormat.equalsIgnoreCase(ContentTypes.XML.name()) || serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name()))) { IEntitySerializer serializer = SerializerFactory.getSerializer(serializeFormat); if (intuitMessage.getRequestElements().getObjectToSerialize() instanceof TaxService && serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name())) { response = serializer.deserialize(responseElements.getDecompressedData(), TaxService.class); } else if (intuitMessage.isEntitlementService()) { if (StringUtils.hasText(responseElements.getDecompressedData())) { response = serializer.deserializeEntitlements(responseElements.getDecompressedData(), EntitlementsResponse.class); } else { response = responseElements.getResponse(); } } else { response = serializer.deserialize(responseElements.getDecompressedData(), IntuitResponse.class); } } else if (serializeFormat.equalsIgnoreCase(ContentTypes.PDF.name()) || serializeFormat.equalsIgnoreCase("plain") || serializeFormat.equalsIgnoreCase("octet-stream")) { LOG.info("PDF or plain content has been received"); } else { LOG.info("Invalid Content Type" + serializeFormat); LOG.debug("Decompressed Data" + responseElements.getDecompressedData()); LOG.error("Decompressed Data" + responseElements.getDecompressedData()); throw new FMSException(responseElements.getDecompressedData()); } } } } responseElements.setResponse(response); LOG.debug("Exit DeserializeInterceptor."); } }
DeserializeInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter DeserializeInterceptor..."); Response response = null; ResponseElements responseElements = intuitMessage.getResponseElements(); String contentType = responseElements.getContentTypeHeader(); if (contentType != null) { String[] contentTypes = contentType.split(";"); for (String contentTypePart : contentTypes) { if (contentTypePart.matches("(.*)/(.*)")) { String serializeFormat = contentTypePart.substring(contentTypePart.lastIndexOf("/") + 1, contentTypePart.length()); LOG.debug("HttpResponse content-type (deserialization format) : " + serializeFormat); if (StringUtils.hasText(serializeFormat) && (serializeFormat.equalsIgnoreCase(ContentTypes.XML.name()) || serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name()))) { IEntitySerializer serializer = SerializerFactory.getSerializer(serializeFormat); if (intuitMessage.getRequestElements().getObjectToSerialize() instanceof TaxService && serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name())) { response = serializer.deserialize(responseElements.getDecompressedData(), TaxService.class); } else if (intuitMessage.isEntitlementService()) { if (StringUtils.hasText(responseElements.getDecompressedData())) { response = serializer.deserializeEntitlements(responseElements.getDecompressedData(), EntitlementsResponse.class); } else { response = responseElements.getResponse(); } } else { response = serializer.deserialize(responseElements.getDecompressedData(), IntuitResponse.class); } } else if (serializeFormat.equalsIgnoreCase(ContentTypes.PDF.name()) || serializeFormat.equalsIgnoreCase("plain") || serializeFormat.equalsIgnoreCase("octet-stream")) { LOG.info("PDF or plain content has been received"); } else { LOG.info("Invalid Content Type" + serializeFormat); LOG.debug("Decompressed Data" + responseElements.getDecompressedData()); LOG.error("Decompressed Data" + responseElements.getDecompressedData()); throw new FMSException(responseElements.getDecompressedData()); } } } } responseElements.setResponse(response); LOG.debug("Exit DeserializeInterceptor."); }  }
DeserializeInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter DeserializeInterceptor..."); Response response = null; ResponseElements responseElements = intuitMessage.getResponseElements(); String contentType = responseElements.getContentTypeHeader(); if (contentType != null) { String[] contentTypes = contentType.split(";"); for (String contentTypePart : contentTypes) { if (contentTypePart.matches("(.*)/(.*)")) { String serializeFormat = contentTypePart.substring(contentTypePart.lastIndexOf("/") + 1, contentTypePart.length()); LOG.debug("HttpResponse content-type (deserialization format) : " + serializeFormat); if (StringUtils.hasText(serializeFormat) && (serializeFormat.equalsIgnoreCase(ContentTypes.XML.name()) || serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name()))) { IEntitySerializer serializer = SerializerFactory.getSerializer(serializeFormat); if (intuitMessage.getRequestElements().getObjectToSerialize() instanceof TaxService && serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name())) { response = serializer.deserialize(responseElements.getDecompressedData(), TaxService.class); } else if (intuitMessage.isEntitlementService()) { if (StringUtils.hasText(responseElements.getDecompressedData())) { response = serializer.deserializeEntitlements(responseElements.getDecompressedData(), EntitlementsResponse.class); } else { response = responseElements.getResponse(); } } else { response = serializer.deserialize(responseElements.getDecompressedData(), IntuitResponse.class); } } else if (serializeFormat.equalsIgnoreCase(ContentTypes.PDF.name()) || serializeFormat.equalsIgnoreCase("plain") || serializeFormat.equalsIgnoreCase("octet-stream")) { LOG.info("PDF or plain content has been received"); } else { LOG.info("Invalid Content Type" + serializeFormat); LOG.debug("Decompressed Data" + responseElements.getDecompressedData()); LOG.error("Decompressed Data" + responseElements.getDecompressedData()); throw new FMSException(responseElements.getDecompressedData()); } } } } responseElements.setResponse(response); LOG.debug("Exit DeserializeInterceptor."); }  @Override void execute(IntuitMessage intuitMessage); }
DeserializeInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter DeserializeInterceptor..."); Response response = null; ResponseElements responseElements = intuitMessage.getResponseElements(); String contentType = responseElements.getContentTypeHeader(); if (contentType != null) { String[] contentTypes = contentType.split(";"); for (String contentTypePart : contentTypes) { if (contentTypePart.matches("(.*)/(.*)")) { String serializeFormat = contentTypePart.substring(contentTypePart.lastIndexOf("/") + 1, contentTypePart.length()); LOG.debug("HttpResponse content-type (deserialization format) : " + serializeFormat); if (StringUtils.hasText(serializeFormat) && (serializeFormat.equalsIgnoreCase(ContentTypes.XML.name()) || serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name()))) { IEntitySerializer serializer = SerializerFactory.getSerializer(serializeFormat); if (intuitMessage.getRequestElements().getObjectToSerialize() instanceof TaxService && serializeFormat.equalsIgnoreCase(ContentTypes.JSON.name())) { response = serializer.deserialize(responseElements.getDecompressedData(), TaxService.class); } else if (intuitMessage.isEntitlementService()) { if (StringUtils.hasText(responseElements.getDecompressedData())) { response = serializer.deserializeEntitlements(responseElements.getDecompressedData(), EntitlementsResponse.class); } else { response = responseElements.getResponse(); } } else { response = serializer.deserialize(responseElements.getDecompressedData(), IntuitResponse.class); } } else if (serializeFormat.equalsIgnoreCase(ContentTypes.PDF.name()) || serializeFormat.equalsIgnoreCase("plain") || serializeFormat.equalsIgnoreCase("octet-stream")) { LOG.info("PDF or plain content has been received"); } else { LOG.info("Invalid Content Type" + serializeFormat); LOG.debug("Decompressed Data" + responseElements.getDecompressedData()); LOG.error("Decompressed Data" + responseElements.getDecompressedData()); throw new FMSException(responseElements.getDecompressedData()); } } } } responseElements.setResponse(response); LOG.debug("Exit DeserializeInterceptor."); }  @Override void execute(IntuitMessage intuitMessage);  }