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());
}
}
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());
}
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);
}
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;
}
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);
}
Aggregations