Search in sources :

Example 1 with BusinessObjectDataAvailabilityCollectionRequest

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityCollectionTest method testCheckBusinessObjectDataAvailabilityCollectionMissingRequiredParameters.

@Test
public void testCheckBusinessObjectDataAvailabilityCollectionMissingRequiredParameters() {
    BusinessObjectDataAvailabilityCollectionRequest request;
    // Try to check business object data availability collection when business object data availability collection request is null.
    try {
        businessObjectDataService.checkBusinessObjectDataAvailabilityCollection(null);
        fail("Should throw an IllegalArgumentException when business object data availability collection request is null.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object data availability collection request must be specified.", e.getMessage());
    }
    // Try to check business object data availability collection when business object data availability request is not specified.
    request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityCollectionRequest();
    for (List<BusinessObjectDataAvailabilityRequest> businessObjectDataAvailabilityRequests : Arrays.asList(null, new ArrayList<BusinessObjectDataAvailabilityRequest>())) {
        request.setBusinessObjectDataAvailabilityRequests(businessObjectDataAvailabilityRequests);
        try {
            businessObjectDataService.checkBusinessObjectDataAvailabilityCollection(request);
            fail("Should throw an IllegalArgumentException when business object data availability request is not specified.");
        } catch (IllegalArgumentException e) {
            assertEquals("At least one business object data availability request must be specified.", e.getMessage());
        }
    }
    // Try to check business object data availability collection when business object data availability request is null.
    request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityCollectionRequest();
    request.getBusinessObjectDataAvailabilityRequests().set(0, null);
    try {
        businessObjectDataService.checkBusinessObjectDataAvailabilityCollection(request);
        fail("Should throw an IllegalArgumentException when business object data availability request is null.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object data availability request must be specified.", e.getMessage());
    }
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) Test(org.junit.Test)

Example 2 with BusinessObjectDataAvailabilityCollectionRequest

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

the class CheckBusinessObjectDataAvailabilityCollection method executeImpl.

@Override
public void executeImpl(DelegateExecution execution) throws Exception {
    String contentTypeString = activitiHelper.getRequiredExpressionVariableAsString(contentType, execution, "ContentType").trim();
    String requestString = activitiHelper.getRequiredExpressionVariableAsString(businessObjectDataAvailabilityCollectionRequest, execution, "BusinessObjectDataAvailabilityCollectionRequest").trim();
    BusinessObjectDataAvailabilityCollectionRequest request = getRequestObject(contentTypeString, requestString, BusinessObjectDataAvailabilityCollectionRequest.class);
    // Call the business object data availability service.
    BusinessObjectDataAvailabilityCollectionResponse businessObjectDataAvailabilityCollectionResponse = businessObjectDataService.checkBusinessObjectDataAvailabilityCollection(request);
    // Set the JSON response as a workflow variable.
    setJsonResponseAsWorkflowVariable(businessObjectDataAvailabilityCollectionResponse, execution);
    // Set workflow variables for whether all the data is available or not available for easy access.
    setTaskWorkflowVariable(execution, VARIABLE_IS_ALL_DATA_AVAILABLE, businessObjectDataAvailabilityCollectionResponse.isIsAllDataAvailable());
    setTaskWorkflowVariable(execution, VARIABLE_IS_ALL_DATA_NOT_AVAILABLE, businessObjectDataAvailabilityCollectionResponse.isIsAllDataNotAvailable());
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) BusinessObjectDataAvailabilityCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)

Example 3 with BusinessObjectDataAvailabilityCollectionRequest

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

the class BusinessObjectDataRestControllerTest method testCheckBusinessObjectDataAvailabilityCollection.

@Test
public void testCheckBusinessObjectDataAvailabilityCollection() {
    // Create a business object data availability collection request.
    BusinessObjectDataAvailabilityCollectionRequest businessObjectDataAvailabilityCollectionRequest = new BusinessObjectDataAvailabilityCollectionRequest();
    // Create a business object data availability collection response.
    BusinessObjectDataAvailabilityCollectionResponse businessObjectDataAvailabilityCollectionResponse = new BusinessObjectDataAvailabilityCollectionResponse();
    // Mock the external calls.
    when(businessObjectDataService.checkBusinessObjectDataAvailabilityCollection(businessObjectDataAvailabilityCollectionRequest)).thenReturn(businessObjectDataAvailabilityCollectionResponse);
    // Call the method under test.
    BusinessObjectDataAvailabilityCollectionResponse result = businessObjectDataRestController.checkBusinessObjectDataAvailabilityCollection(businessObjectDataAvailabilityCollectionRequest);
    // Verify the external calls.
    verify(businessObjectDataService).checkBusinessObjectDataAvailabilityCollection(businessObjectDataAvailabilityCollectionRequest);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAvailabilityCollectionResponse, result);
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) BusinessObjectDataAvailabilityCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse) Test(org.junit.Test)

Example 4 with BusinessObjectDataAvailabilityCollectionRequest

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

the class BusinessObjectDataServiceTestHelper method getTestBusinessObjectDataAvailabilityCollectionRequest.

/**
 * Creates a check business object data availability collection request using hard coded test values.
 *
 * @return the business object data availability collection request
 */
public BusinessObjectDataAvailabilityCollectionRequest getTestBusinessObjectDataAvailabilityCollectionRequest() {
    // Create a check business object data availability collection request.
    BusinessObjectDataAvailabilityCollectionRequest businessObjectDataAvailabilityCollectionRequest = new BusinessObjectDataAvailabilityCollectionRequest();
    // Create a list of check business object data availability requests.
    List<BusinessObjectDataAvailabilityRequest> businessObjectDataAvailabilityRequests = new ArrayList<>();
    businessObjectDataAvailabilityCollectionRequest.setBusinessObjectDataAvailabilityRequests(businessObjectDataAvailabilityRequests);
    // Create a business object data availability request.
    BusinessObjectDataAvailabilityRequest businessObjectDataAvailabilityRequest = new BusinessObjectDataAvailabilityRequest(AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME, AbstractServiceTest.FORMAT_USAGE_CODE, AbstractServiceTest.FORMAT_FILE_TYPE_CODE, AbstractServiceTest.FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(AbstractServiceTest.PARTITION_KEY, Arrays.asList(AbstractServiceTest.PARTITION_VALUE), AbstractServiceTest.NO_PARTITION_VALUE_RANGE, AbstractServiceTest.NO_LATEST_BEFORE_PARTITION_VALUE, AbstractServiceTest.NO_LATEST_AFTER_PARTITION_VALUE)), null, AbstractServiceTest.DATA_VERSION, AbstractServiceTest.NO_STORAGE_NAMES, AbstractServiceTest.STORAGE_NAME, AbstractServiceTest.NO_INCLUDE_ALL_REGISTERED_SUBPARTITIONS);
    businessObjectDataAvailabilityRequests.add(businessObjectDataAvailabilityRequest);
    return businessObjectDataAvailabilityCollectionRequest;
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) ArrayList(java.util.ArrayList) PartitionValueFilter(org.finra.herd.model.api.xml.PartitionValueFilter)

Example 5 with BusinessObjectDataAvailabilityCollectionRequest

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

the class CheckBusinessObjectDataAvailabilityCollectionTest method testCheckBusinessObjectDataAvailabilityCollectionXml.

@Test
public void testCheckBusinessObjectDataAvailabilityCollectionXml() throws Exception {
    // Prepare database entities required for testing.
    businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityCollectionTesting();
    // Prepare the request.
    BusinessObjectDataAvailabilityCollectionRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityCollectionRequest();
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataAvailabilityCollectionRequest", "${businessObjectDataAvailabilityCollectionRequest}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("contentType", "xml"));
    parameters.add(buildParameter("businessObjectDataAvailabilityCollectionRequest", xmlHelper.objectToXml(request)));
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(CheckBusinessObjectDataAvailabilityCollection.VARIABLE_IS_ALL_DATA_AVAILABLE, true);
    variableValuesToValidate.put(CheckBusinessObjectDataAvailabilityCollection.VARIABLE_IS_ALL_DATA_NOT_AVAILABLE, false);
    variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataAvailabilityCollectionResponse()));
    testActivitiServiceTaskSuccess(CheckBusinessObjectDataAvailabilityCollection.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) HashMap(java.util.HashMap) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Aggregations

BusinessObjectDataAvailabilityCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest)7 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)3 HashMap (java.util.HashMap)2 FieldExtension (org.activiti.bpmn.model.FieldExtension)2 BusinessObjectDataAvailabilityCollectionResponse (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)2 Parameter (org.finra.herd.model.api.xml.Parameter)2 BusinessObjectDataCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataCreateRequest)1 BusinessObjectDataDdlCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest)1 BusinessObjectDataDdlRequest (org.finra.herd.model.api.xml.BusinessObjectDataDdlRequest)1 BusinessObjectDataInvalidateUnregisteredRequest (org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest)1 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)1 BusinessObjectDataRetryStoragePolicyTransitionRequest (org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest)1 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)1