Search in sources :

Example 1 with RemoteJenkinsController

use of org.jenkinsci.test.acceptance.controller.RemoteJenkinsController in project acceptance-test-harness by jenkinsci.

the class RemoteJenkinsProvider method createNewJenkinsController.

private JenkinsController createNewJenkinsController() {
    Machine machine = machineProvider.get();
    try {
        // install jenkins WAR
        jenkinsResolver.materialize(machine, jenkinsWar);
    } catch (Exception e) {
        logger.error("Error during setting up Jenkins: " + e.getMessage(), e);
        throw new AssertionError(e);
    }
    String jenkinsHome = machine.dir() + newJenkinsHome() + "/";
    String pluginDir = jenkinsHome + "plugins/";
    String path = JenkinsResolver.JENKINS_TEMP_DIR + "form-element-path.hpi";
    // install form-path-element plugin
    new PluginDownloader("form-element-path").materialize(machine, path);
    try (Ssh ssh = machine.connect()) {
        ssh.executeRemoteCommand("mkdir -p " + pluginDir);
        ssh.executeRemoteCommand(String.format("cp %s %s", path, pluginDir));
    }
    return new RemoteJenkinsController(injector, machine, jenkinsHome, jenkinsWar, privateKeyFile);
}
Also used : PluginDownloader(org.jenkinsci.test.acceptance.resolver.PluginDownloader) Ssh(org.jenkinsci.test.acceptance.Ssh) RemoteJenkinsController(org.jenkinsci.test.acceptance.controller.RemoteJenkinsController) IOException(java.io.IOException)

Example 2 with RemoteJenkinsController

use of org.jenkinsci.test.acceptance.controller.RemoteJenkinsController in project acceptance-test-harness by jenkinsci.

the class RemoteJenkinsProvider method get.

@Override
public JenkinsController get() {
    logger.info("Creating new RemoteJenkinsController...");
    JenkinsController jenkinsController = createNewJenkinsController();
    try {
        cleaner.addTask(jenkinsController);
        jenkinsController.start();
    } catch (IOException e) {
        throw new AssertionError("Failed to start Jenkins: " + e.getMessage(), e);
    }
    return jenkinsController;
}
Also used : JenkinsController(org.jenkinsci.test.acceptance.controller.JenkinsController) RemoteJenkinsController(org.jenkinsci.test.acceptance.controller.RemoteJenkinsController) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 RemoteJenkinsController (org.jenkinsci.test.acceptance.controller.RemoteJenkinsController)2 Ssh (org.jenkinsci.test.acceptance.Ssh)1 JenkinsController (org.jenkinsci.test.acceptance.controller.JenkinsController)1 PluginDownloader (org.jenkinsci.test.acceptance.resolver.PluginDownloader)1