use of org.springframework.util.LinkedMultiValueMap in project CzechIdMng by bcvsolutions.
the class DefaultAuditServiceTest method editAndEditOneTrasaction.
@Test
public void editAndEditOneTrasaction() {
String username = "test_user_" + System.currentTimeMillis();
IdmIdentityDto identity = new IdmIdentityDto();
identity.setUsername(username);
identity.setFirstName(username);
identity.setLastName(username);
identityService.save(identity);
IdmIdentityDto newIdentity = getTransactionTemplate().execute(new TransactionCallback<IdmIdentityDto>() {
public IdmIdentityDto doInTransaction(TransactionStatus transactionStatus) {
IdmIdentityDto identity = identityService.getByCode(username);
identity.setFirstName(username + "--edit");
identityService.save(identity);
//
identity.setEmail("example@example.tld");
identity.setLastName(username + "edit");
return identityService.save(identity);
}
});
assertEquals(newIdentity.getUsername(), username);
MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
parameters.put("username", ImmutableList.of(username));
List<IdmAuditDto> audits = auditService.findEntityWithRelation(IdmIdentity.class, parameters, null).getContent();
assertEquals(3, audits.size());
}
Aggregations