Search in sources :

Example 56 with IdmIdentity

use of eu.bcvsolutions.idm.core.model.entity.IdmIdentity in project CzechIdMng by bcvsolutions.

the class DefaultIdmConfidentialStorageIntegrationTest method testOwnerWithoutId.

@Transactional
@Test(expected = IllegalArgumentException.class)
public void testOwnerWithoutId() {
    String storageKeyOne = getHelper().createName();
    // unpersisted identity
    IdmIdentity owner = new IdmIdentity();
    confidentalStorage.get(owner.getId(), IdmIdentity.class, storageKeyOne);
}
Also used : GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 57 with IdmIdentity

use of eu.bcvsolutions.idm.core.model.entity.IdmIdentity in project CzechIdMng by bcvsolutions.

the class DefaultIdmIdentityServiceUnitTest method testNoContractState.

@Test
public void testNoContractState() {
    IdmIdentity identity = new IdmIdentity(UUID.randomUUID());
    when(repository.findById(identity.getId())).thenReturn(Optional.of(identity));
    when(identityContractService.findAllByIdentity(identity.getId())).thenReturn(Lists.newArrayList());
    // 
    Assert.assertEquals(IdentityState.NO_CONTRACT, service.evaluateState(identity.getId()));
}
Also used : IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Example 58 with IdmIdentity

use of eu.bcvsolutions.idm.core.model.entity.IdmIdentity in project CzechIdMng by bcvsolutions.

the class DefaultIdmIdentityServiceUnitTest method testFutureContractState.

@Test
public void testFutureContractState() {
    IdmIdentity identity = new IdmIdentity(UUID.randomUUID());
    IdmIdentityContractDto contractOne = new IdmIdentityContractDto();
    contractOne.setState(ContractState.DISABLED);
    IdmIdentityContractDto contractTwo = new IdmIdentityContractDto();
    contractTwo.setValidFrom(LocalDate.now().plusDays(1));
    when(repository.findById(identity.getId())).thenReturn(Optional.of(identity));
    when(identityContractService.findAllByIdentity(identity.getId())).thenReturn(Lists.newArrayList(contractOne, contractTwo));
    // 
    Assert.assertEquals(IdentityState.FUTURE_CONTRACT, service.evaluateState(identity.getId()));
}
Also used : IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Test(org.junit.Test) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest)

Aggregations

IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)58 Test (org.junit.Test)44 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)28 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)20 IdmIdentityFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)18 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)13 Transactional (org.springframework.transaction.annotation.Transactional)11 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)9 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)9 IdmIdentityService (eu.bcvsolutions.idm.core.api.service.IdmIdentityService)7 DataFilter (eu.bcvsolutions.idm.core.api.dto.filter.DataFilter)6 List (java.util.List)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 IdmIdentityContract (eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract)5 Assert (org.junit.Assert)5 IdmAuthorityChange (eu.bcvsolutions.idm.core.model.entity.IdmAuthorityChange)4 UUID (java.util.UUID)4 Identifiable (eu.bcvsolutions.idm.core.api.domain.Identifiable)3 IdmEntityEventDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto)3 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)3