use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.
the class UploaderControllerTest method testPerformUploadManifestContainsDuplicateFileNames.
@Test(expected = IllegalArgumentException.class)
public void testPerformUploadManifestContainsDuplicateFileNames() throws Exception {
List<ManifestFile> duplicateTestDataFiles = new ArrayList<>();
duplicateTestDataFiles.addAll(testManifestFiles);
duplicateTestDataFiles.add(testManifestFiles.get(0));
// Create local data files in LOCAL_TEMP_PATH_INPUT directory
for (ManifestFile manifestFile : testManifestFiles) {
createLocalFile(LOCAL_TEMP_PATH_INPUT.toString(), manifestFile.getFileName(), FILE_SIZE_1_KB);
}
// Create uploader input manifest file in LOCAL_TEMP_PATH_INPUT directory
UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto();
uploaderInputManifestDto.setManifestFiles(duplicateTestDataFiles);
File manifestFile = createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), uploaderInputManifestDto);
Assert.assertTrue(manifestFile.isFile());
// Try to upload business object data having duplicate file names.
RegServerAccessParamsDto regServerAccessParamsDto = RegServerAccessParamsDto.builder().withRegServerHost(WEB_SERVICE_HOSTNAME).withRegServerPort(WEB_SERVICE_HTTPS_PORT).withUseSsl(true).withUsername(WEB_SERVICE_HTTPS_USERNAME).withPassword(WEB_SERVICE_HTTPS_PASSWORD).build();
uploaderController.performUpload(regServerAccessParamsDto, manifestFile, getTestS3FileTransferRequestParamsDto(), false, false, TEST_RETRY_ATTEMPTS, TEST_RETRY_DELAY_SECS);
}
use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.
the class UploaderControllerTest method testPerformUploadManifestFileNameDoesNotMatchActualFileName.
@Test(expected = IllegalArgumentException.class)
public void testPerformUploadManifestFileNameDoesNotMatchActualFileName() throws Exception {
List<ManifestFile> declaredManifestFiles = getManifestFilesFromFileNames(Arrays.asList("test-data-1.txt", "test-data-2.txt"), FILE_SIZE_1_KB);
List<ManifestFile> actualManifestFiles = getManifestFilesFromFileNames(Arrays.asList("test-data-1.txt", "TEST-DATA-2.TXT"), FILE_SIZE_1_KB);
// Create local data files in LOCAL_TEMP_PATH_INPUT directory
for (ManifestFile manifestFile : actualManifestFiles) {
createLocalFile(LOCAL_TEMP_PATH_INPUT.toString(), manifestFile.getFileName(), FILE_SIZE_1_KB);
}
// Create uploader input manifest file in LOCAL_TEMP_PATH_INPUT directory.
UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto();
uploaderInputManifestDto.setManifestFiles(declaredManifestFiles);
File manifestFile = createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), uploaderInputManifestDto);
Assert.assertTrue(manifestFile.isFile());
// Try to upload business object data with one of the file having name that does not match to incorrect name specified.
RegServerAccessParamsDto regServerAccessParamsDto = RegServerAccessParamsDto.builder().withRegServerHost(WEB_SERVICE_HOSTNAME).withRegServerPort(WEB_SERVICE_HTTPS_PORT).withUseSsl(true).withUsername(WEB_SERVICE_HTTPS_USERNAME).withPassword(WEB_SERVICE_HTTPS_PASSWORD).build();
uploaderController.performUpload(regServerAccessParamsDto, manifestFile, getTestS3FileTransferRequestParamsDto(), false, false, TEST_RETRY_ATTEMPTS, TEST_RETRY_DELAY_SECS);
}
use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.
the class UploaderWebClientTest method testWebClientRegServerAccessParamsDtoSetterAndGetter.
@Test
public void testWebClientRegServerAccessParamsDtoSetterAndGetter() {
// Create and initialize an instance of RegServerAccessParamsDto.
RegServerAccessParamsDto regServerAccessParamsDto = new RegServerAccessParamsDto();
regServerAccessParamsDto.setRegServerHost(WEB_SERVICE_HOSTNAME);
regServerAccessParamsDto.setRegServerPort(WEB_SERVICE_HTTPS_PORT);
regServerAccessParamsDto.setUseSsl(true);
regServerAccessParamsDto.setUsername(WEB_SERVICE_HTTPS_USERNAME);
regServerAccessParamsDto.setPassword(WEB_SERVICE_HTTPS_PASSWORD);
// Set the DTO.
uploaderWebClient.setRegServerAccessParamsDto(regServerAccessParamsDto);
// Retrieve the DTO and validate the results.
RegServerAccessParamsDto resultRegServerAccessParamsDto = uploaderWebClient.getRegServerAccessParamsDto();
// validate the results.
assertEquals(WEB_SERVICE_HOSTNAME, resultRegServerAccessParamsDto.getRegServerHost());
assertEquals(WEB_SERVICE_HTTPS_PORT, resultRegServerAccessParamsDto.getRegServerPort());
assertTrue(resultRegServerAccessParamsDto.isUseSsl());
assertEquals(WEB_SERVICE_HTTPS_USERNAME, resultRegServerAccessParamsDto.getUsername());
assertEquals(WEB_SERVICE_HTTPS_PASSWORD, resultRegServerAccessParamsDto.getPassword());
}
use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.
the class RetentionExpirationExporterControllerTest method testPerformDownloadOutputFileAlreadyExist.
@Test
public void testPerformDownloadOutputFileAlreadyExist() throws Exception {
File outputFile = new File(LOCAL_OUTPUT_FILE);
// Create an output file to test file already exists.
assertTrue(outputFile.createNewFile());
// Try to perform the retention expiration export.
try {
retentionExpirationExporterController.performRetentionExpirationExport(NAMESPACE, BUSINESS_OBJECT_DEFINITION_NAME, outputFile, new RegServerAccessParamsDto(), UDC_SERVICE_HOSTNAME);
fail();
} catch (IllegalArgumentException e) {
assertEquals(String.format("The specified local output file \"%s\" already exists.", outputFile.toString()), e.getMessage());
}
}
use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.
the class DataBridgeWebClientTest method before.
@Before
public void before() {
dataBridgeWebClient = new DataBridgeWebClient() {
};
RegServerAccessParamsDto regServerAccessParamsDto = new RegServerAccessParamsDto();
regServerAccessParamsDto.setUseSsl(false);
regServerAccessParamsDto.setRegServerPort(8080);
dataBridgeWebClient.setRegServerAccessParamsDto(regServerAccessParamsDto);
dataBridgeWebClient.httpClientOperations = httpClientOperations;
dataBridgeWebClient.herdStringHelper = herdStringHelper;
}
Aggregations