use of org.apache.storm.windowing.TupleWindow in project storm by apache.
the class TestJoinBolt method testThreeStreamLeftJoin_2.
@Test
public void testThreeStreamLeftJoin_2() throws Exception {
ArrayList<Tuple> userStream = makeStream("users", userFields, users, "usersSpout");
ArrayList<Tuple> storesStream = makeStream("stores", storeFields, stores, "storesSpout");
ArrayList<Tuple> cityStream = makeStream("cities", cityFields, cities, "citiesSpout");
TupleWindow window = makeTupleWindow(userStream, cityStream, storesStream);
JoinBolt bolt = new JoinBolt(JoinBolt.Selector.STREAM, "users", "city").leftJoin("stores", "city", "users").leftJoin("cities", "cityName", // join against diff stream compared to testThreeStreamLeftJoin_1
"stores").select("name,storeName,city,country");
MockCollector collector = new MockCollector();
bolt.prepare(null, null, collector);
bolt.execute(window);
printResults(collector);
// stores.length+1 as 2 users in Bengaluru
Assert.assertEquals(stores.length + 1, collector.actualResults.size());
}
use of org.apache.storm.windowing.TupleWindow in project storm by apache.
the class TestJoinBolt method testThreeStreamInnerJoin.
@Test
public void testThreeStreamInnerJoin() throws Exception {
ArrayList<Tuple> userStream = makeStream("users", userFields, users, "usersSpout");
ArrayList<Tuple> storesStream = makeStream("stores", storeFields, stores, "storesSpout");
ArrayList<Tuple> cityStream = makeStream("cities", cityFields, cities, "citiesSpout");
TupleWindow window = makeTupleWindow(userStream, storesStream, cityStream);
JoinBolt bolt = new JoinBolt(JoinBolt.Selector.STREAM, "users", userFields[2]).join("stores", "city", "users").join("cities", "cityName", "stores").select("name,storeName,city,country");
MockCollector collector = new MockCollector();
bolt.prepare(null, null, collector);
bolt.execute(window);
printResults(collector);
Assert.assertEquals(6, collector.actualResults.size());
}
Aggregations