Search in sources :

Example 1 with RecoverableInputOperator

use of com.datatorrent.stram.engine.RecoverableInputOperator in project apex-core by apache.

the class OiOStreamTest method validatePositiveOiOOptionalInput.

@Test
public void validatePositiveOiOOptionalInput() {
    LogicalPlan plan = new LogicalPlan();
    RecoverableInputOperator inputOp1 = plan.addOperator("InputOperator1", new RecoverableInputOperator());
    GenericOperator genOp = plan.addOperator("GenericOperator", new GenericOperator());
    plan.addStream("OiO1", inputOp1.output, genOp.ip1).setLocality(Locality.THREAD_LOCAL);
    try {
        plan.validate();
        Assert.assertTrue("OiO validation", true);
    } catch (ConstraintViolationException ex) {
        Assert.fail("OiO Single Connected InputPort");
    }
}
Also used : RecoverableInputOperator(com.datatorrent.stram.engine.RecoverableInputOperator) ConstraintViolationException(javax.validation.ConstraintViolationException) LogicalPlan(com.datatorrent.stram.plan.logical.LogicalPlan) GenericOperator(com.datatorrent.stram.engine.GenericNodeTest.GenericOperator) Test(org.junit.Test)

Example 2 with RecoverableInputOperator

use of com.datatorrent.stram.engine.RecoverableInputOperator in project apex-core by apache.

the class OiOStreamTest method validateNegativeOiO.

@Test
public void validateNegativeOiO() {
    LogicalPlan plan = new LogicalPlan();
    RecoverableInputOperator inputOp1 = plan.addOperator("InputOperator1", new RecoverableInputOperator());
    RecoverableInputOperator inputOp2 = plan.addOperator("InputOperator2", new RecoverableInputOperator());
    GenericOperator genOp = plan.addOperator("GenericOperator", new GenericOperator());
    StreamMeta oio1 = plan.addStream("OiO1", inputOp1.output, genOp.ip1).setLocality(Locality.THREAD_LOCAL);
    StreamMeta oio2 = plan.addStream("OiO2", inputOp2.output, genOp.ip2).setLocality(Locality.THREAD_LOCAL);
    try {
        plan.validate();
        Assert.fail("OIO Both InputPorts");
    } catch (ConstraintViolationException ex) {
        Assert.assertTrue("OiO validation passed", true);
    } catch (ValidationException ex) {
        Assert.assertTrue("OiO validation passed", true);
    }
    oio1.setLocality(null);
    try {
        plan.validate();
        Assert.fail("OIO First InputPort");
    } catch (ConstraintViolationException ex) {
        Assert.assertTrue("OiO validation passed", true);
    } catch (ValidationException ex) {
        Assert.assertTrue("OiO validation passed", true);
    }
    oio1.setLocality(Locality.THREAD_LOCAL);
    oio2.setLocality(null);
    try {
        plan.validate();
        Assert.fail("OIO Second InputPort");
    } catch (ConstraintViolationException ex) {
        Assert.assertTrue("OiO validation passed", true);
    } catch (ValidationException ex) {
        Assert.assertTrue("OiO validation passed", true);
    }
}
Also used : RecoverableInputOperator(com.datatorrent.stram.engine.RecoverableInputOperator) StreamMeta(com.datatorrent.stram.plan.logical.LogicalPlan.StreamMeta) ValidationException(javax.validation.ValidationException) ConstraintViolationException(javax.validation.ConstraintViolationException) LogicalPlan(com.datatorrent.stram.plan.logical.LogicalPlan) GenericOperator(com.datatorrent.stram.engine.GenericNodeTest.GenericOperator) Test(org.junit.Test)

Example 3 with RecoverableInputOperator

use of com.datatorrent.stram.engine.RecoverableInputOperator in project apex-core by apache.

the class OiOStreamTest method validatePositiveOiO.

@Test
public void validatePositiveOiO() {
    logger.info("Checking the logic for sanity checking of OiO");
    LogicalPlan plan = new LogicalPlan();
    RecoverableInputOperator inputOperator = plan.addOperator("IntegerGenerator", new RecoverableInputOperator());
    CollectorOperator outputOperator = plan.addOperator("IntegerCollector", new CollectorOperator());
    plan.addStream("PossibleOiO", inputOperator.output, outputOperator.input).setLocality(Locality.THREAD_LOCAL);
    try {
        plan.validate();
        Assert.assertTrue("OiO validation", true);
    } catch (ConstraintViolationException ex) {
        Assert.fail("OIO Single InputPort");
    }
}
Also used : RecoverableInputOperator(com.datatorrent.stram.engine.RecoverableInputOperator) CollectorOperator(com.datatorrent.stram.engine.ProcessingModeTests.CollectorOperator) ConstraintViolationException(javax.validation.ConstraintViolationException) LogicalPlan(com.datatorrent.stram.plan.logical.LogicalPlan) Test(org.junit.Test)

Aggregations

RecoverableInputOperator (com.datatorrent.stram.engine.RecoverableInputOperator)3 LogicalPlan (com.datatorrent.stram.plan.logical.LogicalPlan)3 ConstraintViolationException (javax.validation.ConstraintViolationException)3 Test (org.junit.Test)3 GenericOperator (com.datatorrent.stram.engine.GenericNodeTest.GenericOperator)2 CollectorOperator (com.datatorrent.stram.engine.ProcessingModeTests.CollectorOperator)1 StreamMeta (com.datatorrent.stram.plan.logical.LogicalPlan.StreamMeta)1 ValidationException (javax.validation.ValidationException)1