Search in sources :

Example 6 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testDeleteBusinessObjectDefinitionSubjectMatterExpert.

@Test
public void testDeleteBusinessObjectDefinitionSubjectMatterExpert() {
    // Create a business object definition subject matter expert key.
    BusinessObjectDefinitionSubjectMatterExpertKey key = new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID);
    // Create and persist the relative database entities.
    BusinessObjectDefinitionSubjectMatterExpertEntity businessObjectDefinitionSubjectMatterExpertEntity = businessObjectDefinitionSubjectMatterExpertDaoTestHelper.createBusinessObjectDefinitionSubjectMatterExpertEntity(key);
    // Validate that this business object definition subject matter expert exists.
    assertNotNull(businessObjectDefinitionSubjectMatterExpertDao.getBusinessObjectDefinitionSubjectMatterExpertByKey(key));
    // Delete this business object definition subject matter expert.
    BusinessObjectDefinitionSubjectMatterExpert deletedBusinessObjectDefinitionSubjectMatterExpert = businessObjectDefinitionSubjectMatterExpertService.deleteBusinessObjectDefinitionSubjectMatterExpert(key);
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionSubjectMatterExpert(businessObjectDefinitionSubjectMatterExpertEntity.getId(), key), deletedBusinessObjectDefinitionSubjectMatterExpert);
    // Ensure that this business object definition subject matter expert is no longer there.
    assertNull(businessObjectDefinitionSubjectMatterExpertDao.getBusinessObjectDefinitionSubjectMatterExpertByKey(key));
}
Also used : BusinessObjectDefinitionSubjectMatterExpertKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey) BusinessObjectDefinitionSubjectMatterExpert(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpert) BusinessObjectDefinitionSubjectMatterExpertEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionSubjectMatterExpertEntity) Test(org.junit.Test)

Example 7 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testGetBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition.

@Test
public void testGetBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition() throws Exception {
    // Create business object definition subject matter expert keys. The keys are listed out of order to validate the sorting.
    List<BusinessObjectDefinitionSubjectMatterExpertKey> keys = Arrays.asList(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID_2), new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID));
    // Create and persist the relative database entities.
    for (BusinessObjectDefinitionSubjectMatterExpertKey key : keys) {
        businessObjectDefinitionSubjectMatterExpertDaoTestHelper.createBusinessObjectDefinitionSubjectMatterExpertEntity(key);
    }
    // Get a list of business object definition subject matter expert keys for the specified business object definition.
    BusinessObjectDefinitionSubjectMatterExpertKeys resultBusinessObjectDefinitionSubjectMatterExperts = businessObjectDefinitionSubjectMatterExpertService.getBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionSubjectMatterExpertKeys(Arrays.asList(keys.get(1), keys.get(0))), resultBusinessObjectDefinitionSubjectMatterExperts);
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionSubjectMatterExpertKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKeys) BusinessObjectDefinitionSubjectMatterExpertKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey) Test(org.junit.Test)

Example 8 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testGetBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinitionTrimParameters.

@Test
public void testGetBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinitionTrimParameters() {
    // Create and persist business object definition subject matter expert entities.
    businessObjectDefinitionSubjectMatterExpertDaoTestHelper.createBusinessObjectDefinitionSubjectMatterExpertEntity(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID_2));
    businessObjectDefinitionSubjectMatterExpertDaoTestHelper.createBusinessObjectDefinitionSubjectMatterExpertEntity(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID));
    // Get a list of business object definition subject matter expert keys using input parameters with leading and trailing empty spaces.
    BusinessObjectDefinitionSubjectMatterExpertKeys resultBusinessObjectDefinitionSubjectMatterExpertKeys = businessObjectDefinitionSubjectMatterExpertService.getBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition(new BusinessObjectDefinitionKey(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME)));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionSubjectMatterExpertKeys(Arrays.asList(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID), new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID_2))), resultBusinessObjectDefinitionSubjectMatterExpertKeys);
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionSubjectMatterExpertKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKeys) BusinessObjectDefinitionSubjectMatterExpertKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey) Test(org.junit.Test)

Example 9 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertRestControllerTest method testDeleteBusinessObjectDefinitionSubjectMatterExpert.

@Test
public void testDeleteBusinessObjectDefinitionSubjectMatterExpert() {
    // Create a business object definition subject matter expert key.
    BusinessObjectDefinitionSubjectMatterExpertKey key = new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID);
    BusinessObjectDefinitionSubjectMatterExpert businessObjectDefinitionSubjectMatterExpert = new BusinessObjectDefinitionSubjectMatterExpert(ID, key);
    when(businessObjectDefinitionSubjectMatterExpertService.deleteBusinessObjectDefinitionSubjectMatterExpert(key)).thenReturn(businessObjectDefinitionSubjectMatterExpert);
    // Delete this business object definition subject matter expert.
    BusinessObjectDefinitionSubjectMatterExpert deletedBusinessObjectDefinitionSubjectMatterExpert = businessObjectDefinitionSubjectMatterExpertRestController.deleteBusinessObjectDefinitionSubjectMatterExpert(BDEF_NAMESPACE, BDEF_NAME, USER_ID);
    // Verify the external calls.
    verify(businessObjectDefinitionSubjectMatterExpertService).deleteBusinessObjectDefinitionSubjectMatterExpert(key);
    verifyNoMoreInteractions(businessObjectDefinitionSubjectMatterExpertService);
    // Validate the returned object.
    assertEquals(businessObjectDefinitionSubjectMatterExpert, deletedBusinessObjectDefinitionSubjectMatterExpert);
}
Also used : BusinessObjectDefinitionSubjectMatterExpertKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey) BusinessObjectDefinitionSubjectMatterExpert(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpert) Test(org.junit.Test)

Example 10 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertRestControllerTest method testGetBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition.

@Test
public void testGetBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition() throws Exception {
    // Create business object definition subject matter expert keys. The keys are listed out of order to validate the sorting.
    List<BusinessObjectDefinitionSubjectMatterExpertKey> keys = Arrays.asList(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID_2), new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID));
    BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME);
    BusinessObjectDefinitionSubjectMatterExpertKeys businessObjectDefinitionSubjectMatterExpertKeys = new BusinessObjectDefinitionSubjectMatterExpertKeys(keys);
    when(businessObjectDefinitionSubjectMatterExpertService.getBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition(businessObjectDefinitionKey)).thenReturn(businessObjectDefinitionSubjectMatterExpertKeys);
    // Get a list of business object definition subject matter expert keys for the specified business object definition.
    BusinessObjectDefinitionSubjectMatterExpertKeys resultBusinessObjectDefinitionSubjectMatterExperts = businessObjectDefinitionSubjectMatterExpertRestController.getBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition(BDEF_NAMESPACE, BDEF_NAME);
    // Verify the external calls.
    verify(businessObjectDefinitionSubjectMatterExpertService).getBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition(businessObjectDefinitionKey);
    verifyNoMoreInteractions(businessObjectDefinitionSubjectMatterExpertService);
    // Validate the returned object.
    assertEquals(businessObjectDefinitionSubjectMatterExpertKeys, resultBusinessObjectDefinitionSubjectMatterExperts);
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionSubjectMatterExpertKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKeys) BusinessObjectDefinitionSubjectMatterExpertKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionSubjectMatterExpertKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey)23 Test (org.junit.Test)23 BusinessObjectDefinitionSubjectMatterExpert (org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpert)10 BusinessObjectDefinitionSubjectMatterExpertCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertCreateRequest)9 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)5 BusinessObjectDefinitionSubjectMatterExpertKeys (org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKeys)5 BusinessObjectDefinitionSubjectMatterExpertEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionSubjectMatterExpertEntity)5 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)2 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)1 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)1