Search in sources :

Example 6 with MetaverseObjectFactory

use of org.pentaho.metaverse.api.MetaverseObjectFactory 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 7 with MetaverseObjectFactory

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

the class ExternalResourceStepAnalyzerTest method setUp.

@Before
public void setUp() throws Exception {
    analyzer = spy(new ExternalResourceStepAnalyzer<BaseStepMeta>() {

        @Override
        public Set<Class<? extends BaseStepMeta>> getSupportedSteps() {
            return null;
        }

        @Override
        protected Set<StepField> getUsedFields(BaseStepMeta meta) {
            Set<StepField> stepFields = new HashSet<>();
            stepFields.add(new StepField("prevStep", "filename"));
            return stepFields;
        }

        @Override
        public IMetaverseNode createResourceNode(IExternalResourceInfo resource) throws MetaverseException {
            return resourceNode;
        }

        @Override
        public String getResourceInputNodeType() {
            return "INPUT_TYPE";
        }

        @Override
        public String getResourceOutputNodeType() {
            return "OUTPUT_TYPE";
        }

        @Override
        public boolean isOutput() {
            return false;
        }

        @Override
        public boolean isInput() {
            return true;
        }
    });
    when(analyzer.getMetaverseBuilder()).thenReturn(builder);
    analyzer.descriptor = descriptor;
    analyzer.parentTransMeta = parentTransMeta;
    analyzer.parentStepMeta = parentStepMeta;
    analyzer.setMetaverseObjectFactory(new MetaverseObjectFactory());
}
Also used : IExternalResourceInfo(org.pentaho.metaverse.api.model.IExternalResourceInfo) MetaverseObjectFactory(org.pentaho.metaverse.api.MetaverseObjectFactory) StepField(org.pentaho.metaverse.api.StepField) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) HashSet(java.util.HashSet) Before(org.junit.Before)

Aggregations

MetaverseObjectFactory (org.pentaho.metaverse.api.MetaverseObjectFactory)7 Before (org.junit.Before)4 HashSet (java.util.HashSet)3 Test (org.junit.Test)3 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)3 IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)3 StepField (org.pentaho.metaverse.api.StepField)3 IComponentDescriptor (org.pentaho.metaverse.api.IComponentDescriptor)2 INamespace (org.pentaho.metaverse.api.INamespace)2 IExternalResourceInfo (org.pentaho.metaverse.api.model.IExternalResourceInfo)2 Set (java.util.Set)1 Matchers.anyString (org.mockito.Matchers.anyString)1 JsonInputMeta (org.pentaho.di.trans.steps.jsoninput.JsonInputMeta)1 ILogicalIdGenerator (org.pentaho.metaverse.api.ILogicalIdGenerator)1 IMetaverseBuilder (org.pentaho.metaverse.api.IMetaverseBuilder)1 IMetaverseObjectFactory (org.pentaho.metaverse.api.IMetaverseObjectFactory)1