davsclaus commented on code in PR #30983:
URL: https://github.com/apache/camel/pull/30983#discussion_r4721026917
##########
components/camel-azure/camel-azure-iothub/src/test/java/org/apache/camel/component/azure/iothub/client/DeviceClientPoolTest.java:
##########
@@ -168,6 +168,26 @@ void testRemoveClosesClient() throws Exception {
verify(client, times(1)).close();
}
+ @Test
+ void testHttpsClientIsKeptApartAndRemovedByDeviceId() throws Exception {
+ DeviceClient https = mock(DeviceClient.class);
+ DeviceClient mqtt = mock(DeviceClient.class);
+ DeviceClientPool pool = new DeviceClientPool(Duration.ofMinutes(5),
Duration.ofSeconds(30));
+ pool.setDeviceClientFactory((cs, protocol) -> protocol ==
IotHubClientProtocol.HTTPS ? https : mqtt);
+
+ assertSame(https, pool.getOrCreate("d", CS,
IotHubClientProtocol.HTTPS));
+ assertSame(mqtt, pool.getOrCreate("d", CS, IotHubClientProtocol.MQTT));
+ assertSame(mqtt, pool.getOrCreate("d", CS,
IotHubClientProtocol.AMQPS));
+ assertEquals(2, pool.getActiveClientCount());
+
+ pool.remove("d");
+ pool.remove("d");
Review Comment:
Both `remove` overloads are package-private test hooks without a production
caller, and the early return predates this PR, so the two calls in the test are
fine here. Resolving.
_Claude Code on behalf of davsclaus_
##########
components/camel-azure/camel-azure-iothub/src/test/java/org/apache/camel/component/azure/iothub/client/DeviceClientPoolTest.java:
##########
@@ -168,6 +168,26 @@ void testRemoveClosesClient() throws Exception {
verify(client, times(1)).close();
}
+ @Test
+ void testHttpsClientIsKeptApartAndRemovedByDeviceId() throws Exception {
+ DeviceClient https = mock(DeviceClient.class);
+ DeviceClient mqtt = mock(DeviceClient.class);
+ DeviceClientPool pool = new DeviceClientPool(Duration.ofMinutes(5),
Duration.ofSeconds(30));
+ pool.setDeviceClientFactory((cs, protocol) -> protocol ==
IotHubClientProtocol.HTTPS ? https : mqtt);
+
+ assertSame(https, pool.getOrCreate("d", CS,
IotHubClientProtocol.HTTPS));
+ assertSame(mqtt, pool.getOrCreate("d", CS, IotHubClientProtocol.MQTT));
+ assertSame(mqtt, pool.getOrCreate("d", CS,
IotHubClientProtocol.AMQPS));
+ assertEquals(2, pool.getActiveClientCount());
+
+ pool.remove("d");
+ pool.remove("d");
Review Comment:
Same as the thread above: test-only hook, and the early return is on main
already. Resolving.
_Claude Code on behalf of davsclaus_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]