IndexerManagerBean implements IIndexerManagerLocal { @Override @Asynchronous @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) public void indexPartIteration(PartIteration partIteration) { try { Update.Builder update = indexerQueryBuilder.updateRequest(partIteration); DocumentResult execute = indexManager.executeUpdate(update); if (execute.isSucceeded()) { LOGGER.log(Level.INFO, "Part iteration [" + partIteration.getKey() + "] indexed"); } else { LOGGER.log(Level.WARNING, "The part " + partIteration.getKey() + " cannot be indexed : \n" + execute.getErrorMessage()); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Cannot build request for part: " + partIteration.getKey(), e); } catch (IndexerNotAvailableException | IndexerRequestException e) { LOGGER.log(Level.WARNING, "The part " + partIteration.getKey() + " cannot be indexed.", 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 indexPartIterationTest() throws IndexerNotAvailableException, AccountNotFoundException, IndexerRequestException { DocumentResult documentResult = new DocumentResult(new Gson()); PartIteration partIteration = new PartIteration(); Mockito.when(indexManager.executeUpdate(Matchers.any(Update.Builder.class))) .thenReturn(documentResult); indexerManagerBean.indexPartIteration(partIteration); Mockito.verify(indexManager,times(1)).executeUpdate(Matchers.any(Update.Builder.class)); }