Search in sources :

Example 1 with WildflyProviderConfig

use of org.guvnor.ala.wildfly.config.WildflyProviderConfig in project kie-wb-common by kiegroup.

the class ProvisioningPipelinesProducer method getWildflyPipeline.

/**
 * Produces a pipeline for provisioning building an provisioning war applications into an Wildlfy server.
 */
@Produces
public SystemPipelineDescriptor getWildflyPipeline() {
    return new SystemPipelineDescriptor() {

        @Override
        public Optional<ProviderType> getProviderType() {
            return Optional.of(WildflyProviderType.instance());
        }

        @Override
        public Pipeline getPipeline() {
            // Create Wildfly Pipeline Configuration
            final GitConfig gitConfig = new GitConfig() {
            };
            final MavenProjectConfig projectConfig = new MavenProjectConfig() {
            };
            final MavenBuildConfig mavenBuildConfig = new MavenBuildConfig() {

                @Override
                public List<String> getGoals() {
                    final List<String> result = new ArrayList<>();
                    result.add("clean");
                    result.add("package");
                    return result;
                }

                @Override
                public Properties getProperties() {
                    final Properties result = new Properties();
                    result.setProperty("failIfNoTests", "false");
                    return result;
                }
            };
            final MavenBuildExecConfig mavenBuildExecConfig = new MavenBuildExecConfig() {
            };
            final WildflyProviderConfig wildflyProviderConfig = new WildflyProviderConfig() {
            };
            final ContextAwareWildflyRuntimeExecConfig wildflyRuntimeExecConfig = new ContextAwareWildflyRuntimeExecConfig() {
            };
            final Pipeline pipeline = PipelineFactory.newBuilder().addConfigStage("Git Source", gitConfig).addConfigStage("Maven Project", projectConfig).addConfigStage("Maven Build Config", mavenBuildConfig).addConfigStage("Maven Build", mavenBuildExecConfig).addConfigStage("Wildfly Provider Config", wildflyProviderConfig).addConfigStage("Wildfly Runtime Exec", wildflyRuntimeExecConfig).buildAs("source-to-wildlfy-provisioning");
            return pipeline;
        }
    };
}
Also used : WildflyProviderConfig(org.guvnor.ala.wildfly.config.WildflyProviderConfig) ArrayList(java.util.ArrayList) MavenBuildConfig(org.guvnor.ala.build.maven.config.MavenBuildConfig) Properties(java.util.Properties) Pipeline(org.guvnor.ala.pipeline.Pipeline) MavenBuildExecConfig(org.guvnor.ala.build.maven.config.MavenBuildExecConfig) SystemPipelineDescriptor(org.guvnor.ala.pipeline.SystemPipelineDescriptor) MavenProjectConfig(org.guvnor.ala.build.maven.config.MavenProjectConfig) ContextAwareWildflyRuntimeExecConfig(org.guvnor.ala.wildfly.config.impl.ContextAwareWildflyRuntimeExecConfig) GitConfig(org.guvnor.ala.source.git.config.GitConfig) ProviderType(org.guvnor.ala.runtime.providers.ProviderType) WildflyProviderType(org.guvnor.ala.wildfly.model.WildflyProviderType) Produces(javax.enterprise.inject.Produces)

Example 2 with WildflyProviderConfig

use of org.guvnor.ala.wildfly.config.WildflyProviderConfig in project kie-wb-common by kiegroup.

the class WildflyProviderConfigConverterTest method testToDomain.

@Test
public void testToDomain() {
    Map<String, Object> values = new HashMap<>();
    values.put(HOST, HOST_VALUE);
    values.put(PORT, PORT_VALUE);
    values.put(MANAGEMENT_PORT, MANAGEMENT_PORT_VALUE);
    values.put(WILDFLY_USER, WILDFLY_USER_VALUE);
    values.put(WILDFLY_PASSWORD, WILDFLY_PASSWORD_VALUE);
    ProviderConfiguration configuration = new ProviderConfiguration(PROVIDER_NAME_VALUE, values);
    WildflyProviderConfig result = converter.toDomain(configuration);
    assertNotNull(result);
    assertEquals(PROVIDER_NAME_VALUE, result.getName());
    assertEquals(HOST_VALUE, result.getHost());
    assertEquals(PORT_VALUE, result.getPort());
    assertEquals(MANAGEMENT_PORT_VALUE, result.getManagementPort());
    assertEquals(WILDFLY_USER_VALUE, result.getUser());
    assertEquals(WILDFLY_PASSWORD_VALUE, result.getPassword());
}
Also used : WildflyProviderConfig(org.guvnor.ala.wildfly.config.WildflyProviderConfig) HashMap(java.util.HashMap) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 3 with WildflyProviderConfig

use of org.guvnor.ala.wildfly.config.WildflyProviderConfig in project kie-wb-common by kiegroup.

the class WildflyProviderConfigConverterTest method testToModel.

@Test
public void testToModel() {
    WildflyProviderConfig config = mock(WildflyProviderConfig.class);
    when(config.getName()).thenReturn(PROVIDER_NAME_VALUE);
    when(config.getHost()).thenReturn(HOST_VALUE);
    when(config.getPort()).thenReturn(PORT_VALUE);
    when(config.getManagementPort()).thenReturn(MANAGEMENT_PORT_VALUE);
    when(config.getUser()).thenReturn(WILDFLY_USER_VALUE);
    when(config.getPassword()).thenReturn(WILDFLY_PASSWORD_VALUE);
    ProviderConfiguration result = converter.toModel(config);
    assertNotNull(result);
    assertEquals(PROVIDER_NAME_VALUE, result.getId());
    assertEquals(HOST_VALUE, result.getValues().get(HOST));
    assertEquals(PORT_VALUE, result.getValues().get(PORT));
    assertEquals(MANAGEMENT_PORT_VALUE, result.getValues().get(MANAGEMENT_PORT));
    assertEquals(WILDFLY_USER_VALUE, result.getValues().get(WILDFLY_USER));
    assertEquals(WILDFLY_PASSWORD_VALUE, result.getValues().get(WILDFLY_PASSWORD));
}
Also used : WildflyProviderConfig(org.guvnor.ala.wildfly.config.WildflyProviderConfig) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 4 with WildflyProviderConfig

use of org.guvnor.ala.wildfly.config.WildflyProviderConfig in project kie-wb-common by kiegroup.

the class WildflyExecutorTest method testRedeploy.

@Test
@InSequence(2)
public void testRedeploy() {
    final SourceRegistry sourceRegistry = new InMemorySourceRegistry();
    final BuildRegistry buildRegistry = new InMemoryBuildRegistry();
    final InMemoryRuntimeRegistry runtimeRegistry = new InMemoryRuntimeRegistry();
    final WildflyAccessInterface wildflyAccessInterface = new WildflyAccessInterfaceImpl();
    final Pipeline pipe = PipelineFactory.newBuilder().addConfigStage("Git Source", new GitConfig() {
    }).addConfigStage("Maven Project", new MavenProjectConfig() {
    }).addConfigStage("Maven Build Config", new MavenBuildConfig() {
    }).addConfigStage("Maven Build", new MavenBuildExecConfig() {
    }).addConfigStage("Wildfly Provider Config", new WildflyProviderConfig() {
    }).addConfigStage("Wildfly Runtime Exec", new ContextAwareWildflyRuntimeExecConfig()).buildAs("my pipe");
    WildflyRuntimeExecExecutor wildflyRuntimeExecExecutor = new WildflyRuntimeExecExecutor(runtimeRegistry, wildflyAccessInterface);
    final PipelineExecutor executor = new PipelineExecutor(asList(new GitConfigExecutor(sourceRegistry), new MavenProjectConfigExecutor(sourceRegistry), new MavenBuildConfigExecutor(), new MavenBuildExecConfigExecutor(buildRegistry), new WildflyProviderConfigExecutor(runtimeRegistry), wildflyRuntimeExecExecutor));
    executor.execute(new Input() {

        {
            put("repo-name", "drools-workshop");
            put("branch", "master");
            put("origin", gitUrl);
            put("provider-name", "wildlfy-test");
            put("wildfly-user", "admin");
            put("wildfly-password", "Admin#70365");
            put("host", ip);
            put("port", "8080");
            put("management-port", "9990");
        }
    }, pipe, System.out::println);
    List<Runtime> allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    Runtime runtime = allRuntimes.get(0);
    assertTrue(runtime instanceof WildflyRuntime);
    WildflyRuntime wildflyRuntime = (WildflyRuntime) runtime;
    WildflyRuntimeManager runtimeManager = new WildflyRuntimeManager(runtimeRegistry, wildflyAccessInterface);
    runtimeManager.start(wildflyRuntime);
    allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    runtime = allRuntimes.get(0);
    assertTrue(runtime instanceof WildflyRuntime);
    wildflyRuntime = (WildflyRuntime) runtime;
    assertEquals(RUNNING, wildflyRuntime.getState().getState());
    runtimeManager.stop(wildflyRuntime);
    allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    runtime = allRuntimes.get(0);
    assertTrue(runtime instanceof WildflyRuntime);
    wildflyRuntime = (WildflyRuntime) runtime;
    assertEquals(STOPPED, wildflyRuntime.getState().getState());
    wildflyRuntimeExecExecutor.destroy(wildflyRuntime);
    wildflyAccessInterface.dispose();
}
Also used : InMemoryBuildRegistry(org.guvnor.ala.registry.inmemory.InMemoryBuildRegistry) MavenProjectConfigExecutor(org.guvnor.ala.build.maven.executor.MavenProjectConfigExecutor) InMemorySourceRegistry(org.guvnor.ala.registry.inmemory.InMemorySourceRegistry) SourceRegistry(org.guvnor.ala.registry.SourceRegistry) MavenBuildConfig(org.guvnor.ala.build.maven.config.MavenBuildConfig) PipelineExecutor(org.guvnor.ala.pipeline.execution.PipelineExecutor) WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) MavenBuildExecConfig(org.guvnor.ala.build.maven.config.MavenBuildExecConfig) Input(org.guvnor.ala.pipeline.Input) WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) Runtime(org.guvnor.ala.runtime.Runtime) MavenProjectConfig(org.guvnor.ala.build.maven.config.MavenProjectConfig) WildflyAccessInterfaceImpl(org.guvnor.ala.wildfly.access.impl.WildflyAccessInterfaceImpl) WildflyProviderConfigExecutor(org.guvnor.ala.wildfly.executor.WildflyProviderConfigExecutor) BuildRegistry(org.guvnor.ala.registry.BuildRegistry) InMemoryBuildRegistry(org.guvnor.ala.registry.inmemory.InMemoryBuildRegistry) GitConfig(org.guvnor.ala.source.git.config.GitConfig) WildflyProviderConfig(org.guvnor.ala.wildfly.config.WildflyProviderConfig) Pipeline(org.guvnor.ala.pipeline.Pipeline) WildflyRuntimeExecExecutor(org.guvnor.ala.wildfly.executor.WildflyRuntimeExecExecutor) MavenBuildExecConfigExecutor(org.guvnor.ala.build.maven.executor.MavenBuildExecConfigExecutor) WildflyAccessInterface(org.guvnor.ala.wildfly.access.WildflyAccessInterface) GitConfigExecutor(org.guvnor.ala.source.git.executor.GitConfigExecutor) InMemorySourceRegistry(org.guvnor.ala.registry.inmemory.InMemorySourceRegistry) ContextAwareWildflyRuntimeExecConfig(org.guvnor.ala.wildfly.config.impl.ContextAwareWildflyRuntimeExecConfig) WildflyRuntimeManager(org.guvnor.ala.wildfly.service.WildflyRuntimeManager) InMemoryRuntimeRegistry(org.guvnor.ala.registry.inmemory.InMemoryRuntimeRegistry) MavenBuildConfigExecutor(org.guvnor.ala.build.maven.executor.MavenBuildConfigExecutor) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 5 with WildflyProviderConfig

use of org.guvnor.ala.wildfly.config.WildflyProviderConfig in project kie-wb-common by kiegroup.

the class WildflyExecutorTest method testAPI.

@Test
@InSequence(1)
public void testAPI() {
    final SourceRegistry sourceRegistry = new InMemorySourceRegistry();
    final BuildRegistry buildRegistry = new InMemoryBuildRegistry();
    final InMemoryRuntimeRegistry runtimeRegistry = new InMemoryRuntimeRegistry();
    final WildflyAccessInterface wildflyAccessInterface = new WildflyAccessInterfaceImpl();
    final Pipeline pipe = PipelineFactory.newBuilder().addConfigStage("Git Source", new GitConfig() {
    }).addConfigStage("Maven Project", new MavenProjectConfig() {
    }).addConfigStage("Maven Build Config", new MavenBuildConfig() {
    }).addConfigStage("Maven Build", new MavenBuildExecConfig() {
    }).addConfigStage("Wildfly Provider Config", new WildflyProviderConfig() {
    }).addConfigStage("Wildfly Runtime Exec", new ContextAwareWildflyRuntimeExecConfig()).buildAs("my pipe");
    WildflyRuntimeExecExecutor wildflyRuntimeExecExecutor = new WildflyRuntimeExecExecutor(runtimeRegistry, wildflyAccessInterface);
    final PipelineExecutor executor = new PipelineExecutor(asList(new GitConfigExecutor(sourceRegistry), new MavenProjectConfigExecutor(sourceRegistry), new MavenBuildConfigExecutor(), new MavenBuildExecConfigExecutor(buildRegistry), new WildflyProviderConfigExecutor(runtimeRegistry), wildflyRuntimeExecExecutor));
    executor.execute(new Input() {

        {
            put("repo-name", "drools-workshop");
            put("create-repo", "true");
            put("branch", "master");
            put("out-dir", tempPath.getAbsolutePath());
            put("origin", gitUrl);
            put("provider-name", "wildlfy-test");
            put("wildfly-user", "admin");
            put("wildfly-password", "Admin#70365");
            put("host", ip);
            put("port", "8080");
            put("management-port", "9990");
        }
    }, pipe, System.out::println);
    List<Runtime> allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    Runtime runtime = allRuntimes.get(0);
    assertTrue(runtime instanceof WildflyRuntime);
    WildflyRuntime wildflyRuntime = (WildflyRuntime) runtime;
    WildflyRuntimeManager runtimeManager = new WildflyRuntimeManager(runtimeRegistry, wildflyAccessInterface);
    runtimeManager.start(wildflyRuntime);
    allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    runtime = allRuntimes.get(0);
    assertTrue(runtime instanceof WildflyRuntime);
    wildflyRuntime = (WildflyRuntime) runtime;
    assertEquals(RUNNING, wildflyRuntime.getState().getState());
    runtimeManager.stop(wildflyRuntime);
    allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    runtime = allRuntimes.get(0);
    assertTrue(runtime instanceof WildflyRuntime);
    wildflyRuntime = (WildflyRuntime) runtime;
    assertEquals(STOPPED, wildflyRuntime.getState().getState());
    wildflyRuntimeExecExecutor.destroy(wildflyRuntime);
    wildflyAccessInterface.dispose();
}
Also used : InMemoryBuildRegistry(org.guvnor.ala.registry.inmemory.InMemoryBuildRegistry) MavenProjectConfigExecutor(org.guvnor.ala.build.maven.executor.MavenProjectConfigExecutor) InMemorySourceRegistry(org.guvnor.ala.registry.inmemory.InMemorySourceRegistry) SourceRegistry(org.guvnor.ala.registry.SourceRegistry) MavenBuildConfig(org.guvnor.ala.build.maven.config.MavenBuildConfig) PipelineExecutor(org.guvnor.ala.pipeline.execution.PipelineExecutor) WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) MavenBuildExecConfig(org.guvnor.ala.build.maven.config.MavenBuildExecConfig) Input(org.guvnor.ala.pipeline.Input) WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) Runtime(org.guvnor.ala.runtime.Runtime) MavenProjectConfig(org.guvnor.ala.build.maven.config.MavenProjectConfig) WildflyAccessInterfaceImpl(org.guvnor.ala.wildfly.access.impl.WildflyAccessInterfaceImpl) WildflyProviderConfigExecutor(org.guvnor.ala.wildfly.executor.WildflyProviderConfigExecutor) BuildRegistry(org.guvnor.ala.registry.BuildRegistry) InMemoryBuildRegistry(org.guvnor.ala.registry.inmemory.InMemoryBuildRegistry) GitConfig(org.guvnor.ala.source.git.config.GitConfig) WildflyProviderConfig(org.guvnor.ala.wildfly.config.WildflyProviderConfig) Pipeline(org.guvnor.ala.pipeline.Pipeline) WildflyRuntimeExecExecutor(org.guvnor.ala.wildfly.executor.WildflyRuntimeExecExecutor) MavenBuildExecConfigExecutor(org.guvnor.ala.build.maven.executor.MavenBuildExecConfigExecutor) WildflyAccessInterface(org.guvnor.ala.wildfly.access.WildflyAccessInterface) GitConfigExecutor(org.guvnor.ala.source.git.executor.GitConfigExecutor) InMemorySourceRegistry(org.guvnor.ala.registry.inmemory.InMemorySourceRegistry) ContextAwareWildflyRuntimeExecConfig(org.guvnor.ala.wildfly.config.impl.ContextAwareWildflyRuntimeExecConfig) WildflyRuntimeManager(org.guvnor.ala.wildfly.service.WildflyRuntimeManager) InMemoryRuntimeRegistry(org.guvnor.ala.registry.inmemory.InMemoryRuntimeRegistry) MavenBuildConfigExecutor(org.guvnor.ala.build.maven.executor.MavenBuildConfigExecutor) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

WildflyProviderConfig (org.guvnor.ala.wildfly.config.WildflyProviderConfig)6 Test (org.junit.Test)4 MavenBuildConfig (org.guvnor.ala.build.maven.config.MavenBuildConfig)3 MavenBuildExecConfig (org.guvnor.ala.build.maven.config.MavenBuildExecConfig)3 MavenProjectConfig (org.guvnor.ala.build.maven.config.MavenProjectConfig)3 Pipeline (org.guvnor.ala.pipeline.Pipeline)3 GitConfig (org.guvnor.ala.source.git.config.GitConfig)3 ContextAwareWildflyRuntimeExecConfig (org.guvnor.ala.wildfly.config.impl.ContextAwareWildflyRuntimeExecConfig)3 MavenBuildConfigExecutor (org.guvnor.ala.build.maven.executor.MavenBuildConfigExecutor)2 MavenBuildExecConfigExecutor (org.guvnor.ala.build.maven.executor.MavenBuildExecConfigExecutor)2 MavenProjectConfigExecutor (org.guvnor.ala.build.maven.executor.MavenProjectConfigExecutor)2 Input (org.guvnor.ala.pipeline.Input)2 PipelineExecutor (org.guvnor.ala.pipeline.execution.PipelineExecutor)2 BuildRegistry (org.guvnor.ala.registry.BuildRegistry)2 SourceRegistry (org.guvnor.ala.registry.SourceRegistry)2 InMemoryBuildRegistry (org.guvnor.ala.registry.inmemory.InMemoryBuildRegistry)2 InMemoryRuntimeRegistry (org.guvnor.ala.registry.inmemory.InMemoryRuntimeRegistry)2 InMemorySourceRegistry (org.guvnor.ala.registry.inmemory.InMemorySourceRegistry)2 Runtime (org.guvnor.ala.runtime.Runtime)2 GitConfigExecutor (org.guvnor.ala.source.git.executor.GitConfigExecutor)2