use of edu.snu.mist.common.windows.CountWindowInformation in project mist by snuspl.
the class ContinuousStreamTest method testJoinOperatorStream.
/**
* Test for join operation.
*/
@Test
public void testJoinOperatorStream() throws InjectionException, IOException, ClassNotFoundException {
final ContinuousStream<String> firstInputStream = queryBuilder.socketTextStream(TestParameters.LOCAL_TEXT_SOCKET_SOURCE_CONF);
final ContinuousStream<String> secondInputStream = queryBuilder.socketTextStream(TestParameters.LOCAL_TEXT_SOCKET_SOURCE_CONF);
final MISTBiPredicate<String, String> joinBiPred = (string1, string2) -> string1.equals(string2);
final WindowedStream<Tuple2<String, String>> joinedStream = firstInputStream.join(secondInputStream, joinBiPred, new CountWindowInformation(5, 3));
final Map<String, String> conf = joinedStream.getConfiguration();
Assert.assertEquals(SerializeUtils.serializeToString(joinBiPred), conf.get(ConfKeys.OperatorConf.UDF_STRING.name()));
// Check first input -> mapped
final MISTQuery query = queryBuilder.build();
final DAG<MISTStream, MISTEdge> dag = query.getDAG();
final MISTStream firstMappedInputStream = getNextOperatorStream(dag, 1, firstInputStream, new MISTEdge(Direction.LEFT));
// Check second input -> mapped
final MISTStream secondMappedInputStream = getNextOperatorStream(dag, 1, secondInputStream, new MISTEdge(Direction.LEFT));
// Check two mapped input -> unified
final MISTStream firstUnifiedStream = getNextOperatorStream(dag, 1, firstMappedInputStream, new MISTEdge(Direction.LEFT));
final MISTStream secondUnifiedStream = getNextOperatorStream(dag, 1, secondMappedInputStream, new MISTEdge(Direction.RIGHT));
Assert.assertEquals(firstUnifiedStream, secondUnifiedStream);
// Check unified stream -> windowed
final MISTStream windowedStream = getNextOperatorStream(dag, 1, firstUnifiedStream, new MISTEdge(Direction.LEFT));
// Check windowed stream -> joined
checkEdges(dag, 1, windowedStream, joinedStream, new MISTEdge(Direction.LEFT));
}
use of edu.snu.mist.common.windows.CountWindowInformation in project mist by snuspl.
the class ContinuousStreamTest method testCountWindowedStream.
/**
* Test for creating count-based WindowedStream from ContinuousStream.
*/
@Test
public void testCountWindowedStream() throws InjectionException {
/* Creates a test windowed stream containing 5000 inputs and emits windowed stream every 1000 inputs */
final WindowedStream<Tuple2<String, Integer>> countWindowedStream = filteredMappedStream.window(new CountWindowInformation(windowSize, windowEmissionInterval));
checkSizeBasedWindowInfo(windowSize, windowEmissionInterval, countWindowedStream.getConfiguration());
// Check map -> countWindow
checkEdges(queryBuilder.build().getDAG(), 1, filteredMappedStream, countWindowedStream, new MISTEdge(Direction.LEFT));
}
Aggregations