@Test public void crossProductEqualIfEmpty() throws Exception { CrossProduct crossProd1 = new CrossProduct(); CrossProduct crossProd2 = new CrossProduct(); assertEquals(crossProd1, crossProd2); }
@Test public void crossProductNotEqual() throws Exception { CrossProduct crossProd1 = new CrossProduct(); CrossProduct crossProd2 = new CrossProduct(); crossProd2.add(new PortNode()); assertNotEquals(crossProd1, crossProd2); }
@Test public void iterationStackNotEqualToCrossProduct() throws Exception { IterationStrategyStack itStack = new IterationStrategyStack(); CrossProduct crossProd = new CrossProduct(); assertNotEquals(itStack, crossProd); }
protected IterationStrategyNode parseIterationStrategyNode( IterationNode topNode) throws ReaderException { if (topNode instanceof PortProduct) { PortProduct portProduct = (PortProduct) topNode; PortNode portNode = new PortNode(); portNode.setDesiredDepth(portProduct.getDepth().intValue()); String name = portProduct.getName(); Processor processor = parserState.get().getCurrentProcessor(); InputProcessorPort inputProcessorPort = processor.getInputPorts() .getByName(name); portNode.setInputProcessorPort(inputProcessorPort); return portNode; } IterationStrategyNode node; if (topNode instanceof DotProduct) node = new org.apache.taverna.scufl2.api.iterationstrategy.DotProduct(); else if (topNode instanceof CrossProduct) node = new org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct(); else throw new ReaderException("Invalid node " + topNode); @SuppressWarnings("unchecked") List<IterationStrategyNode> children = (List<IterationStrategyNode>) node; IterationNodeParent parent = (IterationNodeParent) topNode; for (IterationNode child : parent.getCrossOrDotOrPort()) children.add(parseIterationStrategyNode(child)); return node; }
public IterationStrategyStack makeIterationStrategyStack( InputProcessorPort... inputs) { IterationStrategyStack stack = new IterationStrategyStack(); CrossProduct crossProduct = new CrossProduct(); crossProduct.setParent(stack); for (InputProcessorPort inp : inputs) { PortNode n = new PortNode(crossProduct, inp); n.setDesiredDepth(0); } return stack; }
@Test public void crossProductNotEqualToDotProduct() throws Exception { DotProduct dotProd = new DotProduct(); CrossProduct crossProd = new CrossProduct(); assertNotEquals(crossProd, dotProd); assertNotEquals(dotProd, crossProd); }
protected void parseCrossProduct(CrossProduct original) throws ReaderException { org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct cross = new org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct(); mapBean(getParserState().getCurrentBase().resolve(original.getAbout()), cross); cross.setParent(getParserState().getCurrent( IterationStrategyParent.class)); getParserState().push(cross); try { parseProductOf(original.getProductOf()); } finally { getParserState().pop(); } }
CrossProduct cp = new CrossProduct(); iss.add(cp); cp.setParent(iss);
private CrossProduct getCross(int depthA, int depthB) { a = new InputProcessorPort(); a.setName("a"); a.setDepth(0); CrossProduct cp = new CrossProduct(); PortNode nipn1 = new PortNode(cp, a); nipn1.setDesiredDepth(depthA); b = new InputProcessorPort(); b.setName("b"); b.setDepth(0); PortNode nipn2 = new PortNode(cp, b); nipn2.setDesiredDepth(depthB); return cp; }
private CrossProduct getCross(int depthA, int depthB) { a = new InputProcessorPort(); a.setName("a"); a.setDepth(0); CrossProduct cp = new CrossProduct(); PortNode nipn1 = new PortNode(cp, a); nipn1.setDesiredDepth(depthA); b = new InputProcessorPort(); b.setName("b"); b.setDepth(0); PortNode nipn2 = new PortNode(cp, b); nipn2.setDesiredDepth(depthB); return cp; }
@Test public void testSimpleIteration() { WorkflowBundle wb = new WorkflowBundle(); Workflow w = new Workflow(); wb.setMainWorkflow(w); InputWorkflowPort a = new InputWorkflowPort(w, "a"); a.setDepth(1); Processor p = new Processor(w, "p"); InputProcessorPort ipp = new InputProcessorPort(p, "in"); ipp.setDepth(0); OutputProcessorPort opp = new OutputProcessorPort(p, "out"); opp.setDepth(3); DataLink inLink = new DataLink(w, a, ipp); IterationStrategyStack iss = new IterationStrategyStack(p); CrossProduct cp = new CrossProduct(); iss.add(cp); PortNode portNode = new PortNode(cp, ipp); portNode.setDesiredDepth(0); StructuralValidator sv = new StructuralValidator(); ReportStructuralValidationListener l = new ReportStructuralValidationListener(); sv.checkStructure(wb, l); ValidatorState vs = sv.getValidatorState(); assertEquals(0, l.getIncompleteWorkflows().size()); assertEquals(Integer.valueOf(1), vs.getPortResolvedDepth(a)); assertEquals(Integer.valueOf(1), vs.getDataLinkResolvedDepth(inLink)); assertEquals(Integer.valueOf(1), vs.getPortResolvedDepth(ipp)); assertEquals(Integer.valueOf(4), vs.getPortResolvedDepth(opp)); }
p3.setParent(p); CrossProduct cp = new CrossProduct(); PortNode pNode1 = new PortNode(); pNode1.setInputProcessorPort(p1);
@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); }
CrossProduct cp = new CrossProduct(); PortNode pNode1 = new PortNode(); pNode1.setInputProcessorPort(p1);
CrossProduct cp = new CrossProduct(); PortNode pNode1 = new PortNode(); pNode1.setInputProcessorPort(p1);
p3.setParent(p); CrossProduct cp = new CrossProduct(); PortNode pNode1 = new PortNode(); pNode1.setInputProcessorPort(p1);
CrossProduct cp = new CrossProduct(); PortNode pNode1 = new PortNode(); pNode1.setInputProcessorPort(p1);