(S)FTP Lambdas
AMQP Lambdas Event Lambdas Feed/File Lambdas Gemfile/Groovy Lambdas * Ensure that JavaDocs are checked via ` check.dependsOn javadoc` * Add `@return` tag to the `MessageBuilder.readOnlyHeaders()`
This commit is contained in:
committed by
Artem Bilan
parent
3402a86fb5
commit
e5ae7d886d
@@ -36,7 +36,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
@@ -87,15 +86,11 @@ public class FileInboundTransactionTests {
|
||||
public void testNoTx() throws Exception {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
final AtomicBoolean crash = new AtomicBoolean();
|
||||
input.subscribe(new MessageHandler() {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
if (crash.get()) {
|
||||
throw new MessagingException("eek");
|
||||
}
|
||||
latch.countDown();
|
||||
input.subscribe(message -> {
|
||||
if (crash.get()) {
|
||||
throw new MessagingException("eek");
|
||||
}
|
||||
latch.countDown();
|
||||
});
|
||||
pseudoTx.start();
|
||||
File file = new File(tmpDir.getRoot(), "si-test1/foo");
|
||||
@@ -123,15 +118,11 @@ public class FileInboundTransactionTests {
|
||||
public void testTx() throws Exception {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
final AtomicBoolean crash = new AtomicBoolean();
|
||||
txInput.subscribe(new MessageHandler() {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
if (crash.get()) {
|
||||
throw new MessagingException("eek");
|
||||
}
|
||||
latch.countDown();
|
||||
txInput.subscribe(message -> {
|
||||
if (crash.get()) {
|
||||
throw new MessagingException("eek");
|
||||
}
|
||||
latch.countDown();
|
||||
});
|
||||
realTx.start();
|
||||
File file = new File(tmpDir.getRoot(), "si-test2/baz");
|
||||
|
||||
@@ -142,28 +142,18 @@ public class FileReadingMessageSourceIntegrationTests {
|
||||
@Repeat(5)
|
||||
public void concurrentProcessing() throws Exception {
|
||||
CountDownLatch go = new CountDownLatch(1);
|
||||
Runnable successfulConsumer = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Message<File> received = pollableFileSource.receive();
|
||||
while (received == null) {
|
||||
Thread.yield();
|
||||
received = pollableFileSource.receive();
|
||||
}
|
||||
Runnable successfulConsumer = () -> {
|
||||
Message<File> received = pollableFileSource.receive();
|
||||
while (received == null) {
|
||||
Thread.yield();
|
||||
received = pollableFileSource.receive();
|
||||
}
|
||||
|
||||
};
|
||||
Runnable failingConsumer = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Message<File> received = pollableFileSource.receive();
|
||||
if (received != null) {
|
||||
pollableFileSource.onFailure(received);
|
||||
}
|
||||
Runnable failingConsumer = () -> {
|
||||
Message<File> received = pollableFileSource.receive();
|
||||
if (received != null) {
|
||||
pollableFileSource.onFailure(received);
|
||||
}
|
||||
|
||||
};
|
||||
CountDownLatch successfulDone = doConcurrently(3, successfulConsumer, go);
|
||||
CountDownLatch failingDone = doConcurrently(10, failingConsumer, go);
|
||||
|
||||
@@ -50,8 +50,6 @@ import org.junit.rules.TemporaryFolder;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.integration.channel.NullChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.file.FileWritingMessageHandler.FlushPredicate;
|
||||
import org.springframework.integration.file.FileWritingMessageHandler.MessageFlushPredicate;
|
||||
import org.springframework.integration.file.support.FileExistsMode;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
@@ -381,13 +379,7 @@ public class FileWritingMessageHandlerTests {
|
||||
final String anyFilename = "fooBar.test";
|
||||
QueueChannel output = new QueueChannel();
|
||||
handler.setOutputChannel(output);
|
||||
handler.setFileNameGenerator(new FileNameGenerator() {
|
||||
|
||||
@Override
|
||||
public String generateFileName(Message<?> message) {
|
||||
return anyFilename;
|
||||
}
|
||||
});
|
||||
handler.setFileNameGenerator(message -> anyFilename);
|
||||
Message<?> message = MessageBuilder.withPayload("test").build();
|
||||
handler.handleMessage(message);
|
||||
File result = (File) output.receive(0).getPayload();
|
||||
@@ -449,13 +441,7 @@ public class FileWritingMessageHandlerTests {
|
||||
File tempFolder = this.temp.newFolder();
|
||||
FileWritingMessageHandler handler = new FileWritingMessageHandler(tempFolder);
|
||||
handler.setFileExistsMode(FileExistsMode.APPEND_NO_FLUSH);
|
||||
handler.setFileNameGenerator(new FileNameGenerator() {
|
||||
|
||||
@Override
|
||||
public String generateFileName(Message<?> message) {
|
||||
return "foo.txt";
|
||||
}
|
||||
});
|
||||
handler.setFileNameGenerator(message -> "foo.txt");
|
||||
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
|
||||
taskScheduler.afterPropertiesSet();
|
||||
handler.setTaskScheduler(taskScheduler);
|
||||
@@ -487,14 +473,9 @@ public class FileWritingMessageHandlerTests {
|
||||
|
||||
handler.setFlushInterval(30000);
|
||||
final AtomicBoolean called = new AtomicBoolean();
|
||||
handler.setFlushPredicate(new MessageFlushPredicate() {
|
||||
|
||||
@Override
|
||||
public boolean shouldFlush(String fileAbsolutePath, long lastWrite, Message<?> triggerMessage) {
|
||||
called.set(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler.setFlushPredicate((fileAbsolutePath, lastWrite, triggerMessage) -> {
|
||||
called.set(true);
|
||||
return true;
|
||||
});
|
||||
handler.handleMessage(new GenericMessage<InputStream>(new ByteArrayInputStream("box".getBytes())));
|
||||
handler.trigger(new GenericMessage<String>("foo"));
|
||||
@@ -503,14 +484,9 @@ public class FileWritingMessageHandlerTests {
|
||||
|
||||
handler.handleMessage(new GenericMessage<InputStream>(new ByteArrayInputStream("bux".getBytes())));
|
||||
called.set(false);
|
||||
handler.flushIfNeeded(new FlushPredicate() {
|
||||
|
||||
@Override
|
||||
public boolean shouldFlush(String fileAbsolutePath, long lastWrite) {
|
||||
called.set(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler.flushIfNeeded((fileAbsolutePath, lastWrite) -> {
|
||||
called.set(true);
|
||||
return true;
|
||||
});
|
||||
assertThat(file.length(), equalTo(24L));
|
||||
assertTrue(called.get());
|
||||
|
||||
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
@@ -29,8 +28,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
@@ -81,21 +78,17 @@ public class PersistentAcceptOnceFileListFilterExternalStoreTests extends RedisA
|
||||
|
||||
store = Mockito.spy(store);
|
||||
|
||||
Mockito.doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
if (suspend.get()) {
|
||||
latch2.countDown();
|
||||
try {
|
||||
latch1.await(10, TimeUnit.SECONDS);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
Mockito.doAnswer(invocation -> {
|
||||
if (suspend.get()) {
|
||||
latch2.countDown();
|
||||
try {
|
||||
latch1.await(10, TimeUnit.SECONDS);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
return invocation.callRealMethod();
|
||||
}
|
||||
return invocation.callRealMethod();
|
||||
}).when(store).replace(Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
||||
|
||||
final FileSystemPersistentAcceptOnceFileListFilter filter =
|
||||
@@ -114,13 +107,8 @@ public class PersistentAcceptOnceFileListFilterExternalStoreTests extends RedisA
|
||||
suspend.set(true);
|
||||
file.setLastModified(file.lastModified() + 5000L);
|
||||
|
||||
Future<Integer> result = Executors.newSingleThreadExecutor().submit(new Callable<Integer>() {
|
||||
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
return filter.filterFiles(new File[] {file}).size();
|
||||
}
|
||||
});
|
||||
Future<Integer> result = Executors.newSingleThreadExecutor()
|
||||
.submit(() -> filter.filterFiles(new File[] { file }).size());
|
||||
assertTrue(latch2.await(10, TimeUnit.SECONDS));
|
||||
store.put("foo:" + file.getAbsolutePath(), "43");
|
||||
latch1.countDown();
|
||||
|
||||
@@ -54,8 +54,6 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
@@ -260,14 +258,10 @@ public class RemoteFileOutboundGatewayTests {
|
||||
gw.afterPropertiesSet();
|
||||
Session<?> session = mock(Session.class);
|
||||
final AtomicReference<String> args = new AtomicReference<String>();
|
||||
doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
Object[] arguments = invocation.getArguments();
|
||||
args.set((String) arguments[0] + (String) arguments[1]);
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
Object[] arguments = invocation.getArguments();
|
||||
args.set((String) arguments[0] + (String) arguments[1]);
|
||||
return null;
|
||||
}).when(session).rename(anyString(), anyString());
|
||||
when(sessionFactory.getSession()).thenReturn(session);
|
||||
Message<String> requestMessage = MessageBuilder.withPayload("foo")
|
||||
@@ -287,14 +281,10 @@ public class RemoteFileOutboundGatewayTests {
|
||||
gw.afterPropertiesSet();
|
||||
Session<?> session = mock(Session.class);
|
||||
final AtomicReference<String> args = new AtomicReference<String>();
|
||||
doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
Object[] arguments = invocation.getArguments();
|
||||
args.set((String) arguments[0] + (String) arguments[1]);
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
Object[] arguments = invocation.getArguments();
|
||||
args.set((String) arguments[0] + (String) arguments[1]);
|
||||
return null;
|
||||
}).when(session).rename(anyString(), anyString());
|
||||
when(sessionFactory.getSession()).thenReturn(session);
|
||||
Message<?> out = (Message<?>) gw.handleRequestMessage(new GenericMessage<String>("foo"));
|
||||
@@ -312,23 +302,15 @@ public class RemoteFileOutboundGatewayTests {
|
||||
gw.afterPropertiesSet();
|
||||
Session<?> session = mock(Session.class);
|
||||
final AtomicReference<String> args = new AtomicReference<String>();
|
||||
doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
Object[] arguments = invocation.getArguments();
|
||||
args.set((String) arguments[0] + (String) arguments[1]);
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
Object[] arguments = invocation.getArguments();
|
||||
args.set((String) arguments[0] + (String) arguments[1]);
|
||||
return null;
|
||||
}).when(session).rename(anyString(), anyString());
|
||||
final List<String> madeDirs = new ArrayList<String>();
|
||||
doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
madeDirs.add((String) invocation.getArguments()[0]);
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
madeDirs.add((String) invocation.getArguments()[0]);
|
||||
return null;
|
||||
}).when(session).mkdir(anyString());
|
||||
when(sessionFactory.getSession()).thenReturn(session);
|
||||
Message<String> requestMessage = MessageBuilder.withPayload("foo")
|
||||
@@ -926,13 +908,9 @@ public class RemoteFileOutboundGatewayTests {
|
||||
gw.afterPropertiesSet();
|
||||
when(sessionFactory.getSession()).thenReturn(session);
|
||||
final AtomicReference<String> written = new AtomicReference<String>();
|
||||
doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
written.set((String) invocation.getArguments()[1]);
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
written.set((String) invocation.getArguments()[1]);
|
||||
return null;
|
||||
}).when(session).write(any(InputStream.class), anyString());
|
||||
tempFolder.newFile("baz.txt");
|
||||
tempFolder.newFile("qux.txt");
|
||||
@@ -964,13 +942,9 @@ public class RemoteFileOutboundGatewayTests {
|
||||
gw.afterPropertiesSet();
|
||||
when(sessionFactory.getSession()).thenReturn(session);
|
||||
final AtomicReference<String> written = new AtomicReference<String>();
|
||||
doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
written.set((String) invocation.getArguments()[1]);
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
written.set((String) invocation.getArguments()[1]);
|
||||
return null;
|
||||
}).when(session).write(any(InputStream.class), anyString());
|
||||
tempFolder.newFile("baz.txt");
|
||||
tempFolder.newFile("qux.txt");
|
||||
|
||||
@@ -35,8 +35,6 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
@@ -45,11 +43,11 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.integration.file.remote.session.CachingSessionFactory;
|
||||
import org.springframework.integration.file.remote.session.Session;
|
||||
import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.integration.util.SimplePool;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
@@ -65,12 +63,10 @@ public class FileTransferringMessageHandlerTests {
|
||||
Session<F> session = mock(Session.class);
|
||||
|
||||
when(sf.getSession()).thenReturn(session);
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
String path = (String) invocation.getArguments()[1];
|
||||
assertFalse(path.startsWith("/"));
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
String path = (String) invocation.getArguments()[1];
|
||||
assertFalse(path.startsWith("/"));
|
||||
return null;
|
||||
}).when(session).rename(Mockito.anyString(), Mockito.anyString());
|
||||
ExpressionParser parser = new SpelExpressionParser();
|
||||
FileTransferringMessageHandler<F> handler = new FileTransferringMessageHandler<F>(sf);
|
||||
@@ -90,12 +86,10 @@ public class FileTransferringMessageHandlerTests {
|
||||
final AtomicReference<String> temporaryPath = new AtomicReference<String>();
|
||||
final AtomicReference<String> finalPath = new AtomicReference<String>();
|
||||
when(sf.getSession()).thenReturn(session);
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
temporaryPath.set((String) invocation.getArguments()[0]);
|
||||
finalPath.set((String) invocation.getArguments()[1]);
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
temporaryPath.set((String) invocation.getArguments()[0]);
|
||||
finalPath.set((String) invocation.getArguments()[1]);
|
||||
return null;
|
||||
}).when(session).rename(Mockito.anyString(), Mockito.anyString());
|
||||
FileTransferringMessageHandler<F> handler = new FileTransferringMessageHandler<F>(sf);
|
||||
handler.setRemoteDirectoryExpression(new LiteralExpression("foo"));
|
||||
@@ -115,12 +109,10 @@ public class FileTransferringMessageHandlerTests {
|
||||
Session<F> session = mock(Session.class);
|
||||
|
||||
when(sf.getSession()).thenReturn(session);
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
String path = (String) invocation.getArguments()[1];
|
||||
assertFalse(path.startsWith("/"));
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
String path = (String) invocation.getArguments()[1];
|
||||
assertFalse(path.startsWith("/"));
|
||||
return null;
|
||||
}).when(session).rename(Mockito.anyString(), Mockito.anyString());
|
||||
ExpressionParser parser = new SpelExpressionParser();
|
||||
FileTransferringMessageHandler<F> handler = new FileTransferringMessageHandler<F>(sf);
|
||||
|
||||
@@ -92,12 +92,8 @@ public class CachingSessionFactoryTests {
|
||||
template.setBeanFactory(mock(BeanFactory.class));
|
||||
template.afterPropertiesSet();
|
||||
try {
|
||||
template.get(new GenericMessage<String>("foo"), new InputStreamCallback() {
|
||||
|
||||
@Override
|
||||
public void doWithInputStream(InputStream stream) throws IOException {
|
||||
throw new RuntimeException("bar");
|
||||
}
|
||||
template.get(new GenericMessage<String>("foo"), (InputStreamCallback) stream -> {
|
||||
throw new RuntimeException("bar");
|
||||
});
|
||||
fail("Expected exception");
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.file.tail.FileTailingMessageProducerSupport.FileTailingEvent;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -128,20 +126,10 @@ public class FileTailingMessageProducerTests {
|
||||
throws Exception {
|
||||
this.adapter = adapter;
|
||||
final List<FileTailingEvent> events = new ArrayList<FileTailingEvent>();
|
||||
adapter.setApplicationEventPublisher(new ApplicationEventPublisher() {
|
||||
|
||||
@Override
|
||||
public void publishEvent(ApplicationEvent event) {
|
||||
FileTailingEvent tailEvent = (FileTailingEvent) event;
|
||||
logger.warn(event);
|
||||
events.add(tailEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishEvent(Object event) {
|
||||
|
||||
}
|
||||
|
||||
adapter.setApplicationEventPublisher(event -> {
|
||||
FileTailingEvent tailEvent = (FileTailingEvent) event;
|
||||
logger.warn(event);
|
||||
events.add(tailEvent);
|
||||
});
|
||||
adapter.setFile(new File(testDir, "foo"));
|
||||
QueueChannel outputChannel = new QueueChannel();
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -86,26 +85,18 @@ public class TailRule extends TestWatcher {
|
||||
fos.close();
|
||||
final AtomicReference<Integer> c = new AtomicReference<Integer>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
Future<Process> future = Executors.newSingleThreadExecutor().submit(new Callable<Process>() {
|
||||
|
||||
@Override
|
||||
public Process call() throws Exception {
|
||||
final Process process = Runtime.getRuntime().exec(commandToTest + " " + file.getAbsolutePath());
|
||||
Executors.newSingleThreadExecutor().execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
c.set(process.getInputStream().read());
|
||||
latch.countDown();
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Error reading test stream", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return process;
|
||||
}
|
||||
Future<Process> future = Executors.newSingleThreadExecutor().submit(() -> {
|
||||
final Process process = Runtime.getRuntime().exec(commandToTest + " " + file.getAbsolutePath());
|
||||
Executors.newSingleThreadExecutor().execute(() -> {
|
||||
try {
|
||||
c.set(process.getInputStream().read());
|
||||
latch.countDown();
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Error reading test stream", e);
|
||||
}
|
||||
});
|
||||
return process;
|
||||
});
|
||||
try {
|
||||
Process process = future.get(10, TimeUnit.SECONDS);
|
||||
|
||||
Reference in New Issue
Block a user