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);
}
}
}
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));
}
Aggregations