use of com.sonar.it.jenkins.orchestrator.container.JenkinsWrapper in project sonar-scanner-jenkins by SonarSource.
the class JenkinsOrchestrator method start.
public void start() {
if (started.getAndSet(true)) {
throw new IllegalStateException("Jenkins is already started");
}
int port = config.getInt("jenkins.container.port", 0);
if (port <= 0) {
port = NetworkUtils.getNextAvailablePort(NetworkUtils.getLocalhost());
}
distribution.setPort(port);
FileSystem fileSystem = config.fileSystem();
ServerInstaller serverInstaller = new ServerInstaller(fileSystem);
server = serverInstaller.install(distribution);
server.setUrl(String.format("http://localhost:%d", port));
jenkinsWrapper = new JenkinsWrapper(server, config, fileSystem.javaHome(), port);
jenkinsWrapper.start();
FirefoxProfile profile = new FirefoxProfile();
// force language to be English
profile.setPreference("intl.accept_languages", "en");
FirefoxOptions options = new FirefoxOptions().setProfile(profile);
driver = new FirefoxDriver(options);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get(server.getUrl());
// Fix window size for having reproducible test behavior
driver.manage().window().setPosition(new Point(20, 20));
driver.manage().window().setSize(new Dimension(1024, 768));
try {
cli = new CLI(new URL(server.getUrl()));
} catch (Exception e) {
throw new RuntimeException(e);
}
// Force updatecenter initialization
driver.get(server.getUrl() + "/pluginManager");
findElement(By.linkText("Advanced")).click();
findElement(buttonByText("Check now")).click();
}
Aggregations