use of org.graylog2.plugin.configuration.ConfigurationRequest in project graylog2-server by Graylog2.
the class GelfOutputTest method testGetRequestedConfiguration.
@Test
public void testGetRequestedConfiguration() throws Exception {
final GelfOutput.Config gelfOutputConfig = new GelfOutput.Config();
final ConfigurationRequest request = gelfOutputConfig.getRequestedConfiguration();
assertNotNull(request);
assertNotNull(request.asList());
}
use of org.graylog2.plugin.configuration.ConfigurationRequest in project graylog2-server by Graylog2.
the class UdpTransportTest method testDefaultReceiveBufferSize.
@Test
public void testDefaultReceiveBufferSize() throws Exception {
final UdpTransport.Config config = new UdpTransport.Config();
final ConfigurationRequest requestedConfiguration = config.getRequestedConfiguration();
assertThat(requestedConfiguration.getField(NettyTransport.CK_RECV_BUFFER_SIZE).getDefaultValue()).isEqualTo(262144);
}
use of org.graylog2.plugin.configuration.ConfigurationRequest in project graylog2-server by Graylog2.
the class AlertConditionFactory method createAlertCondition.
public AlertCondition createAlertCondition(String type, Stream stream, String id, DateTime createdAt, String creatorId, Map<String, Object> parameters, String title) throws ConfigurationException {
final AlertCondition.Factory factory = this.alertConditionMap.get(type);
checkArgument(factory != null, "Unknown alert condition type: " + type);
/*
* Ensure the given parameters fulfill the requested configuration preconditions.
* Here we strictly use the Configuration object to verify the configuration and don't pass it down to
* the factory. The reason for this is that Configuration only support int values, but at least an
* alert condition expects a double.
*/
try {
final ConfigurationRequest requestedConfiguration = factory.config().getRequestedConfiguration();
final Configuration configuration = new Configuration(parameters);
requestedConfiguration.check(configuration);
} catch (ConfigurationException e) {
final String conditionTitle = isNullOrEmpty(title) ? "" : "'" + title + "' ";
LOG.error("Could not load alert condition " + conditionTitle + "<" + id + ">, invalid configuration detected.");
throw e;
}
return factory.create(stream, id, createdAt, creatorId, parameters, title);
}
Aggregations