@Test public void testBrokenStoreKeyConverter() throws Exception { InputAndExpected inputAndExpected = new InputAndExpected(pairList.get(0), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0], false); TransformationOutput output = transformer.transform(inputAndExpected.getInput()); verifyOutput(output.getMsg(), inputAndExpected.getExpected()); factory.setException(new BlobIdTransformerTestException()); inputAndExpected = new InputAndExpected(pairList.get(1), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0], false); output = transformer.transform(inputAndExpected.getInput()); Assert.assertTrue("Should lead to IllegalStateException", output.getException() instanceof IllegalStateException); factory.setException(null); inputAndExpected = new InputAndExpected(pairList.get(2), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0], false); output = transformer.transform(inputAndExpected.getInput()); verifyOutput(output.getMsg(), inputAndExpected.getExpected()); }
@Override public TransformationOutput transform(Message message) { Message transformedMsg = null; try { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey = storeKeyConverter.getConverted(oldStoreKey); if (newStoreKey != null) { transformedMsg = newMessage(message.getStream(), newStoreKey, message.getMessageInfo()); } } catch (Exception e) { return new TransformationOutput(e); } return new TransformationOutput(transformedMsg); }
BlobIdTransformer implements Transformer { @Override public TransformationOutput transform(Message message) { Message transformedMsg = null; try { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey = storeKeyConverter.getConverted(oldStoreKey); if (newStoreKey != null) { transformedMsg = newMessage(message.getStream(), newStoreKey, message.getMessageInfo()); } } catch (Exception e) { return new TransformationOutput(e); } return new TransformationOutput(transformedMsg); } }
BlobIdTransformer implements Transformer { @Override public TransformationOutput transform(Message message) { Message transformedMsg = null; try { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey = storeKeyConverter.getConverted(oldStoreKey); if (newStoreKey != null) { transformedMsg = newMessage(message.getStream(), newStoreKey, message.getMessageInfo()); } } catch (Exception e) { return new TransformationOutput(e); } return new TransformationOutput(transformedMsg); } BlobIdTransformer(StoreKeyFactory storeKeyFactory, StoreKeyConverter storeKeyConverter); }
BlobIdTransformer implements Transformer { @Override public TransformationOutput transform(Message message) { Message transformedMsg = null; try { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey = storeKeyConverter.getConverted(oldStoreKey); if (newStoreKey != null) { transformedMsg = newMessage(message.getStream(), newStoreKey, message.getMessageInfo()); } } catch (Exception e) { return new TransformationOutput(e); } return new TransformationOutput(transformedMsg); } BlobIdTransformer(StoreKeyFactory storeKeyFactory, StoreKeyConverter storeKeyConverter); @Override TransformationOutput transform(Message message); @Override void warmup(List<MessageInfo> messageInfos); }
BlobIdTransformer implements Transformer { @Override public TransformationOutput transform(Message message) { Message transformedMsg = null; try { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey = storeKeyConverter.getConverted(oldStoreKey); if (newStoreKey != null) { transformedMsg = newMessage(message.getStream(), newStoreKey, message.getMessageInfo()); } } catch (Exception e) { return new TransformationOutput(e); } return new TransformationOutput(transformedMsg); } BlobIdTransformer(StoreKeyFactory storeKeyFactory, StoreKeyConverter storeKeyConverter); @Override TransformationOutput transform(Message message); @Override void warmup(List<MessageInfo> messageInfos);  }