gora-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GORA-454) Implement FilterList tests
Date Mon, 11 Jan 2016 12:47:39 GMT

    [ https://issues.apache.org/jira/browse/GORA-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15091852#comment-15091852
] 

ASF GitHub Bot commented on GORA-454:
-------------------------------------

Github user renato2099 commented on a diff in the pull request:

    https://github.com/apache/gora/pull/48#discussion_r49316977
  
    --- Diff: gora-core/src/main/java/org/apache/gora/filter/FilterList.java ---
    @@ -101,8 +109,25 @@ public void write(DataOutput out) throws IOException {
     
       @Override
       public boolean filter(K key, T persistent) {
    -    // TODO not yet implemented
    -    return false;
    +    boolean filtered = false;
    +    //OR
    +    if (operator.equals(Operator.MUST_PASS_ONE)) {
    +      for (Filter<K, T> filter: filters) {
    +        if (!filter.filter(key, persistent)) {
    +          return !filtered;
    +        }
    +      }
    +      //AND
    +    } else if (operator.equals(Operator.MUST_PASS_ALL)) {
    +      for (Filter<K, T> filter: filters) {
    +        if (filter.filter(key, persistent)) {
    +          return !filtered;
    +        }
    +      }
    +    } else {
    +      throw new IllegalStateException(operator + " not yet implemented!");
    +    }
    +    return filtered;
       }
    --- End diff --
    
    I think this looks good, just being annoying here, but would it look more readable if
we have a switch statement instead?


> Implement FilterList tests
> --------------------------
>
>                 Key: GORA-454
>                 URL: https://issues.apache.org/jira/browse/GORA-454
>             Project: Apache Gora
>          Issue Type: Test
>          Components: testing
>    Affects Versions: 0.7
>            Reporter: Lewis John McGibbney
>            Assignee: Lewis John McGibbney
>             Fix For: 0.7
>
>
> This issue relates to us improving tests coverage to accommodate and display functionality
of [FilterListhttps://github.com/apache/gora/blob/master/gora-core/src/main/java/org/apache/gora/filter/FilterList.java].
> The mailing list thread "[Apache Gora: Query|http://www.mail-archive.com/user%40gora.apache.org/msg00530.html]"
prompted better testing of OR and AND operands in the gora-core filter package.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message