private static final long ONE_WEEK_IN_SECONDS = 60L * 60 * 24;
@BeforeSuite(groups = "as5.plugin")
public void start() {
try {
PluginContainerConfiguration pcConfig = new PluginContainerConfiguration();
File pluginDir = new File(ITEST_DIR, "plugins");
pcConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
pcConfig.setPluginDirectory(pluginDir);
pcConfig.setInsideAgent(false);
pcConfig.setCreateResourceClassloaders(true);
// Because we communicate with the AS directly in the tests setups
// we need a number of deps in the test classloader.
// If we configured the plugin container to hide the classes below
// we would run into issues of classes not being able to transfer the
// classloader boundaries outside of our control (like for example during EJB3
// remote interface proxuing). It it therefore best just to include the complete
// set of dependencies in the test scope in pom.xml and let the plugin container
// take those over.
// [mazz] i think this can be fixed, uncomment this if we can isolate the PC better
//pcConfig.setRootPluginClassLoaderRegex(getRootClassLoaderClassesToHideRegex());
// Set initial delays for all scheduled scans to one week to effectively disable them.
pcConfig.setServerDiscoveryInitialDelay(ONE_WEEK_IN_SECONDS);
pcConfig.setServiceDiscoveryInitialDelay(ONE_WEEK_IN_SECONDS);
pcConfig.setAvailabilityScanInitialDelay(ONE_WEEK_IN_SECONDS);
pcConfig.setConfigurationDiscoveryInitialDelay(ONE_WEEK_IN_SECONDS);
pcConfig.setContentDiscoveryInitialDelay(ONE_WEEK_IN_SECONDS);
File tmpDir = new File(ITEST_DIR, "tmp");
tmpDir.mkdirs();
if (!tmpDir.isDirectory() || !tmpDir.canWrite()) {
throw new IOException("Failed to create temporary directory: " + tmpDir);
}
pcConfig.setTemporaryDirectory(tmpDir);
PluginContainer.getInstance().setConfiguration(pcConfig);
System.out.println("Starting PC...");
PluginContainer.getInstance().initialize();
Set<String> pluginNames = PluginContainer.getInstance().getPluginManager().getMetadataManager()
.getPluginNames();