Search in sources :

Example 1 with SFTPPutMeta

use of org.pentaho.di.trans.steps.sftpput.SFTPPutMeta in project pentaho-kettle by pentaho.

the class SFTPPutDialogTest method connectToSFTP_SeveralTimes_AlwaysReturnTrue.

@Test
public void connectToSFTP_SeveralTimes_AlwaysReturnTrue() throws Exception {
    SFTPClient sftp = mock(SFTPClient.class);
    SFTPPutDialog sod = new SFTPPutDialog(mock(Shell.class), new SFTPPutMeta(), mock(TransMeta.class), "SFTPPutDialogTest");
    SFTPPutDialog sodSpy = spy(sod);
    doReturn(sftp).when(sodSpy).createSFTPClient();
    assertTrue(sodSpy.connectToSFTP(false, null));
    assertTrue(sodSpy.connectToSFTP(false, null));
}
Also used : Shell(org.eclipse.swt.widgets.Shell) TransMeta(org.pentaho.di.trans.TransMeta) SFTPClient(org.pentaho.di.job.entries.sftp.SFTPClient) SFTPPutMeta(org.pentaho.di.trans.steps.sftpput.SFTPPutMeta) Test(org.junit.Test)

Example 2 with SFTPPutMeta

use of org.pentaho.di.trans.steps.sftpput.SFTPPutMeta in project pentaho-kettle by pentaho.

the class SFTPPutDialogTest method connectToSFTP_CreateNewConnection_AfterChange.

@Test
public void connectToSFTP_CreateNewConnection_AfterChange() throws Exception {
    SFTPClient sftp = mock(SFTPClient.class);
    SFTPPutMeta sodMeta = new SFTPPutMeta();
    SFTPPutDialog sod = new SFTPPutDialog(mock(Shell.class), sodMeta, mock(TransMeta.class), "SFTPPutDialogTest");
    SFTPPutDialog sodSpy = spy(sod);
    doReturn(sftp).when(sodSpy).createSFTPClient();
    assertTrue(sodSpy.connectToSFTP(false, null));
    sodMeta.setChanged(true);
    assertTrue(sodSpy.connectToSFTP(false, null));
    verify(sodSpy, times(2)).createSFTPClient();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) TransMeta(org.pentaho.di.trans.TransMeta) SFTPClient(org.pentaho.di.job.entries.sftp.SFTPClient) SFTPPutMeta(org.pentaho.di.trans.steps.sftpput.SFTPPutMeta) Test(org.junit.Test)

Aggregations

Shell (org.eclipse.swt.widgets.Shell)2 Test (org.junit.Test)2 SFTPClient (org.pentaho.di.job.entries.sftp.SFTPClient)2 TransMeta (org.pentaho.di.trans.TransMeta)2 SFTPPutMeta (org.pentaho.di.trans.steps.sftpput.SFTPPutMeta)2