Search in sources :

Example 11 with CustomDdl

use of org.finra.herd.model.api.xml.CustomDdl in project herd by FINRAOS.

the class CustomDdlRestControllerTest method testUpdateCustomDdl.

@Test
public void testUpdateCustomDdl() {
    CustomDdlUpdateRequest request = customDdlServiceTestHelper.createCustomDdlUpdateRequest(TEST_DDL_2);
    CustomDdlKey customDdlKey = new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME);
    CustomDdl customDdl = new CustomDdl(ID, new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME), TEST_DDL_2);
    when(customDdlService.updateCustomDdl(customDdlKey, request)).thenReturn(customDdl);
    // Update the custom DDL.
    CustomDdl updatedCustomDdl = customDdlRestController.updateCustomDdl(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, request);
    // Verify the external calls.
    verify(customDdlService).updateCustomDdl(customDdlKey, request);
    verifyNoMoreInteractions(customDdlService);
    // Validate the returned object.
    assertEquals(customDdl, updatedCustomDdl);
}
Also used : CustomDdlUpdateRequest(org.finra.herd.model.api.xml.CustomDdlUpdateRequest) CustomDdl(org.finra.herd.model.api.xml.CustomDdl) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Example 12 with CustomDdl

use of org.finra.herd.model.api.xml.CustomDdl in project herd by FINRAOS.

the class CustomDdlServiceImpl method createCustomDdlFromEntity.

/**
 * Creates the custom DDL from the persisted entity.
 *
 * @param customDdlEntity the custom DDL entity
 *
 * @return the custom DDL
 */
private CustomDdl createCustomDdlFromEntity(CustomDdlEntity customDdlEntity) {
    // Create the custom DDL.
    CustomDdl customDdl = new CustomDdl();
    customDdl.setId(customDdlEntity.getId());
    customDdl.setCustomDdlKey(new CustomDdlKey(customDdlEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode(), customDdlEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName(), customDdlEntity.getBusinessObjectFormat().getUsage(), customDdlEntity.getBusinessObjectFormat().getFileType().getCode(), customDdlEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion(), customDdlEntity.getCustomDdlName()));
    customDdl.setDdl(customDdlEntity.getDdl());
    return customDdl;
}
Also used : CustomDdl(org.finra.herd.model.api.xml.CustomDdl) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey)

Example 13 with CustomDdl

use of org.finra.herd.model.api.xml.CustomDdl in project herd by FINRAOS.

the class CustomDdlServiceTest method testCreateCustomDdlLowerCaseParameters.

@Test
public void testCreateCustomDdlLowerCaseParameters() {
    // Create and persist a business object format entity using upper case values.
    businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, FORMAT_DESCRIPTION.toUpperCase(), true, PARTITION_KEY.toUpperCase());
    // Create a custom DDL using lower case input parameters.
    CustomDdl resultCustomDdl = customDdlService.createCustomDdl(customDdlServiceTestHelper.createCustomDdlCreateRequest(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toLowerCase(), TEST_DDL.toLowerCase()));
    // Validate the returned object.
    customDdlServiceTestHelper.validateCustomDdl(null, NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toLowerCase(), TEST_DDL.toLowerCase(), resultCustomDdl);
}
Also used : CustomDdl(org.finra.herd.model.api.xml.CustomDdl) Test(org.junit.Test)

Example 14 with CustomDdl

use of org.finra.herd.model.api.xml.CustomDdl in project herd by FINRAOS.

the class CustomDdlServiceTest method testUpdateCustomDdlLowerCaseParameters.

@Test
public void testUpdateCustomDdlLowerCaseParameters() {
    // 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());
    // Update the custom DDL using lower case input parameters.
    CustomDdl updatedCustomDdl = customDdlService.updateCustomDdl(new CustomDdlKey(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, CUSTOM_DDL_NAME.toLowerCase()), customDdlServiceTestHelper.createCustomDdlUpdateRequest(TEST_DDL_2.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_2.toLowerCase(), 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 15 with CustomDdl

use of org.finra.herd.model.api.xml.CustomDdl in project herd by FINRAOS.

the class CustomDdlServiceTest method testGetCustomDdlUpperCaseParameters.

@Test
public void testGetCustomDdlUpperCaseParameters() {
    // 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());
    // Get the custom DDL using upper case input parameters.
    CustomDdl resultCustomDdl = customDdlService.getCustomDdl(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(), resultCustomDdl);
}
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

CustomDdl (org.finra.herd.model.api.xml.CustomDdl)21 Test (org.junit.Test)20 CustomDdlKey (org.finra.herd.model.api.xml.CustomDdlKey)17 CustomDdlEntity (org.finra.herd.model.jpa.CustomDdlEntity)12 CustomDdlCreateRequest (org.finra.herd.model.api.xml.CustomDdlCreateRequest)1 CustomDdlUpdateRequest (org.finra.herd.model.api.xml.CustomDdlUpdateRequest)1