use of org.pentaho.di.job.entries.trans.JobEntryTrans in project pentaho-kettle by pentaho.
the class JobMetaTest method testLookupRepositoryReferences.
@Test
public void testLookupRepositoryReferences() throws Exception {
jobMeta.clear();
JobEntryTrans jobEntryMock = mock(JobEntryTrans.class);
when(jobEntryMock.hasRepositoryReferences()).thenReturn(true);
JobEntryTrans brokenJobEntryMock = mock(JobEntryTrans.class);
when(brokenJobEntryMock.hasRepositoryReferences()).thenReturn(true);
doThrow(mock(IdNotFoundException.class)).when(brokenJobEntryMock).lookupRepositoryReferences(any(Repository.class));
JobEntryCopy jobEntryCopy1 = mock(JobEntryCopy.class);
when(jobEntryCopy1.getEntry()).thenReturn(jobEntryMock);
jobMeta.addJobEntry(0, jobEntryCopy1);
JobEntryCopy jobEntryCopy2 = mock(JobEntryCopy.class);
when(jobEntryCopy2.getEntry()).thenReturn(brokenJobEntryMock);
jobMeta.addJobEntry(1, jobEntryCopy2);
JobEntryCopy jobEntryCopy3 = mock(JobEntryCopy.class);
when(jobEntryCopy3.getEntry()).thenReturn(jobEntryMock);
jobMeta.addJobEntry(2, jobEntryCopy3);
try {
jobMeta.lookupRepositoryReferences(mock(Repository.class));
fail("no exception for broken entry");
} catch (LookupReferencesException e) {
// ok
}
verify(jobEntryMock, times(2)).lookupRepositoryReferences(any(Repository.class));
}
use of org.pentaho.di.job.entries.trans.JobEntryTrans in project pentaho-kettle by pentaho.
the class JobEntryTransDialog method getParameters.
private void getParameters(TransMeta inputTransMeta) {
try {
if (inputTransMeta == null) {
JobEntryTrans jet = new JobEntryTrans();
getInfo(jet);
inputTransMeta = jet.getTransMeta(rep, metaStore, jobMeta);
}
String[] parameters = inputTransMeta.listParameters();
String[] existing = wParameters.getItems(1);
for (int i = 0; i < parameters.length; i++) {
if (Const.indexOfString(parameters[i], existing) < 0) {
TableItem item = new TableItem(wParameters.table, SWT.NONE);
item.setText(1, parameters[i]);
}
}
wParameters.removeEmptyRows();
wParameters.setRowNums();
wParameters.optWidth(true);
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "JobEntryTransDialog.Exception.UnableToLoadTransformation.Title"), BaseMessages.getString(PKG, "JobEntryTransDialog.Exception.UnableToLoadTransformation.Message"), e);
}
}
Aggregations