use of org.finra.herd.model.api.xml.BusinessObjectDataKeys in project herd by FINRAOS.
the class BusinessObjectDataServiceImpl method getAllBusinessObjectDataByBusinessObjectFormat.
@NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public BusinessObjectDataKeys getAllBusinessObjectDataByBusinessObjectFormat(BusinessObjectFormatKey businessObjectFormatKey) {
// Perform validation and trim. Please note that we specify business object format version parameter to be required.
businessObjectFormatHelper.validateBusinessObjectFormatKey(businessObjectFormatKey, true);
// Ensure that a business object definition already exists with the specified name.
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoHelper.getBusinessObjectFormatEntity(businessObjectFormatKey);
// Get the maximum number of records to return.
Integer maxResults = configurationHelper.getProperty(ConfigurationValue.BUSINESS_OBJECT_DATA_SEARCH_MAX_RESULTS, Integer.class);
// Gets the list of business object data keys and return them.
BusinessObjectDataKeys businessObjectDataKeys = new BusinessObjectDataKeys();
businessObjectDataKeys.getBusinessObjectDataKeys().addAll(businessObjectDataDao.getBusinessObjectDataByBusinessObjectFormat(businessObjectFormatEntity, maxResults));
return businessObjectDataKeys;
}
use of org.finra.herd.model.api.xml.BusinessObjectDataKeys in project herd by FINRAOS.
the class BusinessObjectDataServiceGetAllBusinessObjectDataTest method testGetAllBusinessObjectDataByBusinessObjectDefinition.
@Test
public void testGetAllBusinessObjectDataByBusinessObjectDefinition() {
// Create a business object definition key.
BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME);
// Create a business object definition entity.
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(businessObjectDefinitionKey, DATA_PROVIDER_NAME, BDEF_DESCRIPTION);
// Create a list of business object data keys.
List<BusinessObjectDataKey> businessObjectDataKeys = Arrays.asList(new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION));
// Mock the external calls.
when(businessObjectDefinitionDaoHelper.getBusinessObjectDefinitionEntity(businessObjectDefinitionKey)).thenReturn(businessObjectDefinitionEntity);
when(configurationHelper.getProperty(ConfigurationValue.BUSINESS_OBJECT_DATA_SEARCH_MAX_RESULTS, Integer.class)).thenReturn(MAX_RESULTS_1);
when(businessObjectDataDao.getBusinessObjectDataByBusinessObjectDefinition(businessObjectDefinitionEntity, MAX_RESULTS_1)).thenReturn(businessObjectDataKeys);
// Call the method being tested.
BusinessObjectDataKeys response = businessObjectDataService.getAllBusinessObjectDataByBusinessObjectDefinition(businessObjectDefinitionKey);
// Verify the external calls.
verify(businessObjectDefinitionHelper).validateBusinessObjectDefinitionKey(businessObjectDefinitionKey);
verify(businessObjectDefinitionDaoHelper).getBusinessObjectDefinitionEntity(businessObjectDefinitionKey);
verify(configurationHelper).getProperty(ConfigurationValue.BUSINESS_OBJECT_DATA_SEARCH_MAX_RESULTS, Integer.class);
verify(businessObjectDataDao).getBusinessObjectDataByBusinessObjectDefinition(businessObjectDefinitionEntity, MAX_RESULTS_1);
verifyNoMoreInteractionsHelper();
// Validate the returned object.
assertEquals(new BusinessObjectDataKeys(businessObjectDataKeys), response);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataKeys in project herd by FINRAOS.
the class BusinessObjectDataServiceGetAllBusinessObjectDataTest method testGetAllBusinessObjectDataByBusinessObjectFormat.
@Test
public void testGetAllBusinessObjectDataByBusinessObjectFormat() {
// Create a business object definition key.
BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION);
// Create a business object format entity.
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(businessObjectFormatKey, FORMAT_DESCRIPTION, NO_LATEST_VERSION_FLAG_SET, PARTITION_KEY);
// Create a list of business object data keys.
List<BusinessObjectDataKey> businessObjectDataKeys = Arrays.asList(new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION));
// Mock the external calls.
when(businessObjectFormatDaoHelper.getBusinessObjectFormatEntity(businessObjectFormatKey)).thenReturn(businessObjectFormatEntity);
when(configurationHelper.getProperty(ConfigurationValue.BUSINESS_OBJECT_DATA_SEARCH_MAX_RESULTS, Integer.class)).thenReturn(MAX_RESULTS_1);
when(businessObjectDataDao.getBusinessObjectDataByBusinessObjectFormat(businessObjectFormatEntity, MAX_RESULTS_1)).thenReturn(businessObjectDataKeys);
// Call the method being tested.
BusinessObjectDataKeys response = businessObjectDataService.getAllBusinessObjectDataByBusinessObjectFormat(businessObjectFormatKey);
// Verify the external calls.
verify(businessObjectFormatHelper).validateBusinessObjectFormatKey(businessObjectFormatKey, true);
verify(businessObjectFormatDaoHelper).getBusinessObjectFormatEntity(businessObjectFormatKey);
verify(configurationHelper).getProperty(ConfigurationValue.BUSINESS_OBJECT_DATA_SEARCH_MAX_RESULTS, Integer.class);
verify(businessObjectDataDao).getBusinessObjectDataByBusinessObjectFormat(businessObjectFormatEntity, MAX_RESULTS_1);
verifyNoMoreInteractionsHelper();
// Validate the returned object.
assertEquals(new BusinessObjectDataKeys(businessObjectDataKeys), response);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataKeys in project herd by FINRAOS.
the class BusinessObjectDataRestControllerTest method testGetAllBusinessObjectDataByBusinessObjectDefinition.
@Test
public void testGetAllBusinessObjectDataByBusinessObjectDefinition() {
// Create a business object definition key.
BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME);
// Create a list of business object data keys.
BusinessObjectDataKeys businessObjectDataKeys = new BusinessObjectDataKeys(Arrays.asList(new BusinessObjectDataKey()));
// Mock the external calls.
when(businessObjectDataService.getAllBusinessObjectDataByBusinessObjectDefinition(businessObjectDefinitionKey)).thenReturn(businessObjectDataKeys);
// Call the method under test.
BusinessObjectDataKeys result = businessObjectDataRestController.getAllBusinessObjectDataByBusinessObjectDefinition(BDEF_NAMESPACE, BDEF_NAME);
// Verify the external calls.
verify(businessObjectDataService).getAllBusinessObjectDataByBusinessObjectDefinition(businessObjectDefinitionKey);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(businessObjectDataKeys, result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataKeys in project herd by FINRAOS.
the class BusinessObjectDataRestControllerTest method testGetAllBusinessObjectDataByBusinessObjectFormat.
@Test
public void testGetAllBusinessObjectDataByBusinessObjectFormat() {
// Create a business object format key.
BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION);
// Create a list of business object data keys.
BusinessObjectDataKeys businessObjectDataKeys = new BusinessObjectDataKeys(Arrays.asList(new BusinessObjectDataKey()));
// Mock the external calls.
when(businessObjectDataService.getAllBusinessObjectDataByBusinessObjectFormat(businessObjectFormatKey)).thenReturn(businessObjectDataKeys);
// Call the method under test.
BusinessObjectDataKeys result = businessObjectDataRestController.getAllBusinessObjectDataByBusinessObjectFormat(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION);
// Verify the external calls.
verify(businessObjectDataService).getAllBusinessObjectDataByBusinessObjectFormat(businessObjectFormatKey);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(businessObjectDataKeys, result);
}
Aggregations