PoolingSplitJoinService extends SplitJoinService { public void setMaxThreads(Integer size) { maxThreads = size; } PoolingSplitJoinService(); @Override void prepare(); @Override void initService(); @Override void start(); @Override void closeService(); Integer getMaxThreads(); void setMaxThreads(Integer size); PoolingSplitJoinService withMaxThreads(Integer max); Boolean getWarmStart(); void setWarmStart(Boolean b); PoolingSplitJoinService withWarmStart(Boolean b);  }
@Test public void testSetMaxThreads() throws Exception { PoolingSplitJoinService service = createServiceForTests(); assertNull(service.getMaxThreads()); service.setMaxThreads(10); assertEquals(10, service.getMaxThreads().intValue()); service.setMaxThreads(null); assertNull(service.getMaxThreads()); }
@Test public void testService_MaxThreadSpecified() throws Exception { AdaptrisMessage msg = SplitterCase.createLineCountMessageInput(); PoolingSplitJoinService service = createServiceForTests(); service.setMaxThreads(8); service.setService(asCollection(new NullService())); service.setTimeout(new TimeInterval(10L, TimeUnit.SECONDS)); service.setSplitter(new LineCountSplitter()); service.setAggregator(new MimeAggregator()); execute(service, msg); BodyPartIterator input = MimeHelper.createBodyPartIterator(msg); await() .atMost(FIVE_SECONDS) .with() .pollInterval(ONE_HUNDRED_MILLISECONDS) .until(input::size, equalTo(11)); assertEquals(11, input.size()); }