Skip to content

Commit

Permalink
Add enum UnderlayTestConfigs to list test underlays (#1095)
Browse files Browse the repository at this point in the history
  • Loading branch information
dexamundsen authored Dec 9, 2024
1 parent f27da98 commit ed91e00
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 24 deletions.
19 changes: 19 additions & 0 deletions underlay/src/test/java/bio/terra/tanagra/UnderlayTestConfigs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package bio.terra.tanagra;

public enum UnderlayTestConfigs {
AOUSC2023Q3R2("aouSC2023Q3R2_verily"),
AOUSR2019Q4R4("aouSR2019q4r4_broad"),
CMSSYNPUF("cmssynpuf_broad"),
SD20230331("sd20230331_verily"),
SD20230831("sd20230831_verily");

private final String fileName;

UnderlayTestConfigs(String fileName) {
this.fileName = fileName;
}

public String fileName() {
return fileName;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package bio.terra.tanagra.datasetspecific.cmssynpuf;

import static bio.terra.tanagra.UnderlayTestConfigs.CMSSYNPUF;

import bio.terra.tanagra.api.query.hint.HintInstance;
import bio.terra.tanagra.api.shared.Literal;
import bio.terra.tanagra.api.shared.ValueDisplay;
Expand All @@ -15,7 +17,7 @@ public class CmsSynpufHintsTest extends BaseHintsTest {

@Override
protected String getServiceConfigName() {
return "cmssynpuf_broad";
return CMSSYNPUF.fileName();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.SD20230831;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -32,7 +33,7 @@ public class BioVUFilterBuilderTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("sd20230831_verily");
SZService szService = configReader.readService(SD20230831.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.AOUSR2019Q4R4;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -48,7 +49,7 @@ public class EntityGroupFilterBuilderForCriteriaOccurrenceTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("aouSR2019q4r4_broad");
SZService szService = configReader.readService(AOUSR2019Q4R4.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.SD20230831;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -42,7 +43,7 @@ public class EntityGroupFilterBuilderForGroupTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("sd20230831_verily");
SZService szService = configReader.readService(SD20230831.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.SD20230831;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -36,7 +37,7 @@ public class EntityGroupFilterBuilderForItemsTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("sd20230831_verily");
SZService szService = configReader.readService(SD20230831.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.AOUSC2023Q3R2;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
Expand Down Expand Up @@ -43,7 +44,7 @@ public class FilterableGroupFilterBuilderTest {
private static GroupItems groupItems_variant;

// Double escaped for Java then for JSON.
private static String configJson =
private static final String configJson =
"""
{
"entityGroup": "variantPerson",
Expand Down Expand Up @@ -109,7 +110,7 @@ public class FilterableGroupFilterBuilderTest {
@BeforeAll
static void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("aouSC2023Q3R2_verily");
SZService szService = configReader.readService(AOUSC2023Q3R2.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.SD20230831;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -40,7 +41,7 @@ public class MultiAttributeFilterBuilderTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("sd20230831_verily");
SZService szService = configReader.readService(SD20230831.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.CMSSYNPUF;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
Expand All @@ -25,7 +26,7 @@ public class OutputUnfilteredFilterBuilderTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("cmssynpuf_broad");
SZService szService = configReader.readService(CMSSYNPUF.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.CMSSYNPUF;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -32,7 +33,7 @@ public class PrimaryEntityFilterBuilderTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("cmssynpuf_broad");
SZService szService = configReader.readService(CMSSYNPUF.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.filterbuilder;

import static bio.terra.tanagra.UnderlayTestConfigs.SD20230831;
import static bio.terra.tanagra.utils.ProtobufUtils.serializeToJson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -43,7 +44,7 @@ public class TextSearchFilterBuilderTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("sd20230831_verily");
SZService szService = configReader.readService(SD20230831.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package bio.terra.tanagra.query.bigquery;

import static bio.terra.tanagra.UnderlayTestConfigs.CMSSYNPUF;

import bio.terra.tanagra.testing.GeneratedSqlUtils;
import bio.terra.tanagra.underlay.ConfigReader;
import bio.terra.tanagra.underlay.Underlay;
Expand All @@ -24,7 +26,7 @@ void setup() {
}

protected String getServiceConfigName() {
return "cmssynpuf_broad";
return CMSSYNPUF.fileName();
}

protected void assertSqlMatchesWithTableNameOnly(String testName, String sql, BQTable... tables)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.query.bigquery.pagination;

import static bio.terra.tanagra.UnderlayTestConfigs.CMSSYNPUF;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
Expand Down Expand Up @@ -27,13 +28,12 @@
@Tag("requires-cloud-access")
@Tag("broad-underlays")
public class BQCountQueryPaginationTest {
private static final String SERVICE_CONFIG_NAME = "cmssynpuf_broad";
private Underlay underlay;

@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService(SERVICE_CONFIG_NAME);
SZService szService = configReader.readService(CMSSYNPUF.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.query.bigquery.pagination;

import static bio.terra.tanagra.UnderlayTestConfigs.CMSSYNPUF;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
Expand All @@ -22,13 +23,12 @@
@Tag("requires-cloud-access")
@Tag("broad-underlays")
public class BQListQueryPaginationTest {
private static final String SERVICE_CONFIG_NAME = "cmssynpuf_broad";
private Underlay underlay;

@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService(SERVICE_CONFIG_NAME);
SZService szService = configReader.readService(CMSSYNPUF.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.query.bigquery.resultparsing;

import static bio.terra.tanagra.UnderlayTestConfigs.AOUSR2019Q4R4;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand All @@ -16,7 +17,7 @@
public class BQHintQueryResultsTest extends BQRunnerTest {
@Override
protected String getServiceConfigName() {
return "aouSR2019q4r4_broad";
return AOUSR2019Q4R4.fileName();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package bio.terra.tanagra.query.bigquery.sqlbuilding;

import static bio.terra.tanagra.UnderlayTestConfigs.AOUSR2019Q4R4;

import bio.terra.tanagra.api.query.hint.HintQueryRequest;
import bio.terra.tanagra.api.query.hint.HintQueryResult;
import bio.terra.tanagra.api.shared.Literal;
Expand All @@ -13,7 +15,7 @@
public class BQHintQueryTest extends BQRunnerTest {
@Override
protected String getServiceConfigName() {
return "aouSR2019q4r4_broad";
return AOUSR2019Q4R4.fileName();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package bio.terra.tanagra.query.bigquery.sqlbuilding;

import static bio.terra.tanagra.UnderlayTestConfigs.AOUSR2019Q4R4;
import static bio.terra.tanagra.UnderlayTestConfigs.CMSSYNPUF;
import static org.junit.jupiter.api.Assertions.assertTrue;

import bio.terra.tanagra.api.field.AttributeField;
Expand Down Expand Up @@ -28,7 +30,7 @@
public class BQRemoveParamsTest extends BQRunnerTest {
@Override
protected String getServiceConfigName() {
return "aouSR2019q4r4_broad";
return AOUSR2019Q4R4.fileName();
}

@Test
Expand Down Expand Up @@ -99,7 +101,7 @@ void dateRemoveParam() throws IOException {
// The aouSR2019q4r4 underlay does not have an example of a field with DATE type.
// So for this test, we use the cmssynpuf underlay.
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("cmssynpuf_broad");
SZService szService = configReader.readService(CMSSYNPUF.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
Underlay underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
BQQueryRunner bqQueryRunner = (BQQueryRunner) underlay.getQueryRunner();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package bio.terra.tanagra.query.bigquery.sqlbuilding.filter;

import static bio.terra.tanagra.UnderlayTestConfigs.SD20230331;

import bio.terra.tanagra.api.field.AttributeField;
import bio.terra.tanagra.api.filter.AttributeFilter;
import bio.terra.tanagra.api.filter.EntityFilter;
Expand Down Expand Up @@ -204,7 +206,7 @@ void groupHasItemsFilterIntermediateTable() throws IOException {
// of the test, we use the SD underlay. But since we the GHA does not have
// credentials to query against an SD dataset, here we just check the generated SQL.
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("sd20230331_verily");
SZService szService = configReader.readService(SD20230331.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
Underlay underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
BQQueryRunner bqQueryRunner = (BQQueryRunner) underlay.getQueryRunner();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package bio.terra.tanagra.query.bigquery.sqlbuilding.filter;

import static bio.terra.tanagra.UnderlayTestConfigs.SD20230331;

import bio.terra.tanagra.api.field.AttributeField;
import bio.terra.tanagra.api.filter.AttributeFilter;
import bio.terra.tanagra.api.filter.RelationshipFilter;
Expand Down Expand Up @@ -253,7 +255,7 @@ void relationshipFilterFKFilter() throws IOException {
// of the test, we use the SD underlay. But since we the GHA does not have
// credentials to query against an SD dataset, here we just check the generated SQL.
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("sd20230331_verily");
SZService szService = configReader.readService(SD20230331.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
Underlay underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
BQQueryRunner bqQueryRunner = (BQQueryRunner) underlay.getQueryRunner();
Expand Down Expand Up @@ -817,7 +819,7 @@ void relationshipFilterNestedNullFilterFKFilter() throws IOException {
// of the test, we use the SD underlay. But since we the GHA does not have
// credentials to query against an SD dataset, here we just check the generated SQL.
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("sd20230331_verily");
SZService szService = configReader.readService(SD20230331.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
Underlay underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
BQQueryRunner bqQueryRunner = (BQQueryRunner) underlay.getQueryRunner();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bio.terra.tanagra.underlay;

import static bio.terra.tanagra.UnderlayTestConfigs.CMSSYNPUF;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand All @@ -21,7 +22,7 @@ public class CriteriaSelectorTest {
@BeforeEach
void setup() {
ConfigReader configReader = ConfigReader.fromJarResources();
SZService szService = configReader.readService("cmssynpuf_broad");
SZService szService = configReader.readService(CMSSYNPUF.fileName());
SZUnderlay szUnderlay = configReader.readUnderlay(szService.underlay);
underlay = Underlay.fromConfig(szService.bigQuery, szUnderlay, configReader);
}
Expand Down

0 comments on commit ed91e00

Please sign in to comment.