use of org.xwiki.extension.job.internal.UninstallJob in project xwiki-platform by xwiki.
the class XarExtensionHandlerTest method uninstall.
private void uninstall(ExtensionId extensionId, String wiki) throws Throwable {
UninstallRequest uninstallRequest = new UninstallRequest();
uninstallRequest.setProperty("user.reference", getXWikiContext().getUserReference());
uninstallRequest.setProperty("checkrights", true);
uninstallRequest.addExtension(extensionId);
if (wiki != null) {
uninstallRequest.addNamespace("wiki:" + wiki);
}
Job uninstallJob = this.jobExecutor.execute(UninstallJob.JOBTYPE, uninstallRequest);
uninstallJob.join();
List<LogEvent> errors = uninstallJob.getStatus().getLog().getLogsFrom(LogLevel.WARN);
if (!errors.isEmpty()) {
if (errors.get(0).getThrowable() != null) {
throw errors.get(0).getThrowable();
} else {
throw new Exception(errors.get(0).getFormattedMessage());
}
}
}
Aggregations