Search in sources :

Example 1 with TestInputOperator

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);
}
Also used : PhysicalPlan(com.datatorrent.stram.plan.physical.PhysicalPlan) GenericTestOperator(com.datatorrent.stram.engine.GenericTestOperator) PTContainer(com.datatorrent.stram.plan.physical.PTContainer) TestOutputOperator(com.datatorrent.stram.engine.TestOutputOperator) TestInputOperator(com.datatorrent.stram.stream.OiOEndWindowTest.TestInputOperator) Test(org.junit.Test)

Example 2 with TestInputOperator

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);
}
Also used : PhysicalPlan(com.datatorrent.stram.plan.physical.PhysicalPlan) GenericTestOperator(com.datatorrent.stram.engine.GenericTestOperator) PTContainer(com.datatorrent.stram.plan.physical.PTContainer) TestOutputOperator(com.datatorrent.stram.engine.TestOutputOperator) TestInputOperator(com.datatorrent.stram.stream.OiOEndWindowTest.TestInputOperator) Test(org.junit.Test)

Example 3 with TestInputOperator

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);
}
Also used : PhysicalPlan(com.datatorrent.stram.plan.physical.PhysicalPlan) GenericTestOperator(com.datatorrent.stram.engine.GenericTestOperator) PTContainer(com.datatorrent.stram.plan.physical.PTContainer) TestOutputOperator(com.datatorrent.stram.engine.TestOutputOperator) TestInputOperator(com.datatorrent.stram.stream.OiOEndWindowTest.TestInputOperator) Test(org.junit.Test)

Aggregations

GenericTestOperator (com.datatorrent.stram.engine.GenericTestOperator)3 TestOutputOperator (com.datatorrent.stram.engine.TestOutputOperator)3 PTContainer (com.datatorrent.stram.plan.physical.PTContainer)3 PhysicalPlan (com.datatorrent.stram.plan.physical.PhysicalPlan)3 TestInputOperator (com.datatorrent.stram.stream.OiOEndWindowTest.TestInputOperator)3 Test (org.junit.Test)3