Search in sources :

Example 6 with BusinessObjectDefinitionColumnChangeEvent

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

the class BusinessObjectDefinitionColumnRestControllerTest method testUpdateBusinessObjectDefinitionColumn.

@Test
public void testUpdateBusinessObjectDefinitionColumn() {
    // Create business object definition change event
    List<BusinessObjectDefinitionColumnChangeEvent> businessObjectDefinitionColumnChangeEvents = Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, CREATED_ON, CREATED_BY));
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    BusinessObjectDefinitionColumnUpdateRequest request = new BusinessObjectDefinitionColumnUpdateRequest(BDEF_COLUMN_DESCRIPTION_2);
    BusinessObjectDefinitionColumn businessObjectDefinitionColumn = new BusinessObjectDefinitionColumn(ID, businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, businessObjectDefinitionColumnChangeEvents);
    when(businessObjectDefinitionColumnService.updateBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, request)).thenReturn(businessObjectDefinitionColumn);
    // Update the business object definition column.
    BusinessObjectDefinitionColumn updatedBusinessObjectDefinitionColumn = businessObjectDefinitionColumnRestController.updateBusinessObjectDefinitionColumn(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME, request);
    // Verify the external calls.
    verify(businessObjectDefinitionColumnService).updateBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, request);
    verifyNoMoreInteractions(businessObjectDefinitionColumnService);
    // Validate the returned object.
    assertEquals(businessObjectDefinitionColumn, updatedBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectDefinitionColumnUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnUpdateRequest) Test(org.junit.Test)

Example 7 with BusinessObjectDefinitionColumnChangeEvent

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

the class BusinessObjectDefinitionColumnRestControllerTest method testCreateBusinessObjectDefinitionColumn.

@Test
public void testCreateBusinessObjectDefinitionColumn() {
    // Create business object definition change event
    List<BusinessObjectDefinitionColumnChangeEvent> businessObjectDefinitionColumnChangeEvents = Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, CREATED_ON, CREATED_BY));
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    BusinessObjectDefinitionColumn businessObjectDefinitionColumn = new BusinessObjectDefinitionColumn(ID, businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, businessObjectDefinitionColumnChangeEvents);
    BusinessObjectDefinitionColumnCreateRequest businessObjectDefinitionColumnCreateRequest = new BusinessObjectDefinitionColumnCreateRequest(businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION);
    when(businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(businessObjectDefinitionColumnCreateRequest)).thenReturn(businessObjectDefinitionColumn);
    // Create a business object definition column.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnRestController.createBusinessObjectDefinitionColumn(businessObjectDefinitionColumnCreateRequest);
    // Verify the external calls.
    verify(businessObjectDefinitionColumnService).createBusinessObjectDefinitionColumn(businessObjectDefinitionColumnCreateRequest);
    verifyNoMoreInteractions(businessObjectDefinitionColumnService);
    // Validate the returned object.
    assertEquals(businessObjectDefinitionColumn, resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) Test(org.junit.Test)

Example 8 with BusinessObjectDefinitionColumnChangeEvent

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

the class BusinessObjectDefinitionColumnServiceTest method testGetBusinessObjectDefinitionColumnWithChangeEvents.

@Test
public void testGetBusinessObjectDefinitionColumnWithChangeEvents() {
    // Create and persist a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    // Create and persist a schema column for this business object format.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME);
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create a business object definition column.
    businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
    // Get the business object definition column entity.
    BusinessObjectDefinitionColumnEntity resultBusinessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
    // Get the business object definition column.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, true);
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(resultBusinessObjectDefinitionColumn.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, resultBusinessObjectDefinitionColumn.getBusinessObjectDefinitionColumnChangeEvents().get(0).getEventTime(), resultBusinessObjectDefinitionColumnEntity.getCreatedBy()))), resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) Test(org.junit.Test)

Example 9 with BusinessObjectDefinitionColumnChangeEvent

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

the class BusinessObjectDefinitionColumnServiceTest method testCreateBusinessObjectDefinitionColumn.

@Test
public void testCreateBusinessObjectDefinitionColumn() {
    // Create and persist a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    // Create and persist a schema column for this business object format.
    SchemaColumnEntity schemaColumnEntity = schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME);
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create a business object definition column.
    businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
    // Get the business object definition column entity.
    BusinessObjectDefinitionColumnEntity resultBusinessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
    // Get the business object definition column.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, true);
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(resultBusinessObjectDefinitionColumn.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, resultBusinessObjectDefinitionColumn.getBusinessObjectDefinitionColumnChangeEvents().get(0).getEventTime(), resultBusinessObjectDefinitionColumnEntity.getCreatedBy()))), resultBusinessObjectDefinitionColumn);
    // Validate that the schema column is now linked with the business object definition column.
    assertEquals(Long.valueOf(resultBusinessObjectDefinitionColumn.getId()), Long.valueOf(schemaColumnEntity.getBusinessObjectDefinitionColumn().getId()));
}
Also used : SchemaColumnEntity(org.finra.herd.model.jpa.SchemaColumnEntity) BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) Test(org.junit.Test)

Example 10 with BusinessObjectDefinitionColumnChangeEvent

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

the class BusinessObjectDefinitionColumnServiceTest method testGetBusinessObjectDefinitionColumnWithChangeEventsWithUpdate.

@Test
public void testGetBusinessObjectDefinitionColumnWithChangeEventsWithUpdate() {
    // Create and persist a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    // Create and persist a schema column for this business object format.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME);
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create a business object definition column.
    businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
    // Get the created business object definition column entity.
    BusinessObjectDefinitionColumnEntity resultBusinessObjectDefinitionColumnEntityCreated = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
    // Update a business object definition column.
    businessObjectDefinitionColumnService.updateBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, new BusinessObjectDefinitionColumnUpdateRequest(BDEF_COLUMN_DESCRIPTION_2));
    // Get the updated business object definition column entity.
    BusinessObjectDefinitionColumnEntity resultBusinessObjectDefinitionColumnEntityUpdated = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
    // Get the business object definition column.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, true);
    // Build the expected business object definition column change events list.
    List<BusinessObjectDefinitionColumnChangeEvent> expectedBusinessObjectDefinitionColumnChangeEvents = Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION_2, resultBusinessObjectDefinitionColumn.getBusinessObjectDefinitionColumnChangeEvents().get(0).getEventTime(), resultBusinessObjectDefinitionColumnEntityUpdated.getCreatedBy()), new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, resultBusinessObjectDefinitionColumn.getBusinessObjectDefinitionColumnChangeEvents().get(1).getEventTime(), resultBusinessObjectDefinitionColumnEntityCreated.getCreatedBy()));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(resultBusinessObjectDefinitionColumn.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION_2, expectedBusinessObjectDefinitionColumnChangeEvents), resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) BusinessObjectDefinitionColumnUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnUpdateRequest) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionColumn (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn)10 BusinessObjectDefinitionColumnChangeEvent (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent)10 BusinessObjectDefinitionColumnKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey)9 Test (org.junit.Test)9 BusinessObjectDefinitionColumnCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest)4 BusinessObjectDefinitionColumnEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity)3 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)3 BusinessObjectDefinitionColumnUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnUpdateRequest)2 BusinessObjectDefinitionColumnSearchFilter (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchFilter)1 BusinessObjectDefinitionColumnSearchKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchKey)1 BusinessObjectDefinitionColumnSearchRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchRequest)1 BusinessObjectDefinitionColumnSearchResponse (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchResponse)1 SchemaColumnEntity (org.finra.herd.model.jpa.SchemaColumnEntity)1