SyncMBeanImpl implements SynchronizationMBean { @NotNull @Override public String[] syncAllExternalUsers() { Delegatee delegatee = getDelegatee(); try { return delegatee.syncAllExternalUsers(); } finally { delegatee.close(); } } SyncMBeanImpl(@NotNull ContentRepository repository, @NotNull SecurityProvider securityProvider,
                         @NotNull SyncManager syncManager, @NotNull String syncName,
                         @NotNull ExternalIdentityProviderManager idpManager, @NotNull String idpName); @NotNull @Override String getSyncHandlerName(); @NotNull @Override String getIDPName(); @NotNull @Override String[] syncUsers(@NotNull String[] userIds, boolean purge); @NotNull @Override String[] syncAllUsers(boolean purge); @NotNull @Override String[] syncExternalUsers(@NotNull String[] externalIds); @NotNull @Override String[] syncAllExternalUsers(); @NotNull @Override String[] listOrphanedUsers(); @NotNull @Override String[] purgeOrphanedUsers();  }
@Test public void testInitialSyncAllExternalUsers() throws Exception { String[] result = syncMBean.syncAllExternalUsers(); Map<String, String> expected = getExpectedUserResult("add", false); assertResultMessages(result, expected); UserManager userManager = getUserManager(); for (String id : expected.keySet()) { ExternalIdentity ei = idp.getUser(id); if (ei == null) { ei = idp.getGroup(id); } assertSync(ei, userManager); } }
@Test public void testSyncAllExternalUsersAgain() throws Exception { syncMBean.syncAllExternalUsers(); String[] result = syncMBean.syncAllExternalUsers(); Map<String, String> expected = getExpectedUserResult("upd", false); assertResultMessages(result, expected); UserManager userManager = getUserManager(); for (String id : expected.keySet()) { ExternalIdentity ei = idp.getUser(id); if (ei == null) { ei = idp.getGroup(id); } assertSync(ei, userManager); } }
@Test public void testSyncAllExternalUsersThrowingHandler() throws Exception { String[] result = createThrowingSyncMBean(false).syncAllExternalUsers(); Map<String, String> expected = getExpectedUserResult("ERR", false); assertResultMessages(result, expected); }