Search in sources :

Example 21 with BusinessObjectDefinitionColumnKey

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

the class BusinessObjectDefinitionColumnDaoTest method testGetBusinessObjectDefinitionColumnByKey.

@Test
public void testGetBusinessObjectDefinitionColumnByKey() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create a business object definition column entity.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_DESCRIPTION);
    // Get business object definition column.
    assertEquals(businessObjectDefinitionColumnEntity, businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(businessObjectDefinitionColumnKey));
    // Get business object definition column by passing all case-insensitive parameters in uppercase.
    assertEquals(businessObjectDefinitionColumnEntity, businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), BDEF_COLUMN_NAME.toUpperCase())));
    // Get business object definition column by passing all case-insensitive parameters in lowercase.
    assertEquals(businessObjectDefinitionColumnEntity, businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), BDEF_COLUMN_NAME.toLowerCase())));
    // Try invalid values for all input parameters.
    assertNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(new BusinessObjectDefinitionColumnKey("I_DO_NOT_EXIST", BDEF_NAME, BDEF_COLUMN_NAME)));
    assertNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, "I_DO_NOT_EXIST", BDEF_COLUMN_NAME)));
    assertNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, "I_DO_NOT_EXIST")));
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) Test(org.junit.Test)

Example 22 with BusinessObjectDefinitionColumnKey

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

the class BusinessObjectDefinitionColumnDaoTest method testGetBusinessObjectDefinitionColumnByKeyDuplicateColumns.

@Test
public void testGetBusinessObjectDefinitionColumnByKeyDuplicateColumns() throws Exception {
    // Create a business object definition entity.
    BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION);
    // Create duplicate business object definition columns.
    businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionEntity, BDEF_COLUMN_NAME.toUpperCase(), DESCRIPTION);
    businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionEntity, BDEF_COLUMN_NAME.toLowerCase(), DESCRIPTION_2);
    // Try to get business object definition column when business object definition has duplicate columns.
    try {
        businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME));
        fail("Should throw an IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
        assertEquals(String.format("Found more than one business object definition column instance with parameters {namespace=\"%s\", " + "businessObjectDefinitionName=\"%s\", businessObjectDefinitionColumnName=\"%s\"}.", BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), e.getMessage());
    }
}
Also used : BusinessObjectDefinitionEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionEntity) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) Test(org.junit.Test)

Example 23 with BusinessObjectDefinitionColumnKey

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

the class BusinessObjectDefinitionColumnDaoTest method testGetBusinessObjectDefinitionColumnByBusinessObjectDefinitionColumnName.

@Test
public void testGetBusinessObjectDefinitionColumnByBusinessObjectDefinitionColumnName() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create a business object definition column entity.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_DESCRIPTION);
    // Get the business object definition entity.
    BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionColumnEntity.getBusinessObjectDefinition();
    // Get business object definition column.
    assertEquals(businessObjectDefinitionColumnEntity, businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByBusinessObjectDefinitionColumnName(businessObjectDefinitionEntity, BDEF_COLUMN_NAME));
    // Get business object definition column by passing all case-insensitive parameters in uppercase.
    assertEquals(businessObjectDefinitionColumnEntity, businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByBusinessObjectDefinitionColumnName(businessObjectDefinitionEntity, BDEF_COLUMN_NAME.toUpperCase()));
    // Get business object definition column by passing all case-insensitive parameters in lowercase.
    assertEquals(businessObjectDefinitionColumnEntity, businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByBusinessObjectDefinitionColumnName(businessObjectDefinitionEntity, BDEF_COLUMN_NAME.toLowerCase()));
    // Try invalid values for all input parameters.
    assertNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByBusinessObjectDefinitionColumnName(businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME_2, DATA_PROVIDER_NAME, DESCRIPTION), BDEF_COLUMN_NAME));
    assertNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByBusinessObjectDefinitionColumnName(businessObjectDefinitionEntity, "I_DO_NOT_EXIST"));
}
Also used : BusinessObjectDefinitionEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionEntity) BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) Test(org.junit.Test)

Example 24 with BusinessObjectDefinitionColumnKey

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

the class BusinessObjectDefinitionHelperTest method testGetBusinessObjectDefinitionKey.

@Test
public void testGetBusinessObjectDefinitionKey() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Get a business object definition key from the column key.
    BusinessObjectDefinitionKey response = businessObjectDefinitionHelper.getBusinessObjectDefinitionKey(businessObjectDefinitionColumnKey);
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), response);
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest) Test(org.junit.Test)

Example 25 with BusinessObjectDefinitionColumnKey

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

the class BusinessObjectDefinitionColumnRestControllerTest method testGetBusinessObjectDefinitionColumns.

@Test
public void testGetBusinessObjectDefinitionColumns() {
    // Create and persist business object definition column entities.
    businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), DESCRIPTION_2);
    businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), DESCRIPTION);
    BusinessObjectDefinitionColumnKeys businessObjectDefinitionColumnKeys = new BusinessObjectDefinitionColumnKeys(Lists.newArrayList(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2)));
    BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME);
    when(businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumns(businessObjectDefinitionKey)).thenReturn(businessObjectDefinitionColumnKeys);
    // Get a list of business object definition column keys.
    BusinessObjectDefinitionColumnKeys resultBusinessObjectDefinitionColumnKeys = businessObjectDefinitionColumnRestController.getBusinessObjectDefinitionColumns(BDEF_NAMESPACE, BDEF_NAME);
    // Verify the external calls.
    verify(businessObjectDefinitionColumnService).getBusinessObjectDefinitionColumns(businessObjectDefinitionKey);
    verifyNoMoreInteractions(businessObjectDefinitionColumnService);
    // Validate the returned object.
    assertEquals(businessObjectDefinitionColumnKeys, resultBusinessObjectDefinitionColumnKeys);
}
Also used : BusinessObjectDefinitionColumnKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKeys) BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionColumnKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey)55 Test (org.junit.Test)54 BusinessObjectDefinitionColumn (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn)32 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)23 BusinessObjectDefinitionColumnEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity)20 BusinessObjectDefinitionColumnCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest)15 BusinessObjectDefinitionColumnChangeEvent (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent)9 BusinessObjectDefinitionColumnUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnUpdateRequest)9 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)6 BusinessObjectDefinitionColumnSearchFilter (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchFilter)6 BusinessObjectDefinitionColumnSearchKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchKey)6 BusinessObjectDefinitionColumnSearchRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchRequest)6 BusinessObjectDefinitionColumnSearchResponse (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchResponse)6 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)6 BusinessObjectDefinitionColumnKeys (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKeys)5 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)3 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)2 SchemaColumnEntity (org.finra.herd.model.jpa.SchemaColumnEntity)1 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)1