Search in sources :

Example 1 with LogAccessor

use of org.springframework.core.log.LogAccessor in project spring-integration by spring-projects.

the class EnableIntegrationTests method testAnnotatedServiceActivator.

@Test
public void testAnnotatedServiceActivator() throws Exception {
    this.serviceActivatorEndpoint.start();
    assertThat(this.inputReceiveLatch.await(10, TimeUnit.SECONDS)).isTrue();
    assertThat(TestUtils.getPropertyValue(this.serviceActivatorEndpoint, "maxMessagesPerPoll")).isEqualTo(10L);
    Trigger trigger = TestUtils.getPropertyValue(this.serviceActivatorEndpoint, "trigger", Trigger.class);
    assertThat(trigger).isInstanceOf(PeriodicTrigger.class);
    assertThat(TestUtils.getPropertyValue(trigger, "period")).isEqualTo(100L);
    assertThat(TestUtils.getPropertyValue(trigger, "fixedRate", Boolean.class)).isFalse();
    assertThat(this.annotationTestService.isRunning()).isTrue();
    LogAccessor logger = spy(TestUtils.getPropertyValue(this.serviceActivatorEndpoint, "logger", LogAccessor.class));
    when(logger.isDebugEnabled()).thenReturn(true);
    final CountDownLatch pollerInterruptedLatch = new CountDownLatch(1);
    doAnswer(invocation -> {
        pollerInterruptedLatch.countDown();
        invocation.callRealMethod();
        return null;
    }).when(logger).debug("Received no Message during the poll, returning 'false'");
    new DirectFieldAccessor(this.serviceActivatorEndpoint).setPropertyValue("logger", logger);
    this.serviceActivatorEndpoint.stop();
    assertThat(this.annotationTestService.isRunning()).isFalse();
    // wait until the service activator's poller is interrupted.
    assertThat(pollerInterruptedLatch.await(10, TimeUnit.SECONDS)).isTrue();
    this.serviceActivatorEndpoint.start();
    assertThat(this.annotationTestService.isRunning()).isTrue();
    trigger = TestUtils.getPropertyValue(this.serviceActivatorEndpoint1, "trigger", Trigger.class);
    assertThat(trigger).isInstanceOf(PeriodicTrigger.class);
    assertThat(TestUtils.getPropertyValue(trigger, "period")).isEqualTo(100L);
    assertThat(TestUtils.getPropertyValue(trigger, "fixedRate", Boolean.class)).isTrue();
    trigger = TestUtils.getPropertyValue(this.serviceActivatorEndpoint2, "trigger", Trigger.class);
    assertThat(trigger).isInstanceOf(CronTrigger.class);
    assertThat(TestUtils.getPropertyValue(trigger, "expression.expression")).isEqualTo("0 5 7 * * *");
    trigger = TestUtils.getPropertyValue(this.serviceActivatorEndpoint3, "trigger", Trigger.class);
    assertThat(trigger).isInstanceOf(PeriodicTrigger.class);
    assertThat(TestUtils.getPropertyValue(trigger, "period")).isEqualTo(11L);
    assertThat(TestUtils.getPropertyValue(trigger, "fixedRate", Boolean.class)).isFalse();
    trigger = TestUtils.getPropertyValue(this.serviceActivatorEndpoint4, "trigger", Trigger.class);
    assertThat(trigger).isInstanceOf(PeriodicTrigger.class);
    assertThat(TestUtils.getPropertyValue(trigger, "period")).isEqualTo(1000L);
    assertThat(TestUtils.getPropertyValue(trigger, "fixedRate", Boolean.class)).isFalse();
    assertThat(trigger).isSameAs(this.myTrigger);
    trigger = TestUtils.getPropertyValue(this.transformer, "trigger", Trigger.class);
    assertThat(trigger).isInstanceOf(PeriodicTrigger.class);
    assertThat(TestUtils.getPropertyValue(trigger, "period")).isEqualTo(10L);
    assertThat(TestUtils.getPropertyValue(trigger, "fixedRate", Boolean.class)).isFalse();
    this.input.send(MessageBuilder.withPayload("Foo").build());
    Message<?> interceptedMessage = this.wireTapChannel.receive(10_000);
    assertThat(interceptedMessage).isNotNull();
    assertThat(interceptedMessage.getPayload()).isEqualTo("Foo");
    Message<?> receive = this.output.receive(10_000);
    assertThat(receive).isNotNull();
    assertThat(receive.getPayload()).isEqualTo("FOO");
    receive = this.wireTapFromOutput.receive(10_000);
    assertThat(receive).isNotNull();
    assertThat(receive.getPayload()).isEqualTo("FOO");
    MessageHistory messageHistory = receive.getHeaders().get(MessageHistory.HEADER_NAME, MessageHistory.class);
    assertThat(messageHistory).isNotNull();
    String messageHistoryString = messageHistory.toString();
    assertThat(messageHistoryString).contains("input");
    assertThat(messageHistoryString).contains("annotationTestService.handle.serviceActivator");
    assertThat(messageHistoryString).doesNotContain("output");
    receive = this.publishedChannel.receive(10_000);
    assertThat(receive).isNotNull();
    assertThat(receive.getPayload()).isEqualTo("foo");
    messageHistory = receive.getHeaders().get(MessageHistory.HEADER_NAME, MessageHistory.class);
    assertThat(messageHistory).isNotNull();
    messageHistoryString = messageHistory.toString();
    assertThat(messageHistoryString).doesNotContain("input");
    assertThat(messageHistoryString).doesNotContain("output");
    assertThat(messageHistoryString).contains("publishedChannel");
    assertThat(this.wireTapChannel.receive(0)).isNull();
    assertThat(this.testChannelInterceptor.getInvoked()).isGreaterThan(0);
    assertThat(this.fbInterceptorCounter.get()).isGreaterThan(0);
    assertThat(this.context.containsBean("annotationTestService.count.inboundChannelAdapter.source")).isTrue();
    Object messageSource = this.context.getBean("annotationTestService.count.inboundChannelAdapter.source");
    assertThat(messageSource).isInstanceOf(MethodInvokingMessageSource.class);
    assertThat(this.counterChannel.receive(10)).isNull();
    SmartLifecycle countSA = this.context.getBean("annotationTestService.count.inboundChannelAdapter", SmartLifecycle.class);
    assertThat(countSA.isAutoStartup()).isFalse();
    assertThat(countSA.getPhase()).isEqualTo(23);
    countSA.start();
    for (int i = 0; i < 10; i++) {
        Message<?> message = this.counterChannel.receive(10_000);
        assertThat(message).isNotNull();
        assertThat(message.getPayload()).isEqualTo(i + 1);
    }
    Message<?> message = this.fooChannel.receive(10_000);
    assertThat(message).isNotNull();
    assertThat(message.getPayload()).isEqualTo("foo");
    message = this.fooChannel.receive(10_000);
    assertThat(message).isNotNull();
    assertThat(message.getPayload()).isEqualTo("foo");
    assertThat(this.fooChannel.receive(10)).isNull();
    message = this.messageChannel.receive(10_000);
    assertThat(message).isNotNull();
    assertThat(message.getPayload()).isEqualTo("bar");
    assertThat(message.getHeaders().containsKey("foo")).isTrue();
    assertThat(message.getHeaders().get("foo")).isEqualTo("FOO");
    MessagingTemplate messagingTemplate = new MessagingTemplate(this.controlBusChannel);
    assertThat(messagingTemplate.convertSendAndReceive("@pausable.isRunning()", Boolean.class)).isEqualTo(false);
    this.controlBusChannel.send(new GenericMessage<>("@pausable.start()"));
    assertThat(messagingTemplate.convertSendAndReceive("@pausable.isRunning()", Boolean.class)).isEqualTo(true);
    this.controlBusChannel.send(new GenericMessage<>("@pausable.stop()"));
    assertThat(messagingTemplate.convertSendAndReceive("@pausable.isRunning()", Boolean.class)).isEqualTo(false);
    this.controlBusChannel.send(new GenericMessage<>("@pausable.pause()"));
    Object pausable = this.context.getBean("pausable");
    assertThat(TestUtils.getPropertyValue(pausable, "paused", Boolean.class)).isTrue();
    this.controlBusChannel.send(new GenericMessage<>("@pausable.resume()"));
    assertThat(TestUtils.getPropertyValue(pausable, "paused", Boolean.class)).isFalse();
    Map<String, ServiceActivatingHandler> beansOfType = this.context.getBeansOfType(ServiceActivatingHandler.class);
    assertThat(beansOfType.keySet().contains("enableIntegrationTests.ContextConfiguration2.controlBus.serviceActivator.handler")).isFalse();
    assertThat(this.controlBusEndpoint.getBeanName()).isEqualTo(this.contextConfiguration2.controlBusEndpoint.getBeanName());
    assertThat(this.controlBusEndpoint.getHandler()).isSameAs(this.contextConfiguration2.controlBusEndpoint.getHandler());
}
Also used : CountDownLatch(java.util.concurrent.CountDownLatch) SmartLifecycle(org.springframework.context.SmartLifecycle) AbstractEndpoint(org.springframework.integration.endpoint.AbstractEndpoint) MessageHistory(org.springframework.integration.history.MessageHistory) EnableMessageHistory(org.springframework.integration.config.EnableMessageHistory) MessagingTemplate(org.springframework.integration.core.MessagingTemplate) Trigger(org.springframework.scheduling.Trigger) CronTrigger(org.springframework.scheduling.support.CronTrigger) OnlyOnceTrigger(org.springframework.integration.test.util.OnlyOnceTrigger) PeriodicTrigger(org.springframework.scheduling.support.PeriodicTrigger) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) LogAccessor(org.springframework.core.log.LogAccessor) ServiceActivatingHandler(org.springframework.integration.handler.ServiceActivatingHandler) Test(org.junit.jupiter.api.Test)

Example 2 with LogAccessor

use of org.springframework.core.log.LogAccessor in project spring-integration by spring-projects.

the class AvroTests method testTransformers.

@Test
@LogLevels(classes = DirectChannel.class, categories = "bar", level = "DEBUG")
void testTransformers(@Autowired Config config) {
    AvroTestClass1 test = new AvroTestClass1("baz", "fiz");
    LogAccessor spied = spy(TestUtils.getPropertyValue(config.in1(), "logger", LogAccessor.class));
    new DirectFieldAccessor(config.in1()).setPropertyValue("logger", spied);
    config.in1().send(new GenericMessage<>(test));
    assertThat(config.tapped().receive(0)).isNotNull().extracting(msg -> msg.getPayload()).isInstanceOf(byte[].class);
    Message<?> received = config.out().receive(0);
    assertThat(received).isNotNull().extracting(msg -> msg.getPayload()).isEqualTo(test).isNotSameAs(test);
    assertThat(received.getHeaders().get("flow")).isEqualTo("flow1");
    ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
    verify(spied, atLeastOnce()).debug(captor.capture());
    assertThat(captor.getAllValues()).anyMatch(s -> s.contains("preSend on channel"));
    assertThat(captor.getAllValues()).anyMatch(s -> s.contains("postSend (sent=true) on channel"));
}
Also used : QueueChannel(org.springframework.integration.channel.QueueChannel) AvroHeaders(org.springframework.integration.transformer.support.AvroHeaders) IntegrationFlow(org.springframework.integration.dsl.IntegrationFlow) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) Autowired(org.springframework.beans.factory.annotation.Autowired) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) LogAccessor(org.springframework.core.log.LogAccessor) EnableIntegration(org.springframework.integration.config.EnableIntegration) Mockito.spy(org.mockito.Mockito.spy) TestUtils(org.springframework.integration.test.util.TestUtils) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) Configuration(org.springframework.context.annotation.Configuration) SpringJUnitConfig(org.springframework.test.context.junit.jupiter.SpringJUnitConfig) ArgumentCaptor(org.mockito.ArgumentCaptor) LogLevels(org.springframework.integration.test.condition.LogLevels) IntegrationFlows(org.springframework.integration.dsl.IntegrationFlows) Message(org.springframework.messaging.Message) PollableChannel(org.springframework.messaging.PollableChannel) Bean(org.springframework.context.annotation.Bean) GenericMessage(org.springframework.messaging.support.GenericMessage) DirectChannel(org.springframework.integration.channel.DirectChannel) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) LogAccessor(org.springframework.core.log.LogAccessor) Test(org.junit.jupiter.api.Test) LogLevels(org.springframework.integration.test.condition.LogLevels)

Example 3 with LogAccessor

use of org.springframework.core.log.LogAccessor in project spring-integration by spring-projects.

the class MqttAdapterTests method testNoNPEOnReconnectAndStopRaceCondition.

@Test
public void testNoNPEOnReconnectAndStopRaceCondition() throws Exception {
    final IMqttClient client = mock(IMqttClient.class);
    MqttPahoMessageDrivenChannelAdapter adapter = buildAdapterIn(client, null, ConsumerStopAction.UNSUBSCRIBE_NEVER);
    adapter.setRecoveryInterval(10);
    MqttException mqttException = new MqttException(MqttException.REASON_CODE_SUBSCRIBE_FAILED);
    willThrow(mqttException).given(client).subscribe(any(), ArgumentMatchers.<int[]>any());
    LogAccessor logger = spy(TestUtils.getPropertyValue(adapter, "logger", LogAccessor.class));
    new DirectFieldAccessor(adapter).setPropertyValue("logger", logger);
    CountDownLatch exceptionLatch = new CountDownLatch(1);
    ArgumentCaptor<MqttException> mqttExceptionArgumentCaptor = ArgumentCaptor.forClass(MqttException.class);
    willAnswer(i -> {
        exceptionLatch.countDown();
        return null;
    }).given(logger).error(mqttExceptionArgumentCaptor.capture(), eq("Exception while connecting and subscribing"));
    ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
    taskScheduler.initialize();
    adapter.setTaskScheduler(taskScheduler);
    adapter.setApplicationEventPublisher(event -> {
        if (event instanceof MqttConnectionFailedEvent) {
            adapter.destroy();
        }
    });
    adapter.start();
    assertThat(exceptionLatch.await(10, TimeUnit.SECONDS)).isTrue();
    assertThat(mqttExceptionArgumentCaptor.getValue()).isNotNull().isSameAs(mqttException);
    taskScheduler.destroy();
}
Also used : MqttPahoMessageDrivenChannelAdapter(org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter) MqttException(org.eclipse.paho.client.mqttv3.MqttException) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) MqttConnectionFailedEvent(org.springframework.integration.mqtt.event.MqttConnectionFailedEvent) LogAccessor(org.springframework.core.log.LogAccessor) CountDownLatch(java.util.concurrent.CountDownLatch) IMqttClient(org.eclipse.paho.client.mqttv3.IMqttClient) ThreadPoolTaskScheduler(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler) Test(org.junit.jupiter.api.Test)

Example 4 with LogAccessor

use of org.springframework.core.log.LogAccessor in project spring-integration by spring-projects.

the class DownstreamExceptionTests method testNoErrorChannel.

@Test
@SuppressWarnings("unchecked")
public void testNoErrorChannel() throws Exception {
    service.n = 0;
    LogAccessor logger = spy(TestUtils.getPropertyValue(noErrorChannel, "logger", LogAccessor.class));
    final CountDownLatch latch = new CountDownLatch(1);
    doAnswer(invocation -> {
        if (((Supplier<String>) invocation.getArgument(1)).get().contains("Unhandled")) {
            latch.countDown();
        }
        return null;
    }).when(logger).error(any(Throwable.class), any(Supplier.class));
    new DirectFieldAccessor(noErrorChannel).setPropertyValue("logger", logger);
    MqttPahoMessageHandler adapter = new MqttPahoMessageHandler(MosquittoContainerTest.mqttUrl(), "si-test-out");
    adapter.setDefaultTopic("mqtt-fooEx1");
    adapter.setBeanFactory(mock(BeanFactory.class));
    adapter.afterPropertiesSet();
    adapter.start();
    adapter.handleMessage(new GenericMessage<>("foo"));
    service.barrier.await(10, TimeUnit.SECONDS);
    service.barrier.reset();
    adapter.handleMessage(new GenericMessage<>("foo"));
    service.barrier.await(10, TimeUnit.SECONDS);
    assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
    verify(logger).error(any(Throwable.class), ArgumentMatchers.<Supplier<String>>argThat(logMessage -> logMessage.get().startsWith("Unhandled exception for")));
    service.barrier.reset();
    adapter.stop();
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) DirtiesContext(org.springframework.test.annotation.DirtiesContext) CyclicBarrier(java.util.concurrent.CyclicBarrier) ArgumentMatchers(org.mockito.ArgumentMatchers) MqttPahoMessageHandler(org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Autowired(org.springframework.beans.factory.annotation.Autowired) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) LogAccessor(org.springframework.core.log.LogAccessor) Mockito.spy(org.mockito.Mockito.spy) TestUtils(org.springframework.integration.test.util.TestUtils) Supplier(java.util.function.Supplier) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) SpringJUnitConfig(org.springframework.test.context.junit.jupiter.SpringJUnitConfig) CountDownLatch(java.util.concurrent.CountDownLatch) MqttPahoMessageDrivenChannelAdapter(org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter) Mockito.doAnswer(org.mockito.Mockito.doAnswer) BeanFactory(org.springframework.beans.factory.BeanFactory) PollableChannel(org.springframework.messaging.PollableChannel) GenericMessage(org.springframework.messaging.support.GenericMessage) Mockito.mock(org.mockito.Mockito.mock) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) MqttPahoMessageHandler(org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler) BeanFactory(org.springframework.beans.factory.BeanFactory) Supplier(java.util.function.Supplier) LogAccessor(org.springframework.core.log.LogAccessor) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.jupiter.api.Test)

Example 5 with LogAccessor

use of org.springframework.core.log.LogAccessor in project spring-integration by spring-projects.

the class SourcePollingChannelAdapterFactoryBeanTests method testInterrupted.

@Test
public void testInterrupted() throws Exception {
    final CountDownLatch startLatch = new CountDownLatch(1);
    MessageSource<Object> ms = () -> {
        startLatch.countDown();
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new MessagingException("Interrupted awaiting stopLatch", e);
        }
        return null;
    };
    SourcePollingChannelAdapter pollingChannelAdapter = new SourcePollingChannelAdapter();
    ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
    taskScheduler.setWaitForTasksToCompleteOnShutdown(true);
    taskScheduler.setAwaitTerminationSeconds(1);
    taskScheduler.afterPropertiesSet();
    pollingChannelAdapter.setTaskScheduler(taskScheduler);
    MessagePublishingErrorHandler errorHandler = new MessagePublishingErrorHandler();
    Log errorHandlerLogger = TestUtils.getPropertyValue(errorHandler, "logger", Log.class);
    errorHandlerLogger = spy(errorHandlerLogger);
    DirectFieldAccessor dfa = new DirectFieldAccessor(errorHandler);
    dfa.setPropertyValue("logger", errorHandlerLogger);
    pollingChannelAdapter.setErrorHandler(errorHandler);
    pollingChannelAdapter.setSource(ms);
    pollingChannelAdapter.setOutputChannel(new NullChannel());
    pollingChannelAdapter.setBeanFactory(mock(BeanFactory.class));
    pollingChannelAdapter.afterPropertiesSet();
    LogAccessor adapterLogger = TestUtils.getPropertyValue(pollingChannelAdapter, "logger", LogAccessor.class);
    adapterLogger = spy(adapterLogger);
    when(adapterLogger.isDebugEnabled()).thenReturn(true);
    dfa = new DirectFieldAccessor(pollingChannelAdapter);
    dfa.setPropertyValue("logger", adapterLogger);
    pollingChannelAdapter.start();
    assertThat(startLatch.await(10, TimeUnit.SECONDS)).isTrue();
    pollingChannelAdapter.stop();
    taskScheduler.shutdown();
    verifyNoInteractions(errorHandlerLogger);
    verify(adapterLogger).debug(ArgumentMatchers.<Supplier<String>>argThat(logMessage -> logMessage.get().contains("Poll interrupted - during stop()?")));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) QueueChannel(org.springframework.integration.channel.QueueChannel) MessagingException(org.springframework.messaging.MessagingException) ArgumentMatchers(org.mockito.ArgumentMatchers) PollerMetadata(org.springframework.integration.scheduling.PollerMetadata) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TestApplicationContext(org.springframework.integration.test.util.TestUtils.TestApplicationContext) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) Mockito.spy(org.mockito.Mockito.spy) TestUtils(org.springframework.integration.test.util.TestUtils) Supplier(java.util.function.Supplier) MessagePublishingErrorHandler(org.springframework.integration.channel.MessagePublishingErrorHandler) MessageSource(org.springframework.integration.core.MessageSource) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) ArrayList(java.util.ArrayList) MethodInvocation(org.aopalliance.intercept.MethodInvocation) NullChannel(org.springframework.integration.channel.NullChannel) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Advice(org.aopalliance.aop.Advice) Message(org.springframework.messaging.Message) ThreadPoolTaskScheduler(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler) PeriodicTrigger(org.springframework.scheduling.support.PeriodicTrigger) ClassUtils(org.springframework.util.ClassUtils) Trigger(org.springframework.scheduling.Trigger) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) SourcePollingChannelAdapter(org.springframework.integration.endpoint.SourcePollingChannelAdapter) TaskScheduler(org.springframework.scheduling.TaskScheduler) Mockito.when(org.mockito.Mockito.when) LogAccessor(org.springframework.core.log.LogAccessor) BDDMockito.willAnswer(org.mockito.BDDMockito.willAnswer) Mockito.verify(org.mockito.Mockito.verify) Lifecycle(org.springframework.context.Lifecycle) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) MethodInterceptor(org.aopalliance.intercept.MethodInterceptor) List(java.util.List) BeanFactory(org.springframework.beans.factory.BeanFactory) Log(org.apache.commons.logging.Log) GenericMessage(org.springframework.messaging.support.GenericMessage) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Mockito.mock(org.mockito.Mockito.mock) MessagePublishingErrorHandler(org.springframework.integration.channel.MessagePublishingErrorHandler) MessagingException(org.springframework.messaging.MessagingException) Log(org.apache.commons.logging.Log) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CountDownLatch(java.util.concurrent.CountDownLatch) ThreadPoolTaskScheduler(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) BeanFactory(org.springframework.beans.factory.BeanFactory) SourcePollingChannelAdapter(org.springframework.integration.endpoint.SourcePollingChannelAdapter) LogAccessor(org.springframework.core.log.LogAccessor) NullChannel(org.springframework.integration.channel.NullChannel) Test(org.junit.jupiter.api.Test)

Aggregations

LogAccessor (org.springframework.core.log.LogAccessor)38 Test (org.junit.jupiter.api.Test)34 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)34 BeanFactory (org.springframework.beans.factory.BeanFactory)19 CountDownLatch (java.util.concurrent.CountDownLatch)16 QueueChannel (org.springframework.integration.channel.QueueChannel)15 Supplier (java.util.function.Supplier)11 Message (org.springframework.messaging.Message)11 GenericMessage (org.springframework.messaging.support.GenericMessage)11 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)9 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)9 Mockito.spy (org.mockito.Mockito.spy)9 TestUtils (org.springframework.integration.test.util.TestUtils)8 ThreadPoolTaskScheduler (org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler)8 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 AtomicReference (java.util.concurrent.atomic.AtomicReference)7 Mockito.mock (org.mockito.Mockito.mock)7 Mockito.verify (org.mockito.Mockito.verify)7 TimeUnit (java.util.concurrent.TimeUnit)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6