Last active
December 23, 2015 13:49
-
-
Save adamcataldo/6644695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testHistoryBotRemover() { | |
Fields pageViewFields = new Fields("id", "pageViewId", "path", "campaignTag", "sessionId", "userId", "remoteHost", | |
"host"); | |
Fields sessionFields = new Fields("sessionId", "campaignTag"); | |
TupleInputTap campaignPageViewsTap = new TupleInputTap("campaignPageViewsTap", | |
pageViewFields, | |
new Tuple(0L, "0", "/foo", "bar", 0L, 0L, "1.1.1.1", "foo.bar.com"), | |
new Tuple(3L, "3", "/foo", "bar", 1L, 0L, "1.1.1.1", "foo.bar.com"), | |
AvroInMemoryInputTap<UserEvent> userEventsTap = new AvroInMemoryInputTap<UserEvent>(UserEvent.getClassSchema(), | |
userEvent().setId(0).setPageViewId("0").setCategory("pageload").build()); | |
TupleOutputTap nonBotPageViewsTap = new TupleOutputTap("nonBotPageViewsTap", pageViewFields); | |
TupleOutputTap nonBotSessionsTap = new TupleOutputTap("nonBotPageViewsTap", sessionFields); | |
nonBotPageViews = new HistoryBotRemover(campaignPageViews, userEvents); | |
Flow<Properties> flow = new LocalFlowConnector().connect(new FlowDef() | |
.addSource(campaignPageViews, campaignPageViewsTap) | |
.addSource(userEvents, userEventsTap) | |
.addTailSink(nonBotPageViews, nonBotPageViewsTap)); | |
flow.complete(); | |
Set<Tuple> expectedPageViews = Sets.newHashSet( | |
new Tuple(0L, "0", "/foo", "bar", 0L, 0L, "1.1.1.1", "foo.bar.com")); | |
assertEquals(expectedPageViews, nonBotPageViewsTap.getResults()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment