@Test public void testBuild() throws Exception { long timestamp = System.currentTimeMillis(); EventCorrelationInjector injector = new EventCorrelationInjector(); StreamlineEvent parentEvent = copyEventWithNewID(); parentEvent = injector.injectCorrelationInformation(parentEvent, Collections.emptyList(), TEST_COMPONENT_NAME); StreamlineEvent injectedEvent = injector.injectCorrelationInformation( INPUT_STREAMLINE_EVENT, Collections.singletonList(parentEvent), TEST_COMPONENT_NAME); EventInformation information = sut.build(timestamp, TEST_COMPONENT_NAME, TEST_STREAM_ID, Sets.newHashSet(TEST_TARGET_COMPONENT_NAME, TEST_TARGET_COMPONENT_NAME_2), injectedEvent); assertEquals(timestamp, information.getTimestamp()); assertEquals(injectedEvent.getId(), information.getEventId()); assertEquals(EventCorrelationInjector.getRootIds(injectedEvent), information.getRootIds()); assertEquals(EventCorrelationInjector.getParentIds(injectedEvent), information.getParentIds()); assertEquals(EventCorrelationInjector.getSourceComponentName(injectedEvent), information.getComponentName()); assertEquals(TEST_COMPONENT_NAME, information.getComponentName()); assertEquals(TEST_STREAM_ID, information.getStreamId()); assertEquals(Sets.newHashSet(TEST_TARGET_COMPONENT_NAME, TEST_TARGET_COMPONENT_NAME_2), information.getTargetComponents()); }
public EventInformation build(long timestamp, String componentName, String streamId, Set<String> targetComponents, StreamlineEvent event) { String sourceComponentName = EventCorrelationInjector.getSourceComponentName(event); if (!componentName.equals(sourceComponentName)) { throw new IllegalStateException("component name in event correlation is different from provided component name"); } return new EventInformation(timestamp, componentName, streamId, targetComponents, event.getId(), EventCorrelationInjector.getRootIds(event), EventCorrelationInjector.getParentIds(event), event); }
EventInformationBuilder { public EventInformation build(long timestamp, String componentName, String streamId, Set<String> targetComponents, StreamlineEvent event) { String sourceComponentName = EventCorrelationInjector.getSourceComponentName(event); if (!componentName.equals(sourceComponentName)) { throw new IllegalStateException("component name in event correlation is different from provided component name"); } return new EventInformation(timestamp, componentName, streamId, targetComponents, event.getId(), EventCorrelationInjector.getRootIds(event), EventCorrelationInjector.getParentIds(event), event); } }
EventInformationBuilder { public EventInformation build(long timestamp, String componentName, String streamId, Set<String> targetComponents, StreamlineEvent event) { String sourceComponentName = EventCorrelationInjector.getSourceComponentName(event); if (!componentName.equals(sourceComponentName)) { throw new IllegalStateException("component name in event correlation is different from provided component name"); } return new EventInformation(timestamp, componentName, streamId, targetComponents, event.getId(), EventCorrelationInjector.getRootIds(event), EventCorrelationInjector.getParentIds(event), event); }  }
EventInformationBuilder { public EventInformation build(long timestamp, String componentName, String streamId, Set<String> targetComponents, StreamlineEvent event) { String sourceComponentName = EventCorrelationInjector.getSourceComponentName(event); if (!componentName.equals(sourceComponentName)) { throw new IllegalStateException("component name in event correlation is different from provided component name"); } return new EventInformation(timestamp, componentName, streamId, targetComponents, event.getId(), EventCorrelationInjector.getRootIds(event), EventCorrelationInjector.getParentIds(event), event); }  EventInformation build(long timestamp, String componentName, String streamId, Set<String> targetComponents,
                                  StreamlineEvent event); }
EventInformationBuilder { public EventInformation build(long timestamp, String componentName, String streamId, Set<String> targetComponents, StreamlineEvent event) { String sourceComponentName = EventCorrelationInjector.getSourceComponentName(event); if (!componentName.equals(sourceComponentName)) { throw new IllegalStateException("component name in event correlation is different from provided component name"); } return new EventInformation(timestamp, componentName, streamId, targetComponents, event.getId(), EventCorrelationInjector.getRootIds(event), EventCorrelationInjector.getParentIds(event), event); }  EventInformation build(long timestamp, String componentName, String streamId, Set<String> targetComponents,
                                  StreamlineEvent event);  }