test_class.declarator: batchSize
test_class.modifier: private final
test_class.original_string: private final int batchSize;
test_class.type: int
test_class.var_name: batchSize
test_class.declarator: delegatee
test_class.modifier: private
test_class.original_string: private Delegatee delegatee;
test_class.type: Delegatee
test_class.var_name: delegatee
test_class.declarator: TEST_IDS = new String[] {
              ID_TEST_USER,
              TestIdentityProvider.ID_SECOND_USER,
              TestIdentityProvider.ID_WILDCARD_USER}
test_class.modifier: private static final
test_class.original_string: private static final String[] TEST_IDS = new String[] {
              ID_TEST_USER,
              TestIdentityProvider.ID_SECOND_USER,
              TestIdentityProvider.ID_WILDCARD_USER};
test_class.type: String[]
test_class.var_name: TEST_IDS
test_class.file: oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/jmx/DelegateeTest.java
test_class.identifier: DelegateeTest
test_class.superclass: extends AbstractJmxTest
test_case.body: @Test
      public void testSyncExternalUsersGeneratesNullIdentity() throws Exception {
          SyncContext ctx = mock(SyncContext.class);
          when(ctx.sync(any(ExternalIdentity.class))).thenReturn(new DefaultSyncResultImpl(null, SyncResult.Status.NOP));
          when(ctx.setForceGroupSync(anyBoolean())).thenReturn(ctx);
          SyncHandler syncHandler = when(mock(SyncHandler.class).createContext(any(ExternalIdentityProvider.class), any(UserManager.class), any(ValueFactory.class))).thenReturn(ctx).getMock();
  
          Delegatee d = createDelegatee(new TestIdentityProvider(), syncHandler);
          ExternalIdentityRef ref = new ExternalIdentityRef(ID_TEST_USER, DEFAULT_IDP_NAME);
          String[] res = d.syncExternalUsers(new String[] {ref.getString()});
  
          assertResultMessages(res, ID_TEST_USER, "nsi");
      }
test_case.class_method_signature: DelegateeTest.testSyncExternalUsersGeneratesNullIdentity()
test_case.full_signature: @Test public void testSyncExternalUsersGeneratesNullIdentity()
test_case.identifier: testSyncExternalUsersGeneratesNullIdentity
test_case.invocations: mock thenReturn when sync any thenReturn when setForceGroupSync anyBoolean getMock thenReturn when createContext mock any any any createDelegatee syncExternalUsers getString assertResultMessages
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSyncExternalUsersGeneratesNullIdentity()
focal_class.declarator: log = LoggerFactory.getLogger(Delegatee.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(Delegatee.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: ERROR_CREATE_DELEGATEE = "Unable to create delegatee"
focal_class.modifier: private static final
focal_class.original_string: private static final String ERROR_CREATE_DELEGATEE = "Unable to create delegatee";
focal_class.type: String
focal_class.var_name: ERROR_CREATE_DELEGATEE
focal_class.declarator: ERROR_SYNC_USER = "Error while syncing user {}"
focal_class.modifier: private static final
focal_class.original_string: private static final String ERROR_SYNC_USER = "Error while syncing user {}";
focal_class.type: String
focal_class.var_name: ERROR_SYNC_USER
focal_class.declarator: NO_BATCH_SIZE = 0
focal_class.modifier: private static final
focal_class.original_string: private static final int NO_BATCH_SIZE = 0;
focal_class.type: int
focal_class.var_name: NO_BATCH_SIZE
focal_class.declarator: DEFAULT_BATCH_SIZE = 100
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_BATCH_SIZE = 100;
focal_class.type: int
focal_class.var_name: DEFAULT_BATCH_SIZE
focal_class.declarator: handler
focal_class.modifier: private final
focal_class.original_string: private final SyncHandler handler;
focal_class.type: SyncHandler
focal_class.var_name: handler
focal_class.declarator: idp
focal_class.modifier: private final
focal_class.original_string: private final ExternalIdentityProvider idp;
focal_class.type: ExternalIdentityProvider
focal_class.var_name: idp
focal_class.declarator: userMgr
focal_class.modifier: private final
focal_class.original_string: private final UserManager userMgr;
focal_class.type: UserManager
focal_class.var_name: userMgr
focal_class.declarator: systemSession
focal_class.modifier: private final
focal_class.original_string: private final ContentSession systemSession;
focal_class.type: ContentSession
focal_class.var_name: systemSession
focal_class.declarator: root
focal_class.modifier: private final
focal_class.original_string: private final Root root;
focal_class.type: Root
focal_class.var_name: root
focal_class.declarator: batchSize
focal_class.modifier: private final
focal_class.original_string: private final int batchSize;
focal_class.type: int
focal_class.var_name: batchSize
focal_class.declarator: context
focal_class.modifier: private
focal_class.original_string: private SyncContext context;
focal_class.type: SyncContext
focal_class.var_name: context
focal_class.file: oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/jmx/Delegatee.java
focal_class.identifier: Delegatee
focal_class.class_method_signature: Delegatee.Delegatee(@NotNull SyncHandler handler, @NotNull ExternalIdentityProvider idp,
                        @NotNull ContentSession systemSession, @NotNull SecurityProvider securityProvider, int batchSize)
focal_class.full_signature: private  Delegatee(@NotNull SyncHandler handler, @NotNull ExternalIdentityProvider idp,
                        @NotNull ContentSession systemSession, @NotNull SecurityProvider securityProvider, int batchSize)
focal_class.identifier: Delegatee
focal_class.modifiers: private
focal_class.parameters: (@NotNull SyncHandler handler, @NotNull ExternalIdentityProvider idp,
                        @NotNull ContentSession systemSession, @NotNull SecurityProvider securityProvider, int batchSize)
focal_class.signature:  Delegatee(@NotNull SyncHandler handler, @NotNull ExternalIdentityProvider idp,
                        @NotNull ContentSession systemSession, @NotNull SecurityProvider securityProvider, int batchSize)
focal_class.class_method_signature: Delegatee.createInstance(@NotNull ContentRepository repository, @NotNull SecurityProvider securityProvider,
                                      @NotNull SyncHandler handler, @NotNull ExternalIdentityProvider idp)
focal_class.full_signature: @NotNull static Delegatee createInstance(@NotNull ContentRepository repository, @NotNull SecurityProvider securityProvider,
                                      @NotNull SyncHandler handler, @NotNull ExternalIdentityProvider idp)
focal_class.identifier: createInstance
focal_class.modifiers: @NotNull static
focal_class.parameters: (@NotNull ContentRepository repository, @NotNull SecurityProvider securityProvider,
                                      @NotNull SyncHandler handler, @NotNull ExternalIdentityProvider idp)
focal_class.return: Delegatee
focal_class.signature: Delegatee createInstance(@NotNull ContentRepository repository, @NotNull SecurityProvider securityProvider,
                                      @NotNull SyncHandler handler, @NotNull ExternalIdentityProvider idp)
focal_class.class_method_signature: Delegatee.createInstance(@NotNull final ContentRepository repository,
                                      @NotNull SecurityProvider securityProvider,
                                      @NotNull SyncHandler handler,
                                      @NotNull ExternalIdentityProvider idp,
                                      int batchSize)
focal_class.full_signature: @NotNull static Delegatee createInstance(@NotNull final ContentRepository repository,
                                      @NotNull SecurityProvider securityProvider,
                                      @NotNull SyncHandler handler,
                                      @NotNull ExternalIdentityProvider idp,
                                      int batchSize)
focal_class.identifier: createInstance
focal_class.modifiers: @NotNull static
focal_class.parameters: (@NotNull final ContentRepository repository,
                                      @NotNull SecurityProvider securityProvider,
                                      @NotNull SyncHandler handler,
                                      @NotNull ExternalIdentityProvider idp,
                                      int batchSize)
focal_class.return: Delegatee
focal_class.signature: Delegatee createInstance(@NotNull final ContentRepository repository,
                                      @NotNull SecurityProvider securityProvider,
                                      @NotNull SyncHandler handler,
                                      @NotNull ExternalIdentityProvider idp,
                                      int batchSize)
focal_class.class_method_signature: Delegatee.close(@NotNull ContentSession systemSession)
focal_class.full_signature: private static void close(@NotNull ContentSession systemSession)
focal_class.identifier: close
focal_class.modifiers: private static
focal_class.parameters: (@NotNull ContentSession systemSession)
focal_class.return: void
focal_class.signature: void close(@NotNull ContentSession systemSession)
focal_class.class_method_signature: Delegatee.close()
focal_class.full_signature:  void close()
focal_class.identifier: close
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: Delegatee.syncUsers(@NotNull String[] userIds, boolean purge)
focal_class.full_signature: @NotNull String[] syncUsers(@NotNull String[] userIds, boolean purge)
focal_class.identifier: syncUsers
focal_class.modifiers: @NotNull
focal_class.parameters: (@NotNull String[] userIds, boolean purge)
focal_class.return: String[]
focal_class.signature: String[] syncUsers(@NotNull String[] userIds, boolean purge)
focal_class.class_method_signature: Delegatee.syncAllUsers(boolean purge)
focal_class.full_signature: @NotNull String[] syncAllUsers(boolean purge)
focal_class.identifier: syncAllUsers
focal_class.modifiers: @NotNull
focal_class.parameters: (boolean purge)
focal_class.return: String[]
focal_class.signature: String[] syncAllUsers(boolean purge)
focal_class.class_method_signature: Delegatee.syncExternalUsers(@NotNull String[] externalIds)
focal_class.full_signature: @NotNull String[] syncExternalUsers(@NotNull String[] externalIds)
focal_class.identifier: syncExternalUsers
focal_class.modifiers: @NotNull
focal_class.parameters: (@NotNull String[] externalIds)
focal_class.return: String[]
focal_class.signature: String[] syncExternalUsers(@NotNull String[] externalIds)
focal_class.class_method_signature: Delegatee.syncAllExternalUsers()
focal_class.full_signature: @NotNull String[] syncAllExternalUsers()
focal_class.identifier: syncAllExternalUsers
focal_class.modifiers: @NotNull
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] syncAllExternalUsers()
focal_class.class_method_signature: Delegatee.listOrphanedUsers()
focal_class.full_signature: @NotNull String[] listOrphanedUsers()
focal_class.identifier: listOrphanedUsers
focal_class.modifiers: @NotNull
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] listOrphanedUsers()
focal_class.class_method_signature: Delegatee.purgeOrphanedUsers()
focal_class.full_signature: @NotNull String[] purgeOrphanedUsers()
focal_class.identifier: purgeOrphanedUsers
focal_class.modifiers: @NotNull
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] purgeOrphanedUsers()
focal_class.class_method_signature: Delegatee.isMyIDP(@NotNull SyncedIdentity id)
focal_class.full_signature: private boolean isMyIDP(@NotNull SyncedIdentity id)
focal_class.identifier: isMyIDP
focal_class.modifiers: private
focal_class.parameters: (@NotNull SyncedIdentity id)
focal_class.return: boolean
focal_class.signature: boolean isMyIDP(@NotNull SyncedIdentity id)
focal_class.class_method_signature: Delegatee.syncUser(@NotNull ExternalIdentity id, @NotNull List<SyncResult> results, @NotNull ResultMessages messages)
focal_class.full_signature: @NotNull private List<SyncResult> syncUser(@NotNull ExternalIdentity id, @NotNull List<SyncResult> results, @NotNull ResultMessages messages)
focal_class.identifier: syncUser
focal_class.modifiers: @NotNull private
focal_class.parameters: (@NotNull ExternalIdentity id, @NotNull List<SyncResult> results, @NotNull ResultMessages messages)
focal_class.return: List<SyncResult>
focal_class.signature: List<SyncResult> syncUser(@NotNull ExternalIdentity id, @NotNull List<SyncResult> results, @NotNull ResultMessages messages)
focal_class.class_method_signature: Delegatee.syncUser(@NotNull String userId, boolean includeIdpName,
                                        @NotNull List<SyncResult> results, @NotNull ResultMessages messages)
focal_class.full_signature: @NotNull private List<SyncResult> syncUser(@NotNull String userId, boolean includeIdpName,
                                        @NotNull List<SyncResult> results, @NotNull ResultMessages messages)
focal_class.identifier: syncUser
focal_class.modifiers: @NotNull private
focal_class.parameters: (@NotNull String userId, boolean includeIdpName,
                                        @NotNull List<SyncResult> results, @NotNull ResultMessages messages)
focal_class.return: List<SyncResult>
focal_class.signature: List<SyncResult> syncUser(@NotNull String userId, boolean includeIdpName,
                                        @NotNull List<SyncResult> results, @NotNull ResultMessages messages)
focal_class.class_method_signature: Delegatee.commit(@NotNull ResultMessages messages, @NotNull List<SyncResult> resultList, int size)
focal_class.full_signature: @NotNull private List<SyncResult> commit(@NotNull ResultMessages messages, @NotNull List<SyncResult> resultList, int size)
focal_class.identifier: commit
focal_class.modifiers: @NotNull private
focal_class.parameters: (@NotNull ResultMessages messages, @NotNull List<SyncResult> resultList, int size)
focal_class.return: List<SyncResult>
focal_class.signature: List<SyncResult> commit(@NotNull ResultMessages messages, @NotNull List<SyncResult> resultList, int size)
focal_class.class_method_signature: Delegatee.internalListOrphanedIdentities()
focal_class.full_signature: @NotNull private Iterator<String> internalListOrphanedIdentities()
focal_class.identifier: internalListOrphanedIdentities
focal_class.modifiers: @NotNull private
focal_class.parameters: ()
focal_class.return: Iterator<String>
focal_class.signature: Iterator<String> internalListOrphanedIdentities()
focal_method.body: @NotNull
      String[] syncExternalUsers(@NotNull String[] externalIds) {
          ResultMessages messages = new ResultMessages();
          context.setForceGroupSync(true).setForceUserSync(true);
  
          List<SyncResult> results = new ArrayList<>(batchSize);
          for (String externalId : externalIds) {
              ExternalIdentityRef ref = ExternalIdentityRef.fromString(externalId);
              if (!idp.getName().equals(ref.getProviderName())) {
                  results.add(new DefaultSyncResultImpl(new DefaultSyncedIdentity(ref.getId(), ref, false, -1), SyncResult.Status.FOREIGN));
              } else {
                  try {
                      ExternalIdentity id = idp.getIdentity(ref);
                      if (id != null) {
                          results = syncUser(id, results, messages);
                      } else {
                          results.add(new DefaultSyncResultImpl(
                                  new DefaultSyncedIdentity("", ref, false, -1),
                                  SyncResult.Status.NO_SUCH_IDENTITY
                          ));
                      }
                  } catch (ExternalIdentityException e) {
                      log.warn("error while fetching the external identity {}", externalId, e);
                      results.add(new ErrorSyncResult(ref, e));
                  }
              }
          }
          commit(messages, results, NO_BATCH_SIZE);
          return messages.getMessages();
      }
focal_method.class_method_signature: Delegatee.syncExternalUsers(@NotNull String[] externalIds)
focal_method.full_signature: @NotNull String[] syncExternalUsers(@NotNull String[] externalIds)
focal_method.identifier: syncExternalUsers
focal_method.invocations: setForceUserSync setForceGroupSync fromString equals getName getProviderName add getId getIdentity syncUser add warn add commit getMessages
focal_method.modifiers: @NotNull
focal_method.parameters: (@NotNull String[] externalIds)
focal_method.return: String[]
focal_method.signature: String[] syncExternalUsers(@NotNull String[] externalIds)