Search in sources :

Example 11 with TableModel

use of bio.terra.model.TableModel 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" });
}
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 12 with TableModel

use of bio.terra.model.TableModel 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 13 with TableModel

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

the class DatasetValidationsTest method testIntPartitionWithBadOptions.

@Test
public void testIntPartitionWithBadOptions() throws Exception {
    TableModel table = new TableModel().name("table").columns(Collections.emptyList()).partitionMode(TableModel.PartitionModeEnum.INT).datePartitionOptions(new DatePartitionOptionsModel().column("foo"));
    DatasetRequestModel req = buildDatasetRequest();
    req.getSchema().tables(Collections.singletonList(table)).relationships(Collections.emptyList()).assets(Collections.emptyList());
    ErrorModel errorModel = expectBadDatasetCreateRequest(req);
    checkValidationErrorModel(errorModel, new String[] { "InvalidDatePartitionOptions", "MissingIntPartitionOptions" });
}
Also used : DatasetRequestModel(bio.terra.model.DatasetRequestModel) DatePartitionOptionsModel(bio.terra.model.DatePartitionOptionsModel) ErrorModel(bio.terra.model.ErrorModel) TableModel(bio.terra.model.TableModel) AssetTableModel(bio.terra.model.AssetTableModel) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 14 with TableModel

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

the class DatasetValidationsTest method testDatePartitionWithMissingColumn.

@Test
public void testDatePartitionWithMissingColumn() throws Exception {
    TableModel table = new TableModel().name("table").columns(Collections.emptyList()).partitionMode(TableModel.PartitionModeEnum.DATE).datePartitionOptions(new DatePartitionOptionsModel().column("not_a_column"));
    DatasetRequestModel req = buildDatasetRequest();
    req.getSchema().tables(Collections.singletonList(table)).relationships(Collections.emptyList()).assets(Collections.emptyList());
    ErrorModel errorModel = expectBadDatasetCreateRequest(req);
    checkValidationErrorModel(errorModel, new String[] { "InvalidDatePartitionColumnName" });
}
Also used : DatasetRequestModel(bio.terra.model.DatasetRequestModel) DatePartitionOptionsModel(bio.terra.model.DatePartitionOptionsModel) ErrorModel(bio.terra.model.ErrorModel) TableModel(bio.terra.model.TableModel) AssetTableModel(bio.terra.model.AssetTableModel) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 15 with TableModel

use of bio.terra.model.TableModel 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

TableModel (bio.terra.model.TableModel)15 AssetTableModel (bio.terra.model.AssetTableModel)14 ErrorModel (bio.terra.model.ErrorModel)14 Test (org.junit.Test)14 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)14 DatasetRequestModel (bio.terra.model.DatasetRequestModel)13 ColumnModel (bio.terra.model.ColumnModel)8 IntPartitionOptionsModel (bio.terra.model.IntPartitionOptionsModel)7 DatePartitionOptionsModel (bio.terra.model.DatePartitionOptionsModel)5 ConnectedTestConfiguration (bio.terra.app.configuration.ConnectedTestConfiguration)1 PDAO_PREFIX (bio.terra.common.PdaoConstant.PDAO_PREFIX)1 TestUtils (bio.terra.common.TestUtils)1 Connected (bio.terra.common.category.Connected)1 ConnectedOperations (bio.terra.common.fixtures.ConnectedOperations)1 JsonLoader (bio.terra.common.fixtures.JsonLoader)1 Names (bio.terra.common.fixtures.Names)1 BillingProfileModel (bio.terra.model.BillingProfileModel)1 DRSObject (bio.terra.model.DRSObject)1 DatasetSummaryModel (bio.terra.model.DatasetSummaryModel)1 DeleteResponseModel (bio.terra.model.DeleteResponseModel)1