fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vorbur...@apache.org
Subject [fineract] branch develop updated: fix moar flaky StorageTest.testNotificationStorage() [FINERACT-828]
Date Sun, 17 May 2020 19:29:32 GMT
This is an automated email from the ASF dual-hosted git repository.

vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 5557b8b  fix moar flaky StorageTest.testNotificationStorage() [FINERACT-828]
5557b8b is described below

commit 5557b8be4af1652267b27c870d4306d9bb0c91f7
Author: Michael Vorburger <mike@vorburger.ch>
AuthorDate: Sun May 17 02:04:42 2020 +0200

    fix moar flaky StorageTest.testNotificationStorage() [FINERACT-828]
    
    similar fix to earlier Pull Request for the same
    
    also added some more toString()
---
 .../notification/domain/NotificationMapper.java    |  5 +++++
 .../useradministration/domain/AppUser.java         | 24 +++++++++++++---------
 .../apache/fineract/notification/StorageTest.java  |  2 +-
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapper.java
b/fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapper.java
index 64188a6..13a41cf 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapper.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapper.java
@@ -78,4 +78,9 @@ public class NotificationMapper extends AbstractPersistableCustom {
         isRead = read;
     }
 
+    @Override
+    public String toString() {
+        return "NotificationMapper [notification=" + this.notification + ", userId=" + this.userId
+ ", isRead=" + this.isRead
+                + ", createdAt=" + this.createdAt + ", getId()=" + this.getId() + "]";
+    }
 }
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
index baafc7d..4d8a63d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
@@ -129,7 +129,7 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser
{
         String password = command.stringValueOfParameterNamed("password");
         final Boolean sendPasswordToEmail = command.booleanObjectValueOfParameterNamed("sendPasswordToEmail");
 
-        if (sendPasswordToEmail.booleanValue()) {
+        if (sendPasswordToEmail) {
             password = new RandomPasswordGenerator(13).generate();
         }
 
@@ -309,14 +309,14 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser
{
         }
 
         if(this.isSelfServiceUser && command.hasParameter(AppUserConstants.CLIENTS)){
-                actualChanges.put(AppUserConstants.CLIENTS, command.arrayValueOfParameterNamed(AppUserConstants.CLIENTS));
-                Set<AppUserClientMapping> newClients = createAppUserClientMappings(clients);
-                if(this.appUserClientMappings == null){
-                    this.appUserClientMappings = new HashSet<>();
-                }else{
-                    this.appUserClientMappings.retainAll(newClients);
-                }
-                this.appUserClientMappings.addAll(newClients);
+            actualChanges.put(AppUserConstants.CLIENTS, command.arrayValueOfParameterNamed(AppUserConstants.CLIENTS));
+            Set<AppUserClientMapping> newClients = createAppUserClientMappings(clients);
+            if(this.appUserClientMappings == null){
+                this.appUserClientMappings = new HashSet<>();
+            }else{
+                this.appUserClientMappings.retainAll(newClients);
+            }
+            this.appUserClientMappings.addAll(newClients);
         }else if(!this.isSelfServiceUser && actualChanges.containsKey(AppUserConstants.IS_SELF_SERVICE_USER)){
             actualChanges.put(AppUserConstants.CLIENTS, new ArrayList<>());
             if(this.appUserClientMappings != null){
@@ -575,7 +575,7 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser
{
     public void validateHasPermissionTo(final String function) {
         if (hasNotPermissionTo(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);
         }
     }
@@ -663,4 +663,8 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser
{
         return newAppUserClientMappings;
     }
 
+    @Override
+    public String toString() {
+        return "AppUser [username=" + this.username + ", getId()=" + this.getId() + "]";
+    }
 }
\ No newline at end of file
diff --git a/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java
b/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java
index c8a7440..87ed1e9 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java
@@ -122,7 +122,7 @@ public class StorageTest {
                         );
 
         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);
         assertEquals(actualGeneratedNotificationId, Long.valueOf(1));
     }


Mime
View raw message