use of bio.terra.model.IngestResponseModel in project jade-data-repo by DataBiosphere.
the class IngestInsertIntoDatasetTableStep method doStep.
@Override
public StepResult doStep(FlightContext context) throws InterruptedException {
Dataset dataset = IngestUtils.getDataset(context, datasetService);
DatasetTable targetTable = IngestUtils.getDatasetTable(context, dataset);
String stagingTableName = IngestUtils.getStagingTableName(context);
IngestRequestModel ingestRequest = IngestUtils.getIngestRequestModel(context);
PdaoLoadStatistics loadStatistics = IngestUtils.getIngestStatistics(context);
IngestResponseModel ingestResponse = new IngestResponseModel().dataset(dataset.getName()).datasetId(dataset.getId().toString()).table(ingestRequest.getTable()).path(ingestRequest.getPath()).loadTag(ingestRequest.getLoadTag()).badRowCount(loadStatistics.getBadRecords()).rowCount(loadStatistics.getRowCount());
context.getWorkingMap().put(JobMapKeys.RESPONSE.getKeyName(), ingestResponse);
bigQueryPdao.insertIntoDatasetTable(dataset, targetTable, stagingTableName);
return StepResult.getStepResultSuccess();
}
use of bio.terra.model.IngestResponseModel in project jade-data-repo by DataBiosphere.
the class IngestTest method ingestBadPathTest.
@Test
public void ingestBadPathTest() throws Exception {
IngestRequestModel request = dataRepoFixtures.buildSimpleIngest("file", "totally-legit-file.json");
DataRepoResponse<JobModel> ingestJobResponse = dataRepoFixtures.ingestJsonDataLaunch(steward(), datasetId, request);
DataRepoResponse<IngestResponseModel> ingestResponse = dataRepoClient.waitForResponse(steward(), ingestJobResponse, IngestResponseModel.class);
assertThat("ingest failed", ingestResponse.getStatusCode(), equalTo(HttpStatus.NOT_FOUND));
assertThat("failure is explained", ingestResponse.getErrorObject().orElseThrow(IllegalStateException::new).getMessage(), containsString("not found"));
}
use of bio.terra.model.IngestResponseModel in project jade-data-repo by DataBiosphere.
the class IngestTest method ingestBadMultiWildcardTest.
@Test
public void ingestBadMultiWildcardTest() throws Exception {
IngestRequestModel request = dataRepoFixtures.buildSimpleIngest("file", "ingest-prefix/*/ingest/suffix/*.json");
DataRepoResponse<JobModel> ingestJobResponse = dataRepoFixtures.ingestJsonDataLaunch(steward(), datasetId, request);
DataRepoResponse<IngestResponseModel> ingestResponse = dataRepoClient.waitForResponse(steward(), ingestJobResponse, IngestResponseModel.class);
assertThat("ingest failed", ingestResponse.getStatusCode(), equalTo(HttpStatus.BAD_REQUEST));
assertThat("failure is explained", ingestResponse.getErrorObject().orElseThrow(IllegalStateException::new).getMessage(), containsString("not supported"));
}
use of bio.terra.model.IngestResponseModel in project jade-data-repo by DataBiosphere.
the class IngestTest method ingestSingleFileMalformedTest.
@Test
public void ingestSingleFileMalformedTest() throws Exception {
IngestRequestModel request = dataRepoFixtures.buildSimpleIngest("file", "ingest-test/ingest-test-prtcpnt-malformed.json");
DataRepoResponse<JobModel> ingestJobResponse = dataRepoFixtures.ingestJsonDataLaunch(steward(), datasetId, request);
DataRepoResponse<IngestResponseModel> ingestResponse = dataRepoClient.waitForResponse(steward(), ingestJobResponse, IngestResponseModel.class);
assertThat("ingest failed", ingestResponse.getStatusCode(), equalTo(HttpStatus.BAD_REQUEST));
assertThat("failure is explained", ingestResponse.getErrorObject().orElseThrow(IllegalStateException::new).getErrorDetail(), hasItem(containsString("too many errors")));
}
use of bio.terra.model.IngestResponseModel in project jade-data-repo by DataBiosphere.
the class IngestTest method ingestBadBucketPatternTest.
@Test
public void ingestBadBucketPatternTest() throws Exception {
IngestRequestModel request = new IngestRequestModel().table("file").format(IngestRequestModel.FormatEnum.JSON).path("gs://bucket*pattern/some-file.json");
DataRepoResponse<JobModel> ingestJobResponse = dataRepoFixtures.ingestJsonDataLaunch(steward(), datasetId, request);
DataRepoResponse<IngestResponseModel> ingestResponse = dataRepoClient.waitForResponse(steward(), ingestJobResponse, IngestResponseModel.class);
assertThat("ingest failed", ingestResponse.getStatusCode(), equalTo(HttpStatus.BAD_REQUEST));
assertThat("failure is explained", ingestResponse.getErrorObject().orElseThrow(IllegalStateException::new).getMessage(), containsString("not supported"));
}
Aggregations