Search in sources :

Example 1 with WildflyProviderImpl

use of org.guvnor.ala.wildfly.model.WildflyProviderImpl in project kie-wb-common by kiegroup.

the class WildflyAccessInterfaceImplTest method testWildflyClient.

@Test
public void testWildflyClient() {
    final String hostId = "localhost";
    final String port = "8081";
    final String managementPort = "9991";
    final String user = "admin";
    final String password = "pass";
    final WildflyClient client = accessInterface.getWildflyClient(new WildflyProviderImpl(new WildflyProviderConfigImpl(PROVIDER, hostId, port, managementPort, user, password)));
    assertNotNull(client);
    assertEquals(client.getPort(), 8081);
    assertEquals(client.getManagementPort(), 9991);
    assertEquals(client.getHost(), hostId);
    assertEquals(client.getProviderName(), PROVIDER);
    assertEquals(client.getUser(), user);
    assertEquals(client.getPassword(), password);
}
Also used : WildflyProviderImpl(org.guvnor.ala.wildfly.model.WildflyProviderImpl) WildflyClient(org.guvnor.ala.wildfly.access.WildflyClient) WildflyProviderConfigImpl(org.guvnor.ala.wildfly.config.impl.WildflyProviderConfigImpl) Test(org.junit.Test)

Example 2 with WildflyProviderImpl

use of org.guvnor.ala.wildfly.model.WildflyProviderImpl in project kie-wb-common by kiegroup.

the class WildflyAccessInterfaceImplTest method testWildflyClientNull.

@Test
public void testWildflyClientNull() {
    final WildflyClient client = accessInterface.getWildflyClient(new WildflyProviderImpl(new WildflyProviderConfigImpl(PROVIDER, null, null, null, null, null)));
    assertNotNull(client);
    assertEquals(client.getPort(), 8080);
    assertEquals(client.getManagementPort(), 9990);
}
Also used : WildflyProviderImpl(org.guvnor.ala.wildfly.model.WildflyProviderImpl) WildflyClient(org.guvnor.ala.wildfly.access.WildflyClient) WildflyProviderConfigImpl(org.guvnor.ala.wildfly.config.impl.WildflyProviderConfigImpl) Test(org.junit.Test)

Example 3 with WildflyProviderImpl

use of org.guvnor.ala.wildfly.model.WildflyProviderImpl in project kie-wb-common by kiegroup.

the class WildflyProviderConfigExecutor method apply.

@Override
public Optional<WildflyProvider> apply(final WildflyProviderConfig wildflyProviderConfig) {
    if (wildflyProviderConfig.getName() == null || wildflyProviderConfig.getName().isEmpty()) {
        throw new ProvisioningException("No name was provided for the WildflyProviderConfig.getName() " + "configuration parameter. You might probably have to properly set " + "the pipeline input parameter: " + ProviderConfig.PROVIDER_NAME);
    }
    Provider provider = runtimeRegistry.getProvider(wildflyProviderConfig.getName());
    WildflyProvider wildflyProvider;
    if (provider != null) {
        if (!(provider instanceof WildflyProvider)) {
            throw new ProvisioningException("The provider: " + wildflyProviderConfig.getName() + " must be an instance of " + WildflyProviderConfig.class + " but is: " + provider.getClass());
        } else {
            wildflyProvider = (WildflyProvider) provider;
        }
    } else {
        wildflyProvider = new WildflyProviderImpl(new WildflyProviderConfigImpl(wildflyProviderConfig.getName(), wildflyProviderConfig.getHost(), wildflyProviderConfig.getPort(), wildflyProviderConfig.getManagementPort(), wildflyProviderConfig.getUser(), wildflyProviderConfig.getPassword()));
        runtimeRegistry.registerProvider(wildflyProvider);
    }
    return Optional.of(wildflyProvider);
}
Also used : WildflyProviderConfig(org.guvnor.ala.wildfly.config.WildflyProviderConfig) WildflyProviderImpl(org.guvnor.ala.wildfly.model.WildflyProviderImpl) ProvisioningException(org.guvnor.ala.exceptions.ProvisioningException) WildflyProviderConfigImpl(org.guvnor.ala.wildfly.config.impl.WildflyProviderConfigImpl) Provider(org.guvnor.ala.runtime.providers.Provider) WildflyProvider(org.guvnor.ala.wildfly.model.WildflyProvider) WildflyProvider(org.guvnor.ala.wildfly.model.WildflyProvider)

Aggregations

WildflyProviderConfigImpl (org.guvnor.ala.wildfly.config.impl.WildflyProviderConfigImpl)3 WildflyProviderImpl (org.guvnor.ala.wildfly.model.WildflyProviderImpl)3 WildflyClient (org.guvnor.ala.wildfly.access.WildflyClient)2 Test (org.junit.Test)2 ProvisioningException (org.guvnor.ala.exceptions.ProvisioningException)1 Provider (org.guvnor.ala.runtime.providers.Provider)1 WildflyProviderConfig (org.guvnor.ala.wildfly.config.WildflyProviderConfig)1 WildflyProvider (org.guvnor.ala.wildfly.model.WildflyProvider)1