use of org.pentaho.di.trans.step.BaseStepMeta in project pentaho-metaverse by pentaho.
the class TransMetaJsonDeserializer method deserializeSteps.
protected void deserializeSteps(TransMeta transMeta, JsonNode node, ObjectMapper mapper) throws IOException {
ArrayNode stepsArrayNode = (ArrayNode) node.get(TransMetaJsonSerializer.JSON_PROPERTY_STEPS);
String stepName = null;
for (int i = 0; i < stepsArrayNode.size(); i++) {
JsonNode stepNode = stepsArrayNode.get(i);
String className = stepNode.get(IInfo.JSON_PROPERTY_CLASS).asText();
stepName = stepNode.get(IInfo.JSON_PROPERTY_NAME).asText();
ObjectId stepId = new StringObjectId(stepName);
// add the step attributes to the repo so they can be found when they are looked up by the readRep impl
JsonNode attributes = stepNode.get(AbstractStepMetaJsonSerializer.JSON_PROPERTY_ATTRIBUTES);
writeJsonAttributes(attributes, mapper, stepId);
JsonNode fields = stepNode.get(AbstractStepMetaJsonSerializer.JSON_PROPERTY_FIELDS);
writeJsonFields(fields, mapper, stepId);
try {
Class clazz = this.getClass().getClassLoader().loadClass(className);
BaseStepMeta meta = (BaseStepMeta) clazz.newInstance();
meta.readRep(getRepository(), null, stepId, transMeta.getDatabases());
StepMetaInterface smi = (StepMetaInterface) meta;
StepMeta step = new StepMeta(stepName, smi);
transMeta.addStep(step);
} catch (Exception e) {
LOGGER.warn(Messages.getString("WARNING.Deserialization.Trans.Steps", stepName), e);
}
}
}
use of org.pentaho.di.trans.step.BaseStepMeta in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method getBaseStepMetaFromStepMeta.
protected BaseStepMeta getBaseStepMetaFromStepMeta(StepMeta stepMeta) {
// Attempt to discover a BaseStepMeta from the given StepMeta
BaseStepMeta baseStepMeta = new BaseStepMeta();
baseStepMeta.setParentStepMeta(stepMeta);
if (stepMeta != null) {
StepMetaInterface smi = stepMeta.getStepMetaInterface();
if (smi instanceof BaseStepMeta) {
baseStepMeta = (BaseStepMeta) smi;
}
}
return baseStepMeta;
}
use of org.pentaho.di.trans.step.BaseStepMeta in project pentaho-metaverse by pentaho.
the class TransformationAnalyzer method getBaseStepMetaFromStepMeta.
protected BaseStepMeta getBaseStepMetaFromStepMeta(StepMeta stepMeta) {
// Attempt to discover a BaseStepMeta from the given StepMeta
BaseStepMeta baseStepMeta = new BaseStepMeta();
baseStepMeta.setParentStepMeta(stepMeta);
if (stepMeta != null) {
StepMetaInterface smi = stepMeta.getStepMetaInterface();
if (smi instanceof BaseStepMeta) {
baseStepMeta = (BaseStepMeta) smi;
}
}
return baseStepMeta;
}
use of org.pentaho.di.trans.step.BaseStepMeta in project pentaho-metaverse by pentaho.
the class StepAnalyzerProviderTest method testGetAnalyzersForClass.
@Test
public void testGetAnalyzersForClass() throws Exception {
Set<IStepAnalyzer> baseStepAnalyzerSet = Sets.newSet(mock(IStepAnalyzer.class));
Set<IStepAnalyzer> tableOutputStepAnalyzerSet = Sets.newSet(mock(IStepAnalyzer.class));
// Return the baseStepAnalyzer set if BaseStepMeta analyzers are requested
provider.analyzerTypeMap.put(BaseStepMeta.class, baseStepAnalyzerSet);
// Return the tableOutputStepAnalyzerSet set if TableOutputMeta analyzers are requested
provider.analyzerTypeMap.put(TableOutputMeta.class, tableOutputStepAnalyzerSet);
List<IStepAnalyzer> analyzers = provider.getAnalyzers(new ArrayList() {
{
add(BaseStepMeta.class);
add(TableOutputMeta.class);
}
});
assertEquals(analyzers.size(), 2);
analyzers = provider.getAnalyzers(new HashSet() {
{
add(TableOutputMeta.class);
}
});
assertEquals(analyzers.size(), 1);
}
use of org.pentaho.di.trans.step.BaseStepMeta in project pentaho-metaverse by pentaho.
the class AbstractStepMetaJsonSerializerTest method setUp.
@Before
public void setUp() throws Exception {
repo = new LineageRepository();
serializer = new BaseStepMetaJsonSerializer(BaseStepMeta.class, repo);
spyMeta = spy(new BaseStepMeta());
spyParent = spy(new StepMeta());
spyParentTrans = spy(new TransMeta());
when(spyMeta.getParentStepMeta()).thenReturn(spyParent);
when(spyParent.getName()).thenReturn(STEP_META_NAME);
}
Aggregations