Codota Logo
ParserConfigurations.updateSensorParserConfig
Code IndexAdd Codota to your IDE (free)

How to use
updateSensorParserConfig
method
in
org.apache.metron.common.configuration.ParserConfigurations

Best Java code snippets using org.apache.metron.common.configuration.ParserConfigurations.updateSensorParserConfig (Showing top 17 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: apache/metron

public void updateSensorParserConfig(String sensorType, byte[] data) throws IOException {
 updateSensorParserConfig(sensorType, new ByteArrayInputStream(data));
}
origin: apache/metron

public StellarParserRunner withParserConfiguration(String sensorType, SensorParserConfig config) {
  parserConfigurations = new ParserConfigurations();
  parserConfigurations.updateSensorParserConfig(sensorType, config);
  return this;
}
origin: apache/metron

@Override
public void update(String name, byte[] data) throws IOException {
 getConfigurations().updateSensorParserConfig(name, data);
}
origin: apache/metron

public void updateSensorParserConfig(String sensorType, InputStream io) throws IOException {
 SensorParserConfig sensorParserConfig = JSONUtils.INSTANCE.load(io, SensorParserConfig.class);
 updateSensorParserConfig(sensorType, sensorParserConfig);
}
origin: apache/metron

private ParserConfigurations create(byte[] sensorConfig) {
  try {
    ParserConfigurations result = new ParserConfigurations();
    result.updateSensorParserConfig(sensorType, SensorParserConfig.fromBytes(sensorConfig));
    return result;
  } catch(IOException e) {
    throw new IllegalArgumentException(e);
  }
}
origin: apache/metron

public static void updateParserConfigsFromZookeeper(ParserConfigurations configurations, CuratorFramework client) throws Exception {
 updateConfigsFromZookeeper( configurations
              , PARSER
              , sensorType -> configurations.updateSensorParserConfig(sensorType, readSensorParserConfigBytesFromZookeeper(sensorType, client))
              , client
              );
}
origin: apache/metron

public static ParserConfigurations getSampleParserConfigs() throws IOException {
 ParserConfigurations configurations = new ParserConfigurations();
 configurations.updateGlobalConfig(ConfigurationsUtils.readGlobalConfigFromFile(TestConstants.SAMPLE_CONFIG_PATH));
 Map<String, byte[]> sensorParserConfigs = ConfigurationsUtils.readSensorParserConfigsFromFile(TestConstants.PARSER_CONFIGS_PATH);
 for(String sensorType: sensorParserConfigs.keySet()) {
  configurations.updateSensorParserConfig(sensorType, sensorParserConfigs.get(sensorType));
 }
 return configurations;
}
origin: apache/metron

 @Override
 public ParserConfigurations getConfigurations() {
  ParserConfigurations configurations = new ParserConfigurations();
  SensorParserConfig sensorParserConfig = new SensorParserConfig();
  sensorParserConfig.setParserConfig(new HashMap<String, Object>() {{
    put(IndexingConfigurations.BATCH_SIZE_CONF, 10);
  }});
  configurations.updateSensorParserConfig("yaf", sensorParserConfig);
  return configurations;
 }
};
origin: apache/metron

@Before
public void setup() throws IOException {
 parserConfigurations = new ParserConfigurations();
 SensorParserConfig broConfig = SensorParserConfig.fromBytes(broConfigString.getBytes());
 SensorParserConfig snortConfig = SensorParserConfig.fromBytes(snortConfigString.getBytes());
 parserConfigurations.updateSensorParserConfig("bro", broConfig);
 parserConfigurations.updateSensorParserConfig("snort", snortConfig);
 parserConfigurations.updateGlobalConfig(JSONUtils.INSTANCE.load(globalConfigString, JSONUtils.MAP_SUPPLIER));
 parserRunner = new ParserRunnerImpl(new HashSet<>(Arrays.asList("bro", "snort")));
 broParser = mock(MessageParser.class);
 snortParser = mock(MessageParser.class);
 stellarFilter = mock(StellarFilter.class);
 mockStatic(ReflectionUtils.class);
 mockStatic(Filters.class);
 when(ReflectionUtils.createInstance("org.apache.metron.parsers.bro.BasicBroParser")).thenReturn(broParser);
 when(ReflectionUtils.createInstance("org.apache.metron.parsers.snort.BasicSnortParser")).thenReturn(snortParser);
 when(Filters.get("org.apache.metron.parsers.filters.StellarFilter", broConfig.getParserConfig()))
     .thenReturn(stellarFilter);
}
origin: apache/metron

@Test
public void pulls_writer_configuration_from_parserConfig() throws IOException {
 ParserConfigurations parserConfigurations = new ParserConfigurations();
 final String sensorName = "some-sensor";
 parserConfigurations.updateSensorParserConfig("some-sensor", configJson.getBytes());
 ParserWriterConfiguration writerConfiguration = new ParserWriterConfiguration(
   parserConfigurations);
 assertThat("batch size should match", writerConfiguration.getBatchSize(sensorName), equalTo(5));
 assertThat("batch timeout should match", writerConfiguration.getBatchTimeout(sensorName), equalTo(10000));
 assertThat("index should match", writerConfiguration.getIndex(sensorName), equalTo("modified-index"));
 assertThat("enabled should match", writerConfiguration.isEnabled(sensorName), equalTo(false));
}
origin: apache/metron

public ParserDriver(String sensorType, String parserConfig, String globalConfig)
  throws IOException {
 SensorParserConfig sensorParserConfig = SensorParserConfig.fromBytes(parserConfig.getBytes());
 this.sensorType = sensorType == null ? sensorParserConfig.getSensorTopic() : sensorType;
 config = new ParserConfigurations();
 config.updateSensorParserConfig(this.sensorType,
   SensorParserConfig.fromBytes(parserConfig.getBytes()));
 config.updateGlobalConfig(JSONUtils.INSTANCE.load(globalConfig, JSONUtils.MAP_SUPPLIER));
 parserRunner = new ParserRunnerImpl(new HashSet<String>() {{
  add(sensorType);
 }});
}
origin: apache/metron

parserConfigurations.updateSensorParserConfig("yaf", new SensorParserConfig());
doThrow(new IllegalStateException("parserRunner.execute failed")).when(parserRunner).execute(eq("yaf"), any(), eq(parserConfigurations));
origin: apache/metron

MockParserRunner mockParserRunner = new MockParserRunner(new HashSet<String>() {{ add("yaf"); }});
ParserConfigurations parserConfigurations = new ParserConfigurations();
parserConfigurations.updateSensorParserConfig("yaf", new SensorParserConfig());
doThrow(new IllegalStateException("write failed")).when(writerHandler).write(any(), any(), any(), any(), any());
origin: apache/metron

MockParserRunner mockParserRunner = new MockParserRunner(new HashSet<String>() {{ add("yaf"); }});
ParserConfigurations parserConfigurations = new ParserConfigurations();
parserConfigurations.updateSensorParserConfig("yaf", new SensorParserConfig());
origin: apache/metron

@Test
public void sensorParserConfig_properties_populated_by_JSON_configuration() throws IOException {
 ParserConfigurations parserConfigs = new ParserConfigurations();
 parserConfigs.updateSensorParserConfig("test-sensor", parserConfig.getBytes());
 SensorParserConfig actualSensorConfig = parserConfigs.getSensorParserConfig("test-sensor");
 assertThat(actualSensorConfig.getParserClassName(), equalTo("parser-class"));
origin: apache/metron

mockParserRunner.setInvalid(true);
ParserConfigurations parserConfigurations = new ParserConfigurations();
parserConfigurations.updateSensorParserConfig("yaf", new SensorParserConfig());
origin: apache/metron

Map<String, byte[]> sensorParserConfigs = ConfigurationsUtils.readSensorParserConfigsFromFile(TestConstants.PARSER_CONFIGS_PATH);
for (String sensorType : sensorParserConfigs.keySet()) {
 sampleConfigurations.updateSensorParserConfig(sensorType, sensorParserConfigs.get(sensorType));
 put("configName", "configObject");
}});
sampleConfigurations.updateSensorParserConfig(sensorType, testSensorConfig);
ConfigurationsUtils.writeSensorParserConfigToZookeeper(sensorType, testSensorConfig, zookeeperUrl);
waitForConfigUpdate(sensorType);
org.apache.metron.common.configurationParserConfigurationsupdateSensorParserConfig

Popular methods of ParserConfigurations

  • getSensorParserConfig
  • <init>
  • getGlobalConfig
  • updateGlobalConfig
  • getConfigurations
  • getFieldValidations
  • delete
  • equals
  • getKey
  • getTypes

Popular in Java

  • Making http post requests using okhttp
  • getSystemService (Context)
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • Kernel (java.awt.image)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now