Search in sources :

Example 46 with SensorParserConfig

use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.

the class ParserTopologyCLITest method testSecurityProtocol_fromCLI.

@Test
public void testSecurityProtocol_fromCLI() throws Exception {
    testConfigOption(ParserTopologyCLI.ParserOptions.SECURITY_PROTOCOL, "PLAINTEXT", input -> input.getSecurityProtocol().equals("PLAINTEXT"), () -> {
        SensorParserConfig config = getBaseConfig();
        config.setSecurityProtocol("KERBEROS");
        return config;
    }, input -> input.getSecurityProtocol().equals("KERBEROS"));
}
Also used : SensorParserConfig(org.apache.metron.common.configuration.SensorParserConfig) Test(org.junit.Test)

Example 47 with SensorParserConfig

use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.

the class ParserTopologyCLITest method testErrorNumTasks.

@Test
public void testErrorNumTasks() throws Exception {
    testConfigOption(ParserTopologyCLI.ParserOptions.ERROR_WRITER_NUM_TASKS, "10", input -> input.getErrorNumTasks().equals(10), () -> {
        SensorParserConfig config = getBaseConfig();
        config.setErrorWriterNumTasks(20);
        return config;
    }, input -> input.getErrorNumTasks().equals(20));
}
Also used : SensorParserConfig(org.apache.metron.common.configuration.SensorParserConfig) Test(org.junit.Test)

Example 48 with SensorParserConfig

use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.

the class ConfigUploadComponent method getSensorParserConfig.

public SensorParserConfig getSensorParserConfig(String sensorType) {
    SensorParserConfig sensorParserConfig = new SensorParserConfig();
    CuratorFramework client = getClient(topologyProperties.getProperty(ZKServerComponent.ZOOKEEPER_PROPERTY));
    client.start();
    try {
        sensorParserConfig = readSensorParserConfigFromZookeeper(sensorType, client);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        client.close();
    }
    return sensorParserConfig;
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) SensorParserConfig(org.apache.metron.common.configuration.SensorParserConfig) UnableToStartException(org.apache.metron.integration.UnableToStartException) KeeperException(org.apache.zookeeper.KeeperException)

Example 49 with SensorParserConfig

use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.

the class KafkaWriterTest method createConfiguration.

public WriterConfiguration createConfiguration(final Map<String, Object> parserConfig) {
    ParserConfigurations configurations = new ParserConfigurations();
    configurations.updateSensorParserConfig(SENSOR_TYPE, new SensorParserConfig() {

        {
            setParserConfig(parserConfig);
        }
    });
    return new ParserWriterConfiguration(configurations);
}
Also used : ParserConfigurations(org.apache.metron.common.configuration.ParserConfigurations) ParserWriterConfiguration(org.apache.metron.common.configuration.writer.ParserWriterConfiguration) SensorParserConfig(org.apache.metron.common.configuration.SensorParserConfig)

Aggregations

SensorParserConfig (org.apache.metron.common.configuration.SensorParserConfig)49 Test (org.junit.Test)39 JSONObject (org.json.simple.JSONObject)18 FieldTransformer (org.apache.metron.common.configuration.FieldTransformer)17 HashMap (java.util.HashMap)9 ParserConfigurations (org.apache.metron.common.configuration.ParserConfigurations)5 Config (org.apache.storm.Config)5 File (java.io.File)4 IOException (java.io.IOException)3 JSONUtils (org.apache.metron.common.utils.JSONUtils)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Reference (java.lang.ref.Reference)2 java.util (java.util)2 List (java.util.List)2 Map (java.util.Map)2 Predicate (java.util.function.Predicate)2 Supplier (java.util.function.Supplier)2 Multiline (org.adrianwalker.multilinestring.Multiline)2 CommandLine (org.apache.commons.cli.CommandLine)2