Search in sources :

Example 11 with CustomDdlKey

use of org.finra.herd.model.api.xml.CustomDdlKey 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);
}
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 12 with CustomDdlKey

use of org.finra.herd.model.api.xml.CustomDdlKey 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 13 with CustomDdlKey

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

the class CustomDdlRestControllerTest method testCreateCustomDdl.

@Test
public void testCreateCustomDdl() {
    CustomDdlCreateRequest request = customDdlServiceTestHelper.createCustomDdlCreateRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL);
    CustomDdl customDdl = new CustomDdl(ID, new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME), TEST_DDL);
    when(customDdlService.createCustomDdl(request)).thenReturn(customDdl);
    // Create a custom DDL.
    CustomDdl resultCustomDdl = customDdlRestController.createCustomDdl(request);
    // Validate the returned object.
    customDdlServiceTestHelper.validateCustomDdl(null, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL, resultCustomDdl);
    // Verify the external calls.
    verify(customDdlService).createCustomDdl(request);
    verifyNoMoreInteractions(customDdlService);
    // Validate the returned object.
    assertEquals(customDdl, resultCustomDdl);
}
Also used : CustomDdlCreateRequest(org.finra.herd.model.api.xml.CustomDdlCreateRequest) CustomDdl(org.finra.herd.model.api.xml.CustomDdl) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Example 14 with CustomDdlKey

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

the class CustomDdlRestControllerTest method testGetCustomDdl.

@Test
public void testGetCustomDdl() {
    CustomDdl customDdl = new CustomDdl(ID, new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME), TEST_DDL);
    CustomDdlKey customDdlKey = new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME);
    when(customDdlService.getCustomDdl(customDdlKey)).thenReturn(customDdl);
    // Retrieve the custom DDL.
    CustomDdl resultCustomDdl = customDdlRestController.getCustomDdl(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME);
    // Validate the returned object.
    customDdlServiceTestHelper.validateCustomDdl(resultCustomDdl.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL, resultCustomDdl);
    // Verify the external calls.
    verify(customDdlService).getCustomDdl(customDdlKey);
    verifyNoMoreInteractions(customDdlService);
    // Validate the returned object.
    assertEquals(customDdl, resultCustomDdl);
}
Also used : CustomDdl(org.finra.herd.model.api.xml.CustomDdl) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Example 15 with CustomDdlKey

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

the class CustomDdlRestControllerTest method testDeleteCustomDdl.

@Test
public void testDeleteCustomDdl() {
    CustomDdlKey customDdlKey = new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME);
    CustomDdl customDdl = new CustomDdl(ID, customDdlKey, TEST_DDL);
    when(customDdlService.deleteCustomDdl(customDdlKey)).thenReturn(customDdl);
    // Delete this custom DDL.
    CustomDdl deletedCustomDdl = customDdlRestController.deleteCustomDdl(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME);
    // Validate the returned object.
    customDdlServiceTestHelper.validateCustomDdl(customDdl.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, CUSTOM_DDL_NAME, TEST_DDL, deletedCustomDdl);
    // Verify the external calls.
    verify(customDdlService).deleteCustomDdl(customDdlKey);
    verifyNoMoreInteractions(customDdlService);
    // Validate the returned object.
    assertEquals(customDdl, deletedCustomDdl);
}
Also used : CustomDdl(org.finra.herd.model.api.xml.CustomDdl) CustomDdlKey(org.finra.herd.model.api.xml.CustomDdlKey) Test(org.junit.Test)

Aggregations

CustomDdlKey (org.finra.herd.model.api.xml.CustomDdlKey)35 Test (org.junit.Test)29 CustomDdl (org.finra.herd.model.api.xml.CustomDdl)17 CustomDdlEntity (org.finra.herd.model.jpa.CustomDdlEntity)16 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)8 CustomDdlKeys (org.finra.herd.model.api.xml.CustomDdlKeys)5 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)3 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)3 ArrayList (java.util.ArrayList)2 CustomDdlCreateRequest (org.finra.herd.model.api.xml.CustomDdlCreateRequest)2 HashMap (java.util.HashMap)1 Tuple (javax.persistence.Tuple)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 Predicate (javax.persistence.criteria.Predicate)1 BusinessObjectDataDdl (org.finra.herd.model.api.xml.BusinessObjectDataDdl)1 BusinessObjectFormatDdl (org.finra.herd.model.api.xml.BusinessObjectFormatDdl)1 CustomDdlUpdateRequest (org.finra.herd.model.api.xml.CustomDdlUpdateRequest)1 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)1 FileTypeEntity (org.finra.herd.model.jpa.FileTypeEntity)1 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)1