use of org.jenkinsci.utils.process.CommandBuilder in project acceptance-test-harness by jenkinsci.
the class SAMLPluginTest method startSimpleSAML.
private SAMLContainer startSimpleSAML(String rootUrl) throws IOException, InterruptedException {
Starter<SAMLContainer> starter = samlContainer.starter();
File users = new File("src/test/resources/saml_plugin/users.php");
File config = new File("src/test/resources/saml_plugin/config.php");
File idp_metadata = new File("src/test/resources/saml_plugin/saml20-idp-hosted.php");
starter.withOptions(new CommandBuilder(// service provider ID
"-e", // service provider ID
"SIMPLESAMLPHP_SP_ENTITY_ID=" + SERVICE_PROVIDER_ID, // login back URL
"-e", // login back URL
"SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE=" + rootUrl + "securityRealm/finishLogin", // unused
"-e", // unused
"SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE=" + rootUrl + "logout", // users info
"-v", // users info
users.getAbsolutePath() + ":/var/www/simplesamlphp/config/authsources.php", // config info,
"-v", // config info,
config.getAbsolutePath() + ":/var/www/simplesamlphp/config/config.php", // IdP advanced configuration
"-v", // IdP advanced configuration
idp_metadata.getAbsolutePath() + ":/var/www/simplesamlphp/metadata/saml20-idp-hosted.php"));
SAMLContainer samlServer = starter.start();
System.out.println("============ SAML Server: " + samlServer.host() + ":" + samlServer.port());
return samlServer;
}
use of org.jenkinsci.utils.process.CommandBuilder in project acceptance-test-harness by jenkinsci.
the class TSRWinstoneDockerController method startProcess.
@Override
public ProcessInputStream startProcess() throws IOException {
try {
// can't mount symlink very well, so we need to resolve it
File war = this.war.getCanonicalFile();
CommandBuilder opts = new CommandBuilder();
opts.add("-v", getJenkinsHome() + ":/work");
opts.add("-v", war.getParent() + ":/war");
// TODO: unify ID and fixture
DockerImage img;
if (dockerImage != null)
img = new DockerImage(dockerImage);
else
img = docker.build(fixtureType);
container = img.start(fixtureType, opts, null);
CommandBuilder cmds = new CommandBuilder();
cmds.add("java");
cmds.add("-DJENKINS_HOME=/work");
cmds.add("-jar", "/war/" + war.getName());
cmds.add("--ajp13Port=-1", "--controlPort=8081", "--httpPort=8080");
return container.popen(cmds);
} catch (InterruptedException e) {
throw (IOException) new InterruptedIOException("Failed to launch winstone").initCause(e);
}
}
use of org.jenkinsci.utils.process.CommandBuilder in project acceptance-test-harness by jenkinsci.
the class JBossController method startProcess.
@Override
public ProcessInputStream startProcess() throws IOException {
File jenkinsDeploymentDir = new File(jbossHome, "standalone/deployments/jenkins.war.deployed");
if (jenkinsDeploymentDir.exists()) {
FileUtils.forceDelete(jenkinsDeploymentDir);
}
File jenkinsDeploymentFailDir = new File(jbossHome, "standalone/deployments/jenkins.war.failed");
if (jenkinsDeploymentFailDir.exists()) {
FileUtils.forceDelete(jenkinsDeploymentFailDir);
}
File jenkinsWarDeploymentPath = new File(jbossHome, "standalone/deployments/jenkins.war");
if (jenkinsWarDeploymentPath.exists()) {
FileUtils.forceDelete(jenkinsWarDeploymentPath);
}
FileUtils.copyFile(war, jenkinsWarDeploymentPath);
File jbossLog = new File(jbossHome, "/standalone/log/server.log");
if (jbossLog.exists()) {
FileUtils.forceDelete(jbossLog);
}
CommandBuilder cb = new CommandBuilder(jbossHome + "/bin/standalone.sh");
cb.env.putAll(commonLaunchEnv());
return cb.popen();
}
use of org.jenkinsci.utils.process.CommandBuilder in project acceptance-test-harness by jenkinsci.
the class JBossController method stopNow.
@Override
public void stopNow() throws IOException {
System.out.println(" Stopping a temporary Jenkins/JBoss instance\n");
CommandBuilder cb = new CommandBuilder(jbossHome + "/bin/jboss-cli.sh", " --connect", "--command=:shutdown");
try {
int status = cb.system();
if (status != 0) {
System.out.println("Cannot stop JBoss: " + cb.toString());
}
} catch (InterruptedException e) {
throw new IOException(e);
}
}
use of org.jenkinsci.utils.process.CommandBuilder in project acceptance-test-harness by jenkinsci.
the class TomcatController method startProcess.
@Override
public ProcessInputStream startProcess() throws IOException {
try {
File jenkinsDeploymentDir = new File(catalinaHome, "webapps/jenkins");
if (jenkinsDeploymentDir.exists()) {
FileUtils.forceDelete(jenkinsDeploymentDir);
}
File jenkinsWarDeploymentPath = new File(catalinaHome, "webapps/jenkins.war");
if (jenkinsWarDeploymentPath.exists()) {
FileUtils.forceDelete(jenkinsWarDeploymentPath);
}
FileUtils.copyFile(war, jenkinsWarDeploymentPath);
File tomcatLog = new File(catalinaHome, "logs/catalina.out");
if (tomcatLog.exists()) {
FileUtils.forceDelete(tomcatLog);
}
CommandBuilder cb = new CommandBuilder(catalinaHome + "/bin/startup.sh");
cb.env.putAll(commonLaunchEnv());
int status = cb.system();
if (status != 0) {
throw new RuntimeException("Failed during Tomcat startup: " + cb.toString());
}
CommandBuilder tail = new CommandBuilder("tail").add("-f", tomcatLog);
return tail.popen();
} catch (InterruptedException e) {
throw new IOException(e);
}
}
Aggregations