use of org.guvnor.ala.build.maven.config.MavenBuildConfig 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;
}
};
}
use of org.guvnor.ala.build.maven.config.MavenBuildConfig 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.build.maven.config.MavenBuildConfig 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