use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class TransExtensionPointUtil method addLineageGraph.
public static void addLineageGraph(final TransMeta transMeta) throws MetaverseException {
if (transMeta == null) {
throw new MetaverseException(Messages.getString("ERROR.Document.IsNull"));
}
// Get the "natural" filename (repo-based if in repository, filesystem-based otherwise)
String filename = getFilename(transMeta);
final Graph graph = new TinkerGraph();
final IMetaverseBuilder metaverseBuilder = new MetaverseBuilder(graph);
final IMetaverseObjectFactory objFactory = MetaverseUtil.getDocumentController().getMetaverseObjectFactory();
// Add the client design node
final String clientName = KettleClientEnvironment.getInstance().getClient().toString();
final INamespace namespace = new Namespace(clientName);
final IMetaverseNode designNode = objFactory.createNodeObject(clientName, clientName, DictionaryConst.NODE_TYPE_LOCATOR);
metaverseBuilder.addNode(designNode);
// Create a document object containing the transMeta
final IDocument document = MetaverseUtil.createDocument(namespace, transMeta, filename, transMeta.getName(), "ktr", URLConnection.getFileNameMap().getContentTypeFor("trans.ktr"));
MetaverseUtil.addLineageGraph(document, graph);
}
use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class MetaverseDocumentAnalyzerTest method setUp.
/**
* @throws Exception
*/
@Before
public void setUp() throws Exception {
builder = mock(IMetaverseBuilder.class);
transDoc = mock(IDocument.class);
namespace = mock(INamespace.class);
descriptor = new MetaverseComponentDescriptor("name", DictionaryConst.NODE_TYPE_TRANS, namespace);
IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
when(builder.getMetaverseObjectFactory()).thenReturn(factory);
analyzer.setMetaverseBuilder(builder);
when(namespace.getParentNamespace()).thenReturn(namespace);
when(transDoc.getType()).thenReturn(type);
when(transDoc.getContent()).thenReturn(content);
when(transDoc.getNamespace()).thenReturn(namespace);
}
use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class TransExtensionPointUtilTest method testAddLineageGraphNullFilename.
@Test
public void testAddLineageGraphNullFilename() throws Exception {
IDocumentController mockDoc = mock(IDocumentController.class);
IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
when(mockDoc.getMetaverseObjectFactory()).thenReturn(factory);
MetaverseUtil.setDocumentController(mockDoc);
when(transMeta.getFilename()).thenReturn(null);
when(transMeta.getPathAndName()).thenReturn("/Transformation 1");
TransExtensionPointUtil.addLineageGraph(transMeta);
}
use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class TableInputStepAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
analyzer = spy(new TableInputStepAnalyzer());
when(mockNamespace.getParentNamespace()).thenReturn(mockNamespace);
descriptor = new MetaverseComponentDescriptor("test", DictionaryConst.NODE_TYPE_TRANS_STEP, mockNamespace);
analyzer.setDescriptor(descriptor);
analyzer.setBaseStepMeta(meta);
IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
when(builder.getMetaverseObjectFactory()).thenReturn(factory);
analyzer.setMetaverseBuilder(builder);
}
use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class TableOutputStepAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
when(mockBuilder.getMetaverseObjectFactory()).thenReturn(factory);
analyzer = spy(new TableOutputStepAnalyzer());
analyzer.setConnectionAnalyzer(mock(IConnectionAnalyzer.class));
analyzer.setMetaverseBuilder(mockBuilder);
analyzer.setBaseStepMeta(meta);
analyzer.setRootNode(node);
analyzer.setParentTransMeta(parentTransMeta);
analyzer.setParentStepMeta(parentStepMeta);
when(mockNamespace.getParentNamespace()).thenReturn(mockNamespace);
descriptor = new MetaverseComponentDescriptor("test", DictionaryConst.NODE_TYPE_TRANS_STEP, mockNamespace);
analyzer.setDescriptor(descriptor);
when(meta.getParentStepMeta()).thenReturn(parentStepMeta);
when(parentStepMeta.getParentTransMeta()).thenReturn(parentTransMeta);
when(parentStepMeta.getName()).thenReturn("test");
when(parentStepMeta.getStepID()).thenReturn("TableOutputStep");
}
Aggregations