use of org.pentaho.metaverse.api.IMetaverseReader in project pentaho-metaverse by pentaho.
the class IntegrationTestUtil method buildMetaverseGraph.
public static synchronized Graph buildMetaverseGraph(IDocumentLocatorProvider provider) throws Exception {
IDocumentLocatorProvider documentLocatorProvider = provider;
IMetaverseReader reader = PentahoSystem.get(IMetaverseReader.class);
Set<IDocumentLocator> locators = documentLocatorProvider.getDocumentLocators();
MetaverseCompletionService mcs = MetaverseCompletionService.getInstance();
// Run a scan for each locator
for (IDocumentLocator locator : locators) {
locator.startScan();
}
mcs.waitTillEmpty();
return reader.getMetaverse();
}
use of org.pentaho.metaverse.api.IMetaverseReader 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.IMetaverseReader in project pentaho-metaverse by pentaho.
the class BlueprintsGraphMetaverseReaderTest method testFindNode.
@Test
public void testFindNode() throws Exception {
IMetaverseReader metaverseReader = new BlueprintsGraphMetaverseReader(graph);
IMetaverseNode node = metaverseReader.findNode("data.txt");
assertNotNull("Node is null", node);
assertEquals("Id is wrong", "data.txt", node.getStringID());
assertEquals("Type is wrong", DictionaryConst.NODE_TYPE_FILE, node.getType());
assertEquals("Name is wrong", "Text file: data.txt", node.getName());
assertNull(node.getProperty(DictionaryConst.PROPERTY_TYPE_LOCALIZED));
node = metaverseReader.findNode("bogus");
assertNull("Node is not null", node);
node = metaverseReader.findNode("trans1.ktr");
assertNotNull("Node is null", node);
assertEquals("Id is wrong", "trans1.ktr", node.getStringID());
assertEquals("Type is wrong", DictionaryConst.NODE_TYPE_TRANS, node.getType());
assertEquals("Localized type is wrong", "Transformation", node.getProperty(DictionaryConst.PROPERTY_TYPE_LOCALIZED));
assertEquals("Localized type is wrong", "Document", node.getProperty(DictionaryConst.PROPERTY_CATEGORY_LOCALIZED));
}
Aggregations