use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class TransformationAnalyzerTest method setUp.
/**
* @throws Exception
*/
@Before
public void setUp() throws Exception {
IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
when(mockBuilder.getMetaverseObjectFactory()).thenReturn(factory);
analyzer = new TransformationAnalyzer();
analyzer.setMetaverseBuilder(mockBuilder);
when(namespace.getParentNamespace()).thenReturn(namespace);
when(mockTransDoc.getType()).thenReturn(DictionaryConst.NODE_TYPE_TRANS);
when(mockTransDoc.getContent()).thenReturn(mockContent);
when(mockTransDoc.getNamespace()).thenReturn(namespace);
when(mockGenRowsStepMeta.getParentStepMeta()).thenReturn(mockStepMeta);
when(mockSelectValuesStepMeta.getParentStepMeta()).thenReturn(mockStepMeta);
when(mockStepMeta.getStepMetaInterface()).thenReturn(mockGenRowsStepMeta);
when(mockStepMeta.getParentTransMeta()).thenReturn(mockContent);
when(mockContent.listVariables()).thenReturn(new String[] {});
final String PARAM = "param1";
when(mockContent.listParameters()).thenReturn(new String[] { PARAM });
when(mockContent.nrSteps()).thenReturn(1);
when(mockContent.getStep(0)).thenReturn(mockStepMeta);
when(mockContent.getParameterDefault(PARAM)).thenReturn("default");
when(mockContent.getNextStepNames(mockStepMeta)).thenReturn(new String[] { "previousStepName" });
descriptor = new MetaverseComponentDescriptor("name", DictionaryConst.NODE_TYPE_TRANS, namespace);
}
use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class JobRuntimeExtensionPointTest method testJobMetaVariablesAreCombinedWithExistingJobVariables.
@Test
public void testJobMetaVariablesAreCombinedWithExistingJobVariables() throws Exception {
JobLineageHolderMap originalHolderMap = mockBuilder();
JobRuntimeExtensionPoint extensionPoint = new JobRuntimeExtensionPoint();
IDocumentAnalyzer documentAnalyzer = Mockito.mock(IDocumentAnalyzer.class);
extensionPoint.setDocumentAnalyzer(documentAnalyzer);
final IMetaverseObjectFactory objectFactory = mock(IMetaverseObjectFactory.class);
when(mockBuilder.getMetaverseObjectFactory()).thenReturn(objectFactory);
final IDocument document = mock(IDocument.class);
when(objectFactory.createDocumentObject()).thenReturn(document);
job.setVariable("dontloseme", "okipromise");
extensionPoint.callExtensionPoint(null, job);
assertEquals("okipromise", job.getVariable("dontloseme"));
// Restore original JobLineageHolderMap for use by others
JobLineageHolderMap.setInstance(originalHolderMap);
}
use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class MongoDbInputStepAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
when(mockBuilder.getMetaverseObjectFactory()).thenReturn(factory);
analyzer = spy(new MongoDbInputStepAnalyzer());
analyzer.setConnectionAnalyzer(mock(IConnectionAnalyzer.class));
analyzer.setMetaverseBuilder(mockBuilder);
analyzer.setBaseStepMeta(meta);
analyzer.setRootNode(node);
analyzer.setParentTransMeta(mockTransMeta);
analyzer.setParentStepMeta(parentStepMeta);
when(mockNamespace.getParentNamespace()).thenReturn(mockNamespace);
descriptor = new MetaverseComponentDescriptor("test", DictionaryConst.NODE_TYPE_TRANS_STEP, mockNamespace);
analyzer.setDescriptor(descriptor);
when(meta.getParentStepMeta()).thenReturn(parentStepMeta);
when(parentStepMeta.getParentTransMeta()).thenReturn(mockTransMeta);
when(parentStepMeta.getName()).thenReturn("test");
when(parentStepMeta.getStepID()).thenReturn("MongoDbInput");
}
use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class DocumentControllerTest method testSetMetaverseObjectFactory_nullBuilder.
@Test
public void testSetMetaverseObjectFactory_nullBuilder() throws Exception {
DocumentController dc = new DocumentController(null);
IMetaverseObjectFactory factory = mock(IMetaverseObjectFactory.class);
dc.setMetaverseObjectFactory(factory);
verify(mockBuilder, never()).setMetaverseObjectFactory(any(IMetaverseObjectFactory.class));
}
use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.
the class DocumentControllerTest method testGetMetaverseObjectFactory.
@Test
public void testGetMetaverseObjectFactory() throws Exception {
docController.setMetaverseBuilder(mockBuilder);
IMetaverseObjectFactory objectFactory = mock(IMetaverseObjectFactory.class);
when(mockBuilder.getMetaverseObjectFactory()).thenReturn(objectFactory);
assertNotNull(docController.getMetaverseObjectFactory());
verify(mockBuilder).getMetaverseObjectFactory();
}
Aggregations