use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testIntPartitionWithBadRange.
@Test
public void testIntPartitionWithBadRange() throws Exception {
ColumnModel column = new ColumnModel().name("column").datatype("int64");
TableModel table = new TableModel().name("table").columns(Collections.singletonList(column)).partitionMode(TableModel.PartitionModeEnum.INT).intPartitionOptions(new IntPartitionOptionsModel().column(column.getName()).min(5L).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[] { "InvalidIntPartitionRange", "InvalidIntPartitionInterval" });
}
use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testDatasetNameMissing.
@Test
public void testDatasetNameMissing() throws Exception {
ErrorModel errorModel = expectBadDatasetCreateRequest(buildDatasetRequest().name(null));
checkValidationErrorModel(errorModel, new String[] { "NotNull", "DatasetNameMissing" });
}
use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testDuplicateRelationshipNames.
@Test
public void testDuplicateRelationshipNames() throws Exception {
DatasetRequestModel req = buildDatasetRequest();
RelationshipModel relationship = buildParticipantSampleRelationship();
req.getSchema().relationships(Arrays.asList(relationship, relationship));
ErrorModel errorModel = expectBadDatasetCreateRequest(req);
checkValidationErrorModel(errorModel, new String[] { "DuplicateRelationshipNames" });
}
use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testIntPartitionWithMismatchedType.
@Test
public void testIntPartitionWithMismatchedType() throws Exception {
ColumnModel column = new ColumnModel().name("column").datatype("timestamp");
TableModel table = new TableModel().name("table").columns(Collections.singletonList(column)).partitionMode(TableModel.PartitionModeEnum.INT).intPartitionOptions(new IntPartitionOptionsModel().column(column.getName()).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[] { "InvalidIntPartitionColumnType" });
}
use of bio.terra.model.ErrorModel in project jade-data-repo by DataBiosphere.
the class DatasetValidationsTest method testInvalidAssetTableColumn.
@Test
public void testInvalidAssetTableColumn() throws Exception {
// participant is a valid table but date_collected is in the sample table
AssetTableModel invalidAssetTable = new AssetTableModel().name("participant").columns(Collections.singletonList("date_collected"));
AssetModel asset = new AssetModel().name("mismatched").rootTable("participant").rootColumn("date_collected").tables(Collections.singletonList(invalidAssetTable)).follow(Collections.singletonList("participant_sample"));
DatasetRequestModel req = buildDatasetRequest();
req.getSchema().assets(Collections.singletonList(asset));
ErrorModel errorModel = expectBadDatasetCreateRequest(req);
checkValidationErrorModel(errorModel, new String[] { "InvalidAssetTableColumn", "InvalidRootColumn" });
}
Aggregations