Search in sources :

Example 1 with BusinessObjectFormatKeys

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

the class BusinessObjectFormatServiceImpl method getBusinessObjectFormats.

@Override
public BusinessObjectFormatKeys getBusinessObjectFormats(BusinessObjectDefinitionKey businessObjectDefinitionKey, boolean latestBusinessObjectFormatVersion) {
    // Perform validation and trim.
    businessObjectDefinitionHelper.validateBusinessObjectDefinitionKey(businessObjectDefinitionKey);
    // Ensure that a business object definition already exists with the specified name.
    businessObjectDefinitionDaoHelper.getBusinessObjectDefinitionEntity(businessObjectDefinitionKey);
    // Gets the list of keys and return them.
    BusinessObjectFormatKeys businessObjectFormatKeys = new BusinessObjectFormatKeys();
    businessObjectFormatKeys.getBusinessObjectFormatKeys().addAll(businessObjectFormatDao.getBusinessObjectFormats(businessObjectDefinitionKey, latestBusinessObjectFormatVersion));
    return businessObjectFormatKeys;
}
Also used : BusinessObjectFormatKeys(org.finra.herd.model.api.xml.BusinessObjectFormatKeys)

Example 2 with BusinessObjectFormatKeys

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

the class BusinessObjectFormatServiceTest method testGetBusinessObjectFormatsMissingOptionalParameters.

@Test
public void testGetBusinessObjectFormatsMissingOptionalParameters() {
    // Create and persist the relative business object definitions.
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    // Create and persist business object format entities.
    for (BusinessObjectFormatKey key : businessObjectFormatDaoTestHelper.getTestBusinessObjectFormatKeys()) {
        businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(key.getNamespace(), key.getBusinessObjectDefinitionName(), key.getBusinessObjectFormatUsage(), key.getBusinessObjectFormatFileType(), key.getBusinessObjectFormatVersion(), FORMAT_DESCRIPTION, false, PARTITION_KEY);
    }
    // Retrieve a list of business object format keys for the specified business object
    // definition without passing the latestBusinessObjectFormatVersion flag.
    BusinessObjectFormatKeys resultKeys = businessObjectFormatService.getBusinessObjectFormats(new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME), false);
    // Validate the returned object.
    assertEquals(businessObjectFormatDaoTestHelper.getExpectedBusinessObjectFormatKeys(), resultKeys.getBusinessObjectFormatKeys());
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) BusinessObjectFormatKeys(org.finra.herd.model.api.xml.BusinessObjectFormatKeys) Test(org.junit.Test)

Example 3 with BusinessObjectFormatKeys

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

the class BusinessObjectFormatServiceTest method testGetBusinessObjectFormats.

@Test
public void testGetBusinessObjectFormats() {
    // Create and persist the relative business object definitions.
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    // Create and persist business object format entities.
    for (BusinessObjectFormatKey key : businessObjectFormatDaoTestHelper.getTestBusinessObjectFormatKeys()) {
        businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(key.getNamespace(), key.getBusinessObjectDefinitionName(), key.getBusinessObjectFormatUsage(), key.getBusinessObjectFormatFileType(), key.getBusinessObjectFormatVersion(), FORMAT_DESCRIPTION, false, PARTITION_KEY);
    }
    // Retrieve a list of business object format keys for the specified business object definition.
    BusinessObjectFormatKeys resultKeys = businessObjectFormatService.getBusinessObjectFormats(new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME), false);
    // Validate the returned object.
    assertEquals(businessObjectFormatDaoTestHelper.getExpectedBusinessObjectFormatKeys(), resultKeys.getBusinessObjectFormatKeys());
    // Retrieve a list of the latest version business object format keys for the specified business object definition.
    resultKeys = businessObjectFormatService.getBusinessObjectFormats(new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME), true);
    // Validate the returned object.
    assertEquals(businessObjectFormatDaoTestHelper.getExpectedBusinessObjectFormatLatestVersionKeys(), resultKeys.getBusinessObjectFormatKeys());
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) BusinessObjectFormatKeys(org.finra.herd.model.api.xml.BusinessObjectFormatKeys) Test(org.junit.Test)

Example 4 with BusinessObjectFormatKeys

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

the class BusinessObjectFormatServiceTest method testGetBusinessObjectFormatsLowerCaseParameters.

@Test
public void testGetBusinessObjectFormatsLowerCaseParameters() {
    // Create and persist the relative business object definitions.
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
    // Create and persist business object format entities.
    for (BusinessObjectFormatKey key : businessObjectFormatDaoTestHelper.getTestBusinessObjectFormatKeys()) {
        businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(key.getNamespace(), key.getBusinessObjectDefinitionName(), key.getBusinessObjectFormatUsage(), key.getBusinessObjectFormatFileType(), key.getBusinessObjectFormatVersion(), FORMAT_DESCRIPTION, false, PARTITION_KEY);
    }
    // Retrieve a list of business object format keys for the specified business object definition using lower case input parameters.
    BusinessObjectFormatKeys resultKeys = businessObjectFormatService.getBusinessObjectFormats(new BusinessObjectDefinitionKey(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase()), false);
    // Validate the returned object.
    assertEquals(businessObjectFormatDaoTestHelper.getExpectedBusinessObjectFormatKeys(), resultKeys.getBusinessObjectFormatKeys());
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) BusinessObjectFormatKeys(org.finra.herd.model.api.xml.BusinessObjectFormatKeys) Test(org.junit.Test)

Example 5 with BusinessObjectFormatKeys

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

the class BusinessObjectFormatRestControllerTest method testGetBusinessObjectFormatsWithFilters.

@Test
public void testGetBusinessObjectFormatsWithFilters() {
    BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME);
    BusinessObjectFormatKeys businessObjectFormatKeys = new BusinessObjectFormatKeys(Arrays.asList(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, INITIAL_FORMAT_VERSION), new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME_2, BDEF_DESCRIPTION, INITIAL_FORMAT_VERSION)));
    when(businessObjectFormatService.getBusinessObjectFormatsWithFilters(businessObjectDefinitionKey, FORMAT_USAGE_CODE, false)).thenReturn(businessObjectFormatKeys);
    // Retrieve a list of business object format keys for the specified business object definition.
    BusinessObjectFormatKeys resultKeys = businessObjectFormatRestController.getBusinessObjectFormatsWithFilters(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, false);
    // Verify the external calls.
    verify(businessObjectFormatService).getBusinessObjectFormatsWithFilters(businessObjectDefinitionKey, FORMAT_USAGE_CODE, false);
    verifyNoMoreInteractions(businessObjectFormatService);
    // Validate the returned object.
    assertEquals(businessObjectFormatKeys, resultKeys);
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) BusinessObjectFormatKeys(org.finra.herd.model.api.xml.BusinessObjectFormatKeys) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest) Test(org.junit.Test)

Aggregations

BusinessObjectFormatKeys (org.finra.herd.model.api.xml.BusinessObjectFormatKeys)10 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)8 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)8 Test (org.junit.Test)8 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)2