Search in sources :

Example 21 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class SpoonTest method testJobToXMLFileSaveFileAsFailed.

@Test
public void testJobToXMLFileSaveFileAsFailed() throws Exception {
    JobMeta mockJobMeta = mock(JobMeta.class);
    // passing a invalid type so not running GUIResource class
    prepareSetSaveTests(spoon, log, mockSpoonPerspective, mockJobMeta, true, true, "NotMainSpoonPerspective", true, false, "Invalid TYPE", null, true, true);
    doCallRealMethod().when(spoon).saveFileAs(mockJobMeta);
    assertFalse(spoon.saveFileAs(mockJobMeta));
    verify(mockJobMeta).setRepository(spoon.rep);
    verify(mockJobMeta).setMetaStore(spoon.metaStore);
    verify(spoon).enableMenus();
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) Test(org.junit.Test)

Example 22 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class SpoonTest method testSetShellTextForJobWVersionEnabledRepIsNull.

@Test
public void testSetShellTextForJobWVersionEnabledRepIsNull() {
    JobMeta mockJobMeta = mock(JobMeta.class);
    Shell mockShell = prepareSetShellTextTests(spoon, mockJobMeta, true, false, true, false, false, false, false, false);
    verify(mockShell).setText("Spoon - jobName v1.0");
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) Shell(org.eclipse.swt.widgets.Shell) Test(org.junit.Test)

Example 23 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class EngineMetaUtilsTest method isJobOrTransformation_withJob.

@Test
public void isJobOrTransformation_withJob() {
    JobMeta jobInstance = new JobMeta();
    assertTrue(EngineMetaUtils.isJobOrTransformation(jobInstance));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) Test(org.junit.Test)

Example 24 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class SpoonDBDelegate method getSQL.

public void getSQL() {
    TransMeta transMeta = spoon.getActiveTransformation();
    if (transMeta != null) {
        getTransSQL(transMeta);
    }
    JobMeta jobMeta = spoon.getActiveJob();
    if (jobMeta != null) {
        getJobSQL(jobMeta);
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) TransMeta(org.pentaho.di.trans.TransMeta)

Example 25 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class SpoonJobDelegate method getJobEntryDialog.

public JobEntryDialogInterface getJobEntryDialog(JobEntryInterface jobEntryInterface, JobMeta jobMeta) {
    Class<?>[] paramClasses = new Class<?>[] { Shell.class, JobEntryInterface.class, Repository.class, JobMeta.class };
    Object[] paramArgs = new Object[] { spoon.getShell(), jobEntryInterface, spoon.getRepository(), jobMeta };
    PluginRegistry registry = PluginRegistry.getInstance();
    PluginInterface plugin = registry.getPlugin(JobEntryPluginType.class, jobEntryInterface);
    String dialogClassName = plugin.getClassMap().get(JobEntryDialogInterface.class);
    if (dialogClassName == null) {
        // try the deprecated way
        log.logDebug("Use of JobEntryInterface#getDialogClassName is deprecated, use PluginDialog annotation instead.");
        dialogClassName = jobEntryInterface.getDialogClassName();
    }
    try {
        Class<JobEntryDialogInterface> dialogClass = registry.getClass(plugin, dialogClassName);
        Constructor<JobEntryDialogInterface> dialogConstructor = dialogClass.getConstructor(paramClasses);
        JobEntryDialogInterface entryDialogInterface = dialogConstructor.newInstance(paramArgs);
        entryDialogInterface.setMetaStore(spoon.getMetaStore());
        return entryDialogInterface;
    } catch (Throwable t) {
        t.printStackTrace();
        String errorTitle = BaseMessages.getString(PKG, "Spoon.Dialog.ErrorCreatingJobDialog.Title");
        String errorMsg = BaseMessages.getString(PKG, "Spoon.Dialog.ErrorCreatingJobEntryDialog.Message", dialogClassName);
        spoon.getLog().logError(spoon.toString(), errorMsg);
        new ErrorDialog(spoon.getShell(), errorTitle, errorMsg, t);
        return null;
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobEntryInterface(org.pentaho.di.job.entry.JobEntryInterface) JobEntryDialogInterface(org.pentaho.di.job.entry.JobEntryDialogInterface) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) Shell(org.eclipse.swt.widgets.Shell) Repository(org.pentaho.di.repository.Repository) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry)

Aggregations

JobMeta (org.pentaho.di.job.JobMeta)254 Test (org.junit.Test)88 TransMeta (org.pentaho.di.trans.TransMeta)69 KettleException (org.pentaho.di.core.exception.KettleException)62 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)48 Job (org.pentaho.di.job.Job)45 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)27 Repository (org.pentaho.di.repository.Repository)25 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)25 Point (org.pentaho.di.core.gui.Point)24 ArrayList (java.util.ArrayList)23 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)22 SlaveServer (org.pentaho.di.cluster.SlaveServer)17 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)17 FileObject (org.apache.commons.vfs2.FileObject)16 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)16 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)15 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)15 PrintWriter (java.io.PrintWriter)12 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)12