Search in sources :

Example 16 with FilterBuilderDto

use of eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto in project CzechIdMng by bcvsolutions.

the class DefaultFilterManagerIntegrationTest method testGetNullPredicate.

/**
 * Test all registered filters - filter has to be checked for null values.
 */
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testGetNullPredicate() throws Exception {
    for (FilterBuilderDto filterBuilderDto : filterManager.find(null)) {
        FilterBuilder filterBuilder = filterManager.getBuilder(filterBuilderDto.getEntityClass(), filterBuilderDto.getName());
        if (filterBuilder == null) {
            // ~ service impl
            continue;
        }
        if (!DataFilter.class.isAssignableFrom(filterBuilderDto.getFilterClass())) {
            // ~ not registrable
            continue;
        }
        if (DataFilter.class.equals(filterBuilderDto.getFilterClass())) {
            // TODO: construct abstract data filter
            continue;
        }
        // 
        Class<? extends DataFilter> filterClass = (Class<? extends DataFilter>) filterBuilderDto.getFilterClass();
        Assert.assertNull(filterBuilder.getPredicate(null, null, null, filterClass.getDeclaredConstructor().newInstance()));
    }
}
Also used : DataFilter(eu.bcvsolutions.idm.core.api.dto.filter.DataFilter) FilterBuilderDto(eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto) FilterBuilder(eu.bcvsolutions.idm.core.api.repository.filter.FilterBuilder) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Aggregations

FilterBuilderDto (eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto)16 Test (org.junit.Test)11 FilterBuilderFilter (eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter)10 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)8 IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)4 FilterBuilder (eu.bcvsolutions.idm.core.api.repository.filter.FilterBuilder)2 FilterKey (eu.bcvsolutions.idm.core.api.repository.filter.FilterKey)2 AbstractRestTest (eu.bcvsolutions.idm.test.api.AbstractRestTest)2 HashMap (java.util.HashMap)2 List (java.util.List)2 DataFilter (eu.bcvsolutions.idm.core.api.dto.filter.DataFilter)1 DisabledFilterBuilder (eu.bcvsolutions.idm.core.api.repository.filter.DisabledFilterBuilder)1 BaseController (eu.bcvsolutions.idm.core.api.rest.BaseController)1 IdmIdentityService (eu.bcvsolutions.idm.core.api.service.IdmIdentityService)1 ReadDtoService (eu.bcvsolutions.idm.core.api.service.ReadDtoService)1 AutowireHelper (eu.bcvsolutions.idm.core.api.utils.AutowireHelper)1 AbstractFormValueService (eu.bcvsolutions.idm.core.eav.service.impl.AbstractFormValueService)1 DefaultManagersFilter (eu.bcvsolutions.idm.core.model.repository.filter.DefaultManagersFilter)1 GuaranteeManagersFilter (eu.bcvsolutions.idm.core.model.repository.filter.GuaranteeManagersFilter)1 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)1