use of org.pentaho.metaverse.api.model.BaseMetaverseBuilder in project pentaho-metaverse by pentaho.
the class AnnotationDrivenJobAnalyzerTest method jobCanReferenceStepMetaForAnalysis.
@Test
public void jobCanReferenceStepMetaForAnalysis() throws MetaverseAnalyzerException {
TestJobEntry jobEntry = new TestJobEntry();
AnnotationDrivenJobAnalyzer jobAnalyzer = new AnnotationDrivenJobAnalyzer(jobEntry) {
@Override
AnnotationDrivenStepMetaAnalyzer createStepAnalyzer(BaseStepMeta baseStepMeta) {
return stepAnalyzer;
}
};
jobAnalyzer.setMetaverseBuilder(new BaseMetaverseBuilder(new TinkerGraph()));
jobAnalyzer.analyze(new MetaverseComponentDescriptor("root", "job", new Namespace("names")), jobEntry);
Mockito.verify(stepAnalyzer).customAnalyze(any(TestStepMeta.class), any(MetaverseTransientNode.class));
}
use of org.pentaho.metaverse.api.model.BaseMetaverseBuilder in project pentaho-metaverse by pentaho.
the class KettleAnalyzerUtilTest method tesBuildDocument.
@Test
public void tesBuildDocument() throws MetaverseException {
final IMetaverseBuilder builder = new BaseMetaverseBuilder(null);
final AbstractMeta transMeta = Mockito.mock(TransMeta.class);
final String transName = "MyTransMeta";
Mockito.doReturn(transName).when(transMeta).getName();
Mockito.doReturn("ktr").when(transMeta).getDefaultExtension();
final String id = "path.ktr";
final String namespaceId = "MyNamespace";
final INamespace namespace = new Namespace(namespaceId);
assertNull(KettleAnalyzerUtil.buildDocument(null, transMeta, id, namespace));
IDocument document = KettleAnalyzerUtil.buildDocument(builder, transMeta, id, namespace);
assertNotNull(document);
assertEquals(namespace, document.getNamespace());
assertEquals(transMeta, document.getContent());
assertEquals(id, document.getStringID());
assertEquals(transName, document.getName());
assertEquals("ktr", document.getExtension());
assertEquals(DictionaryConst.CONTEXT_RUNTIME, document.getContext().getContextName());
assertEquals(document.getName(), document.getProperty(DictionaryConst.PROPERTY_NAME));
assertEquals(KettleAnalyzerUtil.normalizeFilePath("path.ktr"), document.getProperty(DictionaryConst.PROPERTY_PATH));
assertEquals(namespaceId, document.getProperty(DictionaryConst.PROPERTY_NAMESPACE));
}
Aggregations