use of org.guvnor.ala.ui.wildfly.service.TestConnectionResult in project kie-wb-common by kiegroup.
the class WildflyClientServiceImpl method testConnection.
@Override
public TestConnectionResult testConnection(final String host, final int port, final int managementPort, final String user, final String password) {
final TestConnectionResult result = new TestConnectionResult();
try {
final String testMessage = createWFClient(host, port, managementPort, user, password).testConnection();
result.setManagementConnectionError(false);
result.setManagementConnectionMessage(testMessage);
} catch (Exception e) {
result.setManagementConnectionError(true);
result.setManagementConnectionMessage(e.getMessage());
}
return result;
}
use of org.guvnor.ala.ui.wildfly.service.TestConnectionResult in project kie-wb-common by kiegroup.
the class WildflyClientServiceImplTest method testTestConnectionFailed.
@Test
public void testTestConnectionFailed() {
when(wfClient.testConnection()).thenThrow(new WildflyClientException(ERROR_MESSAGE));
TestConnectionResult result = wildflyClientService.testConnection(DUMMY_VALUE, DUMMY_INT_VALUE, DUMMY_INT_VALUE, DUMMY_VALUE, DUMMY_VALUE);
assertTrue(result.getManagementConnectionError());
assertEquals(ERROR_MESSAGE, result.getManagementConnectionMessage());
}
use of org.guvnor.ala.ui.wildfly.service.TestConnectionResult in project kie-wb-common by kiegroup.
the class WildflyClientServiceImplTest method testTestConnectionSuccessful.
@Test
public void testTestConnectionSuccessful() {
when(wfClient.testConnection()).thenReturn(CONNECTION_SUCCESSFUL);
TestConnectionResult result = wildflyClientService.testConnection(DUMMY_VALUE, DUMMY_INT_VALUE, DUMMY_INT_VALUE, DUMMY_VALUE, DUMMY_VALUE);
assertFalse(result.getManagementConnectionError());
assertEquals(CONNECTION_SUCCESSFUL, result.getManagementConnectionMessage());
}
use of org.guvnor.ala.ui.wildfly.service.TestConnectionResult in project kie-wb-common by kiegroup.
the class WF10ProviderConfigPresenterTest method testOnTestConnectionWhenConnectionFailed.
@Test
public void testOnTestConnectionWhenConnectionFailed() {
when(view.getTestConnectionFailMessage(ERROR_MESSAGE)).thenReturn(ERROR_MESSAGE_TRANSFORMED);
TestConnectionResult result = mock(TestConnectionResult.class);
when(result.getManagementConnectionError()).thenReturn(true);
when(result.getManagementConnectionMessage()).thenReturn(ERROR_MESSAGE);
when(wildflyClientService.testConnection(HOST_VALUE, Integer.parseInt(PORT_VALUE), Integer.parseInt(MANAGEMENT_PORT_VALUE), USER_VALUE, PASSWORD_VALUE)).thenReturn(result);
fillConnectionParams();
presenter.onTestConnection();
verify(view, times(1)).showInformationPopup(ERROR_MESSAGE_TRANSFORMED);
}
use of org.guvnor.ala.ui.wildfly.service.TestConnectionResult in project kie-wb-common by kiegroup.
the class WF10ProviderConfigPresenterTest method testOnTestConnectionWhenConnectionSuccessful.
@Test
public void testOnTestConnectionWhenConnectionSuccessful() {
when(view.getTestConnectionSuccessfulMessage(SUCCESS_MESSAGE)).thenReturn(SUCCESS_MESSAGE_TRANSFORMED);
TestConnectionResult result = mock(TestConnectionResult.class);
when(result.getManagementConnectionError()).thenReturn(false);
when(result.getManagementConnectionMessage()).thenReturn(SUCCESS_MESSAGE);
when(wildflyClientService.testConnection(HOST_VALUE, Integer.parseInt(PORT_VALUE), Integer.parseInt(MANAGEMENT_PORT_VALUE), USER_VALUE, PASSWORD_VALUE)).thenReturn(result);
fillConnectionParams();
presenter.onTestConnection();
verify(view, times(1)).showInformationPopup(SUCCESS_MESSAGE_TRANSFORMED);
}
Aggregations