use of org.finra.herd.model.api.xml.CustomDdlKey in project herd by FINRAOS.
the class CustomDdlServiceTest method testDeleteCustomDdl.
@Test
public void testDeleteCustomDdl() {
// Create and persist a custom DDL entity.
CustomDdlEntity customDdlEntity = customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL);
// Validate that this custom DDL exists.
CustomDdlKey customDdlKey = new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME);
assertNotNull(customDdlDao.getCustomDdlByKey(customDdlKey));
// Delete this custom DDL.
CustomDdl deletedCustomDdl = customDdlService.deleteCustomDdl(new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME));
// Validate the returned object.
customDdlServiceTestHelper.validateCustomDdl(customDdlEntity.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL, deletedCustomDdl);
// Ensure that this custom DDL is no longer there.
assertNull(customDdlDao.getCustomDdlByKey(customDdlKey));
}
use of org.finra.herd.model.api.xml.CustomDdlKey in project herd by FINRAOS.
the class CustomDdlServiceTest method testDeleteCustomDdlCustomDdlNoExists.
@Test
public void testDeleteCustomDdlCustomDdlNoExists() {
// Try to delete a non-existing custom DDL.
try {
customDdlService.deleteCustomDdl(new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME));
fail("Should throw an ObjectNotFoundException when custom DDL does not exist.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Custom DDL with name \"%s\" does not exist for business object format with namespace \"%s\", " + "business object definition name \"%s\", format usage \"%s\", format file type \"%s\", and format version \"%d\".", CUSTOM_DDL_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.CustomDdlKey in project herd by FINRAOS.
the class CustomDdlServiceTest method testUpdateCustomDdlTrimParameters.
@Test
public void testUpdateCustomDdlTrimParameters() {
// Create and persist a custom DDL entity.
CustomDdlEntity customDdlEntity = customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL);
// Update the custom DDL using input parameters with leading and trailing empty spaces.
CustomDdl updatedCustomDdl = customDdlService.updateCustomDdl(new CustomDdlKey(addWhitespace(NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(FORMAT_USAGE_CODE), addWhitespace(FORMAT_FILE_TYPE_CODE), FORMAT_VERSION, addWhitespace(CUSTOM_DDL_NAME)), customDdlServiceTestHelper.createCustomDdlUpdateRequest(addWhitespace(TEST_DDL_2)));
// Validate the returned object.
customDdlServiceTestHelper.validateCustomDdl(customDdlEntity.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL_2, updatedCustomDdl);
}
use of org.finra.herd.model.api.xml.CustomDdlKey in project herd by FINRAOS.
the class CustomDdlServiceTest method testGetCustomDdlsLowerCaseParameters.
@Test
public void testGetCustomDdlsLowerCaseParameters() {
// List of test custom DDL names.
List<String> testCustomDdlNames = Arrays.asList(CUSTOM_DDL_NAME, CUSTOM_DDL_NAME_2);
// Create and persist a custom DDL entities using upper case values.
for (String customDdlName : testCustomDdlNames) {
customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, customDdlName.toUpperCase(), TEST_DDL.toUpperCase());
}
// Retrieve a list of custom DDL keys using lower case input parameters.
CustomDdlKeys resultCustomDdlKeys = customDdlService.getCustomDdls(new BusinessObjectFormatKey(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION));
// Validate the returned object.
assertNotNull(resultCustomDdlKeys);
assertEquals(testCustomDdlNames.size(), resultCustomDdlKeys.getCustomDdlKeys().size());
for (int i = 0; i < testCustomDdlNames.size(); i++) {
assertEquals(new CustomDdlKey(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, testCustomDdlNames.get(i).toUpperCase()), resultCustomDdlKeys.getCustomDdlKeys().get(i));
}
}
use of org.finra.herd.model.api.xml.CustomDdlKey in project herd by FINRAOS.
the class CustomDdlServiceTest method testDeleteCustomDdlTrimParameters.
@Test
public void testDeleteCustomDdlTrimParameters() {
// Create and persist a custom DDL entity.
CustomDdlEntity customDdlEntity = customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL);
// Validate that this custom DDL exists.
CustomDdlKey customDdlKey = new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME);
assertNotNull(customDdlDao.getCustomDdlByKey(customDdlKey));
// Delete the custom DDL using input parameters with leading and trailing empty spaces.
CustomDdl deletedCustomDdl = customDdlService.deleteCustomDdl(new CustomDdlKey(addWhitespace(NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(FORMAT_USAGE_CODE), addWhitespace(FORMAT_FILE_TYPE_CODE), FORMAT_VERSION, addWhitespace(CUSTOM_DDL_NAME)));
// Validate the returned object.
customDdlServiceTestHelper.validateCustomDdl(customDdlEntity.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL, deletedCustomDdl);
// Ensure that this custom DDL is no longer there.
assertNull(customDdlDao.getCustomDdlByKey(customDdlKey));
}
Aggregations