protected void reindexExportImportConfigurations(long companyId) throws PortalException { final ActionableDynamicQuery actionableDynamicQuery = ExportImportConfigurationLocalServiceUtil.getActionableDynamicQuery(); actionableDynamicQuery.setCompanyId(companyId); actionableDynamicQuery.setPerformActionMethod( new ActionableDynamicQuery.PerformActionMethod() { @Override public void performAction(Object object) throws PortalException { ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration) object; Document document = getDocument(exportImportConfiguration); actionableDynamicQuery.addDocument(document); } }); actionableDynamicQuery.setSearchEngineId(getSearchEngineId()); actionableDynamicQuery.performActions(); }
@Test public void testActionableDynamicQuery() throws Exception { final IntegerWrapper count = new IntegerWrapper(); ActionableDynamicQuery actionableDynamicQuery = ExportImportConfigurationLocalServiceUtil.getActionableDynamicQuery(); actionableDynamicQuery.setPerformActionMethod( new ActionableDynamicQuery.PerformActionMethod() { @Override public void performAction(Object object) { ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration) object; Assert.assertNotNull(exportImportConfiguration); count.increment(); } }); actionableDynamicQuery.performActions(); Assert.assertEquals(count.getValue(), _persistence.countAll()); }