in src/main/java/org/apache/sling/testing/teleporter/client/TeleporterHttpClient.java [232:255]
void uninstallBundle(String bundleSymbolicName, int webConsoleReadyTimeoutSeconds) throws MalformedURLException, IOException {
log.debug("Uninstalling bundle {}", bundleSymbolicName);
// equivalent of
// curl -u admin:admin -F action=uninstall http://localhost:8080/system/console/bundles/$N
final String url = baseUrl + "/system/console/bundles/" + bundleSymbolicName;
final HttpURLConnection c = setHttpTimeouts((HttpURLConnection)new URL(url).openConnection());
waitForStatus(url, 200, webConsoleReadyTimeoutSeconds * 1000);
try {
setConnectionCredentials(c);
new MultipartAdapter(c, CHARSET)
.parameter("action", "uninstall")
.close();
final int status = c.getResponseCode();
if(status != 200) {
throw new IOException("Got status code " + status + " for " + url);
}
log.debug("POST request to uninstall bundle {} successful", bundleSymbolicName);
} finally {
cleanup(c);
}
}