use of org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey in project herd by FINRAOS.
the class BusinessObjectDataAttributeServiceTest method testCreateBusinessObjectDataAttributeInvalidParameters.
@Test
public void testCreateBusinessObjectDataAttributeInvalidParameters() {
// Try to create a business object data attribute when namespace contains a forward slash character.
try {
businessObjectDataAttributeService.createBusinessObjectDataAttribute(new BusinessObjectDataAttributeCreateRequest(new BusinessObjectDataAttributeKey(addSlash(BDEF_NAMESPACE), BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), ATTRIBUTE_VALUE_1));
fail("Should throw an IllegalArgumentException when 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 data attribute when business object definition name contains a forward slash character.
try {
businessObjectDataAttributeService.createBusinessObjectDataAttribute(new BusinessObjectDataAttributeCreateRequest(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, addSlash(BDEF_NAME), FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), ATTRIBUTE_VALUE_1));
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 data attribute when business object format usage contains a forward slash character.
try {
businessObjectDataAttributeService.createBusinessObjectDataAttribute(new BusinessObjectDataAttributeCreateRequest(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, addSlash(FORMAT_USAGE_CODE), FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), ATTRIBUTE_VALUE_1));
fail("Should throw an IllegalArgumentException when business object format usage contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Business object format usage can not contain a forward slash character.", e.getMessage());
}
// Try to create a business object data attribute when business object format file type contains a forward slash character.
try {
businessObjectDataAttributeService.createBusinessObjectDataAttribute(new BusinessObjectDataAttributeCreateRequest(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, addSlash(FORMAT_FILE_TYPE_CODE), FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), ATTRIBUTE_VALUE_1));
fail("Should throw an IllegalArgumentException when business object format file type contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Business object format file type can not contain a forward slash character.", e.getMessage());
}
// Try to create a business object data attribute when partition value contains a forward slash character.
try {
businessObjectDataAttributeService.createBusinessObjectDataAttribute(new BusinessObjectDataAttributeCreateRequest(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, addSlash(PARTITION_VALUE), SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), ATTRIBUTE_VALUE_1));
fail("Should throw an IllegalArgumentException when partition value contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Partition value can not contain a forward slash character.", e.getMessage());
}
// Try to create a business object data attribute when a sub-partition value contains a forward slash character.
try {
businessObjectDataAttributeService.createBusinessObjectDataAttribute(new BusinessObjectDataAttributeCreateRequest(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(addSlash(PARTITION_VALUE_2)), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), ATTRIBUTE_VALUE_1));
fail("Should throw an IllegalArgumentException when sub-partition value contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Subpartition value can not contain a forward slash character.", e.getMessage());
}
// Try to create a business object data attribute when attribute name contains a forward slash character.
try {
businessObjectDataAttributeService.createBusinessObjectDataAttribute(new BusinessObjectDataAttributeCreateRequest(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, addSlash(ATTRIBUTE_NAME_1_MIXED_CASE)), ATTRIBUTE_VALUE_1));
fail("Should throw an IllegalArgumentException when attribute name contains a forward slash character.");
} catch (IllegalArgumentException e) {
assertEquals("Business object data attribute name can not contain a forward slash character.", e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey in project herd by FINRAOS.
the class BusinessObjectDataAttributeServiceTest method testGetBusinessObjectDataAttributeBusinessObjectDataAttributeNoExists.
@Test
public void testGetBusinessObjectDataAttributeBusinessObjectDataAttributeNoExists() {
// Create and persist a business object data entity.
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, true, BDATA_STATUS);
// Try to get a non-existing business object data attribute.
try {
businessObjectDataAttributeService.getBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE));
fail("Should throw an ObjectNotFoundException when business object data attribute does not exist.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Attribute with name \"%s\" does not exist for business object data {namespace: \"%s\", businessObjectDefinitionName: \"%s\", " + "businessObjectFormatUsage: \"%s\", businessObjectFormatFileType: \"%s\", businessObjectFormatVersion: %d, " + "businessObjectDataPartitionValue: \"%s\", businessObjectDataSubPartitionValues: \"%s,%s,%s,%s\", businessObjectDataVersion: %d}.", ATTRIBUTE_NAME_1_MIXED_CASE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3), DATA_VERSION), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey in project herd by FINRAOS.
the class BusinessObjectDataAttributeServiceTest method testUpdateBusinessObjectDataAttributeLowerCaseParameters.
@Test
public void testUpdateBusinessObjectDataAttributeLowerCaseParameters() {
// Create and persist a business object data attribute entity using upper case values.
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, PARTITION_VALUE.toUpperCase(), convertListToUpperCase(SUBPARTITION_VALUES), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE.toUpperCase(), ATTRIBUTE_VALUE_1.toUpperCase());
// Update the business object data attribute using lower case input parameters (except for case-sensitive partition values).
BusinessObjectDataAttribute updatedBusinessObjectDataAttribute = businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, PARTITION_VALUE.toUpperCase(), convertListToUpperCase(SUBPARTITION_VALUES), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE.toLowerCase()), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_2.toLowerCase()));
// Validate the returned object.
businessObjectDataAttributeServiceTestHelper.validateBusinessObjectDataAttribute(businessObjectDataAttributeEntity.getId(), NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, PARTITION_VALUE.toUpperCase(), convertListToUpperCase(SUBPARTITION_VALUES), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE.toUpperCase(), ATTRIBUTE_VALUE_2.toLowerCase(), updatedBusinessObjectDataAttribute);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey in project herd by FINRAOS.
the class BusinessObjectDataAttributeServiceTest method testDeleteBusinessObjectDataAttributeBusinessObjectFormatNoExists.
@Test
public void testDeleteBusinessObjectDataAttributeBusinessObjectFormatNoExists() {
// Try to delete a business object data attribute instance using non-existing business object format.
try {
businessObjectDataAttributeService.deleteBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE));
fail("Should throw an ObjectNotFoundException when business object format does not exist.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Business object format with namespace \"%s\", business object definition name \"%s\", format usage \"%s\", " + "format file type \"%s\", and format version \"%d\" doesn't exist.", NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey in project herd by FINRAOS.
the class BusinessObjectDataAttributeServiceTest method testDeleteBusinessObjectDataAttributeBusinessObjectDataNoExists.
@Test
public void testDeleteBusinessObjectDataAttributeBusinessObjectDataNoExists() {
// Create and persist a business object format entity.
businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, true, PARTITION_KEY);
// Try to delete a business object data attribute instance using non-existing business object data.
try {
businessObjectDataAttributeService.deleteBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE));
fail("Should throw an ObjectNotFoundException when business object data does not exist.");
} catch (ObjectNotFoundException e) {
assertEquals(businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataNotFoundErrorMessage(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, null), e.getMessage());
}
}
Aggregations