-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--Also fixes a few edge cases that came up from the tests (we weren't handling `null` correctly, and the `NotFilter` is not in fact a MulticlauseFilter despite having a child). --Also fixes a test that started failing `AsyncInvalidApiRequest`. It was using the `GroovyTestUtils::compareJson` rather than `GroovyTestUtils::compareErrorPayload` which does something very similar, except it ignores the `requestId`. I don't know why this test wasn't failing earlier.
- Loading branch information
Andrew Cholewa
committed
Dec 8, 2016
1 parent
e846399
commit 8d5c155
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...-core/src/test/groovy/com/yahoo/bard/webservice/logging/blocks/DruidFilterInfoSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.yahoo.bard.webservice.logging.blocks | ||
|
||
import com.yahoo.bard.webservice.data.dimension.Dimension | ||
import com.yahoo.bard.webservice.druid.model.filter.AndFilter | ||
import com.yahoo.bard.webservice.druid.model.filter.Filter | ||
import com.yahoo.bard.webservice.druid.model.filter.NotFilter | ||
import com.yahoo.bard.webservice.druid.model.filter.OrFilter | ||
import com.yahoo.bard.webservice.druid.model.filter.SelectorFilter | ||
|
||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
|
||
class DruidFilterInfoSpec extends Specification { | ||
|
||
@Shared Filter selector = new SelectorFilter(Stub(Dimension), "value") | ||
|
||
static final String SELECTOR_NAME = SelectorFilter.class.simpleName | ||
static final String AND_NAME = AndFilter.class.simpleName | ||
static final String OR_NAME = OrFilter.class.simpleName | ||
static final String NOT_NAME = NotFilter.class.simpleName | ||
|
||
@Unroll | ||
def "The DruidFilterInfo correctly analyzes #filter"() { | ||
expect: | ||
new DruidFilterInfo(filter).numEachFilterType == expectedMap | ||
|
||
where: | ||
filter | expectedMap | ||
null | [:] | ||
selector | [(SELECTOR_NAME): 1L] | ||
new AndFilter([selector, selector]) | [(AND_NAME): 1L, (SELECTOR_NAME): 2L] | ||
new NotFilter(new AndFilter([selector, selector])) | [(NOT_NAME): 1L, (AND_NAME): 1L, (SELECTOR_NAME): 2L] | ||
new OrFilter([new AndFilter([selector, selector]), new NotFilter(new AndFilter([selector, selector]))]) | [(OR_NAME): 1L, (AND_NAME): 2L, (NOT_NAME): 1L, (SELECTOR_NAME): 4L] | ||
} | ||
} |