use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class JobExecutionConfiguration method getUsedArguments.
public void getUsedArguments(JobMeta jobMeta, String[] commandLineArguments, IMetaStore metaStore) {
for (JobEntryCopy jobEntryCopy : jobMeta.jobcopies) {
if (jobEntryCopy.isTransformation()) {
JobEntryTrans jobEntryTrans = (JobEntryTrans) jobEntryCopy.getEntry();
try {
TransMeta transMeta = jobEntryTrans.getTransMeta(repository, metaStore, jobMeta);
Map<String, String> map = transMeta.getUsedArguments(commandLineArguments);
for (String key : map.keySet()) {
String value = map.get(key);
if (!arguments.containsKey(key)) {
arguments.put(key, value);
}
}
} catch (KettleException ke) {
// suppress exceptions at this time - we will let the runtime report on any errors
}
}
}
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SalesforceInputDialog method preview.
// Preview the data
private void preview() {
try {
SalesforceInputMeta oneMeta = new SalesforceInputMeta();
getInfo(oneMeta);
// check if the path is given
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "SalesforceInputDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "SalesforceInputDialog.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, "SalesforceInputDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "SalesforceInputDialog.ErrorPreviewingData.DialogMessage"), e);
}
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SalesforceInputTest method doConversions.
@Test
public void doConversions() throws Exception {
StepMeta stepMeta = new StepMeta();
String name = "test";
stepMeta.setName(name);
StepDataInterface stepDataInterface = Mockito.mock(StepDataInterface.class);
int copyNr = 0;
TransMeta transMeta = Mockito.mock(TransMeta.class);
Trans trans = Mockito.mock(Trans.class);
Mockito.when(transMeta.findStep(Mockito.eq(name))).thenReturn(stepMeta);
SalesforceInput salesforceInput = new SalesforceInput(stepMeta, stepDataInterface, copyNr, transMeta, trans);
SalesforceInputMeta meta = new SalesforceInputMeta();
SalesforceInputData data = new SalesforceInputData();
data.outputRowMeta = Mockito.mock(RowMeta.class);
Mockito.when(data.outputRowMeta.getValueMeta(Mockito.eq(0))).thenReturn(new ValueMetaBinary());
data.convertRowMeta = Mockito.mock(RowMeta.class);
Mockito.when(data.convertRowMeta.getValueMeta(Mockito.eq(0))).thenReturn(new ValueMetaString());
Field metaField = salesforceInput.getClass().getDeclaredField("meta");
metaField.setAccessible(true);
metaField.set(salesforceInput, meta);
Field dataField = salesforceInput.getClass().getDeclaredField("data");
dataField.setAccessible(true);
dataField.set(salesforceInput, data);
Object[] outputRowData = new Object[1];
byte[] binary = { 0, 1, 0, 1, 1, 1 };
salesforceInput.doConversions(outputRowData, 0, new String(Base64.encode(binary)));
Assert.assertArrayEquals(binary, (byte[]) outputRowData[0]);
binary = new byte[0];
salesforceInput.doConversions(outputRowData, 0, new String(Base64.encode(binary)));
Assert.assertArrayEquals(binary, (byte[]) outputRowData[0]);
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class S3CsvInputDialog method preview.
// Preview the data
private void preview() {
// Create the XML input step
S3CsvInputMeta oneMeta = new S3CsvInputMeta();
getInfo(oneMeta);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), Messages.getString("S3CsvInputDialog.PreviewSize.DialogTitle"), Messages.getString("S3CsvInputDialog.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, Messages.getString("System.Dialog.PreviewError.Title"), Messages.getString("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 PurRepository_RepositoryDirectory_IT method setup.
@Before
public void setup() throws Exception {
transMeta = new TransMeta();
transMeta.setName("Test");
transMeta.setRepositoryDirectory(purRepository.getDefaultSaveDirectory(transMeta));
final Calendar date = Calendar.getInstance();
date.setTimeInMillis(0);
purRepository.save(transMeta, "test", date, null, false);
createPurRepository();
defaultSaveDirectory = purRepository.getDefaultSaveDirectory(transMeta);
purRepository.createRepositoryDirectory(defaultSaveDirectory, "test dir");
defaultSaveDirectory = purRepository.getDefaultSaveDirectory(transMeta);
}
Aggregations