Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
public void testHistoryBotRemover() {
Fields pageViewFields = new Fields("id", "pageViewId", "path", "campaignTag", "sessionId", "userId", "remoteHost",
Fields sessionFields = new Fields("sessionId", "campaignTag");
TupleInputTap campaignPageViewsTap = new TupleInputTap("campaignPageViewsTap",
new Tuple(0L, "0", "/foo", "bar", 0L, 0L, "", ""),
new Tuple(3L, "3", "/foo", "bar", 1L, 0L, "", ""),
AvroInMemoryInputTap<UserEvent> userEventsTap = new AvroInMemoryInputTap<UserEvent>(UserEvent.getClassSchema(),
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));
Set<Tuple> expectedPageViews = Sets.newHashSet(
new Tuple(0L, "0", "/foo", "bar", 0L, 0L, "", ""));
assertEquals(expectedPageViews, nonBotPageViewsTap.getResults());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment