use of org.jenkinsci.test.acceptance.server.PooledJenkinsController in project acceptance-test-harness by jenkinsci.
the class FallbackConfig method createController.
/**
* Instantiates a controller through the "TYPE" attribute and {@link JenkinsControllerFactory}.
*/
@Provides
@TestScope
public JenkinsController createController(Injector injector, ExtensionList<JenkinsControllerFactory> factories) throws IOException {
// this is lower case for backward compatibility
String type = System.getenv("type");
if (type == null)
type = System.getenv("TYPE");
if (type == null) {
File socket = getSocket();
if (socket.exists() && !JenkinsControllerPoolProcess.MAIN) {
LOGGER.info("Found pooled jenkins controller listening on socket " + socket.getAbsolutePath());
return new PooledJenkinsController(injector, socket);
} else {
LOGGER.warning("No pooled jenkins controller listening on socket " + socket.getAbsolutePath());
type = "winstone";
}
}
for (JenkinsControllerFactory f : factories) {
if (f.getId().equalsIgnoreCase(type)) {
final JenkinsController c = f.create();
c.postConstruct(injector);
return c;
}
}
throw new AssertionError("Invalid controller type: " + type);
}
Aggregations