Search in sources :

Example 31 with StreamMeta

use of com.datatorrent.stram.plan.logical.LogicalPlan.StreamMeta in project apex-core by apache.

the class LogicalPlanTest method testLocalityValidation.

@Test
public void testLocalityValidation() {
    TestGeneratorInputOperator input1 = dag.addOperator("input1", TestGeneratorInputOperator.class);
    GenericTestOperator o1 = dag.addOperator("o1", GenericTestOperator.class);
    StreamMeta s1 = dag.addStream("input1.outport", input1.outport, o1.inport1).setLocality(Locality.THREAD_LOCAL);
    dag.validate();
    TestGeneratorInputOperator input2 = dag.addOperator("input2", TestGeneratorInputOperator.class);
    dag.addStream("input2.outport", input2.outport, o1.inport2);
    try {
        dag.validate();
        Assert.fail("Exception expected for " + o1);
    } catch (ValidationException ve) {
        Assert.assertThat("", ve.getMessage(), RegexMatcher.matches("Locality THREAD_LOCAL invalid for operator .* with multiple input streams .*"));
    }
    s1.setLocality(null);
    dag.validate();
}
Also used : StreamMeta(com.datatorrent.stram.plan.logical.LogicalPlan.StreamMeta) ValidationException(javax.validation.ValidationException) GenericTestOperator(com.datatorrent.stram.engine.GenericTestOperator) TestGeneratorInputOperator(com.datatorrent.stram.engine.TestGeneratorInputOperator) Test(org.junit.Test)

Aggregations

StreamMeta (com.datatorrent.stram.plan.logical.LogicalPlan.StreamMeta)31 Test (org.junit.Test)17 InputPortMeta (com.datatorrent.stram.plan.logical.LogicalPlan.InputPortMeta)14 OperatorMeta (com.datatorrent.stram.plan.logical.LogicalPlan.OperatorMeta)13 Map (java.util.Map)10 GenericTestOperator (com.datatorrent.stram.engine.GenericTestOperator)9 LogicalPlan (com.datatorrent.stram.plan.logical.LogicalPlan)8 Integer2String (com.datatorrent.api.StringCodec.Integer2String)6 StramLocalCluster (com.datatorrent.stram.StramLocalCluster)6 OutputPortMeta (com.datatorrent.stram.plan.logical.LogicalPlan.OutputPortMeta)6 HashMap (java.util.HashMap)6 LinkedHashMap (java.util.LinkedHashMap)6 Configuration (org.apache.hadoop.conf.Configuration)6 MemoryStorageAgent (com.datatorrent.stram.support.StramTestSupport.MemoryStorageAgent)5 TestGeneratorInputOperator (com.datatorrent.stram.engine.TestGeneratorInputOperator)4 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 ValidationException (javax.validation.ValidationException)4 JSONObject (org.codehaus.jettison.json.JSONObject)4 Properties (java.util.Properties)3