IndexerManagerBean implements IIndexerManagerLocal { @Override @Asynchronous @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) public void indexDocumentIterations(List<DocumentIteration> documentIterations) { Bulk.Builder bulk = new Bulk.Builder(); documentIterations.stream() .filter(documentIteration -> documentIteration.getCheckInDate() != null) .forEach(documentIteration -> addToBulk(documentIteration, bulk)); try { indexManager.sendBulk(bulk); } catch (IndexerNotAvailableException | IndexerRequestException e) { LOGGER.log(Level.FINE, null, e); } }  @Override boolean ping(); @Override @RolesAllowed({UserGroupMapping.ADMIN_ROLE_ID, UserGroupMapping.REGULAR_USER_ROLE_ID}) @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) void createWorkspaceIndex(String workspaceId); @Override @RolesAllowed({UserGroupMapping.ADMIN_ROLE_ID, UserGroupMapping.REGULAR_USER_ROLE_ID}) void deleteWorkspaceIndex(String workspaceId); @Override @Asynchronous @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) void indexDocumentIteration(DocumentIteration documentIteration); @Override @Asynchronous @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) void indexDocumentIterations(List<DocumentIteration> documentIterations); @Override @Asynchronous @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) void indexPartIteration(PartIteration partIteration); @Override @Asynchronous @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) void indexPartIterations(List<PartIteration> partIterations); @Override @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) void removeDocumentIterationFromIndex(DocumentIteration documentIteration); @Override @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) void removePartIterationFromIndex(PartIteration partIteration); @Override @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) List<DocumentRevision> searchDocumentRevisions(DocumentSearchQuery documentSearchQuery, int from, int size); @Override @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) List<PartRevision> searchPartRevisions(PartSearchQuery partSearchQuery, int from, int size); @Override @RolesAllowed({UserGroupMapping.ADMIN_ROLE_ID}) void indexAllWorkspacesData(); @Override @RolesAllowed({UserGroupMapping.ADMIN_ROLE_ID, UserGroupMapping.REGULAR_USER_ROLE_ID}) void indexWorkspaceData(String workspaceId);  }
@Test public void indexDocumentIterationsTest() throws IndexerRequestException, IndexerNotAvailableException { List<DocumentIteration> documentIterations = new ArrayList<>(); documentIterations.add(new DocumentIteration()); documentIterations.add(new DocumentIteration()); indexerManagerBean.indexDocumentIterations(documentIterations); Mockito.verify(indexManager,times(1)) .sendBulk(Matchers.any(Bulk.Builder.class)); }