Search in sources :

Example 1 with FileTransferConfigurator

use of com.axway.ats.action.filetransfer.FileTransferConfigurator in project ats-framework by Axway.

the class Test_GenericTransferClient method testConnectUsingCustomClient.

@Test(expected = AssertionError.class)
public void testConnectUsingCustomClient() throws Exception {
    String customFileTransferClientName = "SomeCustomClientClass";
    mockStatic(FileTransferConfigurator.class);
    FileTransferConfigurator mockFileTransferConfigurator = createMock(FileTransferConfigurator.class);
    expect(FileTransferConfigurator.getInstance()).andReturn(mockFileTransferConfigurator);
    expect(mockFileTransferConfigurator.getFileTransferClient(TransferProtocol.HTTP_CUSTOM)).andReturn(customFileTransferClientName);
    IFileTransferClient basicClient = createMock(IFileTransferClient.class);
    mockStatic(ClientFactory.class);
    expect(ClientFactory.getInstance()).andReturn(factoryMock);
    expect(factoryMock.getClient(TransferProtocol.HTTP_CUSTOM, TransferProtocol.HTTP_CUSTOM.getDefaultPort(), customFileTransferClientName)).andReturn(basicClient);
    basicClient.connect(SAMPLE_HOST_NAME, SAMPLE_USER_NAME, SAMPLE_PASSWORD);
    replayAll();
    mockedTestObject = new FileTransferClient(TransferProtocol.HTTP_CUSTOM);
    mockedTestObject.connect(SAMPLE_HOST_NAME, SAMPLE_USER_NAME, SAMPLE_PASSWORD);
    verifyAll();
}
Also used : IFileTransferClient(com.axway.ats.core.filetransfer.model.IFileTransferClient) IFileTransferClient(com.axway.ats.core.filetransfer.model.IFileTransferClient) FileTransferClient(com.axway.ats.action.filetransfer.FileTransferClient) FileTransferConfigurator(com.axway.ats.action.filetransfer.FileTransferConfigurator) BaseTest(com.axway.ats.action.BaseTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

BaseTest (com.axway.ats.action.BaseTest)1 FileTransferClient (com.axway.ats.action.filetransfer.FileTransferClient)1 FileTransferConfigurator (com.axway.ats.action.filetransfer.FileTransferConfigurator)1 IFileTransferClient (com.axway.ats.core.filetransfer.model.IFileTransferClient)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1