Search in sources :

Example 1 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testCreateBusinessObjectDefinitionSubjectMatterExpert.

@Test
public void testCreateBusinessObjectDefinitionSubjectMatterExpert() {
    // 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.
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, DESCRIPTION);
    // Create a business object definition subject matter expert.
    BusinessObjectDefinitionSubjectMatterExpert resultBusinessObjectDefinitionSubjectMatterExpert = businessObjectDefinitionSubjectMatterExpertService.createBusinessObjectDefinitionSubjectMatterExpert(new BusinessObjectDefinitionSubjectMatterExpertCreateRequest(key));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionSubjectMatterExpert(resultBusinessObjectDefinitionSubjectMatterExpert.getId(), key), resultBusinessObjectDefinitionSubjectMatterExpert);
}
Also used : BusinessObjectDefinitionSubjectMatterExpertKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey) BusinessObjectDefinitionSubjectMatterExpert(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpert) BusinessObjectDefinitionSubjectMatterExpertCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertCreateRequest) Test(org.junit.Test)

Example 2 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testGetBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinitionLowerCaseParameters.

@Test
public void testGetBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinitionLowerCaseParameters() {
    // 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 lower case parameter values.
    BusinessObjectDefinitionSubjectMatterExpertKeys resultBusinessObjectDefinitionSubjectMatterExpertKeys = businessObjectDefinitionSubjectMatterExpertService.getBusinessObjectDefinitionSubjectMatterExpertsByBusinessObjectDefinition(new BusinessObjectDefinitionKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase()));
    // 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 3 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testCreateBusinessObjectDefinitionSubjectMatterExpertBusinessObjectDefinitionSubjectMatterExpertAlreadyExists.

@Test
public void testCreateBusinessObjectDefinitionSubjectMatterExpertBusinessObjectDefinitionSubjectMatterExpertAlreadyExists() {
    // Create and persist a business object definition subject matter expert entity.
    businessObjectDefinitionSubjectMatterExpertDaoTestHelper.createBusinessObjectDefinitionSubjectMatterExpertEntity(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID));
    // Try to add a duplicate business object definition subject matter expert.
    for (String userId : Arrays.asList(USER_ID, USER_ID.toUpperCase(), USER_ID.toLowerCase())) {
        try {
            businessObjectDefinitionSubjectMatterExpertService.createBusinessObjectDefinitionSubjectMatterExpert(new BusinessObjectDefinitionSubjectMatterExpertCreateRequest(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, userId)));
            fail();
        } catch (AlreadyExistsException e) {
            assertEquals(String.format("Unable to create business object definition subject matter expert with user id \"%s\" " + "because it already exists for the business object definition {%s}.", userId, businessObjectDefinitionServiceTestHelper.getExpectedBusinessObjectDefinitionKeyAsString(BDEF_NAMESPACE, BDEF_NAME)), e.getMessage());
        }
    }
}
Also used : AlreadyExistsException(org.finra.herd.model.AlreadyExistsException) BusinessObjectDefinitionSubjectMatterExpertKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey) BusinessObjectDefinitionSubjectMatterExpertCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertCreateRequest) Test(org.junit.Test)

Example 4 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testDeleteBusinessObjectDefinitionSubjectMatterExpertTrimParameters.

@Test
public void testDeleteBusinessObjectDefinitionSubjectMatterExpertTrimParameters() {
    // Create a business object definition subject matter expert key.
    BusinessObjectDefinitionSubjectMatterExpertKey key = new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID);
    // Create and persist a business object definition subject matter expert.
    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 using input parameters with leading and trailing empty spaces.
    BusinessObjectDefinitionSubjectMatterExpert deletedBusinessObjectDefinitionSubjectMatterExpert = businessObjectDefinitionSubjectMatterExpertService.deleteBusinessObjectDefinitionSubjectMatterExpert(new BusinessObjectDefinitionSubjectMatterExpertKey(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(USER_ID)));
    // 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 5 with BusinessObjectDefinitionSubjectMatterExpertKey

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

the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testCreateBusinessObjectDefinitionSubjectMatterExpertInvalidParameters.

@Test
public void testCreateBusinessObjectDefinitionSubjectMatterExpertInvalidParameters() {
    // Try to create a business object definition subject matter expert when business object definition namespace contains a forward slash character.
    try {
        businessObjectDefinitionSubjectMatterExpertService.createBusinessObjectDefinitionSubjectMatterExpert(new BusinessObjectDefinitionSubjectMatterExpertCreateRequest(new BusinessObjectDefinitionSubjectMatterExpertKey(addSlash(BDEF_NAMESPACE), BDEF_NAME, USER_ID)));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("Namespace can not contain a forward slash character.", e.getMessage());
    }
    // Try to create a business object definition subject matter expert when business object definition name contains a forward slash character.
    try {
        businessObjectDefinitionSubjectMatterExpertService.createBusinessObjectDefinitionSubjectMatterExpert(new BusinessObjectDefinitionSubjectMatterExpertCreateRequest(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, addSlash(BDEF_NAME), USER_ID)));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("Business object definition name can not contain a forward slash character.", e.getMessage());
    }
    // Try to create a business object definition subject matter expert when user id contains a forward slash character.
    try {
        businessObjectDefinitionSubjectMatterExpertService.createBusinessObjectDefinitionSubjectMatterExpert(new BusinessObjectDefinitionSubjectMatterExpertCreateRequest(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, addSlash(USER_ID))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("User id can not contain a forward slash character.", e.getMessage());
    }
}
Also used : BusinessObjectDefinitionSubjectMatterExpertKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertKey) BusinessObjectDefinitionSubjectMatterExpertCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionSubjectMatterExpertCreateRequest) 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