Search in sources :

Example 6 with IntPartitionOptionsModel

use of bio.terra.model.IntPartitionOptionsModel 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" });
}
Also used : IntPartitionOptionsModel(bio.terra.model.IntPartitionOptionsModel) DatasetRequestModel(bio.terra.model.DatasetRequestModel) ErrorModel(bio.terra.model.ErrorModel) ColumnModel(bio.terra.model.ColumnModel) TableModel(bio.terra.model.TableModel) AssetTableModel(bio.terra.model.AssetTableModel) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with IntPartitionOptionsModel

use of bio.terra.model.IntPartitionOptionsModel in project jade-data-repo by DataBiosphere.

the class DatasetValidationsTest method testIntPartitionTooManyPartitions.

@Test
public void testIntPartitionTooManyPartitions() 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(0L).max(4001L).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[] { "TooManyIntPartitions" });
}
Also used : IntPartitionOptionsModel(bio.terra.model.IntPartitionOptionsModel) DatasetRequestModel(bio.terra.model.DatasetRequestModel) ErrorModel(bio.terra.model.ErrorModel) ColumnModel(bio.terra.model.ColumnModel) TableModel(bio.terra.model.TableModel) AssetTableModel(bio.terra.model.AssetTableModel) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

AssetTableModel (bio.terra.model.AssetTableModel)7 IntPartitionOptionsModel (bio.terra.model.IntPartitionOptionsModel)7 TableModel (bio.terra.model.TableModel)7 DatasetRequestModel (bio.terra.model.DatasetRequestModel)6 ErrorModel (bio.terra.model.ErrorModel)6 Test (org.junit.Test)6 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 ColumnModel (bio.terra.model.ColumnModel)4 DatePartitionOptionsModel (bio.terra.model.DatePartitionOptionsModel)2