Search in sources :

Example 1 with TestConnectionResult

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;
}
Also used : TestConnectionResult(org.guvnor.ala.ui.wildfly.service.TestConnectionResult)

Example 2 with TestConnectionResult

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());
}
Also used : WildflyClientException(org.guvnor.ala.wildfly.access.exceptions.WildflyClientException) TestConnectionResult(org.guvnor.ala.ui.wildfly.service.TestConnectionResult) Test(org.junit.Test)

Example 3 with TestConnectionResult

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());
}
Also used : TestConnectionResult(org.guvnor.ala.ui.wildfly.service.TestConnectionResult) Test(org.junit.Test)

Example 4 with TestConnectionResult

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);
}
Also used : TestConnectionResult(org.guvnor.ala.ui.wildfly.service.TestConnectionResult) Test(org.junit.Test)

Example 5 with TestConnectionResult

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);
}
Also used : TestConnectionResult(org.guvnor.ala.ui.wildfly.service.TestConnectionResult) Test(org.junit.Test)

Aggregations

TestConnectionResult (org.guvnor.ala.ui.wildfly.service.TestConnectionResult)5 Test (org.junit.Test)4 WildflyClientException (org.guvnor.ala.wildfly.access.exceptions.WildflyClientException)1