Some ZeroMQ tests clean up
* Destroy proxies in the end of tests initiating removal for their internal executors
* Use `@Qualifier("subPubZeroMqProxy")` in the `ZeroMqDslTests.ContextConfiguration` to avoid
warning about deprecated `LocalVariableTableParameterNameDiscoverer`
This commit is contained in:
@@ -174,6 +174,7 @@ public class ZeroMqChannelTests {
|
||||
captureSocket.close();
|
||||
|
||||
proxy.stop();
|
||||
proxy.destroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -222,6 +223,7 @@ public class ZeroMqChannelTests {
|
||||
channel.destroy();
|
||||
channel2.destroy();
|
||||
proxy.stop();
|
||||
proxy.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -287,6 +289,7 @@ public class ZeroMqChannelTests {
|
||||
|
||||
channel.destroy();
|
||||
proxy.stop();
|
||||
proxy.destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ZeroMqDslTests {
|
||||
.forEach(IntegrationFlowContext.IntegrationFlowRegistration::destroy);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableIntegration
|
||||
public static class ContextConfiguration {
|
||||
|
||||
@@ -125,25 +125,28 @@ public class ZeroMqDslTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
ZeroMqProxy subPubZeroMqProxy() {
|
||||
return new ZeroMqProxy(context(), ZeroMqProxy.Type.SUB_PUB);
|
||||
ZeroMqProxy subPubZeroMqProxy(ZContext context) {
|
||||
return new ZeroMqProxy(context, ZeroMqProxy.Type.SUB_PUB);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ZeroMqProxy pullPushZeroMqProxy() {
|
||||
return new ZeroMqProxy(context());
|
||||
ZeroMqProxy pullPushZeroMqProxy(ZContext context) {
|
||||
return new ZeroMqProxy(context);
|
||||
}
|
||||
|
||||
@Bean
|
||||
IntegrationFlow publishToZeroMqPubSubFlow(ZeroMqProxy subPubZeroMqProxy) {
|
||||
IntegrationFlow publishToZeroMqPubSubFlow(ZContext context,
|
||||
@Qualifier("subPubZeroMqProxy") ZeroMqProxy subPubZeroMqProxy) {
|
||||
|
||||
return flow ->
|
||||
flow.handle(ZeroMq.outboundChannelAdapter(context(),
|
||||
() -> {
|
||||
await().until(() -> subPubZeroMqProxy.getFrontendPort() > 0);
|
||||
return "tcp://localhost:" + subPubZeroMqProxy.getFrontendPort();
|
||||
},
|
||||
SocketType.PUB)
|
||||
.topic("someTopic"));
|
||||
flow.handle(
|
||||
ZeroMq.outboundChannelAdapter(context,
|
||||
() -> {
|
||||
await().until(() -> subPubZeroMqProxy.getFrontendPort() > 0);
|
||||
return "tcp://localhost:" + subPubZeroMqProxy.getFrontendPort();
|
||||
},
|
||||
SocketType.PUB)
|
||||
.topic("someTopic"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -148,6 +148,7 @@ public class ZeroMqMessageHandlerTests {
|
||||
messageHandler.destroy();
|
||||
pullSocket.close();
|
||||
proxy.stop();
|
||||
proxy.destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user