Search in sources :

Example 1 with MavenBuildExecConfigExecutor

use of org.guvnor.ala.build.maven.executor.MavenBuildExecConfigExecutor in project kie-wb-common by kiegroup.

the class DockerExecutorTest method testAPI.

@Test
public void testAPI() throws InterruptedException {
    final SourceRegistry sourceRegistry = new InMemorySourceRegistry();
    final BuildRegistry buildRegistry = new InMemoryBuildRegistry();
    final InMemoryRuntimeRegistry runtimeRegistry = new InMemoryRuntimeRegistry();
    final DockerAccessInterface dockerAccessInterface = new DockerAccessInterfaceImpl();
    final Pipeline pipe = PipelineFactory.newBuilder().addConfigStage("Git Source", new GitConfigImpl()).addConfigStage("Maven Project", new MavenProjectConfigImpl()).addConfigStage("Maven Build Config", new MavenBuildConfigImpl()).addConfigStage("Docker Build Config", new DockerBuildConfigImpl()).addConfigStage("Maven Build", new MavenBuildExecConfigImpl()).addConfigStage("Docker Provider Config", new DockerProviderConfigImpl()).addConfigStage("Docker Runtime Config", new ContextAwareDockerProvisioningConfig()).addConfigStage("Docker Runtime Exec", new ContextAwareDockerRuntimeExecConfig()).buildAs("my pipe");
    DockerRuntimeExecExecutor dockerRuntimeExecExecutor = new DockerRuntimeExecExecutor(runtimeRegistry, dockerAccessInterface);
    final PipelineExecutor executor = new PipelineExecutor(asList(new GitConfigExecutor(sourceRegistry), new MavenProjectConfigExecutor(sourceRegistry), new MavenBuildConfigExecutor(), new MavenBuildExecConfigExecutor(buildRegistry), new DockerBuildConfigExecutor(), new DockerProviderConfigExecutor(runtimeRegistry), new DockerProvisioningConfigExecutor(), dockerRuntimeExecExecutor));
    executor.execute(new Input() {

        {
            put("repo-name", "drools-workshop");
            put("create-repo", "true");
            put("branch", "master");
            put("out-dir", tempPath.getAbsolutePath());
            put("origin", gitUrl);
        }
    }, pipe, (Runtime b) -> System.out.println(b));
    List<Runtime> allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    Runtime runtime = allRuntimes.get(0);
    assertTrue(runtime instanceof DockerRuntime);
    DockerRuntime dockerRuntime = (DockerRuntime) runtime;
    DockerRuntimeManager runtimeManager = new DockerRuntimeManager(runtimeRegistry, dockerAccessInterface);
    allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    runtime = allRuntimes.get(0);
    dockerRuntime = (DockerRuntime) runtime;
    assertEquals(RUNNING, dockerRuntime.getState().getState());
    runtimeManager.stop(dockerRuntime);
    allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
    assertEquals(1, allRuntimes.size());
    runtime = allRuntimes.get(0);
    dockerRuntime = (DockerRuntime) runtime;
    assertEquals(STOPPED, dockerRuntime.getState().getState());
    dockerRuntimeExecExecutor.destroy(runtime);
    dockerAccessInterface.dispose();
}
Also used : InMemoryBuildRegistry(org.guvnor.ala.registry.inmemory.InMemoryBuildRegistry) MavenProjectConfigExecutor(org.guvnor.ala.build.maven.executor.MavenProjectConfigExecutor) MavenProjectConfigImpl(org.guvnor.ala.build.maven.config.impl.MavenProjectConfigImpl) ContextAwareDockerProvisioningConfig(org.guvnor.ala.docker.config.impl.ContextAwareDockerProvisioningConfig) DockerBuildConfigImpl(org.guvnor.ala.docker.config.impl.DockerBuildConfigImpl) InMemorySourceRegistry(org.guvnor.ala.registry.inmemory.InMemorySourceRegistry) SourceRegistry(org.guvnor.ala.registry.SourceRegistry) PipelineExecutor(org.guvnor.ala.pipeline.execution.PipelineExecutor) DockerRuntime(org.guvnor.ala.docker.model.DockerRuntime) Input(org.guvnor.ala.pipeline.Input) DockerRuntime(org.guvnor.ala.docker.model.DockerRuntime) Runtime(org.guvnor.ala.runtime.Runtime) DockerRuntimeManager(org.guvnor.ala.docker.service.DockerRuntimeManager) DockerAccessInterface(org.guvnor.ala.docker.access.DockerAccessInterface) BuildRegistry(org.guvnor.ala.registry.BuildRegistry) InMemoryBuildRegistry(org.guvnor.ala.registry.inmemory.InMemoryBuildRegistry) MavenBuildConfigImpl(org.guvnor.ala.build.maven.config.impl.MavenBuildConfigImpl) ContextAwareDockerRuntimeExecConfig(org.guvnor.ala.docker.config.impl.ContextAwareDockerRuntimeExecConfig) GitConfigImpl(org.guvnor.ala.source.git.config.impl.GitConfigImpl) DockerProviderConfigImpl(org.guvnor.ala.docker.config.impl.DockerProviderConfigImpl) DockerAccessInterfaceImpl(org.guvnor.ala.docker.access.impl.DockerAccessInterfaceImpl) Pipeline(org.guvnor.ala.pipeline.Pipeline) MavenBuildExecConfigExecutor(org.guvnor.ala.build.maven.executor.MavenBuildExecConfigExecutor) GitConfigExecutor(org.guvnor.ala.source.git.executor.GitConfigExecutor) InMemorySourceRegistry(org.guvnor.ala.registry.inmemory.InMemorySourceRegistry) MavenBuildExecConfigImpl(org.guvnor.ala.build.maven.config.impl.MavenBuildExecConfigImpl) InMemoryRuntimeRegistry(org.guvnor.ala.registry.inmemory.InMemoryRuntimeRegistry) MavenBuildConfigExecutor(org.guvnor.ala.build.maven.executor.MavenBuildConfigExecutor) Test(org.junit.Test)

Example 2 with MavenBuildExecConfigExecutor

use of org.guvnor.ala.build.maven.executor.MavenBuildExecConfigExecutor 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 3 with MavenBuildExecConfigExecutor

use of org.guvnor.ala.build.maven.executor.MavenBuildExecConfigExecutor 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

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