/** @return A single GetDatasetWriteTicketsInputData for uploading ReadMe.txt. */ private GetDatasetWriteTicketsInputData getSingleGetDatasetWriteTicketsInputData(DataManagementService dmService) { // Create a Dataset DatasetProperties2 props = new DatasetProperties2(); props.ClientId = "datasetWriteTixTestClientId"; props.Type = "Text"; props.Name = "Sample-FMS-Upload"; props.Description = "Testing put File"; DatasetProperties2[] currProps = { props }; CreateDatasetsResponse resp = dmService.CreateDatasets2(currProps); // Assume this file is in current dir FileInfo file1 = new FileInfo("ReadMe.txt"); // Create a file to associate with dataset DatasetFileInfo fileInfo = new DatasetFileInfo(); fileInfo.ClientId = "file_1"; fileInfo.FileName = file1.FullName; fileInfo.NamedReferencedName = "Text"; fileInfo.IsText = true; fileInfo.AllowReplace = false; DatasetFileInfo[] fileInfos = { fileInfo }; GetDatasetWriteTicketsInputData inputData = new GetDatasetWriteTicketsInputData(); inputData.Dataset = resp.Output[0].Dataset; inputData.CreateNewVersion = false; inputData.DatasetFileInfos = fileInfos; return(inputData); }
/** * @return An array of NUMBER_OF_DATASETS GetDatasetWriteTicketsInputData objects * for uploading NUMBER_OF_FILES_PER_DATASET copies of ReadMe.txt to each Dataset. */ private GetDatasetWriteTicketsInputData[] getMultipleGetDatasetWriteTicketsInputData(DataManagementService dmService) { GetDatasetWriteTicketsInputData[] inputs = new GetDatasetWriteTicketsInputData[NUMBER_OF_DATASETS]; DatasetProperties2[] currProps = new DatasetProperties2[inputs.Length]; // Create a bunch of Datasets for (int i = 0; i < inputs.Length; ++i) { DatasetProperties2 props = new DatasetProperties2(); props.ClientId = "datasetWriteTixTestClientId " + i; props.Type = "Text"; props.Name = "Sample-FMS-Upload-" + i; props.Description = "Testing Multiple put File"; currProps[i] = props; } CreateDatasetsResponse resp = dmService.CreateDatasets2(currProps); // Create files to associate with each Dataset for (int i = 0; i < inputs.Length; ++i) { DatasetFileInfo[] fileInfos = new DatasetFileInfo[NUMBER_OF_FILES_PER_DATASET]; for (int j = 0; j < fileInfos.Length; ++j) { DatasetFileInfo fileInfo = new DatasetFileInfo(); // Create different filenames to be uploaded into the same dataset // Create or use this file in current dir FileInfo file1 = new FileInfo("ReadMeCopy" + j + ".txt"); assureFileCreated(file1); fileInfo.ClientId = "Dataset " + i + " File " + j; fileInfo.FileName = file1.FullName; fileInfo.NamedReferencedName = "Text"; fileInfo.IsText = true; fileInfo.AllowReplace = false; fileInfos[j] = fileInfo; } GetDatasetWriteTicketsInputData inputData = new GetDatasetWriteTicketsInputData(); inputData.Dataset = resp.Output[i].Dataset; inputData.CreateNewVersion = false; inputData.DatasetFileInfos = fileInfos; inputs[i] = inputData; } return(inputs); }