Search in sources :

Example 11 with INamespace

use of org.pentaho.metaverse.api.INamespace in project pentaho-metaverse by pentaho.

the class StepAnalyzer method getPrevFieldDescriptor.

/**
 * Create a new IComponentDescriptor for a field input into this step
 *
 * @param prevStepName
 * @param fieldName
 * @return
 */
protected IComponentDescriptor getPrevFieldDescriptor(String prevStepName, String fieldName) {
    IComponentDescriptor prevFieldDescriptor = null;
    if (StringUtils.isNotEmpty(prevStepName)) {
        Object nsObj = rootNode.getProperty(DictionaryConst.PROPERTY_NAMESPACE);
        INamespace ns = new Namespace(nsObj != null ? nsObj.toString() : null);
        IMetaverseNode tmpOriginNode = getMetaverseObjectFactory().createNodeObject(ns, prevStepName, DictionaryConst.NODE_TYPE_TRANS_STEP);
        INamespace stepFieldNamespace = new Namespace(tmpOriginNode.getLogicalId());
        prevFieldDescriptor = new MetaverseComponentDescriptor(fieldName, getInputNodeType(), stepFieldNamespace, getDescriptor().getContext());
    }
    return prevFieldDescriptor;
}
Also used : IComponentDescriptor(org.pentaho.metaverse.api.IComponentDescriptor) INamespace(org.pentaho.metaverse.api.INamespace) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) INamespace(org.pentaho.metaverse.api.INamespace) Namespace(org.pentaho.metaverse.api.Namespace) MetaverseComponentDescriptor(org.pentaho.metaverse.api.MetaverseComponentDescriptor)

Example 12 with INamespace

use of org.pentaho.metaverse.api.INamespace in project pentaho-metaverse by pentaho.

the class BaseKettleMetaverseComponentTest method testCreateFileNode.

@Test
public void testCreateFileNode() throws Exception {
    component.createFileNode(null, null);
    assertNull(component.createFileNode("/path/to/my/file", null));
    IMetaverseBuilder metaverseBuilder = mock(IMetaverseBuilder.class);
    when(metaverseBuilder.getMetaverseObjectFactory()).thenReturn(new MetaverseObjectFactory());
    component.setMetaverseBuilder(metaverseBuilder);
    IComponentDescriptor descriptor = mock(IComponentDescriptor.class);
    INamespace ns = mock(INamespace.class);
    when(descriptor.getNamespace()).thenReturn(ns);
    assertNotNull(component.createFileNode("/path/to/my/file", descriptor));
}
Also used : IComponentDescriptor(org.pentaho.metaverse.api.IComponentDescriptor) INamespace(org.pentaho.metaverse.api.INamespace) MetaverseObjectFactory(org.pentaho.metaverse.api.MetaverseObjectFactory) IMetaverseBuilder(org.pentaho.metaverse.api.IMetaverseBuilder) Test(org.junit.Test)

Example 13 with INamespace

use of org.pentaho.metaverse.api.INamespace in project pentaho-metaverse by pentaho.

the class BaseKettleMetaverseComponentTest method testGetSiblingNamespace.

@Test
public void testGetSiblingNamespace() throws Exception {
    INamespace namespace = mock(INamespace.class);
    // be sure we don't call through to the underlying namespace object if it is null
    assertNull(component.getSiblingNamespace(null, null, null));
    verify(namespace, times(0)).getSiblingNamespace(anyString(), anyString());
    // verify the delegate methods are called
    component.getSiblingNamespace(namespace, null, null);
    verify(namespace, times(1)).getSiblingNamespace(null, null);
    component.getSiblingNamespace(namespace, "name", null);
    verify(namespace, times(1)).getSiblingNamespace("name", null);
    component.getSiblingNamespace(namespace, "name", "type");
    verify(namespace, times(1)).getSiblingNamespace("name", "type");
}
Also used : INamespace(org.pentaho.metaverse.api.INamespace) Test(org.junit.Test)

Aggregations

INamespace (org.pentaho.metaverse.api.INamespace)13 IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)10 Namespace (org.pentaho.metaverse.api.Namespace)8 IComponentDescriptor (org.pentaho.metaverse.api.IComponentDescriptor)5 Test (org.junit.Test)4 IDocument (org.pentaho.metaverse.api.IDocument)4 IMetaverseBuilder (org.pentaho.metaverse.api.IMetaverseBuilder)4 MetaverseComponentDescriptor (org.pentaho.metaverse.api.MetaverseComponentDescriptor)4 MetaverseAnalyzerException (org.pentaho.metaverse.api.MetaverseAnalyzerException)3 MetaverseException (org.pentaho.metaverse.api.MetaverseException)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Date (java.util.Date)2 UnknownParamException (org.pentaho.di.core.parameters.UnknownParamException)2 Job (org.pentaho.di.job.Job)2 JobMeta (org.pentaho.di.job.JobMeta)2 TransMeta (org.pentaho.di.trans.TransMeta)2 AnalysisContext (org.pentaho.metaverse.api.AnalysisContext)2 MetaverseObjectFactory (org.pentaho.metaverse.api.MetaverseObjectFactory)2 PropertiesHolder (org.pentaho.metaverse.api.PropertiesHolder)2 IExecutionProfile (org.pentaho.metaverse.api.model.IExecutionProfile)2