use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testUpdateBusinessObjectDefinitionColumnTrimParameters.
@Test
public void testUpdateBusinessObjectDefinitionColumnTrimParameters() {
// Create a business object definition column key.
BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
// Create and persist a business object definition column.
BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_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);
// Create and persist a schema column for this business object format that is linked with the business object definition column.
schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
// Update the business object definition column using input parameters with leading and trailing empty spaces.
BusinessObjectDefinitionColumn updatedBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.updateBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(BDEF_COLUMN_NAME)), new BusinessObjectDefinitionColumnUpdateRequest(addWhitespace(BDEF_COLUMN_DESCRIPTION_2)));
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, addWhitespace(BDEF_COLUMN_DESCRIPTION_2), NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), updatedBusinessObjectDefinitionColumn);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testCreateBusinessObjectDefinitionColumnMissingRequiredParameters.
@Test
public void testCreateBusinessObjectDefinitionColumnMissingRequiredParameters() {
// Try to create a business object definition column when business object definition namespace is not specified.
try {
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BLANK_TEXT, BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
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 create a business object definition column when business object definition name is not specified.
try {
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BLANK_TEXT, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
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 create a business object definition column when business object definition column name is not specified.
try {
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BLANK_TEXT), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
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());
}
// Try to create a business object definition column when business object definition column name is not specified.
try {
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), BLANK_TEXT, BDEF_COLUMN_DESCRIPTION));
fail("Should throw an IllegalArgumentException when schema column name is not specified.");
} catch (IllegalArgumentException e) {
assertEquals("A schema column name must be specified.", e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testUpdateBusinessObjectDefinitionColumn.
@Test
public void testUpdateBusinessObjectDefinitionColumn() {
// Create a business object definition column key.
BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
// Create and persist a business object definition column.
BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_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);
// Create and persist a schema column for this business object format that is linked with the business object definition column.
schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
// Update the business object definition column.
businessObjectDefinitionColumnService.updateBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, new BusinessObjectDefinitionColumnUpdateRequest(BDEF_COLUMN_DESCRIPTION_2));
// Get the business object definition column.
BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, false);
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION_2, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), resultBusinessObjectDefinitionColumn);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testDeleteBusinessObjectDefinitionColumnUpperCaseParameters.
@Test
public void testDeleteBusinessObjectDefinitionColumnUpperCaseParameters() {
// Create a business object definition column key.
BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
// Create and persist a business object definition column.
BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_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);
// Create and persist a schema column for this business object format that is linked with the business object definition column.
schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
// Validate that this business object definition column exists.
assertNotNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(businessObjectDefinitionColumnKey));
// Delete this business object definition column using upper case parameter values.
BusinessObjectDefinitionColumn deletedBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.deleteBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), BDEF_COLUMN_NAME.toUpperCase()));
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), deletedBusinessObjectDefinitionColumn);
// Ensure that this business object definition column is no longer there.
assertNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(businessObjectDefinitionColumnKey));
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testCreateBusinessObjectDefinitionColumnInvalidParameters.
@Test
public void testCreateBusinessObjectDefinitionColumnInvalidParameters() {
// Try to create a business object definition column when business object definition namespace contains a forward slash character.
try {
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(addSlash(BDEF_NAMESPACE), BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
fail("Should throw an IllegalArgumentException when business object definition namespace contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Namespace can not contain a forward slash character.", e.getMessage());
}
// Try to create a business object definition column when business object definition name contains a forward slash character.
try {
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, addSlash(BDEF_NAME), BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
fail("Should throw an IllegalArgumentException when business object definition name contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Business object definition name can not contain a forward slash character.", e.getMessage());
}
// Try to create a business object definition column when business object definition column name contains a forward slash character.
try {
businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, addSlash(BDEF_COLUMN_NAME)), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
fail("Should throw an IllegalArgumentException when business object definition column name contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Business object definition column name can not contain a forward slash character.", e.getMessage());
}
}
Aggregations