@Test public void testCreateLumberJackEvent() { final String sender = "testsender1"; final byte[] data = "this is a test line".getBytes(); final long seqNumber = 1; final String fields = "{\"file\":\"test\"}"; final Map<String,String> metadata = new HashMap<>(); metadata.put(EventFactory.SENDER_KEY, sender); metadata.put(LumberjackMetadata.SEQNUMBER_KEY, String.valueOf(seqNumber)); metadata.put(LumberjackMetadata.FIELDS_KEY, String.valueOf(fields)); final ChannelResponder responder = new SocketChannelResponder(null); final EventFactory<LumberjackEvent> factory = new LumberjackEventFactory(); final LumberjackEvent event = factory.create(data, metadata, responder); Assert.assertEquals(sender, event.getSender()); Assert.assertEquals(seqNumber, event.getSeqNumber()); Assert.assertEquals(fields, event.getFields()); Assert.assertEquals(data, event.getData()); }
@Override public LumberjackEvent create(final byte[] data, final Map<String, String> metadata, final ChannelResponder responder) { final String sender = metadata.get(EventFactory.SENDER_KEY); final long seqNumber = Long.valueOf(metadata.get(LumberjackMetadata.SEQNUMBER_KEY)); final String fields = metadata.get(LumberjackMetadata.FIELDS_KEY); return new LumberjackEvent(sender, data, responder, seqNumber, fields); }
LumberjackEventFactory implements EventFactory<LumberjackEvent> { @Override public LumberjackEvent create(final byte[] data, final Map<String, String> metadata, final ChannelResponder responder) { final String sender = metadata.get(EventFactory.SENDER_KEY); final long seqNumber = Long.valueOf(metadata.get(LumberjackMetadata.SEQNUMBER_KEY)); final String fields = metadata.get(LumberjackMetadata.FIELDS_KEY); return new LumberjackEvent(sender, data, responder, seqNumber, fields); } }
LumberjackEventFactory implements EventFactory<LumberjackEvent> { @Override public LumberjackEvent create(final byte[] data, final Map<String, String> metadata, final ChannelResponder responder) { final String sender = metadata.get(EventFactory.SENDER_KEY); final long seqNumber = Long.valueOf(metadata.get(LumberjackMetadata.SEQNUMBER_KEY)); final String fields = metadata.get(LumberjackMetadata.FIELDS_KEY); return new LumberjackEvent(sender, data, responder, seqNumber, fields); }  }
LumberjackEventFactory implements EventFactory<LumberjackEvent> { @Override public LumberjackEvent create(final byte[] data, final Map<String, String> metadata, final ChannelResponder responder) { final String sender = metadata.get(EventFactory.SENDER_KEY); final long seqNumber = Long.valueOf(metadata.get(LumberjackMetadata.SEQNUMBER_KEY)); final String fields = metadata.get(LumberjackMetadata.FIELDS_KEY); return new LumberjackEvent(sender, data, responder, seqNumber, fields); }  @Override LumberjackEvent create(final byte[] data, final Map<String, String> metadata, final ChannelResponder responder); }
LumberjackEventFactory implements EventFactory<LumberjackEvent> { @Override public LumberjackEvent create(final byte[] data, final Map<String, String> metadata, final ChannelResponder responder) { final String sender = metadata.get(EventFactory.SENDER_KEY); final long seqNumber = Long.valueOf(metadata.get(LumberjackMetadata.SEQNUMBER_KEY)); final String fields = metadata.get(LumberjackMetadata.FIELDS_KEY); return new LumberjackEvent(sender, data, responder, seqNumber, fields); }  @Override LumberjackEvent create(final byte[] data, final Map<String, String> metadata, final ChannelResponder responder);  }