From 84ea4422a2519883f5b130524bf9d3a97c7155ca Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Fri, 12 Mar 2021 13:20:21 -0500 Subject: [PATCH] Name executors in IP tests - aid in debugging failing tests --- .../integration/ip/tcp/TcpOutboundGatewayTests.java | 4 ++-- .../integration/ip/tcp/TcpReceivingChannelAdapterTests.java | 6 +++--- .../integration/ip/tcp/TcpSendingMessageHandlerTests.java | 4 ++-- .../tcp/connection/CachingClientConnectionFactoryTests.java | 2 +- .../ip/tcp/connection/ConnectionFactoryTests.java | 4 ++-- .../connection/FailoverClientConnectionFactoryTests.java | 4 ++-- .../ip/tcp/connection/TcpNioConnectionTests.java | 4 ++-- .../integration/ip/tcp/serializer/DeserializationTests.java | 6 +++--- .../ip/udp/DatagramPacketMulticastSendingHandlerTests.java | 6 +++--- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpOutboundGatewayTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpOutboundGatewayTests.java index 0764807801..597c5745fa 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpOutboundGatewayTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpOutboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,7 +99,7 @@ public class TcpOutboundGatewayTests { private static final Log logger = LogFactory.getLog(TcpOutboundGatewayTests.class); - private final AsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(); + private final AsyncTaskExecutor executor = new SimpleAsyncTaskExecutor("TcpOutboundGatewayTests"); @Test void testGoodNetSingle() throws Exception { diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapterTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapterTests.java index baa9537044..a0edc8f32e 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapterTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +100,7 @@ public class TcpReceivingChannelAdapterTests extends AbstractTcpChannelAdapterTe final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); final AtomicBoolean done = new AtomicBoolean(); - new SimpleAsyncTaskExecutor().execute(() -> { + new SimpleAsyncTaskExecutor("testNetClientMode").execute(() -> { try { ServerSocket server = ServerSocketFactory.getDefault().createServerSocket(0, 10); serverSocket.set(server); @@ -412,7 +412,7 @@ public class TcpReceivingChannelAdapterTests extends AbstractTcpChannelAdapterTe handler.setConnectionFactory(scf); TcpReceivingChannelAdapter adapter = new TcpReceivingChannelAdapter(); adapter.setConnectionFactory(scf); - Executor te = new SimpleAsyncTaskExecutor(); + Executor te = new SimpleAsyncTaskExecutor("testNioSingleSharedMany"); scf.setTaskExecutor(te); scf.start(); QueueChannel channel = new QueueChannel(); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java index 06726c77fe..377b2f177b 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ public class TcpSendingMessageHandlerTests extends AbstractTcpChannelAdapterTest private static final Log logger = LogFactory.getLog(TcpSendingMessageHandlerTests.class); - private AsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(); + private final AsyncTaskExecutor executor = new SimpleAsyncTaskExecutor("TcpSendingMessageHandlerTests"); private void readFully(InputStream is, byte[] buff) throws IOException { for (int i = 0; i < buff.length; i++) { diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/CachingClientConnectionFactoryTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/CachingClientConnectionFactoryTests.java index 938a3d1843..fd3ed25a0a 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/CachingClientConnectionFactoryTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/CachingClientConnectionFactoryTests.java @@ -751,7 +751,7 @@ public class CachingClientConnectionFactoryTests { invocation.callRealMethod(); String log = ((Supplier) invocation.getArgument(0)).get(); if (log.startsWith("Response")) { - new SimpleAsyncTaskExecutor() + new SimpleAsyncTaskExecutor("testGatewayRelease") .execute(() -> gate.handleMessage(new GenericMessage<>("bar"))); // hold up the first thread until the second has added its pending reply latch.await(20, TimeUnit.SECONDS); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionFactoryTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionFactoryTests.java index 6e4a4d490b..98b71a9025 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionFactoryTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -228,7 +228,7 @@ public class ConnectionFactoryTests { factory.start(); assertThat(latch1.await(10, TimeUnit.SECONDS)).as("missing info log").isTrue(); // stop on a different thread because it waits for the executor - new SimpleAsyncTaskExecutor() + new SimpleAsyncTaskExecutor("testEarlyClose") .execute(factory::stop); int n = 0; DirectFieldAccessor accessor = new DirectFieldAccessor(factory); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactoryTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactoryTests.java index 3dab3cd438..30962977d3 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactoryTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -609,7 +609,7 @@ public class FailoverClientConnectionFactoryTests { private Holder setupAndStartServers(AbstractServerConnectionFactory server1, AbstractServerConnectionFactory server2) { - Executor exec = new SimpleAsyncTaskExecutor(); + Executor exec = new SimpleAsyncTaskExecutor("FailoverClientConnectionFactoryTests"); server1.setTaskExecutor(exec); server2.setTaskExecutor(exec); server1.setBeanName("server1"); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java index cb47906f12..ae8f72f7ed 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ public class TcpNioConnectionTests { private final ApplicationEventPublisher nullPublisher = mock(ApplicationEventPublisher.class); - private final AsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(); + private final AsyncTaskExecutor executor = new SimpleAsyncTaskExecutor("TcpNioConnectionTests"); @Test public void testWriteTimeout(TestInfo testInfo) throws Exception { diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/serializer/DeserializationTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/serializer/DeserializationTests.java index 57e46d1793..d80510d46b 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/serializer/DeserializationTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/serializer/DeserializationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -407,7 +407,7 @@ public class DeserializationTests { // eat SocketTimeoutException. Doesn't matter for this test } }; - Executor exec = new SimpleAsyncTaskExecutor(); + Executor exec = new SimpleAsyncTaskExecutor("testTimeoutWhileDecoding"); Message message; @@ -459,7 +459,7 @@ public class DeserializationTests { // eat SocketTimeoutException. Doesn't matter for this test } }; - Executor exec = new SimpleAsyncTaskExecutor(); + Executor exec = new SimpleAsyncTaskExecutor("testTimeoutWithRawDeserializerEofIsTerminator"); Message message; diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMulticastSendingHandlerTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMulticastSendingHandlerTests.java index 0d092a2e8b..16d8809f5e 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMulticastSendingHandlerTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMulticastSendingHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,7 @@ public class DatagramPacketMulticastSendingHandlerTests { e.printStackTrace(); } }; - Executor executor = new SimpleAsyncTaskExecutor(); + Executor executor = new SimpleAsyncTaskExecutor("verifySendMulticast"); executor.execute(catcher); executor.execute(catcher); assertThat(listening.await(10000, TimeUnit.MILLISECONDS)).isTrue(); @@ -191,7 +191,7 @@ public class DatagramPacketMulticastSendingHandlerTests { e.printStackTrace(); } }; - Executor executor = new SimpleAsyncTaskExecutor(); + Executor executor = new SimpleAsyncTaskExecutor("verifySendMulticastWithAcks"); executor.execute(catcher); executor.execute(catcher); assertThat(listening.await(10000, TimeUnit.MILLISECONDS)).isTrue();