Search in sources :

Example 1 with CustomDdlKeys

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

the class CustomDdlServiceImpl method getCustomDdls.

/**
 * Gets a list of keys for all existing custom DDLs.
 *
 * @return the custom DDL keys
 */
@NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public CustomDdlKeys getCustomDdls(BusinessObjectFormatKey businessObjectFormatKey) {
    // Validate and trim the business object format key.
    businessObjectFormatHelper.validateBusinessObjectFormatKey(businessObjectFormatKey);
    // Ensure that the business object format exists.
    businessObjectFormatDaoHelper.getBusinessObjectFormatEntity(businessObjectFormatKey);
    // Create and populate a list of custom DDL keys.
    CustomDdlKeys customDdlKeys = new CustomDdlKeys();
    customDdlKeys.getCustomDdlKeys().addAll(customDdlDao.getCustomDdls(businessObjectFormatKey));
    return customDdlKeys;
}
Also used : CustomDdlKeys(org.finra.herd.model.api.xml.CustomDdlKeys) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 2 with CustomDdlKeys

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

the class CustomDdlServiceTest method testGetCustomDdls.

@Test
public void testGetCustomDdls() {
    // 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.
    for (String customDdlName : testCustomDdlNames) {
        customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, customDdlName, TEST_DDL);
    }
    // Retrieve a list of custom DDL keys.
    CustomDdlKeys resultCustomDdlKeys = customDdlService.getCustomDdls(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, 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, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, testCustomDdlNames.get(i)), resultCustomDdlKeys.getCustomDdlKeys().get(i));
    }
}
Also used : CustomDdlKeys(org.finra.herd.model.api.xml.CustomDdlKeys) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Example 3 with CustomDdlKeys

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

the class CustomDdlServiceTest method testGetCustomDdlsTrimParameters.

@Test
public void testGetCustomDdlsTrimParameters() {
    // 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.
    for (String customDdlName : testCustomDdlNames) {
        customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, customDdlName, TEST_DDL);
    }
    // Retrieve a list of custom DDL keys using input parameters with leading and trailing empty spaces.
    CustomDdlKeys resultCustomDdlKeys = customDdlService.getCustomDdls(new BusinessObjectFormatKey(addWhitespace(NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(FORMAT_USAGE_CODE), addWhitespace(FORMAT_FILE_TYPE_CODE), 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, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, testCustomDdlNames.get(i)), resultCustomDdlKeys.getCustomDdlKeys().get(i));
    }
}
Also used : CustomDdlKeys(org.finra.herd.model.api.xml.CustomDdlKeys) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Example 4 with CustomDdlKeys

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

the class CustomDdlRestControllerTest method testGetCustomDdls.

@Test
public void testGetCustomDdls() {
    BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION);
    CustomDdlKeys customDdlKeys = new CustomDdlKeys(Arrays.asList(new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, "ddl")));
    when(customDdlService.getCustomDdls(businessObjectFormatKey)).thenReturn(customDdlKeys);
    // Retrieve a list of custom DDL keys.
    CustomDdlKeys resultCustomDdlKeys = customDdlRestController.getCustomDdls(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION);
    // Verify the external calls.
    verify(customDdlService).getCustomDdls(businessObjectFormatKey);
    verifyNoMoreInteractions(customDdlService);
    // Validate the returned object.
    assertEquals(customDdlKeys, resultCustomDdlKeys);
}
Also used : CustomDdlKeys(org.finra.herd.model.api.xml.CustomDdlKeys) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Example 5 with CustomDdlKeys

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

the class CustomDdlServiceTest method testGetCustomDdlsUpperCaseParameters.

@Test
public void testGetCustomDdlsUpperCaseParameters() {
    // 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 lower case values.
    for (String customDdlName : testCustomDdlNames) {
        customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, customDdlName.toLowerCase(), TEST_DDL.toLowerCase());
    }
    // Retrieve a list of custom DDL keys using upper case input parameters.
    CustomDdlKeys resultCustomDdlKeys = customDdlService.getCustomDdls(new BusinessObjectFormatKey(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), 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.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, testCustomDdlNames.get(i).toLowerCase()), resultCustomDdlKeys.getCustomDdlKeys().get(i));
    }
}
Also used : CustomDdlKeys(org.finra.herd.model.api.xml.CustomDdlKeys) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Aggregations

CustomDdlKeys (org.finra.herd.model.api.xml.CustomDdlKeys)7 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)6 Test (org.junit.Test)6 CustomDdlKey (org.finra.herd.model.api.xml.CustomDdlKey)5 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1