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;
}
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));
}
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");
}
Aggregations