Skip to content

Commit

Permalink
Experimental: Support Gradle --parallel
Browse files Browse the repository at this point in the history
This should be treated as experimental but with these changes it seems to build ok.

BUILD SUCCESSFUL

Total time: 5 mins 15.533 secs

It turns out that our sporadic Redis problems were fixed in a later version of Jedis.

The problem was that the `connection.subscribe()` exited immediately. When I started adding debug
logic, the problem went away (because I was using a newer versio of Jedis).

spring-data-redis 1.5.2 is updated to work with the 2.7.3 version of Jedis.

Polishing
  • Loading branch information
garyrussell authored and artembilan committed Jul 23, 2015
1 parent b57018b commit 75a7b63
Show file tree
Hide file tree
Showing 19 changed files with 219 additions and 75 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ services:
- mongodb
- rabbitmq
- redis-server
install:
- sudo rabbitmq-plugins enable rabbitmq_mqtt
- sudo service rabbitmq-server restart
env:
- TERM=dumb SI_FATAL_WHEN_NO_BEANFACTORY=true GRADLE_OPTS='-XX:MaxPermSize=512M -Xmx1024M'
#script:
# - ./gradlew build --parallel
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ subprojects { subproject ->
jackson2Version = '2.5.1'
javaxActivationVersion = '1.1.1'
javaxMailVersion = '1.5.2'
jedisVersion = '2.6.2'
jedisVersion = '2.7.3'
jmsApiVersion = '1.1-rev-1'
jpaApiVersion = '2.0.0'
jrubyVersion = '1.7.19'
Expand Down Expand Up @@ -131,7 +131,7 @@ subprojects { subproject ->
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '1.5.0.M1'
// springCloudClusterVersion = '1.0.0.BUILD-SNAPSHOT'
springDataMongoVersion = '1.7.0.RELEASE'
springDataRedisVersion = '1.5.0.RELEASE'
springDataRedisVersion = '1.5.2.BUILD-SNAPSHOT'
springGemfireVersion = '1.6.0.RELEASE'
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '4.0.1.RELEASE'
springSocialTwitterVersion = '1.1.0.RELEASE'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
Expand All @@ -38,10 +37,10 @@
import org.springframework.integration.redis.rules.RedisAvailable;
import org.springframework.integration.redis.rules.RedisAvailableTests;
import org.springframework.integration.support.converter.SimpleMessageConverter;
import org.springframework.integration.support.utils.IntegrationUtils;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

Expand All @@ -53,6 +52,7 @@
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RedisInboundChannelAdapterParserTests extends RedisAvailableTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

package org.springframework.integration.redis.config;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -33,16 +35,15 @@
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice;
import org.springframework.integration.redis.inbound.RedisInboundChannelAdapter;
import org.springframework.integration.redis.outbound.RedisPublishingMessageHandler;
import org.springframework.integration.redis.rules.RedisAvailable;
import org.springframework.integration.redis.rules.RedisAvailableTests;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.support.converter.SimpleMessageConverter;
import org.springframework.integration.support.utils.IntegrationUtils;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

Expand All @@ -55,6 +56,7 @@
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RedisOutboundChannelAdapterParserTests extends RedisAvailableTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2015 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.
Expand Down Expand Up @@ -37,15 +37,18 @@
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.util.ErrorHandlingTaskExecutor;
import org.springframework.messaging.MessageChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
* @author Artem Bilan
* @author Gary Russell
* @since 3.0
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RedisQueueInboundChannelAdapterParserTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.springframework.integration.redis.inbound.RedisQueueInboundGateway;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

Expand All @@ -42,6 +42,7 @@
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RedisQueueInboundGatewayParserTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2015 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.
Expand All @@ -16,7 +16,11 @@

package org.springframework.integration.redis.config;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import org.hamcrest.Matchers;
import org.junit.Test;
Expand All @@ -33,15 +37,18 @@
import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice;
import org.springframework.integration.redis.outbound.RedisQueueOutboundChannelAdapter;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
* @author Artem Bilan
* @author Gary Russell
* @since 3.0
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RedisQueueOutboundChannelAdapterParserTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2015 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.
Expand All @@ -26,28 +26,25 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.redis.outbound.RedisQueueOutboundGateway;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
* @author David Liu
* @author Gary Russell
* since 4.1
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RedisQueueOutboundGatewayParserTests {

@Autowired
private RedisConnectionFactory connectionFactory;

@Autowired
@Qualifier("outboundGateway")
private PollingConsumer consumer;
Expand All @@ -67,9 +64,6 @@ public class RedisQueueOutboundGatewayParserTests {
@Autowired
private RedisSerializer<?> serializer;

@Autowired
private ApplicationContext context;

@Test
public void testDefaultConfig() throws Exception {
assertFalse(TestUtils.getPropertyValue(this.defaultGateway, "extractPayload", Boolean.class));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 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.
Expand Down Expand Up @@ -33,6 +33,7 @@
import org.springframework.expression.spel.standard.SpelExpression;
import org.springframework.integration.redis.inbound.RedisStoreMessageSource;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

Expand All @@ -43,6 +44,7 @@
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RedisStoreInboundChannelAdapterParserTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2014 the original author or authors
* Copyright 2007-2015 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.
Expand All @@ -16,7 +16,11 @@

package org.springframework.integration.redis.config;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import org.hamcrest.Matchers;
import org.junit.Test;
Expand All @@ -34,6 +38,7 @@
import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice;
import org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
Expand All @@ -44,6 +49,7 @@
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RedisStoreOutboundChannelAdapterParserTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void testInt3442ProperlyStop() throws Exception {
endpoint.stop();

executorService.shutdown();
assertTrue(executorService.awaitTermination(1, TimeUnit.SECONDS));
assertTrue(executorService.awaitTermination(10, TimeUnit.SECONDS));

Mockito.verify(boundListOperations).rightPush(Mockito.any(byte[].class));
}
Expand Down Expand Up @@ -286,9 +286,9 @@ public void publishEvent(ApplicationEvent event) {

@Override
public void publishEvent(Object event) {

}

});
endpoint.setOutputChannel(channel);
endpoint.setReceiveTimeout(100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ private void awaitContainerSubscribedNoWait(RedisMessageListenerContainer contai
RedisConnection connection = null;

int n = 0;
while (n++ < 100 &&
while (n++ < 300 &&
(connection =
TestUtils.getPropertyValue(container, "subscriptionTask.connection", RedisConnection .class)) == null) {
Thread.sleep(100);
}
assertNotNull("RedisMessageListenerContainer Failed to Connect", connection);

n = 0;
while (n++ < 100 && !connection.isSubscribed()) {
while (n++ < 300 && !connection.isSubscribed()) {
Thread.sleep(100);
}
assertTrue("RedisMessageListenerContainer Failed to Subscribe", n < 100);
assertTrue("RedisMessageListenerContainer Failed to Subscribe", n < 300);
}

protected void awaitContainerSubscribedWithPatterns(RedisMessageListenerContainer container) throws Exception {
Expand All @@ -84,10 +84,10 @@ protected void awaitContainerSubscribedWithPatterns(RedisMessageListenerContaine
RedisConnection.class);

int n = 0;
while (n++ < 100 && connection.getSubscription().getPatterns().size() == 0) {
while (n++ < 300 && connection.getSubscription().getPatterns().size() == 0) {
Thread.sleep(100);
}
assertTrue("RedisMessageListenerContainer Failed to Subscribe with patterns", n < 100);
assertTrue("RedisMessageListenerContainer Failed to Subscribe with patterns", n < 300);
// wait another second because of race condition
Thread.sleep(1000);
}
Expand All @@ -98,7 +98,7 @@ protected void awaitFullySubscribed(RedisMessageListenerContainer container, Red
drain(channel);
long now = System.currentTimeMillis();
Message<?> received = null;
while (received == null && System.currentTimeMillis() - now < 10000) {
while (received == null && System.currentTimeMillis() - now < 30000) {
redisTemplate.convertAndSend(redisChannelName, message);
received = channel.receive(1000);
}
Expand Down
3 changes: 2 additions & 1 deletion spring-integration-redis/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ log4j.rootCategory=WARN, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
log4j.appender.stdout.layout.ConversionPattern=%d %5p %t [%c] - <%m>%n

log4j.category.org.springframework.data.redis=WARN
log4j.category.org.springframework.integration=WARN
log4j.category.org.springframework.integration.redis=INFO
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
requires-reply="false"
host="localhost">
<rmi:request-handler-advice-chain>
<beans:bean class="org.springframework.integration.rmi.config.RmiOutboundGatewayParserTests$FooAdvice" />
<beans:ref bean="advice" />
</rmi:request-handler-advice-chain>
</rmi:outbound-gateway>

<beans:bean id="advice"
class="org.springframework.integration.rmi.config.RmiOutboundGatewayParserTests$FooAdvice" />

<chain input-channel="rmiOutboundGatewayInsideChain">
<rmi:outbound-gateway remote-channel="testChannel" host="localhost" requires-reply="false"/>
</chain>
Expand Down
Loading

0 comments on commit 75a7b63

Please sign in to comment.