Search in sources :

Example 11 with FilterBuilderDto

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

the class DefaultFilterManagerUnitTest method testFindByText.

@SuppressWarnings("serial")
@Test
public void testFindByText() {
    FilterBuilderDto dto = new FilterBuilderDto();
    dto.setName("test-x");
    dto.setDescription("x-Test-x");
    dto.setEntityClass(IdmIdentity.class);
    dto.setFilterBuilderClass(IdmIdentityService.class);
    // 
    FilterBuilderFilter filter = new FilterBuilderFilter();
    filter.setText("tesT-");
    Assert.assertTrue(manager.passFilter(dto, filter));
    filter.setText("x-tesT");
    Assert.assertTrue(manager.passFilter(dto, filter));
    filter.setText("xtesT");
    Assert.assertFalse(manager.passFilter(dto, filter));
    dto.setDescription(null);
    filter.setText("x-t");
    Assert.assertFalse(manager.passFilter(dto, filter));
    filter.setText("ident");
    Assert.assertTrue(manager.passFilter(dto, filter));
    filter.setText("service");
    Assert.assertTrue(manager.passFilter(dto, filter));
    // 
    // inline classes with null cannonical name
    dto.setFilterBuilderClass((new IdmIdentity() {
    }).getClass());
    Assert.assertFalse(manager.passFilter(dto, filter));
    filter.setText("ident");
    Assert.assertTrue(manager.passFilter(dto, filter));
}
Also used : FilterBuilderFilter(eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter) FilterBuilderDto(eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 12 with FilterBuilderDto

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

the class DefaultFilterManagerUnitTest method testFindByEntityClass.

@Test
public void testFindByEntityClass() {
    FilterBuilderDto dto = new FilterBuilderDto();
    dto.setModule("test");
    dto.setEntityClass(IdmIdentity.class);
    // 
    FilterBuilderFilter filter = new FilterBuilderFilter();
    filter.setEntityClass(IdmIdentity.class.getCanonicalName());
    Assert.assertTrue(manager.passFilter(dto, filter));
    filter.setEntityClass(IdmIdentity.class.getSimpleName());
    Assert.assertFalse(manager.passFilter(dto, filter));
}
Also used : FilterBuilderFilter(eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter) FilterBuilderDto(eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 13 with FilterBuilderDto

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

the class DefaultFilterManagerUnitTest method testFindById.

@Test(expected = UnsupportedOperationException.class)
public void testFindById() {
    FilterBuilderFilter filter = new FilterBuilderFilter();
    filter.setId(UUID.randomUUID());
    manager.passFilter(new FilterBuilderDto(), filter);
}
Also used : FilterBuilderFilter(eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter) FilterBuilderDto(eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 14 with FilterBuilderDto

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

the class DefaultFilterManagerUnitTest method testFindByName.

@Test
public void testFindByName() {
    FilterBuilderDto dto = new FilterBuilderDto();
    dto.setName("test-x");
    dto.setEntityClass(IdmIdentity.class);
    // 
    FilterBuilderFilter filter = new FilterBuilderFilter();
    filter.setName("test-x");
    Assert.assertTrue(manager.passFilter(dto, filter));
    filter.setName("test-");
    Assert.assertFalse(manager.passFilter(dto, filter));
    filter.setName("test-X");
    Assert.assertFalse(manager.passFilter(dto, filter));
}
Also used : FilterBuilderFilter(eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter) FilterBuilderDto(eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 15 with FilterBuilderDto

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

the class DefaultFilterManagerUnitTest method testFindByModule.

@Test
public void testFindByModule() {
    FilterBuilderDto dto = new FilterBuilderDto();
    dto.setModule("test");
    dto.setEntityClass(IdmIdentity.class);
    // 
    FilterBuilderFilter filter = new FilterBuilderFilter();
    filter.setModule("test");
    Assert.assertTrue(manager.passFilter(dto, filter));
    filter.setModule("tes");
    Assert.assertFalse(manager.passFilter(dto, filter));
}
Also used : FilterBuilderFilter(eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter) FilterBuilderDto(eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

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