public static Map<String, Object> getStellarHandler(EnrichmentConfig enrichmentConfig) { Map<String, Object> fieldMap = enrichmentConfig.getFieldMap(); Map<String, Object> stellarHandler = (Map<String, Object>) fieldMap.getOrDefault("stellar", new HashMap<>()); fieldMap.put("stellar", stellarHandler); stellarHandler.putIfAbsent("config", new LinkedHashMap<String, Object>()); return stellarHandler; }
@Override public int hashCode() { int result = getFieldMap() != null ? getFieldMap().hashCode() : 0; result = 31 * result + (getFieldToTypeMap() != null ? getFieldToTypeMap().hashCode() : 0); result = 31 * result + (getConfig() != null ? getConfig().hashCode() : 0); return result; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; EnrichmentConfig that = (EnrichmentConfig) o; if (getFieldMap() != null ? !getFieldMap().equals(that.getFieldMap()) : that.getFieldMap() != null) return false; if (getFieldToTypeMap() != null ? !getFieldToTypeMap().equals(that.getFieldToTypeMap()) : that.getFieldToTypeMap() != null) return false; return getConfig() != null ? getConfig().equals(that.getConfig()) : that.getConfig() == null; }
protected Map<String, Object > getFieldMap(String sensorType) { if(sensorType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sensorType); if (config != null) { return config.getEnrichment().getFieldMap(); } else { LOG.debug("Unable to retrieve a sensor enrichment config of {}", sensorType); } } else { LOG.error("Trying to retrieve a field map with sensor type of null"); } return new HashMap<>(); }
enrichmentConfig.getFieldMap().remove("stellar");
public Map<String, Object> getFieldMap(String sourceType) { if(sourceType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sourceType); if (config != null && config.getEnrichment() != null) { return config.getEnrichment().getFieldMap(); } else { LOG.debug("Unable to retrieve a sensor enrichment config of {}", sourceType); } } else { LOG.error("Trying to retrieve a field map with source type of null"); } return null; } }
) { Map<String, List<JSONObject>> streamMessageMap = new HashMap<>(); Map<String, Object> enrichmentFieldMap = enrichmentStrategy.getUnderlyingConfig(config).getFieldMap();
fieldMap = config.getEnrichment().getFieldMap(); if(fieldMap!= null) { fieldList = (List<String>)fieldMap.get(Constants.SIMPLE_HBASE_ENRICHMENT);
@Test public void testSerialization() throws Exception { EnrichmentConfig config = JSONUtils.INSTANCE.load(sourceConfigStr, EnrichmentConfig.class); Assert.assertTrue(config.getFieldMap().get("stellar") instanceof Map); Assert.assertTrue(config.getEnrichmentConfigs().get("stellar") instanceof ConfigHandler); Assert.assertEquals(Configs.STELLAR, ((ConfigHandler)config.getEnrichmentConfigs().get("stellar")).getType()); }
Assert.assertNotSame(outputScs.get("bro"), broSc); Assert.assertEquals( outputScs.get("bro").toJSON() , ((List<String>)outputScs.get("bro").getEnrichment().getFieldMap().get(Constants.SIMPLE_HBASE_ENRICHMENT)).size() , 2 ); Assert.assertTrue( outputScs.get("bro").toJSON() , ((List<String>)outputScs.get("bro").getEnrichment().getFieldMap() .get(Constants.SIMPLE_HBASE_ENRICHMENT)) .contains("ip_src_addr") ); Assert.assertTrue( outputScs.get("bro").toJSON() , ((List<String>)outputScs.get("bro").getEnrichment().getFieldMap() .get(Constants.SIMPLE_HBASE_ENRICHMENT)) .contains("ip_dst_addr")