use of org.json.simple.parser.JSONParser in project metron by apache.
the class HostFromPropertiesFileAdapterTest method parseJSON.
@Before
public void parseJSON() throws ParseException {
JSONParser jsonParser = new JSONParser();
expectedMessage = (JSONObject) jsonParser.parse(expectedMessageString);
}
use of org.json.simple.parser.JSONParser in project metron by apache.
the class ThreatIntelAdapterTest method setup.
@Before
public void setup() throws Exception {
final MockHTable trackerTable = (MockHTable) MockHBaseTableProvider.addToCache(atTableName, cf);
final MockHTable threatIntelTable = (MockHTable) MockHBaseTableProvider.addToCache(threatIntelTableName, cf);
EnrichmentHelper.INSTANCE.load(threatIntelTable, cf, new ArrayList<LookupKV<EnrichmentKey, EnrichmentValue>>() {
{
add(new LookupKV<>(new EnrichmentKey("10.0.2.3", "10.0.2.3"), new EnrichmentValue(new HashMap<>())));
}
});
BloomAccessTracker bat = new BloomAccessTracker(threatIntelTableName, 100, 0.03);
PersistentAccessTracker pat = new PersistentAccessTracker(threatIntelTableName, "0", trackerTable, cf, bat, 0L);
lookup = new EnrichmentLookup(threatIntelTable, cf, pat);
JSONParser jsonParser = new JSONParser();
expectedMessage = (JSONObject) jsonParser.parse(expectedMessageString);
}
use of org.json.simple.parser.JSONParser in project metron by apache.
the class BulkMessageWriterBoltTest method parseMessages.
@Before
public void parseMessages() throws ParseException {
JSONParser parser = new JSONParser();
fullMessageList = new ArrayList<>();
sampleMessage = (JSONObject) parser.parse(sampleMessageString);
sampleMessage.put("field", "value1");
fullMessageList.add(((JSONObject) sampleMessage.clone()));
sampleMessage.put("field", "value2");
fullMessageList.add(((JSONObject) sampleMessage.clone()));
sampleMessage.put("field", "value3");
fullMessageList.add(((JSONObject) sampleMessage.clone()));
sampleMessage.put("field", "value4");
fullMessageList.add(((JSONObject) sampleMessage.clone()));
sampleMessage.put("field", "value5");
fullMessageList.add(((JSONObject) sampleMessage.clone()));
}
use of org.json.simple.parser.JSONParser in project metron by apache.
the class GenericEnrichmentBoltTest method parseMessages.
@Before
public void parseMessages() throws ParseException {
JSONParser parser = new JSONParser();
originalMessage = (JSONObject) parser.parse(originalMessageString);
enrichedField1 = (JSONObject) parser.parse(enrichedField1String);
enrichedField2 = (JSONObject) parser.parse(enrichedField2String);
enrichedMessage = (JSONObject) parser.parse(enrichedMessageString);
}
use of org.json.simple.parser.JSONParser in project metron by apache.
the class GeoEnrichmentFunctionsTest method setupOnce.
@BeforeClass
public static void setupOnce() throws ParseException {
JSONParser jsonParser = new JSONParser();
expectedMessage = (JSONObject) jsonParser.parse(expectedMessageString);
expectedSubsetMessage = (JSONObject) jsonParser.parse(expectedSubsetString);
String baseDir = UnitTestHelper.findDir("GeoLite");
geoHdfsFile = new File(new File(baseDir), "GeoIP2-City-Test.mmdb.gz");
}
Aggregations