@Test public void resolveProcessorIterationStrategyRoot() throws Exception { Processor hello = wfBundle.getMainWorkflow().getProcessors() .getByName("Hello"); assertSame(hello.getIterationStrategyStack().get(0), uriTools.resolveUri(HELLO_URI.resolve("iterationstrategy/0/"), wfBundle)); }
@Test public void resolveProcessorIterationStrategy() throws Exception { Processor hello = wfBundle.getMainWorkflow().getProcessors() .getByName("Hello"); assertSame(hello.getIterationStrategyStack().get(0), uriTools.resolveUri( HELLO_URI.resolve("iterationstrategy/0/"), wfBundle)); }
@Test public void uriForIterationStrategyRoot() throws Exception { Processor hello = wfBundle.getMainWorkflow().getProcessors() .getByName("Hello"); URI uri = uriTools.uriForBean(hello.getIterationStrategyStack().get(0)); assertEquals(HELLO_URI + "iterationstrategy/0/", uri.toASCIIString()); }
@Test public void resolveProcessorIterationStrategyNode() throws Exception { Processor hello = wfBundle.getMainWorkflow().getProcessors() .getByName("Hello"); CrossProduct rootStrategyNode = (CrossProduct) hello .getIterationStrategyStack().get(0); assertSame(rootStrategyNode.get(0), uriTools.resolveUri( HELLO_URI.resolve("iterationstrategy/0/0/"), wfBundle)); }
@Test public void uriForIterationStrategyCross() throws Exception { Processor hello = wfBundle.getMainWorkflow().getProcessors() .getByName("Hello"); CrossProduct crossProduct = (CrossProduct) hello .getIterationStrategyStack().get(0); URI uri = uriTools.uriForBean(crossProduct.get(0)); assertEquals(HELLO_URI + "iterationstrategy/0/0/", uri.toASCIIString()); }
@Test public void simpleCrossProduct() throws Exception { assertEquals(1, coloursLisr.getIterationStrategyStack().size()); IterationStrategyTopNode top = coloursLisr.getIterationStrategyStack().get(0); assertTrue(top instanceof CrossProduct); assertEquals(1, top.size()); IterationStrategyNode node = top.get(0); assertTrue(node instanceof PortNode); PortNode portNode = (PortNode) node; assertEquals(0, portNode.getDesiredDepth().intValue()); assertEquals(coloursLisr.getInputPorts().getByName("string"), portNode.getInputProcessorPort()); }
@Test public void iterationStrategy() throws Exception { Processor hello = workflowBundle.getMainWorkflow().getProcessors() .getByName("Hello"); assertEquals(1, hello.getIterationStrategyStack().size()); IterationStrategyTopNode iterationStrategyTopNode = hello .getIterationStrategyStack().get(0); assertTrue(iterationStrategyTopNode instanceof CrossProduct); CrossProduct cross = (CrossProduct) iterationStrategyTopNode; assertEquals(1, cross.size()); PortNode portNode = (PortNode) cross.get(0); assertEquals(hello.getInputPorts().getByName("name"), portNode.getInputProcessorPort()); assertEquals(0, portNode.getDesiredDepth().intValue()); }
@Test public void simpleDot() throws Exception { assertEquals(1, concat.getIterationStrategyStack().size()); IterationStrategyTopNode top = concat.getIterationStrategyStack().get(0); assertTrue(top instanceof DotProduct); assertEquals(2, top.size()); IterationStrategyNode node1 = top.get(0); assertTrue(node1 instanceof PortNode); PortNode portNode1 = (PortNode) node1; assertEquals(0, portNode1.getDesiredDepth().intValue()); assertEquals(concat.getInputPorts().getByName("string1"), portNode1.getInputProcessorPort()); IterationStrategyNode node2 = top.get(1); assertTrue(node2 instanceof PortNode); PortNode portNode2 = (PortNode) node2; assertEquals(0, portNode2.getDesiredDepth().intValue()); assertEquals(concat.getInputPorts().getByName("string2"), portNode2.getInputProcessorPort()); assertEquals(concat.getInputPorts().getByName("string2"), portNode2.getInputProcessorPort()); }
@Test public void crossAndDot() throws Exception { assertEquals(1, shape.getIterationStrategyStack().size()); IterationStrategyTopNode top = shape.getIterationStrategyStack().get(0); assertTrue(top instanceof CrossProduct); assertEquals(2, top.size()); IterationStrategyNode node1 = top.get(0); assertTrue(node1 instanceof PortNode); PortNode portNode1 = (PortNode) node1; assertEquals(0, portNode1.getDesiredDepth().intValue()); assertEquals(shape.getInputPorts().getByName("string1"), portNode1.getInputProcessorPort()); IterationStrategyNode node2 = top.get(1); assertTrue(node2 instanceof DotProduct); DotProduct portNode2 = (DotProduct) node2; // Note: string3 before string2 IterationStrategyNode node21 = portNode2.get(0); assertTrue(node21 instanceof PortNode); PortNode portNode21 = (PortNode) node21; assertEquals(0, portNode21.getDesiredDepth().intValue()); assertEquals(shape.getInputPorts().getByName("string3"), portNode21.getInputProcessorPort()); IterationStrategyNode node22 = portNode2.get(1); assertTrue(node22 instanceof PortNode); PortNode portNode22 = (PortNode) node22; assertEquals(0, portNode22.getDesiredDepth().intValue()); assertEquals(shape.getInputPorts().getByName("string2"), portNode22.getInputProcessorPort()); }