GH-3686: Apply SF editor config

Fixes https://github.com/spring-projects/spring-integration/issues/3686

* Add `src/idea` with respective editor config for IntelliJ IDEA.
Must be imported into an IDE
* Add `src/eclipse` with respective editor config for Eclipse/STS
* Reformat imports in source code according a new editor config
This commit is contained in:
abilan
2022-11-14 10:55:21 -05:00
parent bca9d27a65
commit 7864658d01
1385 changed files with 7627 additions and 6931 deletions

View File

@@ -7,15 +7,21 @@
{
"@build.name": "${buildname}",
"@build.number": "${buildnumber}",
"path": {"$match": "org*"}
"path": {
"$match": "org*"
}
},
{
"$or": [
{
"name": {"$match": "*.pom"}
"name": {
"$match": "*.pom"
}
},
{
"name": {"$match": "*.jar"}
"name": {
"$match": "*.jar"
}
}
]
}

View File

@@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
# Request close promotion repo
- uses: jvalkeal/nexus-sync@v0
with:
url: ${{ secrets.OSSRH_URL }}
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
staging-repo-id: ${{ github.event.inputs.stagedRepositoryId }}
close: true
# Request close promotion repo
- uses: jvalkeal/nexus-sync@v0
with:
url: ${{ secrets.OSSRH_URL }}
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
staging-repo-id: ${{ github.event.inputs.stagedRepositoryId }}
close: true

View File

@@ -15,44 +15,44 @@ jobs:
runs-on: ubuntu-latest
steps:
# to get spec file in .github
- uses: actions/checkout@v2
# to get spec file in .github
- uses: actions/checkout@v2
# Setup jfrog cli
- uses: jfrog/setup-jfrog-cli@v1
with:
version: 1.46.4
env:
JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
# Setup jfrog cli
- uses: jfrog/setup-jfrog-cli@v1
with:
version: 1.46.4
env:
JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
# Extract build id from input
- name: Extract Build Id
run: |
echo JFROG_CLI_BUILD_NAME="${{ github.event.inputs.buildName }}" >> $GITHUB_ENV
echo JFROG_CLI_BUILD_NUMBER=${{ github.event.inputs.buildNumber }} >> $GITHUB_ENV
# Extract build id from input
- name: Extract Build Id
run: |
echo JFROG_CLI_BUILD_NAME="${{ github.event.inputs.buildName }}" >> $GITHUB_ENV
echo JFROG_CLI_BUILD_NUMBER=${{ github.event.inputs.buildNumber }} >> $GITHUB_ENV
# Download released files
- name: Download Release Files
run: |
jfrog rt download \
--spec .github/release-files-spec.json \
--spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER"
# Download released files
- name: Download Release Files
run: |
jfrog rt download \
--spec .github/release-files-spec.json \
--spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER"
# Create checksums, signatures and create staging repo on central and upload
- uses: jvalkeal/nexus-sync@v0
id: nexus
with:
url: ${{ secrets.OSSRH_URL }}
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
create: true
upload: true
generate-checksums: true
pgp-sign: true
pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }}
pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
# Create checksums, signatures and create staging repo on central and upload
- uses: jvalkeal/nexus-sync@v0
id: nexus
with:
url: ${{ secrets.OSSRH_URL }}
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
create: true
upload: true
generate-checksums: true
pgp-sign: true
pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }}
pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
# Print staging repo id
- name: Print Staging Repo Id
run: echo ${{ steps.nexus.outputs.staged-repository-id }}
# Print staging repo id
- name: Print Staging Repo Id
run: echo ${{ steps.nexus.outputs.staged-repository-id }}

View File

@@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
# Request release promotion repo
- uses: jvalkeal/nexus-sync@v0
with:
url: ${{ secrets.OSSRH_URL }}
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
staging-repo-id: ${{ github.event.inputs.stagedRepositoryId }}
release: true
# Request release promotion repo
- uses: jvalkeal/nexus-sync@v0
with:
url: ${{ secrets.OSSRH_URL }}
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
staging-repo-id: ${{ github.event.inputs.stagedRepositoryId }}
release: true

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -47,29 +47,29 @@ import org.springframework.util.StringUtils;
abstract class AbstractAmqpInboundAdapterParser extends AbstractSingleBeanDefinitionParser {
private static final String[] CONTAINER_VALUE_ATTRIBUTES = {
"acknowledge-mode",
"channel-transacted",
"concurrent-consumers",
"consumers-per-queue",
"expose-listener-channel",
"phase",
"prefetch-count",
"queue-names",
"recovery-interval",
"receive-timeout",
"shutdown-timeout",
"tx-size",
"missing-queues-fatal"
"acknowledge-mode",
"channel-transacted",
"concurrent-consumers",
"consumers-per-queue",
"expose-listener-channel",
"phase",
"prefetch-count",
"queue-names",
"recovery-interval",
"receive-timeout",
"shutdown-timeout",
"tx-size",
"missing-queues-fatal"
};
private static final String[] CONTAINER_REFERENCE_ATTRIBUTES = {
"advice-chain",
"connection-factory",
"error-handler",
"message-properties-converter",
"task-executor",
"transaction-attribute",
"transaction-manager"
"advice-chain",
"connection-factory",
"error-handler",
"message-properties-converter",
"task-executor",
"transaction-attribute",
"transaction-manager"
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 the original author or authors.
* Copyright 2016-2022 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.
@@ -41,7 +41,7 @@ import org.springframework.messaging.MessageChannel;
* @since 5.0
*/
public abstract class
AmqpBaseOutboundEndpointSpec<S extends AmqpBaseOutboundEndpointSpec<S, E>, E extends AbstractAmqpOutboundEndpoint>
AmqpBaseOutboundEndpointSpec<S extends AmqpBaseOutboundEndpointSpec<S, E>, E extends AbstractAmqpOutboundEndpoint>
extends MessageHandlerSpec<S, E> {
protected final DefaultAmqpHeaderMapper headerMapper = DefaultAmqpHeaderMapper.outboundMapper(); // NOSONAR final

View File

@@ -36,7 +36,7 @@ import org.springframework.integration.dsl.ComponentsRegistration;
* @since 5.0
*/
public abstract class AmqpInboundChannelAdapterSpec
<S extends AmqpInboundChannelAdapterSpec<S, C>, C extends MessageListenerContainer>
<S extends AmqpInboundChannelAdapterSpec<S, C>, C extends MessageListenerContainer>
extends AmqpBaseInboundChannelAdapterSpec<S>
implements ComponentsRegistration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2020 the original author or authors.
* Copyright 2014-2022 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.
@@ -36,7 +36,7 @@ import org.springframework.integration.dsl.ComponentsRegistration;
* @since 5.0
*/
public abstract class AmqpInboundGatewaySpec
<S extends AmqpInboundGatewaySpec<S, C>, C extends AbstractMessageListenerContainer>
<S extends AmqpInboundGatewaySpec<S, C>, C extends AbstractMessageListenerContainer>
extends AmqpBaseInboundGatewaySpec<S>
implements ComponentsRegistration {

View File

@@ -16,12 +16,12 @@
package org.springframework.integration.amqp.dsl;
import org.springframework.rabbit.stream.listener.StreamListenerContainer;
import org.springframework.rabbit.stream.producer.RabbitStreamTemplate;
import com.rabbitmq.stream.Codec;
import com.rabbitmq.stream.Environment;
import org.springframework.rabbit.stream.listener.StreamListenerContainer;
import org.springframework.rabbit.stream.producer.RabbitStreamTemplate;
/**
* Factory class for RabbitMQ components.
*

View File

@@ -18,12 +18,12 @@ package org.springframework.integration.amqp.dsl;
import java.util.function.Consumer;
import org.springframework.lang.Nullable;
import org.springframework.rabbit.stream.listener.StreamListenerContainer;
import com.rabbitmq.stream.Codec;
import com.rabbitmq.stream.Environment;
import org.springframework.lang.Nullable;
import org.springframework.rabbit.stream.listener.StreamListenerContainer;
/**
* Spec for an inbound channel adapter with a {@link StreamListenerContainer}.
*

View File

@@ -18,6 +18,8 @@ package org.springframework.integration.amqp.dsl;
import java.util.function.Consumer;
import com.rabbitmq.stream.Codec;
import com.rabbitmq.stream.Environment;
import org.aopalliance.aop.Advice;
import org.springframework.lang.Nullable;
@@ -25,9 +27,6 @@ import org.springframework.rabbit.stream.listener.ConsumerCustomizer;
import org.springframework.rabbit.stream.listener.StreamListenerContainer;
import org.springframework.rabbit.stream.support.converter.StreamMessageConverter;
import com.rabbitmq.stream.Codec;
import com.rabbitmq.stream.Environment;
/**
* Spec for {@link StreamListenerContainer}.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -22,6 +22,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.batch.BatchingStrategy;
@@ -54,8 +56,6 @@ import org.springframework.retry.support.RetrySynchronizationManager;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.util.Assert;
import com.rabbitmq.client.Channel;
/**
* Adapter that receives Messages from an AMQP Queue, converts them into
* Spring Integration Messages, and sends the results to a Message Channel.
@@ -349,7 +349,7 @@ public class AmqpInboundChannelAdapter extends MessageProducerSupport implements
AmqpInboundChannelAdapter.this.abstractListenerContainer == null
? false
: AcknowledgeMode.MANUAL == AmqpInboundChannelAdapter.this.abstractListenerContainer
.getAcknowledgeMode();
.getAcknowledgeMode();
protected final RetryOperations retryOps = AmqpInboundChannelAdapter.this.retryTemplate; // NOSONAR

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -21,6 +21,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.Address;
import org.springframework.amqp.core.AmqpTemplate;
@@ -51,8 +53,6 @@ import org.springframework.retry.support.RetrySynchronizationManager;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.util.Assert;
import com.rabbitmq.client.Channel;
/**
* Adapter that receives Messages from an AMQP Queue, converts them into
* Spring Integration Messages, and sends the results to a Message Channel.
@@ -102,6 +102,7 @@ public class AmqpInboundGateway extends MessagingGatewaySupport {
}
// TODO Remove in 6.0
/**
* Construct {@link AmqpInboundGateway} based on the provided {@link AbstractMessageListenerContainer}
* to receive request messages and {@link AmqpTemplate} to send replies.
@@ -290,14 +291,14 @@ public class AmqpInboundGateway extends MessagingGatewaySupport {
Assert.state(this.recoveryCallback == null || this.messageRecoverer == null,
"Only one of 'recoveryCallback' or 'messageRecoverer' may be provided, but not both");
if (this.messageRecoverer != null) {
this.recoveryCallback =
context -> {
Message messageToRecover =
(Message) RetrySynchronizationManager.getContext()
.getAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE);
this.messageRecoverer.recover(messageToRecover, context.getLastThrowable());
return null;
};
this.recoveryCallback =
context -> {
Message messageToRecover =
(Message) RetrySynchronizationManager.getContext()
.getAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE);
this.messageRecoverer.recover(messageToRecover, context.getLastThrowable());
return null;
};
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2022 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.
@@ -22,6 +22,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.GetResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -46,9 +48,6 @@ import org.springframework.integration.endpoint.AbstractMessageSource;
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
import org.springframework.util.Assert;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.GetResponse;
/**
* A pollable {@link org.springframework.integration.core.MessageSource} for RabbitMQ.
*
@@ -277,17 +276,17 @@ public class AmqpMessageSource extends AbstractMessageSource<Object> {
try {
long deliveryTag = this.ackInfo.getGetResponse().getEnvelope().getDeliveryTag();
switch (status) {
case ACCEPT:
this.ackInfo.getChannel().basicAck(deliveryTag, false);
break;
case REJECT:
this.ackInfo.getChannel().basicReject(deliveryTag, false);
break;
case REQUEUE:
this.ackInfo.getChannel().basicReject(deliveryTag, true);
break;
default:
break;
case ACCEPT:
this.ackInfo.getChannel().basicAck(deliveryTag, false);
break;
case REJECT:
this.ackInfo.getChannel().basicReject(deliveryTag, false);
break;
case REQUEUE:
this.ackInfo.getChannel().basicReject(deliveryTag, true);
break;
default:
break;
}
if (this.ackInfo.isTransacted()) {
this.ackInfo.getChannel().txCommit();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -115,9 +115,9 @@ public class AmqpOutboundEndpoint extends AbstractAmqpOutboundEndpoint
*/
public void setMultiSend(boolean multiSend) {
Assert.isTrue(this.rabbitTemplate != null
&& (!this.waitForConfirm || this.rabbitTemplate.getConnectionFactory().isSimplePublisherConfirms()),
&& (!this.waitForConfirm || this.rabbitTemplate.getConnectionFactory().isSimplePublisherConfirms()),
() -> "To use multiSend, " + AmqpOutboundEndpoint.this.amqpTemplate
+ " must be a RabbitTemplate with a ConnectionFactory configured with simple confirms");
+ " must be a RabbitTemplate with a ConnectionFactory configured with simple confirms");
this.multiSend = multiSend;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2022 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.
@@ -19,6 +19,7 @@ package org.springframework.integration.amqp.support;
import java.lang.reflect.UndeclaredThrowableException;
import java.time.Duration;
import com.rabbitmq.client.ConfirmCallback;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -29,8 +30,6 @@ import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils;
import com.rabbitmq.client.ConfirmCallback;
/**
* An advice that causes all downstream {@link RabbitOperations} operations to be executed
* on the same channel, as long as there are no thread handoffs, since the channel is

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -218,7 +218,7 @@ public class DefaultAmqpHeaderMapper extends AbstractHeaderMapper<MessagePropert
}
JavaUtils.INSTANCE
.acceptIfNotNull(getHeaderIfAvailable(headers, IntegrationMessageHeaderAccessor.PRIORITY,
Integer.class),
Integer.class),
amqpMessageProperties::setPriority)
.acceptIfHasText(getHeaderIfAvailable(headers, AmqpHeaders.RECEIVED_EXCHANGE, String.class),
amqpMessageProperties::setReceivedExchange)
@@ -364,7 +364,7 @@ public class DefaultAmqpHeaderMapper extends AbstractHeaderMapper<MessagePropert
* @since 4.3
*/
public static String[] inboundRequestHeaders() {
return new String[] { "*" };
return new String[] {"*"};
}
/**
@@ -388,11 +388,11 @@ public class DefaultAmqpHeaderMapper extends AbstractHeaderMapper<MessagePropert
* @since 4.3
*/
public static String[] outboundReplyHeaders() {
return new String[] { "*" };
return new String[] {"*"};
}
private static String[] safeOutboundHeaders() {
return new String[] { "!x-*", "*" };
return new String[] {"!x-*", "*"};
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 the original author or authors.
* Copyright 2019-2022 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.
@@ -18,11 +18,11 @@ package org.springframework.integration.amqp.support;
import java.util.List;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException;
import com.rabbitmq.client.Channel;
/**
* Utility methods for messaging endpoints.
*
@@ -53,7 +53,7 @@ public final class EndpointUtils {
return isManualAck
? new ManualAckListenerExecutionFailedException(LEFE_MESSAGE, ex, channel,
message.getMessageProperties().getDeliveryTag(), message)
message.getMessageProperties().getDeliveryTag(), message)
: new ListenerExecutionFailedException(LEFE_MESSAGE, ex, message);
}
@@ -72,8 +72,8 @@ public final class EndpointUtils {
return isManualAck
? new ManualAckListenerExecutionFailedException(LEFE_MESSAGE, ex, channel,
messages.get(messages.size() - 1).getMessageProperties().getDeliveryTag(),
messages.toArray(new Message[0]))
messages.get(messages.size() - 1).getMessageProperties().getDeliveryTag(),
messages.toArray(new Message[0]))
: new ListenerExecutionFailedException(LEFE_MESSAGE, ex, messages.toArray(new Message[0]));
}

View File

@@ -18,11 +18,11 @@ package org.springframework.integration.amqp.support;
import java.io.Serial;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException;
import com.rabbitmq.client.Channel;
/**
* A {@link ListenerExecutionFailedException} enhanced with the channel and delivery tag.
* Used for conversion errors when using manual acks.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -16,12 +16,6 @@
package org.springframework.integration.amqp.channel;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Mockito.mock;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.CyclicBarrier;
@@ -57,6 +51,12 @@ import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Mockito.mock;
/**
* @author Gary Russell
* @author Artem Bilan

View File

@@ -16,19 +16,11 @@
package org.springframework.integration.amqp.channel;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import com.rabbitmq.client.AMQP.Queue.DeclareOk;
import com.rabbitmq.client.Channel;
import org.apache.commons.logging.Log;
import org.junit.jupiter.api.Test;
@@ -43,8 +35,15 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.MessageDeliveryException;
import com.rabbitmq.client.AMQP.Queue.DeclareOk;
import com.rabbitmq.client.Channel;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -16,8 +16,6 @@
package org.springframework.integration.amqp.config;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.junit.Test;
@@ -40,6 +38,8 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Mark Fisher
* @author Gary Russell

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
@@ -16,8 +16,6 @@
package org.springframework.integration.amqp.config;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,6 +40,8 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Mark Fisher
* @author Artem Bilan

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -16,9 +16,6 @@
package org.springframework.integration.amqp.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.isNull;
import java.lang.reflect.Field;
import org.junit.Test;
@@ -47,6 +44,9 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.isNull;
/**
* @author Mark Fisher
* @author Gunnar Hillert
@@ -155,6 +155,7 @@ public class AmqpInboundGatewayParserTests {
}
}
private static class TestConverter extends SimpleMessageConverter { }
private static class TestConverter extends SimpleMessageConverter {
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
@@ -16,19 +16,6 @@
package org.springframework.integration.amqp.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.IOException;
import java.lang.reflect.Field;
import java.time.Duration;
@@ -36,6 +23,8 @@ import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.Channel;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@@ -72,8 +61,18 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.util.ReflectionUtils;
import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.Channel;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* @author Mark Fisher
@@ -131,19 +130,19 @@ public class AmqpOutboundChannelAdapterParserTests {
final AtomicBoolean shouldBePersistent = new AtomicBoolean();
Mockito.doAnswer(invocation -> {
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isEqualTo("foo");
assertThat(properties.getHeaders().get("foobar")).isEqualTo("foobar");
assertThat(properties.getHeaders().get("bar")).isNull();
assertThat(properties.getDeliveryMode()).isEqualTo(shouldBePersistent.get() ?
MessageDeliveryMode.PERSISTENT
: MessageDeliveryMode.NON_PERSISTENT);
return null;
})
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isEqualTo("foo");
assertThat(properties.getHeaders().get("foobar")).isEqualTo("foobar");
assertThat(properties.getHeaders().get("bar")).isNull();
assertThat(properties.getDeliveryMode()).isEqualTo(shouldBePersistent.get() ?
MessageDeliveryMode.PERSISTENT
: MessageDeliveryMode.NON_PERSISTENT);
return null;
})
.when(amqpTemplate).send(Mockito.any(String.class), Mockito.any(String.class),
Mockito.any(org.springframework.amqp.core.Message.class), Mockito.any(CorrelationData.class));
Mockito.any(org.springframework.amqp.core.Message.class), Mockito.any(CorrelationData.class));
ReflectionUtils.setField(amqpTemplateField, endpoint, amqpTemplate);
MessageChannel requestChannel = context.getBean("requestChannel", MessageChannel.class);
@@ -209,16 +208,16 @@ public class AmqpOutboundChannelAdapterParserTests {
amqpTemplate = Mockito.spy(amqpTemplate);
Mockito.doAnswer(invocation -> {
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpMessage.getMessageProperties();
assertThat(new String(amqpMessage.getBody())).isEqualTo("hello");
assertThat(properties.getDeliveryMode()).isEqualTo(MessageDeliveryMode.PERSISTENT);
return null;
})
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpMessage.getMessageProperties();
assertThat(new String(amqpMessage.getBody())).isEqualTo("hello");
assertThat(properties.getDeliveryMode()).isEqualTo(MessageDeliveryMode.PERSISTENT);
return null;
})
.when(amqpTemplate).send(Mockito.any(String.class), Mockito.any(String.class),
Mockito.any(org.springframework.amqp.core.Message.class),
Mockito.any(CorrelationData.class));
Mockito.any(org.springframework.amqp.core.Message.class),
Mockito.any(CorrelationData.class));
ReflectionUtils.setField(amqpTemplateField, endpoint, amqpTemplate);
MessageChannel requestChannel = context.getBean("amqpOutboundChannelAdapterWithinChain", MessageChannel.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -16,9 +16,6 @@
package org.springframework.integration.amqp.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.isNull;
import java.lang.reflect.Field;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -48,6 +45,9 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.isNull;
/**
* @author Oleg Zhurakousky
* @author Gary Russell
@@ -64,7 +64,7 @@ public class AmqpOutboundGatewayParserTests {
private static volatile int adviceCalled;
@Autowired
private ApplicationContext context;
private ApplicationContext context;
@Test
public void testGatewayConfig() {
@@ -116,22 +116,22 @@ public class AmqpOutboundGatewayParserTests {
final AtomicBoolean shouldBePersistent = new AtomicBoolean();
Mockito.doAnswer(invocation -> {
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpRequestMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpRequestMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isEqualTo("foo");
assertThat(properties.getDeliveryMode()).isEqualTo(shouldBePersistent.get() ?
MessageDeliveryMode.PERSISTENT
: MessageDeliveryMode.NON_PERSISTENT);
// mock reply AMQP message
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setHeader("foobar", "foobar");
amqpProperties.setHeader("bar", "bar");
return new org.springframework.amqp.core.Message("hello".getBytes(), amqpProperties);
})
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpRequestMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpRequestMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isEqualTo("foo");
assertThat(properties.getDeliveryMode()).isEqualTo(shouldBePersistent.get() ?
MessageDeliveryMode.PERSISTENT
: MessageDeliveryMode.NON_PERSISTENT);
// mock reply AMQP message
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setHeader("foobar", "foobar");
amqpProperties.setHeader("bar", "bar");
return new org.springframework.amqp.core.Message("hello".getBytes(), amqpProperties);
})
.when(amqpTemplate).sendAndReceive(Mockito.any(String.class), Mockito.any(String.class),
Mockito.any(org.springframework.amqp.core.Message.class), isNull());
Mockito.any(org.springframework.amqp.core.Message.class), isNull());
ReflectionUtils.setField(amqpTemplateField, endpoint, amqpTemplate);
MessageChannel requestChannel = this.context.getBean("toRabbit1", MessageChannel.class);
@@ -178,21 +178,21 @@ public class AmqpOutboundGatewayParserTests {
amqpTemplate = Mockito.spy(amqpTemplate);
Mockito.doAnswer(invocation -> {
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpRequestMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpRequestMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isEqualTo("foo");
// mock reply AMQP message
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setHeader("foobar", "foobar");
amqpProperties.setHeader("bar", "bar");
assertThat(properties.getDeliveryMode()).isEqualTo(MessageDeliveryMode.PERSISTENT);
amqpProperties.setReceivedDeliveryMode(properties.getDeliveryMode());
return new org.springframework.amqp.core.Message("hello".getBytes(), amqpProperties);
})
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpRequestMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpRequestMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isEqualTo("foo");
// mock reply AMQP message
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setHeader("foobar", "foobar");
amqpProperties.setHeader("bar", "bar");
assertThat(properties.getDeliveryMode()).isEqualTo(MessageDeliveryMode.PERSISTENT);
amqpProperties.setReceivedDeliveryMode(properties.getDeliveryMode());
return new org.springframework.amqp.core.Message("hello".getBytes(), amqpProperties);
})
.when(amqpTemplate).sendAndReceive(Mockito.any(String.class), Mockito.any(String.class),
Mockito.any(org.springframework.amqp.core.Message.class), isNull());
Mockito.any(org.springframework.amqp.core.Message.class), isNull());
ReflectionUtils.setField(amqpTemplateField, endpoint, amqpTemplate);
MessageChannel requestChannel = this.context.getBean("toRabbit2", MessageChannel.class);
@@ -227,19 +227,19 @@ public class AmqpOutboundGatewayParserTests {
amqpTemplate = Mockito.spy(amqpTemplate);
Mockito.doAnswer(invocation -> {
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpRequestMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpRequestMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isNull();
// mock reply AMQP message
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setHeader("foobar", "foobar");
amqpProperties.setHeader("bar", "bar");
return new org.springframework.amqp.core.Message("hello".getBytes(), amqpProperties);
})
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpRequestMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpRequestMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isNull();
// mock reply AMQP message
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setHeader("foobar", "foobar");
amqpProperties.setHeader("bar", "bar");
return new org.springframework.amqp.core.Message("hello".getBytes(), amqpProperties);
})
.when(amqpTemplate).sendAndReceive(Mockito.any(String.class), Mockito.any(String.class),
Mockito.any(org.springframework.amqp.core.Message.class), isNull());
Mockito.any(org.springframework.amqp.core.Message.class), isNull());
ReflectionUtils.setField(amqpTemplateField, endpoint, amqpTemplate);
MessageChannel requestChannel = this.context.getBean("toRabbit3", MessageChannel.class);
@@ -276,19 +276,19 @@ public class AmqpOutboundGatewayParserTests {
amqpTemplate = Mockito.spy(amqpTemplate);
Mockito.doAnswer(invocation -> {
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpRequestMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpRequestMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isNull();
// mock reply AMQP message
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setHeader("foobar", "foobar");
amqpProperties.setHeader("bar", "bar");
return new org.springframework.amqp.core.Message("hello".getBytes(), amqpProperties);
})
Object[] args = invocation.getArguments();
org.springframework.amqp.core.Message amqpRequestMessage = (org.springframework.amqp.core.Message) args[2];
MessageProperties properties = amqpRequestMessage.getMessageProperties();
assertThat(properties.getHeaders().get("foo")).isNull();
// mock reply AMQP message
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setHeader("foobar", "foobar");
amqpProperties.setHeader("bar", "bar");
return new org.springframework.amqp.core.Message("hello".getBytes(), amqpProperties);
})
.when(amqpTemplate).sendAndReceive(Mockito.any(String.class), Mockito.any(String.class),
Mockito.any(org.springframework.amqp.core.Message.class), isNull());
Mockito.any(org.springframework.amqp.core.Message.class), isNull());
ReflectionUtils.setField(amqpTemplateField, endpoint, amqpTemplate);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -16,8 +16,6 @@
package org.springframework.integration.amqp.config;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,6 +30,8 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Mark Fisher
* @author Artem Bilan

View File

@@ -16,14 +16,6 @@
package org.springframework.integration.amqp.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
@@ -46,6 +38,14 @@ import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
/**
* @author Mark Fisher
* @author Dave Syer

View File

@@ -16,17 +16,13 @@
package org.springframework.integration.amqp.dsl;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import com.rabbitmq.stream.ConsumerBuilder;
import com.rabbitmq.stream.Environment;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
@@ -75,8 +71,11 @@ import org.springframework.rabbit.stream.listener.ConsumerCustomizer;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.rabbitmq.stream.ConsumerBuilder;
import com.rabbitmq.stream.Environment;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
/**
* @author Artem Bilan
@@ -85,9 +84,9 @@ import com.rabbitmq.stream.Environment;
* @since 5.0
*/
@SpringJUnitConfig
@RabbitAvailable(queues = { "amqpOutboundInput", "amqpReplyChannel", "asyncReplies",
@RabbitAvailable(queues = {"amqpOutboundInput", "amqpReplyChannel", "asyncReplies",
"defaultReplyTo", "si.dsl.test", "si.dsl.exception.test.dlq",
"si.dsl.conv.exception.test.dlq", "testTemplateChannelTransacted" })
"si.dsl.conv.exception.test.dlq", "testTemplateChannelTransacted"})
@DirtiesContext
public class AmqpTests {
@@ -169,7 +168,7 @@ public class AmqpTests {
@Test
public void testTemplateChannelTransacted() {
IntegrationFlowBuilder flow = IntegrationFlow.from(Amqp.channel("testTemplateChannelTransacted",
this.rabbitConnectionFactory)
this.rabbitConnectionFactory)
.autoStartup(false)
.templateChannelTransacted(true));
assertThat(TestUtils.getPropertyValue(flow, "currentMessageChannel.amqpTemplate.transactional",
@@ -365,10 +364,10 @@ public class AmqpTests {
@Bean
public IntegrationFlow amqpInboundFlow(ConnectionFactory rabbitConnectionFactory) {
return IntegrationFlow.from(Amqp.inboundAdapter(rabbitConnectionFactory, fooQueue())
.configureContainer(container -> container.consumerBatchEnabled(true)
.batchSize(2))
.batchMode(BatchMode.EXTRACT_PAYLOADS)
.id("amqpInboundFlowAdapter"))
.configureContainer(container -> container.consumerBatchEnabled(true)
.batchSize(2))
.batchMode(BatchMode.EXTRACT_PAYLOADS)
.id("amqpInboundFlowAdapter"))
.transform(String.class, String::toUpperCase)
.channel(Amqp.pollableChannel(rabbitConnectionFactory)
.queueName("amqpReplyChannel")
@@ -403,8 +402,8 @@ public class AmqpTests {
@Bean
public IntegrationFlow inboundWithExceptionFlow(ConnectionFactory cf) {
return IntegrationFlow.from(Amqp.inboundAdapter(cf, exQueue())
.configureContainer(c -> c.defaultRequeueRejected(false))
.errorChannel("errors.input"))
.configureContainer(c -> c.defaultRequeueRejected(false))
.errorChannel("errors.input"))
.handle(m -> {
throw new RuntimeException("fail");
})
@@ -440,17 +439,17 @@ public class AmqpTests {
@Bean
public IntegrationFlow inboundWithConvExceptionFlow(ConnectionFactory cf) {
return IntegrationFlow.from(Amqp.inboundAdapter(cf, exConvQueue())
.configureContainer(c -> c.defaultRequeueRejected(false))
.messageConverter(new SimpleMessageConverter() {
.configureContainer(c -> c.defaultRequeueRejected(false))
.messageConverter(new SimpleMessageConverter() {
@Override
public Object fromMessage(org.springframework.amqp.core.Message message)
throws MessageConversionException {
throw new MessageConversionException("fail");
}
@Override
public Object fromMessage(org.springframework.amqp.core.Message message)
throws MessageConversionException {
throw new MessageConversionException("fail");
}
})
.errorChannel("errors.input"))
})
.errorChannel("errors.input"))
.get();
}

View File

@@ -16,8 +16,6 @@
package org.springframework.integration.amqp.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -58,6 +56,8 @@ import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Gary Russell
*
@@ -70,7 +70,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
AmqpMessageSourceIntegrationTests.DSL_QUEUE,
AmqpMessageSourceIntegrationTests.INTERCEPT_QUEUE,
AmqpMessageSourceIntegrationTests.DLQ,
AmqpMessageSourceIntegrationTests.NOAUTOACK_QUEUE })
AmqpMessageSourceIntegrationTests.NOAUTOACK_QUEUE})
public class AmqpMessageSourceIntegrationTests {
static final String DSL_QUEUE = "AmqpMessageSourceIntegrationTests";
@@ -182,7 +182,7 @@ public class AmqpMessageSourceIntegrationTests {
@ServiceActivator(inputChannel = "noAutoAck")
public void ack(@Header(IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK)
AcknowledgmentCallback callback) {
AcknowledgmentCallback callback) {
callback.noAutoAck();
this.callback = callback;
latch.countDown();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2022 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.
@@ -16,17 +16,15 @@
package org.springframework.integration.amqp.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.util.List;
import java.util.concurrent.ExecutorService;
import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Envelope;
import com.rabbitmq.client.GetResponse;
import org.junit.Test;
import org.springframework.amqp.core.MessageProperties;
@@ -40,12 +38,13 @@ import org.springframework.integration.acks.AcknowledgmentCallback.Status;
import org.springframework.integration.amqp.support.AmqpMessageHeaderErrorMessageStrategy;
import org.springframework.messaging.Message;
import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Envelope;
import com.rabbitmq.client.GetResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/**
* @author Gary Russell
@@ -76,7 +75,7 @@ public class AmqpMessageSourceTests {
assertThat(received.getHeaders().get(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE))
.isInstanceOf(org.springframework.amqp.core.Message.class);
assertThat(received.getHeaders().get(IntegrationMessageHeaderAccessor.SOURCE_DATA))
.isSameAs(received.getHeaders().get(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE));
.isSameAs(received.getHeaders().get(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE));
assertThat(received.getHeaders().get(AmqpHeaders.CONSUMER_QUEUE)).isEqualTo("foo");
// make sure channel is not cached
org.springframework.amqp.rabbit.connection.Connection conn = ccf.createConnection();
@@ -130,7 +129,7 @@ public class AmqpMessageSourceTests {
verify(connection).close(30000);
}
@SuppressWarnings({ "unchecked" })
@SuppressWarnings({"unchecked"})
@Test
public void testBatch() throws Exception {
SimpleBatchingStrategy bs = new SimpleBatchingStrategy(2, 10_000, 10_000L);
@@ -164,5 +163,4 @@ public class AmqpMessageSourceTests {
assertThat(((List<String>) received.getPayload())).contains("test1", "test2");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2021 the original author or authors.
* Copyright 2013-2022 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.
@@ -16,19 +16,6 @@
package org.springframework.integration.amqp.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -37,6 +24,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import com.rabbitmq.client.Channel;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@@ -80,7 +68,18 @@ import org.springframework.messaging.PollableChannel;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.retry.support.RetryTemplate;
import com.rabbitmq.client.Channel;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
/**
* @author Artem Bilan
@@ -199,19 +198,19 @@ public class InboundEndpointTests {
CountDownLatch sendLatch = new CountDownLatch(1);
Mockito.doAnswer(invocation -> {
org.springframework.amqp.core.Message message =
invocation.getArgument(2);
Map<String, Object> headers = message.getMessageProperties().getHeaders();
assertThat(headers.containsKey(JsonHeaders.TYPE_ID.replaceFirst(JsonHeaders.PREFIX, ""))).isTrue();
assertThat(headers.get(JsonHeaders.TYPE_ID.replaceFirst(JsonHeaders.PREFIX, ""))).isNotEqualTo("foo");
assertThat(headers.containsKey(JsonHeaders.CONTENT_TYPE_ID.replaceFirst(JsonHeaders.PREFIX, ""))).isFalse();
assertThat(headers.containsKey(JsonHeaders.KEY_TYPE_ID.replaceFirst(JsonHeaders.PREFIX, ""))).isFalse();
assertThat(headers.containsKey(JsonHeaders.TYPE_ID)).isFalse();
assertThat(headers.containsKey(JsonHeaders.KEY_TYPE_ID)).isFalse();
assertThat(headers.containsKey(JsonHeaders.CONTENT_TYPE_ID)).isFalse();
sendLatch.countDown();
return null;
}).when(rabbitTemplate)
org.springframework.amqp.core.Message message =
invocation.getArgument(2);
Map<String, Object> headers = message.getMessageProperties().getHeaders();
assertThat(headers.containsKey(JsonHeaders.TYPE_ID.replaceFirst(JsonHeaders.PREFIX, ""))).isTrue();
assertThat(headers.get(JsonHeaders.TYPE_ID.replaceFirst(JsonHeaders.PREFIX, ""))).isNotEqualTo("foo");
assertThat(headers.containsKey(JsonHeaders.CONTENT_TYPE_ID.replaceFirst(JsonHeaders.PREFIX, ""))).isFalse();
assertThat(headers.containsKey(JsonHeaders.KEY_TYPE_ID.replaceFirst(JsonHeaders.PREFIX, ""))).isFalse();
assertThat(headers.containsKey(JsonHeaders.TYPE_ID)).isFalse();
assertThat(headers.containsKey(JsonHeaders.KEY_TYPE_ID)).isFalse();
assertThat(headers.containsKey(JsonHeaders.CONTENT_TYPE_ID)).isFalse();
sendLatch.countDown();
return null;
}).when(rabbitTemplate)
.send(anyString(), anyString(), any(org.springframework.amqp.core.Message.class), isNull());
AmqpInboundGateway gateway = new AmqpInboundGateway(container, rabbitTemplate);
@@ -462,7 +461,7 @@ public class InboundEndpointTests {
assertThat(recoveredMessage.get()).isSameAs(amqpMessage);
}
@SuppressWarnings({ "unchecked" })
@SuppressWarnings({"unchecked"})
@Test
public void testBatchAdapter() throws Exception {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(mock(ConnectionFactory.class));
@@ -486,7 +485,7 @@ public class InboundEndpointTests {
assertThat(((List<String>) received.getPayload())).contains("test1", "test2");
}
@SuppressWarnings({ "unchecked" })
@SuppressWarnings({"unchecked"})
@Test
public void testBatchGateway() throws Exception {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(mock(ConnectionFactory.class));
@@ -513,7 +512,7 @@ public class InboundEndpointTests {
assertThat(sourceData).isSameAs(batched.getMessage());
}
@SuppressWarnings({ "unchecked" })
@SuppressWarnings({"unchecked"})
@Test
public void testConsumerBatchExtract() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(mock(ConnectionFactory.class));
@@ -537,7 +536,7 @@ public class InboundEndpointTests {
.hasSize(2);
}
@SuppressWarnings({ "unchecked" })
@SuppressWarnings({"unchecked"})
@Test
public void testConsumerBatch() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(mock(ConnectionFactory.class));
@@ -566,7 +565,8 @@ public class InboundEndpointTests {
container.setConsumerBatchEnabled(true);
AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(container);
adapter.setRetryTemplate(new RetryTemplate());
adapter.setMessageRecoverer((message, cause) -> { });
adapter.setMessageRecoverer((message, cause) -> {
});
assertThatIllegalArgumentException()
.isThrownBy(adapter::afterPropertiesSet)
.withMessageStartingWith("The 'messageRecoverer' must be an instance of MessageBatchRecoverer " +
@@ -577,7 +577,8 @@ public class InboundEndpointTests {
public void testExclusiveRecover() {
AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(mock(AbstractMessageListenerContainer.class));
adapter.setRetryTemplate(new RetryTemplate());
adapter.setMessageRecoverer((message, cause) -> { });
adapter.setMessageRecoverer((message, cause) -> {
});
adapter.setRecoveryCallback(context -> null);
assertThatIllegalStateException()
.isThrownBy(adapter::afterPropertiesSet)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -16,9 +16,7 @@
package org.springframework.integration.amqp.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import com.rabbitmq.client.Channel;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -51,7 +49,8 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.rabbitmq.client.Channel;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* @author Gary Russell

View File

@@ -16,15 +16,6 @@
package org.springframework.integration.amqp.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.willDoNothing;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -59,6 +50,15 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.willDoNothing;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
/**
* @author Oleg Zhurakousky
* @author Gary Russell

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2021 the original author or authors.
* Copyright 2019-2022 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.
@@ -16,9 +16,6 @@
package org.springframework.integration.amqp.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
@@ -48,6 +45,9 @@ import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
/**
* @author Gary Russell
* @author Artem Bilan

View File

@@ -16,15 +16,6 @@
package org.springframework.integration.amqp.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
@@ -60,6 +51,15 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.support.ErrorMessage;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
/**
* @author Gary Russell
* @author Artem Bilan
@@ -67,7 +67,7 @@ import org.springframework.messaging.support.ErrorMessage;
* @since 4.3
*
*/
@RabbitAvailable(queues = { "asyncQ1", "asyncRQ1" })
@RabbitAvailable(queues = {"asyncQ1", "asyncRQ1"})
@LogLevels(categories = "org.springframework.amqp", level = "trace")
class AsyncAmqpGatewayTests {
@@ -152,7 +152,8 @@ class AsyncAmqpGatewayTests {
// timeout tests
asyncTemplate.setReceiveTimeout(10);
receiver.setMessageListener(message1 -> { });
receiver.setMessageListener(message1 -> {
});
// reply timeout with no requiresReply
message = MessageBuilder.withPayload("bar").setErrorChannel(errorChannel).build();
gateway.handleMessage(message);

View File

@@ -16,18 +16,6 @@
package org.springframework.integration.amqp.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.BDDMockito.willDoNothing;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import java.util.Date;
import java.util.concurrent.atomic.AtomicReference;
@@ -53,6 +41,18 @@ import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.scheduling.TaskScheduler;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.BDDMockito.willDoNothing;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
/**
* @author Gary Russell
* @author Artem Bilan

View File

@@ -16,12 +16,14 @@
package org.springframework.integration.amqp.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import com.rabbitmq.stream.Address;
import com.rabbitmq.stream.Consumer;
import com.rabbitmq.stream.Environment;
import com.rabbitmq.stream.OffsetSpecification;
import org.junit.jupiter.api.Test;
import org.springframework.integration.amqp.dsl.RabbitStream;
@@ -29,10 +31,7 @@ import org.springframework.integration.amqp.support.RabbitTestContainer;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.rabbit.stream.producer.RabbitStreamTemplate;
import com.rabbitmq.stream.Address;
import com.rabbitmq.stream.Consumer;
import com.rabbitmq.stream.Environment;
import com.rabbitmq.stream.OffsetSpecification;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Gary Russell

View File

@@ -16,12 +16,6 @@
package org.springframework.integration.amqp.support;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.spy;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
@@ -44,6 +38,12 @@ import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.spy;
/**
* @author Gary Russell
* @author Artem Bilan

View File

@@ -16,22 +16,12 @@
package org.springframework.integration.amqp.support;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.time.Duration;
import java.util.concurrent.ExecutorService;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
@@ -45,9 +35,18 @@ import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/**
* @author Gary Russell

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
@@ -16,10 +16,6 @@
package org.springframework.integration.amqp.support;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.Mockito.mock;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -44,6 +40,10 @@ import org.springframework.messaging.support.GenericMessage;
import org.springframework.util.MimeType;
import org.springframework.util.MimeTypeUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.Mockito.mock;
/**
* @author Mark Fisher
* @author Gary Russell

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2022 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.
@@ -16,8 +16,7 @@
package org.springframework.integration.amqp.support;
import static org.assertj.core.api.Assertions.assertThat;
import com.rabbitmq.client.AMQP.BasicProperties;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -33,7 +32,7 @@ import org.springframework.integration.json.ObjectToJsonTransformer;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.GenericMessage;
import com.rabbitmq.client.AMQP.BasicProperties;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Gary Russell
@@ -63,8 +62,7 @@ public class JsonConverterCompatibilityTests {
@Test
public void testInbound() {
@SuppressWarnings("unchecked")
final Message<String> out = (Message<String>) new ObjectToJsonTransformer()
@SuppressWarnings("unchecked") final Message<String> out = (Message<String>) new ObjectToJsonTransformer()
.transform(new GenericMessage<Foo>(new Foo()));
MessageProperties messageProperties = new MessageProperties();
DefaultAmqpHeaderMapper.outboundMapper().fromHeadersToRequest(out.getHeaders(), messageProperties);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2019 the original author or authors.
* Copyright 2017-2022 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.
@@ -16,9 +16,6 @@
package org.springframework.integration.amqp.support;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import org.junit.Test;
import org.springframework.amqp.core.MessageDeliveryMode;
@@ -29,6 +26,9 @@ import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
/**
* @author Gary Russell
* @since 5.0

View File

@@ -44,9 +44,9 @@ import org.springframework.util.Assert;
public class CamelMessageHandlerSpec extends
MessageHandlerSpec<CamelMessageHandlerSpec, CamelMessageHandler> {
private String[] inboundHeaderNames = { "*" };
private String[] inboundHeaderNames = {"*"};
private String[] outboundHeaderNames = { "*" };
private String[] outboundHeaderNames = {"*"};
protected CamelMessageHandlerSpec(@Nullable ProducerTemplate producerTemplate) {
this.target = producerTemplate == null ? new CamelMessageHandler() : new CamelMessageHandler(producerTemplate);

View File

@@ -42,9 +42,9 @@ public class CamelHeaderMapper implements HeaderMapper<org.apache.camel.Message>
private static final LogAccessor LOGGER = new LogAccessor(CamelHeaderMapper.class);
private String[] inboundHeaderNames = { "*" };
private String[] inboundHeaderNames = {"*"};
private String[] outboundHeaderNames = { "*" };
private String[] outboundHeaderNames = {"*"};
/**
* Provide a list of patterns to map Apache Camel message headers into Spring Integration message.

View File

@@ -16,8 +16,6 @@
package org.springframework.integration.camel.dsl;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.spring.SpringCamelContext;
@@ -36,6 +34,8 @@ import org.springframework.messaging.MessageChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Artem Bilan
*

View File

@@ -16,9 +16,6 @@
package org.springframework.integration.camel.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.ExchangePattern;
import org.apache.camel.ProducerTemplate;
@@ -40,6 +37,9 @@ import org.springframework.messaging.MessageHandlingException;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.support.GenericMessage;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* @author Artem Bilan
*

View File

@@ -20,6 +20,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import com.datastax.oss.driver.api.core.cql.Statement;
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
import org.springframework.data.cassandra.core.cql.WriteOptions;
import org.springframework.expression.Expression;
@@ -28,8 +30,6 @@ import org.springframework.integration.dsl.MessageHandlerSpec;
import org.springframework.integration.expression.FunctionExpression;
import org.springframework.messaging.Message;
import com.datastax.oss.driver.api.core.cql.Statement;
/**
* The {@link MessageHandlerSpec} for {@link CassandraMessageHandler}.
*

View File

@@ -21,6 +21,15 @@ import java.util.List;
import java.util.Map;
import java.util.stream.StreamSupport;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.BatchStatementBuilder;
import com.datastax.oss.driver.api.core.cql.BatchType;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.dao.DataAccessException;
import org.springframework.data.cassandra.ReactiveResultSet;
import org.springframework.data.cassandra.ReactiveSession;
@@ -44,15 +53,6 @@ import org.springframework.integration.handler.MessageProcessor;
import org.springframework.messaging.Message;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.BatchStatementBuilder;
import com.datastax.oss.driver.api.core.cql.BatchType;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* An {@link AbstractReplyProducingMessageHandler} implementation for Cassandra outbound operations.
*

View File

@@ -80,7 +80,7 @@ public class IntegrationTestConfig extends AbstractReactiveCassandraConfiguratio
@Override
public String[] getEntityBasePackages() {
return new String[]{ Book.class.getPackage().getName() };
return new String[] {Book.class.getPackage().getName()};
}
}

View File

@@ -16,12 +16,14 @@
package org.springframework.integration.cassandra.config;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList;
import java.util.List;
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
import com.datastax.oss.driver.api.querybuilder.select.Select;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@@ -41,10 +43,7 @@ import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
import com.datastax.oss.driver.api.querybuilder.select.Select;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Filippo Balicchia

View File

@@ -16,8 +16,6 @@
package org.springframework.integration.cassandra.config;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +24,8 @@ import org.springframework.integration.cassandra.outbound.CassandraMessageHandle
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Filippo Balicchia
* @author Artem Bilan

View File

@@ -16,14 +16,14 @@
package org.springframework.integration.cassandra.config;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.integration.cassandra.config.xml.CassandraParserUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Filippo Balicchia
* @author Artem Bilan

View File

@@ -18,7 +18,10 @@ package org.springframework.integration.cassandra.dsl;
import java.time.Duration;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -40,10 +43,6 @@ import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
/**
* @author Artem Bilan
*

View File

@@ -16,13 +16,16 @@
package org.springframework.integration.cassandra.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
import com.datastax.oss.driver.api.querybuilder.select.Select;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@@ -49,11 +52,7 @@ import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
import com.datastax.oss.driver.api.querybuilder.select.Select;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Soby Chacko

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2021 the original author or authors.
* Copyright 2019-2022 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.
@@ -171,5 +171,4 @@ public final class JavaUtils {
return this;
}
}

View File

@@ -683,9 +683,9 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP
processForceRelease(groupId, timestamp, lastModified);
}
catch (MessageDeliveryException ex) {
logger.warn(ex, () ->
"The MessageGroup [" + groupId +
"] is rescheduled by the reason of: ");
logger.warn(ex, () ->
"The MessageGroup [" + groupId +
"] is rescheduled by the reason of: ");
scheduleGroupToForceComplete(groupId);
}
}, startTime.toInstant());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 the original author or authors.
* Copyright 2019-2022 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.
@@ -21,6 +21,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.function.Predicate;
import reactor.core.Disposable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;
import reactor.core.publisher.Mono;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.IntegrationPatternType;
import org.springframework.integration.channel.ReactiveStreamsSubscribableChannel;
@@ -30,11 +35,6 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.util.Assert;
import reactor.core.Disposable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;
import reactor.core.publisher.Mono;
/**
* The {@link AbstractMessageProducingHandler} implementation for aggregation logic based
* on Reactor's {@link Flux#groupBy} and {@link Flux#window} operators.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -83,18 +83,18 @@ public class MessageGroupExpiredEvent extends IntegrationEvent {
sourceName = this.source.toString();
}
builder.append("MessageGroupExpiredEvent [groupId=")
.append(this.groupId)
.append(", messageCount=")
.append(this.messageCount)
.append(", lastModified=")
.append(this.lastModified)
.append(", expiredAt=")
.append(this.expired)
.append(", discarded=")
.append(this.discarded)
.append(", source=")
.append(sourceName)
.append("]");
.append(this.groupId)
.append(", messageCount=")
.append(this.messageCount)
.append(", lastModified=")
.append(this.lastModified)
.append(", expiredAt=")
.append(this.expired)
.append(", discarded=")
.append(this.discarded)
.append(", source=")
.append(sourceName)
.append("]");
return builder.toString();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -19,7 +19,6 @@ package org.springframework.integration.aggregator;
import org.springframework.integration.store.MessageGroup;
/**
* Strategy for determining when a group of messages reaches a state of
* completion (i.e. can trip a barrier).

View File

@@ -37,7 +37,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
* @author Artem Bilan
* @author Chris Bono
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(Aggregators.class)

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Aggregators {

View File

@@ -43,7 +43,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
*
* @since 4.0
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(BridgeFromRepeatable.class)

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface BridgeFromRepeatable {

View File

@@ -48,7 +48,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
*
* @since 4.0
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(BridgeToRepeatable.class)

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface BridgeToRepeatable {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -28,8 +28,8 @@ import java.lang.annotation.Target;
*
* @author Marius Bogoevici
*/
@Retention (RetentionPolicy.RUNTIME)
@Target (ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
public @interface CorrelationStrategy {
}

View File

@@ -45,7 +45,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
*
* @since 2.0
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(Filters.class)
@@ -86,7 +86,7 @@ public @interface Filter {
* Only the handler is advised, not the downstream flow.
* @return the advice chain.
*/
String[] adviceChain() default { };
String[] adviceChain() default {};
/**
* When {@code true} (default) any discard action (and exception thrown) will occur

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Filters {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -56,7 +56,7 @@ import java.lang.annotation.Target;
*
* @see MessagingGateway
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Gateway {
@@ -123,6 +123,6 @@ public @interface Gateway {
* Specify additional headers that will be added to the request message.
* @return the headers.
*/
GatewayHeader[] headers() default { };
GatewayHeader[] headers() default {};
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
* @author Artem Bilan
* @since 4.0
*/
@Target({ })
@Target({})
@Retention(RetentionPolicy.RUNTIME)
public @interface GatewayHeader {

View File

@@ -51,7 +51,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
*
* @since 4.0
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(InboundChannelAdapters.class)

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface InboundChannelAdapters {

View File

@@ -54,7 +54,7 @@ public @interface IntegrationComponentScan {
* @return the array of 'basePackages'.
*/
@AliasFor("basePackages")
String[] value() default { };
String[] value() default {};
/**
* Base packages to scan for annotated components. The {@link #value()} is an alias
@@ -63,7 +63,7 @@ public @interface IntegrationComponentScan {
* @return the array of 'basePackages'.
*/
@AliasFor("value")
String[] basePackages() default { };
String[] basePackages() default {};
/**
* Type-safe alternative to {@link #basePackages()} for specifying the packages to
@@ -72,7 +72,7 @@ public @interface IntegrationComponentScan {
* serves no purpose other than being referenced by this attribute.
* @return the array of 'basePackageClasses'.
*/
Class<?>[] basePackageClasses() default { };
Class<?>[] basePackageClasses() default {};
/**
@@ -96,7 +96,7 @@ public @interface IntegrationComponentScan {
* @since 5.0
* @see #excludeFilters()
*/
Filter[] includeFilters() default { };
Filter[] includeFilters() default {};
/**
* Specifies which types are not eligible for component scanning.
@@ -104,7 +104,7 @@ public @interface IntegrationComponentScan {
* @since 5.0
* @see #includeFilters()
*/
Filter[] excludeFilters() default { };
Filter[] excludeFilters() default {};
/**

View File

@@ -133,7 +133,7 @@ public @interface MessagingGateway {
* all methods on the service-interface (unless overridden by a specific method).
* @return the suggested payload expression, if any
*/
GatewayHeader[] defaultHeaders() default { };
GatewayHeader[] defaultHeaders() default {};
/**
* An {@link org.springframework.integration.gateway.MethodArgsMessageMapper}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -33,7 +33,7 @@ import java.lang.annotation.Target;
* @author Dave Syer
* @since 2.0
*/
@Target({ ElementType.PARAMETER, ElementType.METHOD })
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Payloads {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -46,7 +46,7 @@ import org.springframework.core.annotation.AliasFor;
*
* @see org.springframework.integration.aop.MessagePublishingInterceptor
*/
@Target({ ElementType.METHOD, ElementType.TYPE })
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Publisher {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
*
* @since 4.2
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Role {

View File

@@ -48,7 +48,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
* @author Artem Bilan
* @author Chris Bono
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(Routers.class)
@@ -74,7 +74,7 @@ public @interface Router {
* @return the channelMappings.
* @see org.springframework.integration.router.AbstractMappingMessageRouter#setChannelMapping(String, String)
*/
String[] channelMappings() default { };
String[] channelMappings() default {};
/**
* Specify a prefix to be added to each channel name prior to resolution.

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Routers {

View File

@@ -46,7 +46,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
* @author Yilin Wei
* @author Chris Bono
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(ServiceActivators.class)
@@ -81,7 +81,7 @@ public @interface ServiceActivator {
* Only the handler is advised, not the downstream flow.
* @return the advice chain.
*/
String[] adviceChain() default { };
String[] adviceChain() default {};
/**
* Specify the maximum amount of time in milliseconds to wait when sending a reply

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ServiceActivators {

View File

@@ -46,7 +46,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
* @author Artem Bilan
* @author Chris Bono
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(Splitters.class)
@@ -83,7 +83,7 @@ public @interface Splitter {
* Only the handler is advised, not the downstream flow.
* @return the advice chain.
*/
String[] adviceChain() default { };
String[] adviceChain() default {};
/**
* Specify the maximum amount of time in milliseconds to wait when sending a reply

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Splitters {

View File

@@ -34,7 +34,7 @@ import org.springframework.messaging.handler.annotation.ValueConstants;
* @author Artem Bilan
* @author Chris Bono
*/
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(Transformers.class)
@@ -59,7 +59,7 @@ public @interface Transformer {
* Only the handler is advised, not the downstream flow.
* @return the advice chain.
*/
String[] adviceChain() default { };
String[] adviceChain() default {};
/**
* Specify the maximum amount of time in milliseconds to wait when sending a reply

View File

@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* @since 6.0
*/
@Documented
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Transformers {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2019 the original author or authors.
* Copyright 2017-2022 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.
@@ -41,7 +41,7 @@ import org.springframework.core.annotation.AliasFor;
* @author Gary Russell
* @since 5.0
*/
@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2021 the original author or authors.
* Copyright 2015-2022 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.
@@ -22,11 +22,6 @@ import java.util.concurrent.locks.LockSupport;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageDeliveryException;
import org.springframework.util.Assert;
import reactor.core.Disposable;
import reactor.core.Disposables;
import reactor.core.publisher.Flux;
@@ -35,6 +30,10 @@ import reactor.core.publisher.Sinks;
import reactor.core.scheduler.Scheduler;
import reactor.core.scheduler.Schedulers;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageDeliveryException;
import org.springframework.util.Assert;
/**
* The {@link AbstractMessageChannel} implementation for the
* Reactive Streams {@link Publisher} based on the Project Reactor {@link Flux}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -132,19 +132,23 @@ public class NullChannel implements PollableChannel,
((Publisher<?>) payload).subscribe(
new Subscriber<Object>() {
@Override public void onSubscribe(Subscription subscription) {
@Override
public void onSubscribe(Subscription subscription) {
subscription.request(Long.MAX_VALUE);
}
@Override public void onNext(Object value) {
@Override
public void onNext(Object value) {
}
@Override public void onError(Throwable ex) {
@Override
public void onError(Throwable ex) {
LOG.warn(ex, "An error happened in a reactive stream processing");
}
@Override public void onComplete() {
@Override
public void onComplete() {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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 QueueChannel extends AbstractPollableChannel implements QueueChanne
super.registerMetricsCaptor(metricsCaptor);
this.sizeGauge =
metricsCaptor.gaugeBuilder("spring.integration.channel.queue.size", this,
(channel) -> getQueueSize())
(channel) -> getQueueSize())
.tag("name", getComponentName() == null ? "unknown" : getComponentName())
.tag("type", "channel")
.description("The size of the queue channel")
@@ -98,7 +98,7 @@ public class QueueChannel extends AbstractPollableChannel implements QueueChanne
this.remainingCapacityGauge =
metricsCaptor.gaugeBuilder("spring.integration.channel.queue.remaining.capacity", this,
(channel) -> getRemainingCapacity())
(channel) -> getRemainingCapacity())
.tag("name", getComponentName() == null ? "unknown" : getComponentName())
.tag("type", "channel")
.description("The remaining capacity of the queue channel")

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -32,7 +32,7 @@ public class GlobalChannelInterceptorWrapper implements Ordered {
private final ChannelInterceptor channelInterceptor;
private volatile String[] patterns = { "*" }; // default
private volatile String[] patterns = {"*"}; // default
private volatile int order = 0;

View File

@@ -16,6 +16,10 @@
package org.springframework.integration.channel.interceptor;
import io.micrometer.common.lang.Nullable;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationRegistry;
import org.springframework.aop.support.AopUtils;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.messaging.Message;
@@ -23,10 +27,6 @@ import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.util.Assert;
import io.micrometer.common.lang.Nullable;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationRegistry;
/**
* The {@link org.springframework.messaging.support.ExecutorChannelInterceptor}
* implementation responsible for an {@link Observation} propagation from one message

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 the original author or authors.
* Copyright 2015-2022 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.
@@ -16,6 +16,8 @@
package org.springframework.integration.channel.interceptor;
import io.micrometer.common.lang.Nullable;
import org.springframework.integration.support.MessageDecorator;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
@@ -23,8 +25,6 @@ import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.support.ExecutorChannelInterceptor;
import io.micrometer.common.lang.Nullable;
/**
* The {@link ExecutorChannelInterceptor} implementation responsible for
* the {@link Thread} (any?) state propagation from one message flow's thread to another

View File

@@ -21,14 +21,14 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.springframework.integration.codec.Codec;
import org.springframework.util.Assert;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.esotericsoftware.kryo.util.Pool;
import org.springframework.integration.codec.Codec;
import org.springframework.util.Assert;
/**
* Base class for {@link Codec}s using {@link Kryo}.
* Manages pooled {@link Kryo} instances.

View File

@@ -16,11 +16,10 @@
package org.springframework.integration.codec.kryo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Registration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Base class for {@link KryoRegistrar} implementations.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 the original author or authors.
* Copyright 2015-2022 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.
@@ -19,12 +19,12 @@ package org.springframework.integration.codec.kryo;
import java.util.ArrayList;
import java.util.List;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Registration;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
/**
* A {@link KryoRegistrar} that delegates and validates registrations across all components.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 the original author or authors.
* Copyright 2015-2022 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.
@@ -20,11 +20,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.esotericsoftware.kryo.Registration;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import com.esotericsoftware.kryo.Registration;
/**
* A {@link KryoRegistrar} used to validateRegistration a
* list of Java classes. This assigns a sequential registration ID starting with an initial value (50 by default), but

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 the original author or authors.
* Copyright 2015-2022 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.
@@ -21,10 +21,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.util.CollectionUtils;
import com.esotericsoftware.kryo.Registration;
import org.springframework.util.CollectionUtils;
/**
* A {@link KryoRegistrar} implementation backed by a Map
* used to explicitly set the registration ID for each class.

View File

@@ -19,13 +19,13 @@ package org.springframework.integration.codec.kryo;
import java.util.HashMap;
import java.util.Map;
import org.springframework.messaging.MessageHeaders;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import org.springframework.messaging.MessageHeaders;
/**
* Kryo Serializer for {@link MessageHeaders}.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 the original author or authors.
* Copyright 2015-2022 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.
@@ -21,6 +21,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Registration;
import org.springframework.integration.message.AdviceMessage;
import org.springframework.integration.support.MutableMessage;
import org.springframework.integration.support.MutableMessageHeaders;
@@ -28,9 +31,6 @@ import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.support.ErrorMessage;
import org.springframework.messaging.support.GenericMessage;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Registration;
/**
* Registers common MessageHeader types and Serializers.
*

Some files were not shown because too many files have changed in this diff Show More