@Test public void maxTransactionScheduledIsNull_shouldBeGatheredFromCoreProperties() { params.set(CORE, ALFRESCO_CORE_NAME); int expectedMaxTransactionToSchedule = 17892; Properties coreProperties = new Properties(); coreProperties.setProperty( MAX_TRANSACTIONS_TO_SCHEDULE_CONF_PROPERTY_NAME, String.valueOf(expectedMaxTransactionToSchedule)); CoreContainer coreContainer = mock(CoreContainer.class); SolrCore core = mock(SolrCore.class); SolrResourceLoader resourceLoader = mock(SolrResourceLoader.class); when(coreContainer.getCore(ALFRESCO_CORE_NAME)).thenReturn(core); when(core.getResourceLoader()).thenReturn(resourceLoader); when(resourceLoader.getCoreProperties()).thenReturn(coreProperties); admin = new AlfrescoCoreAdminHandler(coreContainer); assertEquals(expectedMaxTransactionToSchedule, admin.getMaxTransactionToSchedule(params)); }
int getMaxTransactionToSchedule(SolrParams params) { String requestedCoreName = coreName(params); return ofNullable(params.getInt(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME)) .orElseGet(() -> ofNullable(coreContainer) .map(container -> container.getCore(requestedCoreName)) .map(SolrCore::getResourceLoader) .map(SolrResourceLoader::getCoreProperties) .map(conf -> conf.getProperty(MAX_TRANSACTIONS_TO_SCHEDULE_CONF_PROPERTY_NAME)) .map(Integer::parseInt) .orElse(Integer.MAX_VALUE)); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { int getMaxTransactionToSchedule(SolrParams params) { String requestedCoreName = coreName(params); return ofNullable(params.getInt(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME)) .orElseGet(() -> ofNullable(coreContainer) .map(container -> container.getCore(requestedCoreName)) .map(SolrCore::getResourceLoader) .map(SolrResourceLoader::getCoreProperties) .map(conf -> conf.getProperty(MAX_TRANSACTIONS_TO_SCHEDULE_CONF_PROPERTY_NAME)) .map(Integer::parseInt) .orElse(Integer.MAX_VALUE)); } }
AlfrescoCoreAdminHandler extends CoreAdminHandler { int getMaxTransactionToSchedule(SolrParams params) { String requestedCoreName = coreName(params); return ofNullable(params.getInt(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME)) .orElseGet(() -> ofNullable(coreContainer) .map(container -> container.getCore(requestedCoreName)) .map(SolrCore::getResourceLoader) .map(SolrResourceLoader::getCoreProperties) .map(conf -> conf.getProperty(MAX_TRANSACTIONS_TO_SCHEDULE_CONF_PROPERTY_NAME)) .map(Integer::parseInt) .orElse(Integer.MAX_VALUE)); } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { int getMaxTransactionToSchedule(SolrParams params) { String requestedCoreName = coreName(params); return ofNullable(params.getInt(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME)) .orElseGet(() -> ofNullable(coreContainer) .map(container -> container.getCore(requestedCoreName)) .map(SolrCore::getResourceLoader) .map(SolrResourceLoader::getCoreProperties) .map(conf -> conf.getProperty(MAX_TRANSACTIONS_TO_SCHEDULE_CONF_PROPERTY_NAME)) .map(Integer::parseInt) .orElse(Integer.MAX_VALUE)); } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); @Override void shutdown(); ConcurrentHashMap<String, InformationServer> getInformationServers(); TrackerRegistry getTrackerRegistry(); SolrTrackerScheduler getScheduler(); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { int getMaxTransactionToSchedule(SolrParams params) { String requestedCoreName = coreName(params); return ofNullable(params.getInt(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME)) .orElseGet(() -> ofNullable(coreContainer) .map(container -> container.getCore(requestedCoreName)) .map(SolrCore::getResourceLoader) .map(SolrResourceLoader::getCoreProperties) .map(conf -> conf.getProperty(MAX_TRANSACTIONS_TO_SCHEDULE_CONF_PROPERTY_NAME)) .map(Integer::parseInt) .orElse(Integer.MAX_VALUE)); } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); @Override void shutdown(); ConcurrentHashMap<String, InformationServer> getInformationServers(); TrackerRegistry getTrackerRegistry(); SolrTrackerScheduler getScheduler(); static final String ALFRESCO_DEFAULTS; }