use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class MetaverseDocumentAnalyzerTest method testAnalyzeTransDocument.
@Test
public void testAnalyzeTransDocument() throws MetaverseAnalyzerException {
IMetaverseNode node = (IMetaverseNode) analyzer.analyze(descriptor, transDoc);
assertNotNull(node);
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class MetaverseDocumentAnalyzerTest method testAnalyzeContentFromXml.
@Test
public void testAnalyzeContentFromXml() throws MetaverseAnalyzerException, KettleException {
when(transDoc.getContent()).thenReturn(content.getXML());
IMetaverseNode node = (IMetaverseNode) analyzer.analyze(descriptor, transDoc);
assertNotNull(node);
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class MongoDbConnectionAnalyzerTest method testAnalyze.
@Test
public void testAnalyze() throws Exception {
when(mockBuilder.addNode(any(IMetaverseNode.class))).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
// add the logicalId to the node like it does in the real builder
IMetaverseNode node = (IMetaverseNode) args[0];
node.setProperty(DictionaryConst.PROPERTY_LOGICAL_ID, node.getLogicalId());
return mockBuilder;
}
});
IMetaverseNode node = analyzer.analyze(mockDescriptor, mongoDbMeta);
assertNotNull(node);
assertEquals("localhost", node.getProperty(MongoDbConnectionAnalyzer.HOST_NAMES));
assertEquals("db", node.getProperty(MongoDbConnectionAnalyzer.DATABASE_NAME));
assertEquals("user", node.getProperty(DictionaryConst.PROPERTY_USER_NAME));
assertEquals("12345", node.getProperty(DictionaryConst.PROPERTY_PORT));
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class TransformationAnalyzerTest method testAnalyzerTransformWithStepsAndHop.
@Test
public void testAnalyzerTransformWithStepsAndHop() throws MetaverseAnalyzerException {
StepMeta mockToStepMeta = mock(StepMeta.class);
when(mockToStepMeta.getStepMetaInterface()).thenReturn(mockSelectValuesStepMeta);
StepIOMetaInterface stepIO = mock(StepIOMetaInterface.class);
when(stepIO.getInfoStepnames()).thenReturn(new String[] {});
when(mockSelectValuesStepMeta.getStepIOMeta()).thenReturn(stepIO);
when(mockToStepMeta.getParentTransMeta()).thenReturn(mockContent);
when(mockContent.nrSteps()).thenReturn(2);
when(mockContent.getStep(0)).thenReturn(mockStepMeta);
when(mockContent.getStep(1)).thenReturn(mockToStepMeta);
when(mockContent.nrTransHops()).thenReturn(1);
final TransHopMeta hop = new TransHopMeta(mockStepMeta, mockToStepMeta, true);
when(mockContent.getTransHop(0)).thenReturn(hop);
IMetaverseNode node = analyzer.analyze(descriptor, mockTransDoc);
assertNotNull(node);
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class TransformationAnalyzerTest method testAnalyzerTransformWithParamException.
@Test(expected = MetaverseAnalyzerException.class)
public void testAnalyzerTransformWithParamException() throws Exception {
when(mockContent.getParameterDefault(anyString())).thenThrow(UnknownParamException.class);
// increases line code coverage by adding step to transformation
IMetaverseNode node = analyzer.analyze(descriptor, mockTransDoc);
assertNotNull(node);
}
Aggregations