Search in sources :

Example 1 with WildflyRuntime

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

the class WildflyRuntimeManager method restart.

@Override
public void restart(RuntimeId runtimeId) {
    WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        wildfly.getWildflyClient(runtime.getProviderId()).restart(runtime.getId());
        refresh(runtimeId);
    } catch (WildflyClientException ex) {
        throw new RuntimeOperationException("Error Restarting container: " + runtimeId.getId() + "\n\t There as a problem with restarting your application, please check into the Wildfly Logs for more information.", ex);
    }
}
Also used : WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) WildflyClientException(org.guvnor.ala.wildfly.access.exceptions.WildflyClientException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 2 with WildflyRuntime

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

the class WildflyRuntimeManager method pause.

@Override
public void pause(RuntimeId runtimeId) throws RuntimeOperationException {
    WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        wildfly.getWildflyClient(runtime.getProviderId()).stop(runtime.getId());
        refresh(runtimeId);
    } catch (WildflyClientException ex) {
        throw new RuntimeOperationException("Error Pausing container: " + runtimeId.getId() + "\n\t There as a problem with stopping your application, please check into the Wildfly Logs for more information.", ex);
    }
}
Also used : WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) WildflyClientException(org.guvnor.ala.wildfly.access.exceptions.WildflyClientException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 3 with WildflyRuntime

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

the class WildflyRuntimeManager method refresh.

@Override
public void refresh(RuntimeId runtimeId) throws RuntimeOperationException {
    WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        WildflyAppState appState = wildfly.getWildflyClient(runtime.getProviderId()).getAppState(runtime.getId());
        WildflyRuntime newRuntime = new WildflyRuntime(runtime.getId(), runtime.getName(), runtime.getConfig(), runtime.getProviderId(), runtime.getEndpoint(), runtime.getInfo(), new WildflyRuntimeState(appState.getState(), runtime.getState().getStartedAt()));
        runtimeRegistry.registerRuntime(newRuntime);
    } catch (WildflyClientException ex) {
        throw new RuntimeOperationException("Error Refreshing container: " + runtimeId.getId() + "\n\t There as a problem with refreshing your application, please check into the Wildfly Logs for more information.", ex);
    }
}
Also used : WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) WildflyClientException(org.guvnor.ala.wildfly.access.exceptions.WildflyClientException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException) WildflyRuntimeState(org.guvnor.ala.wildfly.model.WildflyRuntimeState) WildflyAppState(org.guvnor.ala.wildfly.access.WildflyAppState)

Example 4 with WildflyRuntime

use of org.guvnor.ala.wildfly.model.WildflyRuntime 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 WildflyRuntime

use of org.guvnor.ala.wildfly.model.WildflyRuntime 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

WildflyRuntime (org.guvnor.ala.wildfly.model.WildflyRuntime)8 RuntimeOperationException (org.guvnor.ala.exceptions.RuntimeOperationException)5 WildflyClientException (org.guvnor.ala.wildfly.access.exceptions.WildflyClientException)4 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 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 Pipeline (org.guvnor.ala.pipeline.Pipeline)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 GitConfig (org.guvnor.ala.source.git.config.GitConfig)2 GitConfigExecutor (org.guvnor.ala.source.git.executor.GitConfigExecutor)2