use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class TransExecutorStepAnalyzerTest method testConnectUsedFieldToSubTrans_noChildTransSteps.
@Test
public void testConnectUsedFieldToSubTrans_noChildTransSteps() throws Exception {
IMetaverseNode childTransNode = mock(IMetaverseNode.class);
IMetaverseNode rootNode = mock(IMetaverseNode.class);
when(childTransMeta.getSteps()).thenReturn(null);
spyAnalyzer.linkUsedFieldToSubTrans(rootNode, childTransMeta, childTransNode, descriptor);
verify(spyAnalyzer, never()).createFieldNode(any(IComponentDescriptor.class), any(ValueMetaInterface.class), anyString(), eq(false));
verify(builder, never()).addLink(any(IMetaverseNode.class), eq(DictionaryConst.LINK_DERIVES), any(IMetaverseNode.class));
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class TransExecutorStepAnalyzerTest method testConnectToSubTransOutputFields_MainOutput.
@Test
public void testConnectToSubTransOutputFields_MainOutput() throws Exception {
when(meta.getOutputRowsSourceStep()).thenReturn(null);
when(meta.getExecutorsOutputStep()).thenReturn("outputRowsStepName");
String[] outputFields = new String[] { "first", "last" };
when(meta.getOutputRowsField()).thenReturn(outputFields);
IMetaverseNode outNode = mock(IMetaverseNode.class);
StepNodes outputs = new StepNodes();
outputs.addNode("outputRowsStepName", "first", outNode);
outputs.addNode("outputRowsStepName", "last", outNode);
doReturn(outputs).when(spyAnalyzer).getOutputs();
// we'll test this in it's own test
doNothing().when(spyAnalyzer).linkResultFieldToSubTrans(any(IMetaverseNode.class), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
IMetaverseNode childTransNode = mock(IMetaverseNode.class);
spyAnalyzer.connectToSubTransOutputFields(meta, childTransMeta, childTransNode, descriptor);
verify(spyAnalyzer, times(outputFields.length)).linkResultFieldToSubTrans(any(IMetaverseNode.class), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class BlueprintsGraphMetaverseReaderTest method testFindNodes.
@Test
public void testFindNodes() throws Exception {
IMetaverseReader metaverseReader = new BlueprintsGraphMetaverseReader(graph);
List<IMetaverseNode> nodes = metaverseReader.findNodes(DictionaryConst.PROPERTY_TYPE, DictionaryConst.NODE_TYPE_DATA_COLUMN);
assertNotNull("Node is null", nodes);
assertEquals("Node count is wrong", 7, nodes.size());
Set<String> ids = new HashSet<String>();
for (IMetaverseNode node : nodes) {
ids.add(node.getStringID());
}
assertTrue("Id is missing", ids.contains("datasource1.table1.field1"));
assertTrue("Id is missing", ids.contains("datasource1.table1.field2"));
assertTrue("Id is missing", ids.contains("datasource1.table1.field3"));
assertTrue("Id is missing", ids.contains("datasource1.table2.field1"));
assertTrue("Id is missing", ids.contains("datasource1.table2.field2"));
assertTrue("Id is missing", ids.contains("datasource1.table2.field3"));
assertTrue("Id is missing", ids.contains("datasource1.table2.field4"));
nodes = metaverseReader.findNodes(DictionaryConst.PROPERTY_NAME, "Transformation: trans1.ktr");
assertNotNull("Node is null", nodes);
assertEquals("Node count is wrong", 1, nodes.size());
assertEquals("Id is missing", "Transformation: trans1.ktr", nodes.get(0).getProperty(DictionaryConst.PROPERTY_NAME));
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class MetaverseBuilderTest method testIsVirtual.
@Test
public void testIsVirtual() {
builder.addNode(node);
Vertex v = graph.getVertex(node.getStringID());
assertFalse(builder.isVirtual(v));
IMetaverseNode virtual = builder.createNodeObject("virtual node");
Vertex virtualVertex = graph.addVertex(virtual.getStringID());
virtualVertex.setProperty(DictionaryConst.NODE_VIRTUAL, virtual.getProperty(DictionaryConst.NODE_VIRTUAL));
assertTrue(builder.isVirtual(virtualVertex));
assertFalse(builder.isVirtual(null));
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class MetaverseBuilderTest method testUpdateNode.
@Test
public void testUpdateNode() {
builder.addNode(node);
Vertex v = graph.getVertex(node.getStringID());
assertEquals(node.getName(), v.getProperty("name"));
assertEquals(node.getStringID(), v.getId());
IMetaverseNode updateNode = builder.createNodeObject(node.getStringID());
updateNode.setName("UPDATED NAME");
updateNode.setProperty("new prop", "test");
updateNode.setType("new type");
builder.updateNode(updateNode);
v = graph.getVertex(node.getStringID());
assertEquals(node.getStringID(), v.getId());
assertEquals(updateNode.getStringID(), v.getId());
assertEquals(updateNode.getName(), v.getProperty("name"));
assertEquals("test", v.getProperty("new prop"));
assertEquals(updateNode.getType(), v.getProperty("type"));
}
Aggregations