Search in sources :

Example 16 with JobEntryTrans

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));
}
Also used : LookupReferencesException(org.pentaho.di.core.exception.LookupReferencesException) Repository(org.pentaho.di.repository.Repository) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) IdNotFoundException(org.pentaho.di.core.exception.IdNotFoundException) Test(org.junit.Test)

Example 17 with JobEntryTrans

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);
    }
}
Also used : JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) TableItem(org.eclipse.swt.widgets.TableItem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) KettleException(org.pentaho.di.core.exception.KettleException)

Aggregations

JobEntryTrans (org.pentaho.di.job.entries.trans.JobEntryTrans)17 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)14 JobMeta (org.pentaho.di.job.JobMeta)10 Test (org.junit.Test)7 KettleException (org.pentaho.di.core.exception.KettleException)7 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)5 JobEntryInterface (org.pentaho.di.job.entry.JobEntryInterface)5 DefaultRunConfiguration (org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration)4 TransMeta (org.pentaho.di.trans.TransMeta)4 ArrayList (java.util.ArrayList)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 FileObject (org.apache.commons.vfs2.FileObject)2 ObjectLocationSpecificationMethod (org.pentaho.di.core.ObjectLocationSpecificationMethod)2 EmbeddedMetaStore (org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)2 Utils (org.pentaho.di.core.util.Utils)2 JobEntryJob (org.pentaho.di.job.entries.job.JobEntryJob)2 IOException (java.io.IOException)1