use of bio.terra.datarepo.api.RepositoryApi in project jade-data-repo by DataBiosphere.
the class IngestFile method cleanup.
public void cleanup(Map<String, ApiClient> apiClients) throws Exception {
// get the ApiClient for the dataset creator
ApiClient datasetCreatorClient = apiClients.get(datasetCreator);
ResourcesApi resourcesApi = new ResourcesApi(datasetCreatorClient);
RepositoryApi repositoryApi = new RepositoryApi(datasetCreatorClient);
// make the delete request and wait for the job to finish
JobModel deleteDatasetJobResponse = repositoryApi.deleteDataset(datasetSummaryModel.getId());
deleteDatasetJobResponse = DataRepoUtils.waitForJobToFinish(repositoryApi, deleteDatasetJobResponse);
DataRepoUtils.expectJobSuccess(repositoryApi, deleteDatasetJobResponse, DeleteResponseModel.class);
System.out.println("successfully deleted dataset: " + datasetSummaryModel.getName());
// delete the profile
resourcesApi.deleteProfile(billingProfileModel.getId());
System.out.println("successfully deleted profile: " + billingProfileModel.getProfileName());
}
use of bio.terra.datarepo.api.RepositoryApi in project jade-data-repo by DataBiosphere.
the class IngestFile method userJourney.
public void userJourney(ApiClient apiClient) throws Exception {
RepositoryApi repositoryApi = new RepositoryApi(apiClient);
String targetPath = "/testrunner/IngestFile/" + FileUtils.randomizeName("") + ".txt";
FileLoadModel fileLoadModel = new FileLoadModel().sourcePath(sourceFileURI.toString()).description("IngestFile").mimeType("text/plain").targetPath(targetPath).profileId(datasetSummaryModel.getDefaultProfileId());
JobModel ingestFileJobResponse = repositoryApi.ingestFile(datasetSummaryModel.getId(), fileLoadModel);
ingestFileJobResponse = DataRepoUtils.waitForJobToFinish(repositoryApi, ingestFileJobResponse);
FileModel fileModel = DataRepoUtils.expectJobSuccess(repositoryApi, ingestFileJobResponse, FileModel.class);
System.out.println("successfully ingested file: " + fileModel.getPath() + ", id: " + fileModel.getFileId() + ", size: " + fileModel.getSize());
}
use of bio.terra.datarepo.api.RepositoryApi in project jade-data-repo by DataBiosphere.
the class IngestFile method setup.
public void setup(Map<String, ApiClient> apiClients) throws Exception {
// pick the first user to be the dataset creator
List<String> apiClientList = new ArrayList<>(apiClients.keySet());
datasetCreator = apiClientList.get(0);
// get the ApiClient for the dataset creator
ApiClient datasetCreatorClient = apiClients.get(datasetCreator);
ResourcesApi resourcesApi = new ResourcesApi(datasetCreatorClient);
RepositoryApi repositoryApi = new RepositoryApi(datasetCreatorClient);
// create a new profile
billingProfileModel = DataRepoUtils.createProfile(resourcesApi, billingAccount, "profile-simple", true);
System.out.println("successfully created profile: " + billingProfileModel.getProfileName());
// make the create dataset request and wait for the job to finish
JobModel createDatasetJobResponse = DataRepoUtils.createDataset(repositoryApi, billingProfileModel.getId(), "dataset-simple.json", true);
// save a reference to the dataset summary model so we can delete it in cleanup()
datasetSummaryModel = DataRepoUtils.expectJobSuccess(repositoryApi, createDatasetJobResponse, DatasetSummaryModel.class);
System.out.println("successfully created dataset: " + datasetSummaryModel.getName());
}
use of bio.terra.datarepo.api.RepositoryApi in project jade-data-repo by DataBiosphere.
the class RetrieveDataset method cleanup.
public void cleanup(Map<String, ApiClient> apiClients) throws Exception {
// get the ApiClient for the dataset creator
ApiClient datasetCreatorClient = apiClients.get(datasetCreator);
ResourcesApi resourcesApi = new ResourcesApi(datasetCreatorClient);
RepositoryApi repositoryApi = new RepositoryApi(datasetCreatorClient);
// make the delete dataset request and wait for the job to finish
JobModel deleteDatasetJobResponse = repositoryApi.deleteDataset(datasetSummaryModel.getId());
deleteDatasetJobResponse = DataRepoUtils.waitForJobToFinish(repositoryApi, deleteDatasetJobResponse);
DataRepoUtils.expectJobSuccess(repositoryApi, deleteDatasetJobResponse, DeleteResponseModel.class);
System.out.println("successfully deleted dataset: " + datasetSummaryModel.getName());
// delete the profile
resourcesApi.deleteProfile(billingProfileModel.getId());
System.out.println("successfully deleted profile: " + billingProfileModel.getProfileName());
}
use of bio.terra.datarepo.api.RepositoryApi in project jade-data-repo by DataBiosphere.
the class RetrieveDataset method setup.
public void setup(Map<String, ApiClient> apiClients) throws Exception {
// pick the first user to be the dataset creator
List<String> apiClientList = new ArrayList<>(apiClients.keySet());
datasetCreator = apiClientList.get(0);
// get the ApiClient for the dataset creator
ApiClient datasetCreatorClient = apiClients.get(datasetCreator);
ResourcesApi resourcesApi = new ResourcesApi(datasetCreatorClient);
RepositoryApi repositoryApi = new RepositoryApi(datasetCreatorClient);
// create a new profile
billingProfileModel = DataRepoUtils.createProfile(resourcesApi, billingAccount, "profile-simple", true);
System.out.println("successfully created profile: " + billingProfileModel.getProfileName());
// make the create dataset request and wait for the job to finish
JobModel createDatasetJobResponse = DataRepoUtils.createDataset(repositoryApi, billingProfileModel.getId(), "dataset-simple.json", true);
// save a reference to the dataset summary model so we can delete it in cleanup()
datasetSummaryModel = DataRepoUtils.expectJobSuccess(repositoryApi, createDatasetJobResponse, DatasetSummaryModel.class);
System.out.println("successfully created dataset: " + datasetSummaryModel.getName());
}
Aggregations