@Override public Set<OutputActivityPort> getActivityOutputPorts(URI activityType, JsonNode configuration) throws ActivityNotFoundException, ActivityConfigurationException { Set<OutputActivityPort> outputPorts = new HashSet<>(); try { for (ActivityOutputPort port : getActivityFactory(activityType) .getOutputPorts(configuration)) { OutputActivityPort outputActivityPort = new OutputActivityPort(); outputActivityPort.setName(port.getName()); outputActivityPort.setDepth(port.getDepth()); outputActivityPort.setGranularDepth(port.getGranularDepth()); outputPorts.add(outputActivityPort); } } catch (org.apache.taverna.workflowmodel.processor.activity.ActivityConfigurationException e) { throw new ActivityConfigurationException(e); } return outputPorts; }
OutputActivityPort outputPort = new OutputActivityPort(); outputPort.setName(getPortElement(portBean, "name", String.class)); outputPort.setParent(activity);
if (outputActivityPort == null) { outputActivityPort = new OutputActivityPort(); outputActivityPort.setName(fromActivityOutput); outputActivityPort.setParent(parserState.get() .getCurrentActivity());
oap.setDepth(new Integer(0)); oap.setGranularDepth(new Integer(1)); oap.setName("fred"); oap.setParent(null);
@Test public void testCorrectnessOfGranularDepthSpecifiedIncorrectly() { OutputActivityPort oap = new OutputActivityPort(); oap.setDepth(new Integer(3)); oap.setGranularDepth(new Integer(-2)); oap.setName("fred"); oap.setParent(null); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(oap, false, rcvl); Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems(); assertEquals(1, negativeValueProblems.size()); if (!negativeValueProblems.isEmpty()) { NegativeValueProblem problem = negativeValueProblems.iterator().next(); assertEquals(problem.getBean(), oap); assertEquals(problem.getFieldName(), "granularDepth"); assertEquals(problem.getFieldValue(), Integer.valueOf("-2")); } Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); assertEquals(0, nullFieldProblems.size()); // only done when completeness check assertEquals(0, rcvl.getIncompatibleGranularDepthProblems().size()); }
@Test public void testCorrectnessOfMissingGranularDepth() { OutputActivityPort oap = new OutputActivityPort(); oap.setDepth(new Integer(3)); oap.setGranularDepth(null); oap.setName("fred"); oap.setParent(null); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(oap, false, rcvl); Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems(); assertEquals(0, negativeValueProblems.size()); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); assertEquals(0, nullFieldProblems.size()); // only done when completeness check assertEquals(0, rcvl.getIncompatibleGranularDepthProblems().size()); }
protected void parseOutputActivityPort( org.apache.taverna.scufl2.xml.OutputActivityPort original) { OutputActivityPort port = new OutputActivityPort(); mapBean(original.getAbout(), port); port.setParent(getParserState().getCurrent(Activity.class)); port.setName(original.getName()); if (original.getPortDepth() != null) port.setDepth(original.getPortDepth().getValue()); if (original.getGranularPortDepth() != null) port.setGranularDepth(original.getGranularPortDepth().getValue()); }
oap.setDepth(new Integer(3)); oap.setGranularDepth(new Integer(-2)); oap.setName("fred"); oap.setParent(null);
@Test public void testCompletenessOfMissingGranularDepth() { OutputActivityPort oap = new OutputActivityPort(); oap.setDepth(new Integer(3)); oap.setGranularDepth(null); oap.setName("fred"); oap.setParent(null); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(oap, true, rcvl); Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems(); assertEquals(0, negativeValueProblems.size()); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); assertEquals(2, nullFieldProblems.size()); // granular depth and parent boolean granularDepthFieldProblem = false; for (NullFieldProblem nlp : nullFieldProblems) { if (nlp.getBean().equals(oap) && nlp.getFieldName().equals("granularDepth")) { granularDepthFieldProblem = true; } } assertTrue(granularDepthFieldProblem); assertEquals(0, rcvl.getIncompatibleGranularDepthProblems().size()); }