Search in sources :

Example 11 with EngineMetaInterface

use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.

the class SpoonTest method testVersioningEnabled.

@Test
public void testVersioningEnabled() throws Exception {
    Repository repository = Mockito.mock(Repository.class);
    RepositorySecurityProvider securityProvider = Mockito.mock(RepositorySecurityProvider.class);
    Mockito.doReturn(securityProvider).when(repository).getSecurityProvider();
    EngineMetaInterface jobTransMeta = Mockito.spy(new TransMeta());
    RepositoryDirectoryInterface repositoryDirectoryInterface = Mockito.mock(RepositoryDirectoryInterface.class);
    Mockito.doReturn("/home").when(repositoryDirectoryInterface).toString();
    Mockito.doReturn("trans").when(jobTransMeta).getName();
    Mockito.doReturn(RepositoryObjectType.TRANSFORMATION).when(jobTransMeta).getRepositoryElementType();
    Mockito.doReturn(true).when(jobTransMeta).getVersioningEnabled();
    boolean result = Spoon.isVersionEnabled(repository, jobTransMeta);
    Assert.assertTrue(result);
    Mockito.verify(securityProvider, Mockito.never()).isVersioningEnabled(Mockito.anyString());
}
Also used : RepositorySecurityProvider(org.pentaho.di.repository.RepositorySecurityProvider) RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) Repository(org.pentaho.di.repository.Repository) TransMeta(org.pentaho.di.trans.TransMeta) DummyTransMeta(org.pentaho.di.trans.steps.dummytrans.DummyTransMeta) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) Test(org.junit.Test)

Example 12 with EngineMetaInterface

use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.

the class EngineMetaUtilsTest method isJobOrTransformationReturnsFalse_withDatabase.

@Test
public void isJobOrTransformationReturnsFalse_withDatabase() {
    EngineMetaInterface testMetaInstance = mock(EngineMetaInterface.class);
    when(testMetaInstance.getRepositoryElementType()).thenReturn(RepositoryObjectType.DATABASE);
    assertFalse(EngineMetaUtils.isJobOrTransformation(testMetaInstance));
}
Also used : EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) Test(org.junit.Test)

Example 13 with EngineMetaInterface

use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.

the class StarModelerPerspective method setSelectedMeta.

public void setSelectedMeta(EngineMetaInterface meta) {
    EngineMetaInterface prevVal = this.selectedMeta;
    this.selectedMeta = meta;
    Spoon.getInstance().enableMenus();
    firePropertyChange("selectedMeta", prevVal, meta);
}
Also used : EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface)

Example 14 with EngineMetaInterface

use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.

the class RepositoryBrowserController method saveFile.

public boolean saveFile(String path, String name, String fileName, boolean override) {
    boolean result = checkForSecurityOrDupeIssues(path, name, fileName, override);
    if (result) {
        try {
            RepositoryDirectoryInterface repositoryDirectoryInterface = findDirectory(path);
            getSpoon().getDisplay().asyncExec(() -> {
                try {
                    EngineMetaInterface meta = getSpoon().getActiveMeta();
                    meta.setRepositoryDirectory(repositoryDirectoryInterface);
                    meta.setName(name);
                    getSpoon().saveToRepositoryConfirmed(meta);
                    getSpoon().delegates.tabs.renameTabs();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            });
        } catch (Exception e) {
            return false;
        }
    }
    return result;
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) KettleException(org.pentaho.di.core.exception.KettleException) KettleObjectExistsException(org.pentaho.di.core.exception.KettleObjectExistsException) KettleTransException(org.pentaho.di.core.exception.KettleTransException) KettleJobException(org.pentaho.di.core.exception.KettleJobException)

Example 15 with EngineMetaInterface

use of org.pentaho.di.core.EngineMetaInterface in project pentaho-kettle by pentaho.

the class Spoon method saveFile.

public boolean saveFile() {
    try {
        EngineMetaInterface meta = getActiveMeta();
        if (meta != null) {
            if (AbstractMeta.class.isAssignableFrom(meta.getClass()) && ((AbstractMeta) meta).hasMissingPlugins()) {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                mb.setMessage(BaseMessages.getString(PKG, "Spoon.ErrorDialog.MissingPlugin.Error"));
                mb.setText(BaseMessages.getString(PKG, "Spoon.ErrorDialog.MissingPlugin.Title"));
                mb.open();
                return false;
            }
            if (meta != null) {
                return saveToFile(meta);
            }
        }
    } catch (Exception e) {
        KettleRepositoryLostException krle = KettleRepositoryLostException.lookupStackStrace(e);
        if (krle != null) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.File.Save.Fail.Title"), krle.getPrefaceMessage(), krle);
            closeRepository();
        } else {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.File.Save.Fail.Title"), BaseMessages.getString(PKG, "Spoon.File.Save.Fail.Message"), e);
        }
    }
    return false;
}
Also used : AbstractMeta(org.pentaho.di.base.AbstractMeta) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) SWTException(org.eclipse.swt.SWTException) KettleRowException(org.pentaho.di.core.exception.KettleRowException) FileSystemException(org.apache.commons.vfs2.FileSystemException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleAuthException(org.pentaho.di.core.exception.KettleAuthException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) LifecycleException(org.pentaho.di.core.lifecycle.LifecycleException) KettleMissingPluginsException(org.pentaho.di.core.exception.KettleMissingPluginsException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) KettleException(org.pentaho.di.core.exception.KettleException) MalformedURLException(java.net.MalformedURLException) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)21 KettleException (org.pentaho.di.core.exception.KettleException)9 TransMeta (org.pentaho.di.trans.TransMeta)7 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)5 TransGraph (org.pentaho.di.ui.spoon.trans.TransGraph)5 MalformedURLException (java.net.MalformedURLException)4 FileSystemException (org.apache.commons.vfs2.FileSystemException)4 SWTException (org.eclipse.swt.SWTException)4 Test (org.junit.Test)4 KettleAuthException (org.pentaho.di.core.exception.KettleAuthException)4 KettleFileException (org.pentaho.di.core.exception.KettleFileException)4 KettleMissingPluginsException (org.pentaho.di.core.exception.KettleMissingPluginsException)4 KettleRowException (org.pentaho.di.core.exception.KettleRowException)4 KettleValueException (org.pentaho.di.core.exception.KettleValueException)4 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)4 LifecycleException (org.pentaho.di.core.lifecycle.LifecycleException)4 JobMeta (org.pentaho.di.job.JobMeta)4 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)4 Repository (org.pentaho.di.repository.Repository)4 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)4