use of org.pentaho.metaverse.frames.RestClientStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testRestClientStepNode_urlFromField.
@Test
public void testRestClientStepNode_urlFromField() throws Exception {
RestClientStepNode node = root.getRestClientStepNode("REST Client - parameterized");
assertNotNull(node);
Iterable<FramedMetaverseNode> inputUrls = node.getInputUrls();
assertEquals("REST Client", node.getStepType());
RestMeta stepMeta = (RestMeta) getStepMeta(node);
for (FramedMetaverseNode inputUrl : inputUrls) {
assertEquals(stepMeta.getUrlField(), inputUrl.getName());
}
Set<String> usedFields = new HashSet<>();
Collections.addAll(usedFields, stepMeta.getHeaderField());
Collections.addAll(usedFields, stepMeta.getParameterField());
if (stepMeta.isUrlInField()) {
usedFields.add(stepMeta.getUrlField());
}
if (stepMeta.isDynamicMethod()) {
usedFields.add(stepMeta.getMethodFieldName());
}
if (StringUtils.isNotEmpty(stepMeta.getBodyField())) {
usedFields.add(stepMeta.getBodyField());
}
// 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.RestClientStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testRestClientStepNode.
@Test
public void testRestClientStepNode() throws Exception {
RestClientStepNode node = root.getRestClientStepNode("REST Client");
assertNotNull(node);
Iterable<FramedMetaverseNode> inputUrls = node.getInputUrls();
int countInputUrls = getIterableSize(inputUrls);
assertEquals(1, countInputUrls);
assertEquals("REST Client", node.getStepType());
RestMeta stepMeta = (RestMeta) getStepMeta(node);
for (FramedMetaverseNode inputUrl : inputUrls) {
assertEquals(stepMeta.getUrl(), inputUrl.getName());
}
// check the param field is "used"
Iterable<StreamFieldNode> streamFieldNodesUses = node.getStreamFieldNodesUses();
assertEquals(1, getIterableSize(streamFieldNodesUses));
for (StreamFieldNode streamFieldNodesUse : streamFieldNodesUses) {
assertEquals(stepMeta.getParameterField()[0], streamFieldNodesUse.getName());
}
Iterable<StreamFieldNode> outputs = node.getOutputStreamFields();
assertEquals(4, 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());
}
}
Aggregations