@Test public void testDoWorkWithException() throws Exception { ArrayList<ThreadedTeeInputStreamWorker<byte[], String>> workers = new ArrayList<ThreadedTeeInputStreamWorker<byte[], String>>(); TestThreadedTeeInputStreamWorker worker1 = new TestThreadedTeeInputStreamWorker("1"); worker1.setMetricsManager(metricsManager); workers.add(worker1); TestThreadedTeeInputStreamWorkerWithException worker2 = new TestThreadedTeeInputStreamWorkerWithException("2"); worker2.setMetricsManager(metricsManager); workers.add(worker2); ThreadedInputStreamProcess process = new ThreadedInputStreamProcess<byte[], String>("test", workers); byte[] data = createMockData(10); ByteArrayInputStream in = new ByteArrayInputStream(data); List<ThreadedTeeInputStreamWorker.WorkResult<byte[]>> results = process.doWork(in, "test1", 5); assertEquals(2, results.size()); assertEquals(null, results.get(0).getError()); assertNotEquals(null, results.get(1).getError()); assertEquals("2 throwing exception", results.get(1).getError().getMessage()); ByteArrayOutputStream expected = new ByteArrayOutputStream(); expected.write("1".getBytes()); expected.write("test1".getBytes()); expected.write(data); assertArrayEquals(expected.toByteArray(), results.get(0).getResult()); }
public List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data) throws Exception { TeeInputStream teeInputStream = new TeeInputStream(source, this.workerNames); return doWork(data, teeInputStream); }
ThreadedInputStreamProcess { public List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data) throws Exception { TeeInputStream teeInputStream = new TeeInputStream(source, this.workerNames); return doWork(data, teeInputStream); } }
ThreadedInputStreamProcess { public List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data) throws Exception { TeeInputStream teeInputStream = new TeeInputStream(source, this.workerNames); return doWork(data, teeInputStream); } ThreadedInputStreamProcess(String threadNamePrefix,
            Collection<? extends ThreadedTeeInputStreamWorker<TResult, TData>> workersCollection); }
ThreadedInputStreamProcess { public List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data) throws Exception { TeeInputStream teeInputStream = new TeeInputStream(source, this.workerNames); return doWork(data, teeInputStream); } ThreadedInputStreamProcess(String threadNamePrefix,
            Collection<? extends ThreadedTeeInputStreamWorker<TResult, TData>> workersCollection); List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data); List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data, int bufferSize); void stop(); }
ThreadedInputStreamProcess { public List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data) throws Exception { TeeInputStream teeInputStream = new TeeInputStream(source, this.workerNames); return doWork(data, teeInputStream); } ThreadedInputStreamProcess(String threadNamePrefix,
            Collection<? extends ThreadedTeeInputStreamWorker<TResult, TData>> workersCollection); List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data); List<ThreadedTeeInputStreamWorker.WorkResult<TResult>> doWork(InputStream source, TData data, int bufferSize); void stop();  }