use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testDatePartitionWithMismatchedType.
@Test
public void testDatePartitionWithMismatchedType() throws Exception {
ColumnModel column = new ColumnModel().name("column").datatype("int64");
TableModel table = new TableModel().name("table").columns(Collections.singletonList(column)).partitionMode(TableModel.PartitionModeEnum.DATE).datePartitionOptions(new DatePartitionOptionsModel().column(column.getName()));
DatasetRequestModel req = buildDatasetRequest();
req.getSchema().tables(Collections.singletonList(table)).relationships(Collections.emptyList()).assets(Collections.emptyList());
ErrorModel errorModel = expectBadDatasetCreateRequest(req);
checkValidationErrorModel(errorModel, new String[] { "InvalidDatePartitionColumnType" });
}
use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testIntPartitionWithMissingColumn.
@Test
public void testIntPartitionWithMissingColumn() throws Exception {
TableModel table = new TableModel().name("table").columns(Collections.emptyList()).partitionMode(TableModel.PartitionModeEnum.INT).intPartitionOptions(new IntPartitionOptionsModel().column("not_a_column").min(1L).max(2L).interval(1L));
DatasetRequestModel req = buildDatasetRequest();
req.getSchema().tables(Collections.singletonList(table)).relationships(Collections.emptyList()).assets(Collections.emptyList());
ErrorModel errorModel = expectBadDatasetCreateRequest(req);
checkValidationErrorModel(errorModel, new String[] { "InvalidIntPartitionColumnName" });
}
use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testDatePartitionWithBadOptions.
@Test
public void testDatePartitionWithBadOptions() throws Exception {
TableModel table = new TableModel().name("table").columns(Collections.emptyList()).partitionMode(TableModel.PartitionModeEnum.DATE).intPartitionOptions(new IntPartitionOptionsModel().column("foo").min(1L).max(2L).interval(1L));
DatasetRequestModel req = buildDatasetRequest();
req.getSchema().tables(Collections.singletonList(table)).relationships(Collections.emptyList()).assets(Collections.emptyList());
ErrorModel errorModel = expectBadDatasetCreateRequest(req);
checkValidationErrorModel(errorModel, new String[] { "MissingDatePartitionOptions", "InvalidIntPartitionOptions" });
}
use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testDuplicateColumnNames.
@Test
public void testDuplicateColumnNames() throws Exception {
ColumnModel column = new ColumnModel().name("id").datatype("string");
TableModel table = new TableModel().name("table").columns(Arrays.asList(column, column));
DatasetRequestModel req = buildDatasetRequest();
req.getSchema().tables(Collections.singletonList(table));
ErrorModel errorModel = expectBadDatasetCreateRequest(req);
checkValidationErrorModel(errorModel, new String[] { "DuplicateColumnNames", "InvalidRelationshipTermTableColumn", "InvalidRelationshipTermTableColumn", "InvalidAssetTable", "InvalidAssetTableColumn", "InvalidAssetTableColumn", "InvalidRootColumn" });
}
use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class ProfileTest method testBadAccount.
@Test
public void testBadAccount() throws Exception {
String accountId = "blah";
billingProfileRequest.billingAccountId(accountId);
String responseJson = mvc.perform(post("/api/resources/v1/profiles").contentType(MediaType.APPLICATION_JSON).header("Authorization", "Bearer: faketoken").content(TestUtils.mapToJson(billingProfileRequest))).andExpect(status().is4xxClientError()).andReturn().getResponse().getContentAsString();
ErrorModel errors = objectMapper.readerFor(ErrorModel.class).readValue(responseJson);
assertThat("invalid billing account", errors.getErrorDetail().get(0), startsWith("billingAccountId"));
}
Aggregations