use of org.pentaho.metaverse.frames.HttpClientStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testHttpClientStep.
@Test
public void testHttpClientStep() throws Exception {
HttpClientStepNode node = root.getHttpClientStepNode();
assertNotNull(node);
Iterable<FramedMetaverseNode> inputUrls = node.getInputUrls();
int countInputUrls = getIterableSize(inputUrls);
assertEquals(1, countInputUrls);
assertEquals("HTTP Client", node.getStepType());
HTTPMeta stepMeta = (HTTPMeta) getStepMeta(node);
for (FramedMetaverseNode inputUrl : inputUrls) {
assertEquals(stepMeta.getUrl(), inputUrl.getName());
}
// check the param field is "used"
Iterable<StreamFieldNode> streamFieldNodesUses = node.getStreamFieldNodesUses();
assertEquals(2, getIterableSize(streamFieldNodesUses));
Iterable<StreamFieldNode> outputs = node.getOutputStreamFields();
assertEquals(5, getIterableSize(outputs));
Iterable<StreamFieldNode> inputs = node.getInputStreamFields();
assertEquals(3, getIterableSize(inputs));
for (StreamFieldNode in : inputs) {
assertNotNull(in.getFieldNodesDerivedFromMe());
assertEquals(in.getName(), in.getFieldNodesDerivedFromMe().iterator().next().getName());
}
}
use of org.pentaho.metaverse.frames.HttpClientStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testHTTPClientStep_UrlFromField.
@Test
public void testHTTPClientStep_UrlFromField() throws Exception {
// this is testing a specific TextFileInputStep instance
HttpClientStepNode node = root.getHttpClientStepNode_urlFromField();
assertNotNull(node);
// this HTTP Client gets it's files from an incoming stream field, there should be no files modeled statically
Iterable<FramedMetaverseNode> inputUrls = node.getInputUrls();
int countInputUrls = getIterableSize(inputUrls);
// it is coming from a field
assertEquals(0, countInputUrls);
HTTPMeta stepMeta = (HTTPMeta) getStepMeta(node);
assertEquals("HTTP Client", node.getStepType());
Set<String> usedFields = new HashSet<>();
Collections.addAll(usedFields, stepMeta.getHeaderField());
Collections.addAll(usedFields, stepMeta.getArgumentField());
if (stepMeta.isUrlInField()) {
usedFields.add(stepMeta.getUrlField());
}
// check the param field is "used"
Iterable<StreamFieldNode> streamFieldNodesUses = node.getStreamFieldNodesUses();
assertEquals(usedFields.size(), getIterableSize(streamFieldNodesUses));
for (StreamFieldNode streamFieldNodesUse : streamFieldNodesUses) {
assertTrue(usedFields.contains(streamFieldNodesUse.getName()));
}
Iterable<StreamFieldNode> outputs = node.getOutputStreamFields();
assertEquals(getExpectedOutputFieldCount(stepMeta), getIterableSize(outputs));
}
Aggregations