use of org.apache.hop.workflow.engines.local.LocalWorkflowEngine in project hop by apache.
the class WorkflowActionEvalTableContentTest method setUp.
@Before
public void setUp() throws Exception {
MockDriver.registerInstance();
IWorkflowEngine<WorkflowMeta> workflow = new LocalWorkflowEngine(new WorkflowMeta());
action = new ActionEvalTableContent();
workflow.getWorkflowMeta().addAction(new ActionMeta(action));
action.setParentWorkflow(workflow);
workflow.setStopped(false);
DatabaseMeta dbMeta = new DatabaseMeta();
dbMeta.setDatabaseType("mock-db");
action.setDatabase(dbMeta);
action.setVariable(Const.HOP_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_WORKFLOW_ACTIONS, "N");
}
use of org.apache.hop.workflow.engines.local.LocalWorkflowEngine in project hop by apache.
the class WorkflowActionFilesExistTest method setUp.
@Before
public void setUp() throws Exception {
workflow = new LocalWorkflowEngine(new WorkflowMeta());
action = new ActionFilesExist();
workflow.getWorkflowMeta().addAction(new ActionMeta(action));
action.setParentWorkflow(workflow);
WorkflowMeta mockWorkflowMeta = mock(WorkflowMeta.class);
action.setParentWorkflowMeta(mockWorkflowMeta);
workflow.setStopped(false);
existingFile1 = TestUtils.createRamFile(getClass().getSimpleName() + "/existingFile1.ext", action);
existingFile2 = TestUtils.createRamFile(getClass().getSimpleName() + "/existingFile2.ext", action);
}
use of org.apache.hop.workflow.engines.local.LocalWorkflowEngine in project hop by apache.
the class ScriptValueAddFunctions_SetVariableScopeTest method createWorkflow.
private Workflow createWorkflow() {
Workflow workflow = new LocalWorkflowEngine();
workflow = spy(workflow);
return workflow;
}
use of org.apache.hop.workflow.engines.local.LocalWorkflowEngine in project hop by apache.
the class ActionHttp_PDI208_Test method testHttpResultDefaultRows.
@Test
public void testHttpResultDefaultRows() throws IOException {
File localFileForUpload = getInputFile("existingFile1", ".tmp");
File tempFileForDownload = File.createTempFile("downloadedFile1", ".tmp");
localFileForUpload.deleteOnExit();
tempFileForDownload.deleteOnExit();
Object[] r = new Object[] { HTTP_SERVER_BASEURL + "/uploadFile", localFileForUpload.getCanonicalPath(), tempFileForDownload.getCanonicalPath() };
RowMeta rowMetaDefault = new RowMeta();
rowMetaDefault.addValueMeta(new ValueMetaString("URL"));
rowMetaDefault.addValueMeta(new ValueMetaString("UPLOAD"));
rowMetaDefault.addValueMeta(new ValueMetaString("DESTINATION"));
List<RowMetaAndData> rows = new ArrayList<>();
rows.add(new RowMetaAndData(rowMetaDefault, r));
Result previousResult = new Result();
previousResult.setRows(rows);
ActionHttp http = new ActionHttp();
http.setParentWorkflow(new LocalWorkflowEngine());
http.setRunForEveryRow(true);
http.setAddFilenameToResult(false);
http.execute(previousResult, 0);
assertTrue(FileUtils.contentEquals(localFileForUpload, tempFileForDownload));
}
use of org.apache.hop.workflow.engines.local.LocalWorkflowEngine in project hop by apache.
the class ActionHttp_PDI208_Test method testHttpResultCustomRows.
@Test
public void testHttpResultCustomRows() throws IOException {
File localFileForUpload = getInputFile("existingFile2", ".tmp");
File tempFileForDownload = File.createTempFile("downloadedFile2", ".tmp");
localFileForUpload.deleteOnExit();
tempFileForDownload.deleteOnExit();
Object[] r = new Object[] { HTTP_SERVER_BASEURL + "/uploadFile", localFileForUpload.getCanonicalPath(), tempFileForDownload.getCanonicalPath() };
RowMeta rowMetaDefault = new RowMeta();
rowMetaDefault.addValueMeta(new ValueMetaString("MyURL"));
rowMetaDefault.addValueMeta(new ValueMetaString("MyUpload"));
rowMetaDefault.addValueMeta(new ValueMetaString("MyDestination"));
List<RowMetaAndData> rows = new ArrayList<>();
rows.add(new RowMetaAndData(rowMetaDefault, r));
Result previousResult = new Result();
previousResult.setRows(rows);
ActionHttp http = new ActionHttp();
http.setParentWorkflow(new LocalWorkflowEngine());
http.setRunForEveryRow(true);
http.setAddFilenameToResult(false);
http.setUrlFieldname("MyURL");
http.setUploadFieldname("MyUpload");
http.setDestinationFieldname("MyDestination");
http.execute(previousResult, 0);
assertTrue(FileUtils.contentEquals(localFileForUpload, tempFileForDownload));
}
Aggregations