in src/main/java/org/apache/sling/testing/serversetup/instance/SlingTestBase.java [86:145]
public SlingTestBase(SlingInstanceState slingTestState, Properties systemProperties) {
this.slingTestState = slingTestState;
this.systemProperties = systemProperties;
this.keepJarRunning = "true".equals(systemProperties.getProperty(KEEP_JAR_RUNNING_PROP));
final String configuredUrl = systemProperties.getProperty(TEST_SERVER_URL_PROP,
systemProperties.getProperty("launchpad.http.server.url"));
if(configuredUrl != null && configuredUrl.trim().length() > 0) {
slingTestState.setServerBaseUrl(configuredUrl);
slingTestState.setServerStarted(true);
uninstallAdditionalBundles = "true".equals(systemProperties.getProperty(ADDITONAL_BUNDLES_UNINSTALL));
} else {
synchronized(this.slingTestState) {
try {
if(slingTestState.getJarExecutor() == null) {
slingTestState.setJarExecutor(new JarExecutor(systemProperties));
}
} catch(Exception e) {
log.error("JarExecutor setup failed", e);
fail("JarExecutor setup failed: " + e);
}
}
String serverHost = systemProperties.getProperty(SERVER_HOSTNAME_PROP);
if(serverHost == null || serverHost.trim().length() == 0) {
serverHost = "localhost";
}
slingTestState.setServerBaseUrl("http://" + serverHost + ":" + slingTestState.getJarExecutor().getServerPort());
uninstallAdditionalBundles = false; // never undeploy additional bundles in case the server is provisioned here!
}
// Set configured username using "admin" as default credential
final String configuredUsername = systemProperties.getProperty(TEST_SERVER_USERNAME);
if (configuredUsername != null && configuredUsername.trim().length() > 0) {
serverUsername = configuredUsername;
} else {
serverUsername = ADMIN;
}
// Set configured password using "admin" as default credential
final String configuredPassword = systemProperties.getProperty(TEST_SERVER_PASSWORD);
if (configuredPassword != null && configuredPassword.trim().length() > 0) {
serverPassword = configuredPassword;
} else {
serverPassword = ADMIN;
}
// create client
try {
osgiConsoleClient = new OsgiConsoleClient(URI.create(slingTestState.getServerBaseUrl()), serverUsername, serverPassword);
} catch (ClientException e) {
throw new RuntimeException("Cannot instantiate client", e);
}
bundlesInstaller = new BundlesInstaller(osgiConsoleClient);
if(!slingTestState.isServerInfoLogged()) {
log.info("Server base URL={}", slingTestState.getServerBaseUrl());
slingTestState.setServerInfoLogged(true);
}
}