public void testBasic() { NamedInputPortNode nipn = new NamedInputPortNode("Input", 0); DiagnosticIterationStrategyNode disn = new DiagnosticIterationStrategyNode(); nipn.setParent(disn); IterationStrategyImpl is = new IterationStrategyImpl(); is.addInput(nipn); try { is.receiveData("Input", "Process1", new int[]{}, nextID(), context); } catch (WorkflowStructureException e) { fail("Should be able to find input named 'Input' in this test case"); } assertTrue(disn.jobsReceived("Process1") == 1); }
public boolean containsJob(String owningProcess, int[] jobIndex) { List<IterationInternalEvent> jobs = ownerToJobList.get(owningProcess); if (jobs == null) { return false; } for (IterationInternalEvent w : jobs) { if (w instanceof Job) { Job j = (Job)w; if (compareArrays(j.getIndex(), jobIndex) && j.getOwningProcess().equals(owningProcess)) { return true; } } } return false; }
nipn1.setParent(cp); nipn2.setParent(cp); DiagnosticIterationStrategyNode disn = new DiagnosticIterationStrategyNode(); cp.setParent(disn); IterationStrategyImpl is = new IterationStrategyImpl(); try { is.receiveData("Input1", "Process1", new int[] {0}, nextID(), context); assertTrue(disn.jobsReceived("Process1") == 0); is.receiveData("Input1", "Process1", new int[] {1}, nextID(), context); assertTrue(disn.jobsReceived("Process1") == 0); is.receiveData("Input1", "Process1", new int[] {2}, nextID(), context); assertTrue(disn.jobsReceived("Process1") == 0); is.receiveCompletion("Input1", "Process1", new int[]{}, context); is.receiveData("Input2", "Process1", new int[] {0}, nextID(), context); System.out.println(disn); assertTrue(disn.jobsReceived("Process1") == 3); assertTrue(disn.containsJob("Process1", new int[]{0,0})); assertTrue(disn.containsJob("Process1", new int[]{1,0})); assertTrue(disn.containsJob("Process1", new int[]{2,0})); is.receiveData("Input2", "Process1", new int[] {1}, nextID(), context); is.receiveCompletion("Input2", "Process1", new int[]{}, context); System.out.println(disn); assertTrue(disn.jobsReceived("Process1") == 6); } catch (WorkflowStructureException e) { fail("Unknown structure exception");
public void testMultipleProcesses() { NamedInputPortNode nipn = new NamedInputPortNode("Input", 0); DiagnosticIterationStrategyNode disn = new DiagnosticIterationStrategyNode(); nipn.setParent(disn); IterationStrategyImpl is = new IterationStrategyImpl(); is.addInput(nipn); try { is.receiveData("Input", "Process1", new int[]{0}, nextID(), context); is.receiveData("Input", "Process1", new int[]{1}, nextID(), context); is.receiveData("Input", "Process2", new int[]{}, nextID(), context); } catch (WorkflowStructureException e) { fail("Should be able to find input named 'Input' in this test case"); } assertTrue(disn.jobsReceived("Process1") == 2); assertTrue(disn.jobsReceived("Process2") == 1); }
public void testMultipleProcess() { NamedInputPortNode nipn1 = new NamedInputPortNode("Input1", 0); NamedInputPortNode nipn2 = new NamedInputPortNode("Input2", 0); DotProduct dp = new DotProduct(); nipn1.setParent(dp); nipn2.setParent(dp); DiagnosticIterationStrategyNode disn = new DiagnosticIterationStrategyNode(); dp.setParent(disn); IterationStrategyImpl is = new IterationStrategyImpl(); is.addInput(nipn1); is.addInput(nipn2); try { is.receiveData("Input1", "Process1", new int[] {}, nextID(), context); assertTrue(disn.jobsReceived("Process1") == 0); is.receiveCompletion("Input1", "Process1", new int[]{}, context); is.receiveData("Input2", "Process2", new int[] {}, nextID(), context); assertTrue(disn.jobsReceived("Process1") == 0); is.receiveData("Input2", "Process1", new int[] {}, nextID(), context); assertTrue(disn.jobsReceived("Process1") == 1); is.receiveCompletion("Input2", "Process1", new int[]{}, context); System.out.println(disn); } catch (WorkflowStructureException e) { fail("Unknown structure exception"); } }
public void testBasic() { NamedInputPortNode nipn1 = new NamedInputPortNode("Input1", 0); NamedInputPortNode nipn2 = new NamedInputPortNode("Input2", 0); DotProduct dp = new DotProduct(); nipn1.setParent(dp); nipn2.setParent(dp); DiagnosticIterationStrategyNode disn = new DiagnosticIterationStrategyNode(); dp.setParent(disn); IterationStrategyImpl is = new IterationStrategyImpl(); is.addInput(nipn1); is.addInput(nipn2); try { is.receiveData("Input1", "Process1", new int[] {0}, nextID(), context); is.receiveCompletion("Input1", "Process1", new int[]{}, context); assertTrue(disn.jobsReceived("Process1") == 0); is.receiveData("Input2", "Process1", new int[] {0}, nextID(), context); is.receiveCompletion("Input2", "Process1", new int[]{}, context); assertTrue(disn.jobsReceived("Process1") == 1); System.out.println(disn); } catch (WorkflowStructureException e) { fail("Unknown structure exception"); } }
public void testMutipleData() throws MalformedIdentifierException { NamedInputPortNode nipn1 = new NamedInputPortNode("a", 0); NamedInputPortNode nipn2 = new NamedInputPortNode("b", 0); DotProduct dp = new DotProduct(); nipn1.setParent(dp); nipn2.setParent(dp); DiagnosticIterationStrategyNode disn = new DiagnosticIterationStrategyNode(); dp.setParent(disn); IterationStrategyImpl is = new IterationStrategyImpl(); is.addInput(nipn1); is.addInput(nipn2); String owningProcess = "Process1"; for (int i = 0; i < 4; i++) { EntityListIdentifier dataReference = new EntityListIdentifier("urn:t2data:list://foo.bar/alist"+i+"/1"); is.receiveData("a", owningProcess, new int[]{i}, dataReference, context); } is.receiveCompletion("a", owningProcess, new int[]{}, context); for (int i = 0; i < 4; i++) { EntityListIdentifier dataReference = new EntityListIdentifier("urn:t2data:list://foo.bar/blist"+i+"/1"); is.receiveData("b", owningProcess, new int[]{i}, dataReference, context); } is.receiveCompletion("b", owningProcess, new int[]{}, context); assertTrue(disn.jobsReceived("Process1")==4); System.out.println(disn); }
nipn1.setParent(pdp); nipn2.setParent(pdp); DiagnosticIterationStrategyNode disn = new DiagnosticIterationStrategyNode(); pdp.setParent(disn); IterationStrategyImpl is = new IterationStrategyImpl(); assertTrue(disn.jobsReceived("Process1") == 4); System.out.println(disn);