Search in sources :

Example 6 with TransMeta

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);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) YamlInputMeta(org.pentaho.di.trans.steps.yamlinput.YamlInputMeta) Trans(org.pentaho.di.trans.Trans)

Example 7 with TransMeta

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();
    }
}
Also used : TextFileInputMeta(org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) Trans(org.pentaho.di.trans.Trans) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 8 with TransMeta

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));
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Example 9 with TransMeta

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));
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) ClusterSchema(org.pentaho.di.cluster.ClusterSchema) Test(org.junit.Test)

Example 10 with TransMeta

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));
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) ClusterSchema(org.pentaho.di.cluster.ClusterSchema) Test(org.junit.Test)

Aggregations

TransMeta (org.pentaho.di.trans.TransMeta)710 Test (org.junit.Test)289 StepMeta (org.pentaho.di.trans.step.StepMeta)234 Trans (org.pentaho.di.trans.Trans)214 KettleException (org.pentaho.di.core.exception.KettleException)150 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)136 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)117 TransHopMeta (org.pentaho.di.trans.TransHopMeta)115 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)109 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)106 StepInterface (org.pentaho.di.trans.step.StepInterface)76 RowStepCollector (org.pentaho.di.trans.RowStepCollector)73 JobMeta (org.pentaho.di.job.JobMeta)69 ArrayList (java.util.ArrayList)57 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)54 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)51 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)50 InjectorMeta (org.pentaho.di.trans.steps.injector.InjectorMeta)49 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)49 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)49