use of eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter 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));
}
use of eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter 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));
}
use of eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter 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);
}
use of eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter 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));
}
use of eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter 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));
}
Aggregations