Add code formatting guidelines

Add 'eclipse' folder containing Eclipse code
formatter configuration and instructions how to use
 it.

Update rule for join_wrapped_lines

 - Set to `false`

Resolves #930

Update README

Address review comments
This commit is contained in:
Ilayaperumal Gopinathan
2017-05-12 21:34:39 +05:30
committed by Marius Bogoevici
parent 9632546f03
commit bd002e4aaf
159 changed files with 1770 additions and 1283 deletions

View File

@@ -57,23 +57,23 @@ public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends
protected B testBinder;
/**
* Subclasses may override this default value to have tests wait longer for a message receive, for example if
* running
* in an environment that is known to be slow (e.g. travis).
* Subclasses may override this default value to have tests wait longer for a message
* receive, for example if running in an environment that is known to be slow (e.g.
* travis).
*/
protected double timeoutMultiplier = 1.0D;
/**
* Attempt to receive a message on the given channel,
* waiting up to 1s (times the {@link #timeoutMultiplier}).
* Attempt to receive a message on the given channel, waiting up to 1s (times the
* {@link #timeoutMultiplier}).
*/
protected Message<?> receive(PollableChannel channel) {
return receive(channel, 1);
}
/**
* Attempt to receive a message on the given channel,
* waiting up to 1s * additionalMultiplier * {@link #timeoutMultiplier}).
* Attempt to receive a message on the given channel, waiting up to 1s *
* additionalMultiplier * {@link #timeoutMultiplier}).
*
* Allows accomodating tests which are slower than normal (e.g. retry).
*/
@@ -170,7 +170,6 @@ public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends
moduleOutputChannel1.send(message1);
moduleOutputChannel2.send(message2);
Message<?>[] messages = new Message[2];
messages[0] = receive(moduleInputChannel);
messages[1] = receive(moduleInputChannel);
@@ -211,7 +210,6 @@ public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends
consumerBinding.unbind();
}
protected abstract B getBinder() throws Exception;
protected abstract CP createConsumerProperties();
@@ -224,15 +222,14 @@ public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends
return bindingProperties;
}
protected BindingProperties createProducerBindingProperties(PP producerProperties) {
BindingProperties bindingProperties = new BindingProperties();
bindingProperties.setProducer(producerProperties);
return bindingProperties;
}
protected DirectChannel createBindableChannel(String channelName, BindingProperties bindingProperties) throws
Exception {
protected DirectChannel createBindableChannel(String channelName, BindingProperties bindingProperties)
throws Exception {
BindingServiceProperties bindingServiceProperties = new BindingServiceProperties();
bindingServiceProperties.getBindings().put(channelName, bindingProperties);
ConfigurableApplicationContext applicationContext = new GenericApplicationContext();
@@ -259,7 +256,8 @@ public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends
}
/**
* If appropriate, let the binder middleware settle down a bit while binding/unbinding actually happens.
* If appropriate, let the binder middleware settle down a bit while binding/unbinding
* actually happens.
*/
protected void binderBindUnbindLatency() throws InterruptedException {
// default none

View File

@@ -28,24 +28,16 @@ import org.springframework.messaging.MessageChannel;
* @author Gary Russell
* @author Mark Fisher
*/
public abstract class AbstractTestBinder<C extends AbstractBinder<MessageChannel, CP, PP>, CP extends ConsumerProperties, PP extends ProducerProperties> implements Binder<MessageChannel, CP, PP> {
public abstract class AbstractTestBinder<C extends AbstractBinder<MessageChannel, CP, PP>, CP extends ConsumerProperties, PP extends ProducerProperties>
implements Binder<MessageChannel, CP, PP> {
protected Set<String> queues = new HashSet<String>();
private C binder;
public void setBinder(C binder) {
try {
binder.afterPropertiesSet();
}
catch (Exception e) {
throw new RuntimeException("Failed to initialize binder", e);
}
this.binder = binder;
}
@Override
public Binding<MessageChannel> bindConsumer(String name, String group, MessageChannel moduleInputChannel, CP properties) {
public Binding<MessageChannel> bindConsumer(String name, String group, MessageChannel moduleInputChannel,
CP properties) {
queues.add(name);
return binder.bindConsumer(name, group, moduleInputChannel, properties);
}
@@ -66,4 +58,14 @@ public abstract class AbstractTestBinder<C extends AbstractBinder<MessageChannel
return this.binder;
}
public void setBinder(C binder) {
try {
binder.afterPropertiesSet();
}
catch (Exception e) {
throw new RuntimeException("Failed to initialize binder", e);
}
this.binder = binder;
}
}

View File

@@ -25,7 +25,8 @@ import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;
/**
* An {@link EnvironmentPostProcessor} that sets some common configuration properties (log config etc.,) for binder tests.
* An {@link EnvironmentPostProcessor} that sets some common configuration properties (log
* config etc.,) for binder tests.
*
* @author Ilayaperumal Gopinathan
*/

View File

@@ -25,19 +25,18 @@ import org.springframework.integration.support.utils.IntegrationUtils;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
*
* @author Gary Russell
*/
public abstract class BinderTestUtils {
private static final MessageBuilderFactory mbf = new MutableMessageBuilderFactory();
public static final AbstractApplicationContext MOCK_AC = mock(AbstractApplicationContext.class);
public static final ConfigurableListableBeanFactory MOCK_BF = mock(ConfigurableListableBeanFactory.class);
private static final MessageBuilderFactory mbf = new MutableMessageBuilderFactory();
static {
when(MOCK_BF.getBean(IntegrationUtils.INTEGRATION_MESSAGE_BUILDER_FACTORY_BEAN_NAME,
MessageBuilderFactory.class)).thenReturn(mbf);

View File

@@ -44,8 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Mark Fisher
* @author Marius Bogoevici
*/
public abstract class PartitionCapableBinderTests<B extends AbstractTestBinder<? extends
AbstractBinder<MessageChannel, CP, PP>, CP, PP>, CP extends ConsumerProperties, PP extends ProducerProperties>
public abstract class PartitionCapableBinderTests<B extends AbstractTestBinder<? extends AbstractBinder<MessageChannel, CP, PP>, CP, PP>, CP extends ConsumerProperties, PP extends ProducerProperties>
extends AbstractBinderTests<B, CP, PP> {
protected static final SpelExpressionParser spelExpressionParser = new SpelExpressionParser();

View File

@@ -18,7 +18,6 @@ package org.springframework.cloud.stream.binder;
import org.springframework.messaging.Message;
/**
* @author Gary Russell
*/

View File

@@ -17,9 +17,8 @@
package org.springframework.cloud.stream.binder;
/**
* Represents an out-of-band connection to the underlying middleware,
* so that tests can check that some messages actually do (or do not)
* transit through it.
* Represents an out-of-band connection to the underlying middleware, so that tests can
* check that some messages actually do (or do not) transit through it.
*
* @author Eric Bottard
*/

View File

@@ -43,7 +43,6 @@ import org.springframework.util.MimeTypeUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Gary Russell
* @author David Turanski
@@ -132,7 +131,6 @@ public class MessageChannelBinderSupportTests {
assertThat(reconstructed.get(MessageHeaders.CONTENT_TYPE)).isEqualTo(MimeTypeUtils.APPLICATION_JSON_VALUE);
}
@Test
public void testContentTypePreservedForNonSCStApp() {
Message<String> inbound = MessageBuilder.withPayload("{\"foo\":\"bar\"}")
@@ -253,19 +251,6 @@ public class MessageChannelBinderSupportTests {
}
public class TestMessageChannelBinder extends AbstractBinder<MessageChannel, ConsumerProperties, ProducerProperties> {
@Override
protected Binding<MessageChannel> doBindConsumer(String name, String group, MessageChannel channel, ConsumerProperties properties) {
return null;
}
@Override
public Binding<MessageChannel> doBindProducer(String name, MessageChannel channel, ProducerProperties properties) {
return null;
}
}
private static class TupleRegistrar implements KryoRegistrar {
private final TupleKryoRegistrar delegate = new TupleKryoRegistrar();
@@ -280,4 +265,20 @@ public class MessageChannelBinderSupportTests {
}
}
public class TestMessageChannelBinder
extends AbstractBinder<MessageChannel, ConsumerProperties, ProducerProperties> {
@Override
protected Binding<MessageChannel> doBindConsumer(String name, String group, MessageChannel channel,
ConsumerProperties properties) {
return null;
}
@Override
public Binding<MessageChannel> doBindProducer(String name, MessageChannel channel,
ProducerProperties properties) {
return null;
}
}
}