Search in sources :

Example 66 with Assert.assertTrue

use of org.junit.Assert.assertTrue in project CzechIdMng by bcvsolutions.

the class DefaultFormServiceIntegrationTest method testMinMaxValidation.

@Test
public void testMinMaxValidation() {
    // prepare form definition a test saving form values
    IdmFormAttributeDto attributeDouble = new IdmFormAttributeDto();
    String attributeDoubleName = getHelper().createName();
    attributeDouble.setCode(attributeDoubleName);
    attributeDouble.setName(attributeDoubleName);
    attributeDouble.setPersistentType(PersistentType.DOUBLE);
    attributeDouble.setMin(new BigDecimal("0.5"));
    attributeDouble.setMax(new BigDecimal("0.7"));
    IdmFormAttributeDto attributeLong = new IdmFormAttributeDto();
    String attributeLongName = getHelper().createName();
    attributeLong.setCode(attributeLongName);
    attributeLong.setName(attributeLongName);
    attributeLong.setPersistentType(PersistentType.LONG);
    attributeLong.setMin(new BigDecimal("10"));
    attributeLong.setMax(new BigDecimal("20"));
    IdmFormAttributeDto attributeInt = new IdmFormAttributeDto();
    String attributeIntName = getHelper().createName();
    attributeInt.setCode(attributeIntName);
    attributeInt.setName(attributeIntName);
    attributeInt.setPersistentType(PersistentType.INT);
    attributeInt.setMin(new BigDecimal("10.1"));
    attributeInt.setMax(new BigDecimal("20"));
    IdmFormDefinitionDto formDefinitionOne = formService.createDefinition(IdmIdentity.class.getCanonicalName(), getHelper().createName(), Lists.newArrayList(attributeDouble, attributeInt, attributeLong));
    attributeDouble = formDefinitionOne.getMappedAttributeByCode(attributeDouble.getCode());
    attributeInt = formDefinitionOne.getMappedAttributeByCode(attributeInt.getCode());
    attributeLong = formDefinitionOne.getMappedAttributeByCode(attributeLong.getCode());
    // 
    IdmFormValueDto valueDouble = new IdmFormValueDto(attributeDouble);
    IdmFormValueDto valueInt = new IdmFormValueDto(attributeInt);
    IdmFormValueDto valueLong = new IdmFormValueDto(attributeLong);
    // 
    IdmFormInstanceDto formInstance = new IdmFormInstanceDto();
    formInstance.setFormDefinition(formDefinitionOne);
    formInstance.setValues(Lists.newArrayList(valueDouble, valueInt, valueLong));
    // 
    List<InvalidFormAttributeDto> validationErrors = formService.validate(formInstance);
    // 
    Assert.assertTrue(validationErrors.isEmpty());
    // 
    valueDouble.setDoubleValue(new BigDecimal("0.4"));
    valueInt.setLongValue(4L);
    valueLong.setLongValue(4L);
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertEquals(3, validationErrors.size());
    Assert.assertTrue(validationErrors.stream().allMatch(e -> e.getMinValue() != null));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMinValue().equals(new BigDecimal("0.5")) && e.getAttributeCode().equals(attributeDoubleName)));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMinValue().equals(new BigDecimal("10.1")) && e.getAttributeCode().equals(attributeIntName)));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMinValue().equals(new BigDecimal("10")) && e.getAttributeCode().equals(attributeLongName)));
    // 
    valueDouble.setDoubleValue(new BigDecimal("0.8"));
    valueInt.setLongValue(40L);
    valueLong.setLongValue(40L);
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertEquals(3, validationErrors.size());
    Assert.assertTrue(validationErrors.stream().allMatch(e -> e.getMaxValue() != null));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMaxValue().equals(new BigDecimal("0.7")) && e.getAttributeCode().equals(attributeDoubleName)));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMaxValue().equals(new BigDecimal("20")) && e.getAttributeCode().equals(attributeIntName)));
    Assert.assertTrue(validationErrors.stream().anyMatch(e -> e.getMaxValue().equals(new BigDecimal("20")) && e.getAttributeCode().equals(attributeLongName)));
    // 
    valueDouble.setDoubleValue(new BigDecimal("0.5"));
    valueInt.setLongValue(11L);
    valueLong.setLongValue(10L);
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertTrue(validationErrors.isEmpty());
    // 
    valueDouble.setDoubleValue(new BigDecimal("0.7"));
    valueInt.setLongValue(20L);
    valueLong.setLongValue(20L);
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertTrue(validationErrors.isEmpty());
    // 
    valueDouble.setDoubleValue(new BigDecimal("0.6"));
    valueInt.setLongValue(15L);
    valueLong.setLongValue(15L);
    // 
    validationErrors = formService.validate(formInstance);
    Assert.assertTrue(validationErrors.isEmpty());
}
Also used : IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmEntityEventDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto) ZonedDateTime(java.time.ZonedDateTime) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) FormDefinitionCache(eu.bcvsolutions.idm.core.eav.api.domain.FormDefinitionCache) IdmRoleFormValue_(eu.bcvsolutions.idm.core.model.entity.eav.IdmRoleFormValue_) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) BigDecimal(java.math.BigDecimal) CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) Predicate(javax.persistence.criteria.Predicate) IdmFormDefinition(eu.bcvsolutions.idm.core.eav.entity.IdmFormDefinition) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) Map(java.util.Map) ChangePersistentTypeException(eu.bcvsolutions.idm.core.eav.api.exception.ChangePersistentTypeException) IdmIdentityFormValue(eu.bcvsolutions.idm.core.model.entity.eav.IdmIdentityFormValue) CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) IdmFormAttributeService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormAttributeService) IdentityEventType(eu.bcvsolutions.idm.core.model.event.IdentityEvent.IdentityEventType) Sort(org.springframework.data.domain.Sort) CriteriaQuery(javax.persistence.criteria.CriteriaQuery) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) AbstractEntity(eu.bcvsolutions.idm.core.api.entity.AbstractEntity) PageRequest(org.springframework.data.domain.PageRequest) UUID(java.util.UUID) IdmRoleRepository(eu.bcvsolutions.idm.core.model.repository.IdmRoleRepository) Page(org.springframework.data.domain.Page) PriorityType(eu.bcvsolutions.idm.core.api.domain.PriorityType) Serializable(java.io.Serializable) ChangeConfidentialException(eu.bcvsolutions.idm.core.eav.api.exception.ChangeConfidentialException) List(java.util.List) EventConfiguration(eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration) IdmFormAttribute(eu.bcvsolutions.idm.core.eav.entity.IdmFormAttribute) Specification(org.springframework.data.jpa.domain.Specification) Identifiable(eu.bcvsolutions.idm.core.api.domain.Identifiable) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) FormableDto(eu.bcvsolutions.idm.core.api.dto.FormableDto) IdmFormAttribute_(eu.bcvsolutions.idm.core.eav.entity.IdmFormAttribute_) IdmRole(eu.bcvsolutions.idm.core.model.entity.IdmRole) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) ArrayList(java.util.ArrayList) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) IdmFormValueFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmFormValueFilter) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Lists(com.google.common.collect.Lists) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) AbstractFormValueEvaluator(eu.bcvsolutions.idm.core.security.evaluator.eav.AbstractFormValueEvaluator) CoreModuleDescriptor(eu.bcvsolutions.idm.core.CoreModuleDescriptor) DefaultFormableFilter(eu.bcvsolutions.idm.core.api.dto.filter.DefaultFormableFilter) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Direction(org.springframework.data.domain.Sort.Direction) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Root(javax.persistence.criteria.Root) Before(org.junit.Before) IdentityFormValueEvaluator(eu.bcvsolutions.idm.core.security.evaluator.eav.IdentityFormValueEvaluator) Assert.assertNotNull(org.junit.Assert.assertNotNull) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) IdmCacheManager(eu.bcvsolutions.idm.core.api.service.IdmCacheManager) IdmRoleFormValue(eu.bcvsolutions.idm.core.model.entity.eav.IdmRoleFormValue) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) ApplicationContext(org.springframework.context.ApplicationContext) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) InitDemoDataProcessor(eu.bcvsolutions.idm.core.model.event.processor.module.InitDemoDataProcessor) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmTreeNode(eu.bcvsolutions.idm.core.model.entity.IdmTreeNode) IdmEntityEventService(eu.bcvsolutions.idm.core.api.service.IdmEntityEventService) Assert.assertNull(org.junit.Assert.assertNull) ChronoUnit(java.time.temporal.ChronoUnit) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) FormValueService(eu.bcvsolutions.idm.core.eav.api.service.FormValueService) IdmFormDefinitionService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormDefinitionService) IdmEntityEvent_(eu.bcvsolutions.idm.core.model.entity.IdmEntityEvent_) CoreEventType(eu.bcvsolutions.idm.core.api.event.CoreEvent.CoreEventType) AbstractFormableService(eu.bcvsolutions.idm.core.eav.api.service.AbstractFormableService) Subquery(javax.persistence.criteria.Subquery) Assert(org.junit.Assert) FormAttributeValidateProcessor(eu.bcvsolutions.idm.core.eav.processor.FormAttributeValidateProcessor) Assert.assertEquals(org.junit.Assert.assertEquals) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) Transactional(org.springframework.transaction.annotation.Transactional) FormDefinitionAttributes(eu.bcvsolutions.idm.core.eav.api.dto.FormDefinitionAttributes) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) BigDecimal(java.math.BigDecimal) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 67 with Assert.assertTrue

use of org.junit.Assert.assertTrue in project CzechIdMng by bcvsolutions.

the class IdentityFilterTest method testIdentifiers.

@Test
public void testIdentifiers() {
    List<IdmIdentityDto> identities = createIdentities(10);
    IdmIdentityDto identityOne = identities.get(1);
    IdmIdentityDto identityTwo = identities.get(2);
    IdmIdentityDto identityThree = identities.get(3);
    IdmIdentityDto identityFive = identities.get(5);
    IdmIdentityDto identityNine = identities.get(9);
    identityOne.setExternalCode("identityOneExternalCode" + System.currentTimeMillis());
    identityTwo.setUsername("identityTwoUsername" + System.currentTimeMillis());
    identityThree.setLastName(getHelper().createName());
    identityFive.setUsername("identityFiveUsername" + System.currentTimeMillis());
    identityFive.setExternalCode("identityFiveExternalCode" + System.currentTimeMillis());
    identityNine.setExternalCode("identityNineExternalCode" + System.currentTimeMillis());
    identityNine.setUsername("identityNineUsername" + System.currentTimeMillis());
    identityOne = identityService.save(identityOne);
    UUID identityOneId = identityOne.getId();
    identityTwo = identityService.save(identityTwo);
    UUID identityTwoId = identityTwo.getId();
    identityThree = identityService.save(identityThree);
    UUID identityThreeId = identityThree.getId();
    identityFive = identityService.save(identityFive);
    UUID identityFiveId = identityFive.getId();
    identityNine = identityService.save(identityNine);
    UUID identityNineId = identityNine.getId();
    IdmIdentityFilter filter = new IdmIdentityFilter();
    List<String> identifiers = new ArrayList<>();
    identifiers.add(identityOne.getExternalCode());
    identifiers.add(identityTwo.getUsername());
    identifiers.add(identityThree.getLastName());
    identifiers.add(identityFive.getExternalCode());
    identifiers.add(identityFive.getUsername());
    identifiers.add(identityNine.getExternalCode());
    identifiers.add(identityNine.getUsername());
    filter.setIdentifiers(identifiers);
    List<IdmIdentityDto> results = identityService.find(filter, null).getContent();
    Assert.assertEquals(5, results.size());
    Assert.assertTrue(results.stream().anyMatch(i -> i.getId().equals(identityOneId)));
    Assert.assertTrue(results.stream().anyMatch(i -> i.getId().equals(identityTwoId)));
    Assert.assertTrue(results.stream().anyMatch(i -> i.getId().equals(identityThreeId)));
    Assert.assertTrue(results.stream().anyMatch(i -> i.getId().equals(identityFiveId)));
    Assert.assertTrue(results.stream().anyMatch(i -> i.getId().equals(identityNineId)));
}
Also used : ZonedDateTime(java.time.ZonedDateTime) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) FilterManager(eu.bcvsolutions.idm.core.api.repository.filter.FilterManager) ArrayList(java.util.ArrayList) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) DataFilter(eu.bcvsolutions.idm.core.api.dto.filter.DataFilter) Lists(com.google.common.collect.Lists) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) DefaultManagersFilter(eu.bcvsolutions.idm.core.model.repository.filter.DefaultManagersFilter) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) EntityUtils(eu.bcvsolutions.idm.core.api.utils.EntityUtils) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) Assert.assertNotNull(org.junit.Assert.assertNotNull) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Assert.assertTrue(org.junit.Assert.assertTrue) MultiValueMap(org.springframework.util.MultiValueMap) Test(org.junit.Test) UUID(java.util.UUID) Field(java.lang.reflect.Field) Page(org.springframework.data.domain.Page) IdentityState(eu.bcvsolutions.idm.core.api.domain.IdentityState) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) IntrospectionException(java.beans.IntrospectionException) InvocationTargetException(java.lang.reflect.InvocationTargetException) FilterBuilder(eu.bcvsolutions.idm.core.api.repository.filter.FilterBuilder) DefaultSubordinatesFilter(eu.bcvsolutions.idm.core.model.repository.filter.DefaultSubordinatesFilter) List(java.util.List) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) DefaultContractByManagerFilter(eu.bcvsolutions.idm.core.model.repository.filter.DefaultContractByManagerFilter) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) Assert(org.junit.Assert) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) Transactional(org.springframework.transaction.annotation.Transactional) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) ArrayList(java.util.ArrayList) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 68 with Assert.assertTrue

use of org.junit.Assert.assertTrue in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleRequestServiceIntegrationTest method testUpdateSubRoleByRequest.

@Test
@Transactional
public void testUpdateSubRoleByRequest() {
    IdmRoleDto superior = getHelper().createRole();
    IdmRoleDto sub = getHelper().createRole();
    getHelper().createRoleComposition(superior, sub);
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    // 
    IdmRoleRequestDto request = getHelper().assignRoles(getHelper().getPrimeContract(identity), false, superior);
    // 
    Assert.assertEquals(2, request.getConceptRoles().size());
    List<IdmIdentityRoleDto> assignedRoles = identityRoleService.findAllByIdentity(identity.getId());
    Assert.assertEquals(2, assignedRoles.size());
    Assert.assertTrue(assignedRoles.stream().allMatch(ir -> ir.getValidTill() == null));
    IdmIdentityRoleDto directlyAssignedRole = assignedRoles.stream().filter(ir -> ir.getDirectRole() == null).findFirst().get();
    Assert.assertEquals(superior.getId(), directlyAssignedRole.getRole());
    // 
    // change superior role validity by concept
    request = new IdmRoleRequestDto();
    request.setApplicant(identity.getId());
    request.setExecuteImmediately(true);
    request.setRequestedByType(RoleRequestedByType.MANUALLY);
    request.setState(RoleRequestState.EXECUTED);
    request = roleRequestService.save(request);
    Assert.assertEquals(RoleRequestState.CONCEPT, request.getState());
    LocalDate validTill = LocalDate.now().plusMonths(1);
    IdmConceptRoleRequestDto concept = new IdmConceptRoleRequestDto();
    concept.setRoleRequest(request.getId());
    concept.setState(RoleRequestState.EXECUTED);
    concept.setOperation(ConceptRoleRequestOperation.UPDATE);
    concept.setRole(superior.getId());
    concept.setIdentityRole(directlyAssignedRole.getId());
    concept.setValidTill(validTill);
    concept.setIdentityContract(directlyAssignedRole.getIdentityContract());
    concept = conceptRoleRequestService.save(concept);
    Assert.assertEquals(RoleRequestState.CONCEPT, concept.getState());
    getHelper().startRequestInternal(request, true, true);
    request = roleRequestService.get(request.getId());
    Assert.assertEquals(RoleRequestState.EXECUTED, request.getState());
    // 
    assignedRoles = identityRoleService.findAllByIdentity(identity.getId());
    Assert.assertEquals(2, assignedRoles.size());
    Assert.assertTrue(assignedRoles.stream().allMatch(ir -> ir.getValidTill().equals(validTill)));
    // 
    // and remove
    request = new IdmRoleRequestDto();
    request.setApplicant(identity.getId());
    request.setExecuteImmediately(true);
    request.setRequestedByType(RoleRequestedByType.MANUALLY);
    request.setState(RoleRequestState.EXECUTED);
    request = roleRequestService.save(request);
    Assert.assertEquals(RoleRequestState.CONCEPT, request.getState());
    concept = new IdmConceptRoleRequestDto();
    concept.setRoleRequest(request.getId());
    concept.setState(RoleRequestState.EXECUTED);
    concept.setOperation(ConceptRoleRequestOperation.REMOVE);
    concept.setRole(superior.getId());
    concept.setIdentityRole(directlyAssignedRole.getId());
    concept.setIdentityContract(directlyAssignedRole.getIdentityContract());
    concept = conceptRoleRequestService.save(concept);
    Assert.assertEquals(RoleRequestState.CONCEPT, concept.getState());
    getHelper().startRequestInternal(request, true, true);
    request = roleRequestService.get(request.getId());
    Assert.assertEquals(RoleRequestState.EXECUTED, request.getState());
    assignedRoles = identityRoleService.findAllByIdentity(identity.getId());
    Assert.assertTrue(assignedRoles.isEmpty());
}
Also used : IdmRoleRequestByIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestByIdentityDto) IdmConceptRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmConceptRoleRequestService) IdmRequestIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRequestIdentityRoleDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) RoleRequestException(eu.bcvsolutions.idm.core.api.exception.RoleRequestException) Autowired(org.springframework.beans.factory.annotation.Autowired) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) IdmRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) IdmRequestIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmRequestIdentityRoleService) Map(java.util.Map) After(org.junit.After) ModuleService(eu.bcvsolutions.idm.core.api.service.ModuleService) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) Collection(java.util.Collection) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) PriorityType(eu.bcvsolutions.idm.core.api.domain.PriorityType) Serializable(java.io.Serializable) GrantedAuthority(org.springframework.security.core.GrantedAuthority) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) EventConfiguration(eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration) LocalDate(java.time.LocalDate) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) RoleRequestEventType(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent.RoleRequestEventType) RoleRequestApprovalProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleRequestApprovalProcessor) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) FutureTask(java.util.concurrent.FutureTask) RoleRequestedByType(eu.bcvsolutions.idm.core.api.domain.RoleRequestedByType) HashMap(java.util.HashMap) IdmJwtAuthentication(eu.bcvsolutions.idm.core.security.api.domain.IdmJwtAuthentication) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) Lists(com.google.common.collect.Lists) IdmIdentityRole(eu.bcvsolutions.idm.core.model.entity.IdmIdentityRole) IdmAuthorityUtils(eu.bcvsolutions.idm.core.security.api.utils.IdmAuthorityUtils) ImmutableList(com.google.common.collect.ImmutableList) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) Qualifier(org.springframework.beans.factory.annotation.Qualifier) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Before(org.junit.Before) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) SchedulerConfiguration(eu.bcvsolutions.idm.core.scheduler.api.config.SchedulerConfiguration) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) Executor(java.util.concurrent.Executor) Assert.assertNotNull(org.junit.Assert.assertNotNull) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) RoleRequestState(eu.bcvsolutions.idm.core.api.domain.RoleRequestState) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) IdmRoleFormAttributeService(eu.bcvsolutions.idm.core.api.service.IdmRoleFormAttributeService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) Assert.assertNull(org.junit.Assert.assertNull) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) RoleRequestEvent(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent) IdmRequestIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestIdentityRoleFilter) IdmGroupPermission(eu.bcvsolutions.idm.core.security.api.domain.IdmGroupPermission) Assert(org.junit.Assert) ConceptRoleRequestOperation(eu.bcvsolutions.idm.core.api.domain.ConceptRoleRequestOperation) Assert.assertEquals(org.junit.Assert.assertEquals) Transactional(org.springframework.transaction.annotation.Transactional) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) LocalDate(java.time.LocalDate) AbstractCoreWorkflowIntegrationTest(eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 69 with Assert.assertTrue

use of org.junit.Assert.assertTrue in project CzechIdMng by bcvsolutions.

the class DefaultProvisioningExecutorIntegrationTest method testAsynchronousQueueSynchronized.

@Test
public void testAsynchronousQueueSynchronized() throws Exception {
    // 
    // schedule task to process queue async
    Task task = new Task();
    task.setInstanceId(configurationService.getInstanceId());
    task.setTaskType(ProvisioningQueueTaskExecutor.class);
    task = schedulerManager.createTask(task);
    CronTaskTrigger trigger = new CronTaskTrigger();
    trigger.setTaskId(task.getId());
    trigger.setCron("0/5 * * * * ?");
    // 
    schedulerManager.createTrigger(task.getId(), trigger);
    // 
    // turn on async processing
    getHelper().enableAsynchronousProcessing();
    // 
    try {
        int count = 50;
        // system with asynchronous provisioning
        SysSystemDto system = getHelper().createTestResourceSystem(true);
        system.setQueue(true);
        system = systemService.save(system);
        // 
        IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
        IdmRoleDto role = getHelper().createRole();
        getHelper().createRoleSystem(role, system);
        getHelper().createIdentityRole(identity, role);
        // 
        for (int index = 0; index < count; index++) {
            // async provisioning by the notify event
            entityEventManager.changedEntity(identity);
            Thread.sleep(25);
        }
        // 
        IdmEntityEventFilter eventFilter = new IdmEntityEventFilter();
        eventFilter.setOwnerId(identity.getId());
        eventFilter.setTransactionId(identity.getTransactionId());
        eventFilter.setStates(Lists.newArrayList(OperationState.CREATED, OperationState.RUNNING));
        getHelper().waitForResult(res -> {
            return entityEventService.find(eventFilter, PageRequest.of(0, 1)).getTotalElements() != 0;
        });
        // 
        // check archive is executed
        SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
        filter.setEntityIdentifier(identity.getId());
        getHelper().waitForResult(res -> {
            return provisioningArchiveService.find(filter, null).getContent().isEmpty();
        });
        List<SysProvisioningArchiveDto> archives = provisioningArchiveService.find(filter, null).getContent();
        Assert.assertFalse(archives.isEmpty());
        Assert.assertTrue(archives.stream().allMatch(a -> a.getResultState().isSuccessful()));
    } finally {
        schedulerManager.deleteTask(task.getId());
        getHelper().disableAsynchronousProcessing();
    }
}
Also used : ProvisioningExecutor(eu.bcvsolutions.idm.acc.service.api.ProvisioningExecutor) Lists(org.testng.collections.Lists) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) ZonedDateTime(java.time.ZonedDateTime) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) ConfigurationService(eu.bcvsolutions.idm.core.api.service.ConfigurationService) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) RetryProvisioningTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.RetryProvisioningTaskExecutor) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) Map(java.util.Map) Sort(org.springframework.data.domain.Sort) Task(eu.bcvsolutions.idm.core.scheduler.api.dto.Task) SysProvisioningOperationService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningOperationService) SysProvisioningArchive_(eu.bcvsolutions.idm.acc.entity.SysProvisioningArchive_) PageRequest(org.springframework.data.domain.PageRequest) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) UUID(java.util.UUID) SchedulerManager(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulerManager) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) List(java.util.List) SysProvisioningAttributeRepository(eu.bcvsolutions.idm.acc.repository.SysProvisioningAttributeRepository) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) Assert.assertFalse(org.junit.Assert.assertFalse) SysProvisioningAttribute(eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute) ProvisioningQueueTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.ProvisioningQueueTaskExecutor) HikariDataSource(com.zaxxer.hikari.HikariDataSource) CronTaskTrigger(eu.bcvsolutions.idm.core.scheduler.api.dto.CronTaskTrigger) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) HashMap(java.util.HashMap) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysProvisioningBatchDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto) ArrayList(java.util.ArrayList) ConfidentialStorage(eu.bcvsolutions.idm.core.api.service.ConfidentialStorage) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) IcUidAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcUidAttributeImpl) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) DataSource(javax.sql.DataSource) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Direction(org.springframework.data.domain.Sort.Direction) SysProvisioningOperation_(eu.bcvsolutions.idm.acc.entity.SysProvisioningOperation_) ProvisioningOperationType(eu.bcvsolutions.idm.acc.domain.ProvisioningOperationType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) Before(org.junit.Before) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) LongRunningTaskManager(eu.bcvsolutions.idm.core.scheduler.api.service.LongRunningTaskManager) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysProvisioningOperation(eu.bcvsolutions.idm.acc.entity.SysProvisioningOperation) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) Assert.assertTrue(org.junit.Assert.assertTrue) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) Test(org.junit.Test) ApplicationContext(org.springframework.context.ApplicationContext) SysProvisioningBatchService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningBatchService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmEntityEventService(eu.bcvsolutions.idm.core.api.service.IdmEntityEventService) Assert.assertNull(org.junit.Assert.assertNull) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) Assert(org.junit.Assert) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) Task(eu.bcvsolutions.idm.core.scheduler.api.dto.Task) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) CronTaskTrigger(eu.bcvsolutions.idm.core.scheduler.api.dto.CronTaskTrigger) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 70 with Assert.assertTrue

use of org.junit.Assert.assertTrue in project CzechIdMng by bcvsolutions.

the class DefaultProvisioningExecutorIntegrationTest method testRetryProvisioning.

@Test
public void testRetryProvisioning() {
    testProvisioningExceptionProcessor.setDisabled(false);
    try {
        SysSystemDto system = getHelper().createTestResourceSystem(true);
        SysProvisioningOperationDto provisioningOperation = createProvisioningOperation(system, "firstname");
        Map<ProvisioningAttributeDto, Object> accoutObject = provisioningOperation.getProvisioningContext().getAccountObject();
        String uid = (String) accoutObject.get(getProvisioningAttribute(TestHelper.ATTRIBUTE_MAPPING_NAME));
        ZonedDateTime now = ZonedDateTime.now();
        // 
        // publish event
        // 1 - create
        provisioningExecutor.execute(provisioningOperation);
        // is necessary to get again operation from service
        SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
        filter.setSystemEntityUid(provisioningOperation.getSystemEntityUid());
        filter.setSystemId(system.getId());
        SysProvisioningOperationDto operation = provisioningOperationService.find(filter, null).getContent().get(0);
        SysProvisioningBatchDto batch = provisioningBatchService.findBatch(operation.getSystemEntity());
        Assert.assertEquals(OperationState.EXCEPTION, operation.getResultState());
        Assert.assertEquals(AccResultCode.PROVISIONING_FAILED.name(), operation.getResult().getModel().getStatusEnum());
        Assert.assertEquals(1, operation.getCurrentAttempt());
        Assert.assertTrue(operation.getMaxAttempts() > 1);
        Assert.assertTrue(batch.getNextAttempt().isAfter(now));
        SysSystemEntityDto systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, uid);
        Assert.assertTrue(systemEntity.isWish());
        Assert.assertNull(getHelper().findResource(uid));
        // check failed operation is in archive too
        List<SysProvisioningArchiveDto> archived = provisioningArchiveService.find(filter, PageRequest.of(0, 10, new Sort(Direction.DESC, SysProvisioningArchive_.created.getName()))).getContent();
        Assert.assertEquals(1, archived.size());
        Assert.assertEquals(OperationState.EXCEPTION, archived.get(0).getResultState());
        Assert.assertEquals(AccResultCode.PROVISIONING_FAILED.name(), archived.get(0).getResult().getModel().getStatusEnum());
        // 
        batch.setNextAttempt(ZonedDateTime.now());
        provisioningBatchService.save(batch);
        // 
        // retry - the same exception expected
        RetryProvisioningTaskExecutor retryProvisioningTaskExecutor = new RetryProvisioningTaskExecutor();
        Boolean result = longRunningTaskManager.executeSync(retryProvisioningTaskExecutor);
        Assert.assertTrue(result);
        operation = provisioningOperationService.get(operation.getId());
        batch = provisioningBatchService.findBatch(systemEntity.getId());
        Assert.assertEquals(2, operation.getCurrentAttempt());
        Assert.assertNotNull(batch.getNextAttempt());
        Assert.assertTrue(batch.getNextAttempt().isAfter(now));
        archived = provisioningArchiveService.find(filter, PageRequest.of(0, 10, new Sort(Direction.DESC, SysProvisioningArchive_.created.getName()))).getContent();
        Assert.assertEquals(2, archived.size());
        Assert.assertEquals(OperationState.EXCEPTION, archived.get(0).getResultState());
        Assert.assertEquals(AccResultCode.PROVISIONING_FAILED.name(), archived.get(0).getResult().getModel().getStatusEnum());
        // 
        batch.setNextAttempt(ZonedDateTime.now());
        provisioningBatchService.save(batch);
        // 
        // retry - expected success now
        testProvisioningExceptionProcessor.setDisabled(true);
        retryProvisioningTaskExecutor = new RetryProvisioningTaskExecutor();
        longRunningTaskManager.executeSync(retryProvisioningTaskExecutor);
        // 
        systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, uid);
        Assert.assertFalse(systemEntity.isWish());
        Assert.assertNotNull(getHelper().findResource(uid));
        batch = provisioningBatchService.get(batch.getId());
        Assert.assertNull(batch.getNextAttempt());
        archived = provisioningArchiveService.find(filter, PageRequest.of(0, 10, new Sort(Direction.DESC, SysProvisioningArchive_.created.getName()))).getContent();
        Assert.assertEquals(3, archived.size());
        Assert.assertTrue(archived.stream().anyMatch(a -> a.getResultState() == OperationState.EXECUTED));
    } finally {
        testProvisioningExceptionProcessor.setDisabled(true);
    }
}
Also used : ProvisioningExecutor(eu.bcvsolutions.idm.acc.service.api.ProvisioningExecutor) Lists(org.testng.collections.Lists) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) ZonedDateTime(java.time.ZonedDateTime) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) ConfigurationService(eu.bcvsolutions.idm.core.api.service.ConfigurationService) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) RetryProvisioningTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.RetryProvisioningTaskExecutor) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) Map(java.util.Map) Sort(org.springframework.data.domain.Sort) Task(eu.bcvsolutions.idm.core.scheduler.api.dto.Task) SysProvisioningOperationService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningOperationService) SysProvisioningArchive_(eu.bcvsolutions.idm.acc.entity.SysProvisioningArchive_) PageRequest(org.springframework.data.domain.PageRequest) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) UUID(java.util.UUID) SchedulerManager(eu.bcvsolutions.idm.core.scheduler.api.service.SchedulerManager) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) List(java.util.List) SysProvisioningAttributeRepository(eu.bcvsolutions.idm.acc.repository.SysProvisioningAttributeRepository) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) Assert.assertFalse(org.junit.Assert.assertFalse) SysProvisioningAttribute(eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute) ProvisioningQueueTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.ProvisioningQueueTaskExecutor) HikariDataSource(com.zaxxer.hikari.HikariDataSource) CronTaskTrigger(eu.bcvsolutions.idm.core.scheduler.api.dto.CronTaskTrigger) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) HashMap(java.util.HashMap) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysProvisioningBatchDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto) ArrayList(java.util.ArrayList) ConfidentialStorage(eu.bcvsolutions.idm.core.api.service.ConfidentialStorage) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) IcUidAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcUidAttributeImpl) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) DataSource(javax.sql.DataSource) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Direction(org.springframework.data.domain.Sort.Direction) SysProvisioningOperation_(eu.bcvsolutions.idm.acc.entity.SysProvisioningOperation_) ProvisioningOperationType(eu.bcvsolutions.idm.acc.domain.ProvisioningOperationType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) Before(org.junit.Before) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) LongRunningTaskManager(eu.bcvsolutions.idm.core.scheduler.api.service.LongRunningTaskManager) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysProvisioningOperation(eu.bcvsolutions.idm.acc.entity.SysProvisioningOperation) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) Assert.assertTrue(org.junit.Assert.assertTrue) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) Test(org.junit.Test) ApplicationContext(org.springframework.context.ApplicationContext) SysProvisioningBatchService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningBatchService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmEntityEventService(eu.bcvsolutions.idm.core.api.service.IdmEntityEventService) Assert.assertNull(org.junit.Assert.assertNull) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmLongRunningTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) Assert(org.junit.Assert) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ZonedDateTime(java.time.ZonedDateTime) RetryProvisioningTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.RetryProvisioningTaskExecutor) Sort(org.springframework.data.domain.Sort) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysProvisioningBatchDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

Assert (org.junit.Assert)88 Assert.assertTrue (org.junit.Assert.assertTrue)88 Test (org.junit.Test)88 Assert.assertEquals (org.junit.Assert.assertEquals)84 List (java.util.List)82 Before (org.junit.Before)67 UUID (java.util.UUID)55 Assert.assertFalse (org.junit.Assert.assertFalse)54 Autowired (org.springframework.beans.factory.annotation.Autowired)53 Assert.assertNotNull (org.junit.Assert.assertNotNull)52 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)51 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)51 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)49 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)48 Transactional (org.springframework.transaction.annotation.Transactional)46 After (org.junit.After)44 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)42 ApplicationContext (org.springframework.context.ApplicationContext)38 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)37 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)36