private void initExecutor() { executor = taskManagerHelper.createExecutorService(); }
private void initExecutor() { executor = taskManagerHelper.createExecutorService(); }
@Test public void testCreateExecutorServiceWithManualValueCorrect() { //verify the creation when the THREAD_POOL_SIZE_PROPERTY_NAME property was set to a correct value. int valueToSet = 1234; System.setProperty(PipelineExecutorTaskManagerImpl.THREAD_POOL_SIZE_PROPERTY_NAME, Integer.toString(valueToSet)); ExecutorService executorService = taskManagerHelper.createExecutorService(); verifyExecutorServiceAndDestroy(executorService, valueToSet); }
@Test public void testCreateExecutorServiceWithManualValueCorrect() { //verify the creation when the THREAD_POOL_SIZE_PROPERTY_NAME property was set to a correct value. int valueToSet = 1234; System.setProperty(PipelineExecutorTaskManagerImpl.THREAD_POOL_SIZE_PROPERTY_NAME, Integer.toString(valueToSet)); ExecutorService executorService = taskManagerHelper.createExecutorService(); verifyExecutorServiceAndDestroy(executorService, valueToSet); }
@Test public void testCreateExecutorServiceWithManualValueIncorrect() { //verify the creation when the THREAD_POOL_SIZE_PROPERTY_NAME property was set to a wrong value. String valueToSet = "an invalid integer"; System.setProperty(PipelineExecutorTaskManagerImpl.THREAD_POOL_SIZE_PROPERTY_NAME, valueToSet); ExecutorService executorService = taskManagerHelper.createExecutorService(); verifyExecutorServiceAndDestroy(executorService, PipelineExecutorTaskManagerImpl.DEFAULT_THREAD_POOL_SIZE); }
@Test public void testCreateExecutorServiceWithManualValueIncorrect() { //verify the creation when the THREAD_POOL_SIZE_PROPERTY_NAME property was set to a wrong value. String valueToSet = "an invalid integer"; System.setProperty(PipelineExecutorTaskManagerImpl.THREAD_POOL_SIZE_PROPERTY_NAME, valueToSet); ExecutorService executorService = taskManagerHelper.createExecutorService(); verifyExecutorServiceAndDestroy(executorService, PipelineExecutorTaskManagerImpl.DEFAULT_THREAD_POOL_SIZE); }
@Test public void testExecutorServiceInitialization() { taskManager.init(); verify(taskManagerHelper, times(1)).createExecutorService(); assertNotNull(taskManager.executor); }
@Test public void testCreateExecutorServiceWithDefaultValue() { //verify the creation when the THREAD_POOL_SIZE_PROPERTY_NAME property was not set. //The by default value must be used. ExecutorService executorService = taskManagerHelper.createExecutorService(); verifyExecutorServiceAndDestroy(executorService, PipelineExecutorTaskManagerImpl.DEFAULT_THREAD_POOL_SIZE); }
@Test public void testExecutorServiceInitialization() { taskManager.init(); verify(taskManagerHelper, times(1)).createExecutorService(); assertNotNull(taskManager.executor); }
@Test public void testCreateExecutorServiceWithDefaultValue() { //verify the creation when the THREAD_POOL_SIZE_PROPERTY_NAME property was not set. //The by default value must be used. ExecutorService executorService = taskManagerHelper.createExecutorService(); verifyExecutorServiceAndDestroy(executorService, PipelineExecutorTaskManagerImpl.DEFAULT_THREAD_POOL_SIZE); }
@Before public void setUp() { pipelineExecutorTraceCaptor = ArgumentCaptor.forClass(PipelineExecutorTrace.class); taskEntryCaptor = ArgumentCaptor.forClass(PipelineExecutorTaskManagerImpl.TaskEntry.class); stringCaptor = ArgumentCaptor.forClass(String.class); configExecutors = mockConfigExecutors(CONFIG_EXECUTORS_SIZE); when(configExecutorsInstance.iterator()).thenReturn(configExecutors.iterator()); externalListeners = mockEventListeners(PIPELINE_EVENT_LISTENERS); when(eventListenersInstance.iterator()).thenReturn(externalListeners.iterator()); taskManagerHelper = spy(new PipelineExecutorTaskManagerImplHelper(configExecutorsInstance, eventListenersInstance)); doReturn(executorService).when(taskManagerHelper).createExecutorService(); doReturn(pipelineExecutor).when(taskManagerHelper).createPipelineExecutor(); taskManager = spy(new PipelineExecutorTaskManagerImpl(pipelineRegistry, configExecutorsInstance, eventListenersInstance, pipelineExecutorRegistry) { { super.taskManagerHelper = PipelineExecutorTaskManagerImplTestBase.this.taskManagerHelper; } @Override protected void init() { super.init(); super.futureTaskMap = spy(super.futureTaskMap); } }); }
@Before public void setUp() { pipelineExecutorTraceCaptor = ArgumentCaptor.forClass(PipelineExecutorTrace.class); taskEntryCaptor = ArgumentCaptor.forClass(PipelineExecutorTaskManagerImpl.TaskEntry.class); stringCaptor = ArgumentCaptor.forClass(String.class); configExecutors = mockConfigExecutors(CONFIG_EXECUTORS_SIZE); when(configExecutorsInstance.iterator()).thenReturn(configExecutors.iterator()); externalListeners = mockEventListeners(PIPELINE_EVENT_LISTENERS); when(eventListenersInstance.iterator()).thenReturn(externalListeners.iterator()); taskManagerHelper = spy(new PipelineExecutorTaskManagerImplHelper(configExecutorsInstance, eventListenersInstance)); doReturn(executorService).when(taskManagerHelper).createExecutorService(); doReturn(pipelineExecutor).when(taskManagerHelper).createPipelineExecutor(); taskManager = spy(new PipelineExecutorTaskManagerImpl(pipelineRegistry, configExecutorsInstance, eventListenersInstance, pipelineExecutorRegistry) { { super.taskManagerHelper = PipelineExecutorTaskManagerImplTestBase.this.taskManagerHelper; } @Override protected void init() { super.init(); super.futureTaskMap = spy(super.futureTaskMap); } }); }