-
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.
- Loading branch information
Showing
9 changed files
with
66 additions
and
30 deletions.
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
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
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
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
35 changes: 35 additions & 0 deletions
35
...t/groovy/com/yahoo/bard/webservice/table/resolver/PhysicalDataSourceConstraintSpec.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,35 @@ | ||
package com.yahoo.bard.webservice.table.resolver | ||
|
||
import com.yahoo.bard.webservice.data.time.ZonedTimeGrain | ||
import com.yahoo.bard.webservice.table.Column | ||
import com.yahoo.bard.webservice.table.PhysicalTableSchema | ||
|
||
import spock.lang.Specification | ||
|
||
/** | ||
* Test PhysicalDataSourceConstraint correctly translates and filters column physical names. | ||
*/ | ||
class PhysicalDataSourceConstraintSpec extends Specification { | ||
|
||
DataSourceConstraint dataSourceConstraint | ||
PhysicalTableSchema physicalTableSchema | ||
PhysicalDataSourceConstraint physicalDataSourceConstraint | ||
|
||
def setup() { | ||
dataSourceConstraint = Mock(DataSourceConstraint) | ||
dataSourceConstraint | ||
dataSourceConstraint.getAllColumnNames() >> (['columnOne', 'columnTwo', 'columnThree'] as Set) | ||
physicalTableSchema = new PhysicalTableSchema(Mock(ZonedTimeGrain), [new Column('columnOne'), new Column('columnThree')], ['columnOne': 'column_one', 'columnTwo': 'column_two']) | ||
physicalDataSourceConstraint = new PhysicalDataSourceConstraint(dataSourceConstraint, physicalTableSchema) | ||
} | ||
|
||
def "physical data source constraint filters out columns not in the given schema"() { | ||
expect: | ||
!physicalDataSourceConstraint.getAllColumnPhysicalNames().contains('column_two') | ||
} | ||
|
||
def "physical data source constraint maps to physical name correctly even if mapping does not exist"() { | ||
expect: | ||
physicalDataSourceConstraint.getAllColumnPhysicalNames() == ['column_one', 'columnThree'] as Set | ||
} | ||
} |