@Test public void testNullComponentsTransformInput() throws Exception { MessageInfo messageInfo = new MessageInfo(createBlobId(VERSION_1_UNCONVERTED), 123, (short) 123, (short) 123, 0L); Message message = new Message(messageInfo, null); assertException(transformer.transform(message), NullPointerException.class); message = new Message(null, new ByteArrayInputStream(new byte[30])); assertException(transformer.transform(message), NullPointerException.class); }
@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);  }