Search in sources :

Example 6 with BusinessObjectDefinitionSearchResponse

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

the class BusinessObjectDefinitionServiceTest method testSearchBusinessObjectDefinitionValidParams.

@Test
public void testSearchBusinessObjectDefinitionValidParams() {
    // Set up test data.
    Set<BusinessObjectDefinition> expectedBusinessObjectDefinitions = setUpTestEntitiesForSearchTesting();
    // Retrieve the actual business object definition objects from the search response.
    BusinessObjectDefinitionSearchResponse searchResponse = businessObjectDefinitionService.searchBusinessObjectDefinitions(new BusinessObjectDefinitionSearchRequest(Arrays.asList(new BusinessObjectDefinitionSearchFilter(NO_EXCLUSION_SEARCH_FILTER, Arrays.asList(new BusinessObjectDefinitionSearchKey(new TagKey(TAG_TYPE, TAG_CODE), INCLUDE_TAG_HIERARCHY))))), Sets.newHashSet(FIELD_DATA_PROVIDER_NAME, FIELD_DISPLAY_NAME, FIELD_SHORT_DESCRIPTION));
    Set<BusinessObjectDefinition> actualBusinessObjectDefinitions = new HashSet<>(searchResponse.getBusinessObjectDefinitions());
    assertEquals(expectedBusinessObjectDefinitions, actualBusinessObjectDefinitions);
}
Also used : BusinessObjectDefinition(org.finra.herd.model.api.xml.BusinessObjectDefinition) BusinessObjectDefinitionSearchKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchRequest) BusinessObjectDefinitionSearchFilter(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchFilter) BusinessObjectDefinitionSearchResponse(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchResponse) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 7 with BusinessObjectDefinitionSearchResponse

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

the class BusinessObjectDefinitionServiceTest method testSearchBusinessObjectDefinitionsOnlyDataProviderName.

@Test
public void testSearchBusinessObjectDefinitionsOnlyDataProviderName() {
    // Set up test data.
    Set<BusinessObjectDefinition> expectedBusinessObjectDefinitions = setUpTestEntitiesForSearchTesting();
    // Remove fields which are not expected from the expected business object definition objects.
    for (BusinessObjectDefinition businessObjectDefinition : expectedBusinessObjectDefinitions) {
        businessObjectDefinition.setDisplayName(null);
        businessObjectDefinition.setShortDescription(null);
    }
    // Retrieve the actual business object definition objects from the search response.
    BusinessObjectDefinitionSearchResponse searchResponse = businessObjectDefinitionService.searchBusinessObjectDefinitions(new BusinessObjectDefinitionSearchRequest(Arrays.asList(new BusinessObjectDefinitionSearchFilter(NO_EXCLUSION_SEARCH_FILTER, Arrays.asList(new BusinessObjectDefinitionSearchKey(new TagKey(TAG_TYPE, TAG_CODE), INCLUDE_TAG_HIERARCHY))))), Sets.newHashSet(FIELD_DATA_PROVIDER_NAME));
    Set<BusinessObjectDefinition> actualBusinessObjectDefinitions = new HashSet<>(searchResponse.getBusinessObjectDefinitions());
    assertEquals(actualBusinessObjectDefinitions, expectedBusinessObjectDefinitions);
}
Also used : BusinessObjectDefinition(org.finra.herd.model.api.xml.BusinessObjectDefinition) BusinessObjectDefinitionSearchKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchRequest) BusinessObjectDefinitionSearchFilter(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchFilter) BusinessObjectDefinitionSearchResponse(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchResponse) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 8 with BusinessObjectDefinitionSearchResponse

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

the class BusinessObjectDefinitionRestControllerTest method testSearchBusinessObjectDefinition.

@Test
public void testSearchBusinessObjectDefinition() {
    // Create a business object definition search request.
    BusinessObjectDefinitionSearchRequest request = new BusinessObjectDefinitionSearchRequest(Arrays.asList(new BusinessObjectDefinitionSearchFilter(EXCLUSION_SEARCH_FILTER, Arrays.asList(new BusinessObjectDefinitionSearchKey(new TagKey(TAG_TYPE, TAG_CODE), INCLUDE_TAG_HIERARCHY)))));
    // Create a business object definition.
    BusinessObjectDefinition businessObjectDefinition = new BusinessObjectDefinition(ID, BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, SHORT_DESCRIPTION, BDEF_DISPLAY_NAME, Arrays.asList(new Attribute(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1)), new DescriptiveBusinessObjectFormat(FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION), Arrays.asList(new SampleDataFile(DIRECTORY_PATH, FILE_NAME)), CREATED_BY, UPDATED_BY, UPDATED_ON, NO_BUSINESS_OBJECT_DEFINITION_CHANGE_EVENTS);
    // Create a business object definition search response.
    BusinessObjectDefinitionSearchResponse businessObjectDefinitionSearchResponse = new BusinessObjectDefinitionSearchResponse(Arrays.asList(businessObjectDefinition));
    // Create a set of search optional fields.
    Set<String> fields = Sets.newHashSet(FIELD_DATA_PROVIDER_NAME, FIELD_DISPLAY_NAME, FIELD_SHORT_DESCRIPTION);
    // Mock the external calls.
    when(businessObjectDefinitionService.searchBusinessObjectDefinitions(request, fields)).thenReturn(businessObjectDefinitionSearchResponse);
    // Call the method under test.
    BusinessObjectDefinitionSearchResponse result = businessObjectDefinitionSearchResponse = businessObjectDefinitionRestController.searchBusinessObjectDefinitions(fields, request);
    // Verify the external calls.
    verify(businessObjectDefinitionService).searchBusinessObjectDefinitions(request, fields);
    verifyNoMoreInteractions(businessObjectDefinitionService);
    // Validate the results.
    assertEquals(businessObjectDefinitionSearchResponse, result);
}
Also used : BusinessObjectDefinitionSearchKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchKey) BusinessObjectDefinition(org.finra.herd.model.api.xml.BusinessObjectDefinition) SampleDataFile(org.finra.herd.model.api.xml.SampleDataFile) DescriptiveBusinessObjectFormat(org.finra.herd.model.api.xml.DescriptiveBusinessObjectFormat) Attribute(org.finra.herd.model.api.xml.Attribute) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchRequest) BusinessObjectDefinitionSearchFilter(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchFilter) BusinessObjectDefinitionSearchResponse(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchResponse) Test(org.junit.Test)

Example 9 with BusinessObjectDefinitionSearchResponse

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

the class BusinessObjectDefinitionServiceTest method testSearchBusinessObjectDefinitionsOnlyShortDescriptionAndDisplayName.

@Test
public void testSearchBusinessObjectDefinitionsOnlyShortDescriptionAndDisplayName() {
    // Set up test data.
    Set<BusinessObjectDefinition> expectedBusinessObjectDefinitions = setUpTestEntitiesForSearchTesting();
    // Remove fields which are not expected from the expected business object definition objects.
    for (BusinessObjectDefinition businessObjectDefinition : expectedBusinessObjectDefinitions) {
        businessObjectDefinition.setDataProviderName(null);
    }
    // Retrieve the actual business object definition objects from the search response.
    BusinessObjectDefinitionSearchResponse searchResponse = businessObjectDefinitionService.searchBusinessObjectDefinitions(new BusinessObjectDefinitionSearchRequest(Arrays.asList(new BusinessObjectDefinitionSearchFilter(NO_EXCLUSION_SEARCH_FILTER, Arrays.asList(new BusinessObjectDefinitionSearchKey(new TagKey(TAG_TYPE, TAG_CODE), INCLUDE_TAG_HIERARCHY))))), Sets.newHashSet(FIELD_SHORT_DESCRIPTION, FIELD_DISPLAY_NAME));
    Set<BusinessObjectDefinition> actualBusinessObjectDefinitions = new HashSet<>(searchResponse.getBusinessObjectDefinitions());
    assertEquals(actualBusinessObjectDefinitions, expectedBusinessObjectDefinitions);
}
Also used : BusinessObjectDefinition(org.finra.herd.model.api.xml.BusinessObjectDefinition) BusinessObjectDefinitionSearchKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchRequest) BusinessObjectDefinitionSearchFilter(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchFilter) BusinessObjectDefinitionSearchResponse(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchResponse) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 10 with BusinessObjectDefinitionSearchResponse

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

the class BusinessObjectDefinitionServiceTest method testSearchBusinessObjectDefinitionsMissingOptionalParams.

@Test
public void testSearchBusinessObjectDefinitionsMissingOptionalParams() {
    // Set up test data.
    Set<BusinessObjectDefinition> expectedBusinessObjectDefinitions = setUpTestEntitiesForSearchTesting();
    // Remove fields which are not expected from the expected business object definition objects.
    for (BusinessObjectDefinition businessObjectDefinition : expectedBusinessObjectDefinitions) {
        businessObjectDefinition.setDisplayName(null);
        businessObjectDefinition.setShortDescription(null);
        businessObjectDefinition.setDataProviderName(null);
    }
    // Retrieve the actual business object definition objects from the search response.
    // Fields are required to have a blank text value because that is set by default in the controller.
    BusinessObjectDefinitionSearchResponse searchResponse = businessObjectDefinitionService.searchBusinessObjectDefinitions(new BusinessObjectDefinitionSearchRequest(Arrays.asList(new BusinessObjectDefinitionSearchFilter(NO_EXCLUSION_SEARCH_FILTER, Arrays.asList(new BusinessObjectDefinitionSearchKey(new TagKey(TAG_TYPE, TAG_CODE), INCLUDE_TAG_HIERARCHY))))), Sets.newHashSet(BLANK_TEXT));
    Set<BusinessObjectDefinition> actualBusinessObjectDefinitions = new HashSet<>(searchResponse.getBusinessObjectDefinitions());
    assertEquals(actualBusinessObjectDefinitions, expectedBusinessObjectDefinitions);
}
Also used : BusinessObjectDefinition(org.finra.herd.model.api.xml.BusinessObjectDefinition) BusinessObjectDefinitionSearchKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchRequest) BusinessObjectDefinitionSearchFilter(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchFilter) BusinessObjectDefinitionSearchResponse(org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchResponse) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

BusinessObjectDefinition (org.finra.herd.model.api.xml.BusinessObjectDefinition)14 BusinessObjectDefinitionSearchResponse (org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchResponse)14 BusinessObjectDefinitionSearchKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchKey)13 BusinessObjectDefinitionSearchRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchRequest)13 Test (org.junit.Test)13 HashSet (java.util.HashSet)12 BusinessObjectDefinitionSearchFilter (org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchFilter)12 TagKey (org.finra.herd.model.api.xml.TagKey)12 ArrayList (java.util.ArrayList)1 Attribute (org.finra.herd.model.api.xml.Attribute)1 DescriptiveBusinessObjectFormat (org.finra.herd.model.api.xml.DescriptiveBusinessObjectFormat)1 SampleDataFile (org.finra.herd.model.api.xml.SampleDataFile)1 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)1 TagEntity (org.finra.herd.model.jpa.TagEntity)1