This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-provisioner.git

commit c88105bab2a050e3f8af1b7d707cec9826c0947f
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Thu Jul 20 17:04:02 2017 +0200

    Minor change: scootching up expectation withdrawal so it's not forgotten.
---
 .../service/applications/IdentityServiceInitializer.java         | 5 ++---
 .../service/applications/IdentityServiceInitializerTest.java     | 9 ++++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/service/src/main/java/io/mifos/provisioner/internal/service/applications/IdentityServiceInitializer.java
 
b/service/src/main/java/io/mifos/provisioner/internal/service/applications/IdentityServiceInitializer.java
index 7f60abb..4865a7b 100644
--- 
a/service/src/main/java/io/mifos/provisioner/internal/service/applications/IdentityServiceInitializer.java
+++ 
b/service/src/main/java/io/mifos/provisioner/internal/service/applications/IdentityServiceInitializer.java
@@ -254,11 +254,11 @@ public class IdentityServiceInitializer {
     }
     catch (final PermittableGroupAlreadyExistsException 
groupAlreadyExistsException)
     {
+      identityListener.withdrawExpectation(eventExpectation);
       //if the group already exists, read out and compare.  If the group is 
the same, there is nothing left to do.
       final PermittableGroup existingGroup = 
identityService.getPermittableGroup(permittableGroup.getIdentifier());
       if 
(!existingGroup.getIdentifier().equals(permittableGroup.getIdentifier())) {
         logger.error("Group '{}' already exists for tenant {}, but has a 
different name {} (strange).", permittableGroup.getIdentifier(), 
TenantContextHolder.checkedGetIdentifier(), existingGroup.getIdentifier());
-        identityListener.withdrawExpectation(eventExpectation);
       }
 
       //Compare as sets because I'm not going to get into a hissy fit over 
order.
@@ -266,13 +266,12 @@ public class IdentityServiceInitializer {
       final Set<PermittableEndpoint> newGroupPermittables = new 
HashSet<>(permittableGroup.getPermittables());
       if (!existingGroupPermittables.equals(newGroupPermittables)) {
         logger.error("Group '{}' already exists for tenant {}, but has 
different contents.", permittableGroup.getIdentifier(), 
TenantContextHolder.checkedGetIdentifier());
-        identityListener.withdrawExpectation(eventExpectation);
       }
     }
     catch (final RuntimeException unexpected)
     {
-      logger.error("Creating group '{}' for tenant {} failed.", 
permittableGroup.getIdentifier(), TenantContextHolder.checkedGetIdentifier(), 
unexpected);
       identityListener.withdrawExpectation(eventExpectation);
+      logger.error("Creating group '{}' for tenant {} failed.", 
permittableGroup.getIdentifier(), TenantContextHolder.checkedGetIdentifier(), 
unexpected);
     }
     return eventExpectation;
   }
diff --git 
a/service/src/test/java/io/mifos/provisioner/internal/service/applications/IdentityServiceInitializerTest.java
 
b/service/src/test/java/io/mifos/provisioner/internal/service/applications/IdentityServiceInitializerTest.java
index 09cddf4..75dbf3c 100644
--- 
a/service/src/test/java/io/mifos/provisioner/internal/service/applications/IdentityServiceInitializerTest.java
+++ 
b/service/src/test/java/io/mifos/provisioner/internal/service/applications/IdentityServiceInitializerTest.java
@@ -103,7 +103,8 @@ public class IdentityServiceInitializerTest {
 
     try (final AutoTenantContext ignored = new AutoTenantContext("blah")) {
       final SystemProperties systemProperties = new SystemProperties();
-      new IdentityServiceInitializer(identityListenerMock, null, null, 
loggerMock, systemProperties).createOrFindPermittableGroup(identityServiceMock, 
group1);
+      new IdentityServiceInitializer(identityListenerMock, null, null, 
loggerMock, systemProperties)
+          .createOrFindPermittableGroup(identityServiceMock, group1);
     }
   }
 
@@ -118,7 +119,8 @@ public class IdentityServiceInitializerTest {
 
     try (final AutoTenantContext ignored = new AutoTenantContext("blah")) {
       final SystemProperties systemProperties = new SystemProperties();
-      new IdentityServiceInitializer(identityListenerMock, null, null, 
loggerMock, systemProperties).createOrFindPermittableGroup(identityServiceMock, 
group1);
+      new IdentityServiceInitializer(identityListenerMock, null, null, 
loggerMock, systemProperties)
+          .createOrFindPermittableGroup(identityServiceMock, group1);
     }
 
     verify(loggerMock).error(anyString(), anyString(), anyString());
@@ -135,7 +137,8 @@ public class IdentityServiceInitializerTest {
 
     try (final AutoTenantContext ignored = new AutoTenantContext("blah")) {
       final SystemProperties systemProperties = new SystemProperties();
-      new IdentityServiceInitializer(identityListenerMock, null, null, 
loggerMock, systemProperties).createOrFindPermittableGroup(identityServiceMock, 
group1);
+      new IdentityServiceInitializer(identityListenerMock, null, null, 
loggerMock, systemProperties)
+          .createOrFindPermittableGroup(identityServiceMock, group1);
     }
 
     verify(loggerMock).error(anyString(), anyString(), anyString(), 
isA(IllegalStateException.class));

-- 
To stop receiving notification emails like this one, please contact
my...@apache.org.

Reply via email to