@Test public void CompressionDeflateFormatCompressionTest() throws FMSException { String testMessage = "Test Deflate Serialized"; DeflateCompressor compressor = new DeflateCompressor(); byte[] compressed = compressor.compress(testMessage, null); Config.setProperty(Config.COMPRESSION_REQUEST_FORMAT, CompressorFactory.DEFLATE_COMPRESS_FORMAT); message.getRequestElements().setSerializedData(testMessage); instance.execute(message); Assert.assertEquals(message.getRequestElements().getCompressedData(), compressed); }
@Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CompressionInterceptor..."); String serializedData = intuitMessage.getRequestElements().getSerializedData(); if (StringUtils.hasText(serializedData)) { byte[] compressedData = null; String compressFormat = Config.getProperty(Config.COMPRESSION_REQUEST_FORMAT); LOG.info("compression format : " + compressFormat); byte[] uploadFile = intuitMessage.getRequestElements().getUploadFile(); if (StringUtils.hasText(compressFormat)) { ICompressor compressor = CompressorFactory.getCompressor(compressFormat); compressedData = compressor.compress(serializedData, uploadFile); } else { if (uploadFile != null) { byte[] serializedDateByte = serializedData.getBytes(); compressedData = new byte[serializedDateByte.length + uploadFile.length]; System.arraycopy(serializedDateByte, 0, compressedData, 0, serializedDateByte.length); System.arraycopy(uploadFile, 0, compressedData, serializedDateByte.length, uploadFile.length); } else { compressedData = serializedData.getBytes(); } } intuitMessage.getRequestElements().setCompressedData(compressedData); } LOG.debug("Exit CompressionInterceptor."); }
CompressionInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CompressionInterceptor..."); String serializedData = intuitMessage.getRequestElements().getSerializedData(); if (StringUtils.hasText(serializedData)) { byte[] compressedData = null; String compressFormat = Config.getProperty(Config.COMPRESSION_REQUEST_FORMAT); LOG.info("compression format : " + compressFormat); byte[] uploadFile = intuitMessage.getRequestElements().getUploadFile(); if (StringUtils.hasText(compressFormat)) { ICompressor compressor = CompressorFactory.getCompressor(compressFormat); compressedData = compressor.compress(serializedData, uploadFile); } else { if (uploadFile != null) { byte[] serializedDateByte = serializedData.getBytes(); compressedData = new byte[serializedDateByte.length + uploadFile.length]; System.arraycopy(serializedDateByte, 0, compressedData, 0, serializedDateByte.length); System.arraycopy(uploadFile, 0, compressedData, serializedDateByte.length, uploadFile.length); } else { compressedData = serializedData.getBytes(); } } intuitMessage.getRequestElements().setCompressedData(compressedData); } LOG.debug("Exit CompressionInterceptor."); } }
CompressionInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CompressionInterceptor..."); String serializedData = intuitMessage.getRequestElements().getSerializedData(); if (StringUtils.hasText(serializedData)) { byte[] compressedData = null; String compressFormat = Config.getProperty(Config.COMPRESSION_REQUEST_FORMAT); LOG.info("compression format : " + compressFormat); byte[] uploadFile = intuitMessage.getRequestElements().getUploadFile(); if (StringUtils.hasText(compressFormat)) { ICompressor compressor = CompressorFactory.getCompressor(compressFormat); compressedData = compressor.compress(serializedData, uploadFile); } else { if (uploadFile != null) { byte[] serializedDateByte = serializedData.getBytes(); compressedData = new byte[serializedDateByte.length + uploadFile.length]; System.arraycopy(serializedDateByte, 0, compressedData, 0, serializedDateByte.length); System.arraycopy(uploadFile, 0, compressedData, serializedDateByte.length, uploadFile.length); } else { compressedData = serializedData.getBytes(); } } intuitMessage.getRequestElements().setCompressedData(compressedData); } LOG.debug("Exit CompressionInterceptor."); }  }
CompressionInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CompressionInterceptor..."); String serializedData = intuitMessage.getRequestElements().getSerializedData(); if (StringUtils.hasText(serializedData)) { byte[] compressedData = null; String compressFormat = Config.getProperty(Config.COMPRESSION_REQUEST_FORMAT); LOG.info("compression format : " + compressFormat); byte[] uploadFile = intuitMessage.getRequestElements().getUploadFile(); if (StringUtils.hasText(compressFormat)) { ICompressor compressor = CompressorFactory.getCompressor(compressFormat); compressedData = compressor.compress(serializedData, uploadFile); } else { if (uploadFile != null) { byte[] serializedDateByte = serializedData.getBytes(); compressedData = new byte[serializedDateByte.length + uploadFile.length]; System.arraycopy(serializedDateByte, 0, compressedData, 0, serializedDateByte.length); System.arraycopy(uploadFile, 0, compressedData, serializedDateByte.length, uploadFile.length); } else { compressedData = serializedData.getBytes(); } } intuitMessage.getRequestElements().setCompressedData(compressedData); } LOG.debug("Exit CompressionInterceptor."); }  @Override void execute(IntuitMessage intuitMessage); }
CompressionInterceptor implements Interceptor { @Override public void execute(IntuitMessage intuitMessage) throws FMSException { LOG.debug("Enter CompressionInterceptor..."); String serializedData = intuitMessage.getRequestElements().getSerializedData(); if (StringUtils.hasText(serializedData)) { byte[] compressedData = null; String compressFormat = Config.getProperty(Config.COMPRESSION_REQUEST_FORMAT); LOG.info("compression format : " + compressFormat); byte[] uploadFile = intuitMessage.getRequestElements().getUploadFile(); if (StringUtils.hasText(compressFormat)) { ICompressor compressor = CompressorFactory.getCompressor(compressFormat); compressedData = compressor.compress(serializedData, uploadFile); } else { if (uploadFile != null) { byte[] serializedDateByte = serializedData.getBytes(); compressedData = new byte[serializedDateByte.length + uploadFile.length]; System.arraycopy(serializedDateByte, 0, compressedData, 0, serializedDateByte.length); System.arraycopy(uploadFile, 0, compressedData, serializedDateByte.length, uploadFile.length); } else { compressedData = serializedData.getBytes(); } } intuitMessage.getRequestElements().setCompressedData(compressedData); } LOG.debug("Exit CompressionInterceptor."); }  @Override void execute(IntuitMessage intuitMessage);  }