use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SpoonTest method testVersioningCheckingOnServer.
@Test
public void testVersioningCheckingOnServer() 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(securityProvider).isVersioningEnabled(Mockito.anyString());
boolean result = Spoon.isVersionEnabled(repository, jobTransMeta);
Assert.assertTrue(result);
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SpoonTest method testVersioningDisabled.
@Test
public void testVersioningDisabled() 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(false).when(jobTransMeta).getVersioningEnabled();
boolean result = Spoon.isVersionEnabled(repository, jobTransMeta);
Assert.assertFalse(result);
Mockito.verify(securityProvider, Mockito.never()).isVersioningEnabled(Mockito.anyString());
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SpoonTest method testTransToXMLFileSaveFileAsFailed.
@Test
public void testTransToXMLFileSaveFileAsFailed() throws Exception {
TransMeta mockTransMeta = mock(TransMeta.class);
// passing a invalid type so not running GUIResource class
prepareSetSaveTests(spoon, log, mockSpoonPerspective, mockTransMeta, true, true, "NotMainSpoonPerspective", true, false, "Invalid TYPE", null, true, true);
doCallRealMethod().when(spoon).saveFileAs(mockTransMeta);
assertFalse(spoon.saveFileAs(mockTransMeta));
verify(mockTransMeta).setRepository(spoon.rep);
verify(mockTransMeta).setMetaStore(spoon.metaStore);
verify(spoon).enableMenus();
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SpoonTest method testTransToXMLFileSaveFileAs.
@Test
public void testTransToXMLFileSaveFileAs() throws Exception {
TransMeta mockTransMeta = mock(TransMeta.class);
// passing a invalid type so not running GUIResource class
prepareSetSaveTests(spoon, log, mockSpoonPerspective, mockTransMeta, true, true, "NotMainSpoonPerspective", true, true, "Invalid TYPE", null, true, true);
doCallRealMethod().when(spoon).saveFileAs(mockTransMeta);
assertTrue(spoon.saveFileAs(mockTransMeta));
verify(mockTransMeta).setRepository(spoon.rep);
verify(mockTransMeta).setMetaStore(spoon.metaStore);
verify(spoon.delegates.tabs).findTabMapEntry(mockTransMeta);
verify(spoon).enableMenus();
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SpoonTest method testSetShellTextForTransformationWVersionEnabledRevIsNull.
@Test
public void testSetShellTextForTransformationWVersionEnabledRevIsNull() {
TransMeta mockTransMeta = mock(TransMeta.class);
Shell mockShell = prepareSetShellTextTests(spoon, mockTransMeta, true, true, true, true, false, false, false, false);
verify(mockShell).setText("Spoon - transformationName");
}
Aggregations