use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class YamlInputDialog method preview.
// Preview the data
private void preview() {
try {
// Create the XML input step
YamlInputMeta oneMeta = new YamlInputMeta();
getInfo(oneMeta);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "YamlInputDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.NumberRows.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
if (!progressDialog.isCancelled()) {
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "YamlInputDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.ErrorPreviewingData.DialogMessage"), e);
}
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class TextFileInputDialog method preview.
// Preview the data
private void preview() {
// Create the XML input step
TextFileInputMeta oneMeta = new TextFileInputMeta();
getInfo(oneMeta);
if (oneMeta.isAcceptingFilenames()) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Message"));
mb.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Title"));
mb.open();
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SharedObjectSyncUtilTest method synchronizeSteps_sync_shared_only.
@Test
public void synchronizeSteps_sync_shared_only() throws Exception {
final String stepName = "Step";
TransMeta transformarion1 = createTransMeta();
StepMeta step1 = createStepMeta(stepName, true);
transformarion1.addStep(step1);
spoonDelegates.trans.addTransformation(transformarion1);
TransMeta transformarion2 = createTransMeta();
StepMeta unsharedStep2 = createStepMeta(stepName, false);
transformarion2.addStep(unsharedStep2);
spoonDelegates.trans.addTransformation(transformarion2);
TransMeta transformarion3 = createTransMeta();
StepMeta step3 = createStepMeta(stepName, true);
transformarion3.addStep(step3);
spoonDelegates.trans.addTransformation(transformarion3);
step3.setDescription(AFTER_SYNC_VALUE);
sharedUtil.synchronizeSteps(step3);
assertThat(step1.getDescription(), equalTo(AFTER_SYNC_VALUE));
assertThat(unsharedStep2.getDescription(), equalTo(BEFORE_SYNC_VALUE));
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SharedObjectSyncUtilTest method synchronizeClusterSchemas_sync_shared_only.
@Test
public void synchronizeClusterSchemas_sync_shared_only() throws Exception {
final String clusterSchemaName = "ClusterSchema";
TransMeta transformarion1 = createTransMeta();
ClusterSchema clusterSchema1 = createClusterSchema(clusterSchemaName, true);
transformarion1.setClusterSchemas(Collections.singletonList(clusterSchema1));
spoonDelegates.trans.addTransformation(transformarion1);
TransMeta transformarion2 = createTransMeta();
ClusterSchema unsharedClusterSchema2 = createClusterSchema(clusterSchemaName, false);
transformarion2.setClusterSchemas(Collections.singletonList(unsharedClusterSchema2));
spoonDelegates.trans.addTransformation(transformarion2);
TransMeta transformarion3 = createTransMeta();
ClusterSchema clusterSchema3 = createClusterSchema(clusterSchemaName, true);
transformarion3.setClusterSchemas(Collections.singletonList(clusterSchema3));
spoonDelegates.trans.addTransformation(transformarion3);
clusterSchema3.setDynamic(true);
sharedUtil.synchronizeClusterSchemas(clusterSchema3);
assertThat(clusterSchema1.isDynamic(), equalTo(true));
assertThat(unsharedClusterSchema2.isDynamic(), equalTo(false));
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SharedObjectSyncUtilTest method synchronizeClusterSchemas.
@Test
public void synchronizeClusterSchemas() throws Exception {
final String clusterSchemaName = "SharedClusterSchema";
TransMeta transformarion1 = createTransMeta();
ClusterSchema clusterSchema1 = createClusterSchema(clusterSchemaName, true);
transformarion1.setClusterSchemas(Collections.singletonList(clusterSchema1));
spoonDelegates.trans.addTransformation(transformarion1);
TransMeta transformarion2 = createTransMeta();
ClusterSchema clusterSchema2 = createClusterSchema(clusterSchemaName, true);
transformarion2.setClusterSchemas(Collections.singletonList(clusterSchema2));
spoonDelegates.trans.addTransformation(transformarion2);
clusterSchema2.setDynamic(true);
sharedUtil.synchronizeClusterSchemas(clusterSchema2);
assertThat(clusterSchema1.isDynamic(), equalTo(true));
}
Aggregations