@Test public void jpaObjectsToSearch() throws Exception { AcmObjectTypeOne typeOne = new AcmObjectTypeOne(); AcmObjectTypeOne deleteMe = new AcmObjectTypeOne(); AcmObjectChangelist changes = new AcmObjectChangelist(); changes.getAddedObjects().add(typeOne); changes.getAddedObjects().add(new AcmObjectTypeTwo()); changes.getUpdatedObjects().add(new AcmObjectTypeTwo()); changes.getDeletedObjects().add(deleteMe); AcmDatabaseChangesEvent event = new AcmDatabaseChangesEvent(changes); Map<String, AcmObjectToSolrDocTransformer> transformerMap = new HashMap<>(); transformerMap.put("testConverter", typeOneSolrConverter); expect(mockContextHolder.getAllBeansOfType(AcmObjectToSolrDocTransformer.class)).andReturn(transformerMap); Capture<SolrAdvancedSearchDocument> capturedAdvancedSearch = new Capture<>(); Capture<SolrDocument> capturedQuickSearch = new Capture<>(); Capture<SolrContentDocument> capturedContentFileIndex = new Capture<>(); Capture<SolrDeleteDocumentByIdRequest> capturedAdvancedDeleteRequest = new Capture<>(); Capture<SolrDeleteDocumentByIdRequest> capturedQuickDeleteRequest = new Capture<>(); Capture<SolrDeleteDocumentByIdRequest> capturedContentFileIndexDeleteRequest = new Capture<>(); mockSendToSolr.sendSolrAdvancedSearchDocuments(Arrays.asList(capture(capturedAdvancedSearch))); mockSendToSolr.sendSolrQuickSearchDocuments(Arrays.asList(capture(capturedQuickSearch))); mockSendToSolr.sendSolrContentFileIndexDocuments(Arrays.asList(capture(capturedContentFileIndex))); mockSendToSolr.sendSolrAdvancedSearchDeletes(Arrays.asList(capture(capturedAdvancedDeleteRequest))); mockSendToSolr.sendSolrQuickSearchDeletes(Arrays.asList(capture(capturedQuickDeleteRequest))); mockSendToSolr.sendSolrContentFileIndexDeletes(Arrays.asList(capture(capturedContentFileIndexDeleteRequest))); replayAll(); service.onApplicationEvent(event); verifyAll(); assertEquals(4, typeOneSolrConverter.getHandledObjectsCount()); assertEquals(2, typeOneSolrConverter.getHandledQuickSearchCount()); assertNotNull(capturedAdvancedSearch.getValue()); assertNotNull(capturedQuickSearch.getValue()); assertNotNull(capturedAdvancedDeleteRequest.getValue()); assertNotNull(capturedQuickDeleteRequest.getValue()); }
@Override public void onApplicationEvent(AcmDatabaseChangesEvent databaseChangesEvent) { updateObjectsInSolr(databaseChangesEvent.getObjectChangelist()); }
JpaObjectsToSearchService implements ApplicationListener<AcmDatabaseChangesEvent> { @Override public void onApplicationEvent(AcmDatabaseChangesEvent databaseChangesEvent) { updateObjectsInSolr(databaseChangesEvent.getObjectChangelist()); } }
JpaObjectsToSearchService implements ApplicationListener<AcmDatabaseChangesEvent> { @Override public void onApplicationEvent(AcmDatabaseChangesEvent databaseChangesEvent) { updateObjectsInSolr(databaseChangesEvent.getObjectChangelist()); }  }
JpaObjectsToSearchService implements ApplicationListener<AcmDatabaseChangesEvent> { @Override public void onApplicationEvent(AcmDatabaseChangesEvent databaseChangesEvent) { updateObjectsInSolr(databaseChangesEvent.getObjectChangelist()); }  @Override void onApplicationEvent(AcmDatabaseChangesEvent databaseChangesEvent); void updateObjectsInSolr(AcmObjectChangelist changes); SpringContextHolder getSpringContextHolder(); void setSpringContextHolder(SpringContextHolder springContextHolder); SendDocumentsToSolr getSendToSolr(); void setSendToSolr(SendDocumentsToSolr sendToSolr); }
JpaObjectsToSearchService implements ApplicationListener<AcmDatabaseChangesEvent> { @Override public void onApplicationEvent(AcmDatabaseChangesEvent databaseChangesEvent) { updateObjectsInSolr(databaseChangesEvent.getObjectChangelist()); }  @Override void onApplicationEvent(AcmDatabaseChangesEvent databaseChangesEvent); void updateObjectsInSolr(AcmObjectChangelist changes); SpringContextHolder getSpringContextHolder(); void setSpringContextHolder(SpringContextHolder springContextHolder); SendDocumentsToSolr getSendToSolr(); void setSendToSolr(SendDocumentsToSolr sendToSolr);  }