Search in sources :

Example 1 with DatasetSpecificationModel

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

the class DatasetRequestValidator method validate.

@Override
public void validate(@NotNull Object target, Errors errors) {
    if (target != null && target instanceof DatasetRequestModel) {
        DatasetRequestModel datasetRequest = (DatasetRequestModel) target;
        validateDatasetName(datasetRequest.getName(), errors);
        DatasetSpecificationModel schema = datasetRequest.getSchema();
        if (schema != null) {
            validateSchema(schema, errors);
        }
    }
}
Also used : DatasetSpecificationModel(bio.terra.model.DatasetSpecificationModel) DatasetRequestModel(bio.terra.model.DatasetRequestModel)

Example 2 with DatasetSpecificationModel

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

the class DatasetIntegrationTest method testAssetCreationUndo.

@Test
public void testAssetCreationUndo() throws Exception {
    // create a dataset
    DatasetSummaryModel summaryModel = dataRepoFixtures.createDataset(steward(), "it-dataset-omop.json");
    datasetId = summaryModel.getId();
    DatasetModel datasetModel = dataRepoFixtures.getDataset(steward(), summaryModel.getId());
    List<AssetModel> originalAssetList = datasetModel.getSchema().getAssets();
    assertThat("Asset specification is as originally expected", originalAssetList.size(), equalTo(1));
    AssetModel assetModel = new AssetModel().name("assetName").rootTable("person").rootColumn("person_id").tables(Arrays.asList(DatasetFixtures.buildAssetParticipantTable(), DatasetFixtures.buildAssetSampleTable())).follow(Collections.singletonList("fpk_visit_person"));
    // have the asset creation fail
    // by calling the fault insertion
    dataRepoFixtures.setFault(steward(), ConfigEnum.CREATE_ASSET_FAULT.name(), true);
    // add an asset spec
    dataRepoFixtures.addDatasetAsset(steward(), datasetModel.getId(), assetModel);
    // make sure undo is completed successfully
    DatasetModel datasetModelWAsset = dataRepoFixtures.getDataset(steward(), datasetModel.getId());
    DatasetSpecificationModel datasetSpecificationModel = datasetModelWAsset.getSchema();
    List<AssetModel> assetList = datasetSpecificationModel.getAssets();
    // assert that the asset isn't there
    assertThat("Additional asset specification has never been added", assetList.size(), equalTo(1));
}
Also used : DatasetSpecificationModel(bio.terra.model.DatasetSpecificationModel) DatasetSummaryModel(bio.terra.model.DatasetSummaryModel) AssetModel(bio.terra.model.AssetModel) EnumerateDatasetModel(bio.terra.model.EnumerateDatasetModel) DatasetModel(bio.terra.model.DatasetModel) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

DatasetSpecificationModel (bio.terra.model.DatasetSpecificationModel)2 AssetModel (bio.terra.model.AssetModel)1 DatasetModel (bio.terra.model.DatasetModel)1 DatasetRequestModel (bio.terra.model.DatasetRequestModel)1 DatasetSummaryModel (bio.terra.model.DatasetSummaryModel)1 EnumerateDatasetModel (bio.terra.model.EnumerateDatasetModel)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1