Search in sources :

Example 6 with BusinessObjectDataStorageUnitCreateRequest

use of org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateRequest in project herd by FINRAOS.

the class BusinessObjectDataStorageUnitRestControllerTest method testCreateBusinessObjectDataStorageUnit.

@Test
public void testCreateBusinessObjectDataStorageUnit() {
    // Create a business object data storage unit key.
    BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME);
    // Create a storage unit directory.
    StorageDirectory storageDirectory = new StorageDirectory(STORAGE_DIRECTORY_PATH);
    // Create a list of storage files.
    List<StorageFile> storageFiles = Collections.singletonList(new StorageFile(FILE_NAME, FILE_SIZE, ROW_COUNT));
    // Create a business object data storage unit request.
    BusinessObjectDataStorageUnitCreateRequest request = new BusinessObjectDataStorageUnitCreateRequest(businessObjectDataStorageUnitKey, storageDirectory, storageFiles, DISCOVER_STORAGE_FILES);
    // Create a business object data storage unit response.
    BusinessObjectDataStorageUnitCreateResponse response = new BusinessObjectDataStorageUnitCreateResponse(businessObjectDataStorageUnitKey, storageDirectory, storageFiles);
    // Mock the external calls.
    when(businessObjectDataStorageUnitService.createBusinessObjectDataStorageUnit(request)).thenReturn(response);
    // Call the method under test.
    BusinessObjectDataStorageUnitCreateResponse result = businessObjectDataStorageUnitRestController.createBusinessObjectDataStorageUnit(request);
    // Verify the external calls.
    verify(businessObjectDataStorageUnitService).createBusinessObjectDataStorageUnit(request);
    verifyNoMoreInteractions(businessObjectDataStorageUnitService);
    // Validate the results.
    assertEquals(response, result);
}
Also used : BusinessObjectDataStorageUnitKey(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey) BusinessObjectDataStorageUnitCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateRequest) BusinessObjectDataStorageUnitCreateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateResponse) StorageFile(org.finra.herd.model.api.xml.StorageFile) StorageDirectory(org.finra.herd.model.api.xml.StorageDirectory) Test(org.junit.Test)

Example 7 with BusinessObjectDataStorageUnitCreateRequest

use of org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateRequest in project herd by FINRAOS.

the class BusinessObjectDataServiceTestHelper method getBusinessObjectDataStorageUnitCreateRequest.

public BusinessObjectDataStorageUnitCreateRequest getBusinessObjectDataStorageUnitCreateRequest() {
    // Create business object data and storage entities.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(false);
    BusinessObjectDataStatusEntity businessObjectDataStatusEntity = businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(AbstractServiceTest.BDATA_STATUS, AbstractServiceTest.DESCRIPTION, AbstractServiceTest.BDATA_STATUS_PRE_REGISTRATION_FLAG_SET);
    BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectFormatEntity, AbstractServiceTest.PARTITION_VALUE, AbstractServiceTest.DATA_VERSION, AbstractServiceTest.LATEST_VERSION_FLAG_SET, businessObjectDataStatusEntity.getCode());
    StorageEntity storageEntity = storageDaoTestHelper.createStorageEntity();
    // Create a business object data storage unit key.
    BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(businessObjectFormatEntity.getBusinessObjectDefinition().getNamespace().getCode(), businessObjectFormatEntity.getBusinessObjectDefinition().getName(), businessObjectFormatEntity.getUsage(), businessObjectFormatEntity.getFileType().getCode(), businessObjectFormatEntity.getBusinessObjectFormatVersion(), businessObjectDataEntity.getPartitionValue(), AbstractServiceTest.NO_SUBPARTITION_VALUES, businessObjectDataEntity.getVersion(), storageEntity.getName());
    // Create and return a business object data storage unit create request.
    return new BusinessObjectDataStorageUnitCreateRequest(businessObjectDataStorageUnitKey, AbstractServiceTest.NO_STORAGE_DIRECTORY, getStorageFiles(), AbstractServiceTest.NO_DISCOVER_STORAGE_FILES);
}
Also used : BusinessObjectDataStorageUnitKey(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey) BusinessObjectDataStatusEntity(org.finra.herd.model.jpa.BusinessObjectDataStatusEntity) BusinessObjectDataStorageUnitCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateRequest) StorageEntity(org.finra.herd.model.jpa.StorageEntity) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity)

Example 8 with BusinessObjectDataStorageUnitCreateRequest

use of org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateRequest in project herd by FINRAOS.

the class AddBusinessObjectDataStorageUnitTest method testAddBusinessObjectDataStorageUnitUsingXmlRequest.

@Test
public void testAddBusinessObjectDataStorageUnitUsingXmlRequest() throws Exception {
    BusinessObjectDataStorageUnitCreateRequest businessObjectDataStorageUnitCreateRequest = businessObjectDataServiceTestHelper.getBusinessObjectDataStorageUnitCreateRequest();
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataStorageUnitCreateRequest", "${businessObjectDataStorageUnitCreateRequest}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("contentType", "xml"));
    parameters.add(buildParameter("businessObjectDataStorageUnitCreateRequest", xmlHelper.objectToXml(businessObjectDataStorageUnitCreateRequest)));
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_NOT_NULL);
    testActivitiServiceTaskSuccess(AddBusinessObjectDataStorageUnit.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : HashMap(java.util.HashMap) FieldExtension(org.activiti.bpmn.model.FieldExtension) BusinessObjectDataStorageUnitCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateRequest) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Aggregations

BusinessObjectDataStorageUnitCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateRequest)8 Test (org.junit.Test)6 BusinessObjectDataStorageUnitKey (org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey)5 StorageDirectory (org.finra.herd.model.api.xml.StorageDirectory)4 BusinessObjectDataStorageUnitCreateResponse (org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateResponse)3 StorageFile (org.finra.herd.model.api.xml.StorageFile)3 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 FieldExtension (org.activiti.bpmn.model.FieldExtension)2 Parameter (org.finra.herd.model.api.xml.Parameter)2 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)2 StorageEntity (org.finra.herd.model.jpa.StorageEntity)2 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)1 BusinessObjectDataStatusEntity (org.finra.herd.model.jpa.BusinessObjectDataStatusEntity)1 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)1 StorageFileEntity (org.finra.herd.model.jpa.StorageFileEntity)1 StorageUnitEntity (org.finra.herd.model.jpa.StorageUnitEntity)1