use of org.finra.herd.model.api.xml.BusinessObjectDataStatusInformation in project herd by FINRAOS.
the class BusinessObjectDataStatusRestControllerTest method testGetBusinessObjectDataStatusMissingOptionalParameters.
@Test
public void testGetBusinessObjectDataStatusMissingOptionalParameters() {
// and with any allowed number of subpartition values (from 0 to MAX_SUBPARTITIONS).
for (int i = 0; i <= BusinessObjectDataEntity.MAX_SUBPARTITIONS; i++) {
// Build a list of subpartition values.
List<String> subPartitionValues = SUBPARTITION_VALUES.subList(0, i);
BusinessObjectDataStatusInformation businessObjectDataStatusInformation = new BusinessObjectDataStatusInformation();
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null, PARTITION_VALUE, subPartitionValues, null);
when(businessObjectDataStatusService.getBusinessObjectDataStatus(businessObjectDataKey, BLANK_TEXT)).thenReturn(businessObjectDataStatusInformation);
// Get the business object data status information without specifying optional parameters.
BusinessObjectDataStatusInformation resultBusinessObjectDataStatusInformation = businessObjectDataStatusRestController.getBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, BLANK_TEXT, PARTITION_VALUE, getDelimitedFieldValues(subPartitionValues), null, null);
// Verify the external calls.
verify(businessObjectDataStatusService).getBusinessObjectDataStatus(businessObjectDataKey, BLANK_TEXT);
assertEquals(businessObjectDataStatusInformation, resultBusinessObjectDataStatusInformation);
}
verifyNoMoreInteractions(businessObjectDataStatusService);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStatusInformation in project herd by FINRAOS.
the class GetBusinessObjectDataStatusTest method testGetBusinessObjectDataStatusMissingOptionalParametersSubPartitionValuesAsEmptyString.
@Test
public void testGetBusinessObjectDataStatusMissingOptionalParametersSubPartitionValuesAsEmptyString() throws Exception {
// Create a business object data key without sub-partition values.
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION);
// Create a business object data entity.
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS);
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("namespace", "${namespace}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDefinitionName", "${businessObjectDefinitionName}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatUsage", "${businessObjectFormatUsage}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatFileType", "${businessObjectFormatFileType}"));
fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
fieldExtensionList.add(buildFieldExtension("subPartitionValues", "${subPartitionValues}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("namespace", BDEF_NAMESPACE));
parameters.add(buildParameter("businessObjectDefinitionName", BDEF_NAME));
parameters.add(buildParameter("businessObjectFormatUsage", FORMAT_USAGE_CODE));
parameters.add(buildParameter("businessObjectFormatFileType", FORMAT_FILE_TYPE_CODE));
parameters.add(buildParameter("partitionValue", PARTITION_VALUE));
parameters.add(buildParameter("subPartitionValues", EMPTY_STRING));
// Build the expected response object.
BusinessObjectDataStatusInformation expectedBusinessObjectDataStatusInformation = new BusinessObjectDataStatusInformation(businessObjectDataKey, BDATA_STATUS);
// Run the activiti task and validate the returned response object.
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(GetBusinessObjectDataStatus.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataStatusInformation));
testActivitiServiceTaskSuccess(GetBusinessObjectDataStatus.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStatusInformation in project herd by FINRAOS.
the class GetBusinessObjectDataStatusTest method testGetBusinessObjectDataStatus.
@Test
public void testGetBusinessObjectDataStatus() throws Exception {
// Create a business object data key.
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION);
// Create a business object data entity.
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS);
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("namespace", "${namespace}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDefinitionName", "${businessObjectDefinitionName}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatUsage", "${businessObjectFormatUsage}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatFileType", "${businessObjectFormatFileType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatVersion", "${businessObjectFormatVersion}"));
fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
fieldExtensionList.add(buildFieldExtension("subPartitionValues", "${subPartitionValues}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataVersion", "${businessObjectDataVersion}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("namespace", BDEF_NAMESPACE));
parameters.add(buildParameter("businessObjectDefinitionName", BDEF_NAME));
parameters.add(buildParameter("businessObjectFormatUsage", FORMAT_USAGE_CODE));
parameters.add(buildParameter("businessObjectFormatFileType", FORMAT_FILE_TYPE_CODE));
parameters.add(buildParameter("businessObjectFormatVersion", FORMAT_VERSION.toString()));
parameters.add(buildParameter("partitionValue", PARTITION_VALUE));
parameters.add(buildParameter("subPartitionValues", herdStringHelper.buildStringWithDefaultDelimiter(SUBPARTITION_VALUES)));
parameters.add(buildParameter("businessObjectDataVersion", DATA_VERSION.toString()));
// Build the expected response object.
BusinessObjectDataStatusInformation expectedBusinessObjectDataStatusInformation = new BusinessObjectDataStatusInformation(businessObjectDataKey, BDATA_STATUS);
// Run the activiti task and validate the returned response object.
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(GetBusinessObjectDataStatus.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataStatusInformation));
testActivitiServiceTaskSuccess(GetBusinessObjectDataStatus.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStatusInformation in project herd by FINRAOS.
the class BusinessObjectDataStatusRestControllerTest method testGetBusinessObjectDataStatusMissingOptionalParametersPassedAsNulls.
@Test
public void testGetBusinessObjectDataStatusMissingOptionalParametersPassedAsNulls() {
BusinessObjectDataStatusInformation businessObjectDataStatusInformation = new BusinessObjectDataStatusInformation();
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null, PARTITION_VALUE, new ArrayList<>(), null);
when(businessObjectDataStatusService.getBusinessObjectDataStatus(businessObjectDataKey, null)).thenReturn(businessObjectDataStatusInformation);
// Get the business object data status by passing null values for the partition key and the list of sub-partition values.
BusinessObjectDataStatusInformation resultBusinessObjectDataStatusInformation = businessObjectDataStatusRestController.getBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null, PARTITION_VALUE, null, null, null);
// Verify the external calls.
verify(businessObjectDataStatusService).getBusinessObjectDataStatus(businessObjectDataKey, null);
assertEquals(businessObjectDataStatusInformation, resultBusinessObjectDataStatusInformation);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStatusInformation in project herd by FINRAOS.
the class BusinessObjectDataStatusRestControllerTest method testGetBusinessObjectDataStatus.
@Test
public void testGetBusinessObjectDataStatus() {
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION);
BusinessObjectDataStatusInformation businessObjectDataStatusInformation = new BusinessObjectDataStatusInformation();
when(businessObjectDataStatusService.getBusinessObjectDataStatus(businessObjectDataKey, PARTITION_KEY)).thenReturn(businessObjectDataStatusInformation);
// Get the business object data status information.
BusinessObjectDataStatusInformation resultBusinessObjectDataStatusInformation = businessObjectDataStatusRestController.getBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, PARTITION_KEY, PARTITION_VALUE, getDelimitedFieldValues(SUBPARTITION_VALUES), FORMAT_VERSION, DATA_VERSION);
// Verify the external calls.
verify(businessObjectDataStatusService).getBusinessObjectDataStatus(businessObjectDataKey, PARTITION_KEY);
verifyNoMoreInteractions(businessObjectDataStatusService);
// Validate the returned object.
assertEquals(businessObjectDataStatusInformation, resultBusinessObjectDataStatusInformation);
}
Aggregations