-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QTL Integration Style Tests #34
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,14 +68,14 @@ class TableFullViewProcessorSpec extends Specification { | |
def "Check table meta data info at grain level"() { | ||
|
||
setup: | ||
String expectedResponse = "[name:all, description:The pets all grain, metrics:[[category:General, name:rowNum, longName:rowNum, uri:http://localhost:9998/v1/rowNum], [category:General, name:limbs, longName:limbs, uri:http://localhost:9998/v1/limbs], [category:General, name:dayAvgLimbs, longName:dayAvgLimbs, uri:http://localhost:9998/v1/dayAvgLimbs]], retention:P1Y, longName:All, dimensions:[[category:General, name:species, longName:species, uri:http://localhost:9998/v1/species, cardinality:0], [category:General, name:sex, longName:sex, uri:http://localhost:9998/v1/sex, cardinality:0], [category:General, name:breed, longName:breed, uri:http://localhost:9998/v1/breed, cardinality:0]]]" | ||
String expectedResponse = "[description:The pets all grain, dimensions:[[category:General, name:sex, longName:sex, uri:http://localhost:9998/v1/sex, cardinality:0], [category:General, name:species, longName:species, uri:http://localhost:9998/v1/species, cardinality:0], [category:General, name:breed, longName:breed, uri:http://localhost:9998/v1/breed, cardinality:0]], longName:All, metrics:[[category:General, name:rowNum, longName:rowNum, uri:http://localhost:9998/v1/rowNum], [category:General, name:limbs, longName:limbs, uri:http://localhost:9998/v1/limbs], [category:General, name:dayAvgLimbs, longName:dayAvgLimbs, uri:http://localhost:9998/v1/dayAvgLimbs]], name:all, retention:P1Y]" | ||
LogicalTable petsTable = petsShapesTables.find {it.getName() == "pets"} | ||
|
||
when: | ||
TableGrainView tableGrainView = fullViewProcessor.formatTableGrain(petsTable, "all", uriInfo) | ||
|
||
then: | ||
tableGrainView.toString() == expectedResponse | ||
tableGrainView.sort().toString() == expectedResponse | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we sorting here? What changed that we need to sort now but didn't before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of containing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah, it's probably fine. |
||
} | ||
|
||
def "check all the tables full view at grain level"() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
package com.yahoo.bard.webservice.web.endpoints | ||
|
||
import com.yahoo.bard.webservice.data.dimension.BardDimensionField | ||
import com.yahoo.bard.webservice.data.dimension.DimensionDictionary | ||
import com.yahoo.bard.webservice.util.GroovyTestUtils | ||
import com.yahoo.bard.webservice.util.JsonSortStrategy | ||
|
||
/** | ||
* Testing Query Time Lookup Functionality with Lookup Dimensions in GroupBy query. | ||
*/ | ||
class LookupDimensionGroupingDataServletSpec extends BaseDataServletComponentSpec{ | ||
|
||
@Override | ||
def setup() { | ||
DimensionDictionary dimensionStore = jtb.configurationLoader.dimensionDictionary | ||
dimensionStore.findByApiName("sex").with { | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "sex1", "sex1Desc")) | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "sex2", "sex2Desc")) | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "sex3", "sex3Desc")) | ||
} | ||
dimensionStore.findByApiName("breed").with { | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "breed1", "breed1Desc")) | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "breed2", "breed2Desc")) | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "breed3", "breed3Desc")) | ||
} | ||
dimensionStore.findByApiName("species").with { | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "species1", "species1Desc")) | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "species2", "species2Desc")) | ||
addDimensionRow(BardDimensionField.makeDimensionRow(it, "species3", "species3Desc")) | ||
} | ||
} | ||
|
||
@Override | ||
Class<?>[] getResourceClasses() { | ||
[DataServlet.class] | ||
} | ||
|
||
@Override | ||
String getTarget() { | ||
return "data/pets/day/sex/breed/species" | ||
} | ||
|
||
@Override | ||
Map<String, List<String>> getQueryParams() { | ||
[ | ||
"metrics" : ["limbs"], | ||
"dateTime": ["2014-05-01%2F2014-05-02"] | ||
] | ||
} | ||
|
||
@Override | ||
boolean compareResult(String result, String expectedResult, JsonSortStrategy sortStrategy) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need the override? It's doing what the default does anyways I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
// Override "test druid query" feature test's compareResult which calls with SORT_BOTH to be default SORT_MAP | ||
GroovyTestUtils.compareJson(result, expectedResult) | ||
} | ||
|
||
@Override | ||
String getExpectedDruidQuery() { | ||
"""{ | ||
"aggregations": [{ "fieldName": "limbs", "name": "limbs", "type": "longSum" }], | ||
"context": {}, | ||
"dataSource": { "name": "all_pets", "type": "table" }, | ||
"dimensions": [ | ||
"sex", | ||
{ | ||
"dimension": "breed", | ||
"extractionFn": { | ||
"extractionFns": [ | ||
{ | ||
"injective": false, | ||
"lookup": { "namespace": "NAMESPACE1", "type": "namespace" }, | ||
"optimize": true, | ||
"replaceMissingValueWith": "Unknown NAMESPACE1", | ||
"retainMissingValue": false, "type": "lookup" | ||
}, | ||
{ | ||
"injective": false, | ||
"lookup": { "namespace": "NAMESPACE2", "type": "namespace" }, | ||
"optimize": true, | ||
"replaceMissingValueWith": "Unknown NAMESPACE2", | ||
"retainMissingValue": false, "type": "lookup" | ||
} | ||
], | ||
"type": "cascade" | ||
}, | ||
"outputName": "breed", "type": "extraction" | ||
}, | ||
{ | ||
"dimension": "class", | ||
"extractionFn": { | ||
"injective": false, | ||
"lookup": { "namespace": "NAMESPACE1", "type": "namespace" }, | ||
"optimize": true, | ||
"replaceMissingValueWith": "Unknown NAMESPACE1", "retainMissingValue": false, "type": "lookup" | ||
}, | ||
"outputName": "species", | ||
"type": "extraction" | ||
} | ||
], | ||
"granularity": { "period": "P1D", "timeZone": "UTC", "type": "period" }, | ||
"intervals": ["2014-05-01T00:00:00.000Z/2014-05-02T00:00:00.000Z"], | ||
"postAggregations": [], | ||
"queryType": "groupBy" | ||
}""" | ||
} | ||
|
||
@Override | ||
String getFakeDruidResponse() { | ||
"""[ | ||
{ | ||
"version" : "v1", | ||
"timestamp" : "2014-05-01T00:00:00.000Z", | ||
"event" : { | ||
"sex" : "sex1", | ||
"breed" : "breed1", | ||
"species" : "species1", | ||
"limbs" : 1 | ||
} | ||
}, | ||
{ | ||
"version" : "v1", | ||
"timestamp" : "2014-05-01T00:00:00.000Z", | ||
"event" : { | ||
"sex" : "sex2", | ||
"breed" : "breed2", | ||
"species" : "species2", | ||
"limbs" : 2 | ||
} | ||
}, | ||
{ | ||
"version" : "v1", | ||
"timestamp" : "2014-05-01T00:00:00.000Z", | ||
"event" : { | ||
"sex" : "sex3", | ||
"breed" : "breed3", | ||
"species" : "species3", | ||
"limbs" : 3 | ||
} | ||
} | ||
]""" | ||
} | ||
|
||
@Override | ||
String getExpectedApiResponse() { | ||
"""{ | ||
"rows": [{ | ||
"breed|desc": "breed1Desc", | ||
"breed|id": "breed1", | ||
"dateTime": "2014-05-01 00:00:00.000", | ||
"limbs": 1, | ||
"sex|desc": "sex1Desc", | ||
"sex|id": "sex1", | ||
"species|desc": "species1Desc", | ||
"species|id": "species1" | ||
}, | ||
{ | ||
"breed|desc": "breed2Desc", | ||
"breed|id": "breed2", | ||
"dateTime": "2014-05-01 00:00:00.000", | ||
"limbs": 2, | ||
"sex|desc": "sex2Desc", | ||
"sex|id": "sex2", | ||
"species|desc": "species2Desc", | ||
"species|id": "species2" | ||
}, | ||
{ | ||
"breed|desc": "breed3Desc", | ||
"breed|id": "breed3", | ||
"dateTime": "2014-05-01 00:00:00.000", | ||
"limbs": 3, | ||
"sex|desc": "sex3Desc", | ||
"sex|id": "sex3", | ||
"species|desc": "species3Desc", | ||
"species|id": "species3" | ||
}] | ||
}""" | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to call out this change in Changelog