Search in sources :

Example 1 with ValidationException

use of com.github.joschi.jadconfig.ValidationException in project graylog2-server by Graylog2.

the class Configuration method validateNetworkInterfaces.

@ValidatorMethod
@SuppressWarnings("unused")
public void validateNetworkInterfaces() throws ValidationException {
    final URI restListenUri = getRestListenUri();
    final URI webListenUri = getWebListenUri();
    if (restListenUri.getPort() == webListenUri.getPort() && !restListenUri.getHost().equals(webListenUri.getHost()) && (WILDCARD_IP_ADDRESS.equals(restListenUri.getHost()) || WILDCARD_IP_ADDRESS.equals(webListenUri.getHost()))) {
        throw new ValidationException("Wildcard IP addresses cannot be used if the Graylog REST API and web interface listen on the same port.");
    }
}
Also used : ValidationException(com.github.joschi.jadconfig.ValidationException) Tools.normalizeURI(org.graylog2.plugin.Tools.normalizeURI) URI(java.net.URI) ValidatorMethod(com.github.joschi.jadconfig.ValidatorMethod)

Example 2 with ValidationException

use of com.github.joschi.jadconfig.ValidationException in project graylog2-server by Graylog2.

the class EsNodeProviderTest method setupConfig.

private ElasticsearchConfiguration setupConfig(Map<String, String> settings) {
    // required params we don't care about in this test, so we set them to dummy values for all test cases
    settings.put("retention_strategy", "delete");
    ElasticsearchConfiguration configuration = new ElasticsearchConfiguration();
    try {
        new JadConfig(new InMemoryRepository(settings), configuration).process();
    } catch (ValidationException | RepositoryException e) {
        fail(e.getMessage());
    }
    return configuration;
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) ValidationException(com.github.joschi.jadconfig.ValidationException) ElasticsearchConfiguration(org.graylog2.configuration.ElasticsearchConfiguration) RepositoryException(com.github.joschi.jadconfig.RepositoryException)

Aggregations

ValidationException (com.github.joschi.jadconfig.ValidationException)2 JadConfig (com.github.joschi.jadconfig.JadConfig)1 RepositoryException (com.github.joschi.jadconfig.RepositoryException)1 ValidatorMethod (com.github.joschi.jadconfig.ValidatorMethod)1 InMemoryRepository (com.github.joschi.jadconfig.repositories.InMemoryRepository)1 URI (java.net.URI)1 ElasticsearchConfiguration (org.graylog2.configuration.ElasticsearchConfiguration)1 Tools.normalizeURI (org.graylog2.plugin.Tools.normalizeURI)1