@Override public void setParent(Processor parent) { if (this.parent == parent) { return; } if (this.parent != null && this.parent.getIterationStrategyStack() == this) { this.parent.setIterationStrategyStack(null); } this.parent = parent; if (parent != null && parent.getIterationStrategyStack() != this) { parent.setIterationStrategyStack(this); } }
@Test public void testCompletenessOfMissingIterationStrategyStack() { Processor p = new Processor(); p.setIterationStrategyStack(null); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(p, true, rcvl); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); assertFalse(nullFieldProblems.isEmpty()); boolean problem = false; for (NullFieldProblem nlp : nullFieldProblems) { if (nlp.getBean().equals(p) && nlp.getFieldName().equals("iterationStrategyStack")) { problem = true; } } assertTrue(problem); }
@Test public void testCorrectnessOfMissingIterationStrategyStack() { Processor p = new Processor(); p.setIterationStrategyStack(null); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(p, false, rcvl); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); assertEquals(Collections.EMPTY_SET, nullFieldProblems); // only done when completeness check }
p.setIterationStrategyStack(iss); CrossProduct cp = new CrossProduct(); iss.add(cp);
@Test public void testInScopeInputProcessorPort() { Processor p = new Processor(); InputProcessorPort ipp = new InputProcessorPort(); ipp.setParent(p); IterationStrategyStack iss = new IterationStrategyStack(); p.setIterationStrategyStack(iss); CrossProduct cp = new CrossProduct(); iss.add(cp); cp.setParent(iss); PortNode pn = new PortNode(); pn.setInputProcessorPort(ipp); cp.add(pn); pn.setParent(cp); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pn, false, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); assertEquals(Collections.EMPTY_SET, outOfScopeValueProblems); }