use of bio.terra.workspace.generated.model.ApiResourceAttributesUnion in project terra-workspace-manager by DataBiosphere.
the class MakeApiResourceDescriptionTest method mapReferencedBigQueryDataTableTest.
@Test
public void mapReferencedBigQueryDataTableTest() throws Exception {
String projectId = RandomStringUtils.randomAlphabetic(12);
String datasetName = RandomStringUtils.randomAlphabetic(12);
String datatableName = RandomStringUtils.randomAlphabetic(12);
var resource = new ReferencedBigQueryDataTableResource(workspaceId, resourceId, resourceName, description, cloning, projectId, datasetName, datatableName);
ApiResourceDescription resourceDescription = resourceController.makeApiResourceDescription(resource);
validateWsmResource(resourceDescription);
ApiResourceAttributesUnion union = resourceDescription.getResourceAttributes();
ApiGcpBigQueryDataTableAttributes attributes = union.getGcpBqDataTable();
assertThat(attributes, is(notNullValue()));
assertEquals(attributes.getDatasetId(), datasetName);
assertEquals(attributes.getProjectId(), projectId);
assertEquals(attributes.getDataTableId(), datatableName);
}
use of bio.terra.workspace.generated.model.ApiResourceAttributesUnion in project terra-workspace-manager by DataBiosphere.
the class ResourceController method makeApiResourceDescription.
// Convert a WsmResource into the API format for enumeration
@VisibleForTesting
public ApiResourceDescription makeApiResourceDescription(WsmResource wsmResource) {
ApiResourceMetadata common = wsmResource.toApiMetadata();
ApiResourceAttributesUnion union = wsmResource.toApiAttributesUnion();
return new ApiResourceDescription().metadata(common).resourceAttributes(union);
}
Aggregations