use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testCreateBusinessObjectDefinitionColumnSchemaColumnNoExistsForDescriptiveFormat.
@Test
public void testCreateBusinessObjectDefinitionColumnSchemaColumnNoExistsForDescriptiveFormat() {
// Create and persist a business object definition entity.
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION);
// Create and persist a business object format entity.
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
// Add descriptive format to definition
businessObjectDefinitionEntity.setDescriptiveBusinessObjectFormat(businessObjectFormatEntity);
businessObjectDefinitionDao.saveAndRefresh(businessObjectDefinitionEntity);
// Try to create a business object definition column when there are no matching schema columns.
try {
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
fail("Should throw an ObjectNotFoundException when no matching schema column exists.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Unable to create business object definition column because there are no format schema " + "columns with name \"%s\" in the descriptive business object format for the business object definition {%s}.", COLUMN_NAME, businessObjectDefinitionServiceTestHelper.getExpectedBusinessObjectDefinitionKeyAsString(BDEF_NAMESPACE, BDEF_NAME)), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testSearchBusinessObjectDefinitionColumnsUpperCaseParameters.
@Test
public void testSearchBusinessObjectDefinitionColumnsUpperCaseParameters() {
createDatabaseEntitiesForBusinessObjectDefinitionColumnSearchTesting();
// Search the business object definition columns using added upper case input parameters.
BusinessObjectDefinitionColumnSearchResponse businessObjectDefinitionColumnSearchResponse = businessObjectDefinitionColumnService.searchBusinessObjectDefinitionColumns(new BusinessObjectDefinitionColumnSearchRequest(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchFilter(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchKey(BDEF_NAMESPACE, BDEF_NAME))))), Sets.newHashSet(SCHEMA_COLUMN_NAME_FIELD.toUpperCase(), DESCRIPTION_FIELD.toUpperCase()));
// Validate the response object.
assertEquals(new BusinessObjectDefinitionColumnSearchResponse(Lists.newArrayList(new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), COLUMN_NAME_2, BDEF_COLUMN_DESCRIPTION_2, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS))), businessObjectDefinitionColumnSearchResponse);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testGetBusinessObjectDefinitionColumnsUpperCaseParameters.
@Test
public void testGetBusinessObjectDefinitionColumnsUpperCaseParameters() {
// Create and persist business object definition column entities.
businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), DESCRIPTION_2);
businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), DESCRIPTION);
// Get a list of business object definition column keys using upper case parameter values.
BusinessObjectDefinitionColumnKeys resultBusinessObjectDefinitionColumnKeys = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumns(new BusinessObjectDefinitionKey(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase()));
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionColumnKeys(Lists.newArrayList(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2))), resultBusinessObjectDefinitionColumnKeys);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testGetBusinessObjectDefinitionColumnWithChangeEventsWithUpdate.
@Test
public void testGetBusinessObjectDefinitionColumnWithChangeEventsWithUpdate() {
// Create and persist a business object format entity.
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
// Create and persist a schema column for this business object format.
schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME);
// Create a business object definition column key.
BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
// Create a business object definition column.
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
// Get the created business object definition column entity.
BusinessObjectDefinitionColumnEntity resultBusinessObjectDefinitionColumnEntityCreated = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
// Update a business object definition column.
businessObjectDefinitionColumnService.updateBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, new BusinessObjectDefinitionColumnUpdateRequest(BDEF_COLUMN_DESCRIPTION_2));
// Get the updated business object definition column entity.
BusinessObjectDefinitionColumnEntity resultBusinessObjectDefinitionColumnEntityUpdated = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
// Get the business object definition column.
BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, true);
// Build the expected business object definition column change events list.
List<BusinessObjectDefinitionColumnChangeEvent> expectedBusinessObjectDefinitionColumnChangeEvents = Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION_2, resultBusinessObjectDefinitionColumn.getBusinessObjectDefinitionColumnChangeEvents().get(0).getEventTime(), resultBusinessObjectDefinitionColumnEntityUpdated.getCreatedBy()), new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, resultBusinessObjectDefinitionColumn.getBusinessObjectDefinitionColumnChangeEvents().get(1).getEventTime(), resultBusinessObjectDefinitionColumnEntityCreated.getCreatedBy()));
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionColumn(resultBusinessObjectDefinitionColumn.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION_2, expectedBusinessObjectDefinitionColumnChangeEvents), resultBusinessObjectDefinitionColumn);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testGetBusinessObjectDefinitionColumnMissingRequiredParameters.
@Test
public void testGetBusinessObjectDefinitionColumnMissingRequiredParameters() {
// Try to get a business object definition column when business object definition namespace is not specified.
try {
businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(BLANK_TEXT, BDEF_NAME, BDEF_COLUMN_NAME), false);
fail("Should throw an IllegalArgumentException when business object definition namespace is not specified.");
} catch (IllegalArgumentException e) {
assertEquals("A namespace must be specified.", e.getMessage());
}
// Try to get a business object definition column when business object definition name is not specified.
try {
businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BLANK_TEXT, BDEF_COLUMN_NAME), false);
fail("Should throw an IllegalArgumentException when business object definition name is not specified.");
} catch (IllegalArgumentException e) {
assertEquals("A business object definition name must be specified.", e.getMessage());
}
// Try to get a business object definition column when business object definition column name is not specified.
try {
businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BLANK_TEXT), false);
fail("Should throw an IllegalArgumentException when business object definition column name is not specified.");
} catch (IllegalArgumentException e) {
assertEquals("A business object definition column name must be specified.", e.getMessage());
}
}
Aggregations