use of org.finra.herd.model.jpa.CustomDdlEntity in project herd by FINRAOS.
the class CustomDdlServiceTest method testGetCustomDdlTrimParameters.
@Test
public void testGetCustomDdlTrimParameters() {
// 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);
// Retrieve the custom DDL using input parameters with leading and trailing empty spaces.
CustomDdl resultCustomDdl = customDdlService.getCustomDdl(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, resultCustomDdl);
}
use of org.finra.herd.model.jpa.CustomDdlEntity in project herd by FINRAOS.
the class CustomDdlServiceTest method testDeleteCustomDdlUpperCaseParameters.
@Test
public void testDeleteCustomDdlUpperCaseParameters() {
// Create and persist a custom DDL entity using lower case values.
CustomDdlEntity customDdlEntity = customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toLowerCase(), TEST_DDL.toLowerCase());
// Validate that this custom DDL exists.
CustomDdlKey customDdlKey = new CustomDdlKey(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toLowerCase());
assertNotNull(customDdlDao.getCustomDdlByKey(customDdlKey));
// Delete the custom DDL using upper case input parameters.
CustomDdl deletedCustomDdl = customDdlService.deleteCustomDdl(new CustomDdlKey(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toUpperCase()));
// Validate the returned object.
customDdlServiceTestHelper.validateCustomDdl(customDdlEntity.getId(), NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toLowerCase(), TEST_DDL.toLowerCase(), deletedCustomDdl);
// Ensure that this custom DDL is no longer there.
assertNull(customDdlDao.getCustomDdlByKey(customDdlKey));
}
use of org.finra.herd.model.jpa.CustomDdlEntity in project herd by FINRAOS.
the class CustomDdlServiceTest method testGetCustomDdlLowerCaseParameters.
@Test
public void testGetCustomDdlLowerCaseParameters() {
// Create and persist a custom DDL entity using upper case values.
CustomDdlEntity customDdlEntity = customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toUpperCase(), TEST_DDL.toUpperCase());
// Get the custom DDL using lower case input parameters.
CustomDdl resultCustomDdl = customDdlService.getCustomDdl(new CustomDdlKey(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toLowerCase()));
// Validate the returned object.
customDdlServiceTestHelper.validateCustomDdl(customDdlEntity.getId(), NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toUpperCase(), TEST_DDL.toUpperCase(), resultCustomDdl);
}
use of org.finra.herd.model.jpa.CustomDdlEntity in project herd by FINRAOS.
the class CustomDdlDaoTest method testGetCustomDdlByKey.
@Test
public void testGetCustomDdlByKey() {
// 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);
// Retrieve the custom DDL.
CustomDdlEntity resultCustomDdlEntity = customDdlDao.getCustomDdlByKey(new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME));
// Validate the returned object.
assertEquals(customDdlEntity.getId(), resultCustomDdlEntity.getId());
}
use of org.finra.herd.model.jpa.CustomDdlEntity in project herd by FINRAOS.
the class CustomDdlDaoTestHelper method createCustomDdlEntity.
/**
* Creates and persists a new custom DDL entity.
*
* @return the newly created custom DDL entity
*/
public CustomDdlEntity createCustomDdlEntity(BusinessObjectFormatEntity businessObjectFormatEntity, String customDdlName, String ddl) {
CustomDdlEntity customDdlEntity = new CustomDdlEntity();
customDdlEntity.setBusinessObjectFormat(businessObjectFormatEntity);
customDdlEntity.setCustomDdlName(customDdlName);
customDdlEntity.setDdl(ddl);
return customDdlDao.saveAndRefresh(customDdlEntity);
}
Aggregations