use of org.apache.hop.workflow.action.ActionMeta in project hop by apache.
the class WorkflowMetaTest method createAction.
private ActionMeta createAction(String name) {
IAction action = mock(IAction.class);
ActionMeta actionMeta = new ActionMeta(action);
when(actionMeta.getName()).thenReturn(name);
return actionMeta;
}
use of org.apache.hop.workflow.action.ActionMeta in project hop by apache.
the class WorkflowMetaTest method shouldUseCoordinatesOfItsTransformsAndNotesWhenCalculatingMinimumPoint.
@Test
public void shouldUseCoordinatesOfItsTransformsAndNotesWhenCalculatingMinimumPoint() {
Point actionPoint = new Point(500, 500);
Point notePadMetaPoint = new Point(400, 400);
ActionMeta actionMeta = mock(ActionMeta.class);
when(actionMeta.getLocation()).thenReturn(actionPoint);
NotePadMeta notePadMeta = mock(NotePadMeta.class);
when(notePadMeta.getLocation()).thenReturn(notePadMetaPoint);
// empty Workflow return 0 coordinate point
Point point = workflowMeta.getMinimum();
assertEquals(0, point.x);
assertEquals(0, point.y);
// when Workflow contains a single transform or note, then workflowMeta should return
// coordinates of it, subtracting borders
workflowMeta.addAction(0, actionMeta);
Point actualTransformPoint = workflowMeta.getMinimum();
assertEquals(actionPoint.x - WorkflowMeta.BORDER_INDENT, actualTransformPoint.x);
assertEquals(actionPoint.y - WorkflowMeta.BORDER_INDENT, actualTransformPoint.y);
// when Workflow contains transform or notes, then workflowMeta should return minimal
// coordinates of them, subtracting borders
workflowMeta.addNote(notePadMeta);
Point transformPoint = workflowMeta.getMinimum();
assertEquals(notePadMetaPoint.x - WorkflowMeta.BORDER_INDENT, transformPoint.x);
assertEquals(notePadMetaPoint.y - WorkflowMeta.BORDER_INDENT, transformPoint.y);
}
use of org.apache.hop.workflow.action.ActionMeta in project hop by apache.
the class WorkflowMetaTest method testPath.
private boolean testPath(String branch) {
ActionDummy je1 = new ActionDummy();
je1.setName("je1");
ActionDummy je2 = new ActionDummy();
je2.setName("je2");
WorkflowHopMeta hop = new WorkflowHopMeta(new ActionMeta(je1), new ActionMeta(je2));
workflowMeta.addWorkflowHop(hop);
ActionDummy je3 = new ActionDummy();
je3.setName("je3");
hop = new WorkflowHopMeta(new ActionMeta(je1), new ActionMeta(je3));
workflowMeta.addWorkflowHop(hop);
ActionDummy je4 = new ActionDummy();
je4.setName("je4");
hop = new WorkflowHopMeta(new ActionMeta(je3), new ActionMeta(je4));
workflowMeta.addWorkflowHop(hop);
if (branch.equals("je1-je4")) {
return workflowMeta.isPathExist(je1, je4);
} else if (branch.equals("je2-je4")) {
return workflowMeta.isPathExist(je2, je4);
} else {
return false;
}
}
use of org.apache.hop.workflow.action.ActionMeta in project hop by apache.
the class WorkflowMetaTest method testAddRemoveJobEntryCopySetUnsetParent.
@Test
public void testAddRemoveJobEntryCopySetUnsetParent() throws Exception {
ActionMeta actionCopy = mock(ActionMeta.class);
workflowMeta.addAction(actionCopy);
workflowMeta.removeAction(0);
verify(actionCopy, times(1)).setParentWorkflowMeta(workflowMeta);
verify(actionCopy, times(1)).setParentWorkflowMeta(null);
}
use of org.apache.hop.workflow.action.ActionMeta in project hop by apache.
the class WorkflowActionColumnsExistTest method setUp.
@Before
public void setUp() {
IWorkflowEngine<WorkflowMeta> parentWorkflow = new LocalWorkflowEngine(new WorkflowMeta());
action = spy(new ActionColumnsExist(""));
parentWorkflow.getWorkflowMeta().addAction(new ActionMeta(action));
parentWorkflow.setStopped(false);
action.setParentWorkflow(parentWorkflow);
parentWorkflow.setLogLevel(LogLevel.NOTHING);
DatabaseMeta dbMeta = mock(DatabaseMeta.class);
action.setDatabase(dbMeta);
db = spy(new Database(action, action, dbMeta));
action.setParentWorkflow(parentWorkflow);
action.setTablename(TABLENAME);
action.setArguments(COLUMNS);
action.setSchemaname(SCHEMANAME);
}
Aggregations