final InstallerLookupDefault installerLookup = new InstallerLookupDefault();
isisConfigurationBuilder.injectInto(installerLookup);
installerLookup.init();
IsisSystemUsingInstallersWithinJunit system = null;
AuthenticationSession session = null;
try {
// init the system; cf similar code in Isis and
// IsisServletContextInitializer
final DeploymentType deploymentType = DeploymentType.PROTOTYPE;
// TODO: replace with regular IsisSystem and remove this subclass.
system = new IsisSystemUsingInstallersWithinJunit(deploymentType, installerLookup, testClass);
system.init();
// specific to this bootstrap mechanism
AuthenticationRequest request;
final LogonFixture logonFixture = system.getFixturesInstaller().getLogonFixture();
if (logonFixture != null) {
request = new AuthenticationRequestLogonFixture(logonFixture);
} else {
request = new AuthenticationRequestExploration(logonFixture);
}
session = IsisContext.getAuthenticationManager().authenticate(request);
IsisContext.openSession(session);
getTransactionManager().startTransaction();
final Object test = createTest();
getServicesInjector().injectDependencies(test);
final TestMethod testMethod = wrapMethod(method);
new MethodRoadie(test, testMethod, notifier, description).run();
getTransactionManager().endTransaction();
} catch (final InvocationTargetException e) {
testAborted(notifier, description, e.getCause());
getTransactionManager().abortTransaction();
return;
} catch (final Exception e) {
testAborted(notifier, description, e);
return;
} finally {
if (system != null) {
if (session != null) {
IsisContext.closeSession();
}
system.shutdown();
}
}
}