fix moar flaky StorageTest.testNotificationStorage() [FINERACT-828]
similar fix to earlier Pull Request for the same also added some more toString()
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
e7889f8463
commit
5557b8be4a
+5
@@ -78,4 +78,9 @@ public class NotificationMapper extends AbstractPersistableCustom {
|
|||||||
isRead = read;
|
isRead = read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "NotificationMapper [notification=" + this.notification + ", userId=" + this.userId + ", isRead=" + this.isRead
|
||||||
|
+ ", createdAt=" + this.createdAt + ", getId()=" + this.getId() + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-10
@@ -129,7 +129,7 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser {
|
|||||||
String password = command.stringValueOfParameterNamed("password");
|
String password = command.stringValueOfParameterNamed("password");
|
||||||
final Boolean sendPasswordToEmail = command.booleanObjectValueOfParameterNamed("sendPasswordToEmail");
|
final Boolean sendPasswordToEmail = command.booleanObjectValueOfParameterNamed("sendPasswordToEmail");
|
||||||
|
|
||||||
if (sendPasswordToEmail.booleanValue()) {
|
if (sendPasswordToEmail) {
|
||||||
password = new RandomPasswordGenerator(13).generate();
|
password = new RandomPasswordGenerator(13).generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,14 +309,14 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(this.isSelfServiceUser && command.hasParameter(AppUserConstants.CLIENTS)){
|
if(this.isSelfServiceUser && command.hasParameter(AppUserConstants.CLIENTS)){
|
||||||
actualChanges.put(AppUserConstants.CLIENTS, command.arrayValueOfParameterNamed(AppUserConstants.CLIENTS));
|
actualChanges.put(AppUserConstants.CLIENTS, command.arrayValueOfParameterNamed(AppUserConstants.CLIENTS));
|
||||||
Set<AppUserClientMapping> newClients = createAppUserClientMappings(clients);
|
Set<AppUserClientMapping> newClients = createAppUserClientMappings(clients);
|
||||||
if(this.appUserClientMappings == null){
|
if(this.appUserClientMappings == null){
|
||||||
this.appUserClientMappings = new HashSet<>();
|
this.appUserClientMappings = new HashSet<>();
|
||||||
}else{
|
}else{
|
||||||
this.appUserClientMappings.retainAll(newClients);
|
this.appUserClientMappings.retainAll(newClients);
|
||||||
}
|
}
|
||||||
this.appUserClientMappings.addAll(newClients);
|
this.appUserClientMappings.addAll(newClients);
|
||||||
}else if(!this.isSelfServiceUser && actualChanges.containsKey(AppUserConstants.IS_SELF_SERVICE_USER)){
|
}else if(!this.isSelfServiceUser && actualChanges.containsKey(AppUserConstants.IS_SELF_SERVICE_USER)){
|
||||||
actualChanges.put(AppUserConstants.CLIENTS, new ArrayList<>());
|
actualChanges.put(AppUserConstants.CLIENTS, new ArrayList<>());
|
||||||
if(this.appUserClientMappings != null){
|
if(this.appUserClientMappings != null){
|
||||||
@@ -575,7 +575,7 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser {
|
|||||||
public void validateHasPermissionTo(final String function) {
|
public void validateHasPermissionTo(final String function) {
|
||||||
if (hasNotPermissionTo(function)) {
|
if (hasNotPermissionTo(function)) {
|
||||||
final String authorizationMessage = "User has no authority to: " + function;
|
final String authorizationMessage = "User has no authority to: " + function;
|
||||||
logger.info("Unauthorized access: userId: {} action: {} allowed: {}", new Object[] { getId(), function, getAuthorities() });
|
logger.info("Unauthorized access: userId: {} action: {} allowed: {}", getId(), function, getAuthorities());
|
||||||
throw new NoAuthorizationException(authorizationMessage);
|
throw new NoAuthorizationException(authorizationMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -663,4 +663,8 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser {
|
|||||||
return newAppUserClientMappings;
|
return newAppUserClientMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AppUser [username=" + this.username + ", getId()=" + this.getId() + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ public class StorageTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
verify(this.notificationGeneratorWritePlatformService, times(1)).create(refEq(notification, "createdAt"));
|
verify(this.notificationGeneratorWritePlatformService, times(1)).create(refEq(notification, "createdAt"));
|
||||||
verify(this.notificationMapperWritePlatformService, times(1)).create(refEq(notificationMapper));
|
verify(this.notificationMapperWritePlatformService, times(1)).create(refEq(notificationMapper, "createdAt"));
|
||||||
verify(this.notificationGeneratorReadRepositoryWrapper, times(1)).findById(1L);
|
verify(this.notificationGeneratorReadRepositoryWrapper, times(1)).findById(1L);
|
||||||
assertEquals(actualGeneratedNotificationId, Long.valueOf(1));
|
assertEquals(actualGeneratedNotificationId, Long.valueOf(1));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user