@Test(expectedExceptions = SystemException.class) public void testDecompressWhenTransformerFactoryConfigurationErrorIsThrownShouldLogError() throws TransformerConfigurationException { StreamResult result = new StreamResult(new StringWriter()); given(transformerFactory.createTransformer()).willThrow(new TransformerFactoryConfigurationError()); given(streamResultFactory.createStreamResult()).willReturn(result); underTest.decompress(inputStream); }
@Override public ByteArrayOutputStream decompress(final InputStream inputStream) { StreamResult streamResult = streamResultFactory.createStreamResult(); InputStream fiDocument = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { Transformer tx = fastInfosetTransformerFactory.createTransformer(); tx.setOutputProperty("{http: tx.setOutputProperty(OutputKeys.INDENT, "yes"); FastInfosetSource fastInfosetSource = fastInfosetSourceFactory.createFastInfosetSource(fiDocument); tx.transform(fastInfosetSource, streamResult); fiDocument.close(); baos.write(streamResult.getWriter().toString().getBytes()); } catch (TransformerFactoryConfigurationError | Exception e) { throw new SystemException("Could not perform fastinfoset decompression!", e); } return baos; }
FastInfosetCompressionService implements CompressionService { @Override public ByteArrayOutputStream decompress(final InputStream inputStream) { StreamResult streamResult = streamResultFactory.createStreamResult(); InputStream fiDocument = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { Transformer tx = fastInfosetTransformerFactory.createTransformer(); tx.setOutputProperty("{http: tx.setOutputProperty(OutputKeys.INDENT, "yes"); FastInfosetSource fastInfosetSource = fastInfosetSourceFactory.createFastInfosetSource(fiDocument); tx.transform(fastInfosetSource, streamResult); fiDocument.close(); baos.write(streamResult.getWriter().toString().getBytes()); } catch (TransformerFactoryConfigurationError | Exception e) { throw new SystemException("Could not perform fastinfoset decompression!", e); } return baos; } }
FastInfosetCompressionService implements CompressionService { @Override public ByteArrayOutputStream decompress(final InputStream inputStream) { StreamResult streamResult = streamResultFactory.createStreamResult(); InputStream fiDocument = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { Transformer tx = fastInfosetTransformerFactory.createTransformer(); tx.setOutputProperty("{http: tx.setOutputProperty(OutputKeys.INDENT, "yes"); FastInfosetSource fastInfosetSource = fastInfosetSourceFactory.createFastInfosetSource(fiDocument); tx.transform(fastInfosetSource, streamResult); fiDocument.close(); baos.write(streamResult.getWriter().toString().getBytes()); } catch (TransformerFactoryConfigurationError | Exception e) { throw new SystemException("Could not perform fastinfoset decompression!", e); } return baos; }  }
FastInfosetCompressionService implements CompressionService { @Override public ByteArrayOutputStream decompress(final InputStream inputStream) { StreamResult streamResult = streamResultFactory.createStreamResult(); InputStream fiDocument = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { Transformer tx = fastInfosetTransformerFactory.createTransformer(); tx.setOutputProperty("{http: tx.setOutputProperty(OutputKeys.INDENT, "yes"); FastInfosetSource fastInfosetSource = fastInfosetSourceFactory.createFastInfosetSource(fiDocument); tx.transform(fastInfosetSource, streamResult); fiDocument.close(); baos.write(streamResult.getWriter().toString().getBytes()); } catch (TransformerFactoryConfigurationError | Exception e) { throw new SystemException("Could not perform fastinfoset decompression!", e); } return baos; }  @Override ByteArrayOutputStream compress(final InputStream inputStream); @Override ByteArrayOutputStream decompress(final InputStream inputStream); }
FastInfosetCompressionService implements CompressionService { @Override public ByteArrayOutputStream decompress(final InputStream inputStream) { StreamResult streamResult = streamResultFactory.createStreamResult(); InputStream fiDocument = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { Transformer tx = fastInfosetTransformerFactory.createTransformer(); tx.setOutputProperty("{http: tx.setOutputProperty(OutputKeys.INDENT, "yes"); FastInfosetSource fastInfosetSource = fastInfosetSourceFactory.createFastInfosetSource(fiDocument); tx.transform(fastInfosetSource, streamResult); fiDocument.close(); baos.write(streamResult.getWriter().toString().getBytes()); } catch (TransformerFactoryConfigurationError | Exception e) { throw new SystemException("Could not perform fastinfoset decompression!", e); } return baos; }  @Override ByteArrayOutputStream compress(final InputStream inputStream); @Override ByteArrayOutputStream decompress(final InputStream inputStream);  }