checkstyle Misc Rules

checkstyle Nesting

checkstyle GenericWhitespace

checkstyle MethodParamPad

checkstyle NoWhiteSpace

checkstyle ParenPad Script

checkstyle ParenPad
This commit is contained in:
Gary Russell
2016-04-05 14:58:29 -04:00
committed by Artem Bilan
parent 05cc7be644
commit 57f96bb759
87 changed files with 737 additions and 628 deletions

View File

@@ -234,17 +234,7 @@ public class RedisQueueInboundGateway extends MessagingGatewaySupport implements
Message<?> replyMessage = this.sendAndReceiveMessage(requestMessage);
if (replyMessage != null) {
if (this.extractPayload) {
if (!(replyMessage.getPayload() instanceof byte[])) {
if (replyMessage.getPayload() instanceof String && !this.serializerExplicitlySet) {
value = stringSerializer.serialize((String) replyMessage.getPayload());
}
else {
value = ((RedisSerializer<Object>) this.serializer).serialize(replyMessage.getPayload());
}
}
else {
value = (byte[]) replyMessage.getPayload();
}
value = extractReplyPayload(replyMessage);
}
else {
if (this.serializer != null) {
@@ -257,6 +247,23 @@ public class RedisQueueInboundGateway extends MessagingGatewaySupport implements
}
}
@SuppressWarnings("unchecked")
private byte[] extractReplyPayload(Message<?> replyMessage) {
byte[] value;
if (!(replyMessage.getPayload() instanceof byte[])) {
if (replyMessage.getPayload() instanceof String && !this.serializerExplicitlySet) {
value = stringSerializer.serialize((String) replyMessage.getPayload());
}
else {
value = ((RedisSerializer<Object>) this.serializer).serialize(replyMessage.getPayload());
}
}
else {
value = (byte[]) replyMessage.getPayload();
}
return value;
}
@Override
protected void doStart() {
super.doStart();

View File

@@ -97,7 +97,7 @@ public class RedisInboundChannelAdapterParserTests extends RedisAvailableTests {
for (int i = 0; i < 3; i++) {
Message<?> receive = receiveChannel.receive(2000);
assertNotNull(receive);
assertThat(receive.getPayload(), Matchers.<Object> isOneOf("Hello Redis from foo", "Hello Redis from bar"));
assertThat(receive.getPayload(), Matchers.<Object>isOneOf("Hello Redis from foo", "Hello Redis from bar"));
}
}

View File

@@ -47,7 +47,7 @@ public class RedisInboundChannelAdapterTests extends RedisAvailableTests {
@Test
@RedisAvailable
public void testRedisInboundChannelAdapter() throws Exception {
for (int iteration = 0; iteration < 10; iteration ++) {
for (int iteration = 0; iteration < 10; iteration++) {
testRedisInboundChannelAdapterGuts(iteration);
}
}

View File

@@ -127,7 +127,7 @@ public class RedisOutboundGatewayTests extends RedisAvailableTests {
@Test
@RedisAvailable
public void testGetCommand() {
this.setDelCommandChannel.send(MessageBuilder.withPayload(new String[]{"foo", "bar"})
this.setDelCommandChannel.send(MessageBuilder.withPayload(new String[] { "foo", "bar" })
.setHeader(RedisHeaders.COMMAND, "SET").build());
Message<?> receive = this.replyChannel.receive(1000);
assertNotNull(receive);
@@ -161,7 +161,7 @@ public class RedisOutboundGatewayTests extends RedisAvailableTests {
byte[] value2 = "bar2".getBytes();
connection.set("foo1".getBytes(), value1);
connection.set("foo2".getBytes(), value2);
this.mgetCommandChannel.send(MessageBuilder.withPayload(new String [] {"foo1", "foo2"}).build());
this.mgetCommandChannel.send(MessageBuilder.withPayload(new String[] { "foo1", "foo2" }).build());
Message<?> receive = this.replyChannel.receive(1000);
assertNotNull(receive);
assertThat((List<byte[]>) receive.getPayload(), Matchers.contains(value1, value2));