Search in sources :

Example 6 with BusinessObjectDefinitionColumnKey

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

the class BusinessObjectDefinitionColumnServiceTest method testUpdateBusinessObjectDefinitionColumnTrimParameters.

@Test
public void testUpdateBusinessObjectDefinitionColumnTrimParameters() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create and persist a business object definition column.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_DESCRIPTION);
    // 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 that is linked with the business object definition column.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
    // Update the business object definition column using input parameters with leading and trailing empty spaces.
    BusinessObjectDefinitionColumn updatedBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.updateBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(BDEF_COLUMN_NAME)), new BusinessObjectDefinitionColumnUpdateRequest(addWhitespace(BDEF_COLUMN_DESCRIPTION_2)));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, addWhitespace(BDEF_COLUMN_DESCRIPTION_2), NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), updatedBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) 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)

Example 7 with BusinessObjectDefinitionColumnKey

use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey 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 8 with BusinessObjectDefinitionColumnKey

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

the class BusinessObjectDefinitionColumnServiceTest method testUpdateBusinessObjectDefinitionColumn.

@Test
public void testUpdateBusinessObjectDefinitionColumn() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create and persist a business object definition column.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_DESCRIPTION);
    // 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 that is linked with the business object definition column.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
    // Update the business object definition column.
    businessObjectDefinitionColumnService.updateBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, new BusinessObjectDefinitionColumnUpdateRequest(BDEF_COLUMN_DESCRIPTION_2));
    // Get the business object definition column.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, false);
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION_2, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) 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)

Example 9 with BusinessObjectDefinitionColumnKey

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

the class BusinessObjectDefinitionColumnServiceTest method testDeleteBusinessObjectDefinitionColumnUpperCaseParameters.

@Test
public void testDeleteBusinessObjectDefinitionColumnUpperCaseParameters() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create and persist a business object definition column.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_DESCRIPTION);
    // 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 that is linked with the business object definition column.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
    // Validate that this business object definition column exists.
    assertNotNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(businessObjectDefinitionColumnKey));
    // Delete this business object definition column using upper case parameter values.
    BusinessObjectDefinitionColumn deletedBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.deleteBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), BDEF_COLUMN_NAME.toUpperCase()));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), deletedBusinessObjectDefinitionColumn);
    // Ensure that this business object definition column is no longer there.
    assertNull(businessObjectDefinitionColumnDao.getBusinessObjectDefinitionColumnByKey(businessObjectDefinitionColumnKey));
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) 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 10 with BusinessObjectDefinitionColumnKey

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

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