Search in sources :

Example 1 with GuaranteeManagersFilter

use of eu.bcvsolutions.idm.core.model.repository.filter.GuaranteeManagersFilter in project CzechIdMng by bcvsolutions.

the class FilterBuilderControllerRestTest method testFindByName.

@Test
public void testFindByName() {
    FilterBuilderFilter filter = new FilterBuilderFilter();
    filter.setName(defaultManagersFilter.getName());
    filter.setEntityClass(IdmIdentity.class.getCanonicalName());
    List<FilterBuilderDto> results = find(filter);
    // 
    Assert.assertFalse(results.isEmpty());
    Assert.assertTrue(results.stream().anyMatch(f -> f.getFilterBuilderClass().equals(AutowireHelper.getTargetClass(defaultManagersFilter))));
    Assert.assertTrue(results.stream().anyMatch(f -> f.getFilterBuilderClass().equals(AutowireHelper.getTargetClass(guaranteeManagersFilter))));
    Assert.assertTrue(results.stream().allMatch(f -> f.getEntityClass().equals(IdmIdentity.class)));
    Assert.assertTrue(results.stream().allMatch(f -> f.getName().equals(defaultManagersFilter.getName())));
    // 
    // not-exists
    filter.setName(getHelper().createName());
    filter.setEntityClass(IdmIdentity.class.getCanonicalName());
    results = find(filter);
    Assert.assertTrue(results.isEmpty());
}
Also used : MockMvcRequestBuilders.put(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put) FilterBuilderFilter(eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Autowired(org.springframework.beans.factory.annotation.Autowired) Test(org.junit.Test) MockMvcResultMatchers.content(org.springframework.test.web.servlet.result.MockMvcResultMatchers.content) GuaranteeManagersFilter(eu.bcvsolutions.idm.core.model.repository.filter.GuaranteeManagersFilter) AutowireHelper(eu.bcvsolutions.idm.core.api.utils.AutowireHelper) List(java.util.List) SecurityMockMvcRequestPostProcessors.authentication(org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication) MockMvcResultMatchers.status(org.springframework.test.web.servlet.result.MockMvcResultMatchers.status) DefaultManagersFilter(eu.bcvsolutions.idm.core.model.repository.filter.DefaultManagersFilter) FilterBuilderDto(eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto) TestHelper(eu.bcvsolutions.idm.test.api.TestHelper) MockMvcRequestBuilders.get(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get) BaseController(eu.bcvsolutions.idm.core.api.rest.BaseController) AbstractRestTest(eu.bcvsolutions.idm.test.api.AbstractRestTest) Assert(org.junit.Assert) Transactional(org.springframework.transaction.annotation.Transactional) 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) AbstractRestTest(eu.bcvsolutions.idm.test.api.AbstractRestTest)

Aggregations

FilterBuilderDto (eu.bcvsolutions.idm.core.api.dto.FilterBuilderDto)1 FilterBuilderFilter (eu.bcvsolutions.idm.core.api.dto.filter.FilterBuilderFilter)1 BaseController (eu.bcvsolutions.idm.core.api.rest.BaseController)1 AutowireHelper (eu.bcvsolutions.idm.core.api.utils.AutowireHelper)1 IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)1 DefaultManagersFilter (eu.bcvsolutions.idm.core.model.repository.filter.DefaultManagersFilter)1 GuaranteeManagersFilter (eu.bcvsolutions.idm.core.model.repository.filter.GuaranteeManagersFilter)1 AbstractRestTest (eu.bcvsolutions.idm.test.api.AbstractRestTest)1 TestHelper (eu.bcvsolutions.idm.test.api.TestHelper)1 List (java.util.List)1 Assert (org.junit.Assert)1 Test (org.junit.Test)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 Transactional (org.springframework.transaction.annotation.Transactional)1