Search in sources :

Example 1 with BusinessObjectDefinitionColumnCreateRequest

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

the class BusinessObjectDefinitionColumnServiceTest method testCreateBusinessObjectDefinitionColumnLowerCaseParameters.

@Test
public void testCreateBusinessObjectDefinitionColumnLowerCaseParameters() {
    // 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 using lower case parameter values.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), BDEF_COLUMN_NAME.toLowerCase()), COLUMN_NAME.toLowerCase(), BDEF_COLUMN_DESCRIPTION.toLowerCase()));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(resultBusinessObjectDefinitionColumn.getId(), new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME.toLowerCase()), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION.toLowerCase(), NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) Test(org.junit.Test)

Example 2 with BusinessObjectDefinitionColumnCreateRequest

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

the class BusinessObjectDefinitionColumnServiceTest method testCreateBusinessObjectDefinitionColumnMissingOptionalParameters.

@Test
public void testCreateBusinessObjectDefinitionColumnMissingOptionalParameters() {
    // 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 without passing optional parameters.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(businessObjectDefinitionColumnKey, COLUMN_NAME, NO_BDEF_COLUMN_DESCRIPTION));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(resultBusinessObjectDefinitionColumn.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, NO_BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) Test(org.junit.Test)

Example 3 with BusinessObjectDefinitionColumnCreateRequest

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

the class BusinessObjectDefinitionColumnServiceTest method testCreateBusinessObjectDefinitionColumnMissingRequiredParameters.

@Test
public void testCreateBusinessObjectDefinitionColumnMissingRequiredParameters() {
    // Try to create a business object definition column when business object definition namespace is not specified.
    try {
        businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BLANK_TEXT, BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
        fail("Should throw an IllegalArgumentException when business object definition namespace is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    // Try to create a business object definition column when business object definition name is not specified.
    try {
        businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BLANK_TEXT, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
        fail("Should throw an IllegalArgumentException when business object definition name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object definition name must be specified.", e.getMessage());
    }
    // Try to create a business object definition column when business object definition column name is not specified.
    try {
        businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BLANK_TEXT), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
        fail("Should throw an IllegalArgumentException when business object definition column name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object definition column name must be specified.", e.getMessage());
    }
    // Try to create a business object definition column when business object definition column name is not specified.
    try {
        businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), BLANK_TEXT, BDEF_COLUMN_DESCRIPTION));
        fail("Should throw an IllegalArgumentException when schema column name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A schema column name must be specified.", e.getMessage());
    }
}
Also used : BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) Test(org.junit.Test)

Example 4 with BusinessObjectDefinitionColumnCreateRequest

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

the class BusinessObjectDefinitionColumnServiceTest method testCreateBusinessObjectDefinitionColumnInvalidParameters.

@Test
public void testCreateBusinessObjectDefinitionColumnInvalidParameters() {
    // Try to create a business object definition column when business object definition namespace contains a forward slash character.
    try {
        businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(addSlash(BDEF_NAMESPACE), BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
        fail("Should throw an IllegalArgumentException when business object definition namespace contains a forward slash character.");
    } catch (IllegalArgumentException e) {
        assertEquals("Namespace can not contain a forward slash character.", e.getMessage());
    }
    // Try to create a business object definition column when business object definition name contains a forward slash character.
    try {
        businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, addSlash(BDEF_NAME), BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
        fail("Should throw an IllegalArgumentException when business object definition name contains a forward slash character.");
    } catch (IllegalArgumentException e) {
        assertEquals("Business object definition name can not contain a forward slash character.", e.getMessage());
    }
    // Try to create a business object definition column when business object definition column name contains a forward slash character.
    try {
        businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, addSlash(BDEF_COLUMN_NAME)), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
        fail("Should throw an IllegalArgumentException when business object definition column name contains a forward slash character.");
    } catch (IllegalArgumentException e) {
        assertEquals("Business object definition column name can not contain a forward slash character.", e.getMessage());
    }
}
Also used : BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) Test(org.junit.Test)

Example 5 with BusinessObjectDefinitionColumnCreateRequest

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

Aggregations

BusinessObjectDefinitionColumnCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest)15 BusinessObjectDefinitionColumnKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey)15 Test (org.junit.Test)15 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)9 BusinessObjectDefinitionColumn (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn)8 BusinessObjectDefinitionColumnChangeEvent (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent)4 BusinessObjectDefinitionColumnEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity)4 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)3 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)2 BusinessObjectDefinitionColumnUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnUpdateRequest)1 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)1 SchemaColumnEntity (org.finra.herd.model.jpa.SchemaColumnEntity)1