@Test public void enableIndexingActionParameter_shouldTriggerTheIndexingEnabling() { final AtomicBoolean invocationMarker = new AtomicBoolean(); admin = new AlfrescoCoreAdminHandler() { @Override NamedList<Object> fixOnSpecificCore( String coreName, Long fromTxCommitTime, Long toTxCommitTime, boolean dryRun, int maxTransactionsToSchedule) { return new NamedList<>(); } @Override NamedList<Object> actionEnableIndexing(SolrParams params) throws JSONException { invocationMarker.set(true); return new SimpleOrderedMap<>(); } }; params.set(ACTION, "ENABLE-INDEXING"); SolrQueryRequest request = mock(SolrQueryRequest.class); when(request.getParams()).thenReturn(params); admin.handleCustomAction(request, mock(SolrQueryResponse.class)); assertTrue(invocationMarker.get()); }
@SuppressWarnings("unchecked") protected void handleCustomAction(SolrQueryRequest req, SolrQueryResponse rsp) { SolrParams params = req.getParams(); String action = ofNullable(params.get(CoreAdminParams.ACTION)) .map(String::trim) .map(String::toUpperCase) .orElse(""); String coreName = coreName(params); LOGGER.info("Running action {} for core {} with params {}", action, coreName, params); try { switch (action) { case "NEWCORE": case "NEWINDEX": rsp.add(ACTION_LABEL, newCore(req)); break; case "UPDATECORE": case "UPDATEINDEX": rsp.add(ACTION_LABEL, updateCore(req)); break; case "UPDATESHARED": rsp.add(ACTION_LABEL, updateShared(req)); break; case "REMOVECORE": rsp.add(ACTION_LABEL, removeCore(req)); break; case "NEWDEFAULTINDEX": case "NEWDEFAULTCORE": rsp.add(ACTION_LABEL, newDefaultCore(req)); break; case "CHECK": rsp.add(ACTION_LABEL, actionCHECK(coreName)); break; case "NODEREPORT": rsp.add(REPORT, actionNODEREPORTS(params)); break; case "ACLREPORT": rsp.add(REPORT, actionACLREPORT(params)); break; case "TXREPORT": rsp.add(REPORT, actionTXREPORT(params)); break; case "ACLTXREPORT": rsp.add(REPORT, actionACLTXREPORT(params)); break; case "RANGECHECK": rsp.getValues().addAll(rangeCheck(params)); break; case "EXPAND": rsp.getValues().addAll(expand(params)); break; case "REPORT": rsp.add(REPORT, actionREPORT(params)); break; case "PURGE": rsp.add(ACTION_LABEL, actionPURGE(params)); break; case "REINDEX": rsp.add(ACTION_LABEL, actionREINDEX(params)); break; case "RETRY": rsp.add(ACTION_LABEL, actionRETRY(params)); break; case "INDEX": rsp.add(ACTION_LABEL, actionINDEX(params)); break; case "FIX": rsp.add(ACTION_LABEL, actionFIX(params)); break; case "SUMMARY": rsp.add(SUMMARY, actionSUMMARY(params)); break; case "LOG4J": rsp.add(ACTION_LABEL, initResourceBasedLogging( ofNullable(params.get("resource")) .orElse("log4j.properties"))); break; case "ENABLE-INDEXING": case "ENABLEINDEXING": rsp.add(ACTION_LABEL, actionEnableIndexing(params)); break; case "DISABLE-INDEXING": case "DISABLEINDEXING": rsp.add(ACTION_LABEL, actionDisableIndexing(params)); break; default: super.handleCustomAction(req, rsp); break; } } catch (Exception ex) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Error executing implementation of admin request " + action, ex); } }
AlfrescoCoreAdminHandler extends CoreAdminHandler { @SuppressWarnings("unchecked") protected void handleCustomAction(SolrQueryRequest req, SolrQueryResponse rsp) { SolrParams params = req.getParams(); String action = ofNullable(params.get(CoreAdminParams.ACTION)) .map(String::trim) .map(String::toUpperCase) .orElse(""); String coreName = coreName(params); LOGGER.info("Running action {} for core {} with params {}", action, coreName, params); try { switch (action) { case "NEWCORE": case "NEWINDEX": rsp.add(ACTION_LABEL, newCore(req)); break; case "UPDATECORE": case "UPDATEINDEX": rsp.add(ACTION_LABEL, updateCore(req)); break; case "UPDATESHARED": rsp.add(ACTION_LABEL, updateShared(req)); break; case "REMOVECORE": rsp.add(ACTION_LABEL, removeCore(req)); break; case "NEWDEFAULTINDEX": case "NEWDEFAULTCORE": rsp.add(ACTION_LABEL, newDefaultCore(req)); break; case "CHECK": rsp.add(ACTION_LABEL, actionCHECK(coreName)); break; case "NODEREPORT": rsp.add(REPORT, actionNODEREPORTS(params)); break; case "ACLREPORT": rsp.add(REPORT, actionACLREPORT(params)); break; case "TXREPORT": rsp.add(REPORT, actionTXREPORT(params)); break; case "ACLTXREPORT": rsp.add(REPORT, actionACLTXREPORT(params)); break; case "RANGECHECK": rsp.getValues().addAll(rangeCheck(params)); break; case "EXPAND": rsp.getValues().addAll(expand(params)); break; case "REPORT": rsp.add(REPORT, actionREPORT(params)); break; case "PURGE": rsp.add(ACTION_LABEL, actionPURGE(params)); break; case "REINDEX": rsp.add(ACTION_LABEL, actionREINDEX(params)); break; case "RETRY": rsp.add(ACTION_LABEL, actionRETRY(params)); break; case "INDEX": rsp.add(ACTION_LABEL, actionINDEX(params)); break; case "FIX": rsp.add(ACTION_LABEL, actionFIX(params)); break; case "SUMMARY": rsp.add(SUMMARY, actionSUMMARY(params)); break; case "LOG4J": rsp.add(ACTION_LABEL, initResourceBasedLogging( ofNullable(params.get("resource")) .orElse("log4j.properties"))); break; case "ENABLE-INDEXING": case "ENABLEINDEXING": rsp.add(ACTION_LABEL, actionEnableIndexing(params)); break; case "DISABLE-INDEXING": case "DISABLEINDEXING": rsp.add(ACTION_LABEL, actionDisableIndexing(params)); break; default: super.handleCustomAction(req, rsp); break; } } catch (Exception ex) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Error executing implementation of admin request " + action, ex); } } }
AlfrescoCoreAdminHandler extends CoreAdminHandler { @SuppressWarnings("unchecked") protected void handleCustomAction(SolrQueryRequest req, SolrQueryResponse rsp) { SolrParams params = req.getParams(); String action = ofNullable(params.get(CoreAdminParams.ACTION)) .map(String::trim) .map(String::toUpperCase) .orElse(""); String coreName = coreName(params); LOGGER.info("Running action {} for core {} with params {}", action, coreName, params); try { switch (action) { case "NEWCORE": case "NEWINDEX": rsp.add(ACTION_LABEL, newCore(req)); break; case "UPDATECORE": case "UPDATEINDEX": rsp.add(ACTION_LABEL, updateCore(req)); break; case "UPDATESHARED": rsp.add(ACTION_LABEL, updateShared(req)); break; case "REMOVECORE": rsp.add(ACTION_LABEL, removeCore(req)); break; case "NEWDEFAULTINDEX": case "NEWDEFAULTCORE": rsp.add(ACTION_LABEL, newDefaultCore(req)); break; case "CHECK": rsp.add(ACTION_LABEL, actionCHECK(coreName)); break; case "NODEREPORT": rsp.add(REPORT, actionNODEREPORTS(params)); break; case "ACLREPORT": rsp.add(REPORT, actionACLREPORT(params)); break; case "TXREPORT": rsp.add(REPORT, actionTXREPORT(params)); break; case "ACLTXREPORT": rsp.add(REPORT, actionACLTXREPORT(params)); break; case "RANGECHECK": rsp.getValues().addAll(rangeCheck(params)); break; case "EXPAND": rsp.getValues().addAll(expand(params)); break; case "REPORT": rsp.add(REPORT, actionREPORT(params)); break; case "PURGE": rsp.add(ACTION_LABEL, actionPURGE(params)); break; case "REINDEX": rsp.add(ACTION_LABEL, actionREINDEX(params)); break; case "RETRY": rsp.add(ACTION_LABEL, actionRETRY(params)); break; case "INDEX": rsp.add(ACTION_LABEL, actionINDEX(params)); break; case "FIX": rsp.add(ACTION_LABEL, actionFIX(params)); break; case "SUMMARY": rsp.add(SUMMARY, actionSUMMARY(params)); break; case "LOG4J": rsp.add(ACTION_LABEL, initResourceBasedLogging( ofNullable(params.get("resource")) .orElse("log4j.properties"))); break; case "ENABLE-INDEXING": case "ENABLEINDEXING": rsp.add(ACTION_LABEL, actionEnableIndexing(params)); break; case "DISABLE-INDEXING": case "DISABLEINDEXING": rsp.add(ACTION_LABEL, actionDisableIndexing(params)); break; default: super.handleCustomAction(req, rsp); break; } } catch (Exception ex) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Error executing implementation of admin request " + action, ex); } } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { @SuppressWarnings("unchecked") protected void handleCustomAction(SolrQueryRequest req, SolrQueryResponse rsp) { SolrParams params = req.getParams(); String action = ofNullable(params.get(CoreAdminParams.ACTION)) .map(String::trim) .map(String::toUpperCase) .orElse(""); String coreName = coreName(params); LOGGER.info("Running action {} for core {} with params {}", action, coreName, params); try { switch (action) { case "NEWCORE": case "NEWINDEX": rsp.add(ACTION_LABEL, newCore(req)); break; case "UPDATECORE": case "UPDATEINDEX": rsp.add(ACTION_LABEL, updateCore(req)); break; case "UPDATESHARED": rsp.add(ACTION_LABEL, updateShared(req)); break; case "REMOVECORE": rsp.add(ACTION_LABEL, removeCore(req)); break; case "NEWDEFAULTINDEX": case "NEWDEFAULTCORE": rsp.add(ACTION_LABEL, newDefaultCore(req)); break; case "CHECK": rsp.add(ACTION_LABEL, actionCHECK(coreName)); break; case "NODEREPORT": rsp.add(REPORT, actionNODEREPORTS(params)); break; case "ACLREPORT": rsp.add(REPORT, actionACLREPORT(params)); break; case "TXREPORT": rsp.add(REPORT, actionTXREPORT(params)); break; case "ACLTXREPORT": rsp.add(REPORT, actionACLTXREPORT(params)); break; case "RANGECHECK": rsp.getValues().addAll(rangeCheck(params)); break; case "EXPAND": rsp.getValues().addAll(expand(params)); break; case "REPORT": rsp.add(REPORT, actionREPORT(params)); break; case "PURGE": rsp.add(ACTION_LABEL, actionPURGE(params)); break; case "REINDEX": rsp.add(ACTION_LABEL, actionREINDEX(params)); break; case "RETRY": rsp.add(ACTION_LABEL, actionRETRY(params)); break; case "INDEX": rsp.add(ACTION_LABEL, actionINDEX(params)); break; case "FIX": rsp.add(ACTION_LABEL, actionFIX(params)); break; case "SUMMARY": rsp.add(SUMMARY, actionSUMMARY(params)); break; case "LOG4J": rsp.add(ACTION_LABEL, initResourceBasedLogging( ofNullable(params.get("resource")) .orElse("log4j.properties"))); break; case "ENABLE-INDEXING": case "ENABLEINDEXING": rsp.add(ACTION_LABEL, actionEnableIndexing(params)); break; case "DISABLE-INDEXING": case "DISABLEINDEXING": rsp.add(ACTION_LABEL, actionDisableIndexing(params)); break; default: super.handleCustomAction(req, rsp); break; } } catch (Exception ex) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Error executing implementation of admin request " + action, ex); } } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); @Override void shutdown(); ConcurrentHashMap<String, InformationServer> getInformationServers(); TrackerRegistry getTrackerRegistry(); SolrTrackerScheduler getScheduler(); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { @SuppressWarnings("unchecked") protected void handleCustomAction(SolrQueryRequest req, SolrQueryResponse rsp) { SolrParams params = req.getParams(); String action = ofNullable(params.get(CoreAdminParams.ACTION)) .map(String::trim) .map(String::toUpperCase) .orElse(""); String coreName = coreName(params); LOGGER.info("Running action {} for core {} with params {}", action, coreName, params); try { switch (action) { case "NEWCORE": case "NEWINDEX": rsp.add(ACTION_LABEL, newCore(req)); break; case "UPDATECORE": case "UPDATEINDEX": rsp.add(ACTION_LABEL, updateCore(req)); break; case "UPDATESHARED": rsp.add(ACTION_LABEL, updateShared(req)); break; case "REMOVECORE": rsp.add(ACTION_LABEL, removeCore(req)); break; case "NEWDEFAULTINDEX": case "NEWDEFAULTCORE": rsp.add(ACTION_LABEL, newDefaultCore(req)); break; case "CHECK": rsp.add(ACTION_LABEL, actionCHECK(coreName)); break; case "NODEREPORT": rsp.add(REPORT, actionNODEREPORTS(params)); break; case "ACLREPORT": rsp.add(REPORT, actionACLREPORT(params)); break; case "TXREPORT": rsp.add(REPORT, actionTXREPORT(params)); break; case "ACLTXREPORT": rsp.add(REPORT, actionACLTXREPORT(params)); break; case "RANGECHECK": rsp.getValues().addAll(rangeCheck(params)); break; case "EXPAND": rsp.getValues().addAll(expand(params)); break; case "REPORT": rsp.add(REPORT, actionREPORT(params)); break; case "PURGE": rsp.add(ACTION_LABEL, actionPURGE(params)); break; case "REINDEX": rsp.add(ACTION_LABEL, actionREINDEX(params)); break; case "RETRY": rsp.add(ACTION_LABEL, actionRETRY(params)); break; case "INDEX": rsp.add(ACTION_LABEL, actionINDEX(params)); break; case "FIX": rsp.add(ACTION_LABEL, actionFIX(params)); break; case "SUMMARY": rsp.add(SUMMARY, actionSUMMARY(params)); break; case "LOG4J": rsp.add(ACTION_LABEL, initResourceBasedLogging( ofNullable(params.get("resource")) .orElse("log4j.properties"))); break; case "ENABLE-INDEXING": case "ENABLEINDEXING": rsp.add(ACTION_LABEL, actionEnableIndexing(params)); break; case "DISABLE-INDEXING": case "DISABLEINDEXING": rsp.add(ACTION_LABEL, actionDisableIndexing(params)); break; default: super.handleCustomAction(req, rsp); break; } } catch (Exception ex) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Error executing implementation of admin request " + action, ex); } } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); @Override void shutdown(); ConcurrentHashMap<String, InformationServer> getInformationServers(); TrackerRegistry getTrackerRegistry(); SolrTrackerScheduler getScheduler(); static final String ALFRESCO_DEFAULTS; }