checkstyle WhiteAround
WhiteAroundCheck script
This commit is contained in:
@@ -50,7 +50,7 @@ public class EventuallyMatcher<U> extends DiagnosingMatcher<U> {
|
||||
}
|
||||
|
||||
public static <U> Matcher<U> eventually(int nbAttempts, int pause, Matcher<U> delegate) {
|
||||
return new EventuallyMatcher<U>(delegate,nbAttempts,pause);
|
||||
return new EventuallyMatcher<U>(delegate, nbAttempts, pause);
|
||||
}
|
||||
|
||||
public static <U> Matcher<U> eventually(Matcher<U> delegate) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -55,7 +55,7 @@ public abstract class AbstractRequestResponseScenarioTests {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Before
|
||||
public void setUp(){
|
||||
public void setUp() {
|
||||
scenarios = defineRequestResponseScenarios();
|
||||
}
|
||||
|
||||
@@ -65,30 +65,30 @@ public abstract class AbstractRequestResponseScenarioTests {
|
||||
* This can handle subscribable or pollable output channels.
|
||||
*/
|
||||
@Test
|
||||
public void testRequestResponseScenarios(){
|
||||
public void testRequestResponseScenarios() {
|
||||
int i = 1;
|
||||
for (RequestResponseScenario scenario: scenarios){
|
||||
String name = scenario.getName() == null? "scenario-"+(i++) : scenario.getName();
|
||||
for (RequestResponseScenario scenario: scenarios) {
|
||||
String name = scenario.getName() == null ? "scenario-" + (i++) : scenario.getName();
|
||||
scenario.init();
|
||||
MessageChannel inputChannel = applicationContext.getBean(scenario.getInputChannelName(),MessageChannel.class);
|
||||
MessageChannel outputChannel = applicationContext.getBean(scenario.getOutputChannelName(),MessageChannel.class);
|
||||
if (outputChannel instanceof SubscribableChannel){
|
||||
MessageChannel inputChannel = applicationContext.getBean(scenario.getInputChannelName(), MessageChannel.class);
|
||||
MessageChannel outputChannel = applicationContext.getBean(scenario.getOutputChannelName(), MessageChannel.class);
|
||||
if (outputChannel instanceof SubscribableChannel) {
|
||||
((SubscribableChannel) outputChannel).subscribe(scenario.getResponseValidator());
|
||||
}
|
||||
|
||||
assertTrue(name + ": message not sent on " + scenario.getInputChannelName()
|
||||
, inputChannel.send(scenario.getMessage()));
|
||||
|
||||
if (outputChannel instanceof PollableChannel){
|
||||
if (outputChannel instanceof PollableChannel) {
|
||||
Message<?> response = ((PollableChannel) outputChannel).receive(10000);
|
||||
assertNotNull(name + ": receive timeout on " + scenario.getOutputChannelName(),response);
|
||||
assertNotNull(name + ": receive timeout on " + scenario.getOutputChannelName(), response);
|
||||
scenario.getResponseValidator().handleMessage(response);
|
||||
}
|
||||
|
||||
assertNotNull("message was not handled on " + outputChannel + " for scenario '" + name + "'.",
|
||||
scenario.getResponseValidator().getLastMessage());
|
||||
|
||||
if (outputChannel instanceof SubscribableChannel){
|
||||
if (outputChannel instanceof SubscribableChannel) {
|
||||
((SubscribableChannel) outputChannel).unsubscribe(scenario.getResponseValidator());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract class AbstractResponseValidator<T> implements MessageHandler {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
this.lastMessage = message;
|
||||
validateResponse((T) (extractPayload()? message.getPayload(): message ));
|
||||
validateResponse((T) (extractPayload() ? message.getPayload() : message ));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LongRunningIntegrationTest extends TestWatcher {
|
||||
private boolean shouldRun = false;
|
||||
|
||||
public LongRunningIntegrationTest() {
|
||||
for(String value: new String[]{System.getenv(RUN_LONG_PROP), System.getProperty(RUN_LONG_PROP)}) {
|
||||
for (String value: new String[]{System.getenv(RUN_LONG_PROP), System.getProperty(RUN_LONG_PROP)}) {
|
||||
if ("true".equalsIgnoreCase(value)) {
|
||||
this.shouldRun = true;
|
||||
break;
|
||||
|
||||
@@ -27,12 +27,12 @@ import org.springframework.messaging.Message;
|
||||
public abstract class MessageValidator extends AbstractResponseValidator<Message<?>> {
|
||||
|
||||
@Override
|
||||
protected final boolean extractPayload(){
|
||||
protected final boolean extractPayload() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void validateResponse(Message<?> response){
|
||||
protected final void validateResponse(Message<?> response) {
|
||||
validateMessage(response);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.springframework.integration.test.support;
|
||||
*
|
||||
*/
|
||||
public abstract class PayloadValidator<T> extends AbstractResponseValidator<T> {
|
||||
protected final boolean extractPayload(){
|
||||
protected final boolean extractPayload() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ public class RequestResponseScenario {
|
||||
private AbstractResponseValidator<?> responseValidator;
|
||||
private String name;
|
||||
|
||||
protected Message<? extends Object> getMessage(){
|
||||
if (message == null){
|
||||
protected Message<? extends Object> getMessage() {
|
||||
if (message == null) {
|
||||
return new GenericMessage<Object>(this.payload);
|
||||
}
|
||||
else {
|
||||
@@ -48,7 +48,7 @@ else {
|
||||
* @param inputChannelName the input channel name
|
||||
* @param outputChannelName the output channel name
|
||||
*/
|
||||
public RequestResponseScenario(String inputChannelName, String outputChannelName){
|
||||
public RequestResponseScenario(String inputChannelName, String outputChannelName) {
|
||||
this.inputChannelName = inputChannelName;
|
||||
this.outputChannelName = outputChannelName;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ else {
|
||||
* @return the response validator
|
||||
* @see AbstractResponseValidator
|
||||
*/
|
||||
public AbstractResponseValidator<?> getResponseValidator(){
|
||||
public AbstractResponseValidator<?> getResponseValidator() {
|
||||
return responseValidator;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ else {
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
Assert.state(message == null || payload == null,"cannot set both message and payload");
|
||||
Assert.state(message == null || payload == null, "cannot set both message and payload");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public abstract class TestUtils {
|
||||
throw new FatalBeanException("failed to register bean with test context", e);
|
||||
}
|
||||
}
|
||||
configurableListableBeanFactory.registerSingleton(beanName, bean);//NOSONAR false positive
|
||||
configurableListableBeanFactory.registerSingleton(beanName, bean); //NOSONAR false positive
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ public abstract class TestUtils {
|
||||
try {
|
||||
sent = errorChannel.send(new ErrorMessage(t), 10000);
|
||||
}
|
||||
catch (Throwable errorDeliveryError) {//NOSONAR
|
||||
catch (Throwable errorDeliveryError) { //NOSONAR
|
||||
// message will be logged only
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Error message was not delivered.", errorDeliveryError);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PayloadMatcherTests {
|
||||
try {
|
||||
assertThat(message, hasPayload("woot"));
|
||||
}
|
||||
catch(AssertionError ae){
|
||||
catch (AssertionError ae) {
|
||||
assertTrue(ae.getMessage().contains("Expected: a Message with payload: "));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user