metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cestella <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #516: METRON-830 Adding StringFunctions to Ste...
Date Fri, 07 Apr 2017 16:37:34 GMT
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/516#discussion_r110431257
  
    --- Diff: metron-platform/metron-common/src/test/java/org/apache/metron/common/dsl/functions/StringFunctionsTest.java
---
    @@ -207,4 +207,78 @@ public void testFormatWithNoArguments() throws Exception {
       public void testFormatWithMissingArguments() throws Exception {
         run("FORMAT('missing arg: %d')", Collections.emptyMap());
       }
    +
    +
    +  /**
    +  * CHOP StringFunction
    +  * @throws Exception
    +  */
    +  @Test
    +  public void testChop() throws Exception {
    +    Assert.assertEquals("ab",   run("CHOP('abc')", new HashedMap()));
    +    Assert.assertEquals(null,   run("CHOP(null)", new HashedMap()));
    +    Assert.assertEquals("abc",  run("CHOP(msg)", ImmutableMap.of("msg", "abc\r\n")));
    --- End diff --
    
    Because it's coming in through a variable `msg`.  The idea being that it could be existent
in a message flowing through the topologies.  Stellar can't represent `\n` and `\r`, but they
can get in there honestly.


---
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