Search in sources :

Example 16 with RelationalTableRegistrationCreateRequest

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

the class RelationalTableRegistrationServiceTest method testRelationalTableRegistrationServiceMethodsNewTransactionPropagation.

/**
 * This unit test is to get coverage for the methods that have an explicit annotation for transaction propagation.
 */
@Test
public void testRelationalTableRegistrationServiceMethodsNewTransactionPropagation() {
    try {
        relationalTableRegistrationServiceImpl.createRelationalTableRegistration(new RelationalTableRegistrationCreateRequest(), APPEND_TO_EXISTING_BUSINESS_OBJECT_DEFINTION_FALSE);
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
}
Also used : RelationalTableRegistrationCreateRequest(org.finra.herd.model.api.xml.RelationalTableRegistrationCreateRequest) Test(org.junit.Test)

Example 17 with RelationalTableRegistrationCreateRequest

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

the class RelationalTableRegistrationRestControllerTest method testRelationalTableRegistrationRestController.

@Test
public void testRelationalTableRegistrationRestController() {
    RelationalTableRegistrationCreateRequest createRequest = new RelationalTableRegistrationCreateRequest();
    createRequest.setNamespace(BDEF_NAMESPACE);
    createRequest.setDataProviderName(DATA_PROVIDER_NAME);
    createRequest.setBusinessObjectDefinitionName(BDEF_NAME);
    createRequest.setBusinessObjectFormatUsage(FORMAT_USAGE_CODE);
    createRequest.setRelationalTableName(RELATIONAL_TABLE_NAME);
    createRequest.setStorageName(STORAGE_NAME);
    BusinessObjectData businessObjectData = new BusinessObjectData();
    businessObjectData.setId(businessObjectData.getId());
    businessObjectData.setNamespace(BDEF_NAMESPACE);
    businessObjectData.setBusinessObjectDefinitionName(BDEF_NAME);
    businessObjectData.setBusinessObjectFormatUsage(FORMAT_USAGE_CODE);
    businessObjectData.setVersion(0);
    businessObjectData.setStatus("VALID");
    businessObjectData.setLatestVersion(true);
    businessObjectData.setBusinessObjectFormatFileType(FileTypeEntity.RELATIONAL_TABLE_FILE_TYPE);
    businessObjectData.setPartitionValue(BusinessObjectDataServiceImpl.NO_PARTITIONING_PARTITION_VALUE);
    businessObjectData.setPartitionKey(BusinessObjectDataServiceImpl.NO_PARTITIONING_PARTITION_KEY);
    when(relationalTableRegistrationService.createRelationalTableRegistration(createRequest, APPEND_TO_EXISTING_BUSINESS_OBJECT_DEFINTION_FALSE)).thenReturn(businessObjectData);
    BusinessObjectData returnedBusinessObjectData = relationalTableRegistrationRestController.createRelationalTableRegistration(createRequest, APPEND_TO_EXISTING_BUSINESS_OBJECT_DEFINTION_FALSE);
    // Verify the external calls.
    verify(relationalTableRegistrationService).createRelationalTableRegistration(createRequest, APPEND_TO_EXISTING_BUSINESS_OBJECT_DEFINTION_FALSE);
    verifyNoMoreInteractions(relationalTableRegistrationService);
    // Validate the returned object.
    assertEquals(businessObjectData, returnedBusinessObjectData);
}
Also used : RelationalTableRegistrationCreateRequest(org.finra.herd.model.api.xml.RelationalTableRegistrationCreateRequest) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) Test(org.junit.Test)

Aggregations

RelationalTableRegistrationCreateRequest (org.finra.herd.model.api.xml.RelationalTableRegistrationCreateRequest)17 Test (org.junit.Test)17 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)5 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)4 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)4 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)3 Attribute (org.finra.herd.model.api.xml.Attribute)2 BusinessObjectFormat (org.finra.herd.model.api.xml.BusinessObjectFormat)2 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)2 Schema (org.finra.herd.model.api.xml.Schema)2 Storage (org.finra.herd.model.api.xml.Storage)2 StorageUnit (org.finra.herd.model.api.xml.StorageUnit)2 BusinessObjectDefinition (org.finra.herd.model.api.xml.BusinessObjectDefinition)1 RelationalStorageAttributesDto (org.finra.herd.model.dto.RelationalStorageAttributesDto)1 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)1