use of org.graylog2.shared.plugins.ChainingClassLoader in project graylog2-server by Graylog2.
the class V20170110150100_FixAlertConditionsMigrationTest method setUp.
@Before
public void setUp() throws Exception {
this.clusterConfigService = spy(new ClusterConfigServiceImpl(objectMapperProvider, fongoRule.getConnection(), nodeId, new ChainingClassLoader(getClass().getClassLoader()), new ClusterEventBus()));
final MongoConnection mongoConnection = spy(fongoRule.getConnection());
final MongoDatabase mongoDatabase = spy(fongoRule.getDatabase());
when(mongoConnection.getMongoDatabase()).thenReturn(mongoDatabase);
this.collection = spy(mongoDatabase.getCollection("streams"));
when(mongoDatabase.getCollection("streams")).thenReturn(collection);
this.migration = new V20170110150100_FixAlertConditionsMigration(mongoConnection, clusterConfigService);
}
use of org.graylog2.shared.plugins.ChainingClassLoader in project graylog2-server by Graylog2.
the class CmdLineTool method installPluginConfigAndBindings.
private PluginBindings installPluginConfigAndBindings(String pluginPath, ChainingClassLoader classLoader) {
final Set<Plugin> plugins = loadPlugins(pluginPath, classLoader);
final PluginBindings pluginBindings = new PluginBindings(plugins);
for (final Plugin plugin : plugins) {
for (final PluginModule pluginModule : plugin.modules()) {
for (final PluginConfigBean configBean : pluginModule.getConfigBeans()) {
jadConfig.addConfigurationBean(configBean);
}
}
}
return pluginBindings;
}
use of org.graylog2.shared.plugins.ChainingClassLoader in project graylog2-server by Graylog2.
the class CmdLineTool method run.
@Override
public void run() {
final Level logLevel = setupLogger();
final PluginBindings pluginBindings = installPluginConfigAndBindings(getPluginPath(configFile), chainingClassLoader);
if (isDumpDefaultConfig()) {
dumpDefaultConfigAndExit();
}
final NamedConfigParametersModule configModule = readConfiguration(configFile);
if (isDumpConfig()) {
dumpCurrentConfigAndExit();
}
if (!validateConfiguration()) {
LOG.error("Validating configuration file failed - exiting.");
System.exit(1);
}
beforeStart();
final List<String> arguments = ManagementFactory.getRuntimeMXBean().getInputArguments();
LOG.info("Running with JVM arguments: {}", Joiner.on(' ').join(arguments));
injector = setupInjector(configModule, pluginBindings, binder -> binder.bind(ChainingClassLoader.class).toInstance(chainingClassLoader));
if (injector == null) {
LOG.error("Injector could not be created, exiting! (Please include the previous error messages in bug reports.)");
System.exit(1);
}
// This is holding all our metrics.
final MetricRegistry metrics = injector.getInstance(MetricRegistry.class);
addInstrumentedAppender(metrics, logLevel);
// Report metrics via JMX.
final JmxReporter reporter = JmxReporter.forRegistry(metrics).build();
reporter.start();
startCommand();
}
use of org.graylog2.shared.plugins.ChainingClassLoader in project graylog2-server by Graylog2.
the class MongoIndexSetServiceTest method setUp.
@Before
public void setUp() throws Exception {
clusterEventBus = new ClusterEventBus();
clusterConfigService = new ClusterConfigServiceImpl(objectMapperProvider, mongoRule.getMongoConnection(), nodeId, new ChainingClassLoader(getClass().getClassLoader()), clusterEventBus);
indexSetService = new MongoIndexSetService(mongoRule.getMongoConnection(), objectMapperProvider, streamService, clusterConfigService, clusterEventBus);
}
Aggregations