Search in sources :

Example 6 with FilterBuilderFilter

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));
}
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 7 with FilterBuilderFilter

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));
}
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 8 with FilterBuilderFilter

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);
}
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 9 with FilterBuilderFilter

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));
}
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 10 with FilterBuilderFilter

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));
}
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)10 FilterBuilderFilter (eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter)10 Test (org.junit.Test)10 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)8 IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)4 AbstractRestTest (eu.bcvsolutions.idm.test.api.AbstractRestTest)2 BaseController (eu.bcvsolutions.idm.core.api.rest.BaseController)1 IdmIdentityService (eu.bcvsolutions.idm.core.api.service.IdmIdentityService)1 AutowireHelper (eu.bcvsolutions.idm.core.api.utils.AutowireHelper)1 DefaultManagersFilter (eu.bcvsolutions.idm.core.model.repository.filter.DefaultManagersFilter)1 GuaranteeManagersFilter (eu.bcvsolutions.idm.core.model.repository.filter.GuaranteeManagersFilter)1 TestHelper (eu.bcvsolutions.idm.test.api.TestHelper)1 List (java.util.List)1 Assert (org.junit.Assert)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 SecurityMockMvcRequestPostProcessors.authentication (org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication)1 MockMvcRequestBuilders.get (org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get)1 MockMvcRequestBuilders.put (org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put)1 MockMvcResultMatchers.content (org.springframework.test.web.servlet.result.MockMvcResultMatchers.content)1 MockMvcResultMatchers.status (org.springframework.test.web.servlet.result.MockMvcResultMatchers.status)1