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);
}
}
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);
}
}
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);
}
}
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();
}
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();
}
Aggregations