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());
}
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));
}
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);
}
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;
}
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;
}
Aggregations