use of org.pentaho.metaverse.api.MetaverseAnalyzerException in project pentaho-metaverse by pentaho.
the class StepAnalyzer method getOutputFields.
@Override
public RowMetaInterface getOutputFields(T meta) {
RowMetaInterface rmi = null;
try {
validateState(null, meta);
} catch (MetaverseAnalyzerException e) {
// eat it
}
if (parentTransMeta != null) {
try {
ProgressNullMonitorListener progressMonitor = new ProgressNullMonitorListener();
rmi = parentTransMeta.getStepFields(parentStepMeta, progressMonitor);
progressMonitor.done();
} catch (KettleStepException e) {
rmi = null;
}
}
return rmi;
}
use of org.pentaho.metaverse.api.MetaverseAnalyzerException in project pentaho-metaverse by pentaho.
the class StepAnalyzer method getInputFields.
@Override
public Map<String, RowMetaInterface> getInputFields(T meta) {
Map<String, RowMetaInterface> rowMeta = null;
try {
validateState(null, meta);
} catch (MetaverseAnalyzerException e) {
// eat it
}
if (parentTransMeta != null) {
try {
rowMeta = new HashMap<String, RowMetaInterface>();
ProgressNullMonitorListener progressMonitor = new ProgressNullMonitorListener();
prevStepNames = parentTransMeta.getPrevStepNames(parentStepMeta);
RowMetaInterface rmi = parentTransMeta.getPrevStepFields(parentStepMeta, progressMonitor);
progressMonitor.done();
if (!ArrayUtils.isEmpty(prevStepNames)) {
rowMeta.put(prevStepNames[0], rmi);
}
} catch (KettleStepException e) {
rowMeta = null;
}
}
return rowMeta;
}
use of org.pentaho.metaverse.api.MetaverseAnalyzerException in project pentaho-metaverse by pentaho.
the class StepAnalyzerTest method testGetInputFieldsWithException.
@Test
public void testGetInputFieldsWithException() {
analyzer = new StepAnalyzer() {
@Override
public void validateState(IComponentDescriptor descriptor, BaseStepMeta object) throws MetaverseAnalyzerException {
throw new MetaverseAnalyzerException("expected exception");
}
@Override
public Set<Class<? extends BaseStepMeta>> getSupportedSteps() {
return null;
}
@Override
protected Set getUsedFields(BaseStepMeta meta) {
// TODO Auto-generated method stub
return null;
}
@Override
protected void customAnalyze(BaseStepMeta meta, IMetaverseNode rootNode) throws MetaverseAnalyzerException {
// TODO Auto-generated method stub
}
};
assertNull(analyzer.getInputFields(null));
}
use of org.pentaho.metaverse.api.MetaverseAnalyzerException in project pentaho-metaverse by pentaho.
the class DatabaseConnectionAnalyzerTest method testAnalyze.
@Test
public void testAnalyze() {
when(builder.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 builder;
}
});
try {
IMetaverseNode node = dbConnectionAnalyzer.analyze(mockDescriptor, databaseMeta);
builder.addNode(node);
assertNotNull(node);
assertEquals(14, node.getPropertyKeys().size());
} catch (MetaverseAnalyzerException e) {
fail("analyze() should not throw an exception!");
}
}
use of org.pentaho.metaverse.api.MetaverseAnalyzerException in project pentaho-metaverse by pentaho.
the class MergeJoinStepAnalyzer method getInputFields.
@Override
public Map<String, RowMetaInterface> getInputFields(MergeJoinMeta meta) {
Map<String, RowMetaInterface> rowMeta = null;
try {
validateState(null, meta);
} catch (MetaverseAnalyzerException e) {
// eat it
}
if (parentTransMeta != null) {
rowMeta = new HashMap<>();
try {
StepMeta stepMeta1 = meta.getStepIOMeta().getInfoStreams().get(0).getStepMeta();
ProgressNullMonitorListener progress = new ProgressNullMonitorListener();
leftStepFields = parentTransMeta.getStepFields(stepMeta1, progress);
progress.done();
progress = new ProgressNullMonitorListener();
StepMeta stepMeta2 = meta.getStepIOMeta().getInfoStreams().get(1).getStepMeta();
rightStepFields = parentTransMeta.getStepFields(stepMeta2, progress);
progress.done();
rowMeta.put(stepMeta1.getName(), leftStepFields);
rowMeta.put(stepMeta2.getName(), rightStepFields);
} catch (Throwable t) {
// eat it
}
}
return rowMeta;
}
Aggregations