Search in sources :

Example 1 with BaseMetaverseBuilder

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));
}
Also used : BaseMetaverseBuilder(org.pentaho.metaverse.api.model.BaseMetaverseBuilder) TinkerGraph(com.tinkerpop.blueprints.impls.tg.TinkerGraph) MetaverseTransientNode(org.pentaho.dictionary.MetaverseTransientNode) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) Namespace(org.pentaho.metaverse.api.Namespace) MetaverseComponentDescriptor(org.pentaho.metaverse.api.MetaverseComponentDescriptor) Test(org.junit.Test)

Example 2 with BaseMetaverseBuilder

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));
}
Also used : BaseMetaverseBuilder(org.pentaho.metaverse.api.model.BaseMetaverseBuilder) INamespace(org.pentaho.metaverse.api.INamespace) AbstractMeta(org.pentaho.di.base.AbstractMeta) Matchers.anyString(org.mockito.Matchers.anyString) IMetaverseBuilder(org.pentaho.metaverse.api.IMetaverseBuilder) INamespace(org.pentaho.metaverse.api.INamespace) Namespace(org.pentaho.metaverse.api.Namespace) IDocument(org.pentaho.metaverse.api.IDocument) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Namespace (org.pentaho.metaverse.api.Namespace)2 BaseMetaverseBuilder (org.pentaho.metaverse.api.model.BaseMetaverseBuilder)2 TinkerGraph (com.tinkerpop.blueprints.impls.tg.TinkerGraph)1 Matchers.anyString (org.mockito.Matchers.anyString)1 AbstractMeta (org.pentaho.di.base.AbstractMeta)1 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)1 MetaverseTransientNode (org.pentaho.dictionary.MetaverseTransientNode)1 IDocument (org.pentaho.metaverse.api.IDocument)1 IMetaverseBuilder (org.pentaho.metaverse.api.IMetaverseBuilder)1 INamespace (org.pentaho.metaverse.api.INamespace)1 MetaverseComponentDescriptor (org.pentaho.metaverse.api.MetaverseComponentDescriptor)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1