use of org.pentaho.metaverse.frames.HttpPostStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testHTTPPostStep_UrlFromField.
@Test
public void testHTTPPostStep_UrlFromField() throws Exception {
// this is testing a specific TextFileInputStep instance
HttpPostStepNode node = root.getHttpPostStepNode_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);
assertEquals(0, countInputUrls);
assertEquals("HTTP Post", node.getStepType());
HTTPPOSTMeta stepMeta = (HTTPPOSTMeta) getStepMeta(node);
Set<String> usedFields = new HashSet<>();
Collections.addAll(usedFields, stepMeta.getQueryField());
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));
}
use of org.pentaho.metaverse.frames.HttpPostStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testHttpPostStep.
@Test
public void testHttpPostStep() throws Exception {
// this is testing a specific TextFileInputStep instance
HttpPostStepNode node = root.getHttpPostStepNode();
assertNotNull(node);
Iterable<FramedMetaverseNode> inputUrls = node.getInputUrls();
int countUrls = getIterableSize(inputUrls);
assertEquals(1, countUrls);
for (FramedMetaverseNode inputUrl : inputUrls) {
assertTrue(inputUrl.getName().endsWith("/posts"));
}
assertEquals("HTTP Post", node.getStepType());
// check the param field is "used"
Iterable<StreamFieldNode> streamFieldNodesUses = node.getStreamFieldNodesUses();
assertEquals(1, getIterableSize(streamFieldNodesUses));
Iterable<StreamFieldNode> outputs = node.getOutputStreamFields();
assertEquals(3, getIterableSize(outputs));
Iterable<StreamFieldNode> inputs = node.getInputStreamFields();
assertEquals(1, getIterableSize(inputs));
for (StreamFieldNode in : inputs) {
assertNotNull(in.getFieldNodesDerivedFromMe());
assertEquals(in.getName(), in.getFieldNodesDerivedFromMe().iterator().next().getName());
}
}
Aggregations