// String home = new File(basedir, "target/tuscany").toString();
// System.setProperty("TUSCANY_HOME", home);
// getLog().info(home);
try {
FelixOSGiHost host = new FelixOSGiHost();
host.setActivator(new LauncherBundleActivator(jarFiles));
BundleContext context = host.start();
for (Bundle b : context.getBundles()) {
if (getLog().isDebugEnabled()) {
getLog().debug(LauncherBundleActivator.toString(b, false));
}
}
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
URL[] urls =
new URL[] {new File(project.getBuild().getOutputDirectory()).toURI().toURL(),
new File(project.getBuild().getTestOutputDirectory()).toURI().toURL()};
URLClassLoader cl = new URLClassLoader(urls, tccl);
Thread.currentThread().setContextClassLoader(cl);
try {
runAllTestsFromDirs(cl, project.getBuild().getTestOutputDirectory());
} finally {
Thread.currentThread().setContextClassLoader(tccl);
}
host.stop();
} catch (Throwable e) {
throw new MojoExecutionException(e.getMessage(), e);
}
// finally {
// System.clearProperty("TUSCANY_HOME");