Search in sources :

Example 16 with BusinessObjectDataSearchRequest

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

the class SearchBusinessObjectDataTest method testSearchBusinessObjectDataWithBadParameter.

@Test
public void testSearchBusinessObjectDataWithBadParameter() throws Exception {
    this.businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataSearchTesting();
    BusinessObjectDataSearchRequest businessObjectDataSearchRequest = getBusinessObjectDataSearchRequest();
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataSearchRequest", "${businessObjectDataSearchRequest}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("contentType", "bad_type"));
    parameters.add(buildParameter("businessObjectDataSearchRequest", jsonHelper.objectToJson(businessObjectDataSearchRequest)));
    String expectedBadFormatMessage = "\"ContentType\" must be a valid value of either \"xml\" or \"json\".";
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(ActivitiRuntimeHelper.VARIABLE_ERROR_MESSAGE, expectedBadFormatMessage);
    testActivitiServiceTaskFailure(SearchBusinessObjectData.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : HashMap(java.util.HashMap) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) BusinessObjectDataSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDataSearchRequest) Test(org.junit.Test)

Example 17 with BusinessObjectDataSearchRequest

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

the class BusinessObjectDataSearchServiceTest method testSearchBusinessObjectDataWithAttributeFilterValuesWithMixedCaseAndSpace.

@Test
public void testSearchBusinessObjectDataWithAttributeFilterValuesWithMixedCaseAndSpace() {
    businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataSearchTesting();
    businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
    BusinessObjectDataSearchRequest request = new BusinessObjectDataSearchRequest();
    List<BusinessObjectDataSearchFilter> filters = new ArrayList<>();
    List<BusinessObjectDataSearchKey> businessObjectDataSearchKeys = new ArrayList<>();
    BusinessObjectDataSearchKey key = new BusinessObjectDataSearchKey();
    key.setNamespace(NAMESPACE);
    key.setBusinessObjectDefinitionName(BDEF_NAME);
    List<AttributeValueFilter> attributeValueFilters = new ArrayList<>();
    attributeValueFilters.add(new AttributeValueFilter("  " + ATTRIBUTE_NAME_1_MIXED_CASE.toLowerCase() + "  ", ATTRIBUTE_VALUE_1));
    key.setAttributeValueFilters(attributeValueFilters);
    businessObjectDataSearchKeys.add(key);
    BusinessObjectDataSearchFilter filter = new BusinessObjectDataSearchFilter(businessObjectDataSearchKeys);
    filters.add(filter);
    request.setBusinessObjectDataSearchFilters(filters);
    BusinessObjectDataSearchResultPagingInfoDto result = businessObjectDataService.searchBusinessObjectData(DEFAULT_PAGE_NUMBER, PAGE_SIZE, request);
    List<BusinessObjectData> resultList = result.getBusinessObjectDataSearchResult().getBusinessObjectDataElements();
    assertEquals(1, resultList.size());
    for (BusinessObjectData data : resultList) {
        assertEquals(NAMESPACE, data.getNamespace());
        assertEquals(BDEF_NAME, data.getBusinessObjectDefinitionName());
        assertEquals(ATTRIBUTE_NAME_1_MIXED_CASE, data.getAttributes().get(0).getName());
        assertEquals(ATTRIBUTE_VALUE_1, data.getAttributes().get(0).getValue());
    }
    // Validate the paging information.
    assertEquals(Long.valueOf(DEFAULT_PAGE_NUMBER), result.getPageNum());
    assertEquals(Long.valueOf(PAGE_SIZE), result.getPageSize());
    assertEquals(Long.valueOf(1), result.getPageCount());
    assertEquals(Long.valueOf(1), result.getTotalRecordsOnPage());
    assertEquals(Long.valueOf(1), result.getTotalRecordCount());
    assertEquals(Long.valueOf(DEFAULT_PAGE_SIZE), result.getMaxResultsPerPage());
}
Also used : BusinessObjectDataSearchResultPagingInfoDto(org.finra.herd.model.dto.BusinessObjectDataSearchResultPagingInfoDto) BusinessObjectDataSearchFilter(org.finra.herd.model.api.xml.BusinessObjectDataSearchFilter) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) ArrayList(java.util.ArrayList) BusinessObjectDataSearchKey(org.finra.herd.model.api.xml.BusinessObjectDataSearchKey) BusinessObjectDataSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDataSearchRequest) AttributeValueFilter(org.finra.herd.model.api.xml.AttributeValueFilter) Test(org.junit.Test)

Example 18 with BusinessObjectDataSearchRequest

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

the class BusinessObjectDataSearchServiceTest method testSearchBusinessObjectDataWithAttributeFilterValues.

@Test
public void testSearchBusinessObjectDataWithAttributeFilterValues() {
    businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataSearchTesting();
    businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
    BusinessObjectDataSearchRequest request = new BusinessObjectDataSearchRequest();
    List<BusinessObjectDataSearchFilter> filters = new ArrayList<>();
    List<BusinessObjectDataSearchKey> businessObjectDataSearchKeys = new ArrayList<>();
    BusinessObjectDataSearchKey key = new BusinessObjectDataSearchKey();
    key.setNamespace(NAMESPACE);
    key.setBusinessObjectDefinitionName(BDEF_NAME);
    List<AttributeValueFilter> attributeValueFilters = new ArrayList<>();
    attributeValueFilters.add(new AttributeValueFilter(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1));
    key.setAttributeValueFilters(attributeValueFilters);
    businessObjectDataSearchKeys.add(key);
    BusinessObjectDataSearchFilter filter = new BusinessObjectDataSearchFilter(businessObjectDataSearchKeys);
    filters.add(filter);
    request.setBusinessObjectDataSearchFilters(filters);
    BusinessObjectDataSearchResultPagingInfoDto result = businessObjectDataService.searchBusinessObjectData(DEFAULT_PAGE_NUMBER, PAGE_SIZE, request);
    List<BusinessObjectData> resultList = result.getBusinessObjectDataSearchResult().getBusinessObjectDataElements();
    assertEquals(1, resultList.size());
    for (BusinessObjectData data : resultList) {
        assertEquals(NAMESPACE, data.getNamespace());
        assertEquals(BDEF_NAME, data.getBusinessObjectDefinitionName());
        assertEquals(ATTRIBUTE_NAME_1_MIXED_CASE, data.getAttributes().get(0).getName());
        assertEquals(ATTRIBUTE_VALUE_1, data.getAttributes().get(0).getValue());
    }
    // Validate the paging information.
    assertEquals(Long.valueOf(DEFAULT_PAGE_NUMBER), result.getPageNum());
    assertEquals(Long.valueOf(PAGE_SIZE), result.getPageSize());
    assertEquals(Long.valueOf(1), result.getPageCount());
    assertEquals(Long.valueOf(1), result.getTotalRecordsOnPage());
    assertEquals(Long.valueOf(1), result.getTotalRecordCount());
    assertEquals(Long.valueOf(DEFAULT_PAGE_SIZE), result.getMaxResultsPerPage());
}
Also used : BusinessObjectDataSearchResultPagingInfoDto(org.finra.herd.model.dto.BusinessObjectDataSearchResultPagingInfoDto) BusinessObjectDataSearchFilter(org.finra.herd.model.api.xml.BusinessObjectDataSearchFilter) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) ArrayList(java.util.ArrayList) BusinessObjectDataSearchKey(org.finra.herd.model.api.xml.BusinessObjectDataSearchKey) BusinessObjectDataSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDataSearchRequest) AttributeValueFilter(org.finra.herd.model.api.xml.AttributeValueFilter) Test(org.junit.Test)

Example 19 with BusinessObjectDataSearchRequest

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

the class RetentionExpirationExporterWebClientTest method testSearchBusinessObjectDataPageNum1.

@Test
public void testSearchBusinessObjectDataPageNum1() throws Exception {
    retentionExpirationExporterWebClient.getRegServerAccessParamsDto().setUseSsl(false);
    BusinessObjectDataSearchResult result = retentionExpirationExporterWebClient.searchBusinessObjectData(new BusinessObjectDataSearchRequest(), 1);
    assertNotNull(result);
    assertEquals(2, CollectionUtils.size(result.getBusinessObjectDataElements()));
}
Also used : BusinessObjectDataSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDataSearchRequest) BusinessObjectDataSearchResult(org.finra.herd.model.api.xml.BusinessObjectDataSearchResult) Test(org.junit.Test)

Example 20 with BusinessObjectDataSearchRequest

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

the class RetentionExpirationExporterWebClientTest method testSearchBusinessObjectDataPageNum2.

@Test
public void testSearchBusinessObjectDataPageNum2() throws Exception {
    retentionExpirationExporterWebClient.getRegServerAccessParamsDto().setUseSsl(false);
    BusinessObjectDataSearchResult result = retentionExpirationExporterWebClient.searchBusinessObjectData(new BusinessObjectDataSearchRequest(), 2);
    assertNotNull(result);
    assertEquals(0, CollectionUtils.size(result.getBusinessObjectDataElements()));
}
Also used : BusinessObjectDataSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDataSearchRequest) BusinessObjectDataSearchResult(org.finra.herd.model.api.xml.BusinessObjectDataSearchResult) Test(org.junit.Test)

Aggregations

BusinessObjectDataSearchRequest (org.finra.herd.model.api.xml.BusinessObjectDataSearchRequest)21 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)13 BusinessObjectDataSearchFilter (org.finra.herd.model.api.xml.BusinessObjectDataSearchFilter)12 BusinessObjectDataSearchKey (org.finra.herd.model.api.xml.BusinessObjectDataSearchKey)12 BusinessObjectDataSearchResultPagingInfoDto (org.finra.herd.model.dto.BusinessObjectDataSearchResultPagingInfoDto)10 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)6 BusinessObjectDataSearchResult (org.finra.herd.model.api.xml.BusinessObjectDataSearchResult)5 HashMap (java.util.HashMap)4 AttributeValueFilter (org.finra.herd.model.api.xml.AttributeValueFilter)4 FieldExtension (org.activiti.bpmn.model.FieldExtension)3 Parameter (org.finra.herd.model.api.xml.Parameter)3 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 BusinessObjectDefinition (org.finra.herd.model.api.xml.BusinessObjectDefinition)1 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)1