use of com.microsoft.applicationinsights.smoketest.fixtures.BeforeWithParams in project ApplicationInsights-Java by microsoft.
the class AiSmokeTest method configureEnvironment.
@BeforeWithParams
public static void configureEnvironment(String appServer, String os, String jreVersion) throws Exception {
System.out.println("Preparing environment...");
try {
ContainerInfo containerInfo = currentContainerInfo.get();
if (containerInfo != null) {
// test cleanup didn't take...try to clean up
if (docker.isContainerRunning(containerInfo.getContainerId())) {
System.err.println("From last test run, container is still running: " + containerInfo);
try {
docker.stopContainer(containerInfo.getContainerId());
} catch (Exception e) {
System.err.println("Couldn't clean up environment. Must be done manually.");
throw e;
}
} else {
// container must have stopped after timeout reached.
currentContainerInfo.set(null);
}
}
checkParams(appServer, os, jreVersion);
setupProperties(appServer, os, jreVersion);
startMockedIngestion();
createDockerNetwork();
startAllContainers();
waitForApplicationToStart();
System.out.println("Environment preparation complete.");
} catch (Exception e) {
String additionalMessage;
if (e instanceof TimeoutException) {
additionalMessage = e.getLocalizedMessage();
} else {
additionalMessage = ExceptionUtils.getStackTrace(e);
}
System.err.printf("Could not configure environment: %s%n", additionalMessage);
throw e;
}
}
Aggregations