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);
}
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()));
}
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()));
}
Aggregations