metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmiklavc <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #232: METRON-395 Fix Metron Bro parser not par...
Date Fri, 26 Aug 2016 14:26:51 GMT
Github user mmiklavc commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/232#discussion_r76427204
  
    --- Diff: metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/bro/BasicBroParserTest.java
---
    @@ -46,14 +46,37 @@ public BasicBroParserTest() throws Exception {
     		jsonParser = new JSONParser();
     	}
     
    -    public void testUnwrappedBroMessage() throws ParseException {
    -        String rawMessage = "{\"timestamp\":\"1449511228474\",\"uid\":\"CFgSLp4HgsGqXnNjZi\",\"source_ip\":\"104.130.172.191\",\"source_port\":33893,\"dest_ip\":\"69.20.0.164\",\"dest_port\":53,\"proto\":\"udp\",\"trans_id\":3514,\"rcode\":3,\"rcode_name\":\"NXDOMAIN\",\"AA\":false,\"TC\":false,\"RD\":false,\"RA\":false,\"Z\":0,\"rejected\":false,\"sensor\":\"cloudbro\",\"type\":\"dns\"}";
    +	/**
    +	 * This test is included as a gut-check about our formatting expectations using the
Java JDK
    +	 * https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html
    +	 */
    +	public void testDecimalFormatAssumptions() {
    +		Pair[] pairs = {
    +						Pair.of(new Double(12345678), "12345678.0"),
    +						Pair.of(new Double(12345678.0), "12345678.0"),
    +						Pair.of(new Double(12345678.1), "12345678.1"),
    +						Pair.of(new Double(12345678.11), "12345678.11"),
    +						Pair.of(new Double(12345678.111), "12345678.111"),
    +						Pair.of(new Double(12345678.1111), "12345678.1111"),
    +						Pair.of(new Double(12345678.11111), "12345678.11111"),
    +						Pair.of(new Double(12345678.111111), "12345678.111111")
    +		};
    +		for (Pair pair : pairs) {
    +			assertEquals("Format did not match", pair.getRight(), new DecimalFormat("0.0#####").format(pair.getLeft()));
    --- End diff --
    
    That's a good suggestion


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message