Search in sources :

Example 1 with RegServerAccessParamsDto

use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.

the class DataBridgeWebClientTest method testGetRegServerAccessParamsDto.

@Test
public void testGetRegServerAccessParamsDto() {
    RegServerAccessParamsDto regServerAccessParamsDto = dataBridgeWebClient.getRegServerAccessParamsDto();
    assertEquals(RegServerAccessParamsDto.builder().withRegServerPort(8080).withUseSsl(false).build(), regServerAccessParamsDto);
}
Also used : RegServerAccessParamsDto(org.finra.herd.model.dto.RegServerAccessParamsDto) Test(org.junit.Test)

Example 2 with RegServerAccessParamsDto

use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.

the class UploaderApp method go.

/**
 * Parses the command line arguments and calls the controller to process the upload.
 *
 * @param args the command line arguments passed to the program.
 *
 * @return the return value of the application.
 * @throws Exception if there are problems performing the upload.
 */
@Override
public ReturnValue go(String[] args) throws Exception {
    // Create the Spring application context.
    ApplicationContext applicationContext = createApplicationContext();
    // Parse the command line arguments and return a return value if we shouldn't continue processing (e.g. we displayed usage information, etc.).
    ReturnValue returnValue = parseCommandLineArguments(args, applicationContext);
    if (returnValue != null) {
        return returnValue;
    }
    // Create an instance of S3 file transfer request parameters DTO.
    S3FileTransferRequestParamsDto params = S3FileTransferRequestParamsDto.builder().withLocalPath(argParser.getStringValue(localPathOpt)).withUseRrs(argParser.getBooleanValue(rrsOpt)).withAwsAccessKeyId(argParser.getStringValue(s3AccessKeyOpt)).withAwsSecretKey(argParser.getStringValue(s3SecretKeyOpt)).withS3Endpoint(argParser.getStringValue(s3EndpointOpt)).withMaxThreads(maxThreads).withHttpProxyHost(argParser.getStringValue(httpProxyHostOpt)).withHttpProxyPort(httpProxyPort).withSocketTimeout(argParser.getIntegerValue(socketTimeoutOpt)).build();
    // Call the controller with the user specified parameters to perform the upload.
    UploaderController controller = applicationContext.getBean(UploaderController.class);
    RegServerAccessParamsDto regServerAccessParamsDto = RegServerAccessParamsDto.builder().withRegServerHost(regServerHost).withRegServerPort(regServerPort).withUseSsl(useSsl).withUsername(argParser.getStringValue(usernameOpt)).withPassword(argParser.getStringValue(passwordOpt)).build();
    controller.performUpload(regServerAccessParamsDto, argParser.getFileValue(manifestPathOpt), params, argParser.getBooleanValue(createNewVersionOpt), argParser.getBooleanValue(forceOpt), maxRetryAttempts, retryDelaySecs);
    // No exceptions were returned so return success.
    return ReturnValue.SUCCESS;
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) S3FileTransferRequestParamsDto(org.finra.herd.model.dto.S3FileTransferRequestParamsDto) RegServerAccessParamsDto(org.finra.herd.model.dto.RegServerAccessParamsDto)

Example 3 with RegServerAccessParamsDto

use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.

the class DownloaderControllerTest method runDownload.

/**
 * Prepares test data and runs a normal download scenario.
 *
 * @param downloaderInputManifestDto the downloader input manifest object instance
 * @param localPath the local target directory
 * @param numOfThreads the maximum number of threads to use for file transfer to S3
 * @param hostname optional override of the default web service hostname.
 */
protected void runDownload(DownloaderInputManifestDto downloaderInputManifestDto, String localPath, Integer numOfThreads, String hostname) throws Exception {
    String hostnameToUse = hostname == null ? WEB_SERVICE_HOSTNAME : hostname;
    // Upload and register business object data parents.
    uploadAndRegisterTestDataParents(downloaderWebClient);
    // Upload and register the initial version if of the test business object data.
    uploadAndRegisterTestData(S3_TEST_PATH_V0);
    // Create a downloader input manifest file in LOCAL_TEMP_PATH_INPUT directory
    File downloaderInputManifestFile = createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), downloaderInputManifestDto);
    // Perform the download.
    S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = getTestS3FileTransferRequestParamsDto();
    s3FileTransferRequestParamsDto.setS3KeyPrefix(S3_TEST_PATH_V0);
    s3FileTransferRequestParamsDto.setLocalPath(localPath);
    s3FileTransferRequestParamsDto.setMaxThreads(numOfThreads);
    RegServerAccessParamsDto regServerAccessParamsDto = RegServerAccessParamsDto.builder().withRegServerHost(hostnameToUse).withRegServerPort(WEB_SERVICE_HTTPS_PORT).withUseSsl(true).withUsername(WEB_SERVICE_HTTPS_USERNAME).withPassword(WEB_SERVICE_HTTPS_PASSWORD).build();
    downloaderController.performDownload(regServerAccessParamsDto, downloaderInputManifestFile, s3FileTransferRequestParamsDto);
}
Also used : S3FileTransferRequestParamsDto(org.finra.herd.model.dto.S3FileTransferRequestParamsDto) RegServerAccessParamsDto(org.finra.herd.model.dto.RegServerAccessParamsDto) File(java.io.File)

Example 4 with RegServerAccessParamsDto

use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.

the class DownloaderControllerTest method testPerformDownloadZeroByteDirectoryMarkersPresent.

@Test
public void testPerformDownloadZeroByteDirectoryMarkersPresent() throws Exception {
    // Upload and register business object data parents.
    uploadAndRegisterTestDataParents(downloaderWebClient);
    // Upload and register the initial version if of the test business object data.
    uploadAndRegisterTestData(S3_TEST_PATH_V0, testManifestFiles, S3_DIRECTORY_MARKERS);
    // Create a downloader input manifest file in LOCAL_TEMP_PATH_INPUT directory
    File downloaderInputManifestFile = createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), getTestDownloaderInputManifestDto());
    // Adjust the S3 file transfer parameters to be passed to the downloader controller.
    S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = getTestS3FileTransferRequestParamsDto();
    s3FileTransferRequestParamsDto.setLocalPath(LOCAL_TEMP_PATH_OUTPUT.toString());
    s3FileTransferRequestParamsDto.setMaxThreads(DownloaderController.MIN_THREADS);
    // Perform the download.
    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();
    downloaderController.performDownload(regServerAccessParamsDto, downloaderInputManifestFile, s3FileTransferRequestParamsDto);
}
Also used : S3FileTransferRequestParamsDto(org.finra.herd.model.dto.S3FileTransferRequestParamsDto) RegServerAccessParamsDto(org.finra.herd.model.dto.RegServerAccessParamsDto) File(java.io.File) Test(org.junit.Test)

Example 5 with RegServerAccessParamsDto

use of org.finra.herd.model.dto.RegServerAccessParamsDto in project herd by FINRAOS.

the class AbstractDownloaderTest method setupEnv.

/**
 * Sets up the test environment.
 */
@Before
public void setupEnv() throws IOException {
    super.setupEnv();
    // Create and initialize a downloader web client instance.
    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();
    downloaderWebClient.setRegServerAccessParamsDto(regServerAccessParamsDto);
}
Also used : RegServerAccessParamsDto(org.finra.herd.model.dto.RegServerAccessParamsDto) Before(org.junit.Before)

Aggregations

RegServerAccessParamsDto (org.finra.herd.model.dto.RegServerAccessParamsDto)24 Test (org.junit.Test)13 File (java.io.File)12 S3FileTransferRequestParamsDto (org.finra.herd.model.dto.S3FileTransferRequestParamsDto)9 Before (org.junit.Before)5 ManifestFile (org.finra.herd.model.dto.ManifestFile)4 ApplicationContext (org.springframework.context.ApplicationContext)4 Path (java.nio.file.Path)3 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)3 S3KeyPrefixInformation (org.finra.herd.model.api.xml.S3KeyPrefixInformation)3 Storage (org.finra.herd.model.api.xml.Storage)3 StorageUnit (org.finra.herd.model.api.xml.StorageUnit)3 DownloaderInputManifestDto (org.finra.herd.model.dto.DownloaderInputManifestDto)3 S3FileTransferResultsDto (org.finra.herd.model.dto.S3FileTransferResultsDto)3 UploaderInputManifestDto (org.finra.herd.model.dto.UploaderInputManifestDto)3 S3Service (org.finra.herd.service.S3Service)3 BusinessObjectDataHelper (org.finra.herd.service.helper.BusinessObjectDataHelper)3 StorageFileHelper (org.finra.herd.service.helper.StorageFileHelper)3 StorageHelper (org.finra.herd.service.helper.StorageHelper)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3