use of com.datatorrent.stram.engine.GenericNodeTest.GenericOperator 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");
}
}
use of com.datatorrent.stram.engine.GenericNodeTest.GenericOperator 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);
}
}
Aggregations