use of org.apache.hop.metadata.api.IHopMetadataProvider in project hop by apache.
the class WorkflowEntrySetVariablesTest method testJobEntrySetVariablesExecute_VARIABLE_TYPE_JVM_VariableNotNull.
@Test
public void testJobEntrySetVariablesExecute_VARIABLE_TYPE_JVM_VariableNotNull() throws Exception {
IHopMetadataProvider metadataProvider = mock(IHopMetadataProvider.class);
action.loadXml(getEntryNode("variableNotNull", "someValue", "JVM"), metadataProvider, new Variables());
assertNull(System.getProperty("variableNotNull"));
Result result = action.execute(new Result(), 0);
assertTrue("Result should be true", result.getResult());
assertEquals("someValue", System.getProperty("variableNotNull"));
}
use of org.apache.hop.metadata.api.IHopMetadataProvider in project hop by apache.
the class ZipFileMetaTest method testCheck.
@Test
public void testCheck() {
ZipFileMeta zipFileMeta = new ZipFileMeta();
zipFileMeta.setDefault();
PipelineMeta pipelineMeta = mock(PipelineMeta.class);
TransformMeta transformMeta = mock(TransformMeta.class);
IRowMeta prev = mock(IRowMeta.class);
IHopMetadataProvider metadataProvider = mock(IHopMetadataProvider.class);
IRowMeta info = mock(IRowMeta.class);
ArrayList<ICheckResult> remarks = new ArrayList<>();
zipFileMeta.check(remarks, pipelineMeta, transformMeta, prev, new String[] { "input" }, new String[] { "output" }, info, new Variables(), metadataProvider);
assertEquals(2, remarks.size());
assertEquals("Source Filename field is missing!", remarks.get(0).getText());
assertEquals("Transform is receiving info from other transforms.", remarks.get(1).getText());
remarks = new ArrayList<>();
zipFileMeta = new ZipFileMeta();
zipFileMeta.setSourceFilenameField("sourceFileField");
zipFileMeta.check(remarks, pipelineMeta, transformMeta, prev, new String[0], new String[] { "output" }, info, new Variables(), metadataProvider);
assertEquals(2, remarks.size());
assertEquals("Target Filename field was specified", remarks.get(0).getText());
assertEquals("No input received from other transforms!", remarks.get(1).getText());
}
use of org.apache.hop.metadata.api.IHopMetadataProvider in project hop by apache.
the class ZipFileMetaTest method testLoadAndGetXml.
@Test
public void testLoadAndGetXml() throws Exception {
ZipFileMeta zipFileMeta = new ZipFileMeta();
Node transformNode = getTestNode();
DatabaseMeta dbMeta = mock(DatabaseMeta.class);
IHopMetadataProvider metadataProvider = mock(IHopMetadataProvider.class);
TransformMeta mockParentTransformMeta = mock(TransformMeta.class);
zipFileMeta.setParentTransformMeta(mockParentTransformMeta);
PipelineMeta mockPipelineMeta = mock(PipelineMeta.class);
when(mockParentTransformMeta.getParentPipelineMeta()).thenReturn(mockPipelineMeta);
zipFileMeta.loadXml(transformNode, metadataProvider);
}
use of org.apache.hop.metadata.api.IHopMetadataProvider in project hop by apache.
the class XmlOutputMetaTest method testLoadAndGetXml.
@Test
public void testLoadAndGetXml() throws Exception {
XmlOutputMeta xmlOutputMeta = new XmlOutputMeta();
Node transformNode = getTestNode();
DatabaseMeta dbMeta = mock(DatabaseMeta.class);
IHopMetadataProvider metadataProvider = mock(IHopMetadataProvider.class);
xmlOutputMeta.loadXml(transformNode, metadataProvider);
assertXmlOutputMeta(xmlOutputMeta);
}
use of org.apache.hop.metadata.api.IHopMetadataProvider in project hop by apache.
the class XmlOutputMetaTest method testLoadXmlException.
@Test
public void testLoadXmlException() throws Exception {
XmlOutputMeta xmlOutputMeta = new XmlOutputMeta();
DatabaseMeta dbMeta = mock(DatabaseMeta.class);
IHopMetadataProvider metadataProvider = mock(IHopMetadataProvider.class);
Node transformNode = mock(Node.class);
when(transformNode.getChildNodes()).thenThrow(new RuntimeException("some words"));
try {
xmlOutputMeta.loadXml(transformNode, metadataProvider);
} catch (HopXmlException e) {
assertEquals("some words", e.getCause().getMessage());
}
}
Aggregations