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