use of com.datatorrent.stram.stream.OiOEndWindowTest.TestInputOperator in project apex-core by apache.
the class OutputUnifiedTest method testManyToOnePartition.
@Test
public void testManyToOnePartition() throws Exception {
TestInputOperator i1 = new TestInputOperator();
dag.addOperator("i1", i1);
GenericTestOperator op1 = new GenericTestOperator();
dag.addOperator("op1", op1);
dag.setOperatorAttribute(op1, OperatorContext.PARTITIONER, new StatelessPartitioner<GenericTestOperator>(3));
TestOutputOperator op2 = new TestOutputOperator();
dag.addOperator("op2", op2);
dag.addStream("s1", i1.output, op1.inport1);
dag.addStream("s2", op1.outport1, op2.inport);
StreamingContainerManager scm = new StreamingContainerManager(dag);
PhysicalPlan physicalPlan = scm.getPhysicalPlan();
List<PTContainer> containers = physicalPlan.getContainers();
Assert.assertEquals("Number of containers", 5, containers.size());
assignContainers(scm, containers);
testOutputAttribute(dag, i1, scm, physicalPlan, false);
testOutputAttribute(dag, op1, scm, physicalPlan, true);
}
use of com.datatorrent.stram.stream.OiOEndWindowTest.TestInputOperator in project apex-core by apache.
the class OutputUnifiedTest method testMxNPartition.
@Test
public void testMxNPartition() throws Exception {
TestInputOperator i1 = new TestInputOperator();
dag.addOperator("i1", i1);
GenericTestOperator op1 = new GenericTestOperator();
dag.addOperator("op1", op1);
dag.setOperatorAttribute(op1, OperatorContext.PARTITIONER, new StatelessPartitioner<GenericTestOperator>(3));
TestOutputOperator op2 = new TestOutputOperator();
dag.addOperator("op2", op2);
dag.setOperatorAttribute(op2, OperatorContext.PARTITIONER, new StatelessPartitioner<GenericTestOperator>(2));
dag.addStream("s1", i1.output, op1.inport1);
dag.addStream("s2", op1.outport1, op2.inport);
StreamingContainerManager scm = new StreamingContainerManager(dag);
PhysicalPlan physicalPlan = scm.getPhysicalPlan();
List<PTContainer> containers = physicalPlan.getContainers();
Assert.assertEquals("Number of containers", 6, containers.size());
assignContainers(scm, containers);
testOutputAttribute(dag, i1, scm, physicalPlan, false);
testOutputAttribute(dag, op1, scm, physicalPlan, true);
}
use of com.datatorrent.stram.stream.OiOEndWindowTest.TestInputOperator in project apex-core by apache.
the class OutputUnifiedTest method testParallelPartition.
@Test
public void testParallelPartition() throws Exception {
TestInputOperator i1 = new TestInputOperator();
dag.addOperator("i1", i1);
dag.setOperatorAttribute(i1, OperatorContext.PARTITIONER, new StatelessPartitioner<GenericTestOperator>(2));
GenericTestOperator op1 = new GenericTestOperator();
dag.addOperator("op1", op1);
dag.setInputPortAttribute(op1.inport1, PortContext.PARTITION_PARALLEL, true);
TestOutputOperator op2 = new TestOutputOperator();
dag.addOperator("op2", op2);
dag.addStream("s1", i1.output, op1.inport1);
dag.addStream("s2", op1.outport1, op2.inport);
StreamingContainerManager scm = new StreamingContainerManager(dag);
PhysicalPlan physicalPlan = scm.getPhysicalPlan();
List<PTContainer> containers = physicalPlan.getContainers();
Assert.assertEquals("Number of containers", 5, containers.size());
assignContainers(scm, containers);
testOutputAttribute(dag, i1, scm, physicalPlan, false);
testOutputAttribute(dag, op1, scm, physicalPlan, true);
}
Aggregations