use of org.pentaho.di.trans.step.StepPartitioningMeta in project pentaho-kettle by pentaho.
the class TransPartitioningTest method prepareStepMetas_cl1_cl2.
/**
* This is a case when we have 2 steps, but partitioned differently
*
* @throws KettlePluginException
*/
private void prepareStepMetas_cl1_cl2() throws KettlePluginException {
StepMeta dummy1 = new StepMeta(ONE, null);
StepMeta dummy2 = new StepMeta(TWO, null);
PartitionSchema schema1 = new PartitionSchema("p1", Arrays.asList(new String[] { PID1, PID2 }));
PartitionSchema schema2 = new PartitionSchema("p2", Arrays.asList(new String[] { PID1, PID2 }));
StepPartitioningMeta partMeta1 = new StepPartitioningMeta("Mirror to all partitions", schema1);
StepPartitioningMeta partMeta2 = new StepPartitioningMeta("Mirror to all partitions", schema2);
partMeta1.setPartitionSchemaName(schema1.getName());
partMeta2.setPartitionSchemaName(schema2.getName());
dummy1.setStepPartitioningMeta(partMeta1);
dummy2.setStepPartitioningMeta(partMeta2);
chain.add(dummy1);
chain.add(dummy2);
for (StepMeta item : chain) {
item.setStepMetaInterface(new DummyTransMeta());
}
}
use of org.pentaho.di.trans.step.StepPartitioningMeta in project pentaho-kettle by pentaho.
the class PartitionSettingsTest method defaultSelectedSchemaIndexWhenSchemaNameIsNotDefined.
@Test
public void defaultSelectedSchemaIndexWhenSchemaNameIsNotDefined() throws Exception {
PartitionSchema schema = new PartitionSchema();
StepPartitioningMeta meta = mock(StepPartitioningMeta.class);
when(meta.getPartitionSchema()).thenReturn(schema);
when(stepMeta.getStepPartitioningMeta()).thenReturn(meta);
List<String> schemas = Arrays.asList("test");
when(partitionSchemasProvider.getPartitionSchemasNames(any(TransMeta.class))).thenReturn(schemas);
assertEquals(0, settings.getDefaultSelectedSchemaIndex());
}
use of org.pentaho.di.trans.step.StepPartitioningMeta in project pentaho-kettle by pentaho.
the class SpoonStepsDelegate method getPartitionerDialog.
public StepDialogInterface getPartitionerDialog(StepMeta stepMeta, StepPartitioningMeta partitioningMeta, TransMeta transMeta) throws KettleException {
Partitioner partitioner = partitioningMeta.getPartitioner();
String dialogClassName = partitioner.getDialogClassName();
Class<?> dialogClass;
Class<?>[] paramClasses = new Class<?>[] { Shell.class, StepMeta.class, StepPartitioningMeta.class, TransMeta.class };
Object[] paramArgs = new Object[] { spoon.getShell(), stepMeta, partitioningMeta, transMeta };
Constructor<?> dialogConstructor;
try {
dialogClass = partitioner.getClass().getClassLoader().loadClass(dialogClassName);
dialogConstructor = dialogClass.getConstructor(paramClasses);
return (StepDialogInterface) dialogConstructor.newInstance(paramArgs);
} catch (Exception e) {
// try the old way for compatibility
Method method;
try {
Class<?>[] sig = new Class<?>[] { Shell.class, StepMetaInterface.class, TransMeta.class };
method = stepMeta.getClass().getDeclaredMethod("getDialog", sig);
if (method != null) {
return (StepDialogInterface) method.invoke(stepMeta, new Object[] { spoon.getShell(), stepMeta, transMeta });
}
} catch (Throwable ignored) {
}
throw new KettleException(e);
}
}
Aggregations