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);
}
}
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());
}
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());
}
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));
}
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));
}
Aggregations