Search in sources :

Example 11 with StepMeta

use of org.pentaho.di.trans.step.StepMeta in project pentaho-kettle by pentaho.

the class UpdateDialog method create.

// Generate code for create table...
// Conversions done by Database
private void create() {
    try {
        UpdateMeta info = new UpdateMeta();
        getInfo(info);
        // new name might not yet be linked to other steps!
        String name = stepname;
        StepMeta stepinfo = new StepMeta(BaseMessages.getString(PKG, "UpdateDialog.StepMeta.Title"), name, info);
        RowMetaInterface prev = transMeta.getPrevStepFields(stepname);
        SQLStatement sql = info.getSQLStatements(transMeta, stepinfo, prev, repository, metaStore);
        if (!sql.hasError()) {
            if (sql.hasSQL()) {
                SQLEditor sqledit = new SQLEditor(transMeta, shell, SWT.NONE, info.getDatabaseMeta(), transMeta.getDbCache(), sql.getSQL());
                sqledit.open();
            } else {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
                mb.setMessage(BaseMessages.getString(PKG, "UpdateDialog.NoSQLNeeds.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "UpdateDialog.NoSQLNeeds.DialogTitle"));
                mb.open();
            }
        } else {
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
            mb.setMessage(sql.getError());
            mb.setText(BaseMessages.getString(PKG, "UpdateDialog.SQLError.DialogTitle"));
            mb.open();
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "UpdateDialog.CouldNotBuildSQL.DialogTitle"), BaseMessages.getString(PKG, "UpdateDialog.CouldNotBuildSQL.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) SQLEditor(org.pentaho.di.ui.core.database.dialog.SQLEditor) UpdateMeta(org.pentaho.di.trans.steps.update.UpdateMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) SQLStatement(org.pentaho.di.core.SQLStatement) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 12 with StepMeta

use of org.pentaho.di.trans.step.StepMeta in project pentaho-kettle by pentaho.

the class GraphTest method testRightClickNoSelection.

@Test
public void testRightClickNoSelection() {
    TransGraph graph = mock(TransGraph.class);
    StepMeta meta1 = mock(StepMeta.class);
    wireSelected(meta1);
    List<StepMeta> selected = new ArrayList<>();
    doCallRealMethod().when(graph).doRightClickSelection(meta1, selected);
    graph.doRightClickSelection(meta1, selected);
    assertEquals(1, selected.size());
    assertTrue(selected.contains(meta1));
    assertTrue(meta1.isSelected());
}
Also used : ArrayList(java.util.ArrayList) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Example 13 with StepMeta

use of org.pentaho.di.trans.step.StepMeta in project pentaho-kettle by pentaho.

the class GraphTest method testRightClickStepSelection.

@Test
public void testRightClickStepSelection() {
    TransGraph graph = mock(TransGraph.class);
    StepMeta meta1 = mock(StepMeta.class);
    StepMeta meta2 = mock(StepMeta.class);
    StepMeta meta3 = mock(StepMeta.class);
    wireSelected(meta1, meta2, meta3);
    List<StepMeta> selected = new ArrayList<>(2);
    meta2.setSelected(true);
    meta3.setSelected(true);
    selected.add(meta2);
    selected.add(meta3);
    doCallRealMethod().when(graph).doRightClickSelection(meta1, selected);
    graph.doRightClickSelection(meta1, selected);
    assertTrue(meta1.isSelected());
    assertEquals(meta1, selected.get(0));
    assertEquals(1, selected.size());
    assertFalse(meta2.isSelected() || meta3.isSelected());
}
Also used : ArrayList(java.util.ArrayList) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Example 14 with StepMeta

use of org.pentaho.di.trans.step.StepMeta 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 15 with StepMeta

use of org.pentaho.di.trans.step.StepMeta in project pentaho-kettle by pentaho.

the class SharedObjectSyncUtilTest method synchronizeSteps_should_not_sync_unshared.

@Test
public void synchronizeSteps_should_not_sync_unshared() 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 step2 = createStepMeta(stepName, false);
    transformarion2.addStep(step2);
    spoonDelegates.trans.addTransformation(transformarion2);
    step2.setDescription(AFTER_SYNC_VALUE);
    sharedUtil.synchronizeSteps(step2);
    assertThat(step1.getDescription(), equalTo(BEFORE_SYNC_VALUE));
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Aggregations

StepMeta (org.pentaho.di.trans.step.StepMeta)637 TransMeta (org.pentaho.di.trans.TransMeta)228 KettleException (org.pentaho.di.core.exception.KettleException)174 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)167 Test (org.junit.Test)162 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)147 TransHopMeta (org.pentaho.di.trans.TransHopMeta)128 Trans (org.pentaho.di.trans.Trans)119 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)113 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)107 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)106 StepInterface (org.pentaho.di.trans.step.StepInterface)92 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)79 Point (org.pentaho.di.core.gui.Point)79 FormAttachment (org.eclipse.swt.layout.FormAttachment)76 FormData (org.eclipse.swt.layout.FormData)76 FormLayout (org.eclipse.swt.layout.FormLayout)76 Label (org.eclipse.swt.widgets.Label)76 Shell (org.eclipse.swt.widgets.Shell)76 Button (org.eclipse.swt.widgets.Button)75