Search in sources :

Example 6 with Command

use of org.finra.herd.core.Command in project herd by FINRAOS.

the class BusinessObjectDataServiceCreateBusinessObjectDataTest method testCreateBusinessObjectDataAttributeValueTooLarge.

@Test(expected = PersistenceException.class)
public void testCreateBusinessObjectDataAttributeValueTooLarge() throws Exception {
    final BusinessObjectDataCreateRequest businessObjectDataCreateRequest = businessObjectDataServiceTestHelper.getNewBusinessObjectDataCreateRequest();
    // Create and add a duplicate attribute which is not allowed.
    Attribute newAttribute = new Attribute();
    newAttribute.setName("Valid Name");
    // Test value greater than 4000 byte limit.
    newAttribute.setValue(new String(new char[4001]).replace('\0', 'A'));
    businessObjectDataCreateRequest.getAttributes().add(newAttribute);
    executeWithoutLogging(SqlExceptionHelper.class, new Command() {

        @Override
        public void execute() {
            // Create the business object data which is invalid.
            businessObjectDataService.createBusinessObjectData(businessObjectDataCreateRequest);
        }
    });
}
Also used : Attribute(org.finra.herd.model.api.xml.Attribute) Command(org.finra.herd.core.Command) BusinessObjectDataCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataCreateRequest) Test(org.junit.Test)

Example 7 with Command

use of org.finra.herd.core.Command in project herd by FINRAOS.

the class DownloaderWebClientTest method testGetData.

@Test
public void testGetData() throws Exception {
    // Upload and register business object data parents.
    uploadAndRegisterTestDataParents(downloaderWebClient);
    // Upload and register the initial version if of the test business object data.
    uploadTestDataFilesToS3(S3_TEST_PATH_V0);
    final UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto();
    executeWithoutLogging(DataBridgeWebClient.class, new Command() {

        @Override
        public void execute() throws Exception {
            BusinessObjectData businessObjectData = downloaderWebClient.preRegisterBusinessObjectData(uploaderInputManifestDto, StorageEntity.MANAGED_STORAGE, false);
            BusinessObjectDataKey businessObjectDataKey = businessObjectDataHelper.getBusinessObjectDataKey(businessObjectData);
            downloaderWebClient.addStorageFiles(businessObjectDataKey, uploaderInputManifestDto, getTestS3FileTransferRequestParamsDto(S3_TEST_PATH_V0 + "/"), StorageEntity.MANAGED_STORAGE);
            downloaderWebClient.updateBusinessObjectDataStatus(businessObjectDataKey, BusinessObjectDataStatusEntity.VALID);
        }
    });
    // Get business object data information.
    DownloaderInputManifestDto downloaderInputManifestDto = getTestDownloaderInputManifestDto();
    BusinessObjectData resultBusinessObjectData = downloaderWebClient.getBusinessObjectData(downloaderInputManifestDto);
    // Validate the results.
    assertNotNull(resultBusinessObjectData);
}
Also used : UploaderInputManifestDto(org.finra.herd.model.dto.UploaderInputManifestDto) Command(org.finra.herd.core.Command) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) DownloaderInputManifestDto(org.finra.herd.model.dto.DownloaderInputManifestDto) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

Command (org.finra.herd.core.Command)7 Test (org.junit.Test)7 IOException (java.io.IOException)2 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)2 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)2 UploaderInputManifestDto (org.finra.herd.model.dto.UploaderInputManifestDto)2 PersistenceException (javax.persistence.PersistenceException)1 ProceedingJoinPoint (org.aspectj.lang.ProceedingJoinPoint)1 AbstractCoreTest (org.finra.herd.core.AbstractCoreTest)1 MockProceedingJoinPoint (org.finra.herd.core.MockProceedingJoinPoint)1 Attribute (org.finra.herd.model.api.xml.Attribute)1 BusinessObjectDataCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataCreateRequest)1 BusinessObjectFormatCreateRequest (org.finra.herd.model.api.xml.BusinessObjectFormatCreateRequest)1 S3KeyPrefixInformation (org.finra.herd.model.api.xml.S3KeyPrefixInformation)1 StorageKey (org.finra.herd.model.api.xml.StorageKey)1 DownloaderInputManifestDto (org.finra.herd.model.dto.DownloaderInputManifestDto)1 StorageUnitEntity (org.finra.herd.model.jpa.StorageUnitEntity)1 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)1 Ignore (org.junit.Ignore)1