private ExecutorManager createMultiExecutorManagerInstance() throws Exception { this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true"); this.props.put(Constants.ConfigurationKeys.QUEUEPROCESSING_ENABLED, "false"); this.loader.addExecutor("localhost", 12345); this.loader.addExecutor("localhost", 12346); return createExecutorManager(); }
@Test public void testMultipleExecutorScenario() throws Exception { this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true"); final Executor executor1 = this.loader.addExecutor("localhost", 12345); final Executor executor2 = this.loader.addExecutor("localhost", 12346); final ExecutorManager manager = createExecutorManager(); final Set<Executor> activeExecutors = new HashSet(manager.getAllActiveExecutors()); Assert.assertArrayEquals(activeExecutors.toArray(), new Executor[]{ executor1, executor2}); }
@Test public void testSetupExecutorsSucess() throws Exception { this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true"); final Executor executor1 = this.loader.addExecutor("localhost", 12345); final ExecutorManager manager = createExecutorManager(); Assert.assertArrayEquals(manager.getAllActiveExecutors().toArray(), new Executor[]{executor1}); // mark older executor as inactive executor1.setActive(false); this.loader.updateExecutor(executor1); final Executor executor2 = this.loader.addExecutor("localhost", 12346); final Executor executor3 = this.loader.addExecutor("localhost", 12347); manager.setupExecutors(); Assert.assertArrayEquals(manager.getAllActiveExecutors().toArray(), new Executor[]{executor2, executor3}); }
@Test(expected = ExecutorManagerException.class) public void testSetupExecutorsException() throws Exception { this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true"); final Executor executor1 = this.loader.addExecutor("localhost", 12345); final ExecutorManager manager = createExecutorManager(); final Set<Executor> activeExecutors = new HashSet(manager.getAllActiveExecutors()); Assert.assertArrayEquals(activeExecutors.toArray(), new Executor[]{executor1}); // mark older executor as inactive executor1.setActive(false); this.loader.updateExecutor(executor1); manager.setupExecutors(); }
assertNotNull(executorLoader); final Executor executor = executorLoader.addExecutor("localhost", 60000); executor.setActive(true); executorLoader.updateExecutor(executor);
this.executorLoader.fetchExecutor(executorHost, executorPort); if (executor == null) { executor = this.executorLoader.addExecutor(executorHost, executorPort); } else if (!executor.isActive()) { executor.setActive(true);