Search in sources :

Example 21 with CustomDdlEntity

use of org.finra.herd.model.jpa.CustomDdlEntity 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));
}
Also used : CustomDdlEntity(org.finra.herd.model.jpa.CustomDdlEntity) CustomDdl(org.finra.herd.model.api.xml.CustomDdl) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Example 22 with CustomDdlEntity

use of org.finra.herd.model.jpa.CustomDdlEntity 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);
}
Also used : CustomDdlEntity(org.finra.herd.model.jpa.CustomDdlEntity) CustomDdl(org.finra.herd.model.api.xml.CustomDdl) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Example 23 with CustomDdlEntity

use of org.finra.herd.model.jpa.CustomDdlEntity 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));
}
Also used : CustomDdlEntity(org.finra.herd.model.jpa.CustomDdlEntity) CustomDdl(org.finra.herd.model.api.xml.CustomDdl) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Aggregations

CustomDdlEntity (org.finra.herd.model.jpa.CustomDdlEntity)23 CustomDdlKey (org.finra.herd.model.api.xml.CustomDdlKey)16 Test (org.junit.Test)13 CustomDdl (org.finra.herd.model.api.xml.CustomDdl)12 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)5 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)4 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)3 ArrayList (java.util.ArrayList)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)2 Predicate (javax.persistence.criteria.Predicate)2 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)2 FileTypeEntity (org.finra.herd.model.jpa.FileTypeEntity)2 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)2 HashMap (java.util.HashMap)1 Tuple (javax.persistence.Tuple)1 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)1 BusinessObjectDataDdl (org.finra.herd.model.api.xml.BusinessObjectDataDdl)1 BusinessObjectFormatDdl (org.finra.herd.model.api.xml.BusinessObjectFormatDdl)1 StorageEntity (org.finra.herd.model.jpa.StorageEntity)1 DdlGenerator (org.finra.herd.service.helper.DdlGenerator)1