Search in sources :

Example 26 with TransMeta

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);
}
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 27 with TransMeta

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());
}
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 28 with TransMeta

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();
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) DummyTransMeta(org.pentaho.di.trans.steps.dummytrans.DummyTransMeta) Test(org.junit.Test)

Example 29 with TransMeta

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();
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) DummyTransMeta(org.pentaho.di.trans.steps.dummytrans.DummyTransMeta) Test(org.junit.Test)

Example 30 with TransMeta

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");
}
Also used : Shell(org.eclipse.swt.widgets.Shell) TransMeta(org.pentaho.di.trans.TransMeta) DummyTransMeta(org.pentaho.di.trans.steps.dummytrans.DummyTransMeta) Test(org.junit.Test)

Aggregations

TransMeta (org.pentaho.di.trans.TransMeta)710 Test (org.junit.Test)289 StepMeta (org.pentaho.di.trans.step.StepMeta)234 Trans (org.pentaho.di.trans.Trans)214 KettleException (org.pentaho.di.core.exception.KettleException)150 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)136 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)117 TransHopMeta (org.pentaho.di.trans.TransHopMeta)115 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)109 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)106 StepInterface (org.pentaho.di.trans.step.StepInterface)76 RowStepCollector (org.pentaho.di.trans.RowStepCollector)73 JobMeta (org.pentaho.di.job.JobMeta)69 ArrayList (java.util.ArrayList)57 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)54 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)51 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)50 InjectorMeta (org.pentaho.di.trans.steps.injector.InjectorMeta)49 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)49 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)49