Search in sources :

Example 16 with UploaderInputManifestDto

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

the class DataBridgeWebClientTest method testPreRegisterBusinessObjectData.

/**
 * Calls preRegisterBusinessObjectData() method and makes assertions.
 *
 * @param attributes a map of business object data attributes
 * @param useSsl specifies whether to use SSL or not
 *
 * @throws IOException
 * @throws JAXBException
 * @throws URISyntaxException
 */
private void testPreRegisterBusinessObjectData(HashMap<String, String> attributes, boolean useSsl) throws IOException, JAXBException, URISyntaxException {
    dataBridgeWebClient.regServerAccessParamsDto.setUseSsl(useSsl);
    UploaderInputManifestDto manifest = getUploaderInputManifestDto();
    manifest.setAttributes(attributes);
    String storageName = "testStorage";
    Boolean createNewVersion = false;
    BusinessObjectData businessObjectData = dataBridgeWebClient.preRegisterBusinessObjectData(manifest, storageName, createNewVersion);
    assertNotNull("businessObjectData", businessObjectData);
}
Also used : UploaderInputManifestDto(org.finra.herd.model.dto.UploaderInputManifestDto) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData)

Example 17 with UploaderInputManifestDto

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

the class DataBridgeWebClientTest method testAddStorageFiles.

/**
 * Calls addStorageFiles() method and makes assertions.
 *
 * @param useSsl specifies whether to use SSL or not
 *
 * @throws IOException
 * @throws JAXBException
 * @throws URISyntaxException
 */
private void testAddStorageFiles(boolean useSsl) throws IOException, JAXBException, URISyntaxException {
    dataBridgeWebClient.regServerAccessParamsDto.setUseSsl(useSsl);
    BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey();
    UploaderInputManifestDto manifest = getUploaderInputManifestDto();
    S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = new S3FileTransferRequestParamsDto();
    String storageName = "testStorage";
    BusinessObjectDataStorageFilesCreateResponse businessObjectDataStorageFilesCreateResponse = dataBridgeWebClient.addStorageFiles(businessObjectDataKey, manifest, s3FileTransferRequestParamsDto, storageName);
    assertNotNull("businessObjectDataStorageFilesCreateResponse", businessObjectDataStorageFilesCreateResponse);
}
Also used : BusinessObjectDataStorageFilesCreateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateResponse) S3FileTransferRequestParamsDto(org.finra.herd.model.dto.S3FileTransferRequestParamsDto) UploaderInputManifestDto(org.finra.herd.model.dto.UploaderInputManifestDto) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey)

Example 18 with UploaderInputManifestDto

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

the class DataBridgeWebClientTest method getUploaderInputManifestDto.

/**
 * Creates a UploaderInputManifestDto.
 *
 * @return the created UploaderInputManifestDto instance
 */
private UploaderInputManifestDto getUploaderInputManifestDto() {
    UploaderInputManifestDto manifest = new UploaderInputManifestDto();
    manifest.setNamespace("testNamespace");
    manifest.setBusinessObjectDefinitionName("testBusinessObjectDefinitionName");
    manifest.setBusinessObjectFormatUsage("testBusinessObjectFormatUsage");
    manifest.setBusinessObjectFormatFileType("testBusinessObjectFormatFileType");
    manifest.setBusinessObjectFormatVersion("0");
    manifest.setPartitionKey("testPartitionKey");
    manifest.setPartitionValue("testPartitionValue");
    manifest.setSubPartitionValues(Arrays.asList("testSubPartitionValue1", "testSubPartitionValue2"));
    List<ManifestFile> manifestFiles = new ArrayList<>();
    {
        ManifestFile manifestFile = new ManifestFile();
        manifestFile.setFileName("testFileName");
        manifestFile.setFileSizeBytes(1l);
        manifestFile.setRowCount(2l);
        manifestFiles.add(manifestFile);
    }
    manifest.setManifestFiles(manifestFiles);
    HashMap<String, String> attributes = new HashMap<>();
    {
        attributes.put("testName", "testValue");
    }
    manifest.setAttributes(attributes);
    return manifest;
}
Also used : UploaderInputManifestDto(org.finra.herd.model.dto.UploaderInputManifestDto) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ManifestFile(org.finra.herd.model.dto.ManifestFile)

Example 19 with UploaderInputManifestDto

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

the class UploaderManifestReaderTest method testReadJsonManifestEmptyParentsList.

@Test
public void testReadJsonManifestEmptyParentsList() throws IOException {
    // Create and read the uploaderInputManifestDto file with an empty list of parents.
    UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto();
    uploaderInputManifestDto.setBusinessObjectDataParents(new ArrayList<BusinessObjectDataKey>());
    UploaderInputManifestDto resultManifest = uploaderManifestReader.readJsonManifest(createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), uploaderInputManifestDto));
    // Validate the results.
    assertUploaderManifest(uploaderInputManifestDto, resultManifest);
}
Also used : UploaderInputManifestDto(org.finra.herd.model.dto.UploaderInputManifestDto) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) Test(org.junit.Test)

Example 20 with UploaderInputManifestDto

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

the class UploaderManifestReaderTest method testReadJsonManifestMaxAttributeValueLength.

@Test
public void testReadJsonManifestMaxAttributeValueLength() throws IOException {
    UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto();
    HashMap<String, String> attributes = new HashMap<>();
    uploaderInputManifestDto.setAttributes(attributes);
    String attributeKey = ATTRIBUTE_NAME_1_MIXED_CASE;
    // Returns "*...*value"
    String attributeValue = StringUtils.leftPad("value", UploaderManifestReader.MAX_ATTRIBUTE_VALUE_LENGTH, '*');
    assertTrue(attributeValue.length() == UploaderManifestReader.MAX_ATTRIBUTE_VALUE_LENGTH);
    attributes.put(attributeKey, attributeValue);
    UploaderInputManifestDto resultManifest = uploaderManifestReader.readJsonManifest(createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), uploaderInputManifestDto));
    // Validate the results.
    assertUploaderManifest(uploaderInputManifestDto, resultManifest);
}
Also used : UploaderInputManifestDto(org.finra.herd.model.dto.UploaderInputManifestDto) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

UploaderInputManifestDto (org.finra.herd.model.dto.UploaderInputManifestDto)28 Test (org.junit.Test)20 HashMap (java.util.HashMap)9 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)9 ManifestFile (org.finra.herd.model.dto.ManifestFile)7 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)6 S3FileTransferRequestParamsDto (org.finra.herd.model.dto.S3FileTransferRequestParamsDto)5 File (java.io.File)4 IOException (java.io.IOException)3 RegServerAccessParamsDto (org.finra.herd.model.dto.RegServerAccessParamsDto)3 ArrayList (java.util.ArrayList)2 Command (org.finra.herd.core.Command)2 BusinessObjectDataStorageFilesCreateResponse (org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateResponse)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 URISyntaxException (java.net.URISyntaxException)1 JAXBException (javax.xml.bind.JAXBException)1 Attribute (org.finra.herd.model.api.xml.Attribute)1 AwsCredential (org.finra.herd.model.api.xml.AwsCredential)1 S3KeyPrefixInformation (org.finra.herd.model.api.xml.S3KeyPrefixInformation)1 Storage (org.finra.herd.model.api.xml.Storage)1