metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cestella <...@git.apache.org>
Subject [GitHub] metron pull request #871: METRON-1365: Allow PROFILE_GET to return a default...
Date Wed, 20 Dec 2017 14:41:52 GMT
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/871#discussion_r158040425
  
    --- Diff: metron-analytics/metron-profiler-client/src/test/java/org/apache/metron/profiler/client/stellar/GetProfileTest.java
---
    @@ -310,6 +306,36 @@ public void testOutsideTimeHorizon() {
         Assert.assertEquals(0, result.size());
       }
     
    +  /**
    +   * Default value should be able to be specified
    +   */
    +  @Test
    +  public void testWithDefaultValue() {
    +    String expr = "PROFILE_GET('profile1', 'entity1', PROFILE_FIXED(4, 'HOURS'))";
    +    @SuppressWarnings("unchecked")
    +    List<Integer> result = run(expr, List.class);
    +
    +    // validate - expect to fail to read any values because we didn't write any.
    +    Assert.assertEquals(0, result.size());
    +
    +    // execute - read the profile values - with config_override.
    +    // first two override values are strings, third is deliberately a number.
    +    testOverride("{'profiler.default.value' : 0}", 0);
    +    testOverride("{'profiler.default.value' : 'metron'}", "metron");
    +    testOverride("{'profiler.default.value' : []}", new ArrayList<>());
    +  }
    +
    +  private void testOverride(String overrides, Object defaultVal) {
    +      String expr = "PROFILE_GET('profile1', 'entity1', PROFILE_FIXED(4, 'HOURS'), [],
" + overrides + ")"
    +      ;
    --- End diff --
    
    Good catch, corrected.


---

Mime
View raw message