lukecwik commented on code in PR #22932:
URL: https://github.com/apache/beam/pull/22932#discussion_r998732722
##########
sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOTest.java:
##########
@@ -555,6 +565,106 @@ public void testCustomAutoscaler() throws IOException {
verify(autoScaler, times(1)).stop();
}
+ @Test
+ public void testCloseWithTimeout() throws IOException {
+ Duration closeTimeout = Duration.millis(2000L);
+ JmsIO.Read spec =
+ JmsIO.read()
+ .withConnectionFactory(connectionFactory)
+ .withUsername(USERNAME)
+ .withPassword(PASSWORD)
+ .withQueue(QUEUE)
+ .withCloseTimeout(closeTimeout);
+
+ JmsIO.UnboundedJmsSource source = new JmsIO.UnboundedJmsSource(spec);
+
+ ScheduledExecutorService mockScheduledExecutorService =
+ Mockito.mock(ScheduledExecutorService.class);
+ ExecutorOptions options = PipelineOptionsFactory.as(ExecutorOptions.class);
+ options.setScheduledExecutorService(mockScheduledExecutorService);
+ ArgumentCaptor<Runnable> runnableArgumentCaptor =
ArgumentCaptor.forClass(Runnable.class);
+ when(mockScheduledExecutorService.schedule(
+ runnableArgumentCaptor.capture(), anyLong(), any(TimeUnit.class)))
+ .thenReturn(null /* unused */);
+
+ JmsIO.UnboundedJmsReader reader = source.createReader(options, null);
+ reader.start();
Review Comment:
```suggestion
reader.start();
```
--
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]