Search in sources :

Example 21 with DataFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.DataFilter 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)

Example 22 with DataFilter

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

the class DefaultFilterManagerIntegrationTest method testFilterNotSupportedCheckDisabled.

@Test
public void testFilterNotSupportedCheckDisabled() {
    try {
        configurationService.setBooleanValue(FilterManager.PROPERTY_CHECK_SUPPORTED_FILTER_ENABLED, false);
        DataFilter filter = new DataFilter(IdmConfigurationDto.class);
        filter.set("wrong", "mock");
        Page<IdmConfigurationDto> configurations = configurationService.find(filter, null);
        // 
        Assert.assertNotNull(configurations);
    } finally {
        configurationService.setBooleanValue(FilterManager.PROPERTY_CHECK_SUPPORTED_FILTER_ENABLED, FilterManager.DEFAULT_CHECK_SUPPORTED_FILTER_ENABLED);
    }
}
Also used : DataFilter(eu.bcvsolutions.idm.core.api.dto.filter.DataFilter) IdmConfigurationDto(eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Aggregations

DataFilter (eu.bcvsolutions.idm.core.api.dto.filter.DataFilter)22 Test (org.junit.Test)17 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)12 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)7 IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)7 IdmConfigurationDto (eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto)6 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)6 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)4 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)3 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)3 IdmIdentityFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)3 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)3 IdmBulkActionDto (eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto)2 ExternalCodeable (eu.bcvsolutions.idm.core.api.domain.ExternalCodeable)2 FilterBuilder (eu.bcvsolutions.idm.core.api.repository.filter.FilterBuilder)2 IdmIdentityService (eu.bcvsolutions.idm.core.api.service.IdmIdentityService)2 AbstractRestTest (eu.bcvsolutions.idm.test.api.AbstractRestTest)2 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 Lists (com.google.common.collect.Lists)1