Search in sources :

Example 6 with CustomDdl

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

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

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

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

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

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