diff --git a/build.gradle b/build.gradle index 0c9d6d1281..075acb528a 100644 --- a/build.gradle +++ b/build.gradle @@ -69,6 +69,7 @@ subprojects { subproject -> apply from: "${rootDir}/src/checkstyle/fixModifiers.gradle" apply from: "${rootDir}/src/checkstyle/fixThis.gradle" apply from: "${rootDir}/src/checkstyle/fixRightCurly.gradle" + apply from: "${rootDir}/src/checkstyle/fixWhiteAround.gradle" if (project.hasProperty('platformVersion')) { apply plugin: 'spring-io' diff --git a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/StubRabbitConnectionFactory.java b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/StubRabbitConnectionFactory.java index db3e665fbd..0f66088280 100644 --- a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/StubRabbitConnectionFactory.java +++ b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/StubRabbitConnectionFactory.java @@ -331,7 +331,8 @@ public class StubRabbitConnectionFactory implements ConnectionFactory { @Override public String getQueue() { return queue; - }}; + } + }; } @Override diff --git a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/channel/ChannelTests.java b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/channel/ChannelTests.java index d00ce94db2..d4a496de78 100644 --- a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/channel/ChannelTests.java +++ b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/channel/ChannelTests.java @@ -65,7 +65,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class ChannelTests extends LogAdjustingTestSupport { @ClassRule diff --git a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpInboundGatewayParserTests.java b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpInboundGatewayParserTests.java index 6d7f9dfe49..4f4bd8a586 100644 --- a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpInboundGatewayParserTests.java +++ b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpInboundGatewayParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -102,7 +102,7 @@ public class AmqpInboundGatewayParserTests { @SuppressWarnings("rawtypes") @Test - public void verifyUsageWithHeaderMapper() throws Exception{ + public void verifyUsageWithHeaderMapper() throws Exception { DirectChannel requestChannel = context.getBean("requestChannel", DirectChannel.class); requestChannel.subscribe(new MessageHandler() { @Override @@ -129,8 +129,8 @@ public class AmqpInboundGatewayParserTests { MessageProperties properties = amqpReplyMessage.getMessageProperties(); assertEquals("bar", properties.getHeaders().get("bar")); return null; - }}) - .when(amqpTemplate).send(Mockito.any(String.class), Mockito.any(String.class), + } + }).when(amqpTemplate).send(Mockito.any(String.class), Mockito.any(String.class), Mockito.any(Message.class), Mockito.any(CorrelationData.class)); ReflectionUtils.setField(amqpTemplateField, gateway, amqpTemplate); @@ -166,6 +166,6 @@ public class AmqpInboundGatewayParserTests { } } - private static class TestConverter extends SimpleMessageConverter {} + private static class TestConverter extends SimpleMessageConverter { } } diff --git a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpointTests.java b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpointTests.java index b71189431d..aec0ab5919 100644 --- a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpointTests.java +++ b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpointTests.java @@ -51,7 +51,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class AmqpOutboundEndpointTests { @Rule diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ExpressionEvaluatingCorrelationStrategy.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ExpressionEvaluatingCorrelationStrategy.java index 7e0a6bd95f..52989b88bd 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ExpressionEvaluatingCorrelationStrategy.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ExpressionEvaluatingCorrelationStrategy.java @@ -56,7 +56,7 @@ public class ExpressionEvaluatingCorrelationStrategy implements CorrelationStrat } public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - if (beanFactory != null){ + if (beanFactory != null) { this.processor.setBeanFactory(beanFactory); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ResequencingMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ResequencingMessageHandler.java index 1ddf8f2dfc..028acef6e4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ResequencingMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ResequencingMessageHandler.java @@ -77,11 +77,11 @@ public class ResequencingMessageHandler extends AbstractCorrelatingMessageHandle int size = messageGroup.getMessages().size(); int sequenceSize = 0; Message message = messageGroup.getOne(); - if (message != null){ + if (message != null) { sequenceSize = new IntegrationMessageHeaderAccessor(message).getSequenceSize(); } // If there is no sequence then it must be incomplete or unbounded - if (sequenceSize > 0 && sequenceSize == size){ + if (sequenceSize > 0 && sequenceSize == size) { remove(messageGroup); } else { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/SequenceNumberComparator.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/SequenceNumberComparator.java index 1a93d3fa76..ffec9f0469 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/SequenceNumberComparator.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/SequenceNumberComparator.java @@ -38,7 +38,7 @@ public class SequenceNumberComparator implements Comparator> { public int compare(Message o1, Message o2) { Integer sequenceNumber1 = new IntegrationMessageHeaderAccessor(o1).getSequenceNumber(); Integer sequenceNumber2 = new IntegrationMessageHeaderAccessor(o2).getSequenceNumber(); - if (sequenceNumber1 == sequenceNumber2) {//NOSONAR - early exit optimization + if (sequenceNumber1 == sequenceNumber2) { //NOSONAR - early exit optimization return 0; } if (sequenceNumber1 == null) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/SequenceSizeReleaseStrategy.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/SequenceSizeReleaseStrategy.java index d82fa84bab..687d134501 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/SequenceSizeReleaseStrategy.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/SequenceSizeReleaseStrategy.java @@ -88,13 +88,13 @@ public class SequenceSizeReleaseStrategy implements ReleaseStrategy { else { int size = messages.size(); - if (size == 0){ + if (size == 0) { canRelease = true; } else { int sequenceSize = new IntegrationMessageHeaderAccessor(messageGroup.getOne()).getSequenceSize(); // If there is no sequence then it must be incomplete.... - if (sequenceSize == size){ + if (sequenceSize == size) { canRelease = true; } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java b/spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java index 53ae5e61f2..75c719a037 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -142,7 +142,7 @@ public class MessagePublishingInterceptor implements MethodInterceptor, BeanFact context.setVariable(PublisherMetadataSource.RETURN_VALUE_VARIABLE_NAME, returnValue); return returnValue; } - catch (Throwable t) {//NOSONAR - rethrown below + catch (Throwable t) { //NOSONAR - rethrown below context.setVariable(PublisherMetadataSource.EXCEPTION_VARIABLE_NAME, t); throw t; } @@ -182,7 +182,7 @@ public class MessagePublishingInterceptor implements MethodInterceptor, BeanFact } else { if (this.defaultChannelName != null) { - synchronized(this) { + synchronized (this) { if (this.defaultChannelName != null && this.messagingTemplate.getDefaultDestination() == null) { Assert.state(this.channelResolver != null, "ChannelResolver is required to resolve channel names."); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java index 6e342da4ff..c0f768afa6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -84,7 +84,7 @@ public class PublisherAnnotationBeanPostProcessor extends ProxyConfig @SuppressWarnings("deprecation") @Override - public void afterPropertiesSet(){ + public void afterPropertiesSet() { this.advisor = new PublisherAnnotationAdvisor(); this.advisor.setBeanFactory(this.beanFactory); this.advisor.setDefaultChannelName(this.defaultChannelName); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractExecutorChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractExecutorChannel.java index ba726b6245..6765dc17c8 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractExecutorChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractExecutorChannel.java @@ -159,7 +159,7 @@ public abstract class AbstractExecutorChannel extends AbstractSubscribableChanne String description = "Failed to handle " + message + " to " + this + " in " + messageHandler; throw new MessageDeliveryException(message, description, ex); } - catch (Error ex) {//NOSONAR - ok, we re-throw below + catch (Error ex) { //NOSONAR - ok, we re-throw below if (!CollectionUtils.isEmpty(interceptorStack)) { String description = "Failed to handle " + message + " to " + this + " in " + messageHandler; triggerAfterMessageHandled(message, new MessageDeliveryException(message, description, ex), @@ -199,7 +199,7 @@ public abstract class AbstractExecutorChannel extends AbstractSubscribableChanne interceptor.afterMessageHandled(message, AbstractExecutorChannel.this, this.delegate.getMessageHandler(), ex); } - catch (Throwable ex2) {//NOSONAR + catch (Throwable ex2) { //NOSONAR logger.error("Exception from afterMessageHandled in " + interceptor, ex2); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessagePublishingErrorHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessagePublishingErrorHandler.java index 2a522528bb..6b9f29adde 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessagePublishingErrorHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessagePublishingErrorHandler.java @@ -88,7 +88,7 @@ public class MessagePublishingErrorHandler implements ErrorHandler, BeanFactoryA sent = errorChannel.send(new ErrorMessage(t)); } } - catch (Throwable errorDeliveryError) {//NOSONAR + catch (Throwable errorDeliveryError) { //NOSONAR // message will be logged only if (this.logger.isWarnEnabled()) { this.logger.warn("Error message was not delivered.", errorDeliveryError); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/NullChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/NullChannel.java index e4f69b846c..2414cc76ed 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/NullChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/NullChannel.java @@ -75,7 +75,7 @@ public class NullChannel implements PollableChannel, MessageChannelMetrics, @Override public String getComponentName() { - return StringUtils.hasText(this.beanName) ? this.beanName: "nullChannel"; + return StringUtils.hasText(this.beanName) ? this.beanName : "nullChannel"; } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java index 6b0594035a..f664e01440 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java @@ -97,7 +97,7 @@ public class PriorityChannel extends QueueChannel { protected Message doReceive(long timeout) { Message message = super.doReceive(timeout); if (message != null) { - message = ((MessageWrapper)message).getRootMessage(); + message = ((MessageWrapper) message).getRootMessage(); this.upperBound.release(); } return message; @@ -107,14 +107,14 @@ public class PriorityChannel extends QueueChannel { private final Comparator> targetComparator; - private SequenceFallbackComparator(Comparator> targetComparator){ + private SequenceFallbackComparator(Comparator> targetComparator) { this.targetComparator = targetComparator; } @Override public int compare(Message message1, Message message2) { int compareResult = 0; - if (this.targetComparator != null){ + if (this.targetComparator != null) { compareResult = this.targetComparator.compare(message1, message2); } else { @@ -126,7 +126,7 @@ public class PriorityChannel extends QueueChannel { compareResult = priority2.compareTo(priority1); } - if (compareResult == 0){ + if (compareResult == 0) { Long sequence1 = ((MessageWrapper) message1).getSequence(); Long sequence2 = ((MessageWrapper) message2).getSequence(); compareResult = sequence1.compareTo(sequence2); @@ -140,12 +140,12 @@ public class PriorityChannel extends QueueChannel { private final Message rootMessage; private final long sequence; - private MessageWrapper(Message rootMessage){ + private MessageWrapper(Message rootMessage) { this.rootMessage = rootMessage; this.sequence = PriorityChannel.this.sequenceCounter.incrementAndGet(); } - public Message getRootMessage(){ + public Message getRootMessage() { return this.rootMessage; } @@ -159,7 +159,7 @@ public class PriorityChannel extends QueueChannel { return this.rootMessage.getPayload(); } - long getSequence(){ + long getSequence() { return this.sequence; } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/PublishSubscribeChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/PublishSubscribeChannel.java index ff76f65215..86583239bd 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/PublishSubscribeChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/PublishSubscribeChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -66,7 +66,7 @@ public class PublishSubscribeChannel extends AbstractExecutorChannel { @Override - public String getComponentType(){ + public String getComponentType() { return "publish-subscribe-channel"; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/RegistrationIds.java b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/RegistrationIds.java index 3af53156c5..c44c968d8b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/RegistrationIds.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/RegistrationIds.java @@ -31,6 +31,6 @@ public final class RegistrationIds { public static final int DEFAULT_MUTABLE_MESSAGEHEADERS_ID = 42; - private RegistrationIds() {} + private RegistrationIds() { } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/ChannelInitializer.java b/spring-integration-core/src/main/java/org/springframework/integration/config/ChannelInitializer.java index c3142fe62a..cb12a4940c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/ChannelInitializer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/ChannelInitializer.java @@ -63,7 +63,7 @@ final class ChannelInitializer implements BeanFactoryAware, InitializingBean { @Override public void afterPropertiesSet() throws Exception { Assert.notNull(this.beanFactory, "'beanFactory' must not be null"); - if (!this.autoCreate){ + if (!this.autoCreate) { return; } else { @@ -72,10 +72,10 @@ final class ChannelInitializer implements BeanFactoryAware, InitializingBean { Assert.notNull(channelCandidatesCollector, "Failed to locate '" + IntegrationContextUtils.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME); // at this point channelNames are all resolved with placeholders and SpEL Collection channelNames = channelCandidatesCollector.getChannelNames(); - if (channelNames != null){ + if (channelNames != null) { for (String channelName : channelNames) { - if (!this.beanFactory.containsBean(channelName)){ - if (this.logger.isDebugEnabled()){ + if (!this.beanFactory.containsBean(channelName)) { + if (this.logger.isDebugEnabled()) { this.logger.debug("Auto-creating channel '" + channelName + "' as DirectChannel"); } IntegrationConfigUtils.autoCreateDirectChannel(channelName, (BeanDefinitionRegistry) this.beanFactory); @@ -92,7 +92,7 @@ final class ChannelInitializer implements BeanFactoryAware, InitializingBean { private final Collection channelNames; - AutoCreateCandidatesCollector(Collection channelNames){ + AutoCreateCandidatesCollector(Collection channelNames) { this.channelNames = channelNames; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/GlobalChannelInterceptorProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/config/GlobalChannelInterceptorProcessor.java index 277242ee9b..ed21da44da 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/GlobalChannelInterceptorProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/GlobalChannelInterceptorProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -70,7 +70,7 @@ final class GlobalChannelInterceptorProcessor implements BeanFactoryAware, Smart @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { Assert.isInstanceOf(ListableBeanFactory.class, beanFactory); - this.beanFactory = (ListableBeanFactory) beanFactory;//NOSONAR (inconsistent sync) + this.beanFactory = (ListableBeanFactory) beanFactory; //NOSONAR (inconsistent sync) } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java b/spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java index fa358cc0e2..55f9ca1da6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-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. @@ -49,7 +49,7 @@ class IdempotentReceiverAutoProxyCreator extends AbstractAutoProxyCreator { public void setIdempotentEndpointsMapping(List> idempotentEndpointsMapping) { Assert.notEmpty(idempotentEndpointsMapping); - this.idempotentEndpointsMapping = idempotentEndpointsMapping;//NOSONAR (inconsistent sync) + this.idempotentEndpointsMapping = idempotentEndpointsMapping; //NOSONAR (inconsistent sync) } @Override @@ -82,7 +82,7 @@ class IdempotentReceiverAutoProxyCreator extends AbstractAutoProxyCreator { } private void initIdempotentEndpointsIfNecessary() { - if (this.idempotentEndpoints == null) {//NOSONAR (inconsistent sync) + if (this.idempotentEndpoints == null) { //NOSONAR (inconsistent sync) synchronized (this) { if (this.idempotentEndpoints == null) { this.idempotentEndpoints = new LinkedHashMap>(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/MessageHistoryRegistrar.java b/spring-integration-core/src/main/java/org/springframework/integration/config/MessageHistoryRegistrar.java index 33f9251d51..13db27eec0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/MessageHistoryRegistrar.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/MessageHistoryRegistrar.java @@ -43,7 +43,7 @@ public class MessageHistoryRegistrar implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { - Map annotationAttributes = importingClassMetadata.getAnnotationAttributes(EnableMessageHistory.class.getName()); + Map annotationAttributes = importingClassMetadata.getAnnotationAttributes(EnableMessageHistory.class.getName()); Object componentNamePatterns = annotationAttributes.get("value"); if (componentNamePatterns instanceof String[]) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/ServiceActivatorFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/ServiceActivatorFactoryBean.java index a6e721385e..0c3d67948a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/ServiceActivatorFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/ServiceActivatorFactoryBean.java @@ -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. @@ -127,7 +127,7 @@ public class ServiceActivatorFactoryBean extends AbstractStandardMessageHandlerF handler.setSendTimeout(this.sendTimeout); } if (this.requiresReply != null) { - if(handler instanceof AbstractReplyProducingMessageHandler) { + if (handler instanceof AbstractReplyProducingMessageHandler) { ((AbstractReplyProducingMessageHandler) handler).setRequiresReply(this.requiresReply); } else { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java index 6c10a9ab4e..f46a976f14 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java @@ -175,13 +175,13 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean annotations) { + protected AbstractEndpoint doCreateEndpoint(MessageHandler handler, MessageChannel inputChannel, List annotations) { AbstractEndpoint endpoint; if (inputChannel instanceof PollableChannel) { PollingConsumer pollingConsumer = new PollingConsumer((PollableChannel) inputChannel, handler); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DelayerParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DelayerParser.java index c2c1e823fa..7dc1650a16 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DelayerParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DelayerParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -78,7 +78,7 @@ public class DelayerParser extends AbstractConsumerEndpointParser { expressionBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionFactoryBean.class); expressionBuilder.addConstructorArgValue(expression); } - else if(expressionElement != null) { + else if (expressionElement != null) { expressionBuilder = BeanDefinitionBuilder.genericBeanDefinition( DynamicExpression.class); String key = expressionElement.getAttribute("key"); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java index 4b5186d667..46b756b5b0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java @@ -341,14 +341,14 @@ public abstract class IntegrationNamespaceUtils { public static void configureHeaderMapper(Element element, BeanDefinitionBuilder rootBuilder, ParserContext parserContext, BeanDefinitionBuilder headerMapperBuilder, String replyHeaderValue) { String defaultMappedReplyHeadersAttributeName = "mapped-reply-headers"; - if (!StringUtils.hasText(replyHeaderValue)){ + if (!StringUtils.hasText(replyHeaderValue)) { replyHeaderValue = defaultMappedReplyHeadersAttributeName; } boolean hasHeaderMapper = element.hasAttribute("header-mapper"); boolean hasMappedRequestHeaders = element.hasAttribute("mapped-request-headers"); boolean hasMappedReplyHeaders = element.hasAttribute(replyHeaderValue); - if (hasHeaderMapper && (hasMappedRequestHeaders || hasMappedReplyHeaders)){ + if (hasHeaderMapper && (hasMappedRequestHeaders || hasMappedReplyHeaders)) { parserContext.getReaderContext().error("The 'header-mapper' attribute is mutually exclusive with" + " 'mapped-request-headers' or 'mapped-reply-headers'. " + "You can only use one or the others", element); @@ -356,7 +356,7 @@ public abstract class IntegrationNamespaceUtils { IntegrationNamespaceUtils.setReferenceIfAttributeDefined(rootBuilder, element, "header-mapper"); - if (hasMappedRequestHeaders || hasMappedReplyHeaders){ + if (hasMappedRequestHeaders || hasMappedReplyHeaders) { if (hasMappedRequestHeaders) { headerMapperBuilder.addPropertyValue("requestHeaderNames", element.getAttribute("mapped-request-headers")); @@ -481,12 +481,12 @@ public abstract class IntegrationNamespaceUtils { boolean hasAttributeValue = StringUtils.hasText(valueElementValue); boolean hasAttributeExpression = StringUtils.hasText(expressionElementValue); - if (hasAttributeValue && hasAttributeExpression){ + if (hasAttributeValue && hasAttributeExpression) { parserContext.getReaderContext().error("Only one of '" + valueElementName + "' or '" + expressionElementName + "' is allowed", element); } - if (oneRequired && (!hasAttributeValue && !hasAttributeExpression)){ + if (oneRequired && (!hasAttributeValue && !hasAttributeExpression)) { parserContext.getReaderContext().error("One of '" + valueElementName + "' or '" + expressionElementName + "' is required", element); } @@ -507,7 +507,7 @@ public abstract class IntegrationNamespaceUtils { String expressionElementValue = element.getAttribute(expressionElementName); - if (StringUtils.hasText(expressionElementValue)){ + if (StringUtils.hasText(expressionElementValue)) { BeanDefinitionBuilder expressionDefBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionFactoryBean.class); expressionDefBuilder.addConstructorArgValue(expressionElementValue); return expressionDefBuilder.getRawBeanDefinition(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ObjectToJsonTransformerParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ObjectToJsonTransformerParser.java index 4dfb716e5a..e3874696fd 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ObjectToJsonTransformerParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ObjectToJsonTransformerParser.java @@ -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. @@ -46,7 +46,7 @@ public class ObjectToJsonTransformerParser extends AbstractTransformerParser { if (StringUtils.hasText(resultType)) { builder.addConstructorArgValue(resultType); } - if (element.hasAttribute("content-type")){ + if (element.hasAttribute("content-type")) { builder.addPropertyValue("contentType", element.getAttribute("content-type")); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PointToPointChannelParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PointToPointChannelParser.java index 2811f41376..07386c92aa 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PointToPointChannelParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PointToPointChannelParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -132,10 +132,10 @@ public class PointToPointChannelParser extends AbstractChannelParser { // configure the default RoundRobinLoadBalancingStrategy String loadBalancer = dispatcherElement.getAttribute("load-balancer"); String loadBalancerRef = dispatcherElement.getAttribute("load-balancer-ref"); - if (StringUtils.hasText(loadBalancer) && StringUtils.hasText(loadBalancerRef)){ + if (StringUtils.hasText(loadBalancer) && StringUtils.hasText(loadBalancerRef)) { parserContext.getReaderContext().error("'load-balancer' and 'load-balancer-ref' are mutually exclusive", element); } - if (StringUtils.hasText(loadBalancerRef)){ + if (StringUtils.hasText(loadBalancerRef)) { builder.addConstructorArgReference(loadBalancerRef); } else { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PollerParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PollerParser.java index ca3c4f21e4..7ef1035d57 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PollerParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PollerParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -91,11 +91,11 @@ public class PollerParser extends AbstractBeanDefinitionParser { IntegrationNamespaceUtils.configureAndSetAdviceChainIfPresent(adviceChainElement, txElement, metadataBuilder.getRawBeanDefinition(), parserContext); - if (txElement != null){ + if (txElement != null) { IntegrationNamespaceUtils.setReferenceIfAttributeDefined(metadataBuilder, txElement, "synchronization-factory", "transactionSynchronizationFactory"); } - else if (adviceChainElement != null){ + else if (adviceChainElement != null) { IntegrationNamespaceUtils.setReferenceIfAttributeDefined(metadataBuilder, adviceChainElement, "synchronization-factory", "transactionSynchronizationFactory"); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PublishingInterceptorParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PublishingInterceptorParser.java index 96b2a31739..b72b490ce9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PublishingInterceptorParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PublishingInterceptorParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -53,7 +53,7 @@ public class PublishingInterceptorParser extends AbstractBeanDefinitionParser { MessagePublishingInterceptor.class); BeanDefinitionBuilder spelSourceBuilder = BeanDefinitionBuilder .genericBeanDefinition(MethodNameMappingPublisherMetadataSource.class); - Map> mappings = this.getMappings(element, element.getAttribute("default-channel"), parserContext); + Map> mappings = this.getMappings(element, element.getAttribute("default-channel"), parserContext); spelSourceBuilder.addConstructorArgValue(mappings.get("payload")); if (mappings.get("headers") != null) { spelSourceBuilder.addPropertyValue("headerExpressionMap", mappings.get("headers")); @@ -62,7 +62,7 @@ public class PublishingInterceptorParser extends AbstractBeanDefinitionParser { BeanDefinitionBuilder chResolverBuilder = BeanDefinitionBuilder.genericBeanDefinition( BeanFactoryChannelResolver.class); - if (mappings.get("channels") != null){ + if (mappings.get("channels") != null) { spelSourceBuilder.addPropertyValue("channelMap", mappings.get("channels")); } String chResolverName = @@ -75,9 +75,9 @@ public class PublishingInterceptorParser extends AbstractBeanDefinitionParser { return rootBuilder.getBeanDefinition(); } - private Map> getMappings(Element element, String defaultChannel, ParserContext parserContext) { + private Map> getMappings(Element element, String defaultChannel, ParserContext parserContext) { List mappings = DomUtils.getChildElementsByTagName(element, "method"); - Map> interceptorMappings = new HashMap>(); + Map> interceptorMappings = new HashMap>(); Map payloadExpressionMap = new HashMap(); Map> headersExpressionMap = new HashMap>(); Map channelMap = new HashMap(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/RecipientListRouterParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/RecipientListRouterParser.java index ceb2b96aa6..9242c74654 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/RecipientListRouterParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/RecipientListRouterParser.java @@ -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. @@ -59,7 +59,7 @@ public class RecipientListRouterParser extends AbstractRouterParser { } recipientList.add(recipientBuilder.getBeanDefinition()); } - if(recipientList.size() > 0) { + if (recipientList.size() > 0) { recipientListRouterBuilder.addPropertyValue("recipients", recipientList); } return recipientListRouterBuilder.getBeanDefinition(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ResourceInboundChannelAdapterParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ResourceInboundChannelAdapterParser.java index a22e99a8dd..c6e2b27b5f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ResourceInboundChannelAdapterParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ResourceInboundChannelAdapterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -40,9 +40,9 @@ public class ResourceInboundChannelAdapterParser extends AbstractPollingInboundC sourceBuilder.addConstructorArgValue(element.getAttribute("pattern")); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(sourceBuilder, element, "pattern-resolver"); boolean hasFilter = element.hasAttribute("filter"); - if (hasFilter){ + if (hasFilter) { String filterValue = element.getAttribute("filter"); - if (StringUtils.hasText(filterValue)){ + if (StringUtils.hasText(filterValue)) { sourceBuilder.addPropertyReference("filter", filterValue); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/TransactionSynchronizationFactoryParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/TransactionSynchronizationFactoryParser.java index 8487d06ffa..b1bcae5049 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/TransactionSynchronizationFactoryParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/TransactionSynchronizationFactoryParser.java @@ -47,7 +47,7 @@ public class TransactionSynchronizationFactoryParser extends Element afterCommitElement = DomUtils.getChildElementByTagName(element, "after-commit"); Element afterRollbackElement = DomUtils.getChildElementByTagName(element, "after-rollback"); - if (this.elementsNotDefined(beforeCommitElement, afterCommitElement, afterRollbackElement)){ + if (this.elementsNotDefined(beforeCommitElement, afterCommitElement, afterRollbackElement)) { parserContext.getReaderContext().error("At least one sub-element " + "('before-commit', 'after-commit' and/or 'after-rollback') must be defined", element); } @@ -63,21 +63,21 @@ public class TransactionSynchronizationFactoryParser extends return syncFactoryBuilder.getBeanDefinition(); } - private void processSubElement(Element element, ParserContext parserContext, BeanDefinitionBuilder expressionProcessor, String elementPrefix){ - if (element != null){ + private void processSubElement(Element element, ParserContext parserContext, BeanDefinitionBuilder expressionProcessor, String elementPrefix) { + if (element != null) { String expression = element.getAttribute("expression"); String channel = element.getAttribute("channel"); - if (this.attributesNotDefined(expression, channel)){ + if (this.attributesNotDefined(expression, channel)) { parserContext.getReaderContext().error("At least one attribute " + "('expression' and/or 'channel') must be defined", element); } - if (StringUtils.hasText(expression)){ + if (StringUtils.hasText(expression)) { RootBeanDefinition expressionDef = new RootBeanDefinition(ExpressionFactoryBean.class); expressionDef.getConstructorArgumentValues().addGenericArgumentValue(expression); expressionProcessor.addPropertyValue(elementPrefix + "Expression", expressionDef); } - if (StringUtils.hasText(channel)){ + if (StringUtils.hasText(channel)) { expressionProcessor.addPropertyReference(elementPrefix + "Channel", channel); } else { @@ -86,17 +86,17 @@ public class TransactionSynchronizationFactoryParser extends } } - private boolean elementsNotDefined(Element... elements){ + private boolean elementsNotDefined(Element... elements) { for (Object element : elements) { - if (element != null){ + if (element != null) { return false; } } return true; } - private boolean attributesNotDefined(String... attributes){ + private boolean attributesNotDefined(String... attributes) { for (String attribute : attributes) { - if (StringUtils.hasText(attribute)){ + if (StringUtils.hasText(attribute)) { return false; } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java b/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java index e8620508e1..68bd51ab4d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -61,7 +61,7 @@ public class MessagingTemplate extends GenericMessagingTemplate { */ @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = beanFactory;//NOSONAR - non-sync is ok here + this.beanFactory = beanFactory; //NOSONAR - non-sync is ok here super.setDestinationResolver(new BeanFactoryChannelResolver(beanFactory)); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySet.java b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySet.java index d60c35b814..9ab35d0c64 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySet.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySet.java @@ -85,11 +85,11 @@ class OrderedAwareCopyOnWriteArraySet implements Set { */ @Override public boolean add(E o) { - Assert.notNull(o,"Can not add NULL object"); + Assert.notNull(o, "Can not add NULL object"); this.writeLock.lock(); try { boolean present = false; - if (o instanceof Ordered){ + if (o instanceof Ordered) { present = this.addOrderedElement((Ordered) o); } else { @@ -107,7 +107,7 @@ class OrderedAwareCopyOnWriteArraySet implements Set { */ @Override public boolean addAll(Collection c) { - Assert.notNull(c,"Can not merge with NULL set"); + Assert.notNull(c, "Can not merge with NULL set"); this.writeLock.lock(); try { for (E object : c) { @@ -140,8 +140,8 @@ class OrderedAwareCopyOnWriteArraySet implements Set { * {@inheritDoc} */ @Override - public boolean removeAll(Collection c){ - if (CollectionUtils.isEmpty(c)){ + public boolean removeAll(Collection c) { + if (CollectionUtils.isEmpty(c)) { return false; } this.writeLock.lock(); @@ -219,7 +219,7 @@ class OrderedAwareCopyOnWriteArraySet implements Set { } @Override - public int size(){ + public int size() { return this.elements.size(); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/RoundRobinLoadBalancingStrategy.java b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/RoundRobinLoadBalancingStrategy.java index 2901fcbc4e..17bf4fde07 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/RoundRobinLoadBalancingStrategy.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/RoundRobinLoadBalancingStrategy.java @@ -53,14 +53,14 @@ public class RoundRobinLoadBalancingStrategy implements LoadBalancingStrategy { return this.buildHandlerIterator(size, handlers.toArray(new MessageHandler[size])); } - private Iterator buildHandlerIterator(int size, final MessageHandler[] handlers){ + private Iterator buildHandlerIterator(int size, final MessageHandler[] handlers) { int nextHandlerStartIndex = getNextHandlerStartIndex(size); final MessageHandler[] reorderedHandlers = new MessageHandler[size]; - System.arraycopy(handlers, nextHandlerStartIndex, reorderedHandlers, 0, size-nextHandlerStartIndex); - System.arraycopy(handlers, 0, reorderedHandlers, size-nextHandlerStartIndex, 0+nextHandlerStartIndex); + System.arraycopy(handlers, nextHandlerStartIndex, reorderedHandlers, 0, size - nextHandlerStartIndex); + System.arraycopy(handlers, 0, reorderedHandlers, size - nextHandlerStartIndex, 0 + nextHandlerStartIndex); return new Iterator() { int currentIndex = 0; @@ -85,7 +85,7 @@ public class RoundRobinLoadBalancingStrategy implements LoadBalancingStrategy { * size. */ private int getNextHandlerStartIndex(int size) { - if (size > 0){ + if (size > 0) { int indexTail = this.currentHandlerIndex.getAndIncrement() % size; return indexTail < 0 ? indexTail + size : indexTail; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/UnicastingDispatcher.java b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/UnicastingDispatcher.java index acf70caf1e..d6d8ba7af2 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/UnicastingDispatcher.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/UnicastingDispatcher.java @@ -194,7 +194,7 @@ public class UnicastingDispatcher extends AbstractDispatcher { if (allExceptions != null && allExceptions.size() == 1) { throw allExceptions.get(0); } - throw new AggregateMessageDeliveryException(message,//NOSONAR - false positive + throw new AggregateMessageDeliveryException(message, //NOSONAR - false positive "All attempts to deliver Message to MessageHandlers failed.", allExceptions); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/EventDrivenConsumer.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/EventDrivenConsumer.java index bcd4057b3a..58c64ea5cd 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/EventDrivenConsumer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/EventDrivenConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -65,16 +65,16 @@ public class EventDrivenConsumer extends AbstractEndpoint { } } - private void logComponentSubscriptionEvent(boolean add){ - if (this.handler instanceof NamedComponent && this.inputChannel instanceof NamedComponent){ - String channelName = ((NamedComponent)this.inputChannel).getComponentName(); - String componentType = ((NamedComponent)this.handler).getComponentType(); + private void logComponentSubscriptionEvent(boolean add) { + if (this.handler instanceof NamedComponent && this.inputChannel instanceof NamedComponent) { + String channelName = ((NamedComponent) this.inputChannel).getComponentName(); + String componentType = ((NamedComponent) this.handler).getComponentType(); componentType = StringUtils.hasText(componentType) ? componentType : ""; - String componentName = ((IntegrationObjectSupport)this).getComponentName(); + String componentName = ((IntegrationObjectSupport) this).getComponentName(); componentName = (StringUtils.hasText(componentName) && componentName.contains("#")) ? "" : ":" + componentName; StringBuffer buffer = new StringBuffer(); buffer.append("{" + componentType + componentName + "} as a subscriber to the '" + channelName + "' channel"); - if (add){ + if (add) { buffer.insert(0, "Adding "); } else { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/ExpressionMessageProducerSupport.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/ExpressionMessageProducerSupport.java index 583378de92..ffd61f5b56 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/ExpressionMessageProducerSupport.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/ExpressionMessageProducerSupport.java @@ -75,7 +75,7 @@ public abstract class ExpressionMessageProducerSupport extends MessageProducerSu } } - protected Object evaluatePayloadExpression(Object payload){ + protected Object evaluatePayloadExpression(Object payload) { Object evaluationResult = payload; if (this.payloadExpression != null) { evaluationResult = this.payloadExpression.getValue(this.evaluationContext, payload); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MethodInvokingMessageSource.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MethodInvokingMessageSource.java index 9409d07b43..16ccfddb32 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MethodInvokingMessageSource.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MethodInvokingMessageSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -82,7 +82,7 @@ public class MethodInvokingMessageSource extends AbstractMessageSource + "' is available on " + this.object.getClass()); } Assert.isTrue(!void.class.equals(this.method.getReturnType()), - "invalid MessageSource method '"+ this.method.getName() + "', a non-void return is required"); + "invalid MessageSource method '" + this.method.getName() + "', a non-void return is required"); this.method.setAccessible(true); this.initialized = true; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/PollingConsumer.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/PollingConsumer.java index 82b2276f9e..5774a28994 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/PollingConsumer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/PollingConsumer.java @@ -115,7 +115,7 @@ public class PollingConsumer extends AbstractPollingEndpoint { String description = "Failed to handle " + theMessage + " to " + this + " in " + this.handler; throw new MessageDeliveryException(theMessage, description, ex); } - catch (Error ex) {//NOSONAR - ok, we re-throw below + catch (Error ex) { //NOSONAR - ok, we re-throw below if (!CollectionUtils.isEmpty(interceptorStack)) { String description = "Failed to handle " + theMessage + " to " + this + " in " + this.handler; triggerAfterMessageHandled(theMessage, @@ -154,7 +154,7 @@ public class PollingConsumer extends AbstractPollingEndpoint { try { interceptor.afterMessageHandled(message, this.inputChannel, this.handler, ex); } - catch (Throwable ex2) {//NOSONAR + catch (Throwable ex2) { //NOSONAR logger.error("Exception from afterMessageHandled in " + interceptor, ex2); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayCompletableFutureProxyFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayCompletableFutureProxyFactoryBean.java index 1811b5144b..3f77344ed9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayCompletableFutureProxyFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayCompletableFutureProxyFactoryBean.java @@ -78,10 +78,10 @@ public class GatewayCompletableFutureProxyFactoryBean extends GatewayProxyFactor try { return doInvoke(this.invocation, false); } - catch (Error e) {//NOSONAR + catch (Error e) { //NOSONAR throw e; } - catch (Throwable t) {//NOSONAR + catch (Throwable t) { //NOSONAR if (t instanceof RuntimeException) { throw (RuntimeException) t; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java index 54d2f2fc0c..86508722c0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java @@ -207,7 +207,7 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper entry : argumentValue.entrySet()) { Object key = entry.getKey(); if (!(key instanceof String)) { - if (this.logger.isWarnEnabled()){ + if (this.logger.isWarnEnabled()) { this.logger.warn("Invalid header name [" + key + "], name type must be String. Skipping mapping of this header to MessageHeaders."); } @@ -325,7 +325,7 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper message) { Assert.notNull(message, "Message must not be null"); - Assert.notNull(message.getPayload(), "Message payload must not be null");//NOSONAR - false positive + Assert.notNull(message.getPayload(), "Message payload must not be null"); //NOSONAR - false positive if (this.loggingEnabled && this.logger.isDebugEnabled()) { this.logger.debug(this + " received message: " + message); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java index 97da607c1b..e729a7792a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java @@ -72,7 +72,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan public void setOutputChannelName(String outputChannelName) { Assert.hasText(outputChannelName, "'outputChannelName' must not be empty"); - this.outputChannelName = outputChannelName;//NOSONAR (inconsistent sync) + this.outputChannelName = outputChannelName; //NOSONAR (inconsistent sync) } /** @@ -98,7 +98,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan @Override protected void onInit() throws Exception { super.onInit(); - Assert.state(!(this.outputChannelName != null && this.outputChannel != null),//NOSONAR (inconsistent sync) + Assert.state(!(this.outputChannelName != null && this.outputChannel != null), //NOSONAR (inconsistent sync) "'outputChannelName' and 'outputChannel' are mutually exclusive."); if (getBeanFactory() != null) { this.messagingTemplate.setBeanFactory(getBeanFactory()); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/LoggingHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/LoggingHandler.java index 6f8bb4f1ac..36b5b76995 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/LoggingHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/LoggingHandler.java @@ -220,7 +220,7 @@ public class LoggingHandler extends AbstractMessageHandler { StringWriter stringWriter = new StringWriter(); if (logMessage instanceof AggregateMessageDeliveryException) { stringWriter.append(((Throwable) logMessage).getMessage()); - for (Exception exception : ((AggregateMessageDeliveryException)logMessage).getAggregatedExceptions()) { + for (Exception exception : ((AggregateMessageDeliveryException) logMessage).getAggregatedExceptions()) { exception.printStackTrace(new PrintWriter(stringWriter, true)); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/AbstractRequestHandlerAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/AbstractRequestHandlerAdvice.java index 96d11610ec..3b30ef1a2f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/AbstractRequestHandlerAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/AbstractRequestHandlerAdvice.java @@ -74,10 +74,10 @@ public abstract class AbstractRequestHandlerAdvice extends IntegrationObjectSupp try { return invocation.proceed(); } - catch (Exception e) {//NOSONAR - catch necessary so we can wrap Errors + catch (Exception e) { //NOSONAR - catch necessary so we can wrap Errors throw e; } - catch (Throwable e) {//NOSONAR - ok to catch; unwrapped and rethrown below + catch (Throwable e) { //NOSONAR - ok to catch; unwrapped and rethrown below throw new ThrowableHolderException(e); } } @@ -98,10 +98,10 @@ public abstract class AbstractRequestHandlerAdvice extends IntegrationObjectSupp " so please raise an issue if you see this exception"); } } - catch (Exception e) {//NOSONAR - catch necessary so we can wrap Errors + catch (Exception e) { //NOSONAR - catch necessary so we can wrap Errors throw e; } - catch (Throwable e) {//NOSONAR - ok to catch; unwrapped and rethrown below + catch (Throwable e) { //NOSONAR - ok to catch; unwrapped and rethrown below throw new ThrowableHolderException(e); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java index efadd99296..9d581d8563 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java @@ -83,12 +83,12 @@ public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHan } public void setSuccessChannel(MessageChannel successChannel) { - Assert.notNull(successChannel,"'successChannel' must not be null"); + Assert.notNull(successChannel, "'successChannel' must not be null"); this.successChannel = successChannel; } public void setFailureChannel(MessageChannel failureChannel) { - Assert.notNull(failureChannel,"'failureChannel' must not be null"); + Assert.notNull(failureChannel, "'failureChannel' must not be null"); this.failureChannel = failureChannel; } @@ -190,7 +190,7 @@ public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHan return evalResult; } - protected StandardEvaluationContext createEvaluationContext(){ + protected StandardEvaluationContext createEvaluationContext() { return ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistoryConfigurer.java b/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistoryConfigurer.java index cbb8a57aba..40607dcd78 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistoryConfigurer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistoryConfigurer.java @@ -97,7 +97,7 @@ public class MessageHistoryConfigurer implements SmartLifecycle, BeanFactoryAwar * components). Cannot be changed if {@link #isRunning()}; invoke {@link #stop()} first. * @param componentNamePatterns The patterns. */ - @ManagedAttribute(description="comma-delimited list of patterns; must invoke stop() before changing.") + @ManagedAttribute(description = "comma-delimited list of patterns; must invoke stop() before changing.") public void setComponentNamePatternsString(String componentNamePatterns) { this.setComponentNamePatterns(StringUtils.delimitedListToStringArray(componentNamePatterns, ",", " ")); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/mapping/AbstractHeaderMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/mapping/AbstractHeaderMapper.java index 402464f990..149e300fcb 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/mapping/AbstractHeaderMapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/mapping/AbstractHeaderMapper.java @@ -547,7 +547,7 @@ public abstract class AbstractHeaderMapper implements RequestReplyHeaderMappe * {@link HeaderMatcher}s matches to the {@code headerName}. * @since 4.1 */ - protected static class CompositeHeaderMatcher implements HeaderMatcher{ + protected static class CompositeHeaderMatcher implements HeaderMatcher { private static final Log logger = LogFactory.getLog(HeaderMatcher.class); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java b/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java index 9b973630f3..c51af5714b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java @@ -51,7 +51,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS @Override public Message getMessage(UUID id) { Message message = getRawMessage(id); - if (message != null){ + if (message != null) { return normalizeMessage(message); } return null; @@ -73,7 +73,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS if (message != null) { Assert.isInstanceOf(Message.class, message); } - if (message != null){ + if (message != null) { return normalizeMessage((Message) message); } return null; @@ -147,7 +147,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS Message actualMessageToRemove = null; for (Message message : rawGroup.getMessages()) { - if (message.getHeaders().getId().equals(messageToRemove.getHeaders().getId())){ + if (message.getHeaders().getId().equals(messageToRemove.getHeaders().getId())) { actualMessageToRemove = message; break; } @@ -206,7 +206,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS MessageGroupMetadata messageGroupMetadata = (MessageGroupMetadata) mgm; Iterator messageIds = messageGroupMetadata.messageIdIterator(); - while (messageIds.hasNext()){ + while (messageIds.hasNext()) { removeMessage(messageIds.next()); } } @@ -230,7 +230,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS MessageGroupMetadata messageGroupMetadata = (MessageGroupMetadata) mgm; UUID firstId = messageGroupMetadata.firstId(); - if (firstId != null){ + if (firstId != null) { messageGroupMetadata.remove(firstId); messageGroupMetadata.setLastModified(System.currentTimeMillis()); doStore(MESSAGE_GROUP_KEY_PREFIX + groupId, messageGroupMetadata); @@ -249,14 +249,14 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS return new MessageGroupIterator(idIterator); } - private Collection normalizeKeys(Collection keys){ + private Collection normalizeKeys(Collection keys) { Set normalizedKeys = new HashSet(); for (Object key : keys) { String strKey = (String) key; - if (strKey.startsWith(MESSAGE_GROUP_KEY_PREFIX)){ + if (strKey.startsWith(MESSAGE_GROUP_KEY_PREFIX)) { strKey = strKey.replace(MESSAGE_GROUP_KEY_PREFIX, ""); } - else if (strKey.startsWith(MESSAGE_KEY_PREFIX)){ + else if (strKey.startsWith(MESSAGE_KEY_PREFIX)) { strKey = strKey.replace(MESSAGE_KEY_PREFIX, ""); } normalizedKeys.add(strKey); @@ -284,7 +284,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS protected abstract Collection doListKeys(String keyPattern); @SuppressWarnings({ "rawtypes", "unchecked" }) - private Message normalizeMessage(Message message){ + private Message normalizeMessage(Message message) { Message normalizedMessage = getMessageBuilderFactory().fromMessage(message) .removeHeader("CREATED_DATE") .build(); @@ -298,7 +298,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS * Will enrich Message with additional meta headers */ @SuppressWarnings({ "rawtypes", "unchecked" }) - private Message enrichMessage(Message message){ + private Message enrichMessage(Message message) { Message enrichedMessage = getMessageBuilderFactory().fromMessage(message) .setHeader(CREATED_DATE, System.currentTimeMillis()) .build(); @@ -308,7 +308,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS return enrichedMessage; } - private MessageGroup buildMessageGroup(Object groupId, boolean raw){ + private MessageGroup buildMessageGroup(Object groupId, boolean raw) { Assert.notNull(groupId, "'groupId' must not be null"); Object mgm = doRetrieve(MESSAGE_GROUP_KEY_PREFIX + groupId); if (mgm != null) { @@ -317,10 +317,10 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS ArrayList> messages = new ArrayList>(); Iterator messageIds = messageGroupMetadata.messageIdIterator(); - while (messageIds.hasNext()){ + while (messageIds.hasNext()) { UUID next = messageIds.next(); if (next != null) { - if (raw){ + if (raw) { messages.add(getRawMessage(next)); } else { @@ -341,7 +341,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS } } - private MessageGroup normalizeSimpleMessageGroup(MessageGroup messageGroup){ + private MessageGroup normalizeSimpleMessageGroup(MessageGroup messageGroup) { MessageGroup normalizedGroup = getMessageGroupFactory().create(messageGroup.getGroupId()); for (Message message : messageGroup.getMessages()) { Message normalizedMessage = normalizeMessage(message); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupMetadata.java b/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupMetadata.java index 9809551810..c4510d0f8f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupMetadata.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupMetadata.java @@ -73,7 +73,7 @@ public class MessageGroupMetadata implements Serializable { this.first = first; } - public void remove(UUID messageId){ + public void remove(UUID messageId) { if (!this.hasMessages) { throw new IllegalStateException("Messages are not available, fetch the entire group"); } @@ -88,25 +88,25 @@ public class MessageGroupMetadata implements Serializable { return this.groupId; } - public Iterator messageIdIterator(){ + public Iterator messageIdIterator() { if (!this.hasMessages) { throw new IllegalStateException("Messages are not available, fetch the entire group"); } return this.messageIds.iterator(); } - public int size(){ + public int size() { return this.messageIds.size(); } - public UUID firstId(){ + public UUID firstId() { if (this.first != null) { return this.first; } if (!this.hasMessages) { throw new IllegalStateException("Messages are not available, fetch the entire group"); } - if (this.messageIds.size() > 0){ + if (this.messageIds.size() > 0) { return this.messageIds.iterator().next(); } return null; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java b/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java index dd6ba437a3..7ed7f5af81 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java @@ -156,7 +156,7 @@ public class MessageGroupQueue extends AbstractQueue> implements Bloc storeLock.lockInterruptibly(); try { - while (this.size() == 0 && timeoutInNanos > 0){ + while (this.size() == 0 && timeoutInNanos > 0) { timeoutInNanos = this.messageStoreNotEmpty.awaitNanos(timeoutInNanos); } message = this.doPoll(); @@ -248,11 +248,11 @@ public class MessageGroupQueue extends AbstractQueue> implements Bloc storeLock.lockInterruptibly(); try { if (this.capacity != Integer.MAX_VALUE) { - while (this.size() == this.capacity && timeoutInNanos > 0){ + while (this.size() == this.capacity && timeoutInNanos > 0) { timeoutInNanos = this.messageStoreNotFull.awaitNanos(timeoutInNanos); } } - if (timeoutInNanos > 0){ + if (timeoutInNanos > 0) { offered = this.doOffer(message); } } @@ -268,7 +268,7 @@ public class MessageGroupQueue extends AbstractQueue> implements Bloc storeLock.lockInterruptibly(); try { if (this.capacity != Integer.MAX_VALUE) { - while (this.size() == this.capacity){ + while (this.size() == this.capacity) { this.messageStoreNotFull.await(); } } @@ -294,7 +294,7 @@ public class MessageGroupQueue extends AbstractQueue> implements Bloc storeLock.lockInterruptibly(); try { - while (this.size() == 0){ + while (this.size() == 0) { this.messageStoreNotEmpty.await(); } message = this.doPoll(); @@ -306,7 +306,7 @@ public class MessageGroupQueue extends AbstractQueue> implements Bloc return message; } - private Collection> getMessages(){ + private Collection> getMessages() { return this.messageGroupStore.getMessageGroup(this.groupId).getMessages(); } @@ -324,9 +324,9 @@ public class MessageGroupQueue extends AbstractQueue> implements Bloc * It is assumed that the 'storeLock' is being held by the caller, otherwise * IllegalMonitorStateException may be thrown */ - private boolean doOffer(Message message){ + private boolean doOffer(Message message) { boolean offered = false; - if (this.capacity == Integer.MAX_VALUE || this.size() < this.capacity){ + if (this.capacity == Integer.MAX_VALUE || this.size() < this.capacity) { this.messageGroupStore.addMessageToGroup(this.groupId, message); offered = true; this.messageStoreNotEmpty.signal(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java b/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java index ffc75c2dce..1c0c7fd408 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java @@ -79,7 +79,7 @@ public class SimpleMessageGroup implements MessageGroup { this.timestamp = timestamp; this.complete = complete; for (Message message : messages) { - if (message != null){ //see INT-2666 + if (message != null) { //see INT-2666 addMessage(message); } } @@ -90,7 +90,7 @@ public class SimpleMessageGroup implements MessageGroup { return this.timestamp; } - public void setLastModified(long lastModified){ + public void setLastModified(long lastModified) { this.lastModified = lastModified; } @@ -126,7 +126,7 @@ public class SimpleMessageGroup implements MessageGroup { return Collections.unmodifiableCollection(this.messages); } - public void setLastReleasedMessageSequenceNumber(int sequenceNumber){ + public void setLastReleasedMessageSequenceNumber(int sequenceNumber) { this.lastReleasedMessageSequence = sequenceNumber; } @@ -166,7 +166,7 @@ public class SimpleMessageGroup implements MessageGroup { } } - public void clear(){ + public void clear() { this.messages.clear(); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/converter/MapMessageConverter.java b/spring-integration-core/src/main/java/org/springframework/integration/support/converter/MapMessageConverter.java index bd819dc54f..a47b52791d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/converter/MapMessageConverter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/converter/MapMessageConverter.java @@ -111,7 +111,7 @@ public class MapMessageConverter implements MessageConverter, BeanFactoryAware { @Override public Object fromMessage(Message message, Class clazz) { - Map map = new HashMap(); + Map map = new HashMap(); map.put("payload", message.getPayload()); Map headers = new HashMap(); for (String headerName : this.headerNames) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java index 060bf4711e..f0711574e2 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-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. @@ -74,7 +74,7 @@ public class Jackson2JsonObjectMapper extends AbstractJacksonJsonObjectMapper * @param mask The bit mask. */ - public DefaultLockRegistry(int mask){ + public DefaultLockRegistry(int mask) { String bits = Integer.toBinaryString(mask); Assert.isTrue(bits.length() < 32 && (mask == 0 || bits.lastIndexOf('0') < bits.indexOf('1') ), "Mask must be a power of 2 - 1"); this.mask = mask; - int arraySize = this.mask+1; + int arraySize = this.mask + 1; this.lockTable = new ReentrantLock[arraySize]; for (int i = 0; i < arraySize; i++) { this.lockTable[i] = new ReentrantLock(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverage.java b/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverage.java index 216b887779..8625dd8d20 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverage.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverage.java @@ -73,7 +73,7 @@ public class ExponentialMovingAverage { */ public ExponentialMovingAverage(int window, double factor) { this.window = window; - this.retention = window * 5;// last retained value contributes just 0.5% to the sum + this.retention = window * 5; // last retained value contributes just 0.5% to the sum this.factor = factor; } @@ -93,7 +93,7 @@ public class ExponentialMovingAverage { this.samples.poll(); } this.samples.add(value); - this.count++;//NOSONAR - false positive, we're synchronized + this.count++; //NOSONAR - false positive, we're synchronized } private Statistics calc() { @@ -132,7 +132,7 @@ public class ExponentialMovingAverage { double mean = weight > 0 ? sum / weight : 0.; double var = weight > 0 ? sumSquares / weight - mean * mean : 0.; double standardDeviation = var > 0 ? Math.sqrt(var) : 0; - return new Statistics(count, min == Double.MAX_VALUE ? 0 : min, max, mean, standardDeviation);//NOSONAR + return new Statistics(count, min == Double.MAX_VALUE ? 0 : min, max, mean, standardDeviation); //NOSONAR } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRate.java b/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRate.java index 6389defdc5..6a51b85b38 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRate.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRate.java @@ -117,7 +117,7 @@ public class ExponentialMovingAverageRate { this.times.poll(); } this.times.add(t); - this.count++;//NOSONAR - false positive, we're synchronized + this.count++; //NOSONAR - false positive, we're synchronized } private Statistics calc() { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRatio.java b/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRatio.java index 62b89b0be1..1637fd8563 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRatio.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRatio.java @@ -134,7 +134,7 @@ public class ExponentialMovingAverageRatio { } this.times.add(t); this.values.add(value); - this.count++;//NOSONAR - false positive, we're synchronized + this.count++; //NOSONAR - false positive, we're synchronized } private Statistics calc() { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/IntegrationManagementConfigurer.java b/spring-integration-core/src/main/java/org/springframework/integration/support/management/IntegrationManagementConfigurer.java index e861dded70..c60ab6b1af 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/IntegrationManagementConfigurer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/management/IntegrationManagementConfigurer.java @@ -291,7 +291,7 @@ public class IntegrationManagementConfigurer implements SmartInitializingSinglet } } } - return null;//NOSONAR - intentional null return + return null; //NOSONAR - intentional null return } public MessageChannelMetrics getChannelMetrics(String name) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transaction/DefaultTransactionSynchronizationFactory.java b/spring-integration-core/src/main/java/org/springframework/integration/transaction/DefaultTransactionSynchronizationFactory.java index 77a668350b..c57f69280f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transaction/DefaultTransactionSynchronizationFactory.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transaction/DefaultTransactionSynchronizationFactory.java @@ -38,7 +38,7 @@ public class DefaultTransactionSynchronizationFactory implements TransactionSync private final TransactionSynchronizationProcessor processor; - public DefaultTransactionSynchronizationFactory(TransactionSynchronizationProcessor processor){ + public DefaultTransactionSynchronizationFactory(TransactionSynchronizationProcessor processor) { Assert.notNull(processor, "'processor' must not be null"); this.processor = processor; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transaction/IntegrationResourceHolder.java b/spring-integration-core/src/main/java/org/springframework/integration/transaction/IntegrationResourceHolder.java index d21ee18865..8b2992a985 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transaction/IntegrationResourceHolder.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transaction/IntegrationResourceHolder.java @@ -56,7 +56,7 @@ public class IntegrationResourceHolder implements ResourceHolder { * @param key The key. * @param value The value. */ - public void addAttribute(String key, Object value){ + public void addAttribute(String key, Object value) { this.attributes.put(key, value); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/HeaderFilter.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/HeaderFilter.java index c769cb0550..e8e14f35e4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/HeaderFilter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/HeaderFilter.java @@ -53,7 +53,7 @@ public class HeaderFilter extends IntegrationObjectSupport implements Transforme @Override public Message transform(Message message) { AbstractIntegrationMessageBuilder builder = this.getMessageBuilderFactory().fromMessage(message); - if (this.patternMatch){ + if (this.patternMatch) { builder.removeHeaders(this.headersToRemove); } else { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java index 2d80e60a4a..a8b61344fc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -54,7 +54,7 @@ import org.springframework.util.StringUtils; * @author Gary Russell * @since 2.0 */ -public class ObjectToMapTransformer extends AbstractPayloadTransformer> { +public class ObjectToMapTransformer extends AbstractPayloadTransformer> { private final JsonObjectMapper jsonObjectMapper = JsonObjectMapperProvider.newInstance(); @@ -67,7 +67,7 @@ public class ObjectToMapTransformer extends AbstractPayloadTransformer transformPayload(Object payload) throws Exception { - Map result = this.jsonObjectMapper.fromJson(this.jsonObjectMapper.toJson(payload), Map.class); + Map result = this.jsonObjectMapper.fromJson(this.jsonObjectMapper.toJson(payload), Map.class); if (this.shouldFlattenKeys) { result = this.flattenMap(result); } @@ -96,13 +96,13 @@ public class ObjectToMapTransformer extends AbstractPayloadTransformer flattenMap(Map result){ - Map resultMap = new HashMap(); + private Map flattenMap(Map result) { + Map resultMap = new HashMap(); this.doFlatten("", result, resultMap); return resultMap; } - private void doFlatten(String propertyPrefix, Map inputMap, Map resultMap){ + private void doFlatten(String propertyPrefix, Map inputMap, Map resultMap) { if (StringUtils.hasText(propertyPrefix)) { propertyPrefix = propertyPrefix + "."; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/support/RoutingSlipHeaderValueMessageProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/support/RoutingSlipHeaderValueMessageProcessor.java index d5005a6490..002a31ee64 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/support/RoutingSlipHeaderValueMessageProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/support/RoutingSlipHeaderValueMessageProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-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. @@ -71,7 +71,7 @@ public class RoutingSlipHeaderValueMessageProcessor @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { Assert.notNull(beanFactory, "beanFactory must not be null"); - this.beanFactory = beanFactory;//NOSONAR (inconsistent sync) + this.beanFactory = beanFactory; //NOSONAR (inconsistent sync) } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/BeanFactoryTypeConverter.java b/spring-integration-core/src/main/java/org/springframework/integration/util/BeanFactoryTypeConverter.java index bdc30ba0db..d023e11123 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/BeanFactoryTypeConverter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/BeanFactoryTypeConverter.java @@ -124,7 +124,7 @@ public class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware } if (!String.class.isAssignableFrom(sourceType.getType())) { PropertyEditor editor = this.delegate.findCustomEditor(sourceType.getType(), null); - if (editor==null) { + if (editor == null) { editor = this.getDefaultEditor(sourceType.getType()); } if (editor != null) { // INT-1441 @@ -147,12 +147,12 @@ public class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware private PropertyEditor getDefaultEditor(Class sourceType) { PropertyEditor defaultEditor; if (this.haveCalledDelegateGetDefaultEditor) { - defaultEditor= this.delegate.getDefaultEditor(sourceType); + defaultEditor = this.delegate.getDefaultEditor(sourceType); } else { - synchronized(this) { + synchronized (this) { // not thread-safe - it builds the defaultEditors field in-place (SPR-10191) - defaultEditor= this.delegate.getDefaultEditor(sourceType); + defaultEditor = this.delegate.getDefaultEditor(sourceType); } this.haveCalledDelegateGetDefaultEditor = true; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/ErrorHandlingTaskExecutor.java b/spring-integration-core/src/main/java/org/springframework/integration/util/ErrorHandlingTaskExecutor.java index c1848b2827..e149dd4e2c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/ErrorHandlingTaskExecutor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/ErrorHandlingTaskExecutor.java @@ -54,7 +54,7 @@ public class ErrorHandlingTaskExecutor implements TaskExecutor { try { task.run(); } - catch (Throwable t) {//NOSONAR + catch (Throwable t) { //NOSONAR ErrorHandlingTaskExecutor.this.errorHandler.handleError(t); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingAnnotationUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingAnnotationUtils.java index 2149a6f9cc..3014bdb949 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingAnnotationUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingAnnotationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-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. @@ -145,6 +145,6 @@ public final class MessagingAnnotationUtils { return targetClass; } - private MessagingAnnotationUtils() {} + private MessagingAnnotationUtils() { } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingMethodInvokerHelper.java b/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingMethodInvokerHelper.java index 7572253e9e..795be37de7 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingMethodInvokerHelper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingMethodInvokerHelper.java @@ -770,13 +770,13 @@ public class MessagingMethodInvokerHelper extends AbstractExpressionEvaluator if (this.canProcessMessageList) { Type type = method.getGenericParameterTypes()[i]; Type parameterizedType = null; - if (type instanceof ParameterizedType){ - parameterizedType = ((ParameterizedType)type).getActualTypeArguments()[0]; - if (parameterizedType instanceof ParameterizedType){ + if (type instanceof ParameterizedType) { + parameterizedType = ((ParameterizedType) type).getActualTypeArguments()[0]; + if (parameterizedType instanceof ParameterizedType) { parameterizedType = ((ParameterizedType) parameterizedType).getRawType(); } } - if (parameterizedType != null && Message.class.isAssignableFrom((Class) parameterizedType)){ + if (parameterizedType != null && Message.class.isAssignableFrom((Class) parameterizedType)) { sb.append("messages.iterator()"); } else { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/SimplePool.java b/spring-integration-core/src/main/java/org/springframework/integration/util/SimplePool.java index 120da1d333..be6c143e4e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/SimplePool.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/SimplePool.java @@ -217,7 +217,7 @@ public class SimplePool implements Pool { } } else { - if (this.logger.isDebugEnabled()){ + if (this.logger.isDebugEnabled()) { this.logger.debug("Releasing " + item + " back to the pool"); } if (item != null) { @@ -228,7 +228,7 @@ public class SimplePool implements Pool { } } else { - if (this.logger.isDebugEnabled()){ + if (this.logger.isDebugEnabled()) { this.logger.debug("Ignoring release of " + item + " back to the pool - not in use"); } } @@ -242,7 +242,7 @@ public class SimplePool implements Pool { } private void doRemoveItem(T item) { - if (this.logger.isDebugEnabled()){ + if (this.logger.isDebugEnabled()) { this.logger.debug("Removing " + item + " from the pool"); } this.allocated.remove(item); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/StackTraceUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/util/StackTraceUtils.java index 76efffc06f..212aada8d8 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/StackTraceUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/StackTraceUtils.java @@ -25,7 +25,7 @@ package org.springframework.integration.util; */ public final class StackTraceUtils { - private StackTraceUtils() {} + private StackTraceUtils() { } /** * Traverses the stack trace element array looking for instances that contain the first or second diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/UpperBound.java b/spring-integration-core/src/main/java/org/springframework/integration/util/UpperBound.java index 718079d3b4..4da4c596a6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/UpperBound.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/UpperBound.java @@ -44,8 +44,8 @@ public final class UpperBound { this.semaphore = (capacity > 0) ? new Semaphore(capacity, true) : null; } - public int availablePermits(){ - if (this.semaphore == null){ + public int availablePermits() { + if (this.semaphore == null) { return Integer.MAX_VALUE; } return this.semaphore.availablePermits(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/WhileLockedProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/util/WhileLockedProcessor.java index f3e448dbb2..93cfb72790 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/WhileLockedProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/WhileLockedProcessor.java @@ -37,11 +37,11 @@ public abstract class WhileLockedProcessor { private final Object key; private final LockRegistry lockRegistry; - public WhileLockedProcessor(LockRegistry lockRegistry, Object key){ + public WhileLockedProcessor(LockRegistry lockRegistry, Object key) { this.key = key; this.lockRegistry = lockRegistry; } - public final void doWhileLocked() throws IOException{ + public final void doWhileLocked() throws IOException { Lock lock = this.lockRegistry.obtain(this.key); try { lock.lockInterruptibly(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/AggregatorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/AggregatorTests.java index 6ebc3d8206..5a14bcaaea 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/AggregatorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/AggregatorTests.java @@ -117,7 +117,7 @@ public class AggregatorTests { Message message = new GenericMessage("foo"); StopWatch stopwatch = new StopWatch(); stopwatch.start(); - for (int i=0; i < 120000; i++) { + for (int i = 0; i < 120000; i++) { if (i % 10000 == 0) { stopwatch.stop(); logger.warn("Sent " + i + " in " + stopwatch.getTotalTimeSeconds() + @@ -183,7 +183,7 @@ public class AggregatorTests { Message message = new GenericMessage("foo"); StopWatch stopwatch = new StopWatch(); stopwatch.start(); - for (int i=0; i < 120000; i++) { + for (int i = 0; i < 120000; i++) { if (i % 10000 == 0) { stopwatch.stop(); logger.warn("Sent " + i + " in " + stopwatch.getTotalTimeSeconds() + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/BarrierMessageHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/BarrierMessageHandlerTests.java index 38d1153a02..ee71576ead 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/BarrierMessageHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/BarrierMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-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. @@ -277,7 +277,7 @@ public class BarrierMessageHandlerTests { return new QueueChannel(); } - @ServiceActivator(inputChannel="in") + @ServiceActivator(inputChannel = "in") @Bean public BarrierMessageHandler barrier() { BarrierMessageHandler barrier = new BarrierMessageHandler(10000); @@ -285,7 +285,7 @@ public class BarrierMessageHandlerTests { return barrier; } - @ServiceActivator (inputChannel="release", poller=@Poller(fixedDelay="0")) + @ServiceActivator (inputChannel = "release", poller = @Poller(fixedDelay = "0")) @Bean public MessageHandler releaser() { return new MessageHandler() { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/CorrelatingMessageBarrierTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/CorrelatingMessageBarrierTests.java index b179161136..99df1b79ef 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/CorrelatingMessageBarrierTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/CorrelatingMessageBarrierTests.java @@ -126,7 +126,7 @@ public class CorrelatingMessageBarrierTests { } private Message testMessage() { - return MessageBuilder.withPayload((Object)"payload").build(); + return MessageBuilder.withPayload((Object) "payload").build(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/ExpressionEvaluatingCorrelationStrategyTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/ExpressionEvaluatingCorrelationStrategyTests.java index 62a82106c4..af42086592 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/ExpressionEvaluatingCorrelationStrategyTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/ExpressionEvaluatingCorrelationStrategyTests.java @@ -82,7 +82,7 @@ public class ExpressionEvaluatingCorrelationStrategyTests { } public static class CustomCorrelator { - public Object correlate(Object o){ + public Object correlate(Object o) { return o; } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingMessageGroupProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingMessageGroupProcessorTests.java index 1961b3aecc..b8ce8addc3 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingMessageGroupProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingMessageGroupProcessorTests.java @@ -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. @@ -331,7 +331,7 @@ public class MethodInvokingMessageGroupProcessorTests { MessageGroupProcessor processor = new MethodInvokingMessageGroupProcessor(new UnannotatedAggregator()); when(messageGroupMock.getMessages()).thenReturn(messagesUpForProcessing); Object result = processor.processMessageGroup(messageGroupMock); - assertTrue(((Message)result).getPayload() instanceof Iterator); + assertTrue(((Message) result).getPayload() instanceof Iterator); } @Test diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/ResequencingMessageGroupProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/ResequencingMessageGroupProcessorTests.java index 0070c42d6e..d588bc6b8b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/ResequencingMessageGroupProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/ResequencingMessageGroupProcessorTests.java @@ -41,14 +41,14 @@ public class ResequencingMessageGroupProcessorTests { @Test public void shouldProcessSequence() { Message prototypeMessage = MessageBuilder.withPayload("foo").setCorrelationId("x").setSequenceNumber(1).setSequenceSize(3).build(); - List> messages= new ArrayList>(); + List> messages = new ArrayList>(); Message message1 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(1).build(); Message message2 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(2).build(); Message message3 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(3).build(); messages.add(message1); messages.add(message2); messages.add(message3); - SimpleMessageGroup group = new SimpleMessageGroup(messages,"x"); + SimpleMessageGroup group = new SimpleMessageGroup(messages, "x"); List processedMessages = (List) processor.processMessageGroup(group); assertThat(processedMessages, hasItems(message1, message2, message3)); } @@ -57,14 +57,14 @@ public class ResequencingMessageGroupProcessorTests { @Test public void shouldPartiallProcessIncompleteSequence() { Message prototypeMessage = MessageBuilder.withPayload("foo").setCorrelationId("x").setSequenceNumber(1).setSequenceSize(4).build(); - List> messages= new ArrayList>(); + List> messages = new ArrayList>(); Message message2 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(4).build(); Message message1 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(1).build(); Message message3 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(3).build(); messages.add(message1); messages.add(message2); messages.add(message3); - SimpleMessageGroup group = new SimpleMessageGroup(messages,"x"); + SimpleMessageGroup group = new SimpleMessageGroup(messages, "x"); List processedMessages = (List) processor.processMessageGroup(group); assertThat(processedMessages, hasItems(message1)); assertThat(processedMessages.size(), is(1)); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AggregatorSupportedUseCasesTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AggregatorSupportedUseCasesTests.java index 03c43c69ce..8cafb5a5e0 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AggregatorSupportedUseCasesTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AggregatorSupportedUseCasesTests.java @@ -46,7 +46,7 @@ public class AggregatorSupportedUseCasesTests { private AggregatingMessageHandler defaultHandler = new AggregatingMessageHandler(processor, store); @Test - public void waitForAllDefaultReleaseStrategyWithLateArrivals(){ + public void waitForAllDefaultReleaseStrategyWithLateArrivals() { QueueChannel outputChannel = new QueueChannel(); QueueChannel discardChannel = new QueueChannel(); defaultHandler.setOutputChannel(outputChannel); @@ -55,7 +55,7 @@ public class AggregatorSupportedUseCasesTests { for (int i = 0; i < 5; i++) { defaultHandler.handleMessage(MessageBuilder.withPayload(i).setSequenceSize(5).setCorrelationId("A").setSequenceNumber(i).build()); } - assertEquals(5, ((List)outputChannel.receive(0).getPayload()).size()); + assertEquals(5, ((List) outputChannel.receive(0).getPayload()).size()); assertNull(discardChannel.receive(0)); assertEquals(0, store.getMessageGroup("A").getMessages().size()); @@ -71,7 +71,7 @@ public class AggregatorSupportedUseCasesTests { } @Test - public void waitForAllCustomReleaseStrategyWithLateArrivals(){ + public void waitForAllCustomReleaseStrategyWithLateArrivals() { QueueChannel outputChannel = new QueueChannel(); QueueChannel discardChannel = new QueueChannel(); defaultHandler.setOutputChannel(outputChannel); @@ -81,7 +81,7 @@ public class AggregatorSupportedUseCasesTests { for (int i = 0; i < 5; i++) { defaultHandler.handleMessage(MessageBuilder.withPayload(i).setCorrelationId("A").build()); } - assertEquals(5, ((List)outputChannel.receive(0).getPayload()).size()); + assertEquals(5, ((List) outputChannel.receive(0).getPayload()).size()); assertNull(discardChannel.receive(0)); assertEquals(0, store.getMessageGroup("A").getMessages().size()); @@ -97,7 +97,7 @@ public class AggregatorSupportedUseCasesTests { } @Test - public void firstBest(){ + public void firstBest() { QueueChannel outputChannel = new QueueChannel(); QueueChannel discardChannel = new QueueChannel(); defaultHandler.setOutputChannel(outputChannel); @@ -107,7 +107,7 @@ public class AggregatorSupportedUseCasesTests { for (int i = 0; i < 5; i++) { defaultHandler.handleMessage(MessageBuilder.withPayload(i).setCorrelationId("A").build()); } - assertEquals(1, ((List)outputChannel.receive(0).getPayload()).size()); + assertEquals(1, ((List) outputChannel.receive(0).getPayload()).size()); assertNotNull(discardChannel.receive(0)); assertNotNull(discardChannel.receive(0)); assertNotNull(discardChannel.receive(0)); @@ -115,7 +115,7 @@ public class AggregatorSupportedUseCasesTests { } @Test - public void batchingWithoutLeftovers(){ + public void batchingWithoutLeftovers() { QueueChannel outputChannel = new QueueChannel(); QueueChannel discardChannel = new QueueChannel(); defaultHandler.setOutputChannel(outputChannel); @@ -126,13 +126,13 @@ public class AggregatorSupportedUseCasesTests { for (int i = 0; i < 10; i++) { defaultHandler.handleMessage(MessageBuilder.withPayload(i).setCorrelationId("A").build()); } - assertEquals(5, ((List)outputChannel.receive(0).getPayload()).size()); - assertEquals(5, ((List)outputChannel.receive(0).getPayload()).size()); + assertEquals(5, ((List) outputChannel.receive(0).getPayload()).size()); + assertEquals(5, ((List) outputChannel.receive(0).getPayload()).size()); assertNull(discardChannel.receive(0)); } @Test - public void batchingWithLeftovers(){ + public void batchingWithLeftovers() { QueueChannel outputChannel = new QueueChannel(); QueueChannel discardChannel = new QueueChannel(); defaultHandler.setOutputChannel(outputChannel); @@ -143,8 +143,8 @@ public class AggregatorSupportedUseCasesTests { for (int i = 0; i < 12; i++) { defaultHandler.handleMessage(MessageBuilder.withPayload(i).setCorrelationId("A").build()); } - assertEquals(5, ((List)outputChannel.receive(0).getPayload()).size()); - assertEquals(5, ((List)outputChannel.receive(0).getPayload()).size()); + assertEquals(5, ((List) outputChannel.receive(0).getPayload()).size()); + assertEquals(5, ((List) outputChannel.receive(0).getPayload()).size()); assertNull(discardChannel.receive(0)); assertEquals(2, store.getMessageGroup("A").getMessages().size()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AnnotationAggregatorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AnnotationAggregatorTests.java index 6a68adb004..0589916adf 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AnnotationAggregatorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/integration/AnnotationAggregatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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,8 +55,8 @@ public class AnnotationAggregatorTests { @SuppressWarnings("unchecked") Message result = (Message) output.receive(); String payload = result.getPayload(); - assertTrue("Wrong payload: "+payload, payload.matches(".*payload.*?=a.*")); - assertTrue("Wrong payload: "+payload, payload.matches(".*payload.*?=b.*")); + assertTrue("Wrong payload: " + payload, payload.matches(".*payload.*?=a.*")); + assertTrue("Wrong payload: " + payload, payload.matches(".*payload.*?=b.*")); } @SuppressWarnings("unused") @@ -69,7 +69,7 @@ public class AnnotationAggregatorTests { @ReleaseStrategy public boolean release(final List> messages) { - return messages.size()>1; + return messages.size() > 1; } @CorrelationStrategy diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/AggregatorWithCustomReleaseStrategyTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/AggregatorWithCustomReleaseStrategyTests.java index fb73ed427e..bf2cf957b5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/AggregatorWithCustomReleaseStrategyTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/AggregatorWithCustomReleaseStrategyTests.java @@ -54,7 +54,7 @@ public class AggregatorWithCustomReleaseStrategyTests { private boolean shouldRun; { - 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; @@ -88,7 +88,7 @@ public class AggregatorWithCustomReleaseStrategyTests { } @Test - public void testAggregatorsUnderStressWithConcurrency() throws Exception{ + public void testAggregatorsUnderStressWithConcurrency() throws Exception { // this is to be sure after INT-2502 for (int i = 0; i < 10; i++) { this.validateSequenceSizeHasNoAffectCustomCorrelator(); @@ -98,7 +98,7 @@ public class AggregatorWithCustomReleaseStrategyTests { } } - public void validateSequenceSizeHasNoAffectCustomCorrelator() throws Exception{ + public void validateSequenceSizeHasNoAffectCustomCorrelator() throws Exception { AbstractApplicationContext context = new ClassPathXmlApplicationContext("aggregator-with-custom-release-strategy.xml", this.getClass()); final MessageChannel inputChannel = context.getBean("aggregationChannelCustomCorrelation", MessageChannel.class); @@ -112,7 +112,7 @@ public class AggregatorWithCustomReleaseStrategyTests { @Override public void run() { inputChannel.send(MessageBuilder.withPayload("foo"). - setHeader("correlation", "foo"+counter).build()); + setHeader("correlation", "foo" + counter).build()); latch.countDown(); } }); @@ -120,7 +120,7 @@ public class AggregatorWithCustomReleaseStrategyTests { @Override public void run() { inputChannel.send(MessageBuilder.withPayload("bar"). - setHeader("correlation", "foo"+counter).build()); + setHeader("correlation", "foo" + counter).build()); latch.countDown(); } }); @@ -128,7 +128,7 @@ public class AggregatorWithCustomReleaseStrategyTests { @Override public void run() { inputChannel.send(MessageBuilder.withPayload("baz"). - setHeader("correlation", "foo"+counter).build()); + setHeader("correlation", "foo" + counter).build()); latch.countDown(); } }); @@ -138,7 +138,7 @@ public class AggregatorWithCustomReleaseStrategyTests { Message message = resultChannel.receive(1000); int counter = 0; - while(message != null){ + while (message != null) { counter++; message = resultChannel.receive(1000); } @@ -146,7 +146,7 @@ public class AggregatorWithCustomReleaseStrategyTests { context.close(); } - public void validateSequenceSizeHasNoAffectWithSplitter() throws Exception{ + public void validateSequenceSizeHasNoAffectWithSplitter() throws Exception { AbstractApplicationContext context = new ClassPathXmlApplicationContext("aggregator-with-custom-release-strategy.xml", this.getClass()); final MessageChannel inputChannel = context.getBean("in", MessageChannel.class); @@ -182,7 +182,7 @@ public class AggregatorWithCustomReleaseStrategyTests { Message message = resultChannel.receive(1000); int counter = 0; - while(message != null && ++counter < 7200){ + while (message != null && ++counter < 7200) { message = resultChannel.receive(1000); } assertEquals(7200, counter); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aop/AnnotationConfigRegistrationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aop/AnnotationConfigRegistrationTests.java index 883fe0f55d..4eb1e5e24a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aop/AnnotationConfigRegistrationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aop/AnnotationConfigRegistrationTests.java @@ -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. @@ -72,7 +72,7 @@ public class AnnotationConfigRegistrationTests { public static class TestBean { - @Publisher(channel="annotationConfigRegistrationTest") + @Publisher(channel = "annotationConfigRegistrationTest") @Payload("#return + #args.lname") public String setName(String fname, String lname, @Header("x") int num) { return fname + " " + lname; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingAnnotationUsageTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingAnnotationUsageTests.java index a38e12827e..f0518c5619 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingAnnotationUsageTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingAnnotationUsageTests.java @@ -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. @@ -81,18 +81,18 @@ public class MessagePublishingAnnotationUsageTests { public static class TestBean { - @Publisher(channel="messagePublishingAnnotationUsageTestChannel") + @Publisher(channel = "messagePublishingAnnotationUsageTestChannel") public String defaultPayload(String fname, @Header("last") String lname) { return fname + " " + lname; } - @Publisher(channel="messagePublishingAnnotationUsageTestChannel") + @Publisher(channel = "messagePublishingAnnotationUsageTestChannel") @Payload public String defaultPayloadButExplicitAnnotation(String fname, @Header String lname) { return fname + " " + lname; } - @Publisher(channel="messagePublishingAnnotationUsageTestChannel") + @Publisher(channel = "messagePublishingAnnotationUsageTestChannel") public String argumentAsPayload(@Payload String fname, @Header String lname) { return fname + " " + lname; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingInterceptorUsageTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingInterceptorUsageTests.java index efc503373a..45853fbaa7 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingInterceptorUsageTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingInterceptorUsageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -42,7 +42,7 @@ public class MessagePublishingInterceptorUsageTests { private QueueChannel channel; @Test - public void demoMessagePublishingInterceptor(){ + public void demoMessagePublishingInterceptor() { String name = testBean.setName("John", "Doe"); Assert.assertNotNull(name); Message message = channel.receive(1000); @@ -54,7 +54,7 @@ public class MessagePublishingInterceptorUsageTests { public static class TestBean { - public String setName(String fname, String lname){ + public String setName(String fname, String lname) { return fname + " " + lname; } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aop/MethodAnnotationPublisherMetadataSourceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aop/MethodAnnotationPublisherMetadataSourceTests.java index a7d31139e7..03b5bbbb26 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aop/MethodAnnotationPublisherMetadataSourceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aop/MethodAnnotationPublisherMetadataSourceTests.java @@ -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. @@ -120,25 +120,25 @@ public class MethodAnnotationPublisherMetadataSourceTests { public void methodWithPayloadAnnotation(String arg1, int arg2) { } - @Publisher(channel="foo") + @Publisher(channel = "foo") @Payload("#return") public String methodWithChannelAndExplicitReturnAsPayload() { return "hello"; } - @Publisher(channel="foo") + @Publisher(channel = "foo") @Payload public String methodWithChannelAndEmptyPayloadAnnotation() { return "hello"; } - @Publisher(channel="foo") + @Publisher(channel = "foo") @Payload("#method") public void methodWithVoidReturnAndMethodNameAsPayload() { } - @Publisher(channel="foo") + @Publisher(channel = "foo") @Payload("#return") public void methodWithVoidReturnAndReturnValueAsPayload() { } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aop/PublisherAnnotationAdvisorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aop/PublisherAnnotationAdvisorTests.java index f604b49a64..0e06f96a6d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aop/PublisherAnnotationAdvisorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aop/PublisherAnnotationAdvisorTests.java @@ -137,17 +137,17 @@ public class PublisherAnnotationAdvisorTests { static class AnnotationAtMethodLevelTestBeanImpl implements TestBean, TestVoidBean { - @Publisher(channel="testChannel") + @Publisher(channel = "testChannel") public String test() { return "foo"; } - @Publisher(channel="testChannel") - public void testVoidMethod(@Payload String s) {} + @Publisher(channel = "testChannel") + public void testVoidMethod(@Payload String s) { } } - @Publisher(channel="testChannel") + @Publisher(channel = "testChannel") static class AnnotationAtClassLevelTestBeanImpl implements TestBean { public String test() { @@ -159,7 +159,7 @@ public class PublisherAnnotationAdvisorTests { @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) - @Publisher(channel="testMetaChannel") + @Publisher(channel = "testMetaChannel") public @interface TestMetaPublisher { } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/bus/DirectChannelSubscriptionTests.java b/spring-integration-core/src/test/java/org/springframework/integration/bus/DirectChannelSubscriptionTests.java index 18fed6e9de..db0473fcd7 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/bus/DirectChannelSubscriptionTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/bus/DirectChannelSubscriptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -134,7 +134,7 @@ public class DirectChannelSubscriptionTests { @MessageEndpoint public static class TestEndpoint { - @ServiceActivator(inputChannel="sourceChannel", outputChannel="targetChannel") + @ServiceActivator(inputChannel = "sourceChannel", outputChannel = "targetChannel") public Message handle(Message message) { return new GenericMessage(message.getPayload() + "-from-annotated-endpoint"); } @@ -144,7 +144,7 @@ public class DirectChannelSubscriptionTests { @MessageEndpoint public static class FailingTestEndpoint { - @ServiceActivator(inputChannel="sourceChannel", outputChannel="targetChannel") + @ServiceActivator(inputChannel = "sourceChannel", outputChannel = "targetChannel") public Message handle(Message message) { throw new RuntimeException("intentional test failure"); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/ChannelPurgerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/ChannelPurgerTests.java index 3c053898cf..e7c6ba322f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/ChannelPurgerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/ChannelPurgerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -161,13 +161,13 @@ public class ChannelPurgerTests { assertNotNull(channel2.receive(0)); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testNullChannel() { QueueChannel channel = null; new ChannelPurger(channel); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testEmptyChannelArray() { QueueChannel[] channels = new QueueChannel[0]; new ChannelPurger(channels); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/DirectChannelParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/DirectChannelParserTests.java index a1eb459ab5..86ef0e17a4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/DirectChannelParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/DirectChannelParserTests.java @@ -38,7 +38,7 @@ public class DirectChannelParserTests { "directChannelParserTests.xml", DirectChannelParserTests.class); Object channel = context.getBean("channel"); assertEquals(DirectChannel.class, channel.getClass()); - DirectFieldAccessor dcAccessor = new DirectFieldAccessor(((DirectChannel)channel).getDispatcher()); + DirectFieldAccessor dcAccessor = new DirectFieldAccessor(((DirectChannel) channel).getDispatcher()); assertTrue(dcAccessor.getPropertyValue("loadBalancingStrategy") instanceof RoundRobinLoadBalancingStrategy); context.close(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/MixedDispatcherConfigurationScenarioTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/MixedDispatcherConfigurationScenarioTests.java index 234bffd1d1..09c0077e94 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/MixedDispatcherConfigurationScenarioTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/MixedDispatcherConfigurationScenarioTests.java @@ -109,12 +109,12 @@ public class MixedDispatcherConfigurationScenarioTests { try { channel.send(message); } - catch (Exception e) {/* ignore */ + catch (Exception e) { /* ignore */ } try { channel.send(message); } - catch (Exception e) {/* ignore */ + catch (Exception e) { /* ignore */ } verify(handlerA, times(2)).handleMessage(message); verify(handlerB, times(0)).handleMessage(message); @@ -232,19 +232,19 @@ public class MixedDispatcherConfigurationScenarioTests { try { channel.send(message); } - catch (Exception e) {/* ignore */ + catch (Exception e) { /* ignore */ } inOrder.verify(handlerA).handleMessage(message); try { channel.send(message); } - catch (Exception e) {/* ignore */ + catch (Exception e) { /* ignore */ } inOrder.verify(handlerB).handleMessage(message); try { channel.send(message); } - catch (Exception e) {/* ignore */ + catch (Exception e) { /* ignore */ } inOrder.verify(handlerC).handleMessage(message); @@ -383,7 +383,7 @@ public class MixedDispatcherConfigurationScenarioTests { try { channel.send(message); } - catch (Exception e) {/* ignore */ + catch (Exception e) { /* ignore */ } inOrder.verify(handlerA).handleMessage(message); inOrder.verify(handlerB).handleMessage(message); @@ -391,7 +391,7 @@ public class MixedDispatcherConfigurationScenarioTests { try { channel.send(message); } - catch (Exception e) {/* ignore */ + catch (Exception e) { /* ignore */ } inOrder.verify(handlerA).handleMessage(message); inOrder.verify(handlerB).handleMessage(message); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/P2pChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/P2pChannelTests.java index 61d17d2343..894a3fb909 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/P2pChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/P2pChannelTests.java @@ -33,8 +33,9 @@ import org.junit.Test; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.springframework.messaging.MessageHandler; + import org.springframework.integration.dispatcher.MessageDispatcher; +import org.springframework.messaging.MessageHandler; import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils.FieldCallback; @@ -78,14 +79,17 @@ public class P2pChannelTests { when(logger.isInfoEnabled()).thenReturn(true); final List logs = new ArrayList(); doAnswer(new Answer() { + @Override public Object answer(InvocationOnMock invocation) throws Throwable { logs.add((String) invocation.getArguments()[0]); return null; - }}).when(logger).info(Mockito.anyString()); + } + }).when(logger).info(Mockito.anyString()); ReflectionUtils.doWithFields(AbstractMessageChannel.class, new FieldCallback() { + @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { - if ("logger".equals(field.getName())){ + if ("logger".equals(field.getName())) { field.setAccessible(true); field.set(channel, logger); } @@ -120,9 +124,10 @@ public class P2pChannelTests { when(logger.isInfoEnabled()).thenReturn(true); ReflectionUtils.doWithFields(AbstractMessageChannel.class, new FieldCallback() { + @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { - if ("logger".equals(field.getName())){ + if ("logger".equals(field.getName())) { field.setAccessible(true); field.set(channel, logger); } @@ -142,9 +147,10 @@ public class P2pChannelTests { when(logger.isInfoEnabled()).thenReturn(true); ReflectionUtils.doWithFields(AbstractMessageChannel.class, new FieldCallback() { + @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { - if ("logger".equals(field.getName())){ + if ("logger".equals(field.getName())) { field.setAccessible(true); field.set(channel, logger); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/PriorityChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/PriorityChannelTests.java index 6e4db52489..184a3f641c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/PriorityChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/PriorityChannelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -53,7 +53,7 @@ public class PriorityChannelTests { } @Test - public void testDefaultComparatorWithTimestampFallback() throws Exception{ + public void testDefaultComparatorWithTimestampFallback() throws Exception { PriorityChannel channel = new PriorityChannel(); for (int i = 0; i < 1000; i++) { channel.send(new GenericMessage(i)); @@ -86,7 +86,7 @@ public class PriorityChannelTests { // although this test has no assertions it results in ConcurrentModificationException // if executed before changes for INT-2508 @Test - public void testPriorityChannelWithConcurrentModification() throws Exception{ + public void testPriorityChannelWithConcurrentModification() throws Exception { final PriorityChannel channel = new PriorityChannel(); final Message message = new GenericMessage("hello"); for (int i = 0; i < 1000; i++) { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelCapacityPlaceholderTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelCapacityPlaceholderTests.java index 6f4de3d9e1..8cbc89e50a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelCapacityPlaceholderTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelCapacityPlaceholderTests.java @@ -54,7 +54,7 @@ public class ChannelCapacityPlaceholderTests { public interface TestService { - @org.springframework.integration.annotation.Gateway(requestChannel="channel") + @org.springframework.integration.annotation.Gateway(requestChannel = "channel") void test(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelWithCustomQueueParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelWithCustomQueueParserTests.java index d155316adb..169519945f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelWithCustomQueueParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelWithCustomQueueParserTests.java @@ -63,7 +63,7 @@ public class ChannelWithCustomQueueParserTests { Object queue = accessor.getPropertyValue("queue"); assertNotNull(queue); assertThat(queue, is(instanceOf(ArrayBlockingQueue.class))); - assertThat(((BlockingQueue)queue).remainingCapacity(), is(2)); + assertThat(((BlockingQueue) queue).remainingCapacity(), is(2)); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ThreadLocalChannelParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ThreadLocalChannelParserTests.java index 7c67df3899..9fd80d4e45 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ThreadLocalChannelParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ThreadLocalChannelParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -110,7 +110,7 @@ public class ThreadLocalChannelParserTests { public void testInterceptor() { int before = interceptor.getSendCount(); channelWithInterceptor.send(new GenericMessage("test")); - assertEquals(before+1, interceptor.getSendCount()); + assertEquals(before + 1, interceptor.getSendCount()); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java index 9aeedea4c4..522084ed43 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -248,7 +248,7 @@ public class ChannelInterceptorTests { } @Test - public void testInterceptorBeanWithPNamespace(){ + public void testInterceptorBeanWithPNamespace() { ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("ChannelInterceptorTests-context.xml", ChannelInterceptorTests.class); ChannelInterceptorAware channel = ac.getBean("input", AbstractMessageChannel.class); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java index 92b30cbb43..42c253a668 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java @@ -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. @@ -57,17 +57,17 @@ public class GlobalChannelInterceptorTests { @Test - public void validateGlobalInterceptor() throws Exception{ + public void validateGlobalInterceptor() throws Exception { Map channels = applicationContext.getBeansOfType(ChannelInterceptorAware.class); for (String channelName : channels.keySet()) { ChannelInterceptorAware channel = channels.get(channelName); - if (channelName.equals("nullChannel")){ + if (channelName.equals("nullChannel")) { continue; } ChannelInterceptor[] interceptors = channel.getChannelInterceptors().toArray(new ChannelInterceptor[channel.getChannelInterceptors().size()]); - if (channelName.equals("inputA")){ // 328741 - Assert.assertTrue(interceptors.length ==10); + if (channelName.equals("inputA")) { // 328741 + Assert.assertTrue(interceptors.length == 10); Assert.assertEquals("interceptor-three", interceptors[0].toString()); Assert.assertEquals("interceptor-two", interceptors[1].toString()); Assert.assertEquals("interceptor-eight", interceptors[2].toString()); @@ -175,7 +175,7 @@ public class GlobalChannelInterceptorTests { } } - public static class TestInterceptor implements MethodInterceptor{ + public static class TestInterceptor implements MethodInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/MessageSelectingInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/MessageSelectingInterceptorTests.java index 5350fc29eb..802c1660d9 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/MessageSelectingInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/MessageSelectingInterceptorTests.java @@ -43,7 +43,7 @@ public class MessageSelectingInterceptorTests { assertTrue(channel.send(new GenericMessage("test1"))); } - @Test(expected=MessageDeliveryException.class) + @Test(expected = MessageDeliveryException.class) public void testSingleSelectorRejects() { final AtomicInteger counter = new AtomicInteger(); MessageSelector selector = new TestMessageSelector(false, counter); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/registry/HeaderChannelRegistryTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/registry/HeaderChannelRegistryTests.java index 67fdf7c3a2..c3d953a4e6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/registry/HeaderChannelRegistryTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/registry/HeaderChannelRegistryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-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. @@ -226,7 +226,7 @@ public class HeaderChannelRegistryTests { when(beanFactory.getBean(IntegrationContextUtils.INTEGRATION_HEADER_CHANNEL_REGISTRY_BEAN_NAME, HeaderChannelRegistry.class)) .thenReturn(mock(HeaderChannelRegistry.class)); - doAnswer(new Answer(){ + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { @@ -238,7 +238,7 @@ public class HeaderChannelRegistryTests { resolver.resolveDestination("foo"); fail("Expected exception"); } - catch (DestinationResolutionException e){ + catch (DestinationResolutionException e) { assertThat(e.getMessage(), Matchers.containsString("failed to look up MessageChannel with name 'foo' in the BeanFactory.")); } @@ -248,7 +248,7 @@ public class HeaderChannelRegistryTests { public void testBFCRNoRegistry() { BeanFactoryChannelResolver resolver = new BeanFactoryChannelResolver(); BeanFactory beanFactory = mock(BeanFactory.class); - doAnswer(new Answer(){ + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { @@ -260,7 +260,7 @@ public class HeaderChannelRegistryTests { resolver.resolveDestination("foo"); fail("Expected exception"); } - catch (DestinationResolutionException e){ + catch (DestinationResolutionException e) { assertThat(e.getMessage(), Matchers.containsString("failed to look up MessageChannel with name 'foo' in the BeanFactory " + "(and there is no HeaderChannelRegistry present).")); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests.java index 88f713f896..df19ce7a19 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -79,7 +79,7 @@ public class ChannelWithMessageStoreParserTests { Message result = output.receive(100); assertEquals("hello", result.getPayload()); - assertEquals(0, messageGroupStore.getMessageGroup(BASE_PACKAGE+".store:output").size()); + assertEquals(0, messageGroupStore.getMessageGroup(BASE_PACKAGE + ".store:output").size()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/MaxValueReleaseStrategy.java b/spring-integration-core/src/test/java/org/springframework/integration/config/MaxValueReleaseStrategy.java index b3ba9db436..e04abfdebd 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/MaxValueReleaseStrategy.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/MaxValueReleaseStrategy.java @@ -24,7 +24,7 @@ public class MaxValueReleaseStrategy { private long maxValue; - public MaxValueReleaseStrategy(long maxValue){ + public MaxValueReleaseStrategy(long maxValue) { this.maxValue = maxValue; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ResequencerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ResequencerParserTests.java index 13181241ee..a78035365c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ResequencerParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ResequencerParserTests.java @@ -139,7 +139,7 @@ public class ResequencerParserTests { } @Test - public void shouldSetReleasePartialSequencesFlag(){ + public void shouldSetReleasePartialSequencesFlag() { EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("completelyDefinedResequencer"); ResequencingMessageHandler resequencer = TestUtils.getPropertyValue(endpoint, "handler", ResequencingMessageHandler.class); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ServiceActivatorAnnotationPostProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ServiceActivatorAnnotationPostProcessorTests.java index fe8ff358a0..8c1b30efa0 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ServiceActivatorAnnotationPostProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ServiceActivatorAnnotationPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -89,7 +89,7 @@ public class ServiceActivatorAnnotationPostProcessorTests { super(latch); } - @ServiceActivator(inputChannel="testChannel") + @ServiceActivator(inputChannel = "testChannel") public void testMethod(String messageText) { this.messageText = messageText; this.countDown(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/TestAggregatorBean.java b/spring-integration-core/src/test/java/org/springframework/integration/config/TestAggregatorBean.java index a123147b4b..5802899879 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/TestAggregatorBean.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/TestAggregatorBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -49,7 +49,7 @@ public class TestAggregatorBean { } } Message returnedMessage = new GenericMessage(buffer.toString()); - if (correlationId!=null) { + if (correlationId != null) { aggregatedMessages.put(correlationId, returnedMessage); } return returnedMessage; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/AnnotatedTestService.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/AnnotatedTestService.java index 301586904f..18b26a3d16 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/AnnotatedTestService.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/AnnotatedTestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -26,7 +26,7 @@ import org.springframework.integration.endpoint.annotation.TestService; @MessageEndpoint public class AnnotatedTestService implements TestService { - @ServiceActivator(inputChannel="inputChannel", outputChannel="outputChannel") + @ServiceActivator(inputChannel = "inputChannel", outputChannel = "outputChannel") public String sayHello(String name) { return "hello " + name; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/AnnotatedTestServiceWithAdvice.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/AnnotatedTestServiceWithAdvice.java index 669be3c6b6..e42c533964 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/AnnotatedTestServiceWithAdvice.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/AnnotatedTestServiceWithAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-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. @@ -26,12 +26,12 @@ import org.springframework.integration.endpoint.annotation.TestService; @MessageEndpoint public class AnnotatedTestServiceWithAdvice implements TestService { - @ServiceActivator(inputChannel="inputChannel", outputChannel="outputChannel") + @ServiceActivator(inputChannel = "inputChannel", outputChannel = "outputChannel") public String sayHello(String name) { return "hello " + name; } - @ServiceActivator(inputChannel="advisedIn", outputChannel="advisedOut", adviceChain="advice") + @ServiceActivator(inputChannel = "advisedIn", outputChannel = "advisedOut", adviceChain = "advice") public String sayHelloWithAdvice(String name) { return "hello " + name; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorAopIntegrationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorAopIntegrationTests.java index 2e3b31d2c9..0d25f1dc24 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorAopIntegrationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorAopIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 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. @@ -92,7 +92,7 @@ public class MessagingAnnotationPostProcessorAopIntegrationTests { @MessageEndpoint public static class AnnotatedService { - @ServiceActivator(inputChannel = "input", outputChannel="output") + @ServiceActivator(inputChannel = "input", outputChannel = "output") public int addOne(AtomicInteger n) { return n.addAndGet(1); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorTests.java index 493e618e8c..3d6ffd7803 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorTests.java @@ -335,7 +335,7 @@ public class MessagingAnnotationPostProcessorTests { return this.messageText; } - @ServiceActivator(inputChannel="testChannel") + @ServiceActivator(inputChannel = "testChannel") public void countdown(String input) { this.messageText = input; latch.countDown(); @@ -356,7 +356,7 @@ public class MessagingAnnotationPostProcessorTests { private static class SimpleAnnotatedEndpointImplementation implements SimpleAnnotatedEndpointInterface { @Override - @ServiceActivator(inputChannel="inputChannel", outputChannel="outputChannel") + @ServiceActivator(inputChannel = "inputChannel", outputChannel = "outputChannel") public String test(String input) { return "test-" + input; } @@ -368,7 +368,7 @@ public class MessagingAnnotationPostProcessorTests { public final AtomicBoolean invoked = new AtomicBoolean(); - @ServiceActivator(inputChannel="inputChannel") + @ServiceActivator(inputChannel = "inputChannel") public String test(String s) { return s + s; } @@ -387,7 +387,7 @@ public class MessagingAnnotationPostProcessorTests { @MessageEndpoint private static class TransformerAnnotationTestBean { - @Transformer(inputChannel="inputChannel", outputChannel="outputChannel") + @Transformer(inputChannel = "inputChannel", outputChannel = "outputChannel") public String transformBefore(String input) { return input.toUpperCase(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationsWithBeanAnnotationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationsWithBeanAnnotationTests.java index 315054d892..f2cbd6f057 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationsWithBeanAnnotationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationsWithBeanAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-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. @@ -96,7 +96,7 @@ public class MessagingAnnotationsWithBeanAnnotationTests { @Autowired private PollableChannel discardChannel; - @Resource(name="collector") + @Resource(name = "collector") private List> collector; @Autowired(required = false) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/RouterAnnotationPostProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/RouterAnnotationPostProcessorTests.java index 36fd54843d..8c2d7414b0 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/RouterAnnotationPostProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/RouterAnnotationPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -67,7 +67,7 @@ public class RouterAnnotationPostProcessorTests { @MessageEndpoint public static class TestRouter { - @Router(inputChannel="input", defaultOutputChannel="output") + @Router(inputChannel = "input", defaultOutputChannel = "output") public String test(String s) { return null; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/SubscriberOrderTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/SubscriberOrderTests.java index 00f5d248a4..dc85736645 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/SubscriberOrderTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/SubscriberOrderTests.java @@ -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. @@ -165,31 +165,31 @@ public class SubscriberOrderTests { } @Order(3) - @ServiceActivator(inputChannel="input") + @ServiceActivator(inputChannel = "input") public void third(Message message) { this.handle(3, message); } @Override - @ServiceActivator(inputChannel="input") + @ServiceActivator(inputChannel = "input") public void second(Message message) { this.handle(2, message); } @Order(1) - @ServiceActivator(inputChannel="input") + @ServiceActivator(inputChannel = "input") public void first(Message message) { this.handle(1, message); } @Order(5) - @ServiceActivator(inputChannel="input") + @ServiceActivator(inputChannel = "input") public void fifth(Message message) { this.handle(5, message); } @Override - @ServiceActivator(inputChannel="input") + @ServiceActivator(inputChannel = "input") public void fourth(Message message) { this.handle(4, message); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithDefaultAggregator.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithDefaultAggregator.java index 469333b3e4..b4f31c645e 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithDefaultAggregator.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithDefaultAggregator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -37,7 +37,7 @@ public class TestAnnotatedEndpointWithDefaultAggregator { private final ConcurrentMap> aggregatedMessages = new ConcurrentHashMap>(); - @Aggregator(inputChannel="inputChannel") + @Aggregator(inputChannel = "inputChannel") public Message aggregatingMethod(List> messages) { List> sortableList = new ArrayList>(messages); Collections.sort(sortableList, new MessageSequenceComparator()); @@ -46,7 +46,7 @@ public class TestAnnotatedEndpointWithDefaultAggregator { for (Message message : sortableList) { buffer.append(message.getPayload().toString()); if (null == correlationId) { - correlationId =new IntegrationMessageHeaderAccessor(message).getCorrelationId(); + correlationId = new IntegrationMessageHeaderAccessor(message).getCorrelationId(); } } Message returnedMessage = new GenericMessage(buffer.toString()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TypeConvertingTestEndpoint.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TypeConvertingTestEndpoint.java index 01406aa3f5..8621e0e2b4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TypeConvertingTestEndpoint.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TypeConvertingTestEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -25,7 +25,7 @@ import org.springframework.integration.annotation.ServiceActivator; @MessageEndpoint public class TypeConvertingTestEndpoint { - @ServiceActivator(inputChannel="inputChannel", outputChannel="outputChannel") + @ServiceActivator(inputChannel = "inputChannel", outputChannel = "outputChannel") public int multiplyByTwo(int number) { return number * 2; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ChainElementsFailureTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ChainElementsFailureTests.java index f61996967c..a363447668 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ChainElementsFailureTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ChainElementsFailureTests.java @@ -261,7 +261,7 @@ public class ChainElementsFailureTests { } public static class SampleService { - public String echo(String value){ + public String echo(String value) { return value; } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ChannelAutoCreationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ChannelAutoCreationTests.java index bb5e978797..cb28f1c159 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ChannelAutoCreationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ChannelAutoCreationTests.java @@ -28,22 +28,22 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class ChannelAutoCreationTests { @Test // no assertions since it validates that no exception is thrown - public void testEnablingAutoChannelCreationBeforeWithCustom(){ + public void testEnablingAutoChannelCreationBeforeWithCustom() { new ClassPathXmlApplicationContext("TestEnableChannelAutoCreation-before-context.xml", this.getClass()); } @Test // no assertions since it validates that no exception is thrown - public void testEnablingAutoChannelCreationAfterWithCustom(){ + public void testEnablingAutoChannelCreationAfterWithCustom() { new ClassPathXmlApplicationContext("TestEnableChannelAutoCreation-after-context.xml", this.getClass()); } - @Test(expected=BeanCreationException.class) - public void testDisablingAutoChannelCreationAfter(){ + @Test(expected = BeanCreationException.class) + public void testDisablingAutoChannelCreationAfter() { new ClassPathXmlApplicationContext("TestDisableChannelAutoCreation-after-context.xml", this.getClass()); } - @Test(expected=BeanCreationException.class) - public void testDisablingAutoChannelCreationBefore(){ + @Test(expected = BeanCreationException.class) + public void testDisablingAutoChannelCreationBefore() { new ClassPathXmlApplicationContext("TestDisableChannelAutoCreation-before-context.xml", this.getClass()); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusRecipientListRouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusRecipientListRouterTests.java index 6188ffeaa9..0e53ef1021 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusRecipientListRouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusRecipientListRouterTests.java @@ -65,7 +65,7 @@ public class ControlBusRecipientListRouterTests { private MessageChannel channel; @Before - public void aa(){ + public void aa() { context.start(); } @@ -142,8 +142,8 @@ public class ControlBusRecipientListRouterTests { MessagingTemplate messagingTemplate = new MessagingTemplate(); messagingTemplate.setReceiveTimeout(1000); - Map map = new HashMap(); - map.put("channel6","true"); + Map map = new HashMap(); + map.put("channel6", "true"); Message message = MessageBuilder.withPayload("@'simpleRouter.handler'.setRecipientMappings(headers.recipientMap)").setHeader("recipientMap", map).build(); this.input.send(message); message = new GenericMessage(1); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ConverterParserWithExistingConversionServiceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ConverterParserWithExistingConversionServiceTests.java index 6d6648734a..77bed4b7e0 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ConverterParserWithExistingConversionServiceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ConverterParserWithExistingConversionServiceTests.java @@ -48,13 +48,13 @@ public class ConverterParserWithExistingConversionServiceTests { private ConversionService conversionService; @Test - public void testConversionServiceAvailability(){ + public void testConversionServiceAvailability() { Assert.isTrue(applicationContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME).equals(conversionService)); Assert.isTrue(conversionService.canConvert(TestBean1.class, TestBean2.class)); Assert.isTrue(conversionService.canConvert(TestBean1.class, TestBean3.class)); } @Test - public void testParentConversionServiceAvailability(){ + public void testParentConversionServiceAvailability() { ApplicationContext parentContext = new ClassPathXmlApplicationContext("ConverterParserWithExistingConversionServiceTests-parent.xml", ConverterParserWithExistingConversionServiceTests.class); GenericApplicationContext childContext = new GenericApplicationContext(); @@ -62,8 +62,8 @@ public class ConverterParserWithExistingConversionServiceTests { childContext.refresh(); - GenericConversionService conversionServiceParent = parentContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME,GenericConversionService.class); - GenericConversionService conversionServiceChild = childContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME,GenericConversionService.class); + GenericConversionService conversionServiceParent = parentContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME, GenericConversionService.class); + GenericConversionService conversionServiceChild = childContext.getBean(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME, GenericConversionService.class); Assert.isTrue(conversionServiceParent == conversionServiceChild); // validating that they are pointing to the same object conversionServiceChild.addConverter(new TestConverter()); conversionServiceChild.addConverter(new TestConverter3()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/EndpointRoleParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/EndpointRoleParserTests.java index 95396de263..0521c95466 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/EndpointRoleParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/EndpointRoleParserTests.java @@ -109,7 +109,7 @@ public class EndpointRoleParserTests { public static class Sink { - public void foo(String s) {} + public void foo(String s) { } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ErrorChannelAutoCreationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ErrorChannelAutoCreationTests.java index 1ae3f5e59b..a285af70c5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ErrorChannelAutoCreationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ErrorChannelAutoCreationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -40,7 +40,7 @@ public class ErrorChannelAutoCreationTests { // see INT-1899 @Test - public void testErrorChannelIsPubSub(){ + public void testErrorChannelIsPubSub() { assertEquals(PublishSubscribeChannel.class, errorChannel.getClass()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ErrorMessageExceptionTypeRouterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ErrorMessageExceptionTypeRouterParserTests.java index 4da973186c..6232bb1f04 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ErrorMessageExceptionTypeRouterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ErrorMessageExceptionTypeRouterParserTests.java @@ -50,7 +50,7 @@ public class ErrorMessageExceptionTypeRouterParserTests { private QueueChannel npeChannel; @Test - public void validateExceptionTypeRouterConfig(){ + public void validateExceptionTypeRouterConfig() { inputChannel.send(new ErrorMessage(new NullPointerException())); assertTrue(npeChannel.receive(1000).getPayload() instanceof NullPointerException); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests.java index 21f0a1bbe0..d4c25d5b73 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests.java @@ -97,7 +97,7 @@ public class GatewayParserTests { assertEquals("bar", result.getHeaders().get("foo")); assertEquals("qux", result.getHeaders().get("baz")); GatewayProxyFactoryBean fb = context.getBean("&methodOverride", GatewayProxyFactoryBean.class); - Map methods = TestUtils.getPropertyValue(fb, "methodMetadataMap", Map.class); + Map methods = TestUtils.getPropertyValue(fb, "methodMetadataMap", Map.class); GatewayMethodMetadata meta = (GatewayMethodMetadata) methods.get("oneWay"); assertNotNull(meta); assertEquals("456", meta.getRequestTimeout()); @@ -152,7 +152,7 @@ public class GatewayParserTests { @Test public void testFactoryBeanObjectTypeWithServiceInterface() throws Exception { - ConfigurableListableBeanFactory beanFactory = ((GenericApplicationContext)context).getBeanFactory(); + ConfigurableListableBeanFactory beanFactory = ((GenericApplicationContext) context).getBeanFactory(); Object attribute = beanFactory.getMergedBeanDefinition("&oneWay").getAttribute( IntegrationConfigUtils.FACTORY_BEAN_OBJECT_TYPE); assertEquals(TestService.class.getName(), attribute); @@ -160,7 +160,7 @@ public class GatewayParserTests { @Test public void testFactoryBeanObjectTypeWithNoServiceInterface() throws Exception { - ConfigurableListableBeanFactory beanFactory = ((GenericApplicationContext)context).getBeanFactory(); + ConfigurableListableBeanFactory beanFactory = ((GenericApplicationContext) context).getBeanFactory(); Object attribute = beanFactory.getMergedBeanDefinition("&defaultConfig").getAttribute( IntegrationConfigUtils.FACTORY_BEAN_OBJECT_TYPE); assertEquals(RequestReplyExchanger.class.getName(), attribute); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests.java index 3ea8d0bf55..14ac2dece6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -82,7 +82,7 @@ public class HeaderEnricherParserTests { assertEquals(Boolean.TRUE, shouldSkipNulls); } - @Test(expected=MessageTransformationException.class) + @Test(expected = MessageTransformationException.class) public void testStringPriorityHeader() { MessageHandler messageHandler = TestUtils.getPropertyValue(context.getBean("headerEnricherWithPriorityAsString"), "handler", MessageHandler.class); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/InnerDefinitionHandlerAwareEndpointParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/InnerDefinitionHandlerAwareEndpointParserTests.java index 9b5f22106a..e211cb3959 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/InnerDefinitionHandlerAwareEndpointParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/InnerDefinitionHandlerAwareEndpointParserTests.java @@ -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. @@ -62,142 +62,142 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { private Properties testConfigurations; @Test - public void testInnerSplitterDefinitionSuccess(){ + public void testInnerSplitterDefinitionSuccess() { String configProperty = testConfigurations.getProperty("splitter-inner-success"); this.testSplitterDefinitionSuccess(configProperty); } @Test - public void testInnerSplitterDefinitionSuccessWithPoller(){ + public void testInnerSplitterDefinitionSuccessWithPoller() { String configProperty = testConfigurations.getProperty("splitter-inner-success-with-poller"); this.bootStrap(configProperty); } @Test - public void testInnerSplitterDefinitionSuccessWithPollerReversedOrder(){ + public void testInnerSplitterDefinitionSuccessWithPollerReversedOrder() { String configProperty = testConfigurations.getProperty("splitter-inner-success-with-poller-reversed-order"); this.bootStrap(configProperty); } @Test - public void testRefSplitterDefinitionSuccess(){ + public void testRefSplitterDefinitionSuccess() { String configProperty = testConfigurations.getProperty("splitter-ref-success"); this.testSplitterDefinitionSuccess(configProperty); } - @Test(expected=BeanDefinitionStoreException.class) - public void testInnerSplitterDefinitionFailureRefAndInner(){ + @Test(expected = BeanDefinitionStoreException.class) + public void testInnerSplitterDefinitionFailureRefAndInner() { String xmlConfig = testConfigurations.getProperty("splitter-failure-refAndBean"); this.bootStrap(xmlConfig); } @Test - public void testInnerTransformerDefinitionSuccess(){ + public void testInnerTransformerDefinitionSuccess() { String configProperty = testConfigurations.getProperty("transformer-inner-success"); this.testTransformerDefinitionSuccess(configProperty); } @Test - public void testRefTransformerDefinitionSuccess(){ + public void testRefTransformerDefinitionSuccess() { String configProperty = testConfigurations.getProperty("transformer-ref-success"); this.testTransformerDefinitionSuccess(configProperty); } - @Test(expected=BeanDefinitionStoreException.class) - public void testInnerTransformerDefinitionFailureRefAndInner(){ + @Test(expected = BeanDefinitionStoreException.class) + public void testInnerTransformerDefinitionFailureRefAndInner() { String xmlConfig = testConfigurations.getProperty("transformer-failure-refAndBean"); this.bootStrap(xmlConfig); } @Test - public void testInnerRouterDefinitionSuccess(){ + public void testInnerRouterDefinitionSuccess() { String configProperty = testConfigurations.getProperty("router-inner-success"); this.testRouterDefinitionSuccess(configProperty); } @Test - public void testRefRouterDefinitionSuccess(){ + public void testRefRouterDefinitionSuccess() { String configProperty = testConfigurations.getProperty("router-ref-success"); this.testRouterDefinitionSuccess(configProperty); } - @Test(expected=BeanDefinitionStoreException.class) - public void testInnerRouterDefinitionFailureRefAndInner(){ + @Test(expected = BeanDefinitionStoreException.class) + public void testInnerRouterDefinitionFailureRefAndInner() { String xmlConfig = testConfigurations.getProperty("router-failure-refAndBean"); this.bootStrap(xmlConfig); } @Test - public void testInnerSADefinitionSuccess(){ + public void testInnerSADefinitionSuccess() { String configProperty = testConfigurations.getProperty("sa-inner-success"); this.testSADefinitionSuccess(configProperty); } @Test - public void testRefSADefinitionSuccess(){ + public void testRefSADefinitionSuccess() { String configProperty = testConfigurations.getProperty("sa-ref-success"); this.testSADefinitionSuccess(configProperty); } - @Test(expected=BeanDefinitionStoreException.class) - public void testInnerSADefinitionFailureRefAndInner(){ + @Test(expected = BeanDefinitionStoreException.class) + public void testInnerSADefinitionFailureRefAndInner() { String xmlConfig = testConfigurations.getProperty("sa-failure-refAndBean"); this.bootStrap(xmlConfig); } @Test - public void testInnerAggregatorDefinitionSuccess(){ + public void testInnerAggregatorDefinitionSuccess() { String configProperty = testConfigurations.getProperty("aggregator-inner-success"); this.testAggregatorDefinitionSuccess(configProperty); } @Test - public void testInnerConcurrentAggregatorDefinitionSuccess(){ + public void testInnerConcurrentAggregatorDefinitionSuccess() { String configProperty = testConfigurations.getProperty("aggregator-inner-concurrent-success"); this.testAggregatorDefinitionSuccess(configProperty); } @Test - public void testInnerConcurrentAggregatorDefinitionSuccessReorderBeanPoller(){ + public void testInnerConcurrentAggregatorDefinitionSuccessReorderBeanPoller() { String configProperty = testConfigurations.getProperty("aggregator-inner-concurrent-success-reorder-bean-poller"); this.testAggregatorDefinitionSuccess(configProperty); } @Test - public void testRefAggregatorDefinitionSuccess(){ + public void testRefAggregatorDefinitionSuccess() { String configProperty = testConfigurations.getProperty("aggregator-ref-success"); this.testAggregatorDefinitionSuccess(configProperty); } - @Test(expected=BeanDefinitionStoreException.class) - public void testInnerAggregatorDefinitionFailureRefAndInner(){ + @Test(expected = BeanDefinitionStoreException.class) + public void testInnerAggregatorDefinitionFailureRefAndInner() { String xmlConfig = testConfigurations.getProperty("aggregator-failure-refAndBean"); this.bootStrap(xmlConfig); } @Test - public void testInnerFilterDefinitionSuccess(){ + public void testInnerFilterDefinitionSuccess() { String configProperty = testConfigurations.getProperty("filter-inner-success"); this.testFilterDefinitionSuccess(configProperty); } @Test - public void testRefFilterDefinitionSuccess(){ + public void testRefFilterDefinitionSuccess() { String configProperty = testConfigurations.getProperty("filter-ref-success"); this.testFilterDefinitionSuccess(configProperty); } - @Test(expected=BeanDefinitionStoreException.class) - public void testInnerFilterDefinitionFailureRefAndInner(){ + @Test(expected = BeanDefinitionStoreException.class) + public void testInnerFilterDefinitionFailureRefAndInner() { String xmlConfig = testConfigurations.getProperty("filter-failure-refAndBean"); this.bootStrap(xmlConfig); } - private void testSplitterDefinitionSuccess(String configProperty){ + private void testSplitterDefinitionSuccess(String configProperty) { ApplicationContext ac = this.bootStrap(configProperty); EventDrivenConsumer splitter = (EventDrivenConsumer) ac.getBean("testSplitter"); Assert.assertNotNull(splitter); - MessageBuilder inChannelMessageBuilder = MessageBuilder.withPayload(new String[]{"One","Two"}); + MessageBuilder inChannelMessageBuilder = MessageBuilder.withPayload(new String[]{"One", "Two"}); Message inMessage = inChannelMessageBuilder.build(); MessageChannel inChannel = (MessageChannel) ac.getBean("inChannel"); inChannel.send(inMessage); @@ -207,11 +207,11 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { Assert.assertTrue(outChannel.receive().getPayload() instanceof String); } - private void testTransformerDefinitionSuccess(String configProperty){ + private void testTransformerDefinitionSuccess(String configProperty) { ApplicationContext ac = this.bootStrap(configProperty); EventDrivenConsumer transformer = (EventDrivenConsumer) ac.getBean("testTransformer"); Assert.assertNotNull(transformer); - MessageBuilder inChannelMessageBuilder = MessageBuilder.withPayload(new String[]{"One","Two"}); + MessageBuilder inChannelMessageBuilder = MessageBuilder.withPayload(new String[]{"One", "Two"}); Message inMessage = inChannelMessageBuilder.build(); DirectChannel inChannel = (DirectChannel) ac.getBean("inChannel"); inChannel.send(inMessage); @@ -220,7 +220,7 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { Assert.assertTrue(payload.equals("One,Two")); } - private void testRouterDefinitionSuccess(String configProperty){ + private void testRouterDefinitionSuccess(String configProperty) { ApplicationContext ac = this.bootStrap(configProperty); EventDrivenConsumer splitter = (EventDrivenConsumer) ac.getBean("testRouter"); Assert.assertNotNull(splitter); @@ -237,7 +237,7 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { Assert.assertTrue(channel2.receive().getPayload().equals("2")); } - private void testSADefinitionSuccess(String configProperty){ + private void testSADefinitionSuccess(String configProperty) { ApplicationContext ac = this.bootStrap(configProperty); EventDrivenConsumer splitter = (EventDrivenConsumer) ac.getBean("testServiceActivator"); Assert.assertNotNull(splitter); @@ -249,7 +249,7 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { Assert.assertTrue(channel1.receive().getPayload().equals("1")); } - private void testAggregatorDefinitionSuccess(String configProperty){ + private void testAggregatorDefinitionSuccess(String configProperty) { ApplicationContext ac = this.bootStrap(configProperty); MessageChannel inChannel = (MessageChannel) ac.getBean("inChannel"); for (int i = 0; i < 5; i++) { @@ -263,7 +263,7 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { assertEquals(0 + 1 + 2 + 3 + 4, receivedMessage.getPayload()); } - private void testFilterDefinitionSuccess(String configProperty){ + private void testFilterDefinitionSuccess(String configProperty) { ApplicationContext ac = this.bootStrap(configProperty); MessageChannel input = (MessageChannel) ac.getBean("inChannel"); PollableChannel output = (PollableChannel) ac.getBean("outChannel"); @@ -272,7 +272,7 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { assertEquals("foo", reply.getPayload()); } - private ApplicationContext bootStrap(String configProperty){ + private ApplicationContext bootStrap(String configProperty) { ByteArrayInputStream stream = new ByteArrayInputStream(configProperty.getBytes()); GenericApplicationContext ac = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ac); @@ -291,31 +291,31 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { } @SuppressWarnings("unchecked") - public static class TestSplitter{ + public static class TestSplitter { public Collection split(String[] payload) { return CollectionUtils.arrayToList(payload); } } - public static class TestTransformer{ - public String split(String[] payload){ + public static class TestTransformer { + public String split(String[] payload) { return StringUtils.arrayToDelimitedString(payload, ","); } } - public static class TestRouter{ + public static class TestRouter { public String route(String value) { return (value.equals("1")) ? "channel1" : "channel2"; } } - public static class TestServiceActivator{ + public static class TestServiceActivator { public String foo(String value) { return value; } } - public static class TestAggregator{ + public static class TestAggregator { public Integer sum(List numbers) { int result = 0; for (Integer number : numbers) { @@ -325,7 +325,7 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { } } - public static class TestMessageFilter{ + public static class TestMessageFilter { public boolean filter(String value) { return value.equals("foo"); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/MapToObjectTransformerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/MapToObjectTransformerParserTests.java index e97e12cbfb..e741efb775 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/MapToObjectTransformerParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/MapToObjectTransformerParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -61,7 +61,7 @@ public class MapToObjectTransformerParserTests { @SuppressWarnings({ "unchecked", "rawtypes" }) @Test - public void testMapToObjectTransformationWithType(){ + public void testMapToObjectTransformationWithType() { Map map = new HashMap(); map.put("fname", "Justin"); map.put("lname", "Case"); @@ -85,7 +85,7 @@ public class MapToObjectTransformerParserTests { @SuppressWarnings({ "unchecked", "rawtypes" }) @Test - public void testMapToObjectTransformationWithRef(){ + public void testMapToObjectTransformationWithRef() { Map map = new HashMap(); map.put("fname", "Justin"); map.put("lname", "Case"); @@ -108,7 +108,7 @@ public class MapToObjectTransformerParserTests { @SuppressWarnings({ "unchecked", "rawtypes" }) @Test - public void testMapToObjectTransformationWithConversionService(){ + public void testMapToObjectTransformationWithConversionService() { Map map = new HashMap(); map.put("fname", "Justin"); map.put("lname", "Case"); @@ -125,12 +125,12 @@ public class MapToObjectTransformerParserTests { assertNotNull(person.getAddress()); assertEquals("1123 Main st", person.getAddress().getStreet()); } - @Test(expected=BeanCreationException.class) - public void testNonPrototypeFailure(){ + @Test(expected = BeanCreationException.class) + public void testNonPrototypeFailure() { new ClassPathXmlApplicationContext("MapToObjectTransformerParserTests-context-fail.xml", MapToObjectTransformerParserTests.class); } - public static class Person{ + public static class Person { private String fname; private String lname; private String ssn; @@ -173,8 +173,8 @@ public class MapToObjectTransformerParserTests { } } - public static class StringToAddressConverter implements Converter{ - public StringToAddressConverter(){} + public static class StringToAddressConverter implements Converter { + public StringToAddressConverter() { } public Address convert(String source) { Address address = new Address(); address.setStreet(source); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ObjectToMapTransformerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ObjectToMapTransformerParserTests.java index 6ffcf58cac..a25e0d210b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ObjectToMapTransformerParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ObjectToMapTransformerParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -71,7 +71,7 @@ public class ObjectToMapTransformerParserTests { @SuppressWarnings("unchecked") @Test - public void testObjectToSpelMapTransformer(){ + public void testObjectToSpelMapTransformer() { Employee employee = this.buildEmployee(); StandardEvaluationContext context = new StandardEvaluationContext(employee); context.addPropertyAccessor(new MapAccessor()); @@ -90,8 +90,8 @@ public class ObjectToMapTransformerParserTests { assertEquals(valueFromTheMap, valueFromExpression); } } - @Test(expected=MessageTransformationException.class) - public void testObjectToSpelMapTransformerWithCycle(){ + @Test(expected = MessageTransformationException.class) + public void testObjectToSpelMapTransformerWithCycle() { Employee employee = this.buildEmployee(); Child child = new Child(); Person parent = employee.getPerson(); @@ -102,7 +102,7 @@ public class ObjectToMapTransformerParserTests { } @Test - public void testObjectToNotFlattenedMapTransformer(){ + public void testObjectToNotFlattenedMapTransformer() { Employee employee = this.buildEmployee(); Message message = MessageBuilder.withPayload(employee).build(); @@ -119,7 +119,7 @@ public class ObjectToMapTransformerParserTests { } @SuppressWarnings({ "unchecked", "rawtypes" }) - public Employee buildEmployee(){ + public Employee buildEmployee() { Address companyAddress = new Address(); companyAddress.setCity("Philadelphia"); companyAddress.setStreet("1123 Main"); @@ -158,7 +158,7 @@ public class ObjectToMapTransformerParserTests { remarksA.put("foo", "foo"); remarksA.put("bar", "bar"); remarksB.put("baz", "baz"); - List> remarks = new ArrayList>(); + List> remarks = new ArrayList>(); remarks.add(remarksA); remarks.add(remarksB); person.setRemarks(remarks); @@ -179,7 +179,7 @@ public class ObjectToMapTransformerParserTests { return employee; } - public static class Employee{ + public static class Employee { private List departments; private String companyName; private Person person; @@ -218,7 +218,7 @@ public class ObjectToMapTransformerParserTests { } } - public static class Person{ + public static class Person { private String fname; private String lname; private String[] akaNames; @@ -263,7 +263,7 @@ public class ObjectToMapTransformerParserTests { } } - public static class Address{ + public static class Address { private String street; private String city; private String zip; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PNamespaceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PNamespaceTests.java index dc956d0ae8..9bed35c4a6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PNamespaceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PNamespaceTests.java @@ -142,7 +142,7 @@ public class PNamespaceTests { public static class SampleAggregator { private String name; - public SampleAggregator(){} + public SampleAggregator() { } public String getName() { return name; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerParserTests.java index 4535c1e438..ca08d51933 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -122,19 +122,19 @@ public class PollerParserTests { assertTrue(metadata.getTrigger() instanceof TestTrigger); } - @Test(expected=BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) public void pollerWithCronTriggerAndTimeUnit() { new ClassPathXmlApplicationContext( "cronTriggerWithTimeUnit-fail.xml", PollerParserTests.class); } - @Test(expected=BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) public void topLevelPollerWithRef() { new ClassPathXmlApplicationContext( "defaultPollerWithRef.xml", PollerParserTests.class); } - @Test(expected=BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) public void pollerWithCronAndFixedDelay() { new ClassPathXmlApplicationContext( "pollerWithCronAndFixedDelay.xml", PollerParserTests.class); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannelTests.java index c14f9ae11e..8b788dc923 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannelTests.java @@ -104,7 +104,7 @@ public class PollerWithErrorChannelTests { public static class SampleService { - public String withSuccess(){ + public String withSuccess() { return "hello"; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/TransactionSynchronizationFactoryParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/TransactionSynchronizationFactoryParserTests.java index 9a90f37658..dba4960053 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/TransactionSynchronizationFactoryParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/TransactionSynchronizationFactoryParserTests.java @@ -36,12 +36,12 @@ import org.springframework.integration.transaction.TransactionSynchronizationPro public class TransactionSynchronizationFactoryParserTests { @Test // nothing to assert. Validates only XSD - public void validateXsdCombinationOfOrderOfSubelements(){ + public void validateXsdCombinationOfOrderOfSubelements() { new ClassPathXmlApplicationContext("TransactionSynchronizationFactoryParserTests-xsd.xml", this.getClass()); } @Test - public void validateFullConfiguration(){ + public void validateFullConfiguration() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("TransactionSynchronizationFactoryParserTests-config.xml", this.getClass()); @@ -63,14 +63,14 @@ public class TransactionSynchronizationFactoryParserTests { assertEquals(afterCommitResultChannel, context.getBean("nullChannel")); Expression afterCommitExpression = TestUtils.getPropertyValue(processor, "afterCommitExpression", Expression.class); assertNotNull(afterCommitExpression); - assertEquals("'afterCommit'", ((SpelExpression)afterCommitExpression).getExpressionString()); + assertEquals("'afterCommit'", ((SpelExpression) afterCommitExpression).getExpressionString()); MessageChannel afterRollbackResultChannel = TestUtils.getPropertyValue(processor, "afterRollbackChannel", MessageChannel.class); assertNotNull(afterRollbackResultChannel); assertEquals(afterRollbackResultChannel, context.getBean("afterRollbackChannel")); Expression afterRollbackExpression = TestUtils.getPropertyValue(processor, "afterRollbackExpression", Expression.class); assertNotNull(afterRollbackExpression); - assertEquals("'afterRollback'", ((SpelExpression)afterRollbackExpression).getExpressionString()); + assertEquals("'afterRollback'", ((SpelExpression) afterRollbackExpression).getExpressionString()); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/propertyplaceholder/PropertyPlaceholderTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/propertyplaceholder/PropertyPlaceholderTests.java index 763eaf2fba..80c0b1322a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/propertyplaceholder/PropertyPlaceholderTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/propertyplaceholder/PropertyPlaceholderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -35,7 +35,7 @@ public class PropertyPlaceholderTests { //parsing and instantiating is enough } - public static class SanityCheck{ + public static class SanityCheck { public SanityCheck(Integer i) { //this will throw an exception if the placeholder isn't replaced } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java b/spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java index f214d1d144..8a69d44537 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -153,7 +153,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get(100000, TimeUnit.MILLISECONDS)); long elapsed = System.currentTimeMillis() - start; assertEquals("test", result.get().getPayload()); - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); } @Test @@ -166,7 +166,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get(10000, TimeUnit.MILLISECONDS)); long elapsed = System.currentTimeMillis() - start; assertEquals("test", result.get().getPayload()); - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); } @Test @@ -183,7 +183,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get(10000, TimeUnit.MILLISECONDS)); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("test", result.get().getPayload()); } @@ -206,7 +206,7 @@ public class AsyncMessagingTemplateTests { long elapsed = System.currentTimeMillis() - start; assertEquals("test", result.get()); - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); } @Test @@ -220,7 +220,7 @@ public class AsyncMessagingTemplateTests { long elapsed = System.currentTimeMillis() - start; assertEquals("test", result.get()); - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); } @Test @@ -237,7 +237,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get(10000, TimeUnit.MILLISECONDS)); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("test", result.get()); } @@ -259,7 +259,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); } @Test @@ -272,7 +272,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("TEST", result.get().getPayload()); } @@ -290,7 +290,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("TEST", result.get().getPayload()); } @@ -305,7 +305,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("TEST", result.get()); } @@ -319,7 +319,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("TEST", result.get()); } @@ -337,7 +337,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("TEST", result.get()); } @@ -352,7 +352,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("123-bar", result.get()); } @@ -366,7 +366,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("TEST-bar", result.get()); } @@ -384,7 +384,7 @@ public class AsyncMessagingTemplateTests { assertNotNull(result.get()); long elapsed = System.currentTimeMillis() - start; - assertTrue(elapsed >= 200-safety); + assertTrue(elapsed >= 200 - safety); assertEquals("TEST-bar", result.get()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/core/MessageIdGenerationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/core/MessageIdGenerationTests.java index 0eedc39f7d..97ee900332 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/core/MessageIdGenerationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/core/MessageIdGenerationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -172,7 +172,7 @@ public class MessageIdGenerationTests { System.out.println("Generated " + times + " messages using Timebased UUID generator " + "in " + timebasedGeneratorElapsedTime + " seconds"); - System.out.println("Time-based ID generator is " + defaultGeneratorElapsedTime/timebasedGeneratorElapsedTime + " times faster"); + System.out.println("Time-based ID generator is " + defaultGeneratorElapsedTime / timebasedGeneratorElapsedTime + " times faster"); } private void assertDestroy() throws Exception { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/core/TimeBasedUUIDGenerator.java b/spring-integration-core/src/test/java/org/springframework/integration/core/TimeBasedUUIDGenerator.java index 364bde8ac9..20b9c982fb 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/core/TimeBasedUUIDGenerator.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/core/TimeBasedUUIDGenerator.java @@ -49,7 +49,7 @@ class TimeBasedUUIDGenerator { return generateIdFromTimestamp(System.currentTimeMillis()); } - public final static UUID generateIdFromTimestamp(long currentTimeMillis){ + public final static UUID generateIdFromTimestamp(long currentTimeMillis) { long time; synchronized (lock) { @@ -76,12 +76,12 @@ class TimeBasedUUIDGenerator { long clock_seq_hi_and_reserved = clockSequence; - clock_seq_hi_and_reserved <<=48; + clock_seq_hi_and_reserved <<= 48; long cls = 0 | clock_seq_hi_and_reserved; long lsb = cls | macAddress; - if (canNotDetermineMac){ + if (canNotDetermineMac) { logger.warning("UUID generation process was not able to determine your MAC address. Returning random UUID (non version 1 UUID)"); return UUID.randomUUID(); } @@ -89,7 +89,7 @@ class TimeBasedUUIDGenerator { return new UUID(time, lsb); } } - private static long getMac(){ + private static long getMac() { long macAddressAsLong = 0; try { InetAddress address = InetAddress.getLocalHost(); @@ -101,7 +101,7 @@ class TimeBasedUUIDGenerator { if (mac != null) { for (int i = 0; i < mac.length; i++) { macAddressAsLong <<= 8; - macAddressAsLong ^= (long)mac[i] & 0xFF; + macAddressAsLong ^= (long) mac[i] & 0xFF; } } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySetTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySetTests.java index 80bc7eee30..6d6a29171f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySetTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySetTests.java @@ -37,7 +37,7 @@ public class OrderedAwareCopyOnWriteArraySetTests { */ @SuppressWarnings("rawtypes") @Test - public void testAddUnordered(){ + public void testAddUnordered() { OrderedAwareCopyOnWriteArraySet setToTest = new OrderedAwareCopyOnWriteArraySet(); setToTest.add("foo"); setToTest.add("bar"); @@ -58,7 +58,7 @@ public class OrderedAwareCopyOnWriteArraySetTests { */ @SuppressWarnings("rawtypes") @Test - public void testAddOrdered(){ + public void testAddOrdered() { OrderedAwareCopyOnWriteArraySet setToTest = new OrderedAwareCopyOnWriteArraySet(); Object o1 = new Foo(3); Object o2 = new Foo(1); @@ -96,7 +96,7 @@ public class OrderedAwareCopyOnWriteArraySetTests { @SuppressWarnings("rawtypes") @Test - public void testAddAllOrderedUnordered(){ + public void testAddAllOrderedUnordered() { List tempList = new ArrayList(); Object o1 = new Foo(3); Object o2 = new Foo(1); @@ -135,13 +135,13 @@ public class OrderedAwareCopyOnWriteArraySetTests { } @Test - public void testConcurrent(){ - for(int i = 0; i < 1000; i++){ + public void testConcurrent() { + for (int i = 0; i < 1000; i++) { this.doConcurrent(); } } @SuppressWarnings("rawtypes") - private void doConcurrent(){ + private void doConcurrent() { final OrderedAwareCopyOnWriteArraySet setToTest = new OrderedAwareCopyOnWriteArraySet(); final Object o1 = new Foo(3); final Object o2 = new Foo(1); @@ -200,13 +200,13 @@ public class OrderedAwareCopyOnWriteArraySetTests { * Will test addAll operation including the removal and adding an object in the concurrent environment */ @Test - public void testConcurrentAll(){ - for(int i = 0; i < 1000; i++){ + public void testConcurrentAll() { + for (int i = 0; i < 1000; i++) { this.doConcurrentAll(); } } @SuppressWarnings("rawtypes") - public void doConcurrentAll(){ + public void doConcurrentAll() { final List tempList = new ArrayList(); Object o1 = new Foo(3); Object o2 = new Foo(1); @@ -279,14 +279,14 @@ public class OrderedAwareCopyOnWriteArraySetTests { } private static class Foo implements Ordered { private final int order; - Foo(int order){ + Foo(int order) { this.order = order; } public int getOrder() { return order; } @Override - public String toString(){ + public String toString() { return "Foo-" + order; } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/PollingTransactionTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/PollingTransactionTests.java index 12c3f3c48e..10f6e4c3d6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/PollingTransactionTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/PollingTransactionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -75,15 +75,15 @@ public class PollingTransactionTests { "transactionTests.xml", this.getClass()); PollingConsumer advicedPoller = context.getBean("advicedSa", PollingConsumer.class); - List adviceChain = TestUtils.getPropertyValue(advicedPoller, "adviceChain",List.class); + List adviceChain = TestUtils.getPropertyValue(advicedPoller, "adviceChain", List.class); assertEquals(3, adviceChain.size()); Runnable poller = TestUtils.getPropertyValue(advicedPoller, "poller", Runnable.class); Callable pollingTask = TestUtils.getPropertyValue(poller, "pollingTask", Callable.class); assertTrue("Poller is not Advised", pollingTask instanceof Advised); - Advisor[] advisors = ((Advised)pollingTask).getAdvisors(); + Advisor[] advisors = ((Advised) pollingTask).getAdvisors(); assertEquals(3, advisors.length); - assertTrue("First advisor is not TX", ((DefaultPointcutAdvisor)advisors[0]).getAdvice() instanceof TransactionInterceptor); + assertTrue("First advisor is not TX", ((DefaultPointcutAdvisor) advisors[0]).getAdvice() instanceof TransactionInterceptor); TestTransactionManager txManager = (TestTransactionManager) context.getBean("txManager"); MessageChannel input = (MessageChannel) context.getBean("goodInputWithAdvice"); PollableChannel output = (PollableChannel) context.getBean("output"); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/RoundRobinDispatcherConcurrentTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/RoundRobinDispatcherConcurrentTests.java index f27ad7b54d..717677a21b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/RoundRobinDispatcherConcurrentTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/RoundRobinDispatcherConcurrentTests.java @@ -172,7 +172,7 @@ public class RoundRobinDispatcherConcurrentTests { start.countDown(); allDone.await(5000, TimeUnit.MILLISECONDS); assertFalse("not all messages were accepted", failed.get()); - verify(handler1, times(TOTAL_EXECUTIONS/2)).handleMessage(message); + verify(handler1, times(TOTAL_EXECUTIONS / 2)).handleMessage(message); verify(handler2, times(TOTAL_EXECUTIONS)).handleMessage(message); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/RoundRobinDispatcherTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/RoundRobinDispatcherTests.java index b497aea3b5..bb8152e754 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/RoundRobinDispatcherTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/RoundRobinDispatcherTests.java @@ -95,8 +95,8 @@ public class RoundRobinDispatcherTests { dispatcher.addHandler(differentHandler); DirectFieldAccessor accessor = new DirectFieldAccessor( new DirectFieldAccessor(dispatcher).getPropertyValue("loadBalancingStrategy")); - ((AtomicInteger) accessor.getPropertyValue("currentHandlerIndex")).set(Integer.MAX_VALUE-5); - for(int i = 0; i < 40; i++) { + ((AtomicInteger) accessor.getPropertyValue("currentHandlerIndex")).set(Integer.MAX_VALUE - 5); + for (int i = 0; i < 40; i++) { dispatcher.dispatch(message); } verify(handler, atLeast(18)).handleMessage(message); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/TransactionalPollerWithMixedAopConfigTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/TransactionalPollerWithMixedAopConfigTests.java index 57a88e1694..a65d96760c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/TransactionalPollerWithMixedAopConfigTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/TransactionalPollerWithMixedAopConfigTests.java @@ -34,7 +34,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class TransactionalPollerWithMixedAopConfigTests { @Test - public void validateTransactionalProxyIsolationToThePollerOnly(){ + public void validateTransactionalProxyIsolationToThePollerOnly() { ApplicationContext context = new ClassPathXmlApplicationContext("TransactionalPollerWithMixedAopConfig-context.xml", this.getClass()); @@ -42,12 +42,12 @@ public class TransactionalPollerWithMixedAopConfigTests { assertTrue(!(context.getBean("inputChannel") instanceof Advised)); } - public static class SampleService{ - public void foo(String payload){} + public static class SampleService { + public void foo(String payload) { } } - public static class Foo{ - public Foo(String value){} + public static class Foo { + public Foo(String value) { } } // public static class SampleAdvice implements MethodInterceptor{ diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/UnicastingDispatcherTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/UnicastingDispatcherTests.java index 8ad5d2db78..a2f7a6ad67 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/UnicastingDispatcherTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/UnicastingDispatcherTests.java @@ -40,7 +40,7 @@ public class UnicastingDispatcherTests { @SuppressWarnings("unchecked") @Test - public void withInboundGatewayAsyncRequestChannelAndExplicitErrorChannel() throws Exception{ + public void withInboundGatewayAsyncRequestChannelAndExplicitErrorChannel() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("unicasting-with-async.xml", this.getClass()); SubscribableChannel errorChannel = context.getBean("errorChannel", SubscribableChannel.class); MessageHandler errorHandler = new MessageHandler() { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/MessageProducerSupportTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/MessageProducerSupportTests.java index f6500030a5..8bc4545b12 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/MessageProducerSupportTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/MessageProducerSupportTests.java @@ -49,7 +49,7 @@ import org.springframework.messaging.support.GenericMessage; */ public class MessageProducerSupportTests { - @Test(expected=MessageDeliveryException.class) + @Test(expected = MessageDeliveryException.class) public void validateExceptionIfNoErrorChannel() { DirectChannel outChannel = new DirectChannel(); @@ -59,7 +59,7 @@ public class MessageProducerSupportTests { throw new RuntimeException("problems"); } }); - MessageProducerSupport mps = new MessageProducerSupport() {}; + MessageProducerSupport mps = new MessageProducerSupport() { }; mps.setOutputChannel(outChannel); mps.setBeanFactory(TestUtils.createTestApplicationContext()); mps.afterPropertiesSet(); @@ -67,7 +67,7 @@ public class MessageProducerSupportTests { mps.sendMessage(new GenericMessage("hello")); } - @Test(expected=MessageDeliveryException.class) + @Test(expected = MessageDeliveryException.class) public void validateExceptionIfSendToErrorChannelFails() { DirectChannel outChannel = new DirectChannel(); outChannel.subscribe(new MessageHandler() { @@ -83,7 +83,7 @@ public class MessageProducerSupportTests { throw new RuntimeException("ooops"); } }); - MessageProducerSupport mps = new MessageProducerSupport() {}; + MessageProducerSupport mps = new MessageProducerSupport() { }; mps.setOutputChannel(outChannel); mps.setErrorChannel(errorChannel); mps.setBeanFactory(TestUtils.createTestApplicationContext()); @@ -107,7 +107,7 @@ public class MessageProducerSupportTests { handler.setBeanFactory(mock(BeanFactory.class)); handler.afterPropertiesSet(); errorChannel.subscribe(handler); - MessageProducerSupport mps = new MessageProducerSupport() {}; + MessageProducerSupport mps = new MessageProducerSupport() { }; mps.setOutputChannel(outChannel); mps.setErrorChannel(errorChannel); mps.setBeanFactory(TestUtils.createTestApplicationContext()); @@ -125,7 +125,7 @@ public class MessageProducerSupportTests { @Test public void testWithChannelName() { DirectChannel outChannel = new DirectChannel(); - MessageProducerSupport mps = new MessageProducerSupport() {}; + MessageProducerSupport mps = new MessageProducerSupport() { }; mps.setOutputChannelName("foo"); TestApplicationContext testApplicationContext = TestUtils.createTestApplicationContext(); testApplicationContext.registerBean("foo", outChannel); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollerAdviceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollerAdviceTests.java index dc62889ef0..e072756597 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollerAdviceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollerAdviceTests.java @@ -188,7 +188,7 @@ public class PollerAdviceTests { public void testMixedAdvice() throws Exception { SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); final List callOrder = new ArrayList(); - final CountDownLatch latch = new CountDownLatch(4);// advice + advice + source + advice + final CountDownLatch latch = new CountDownLatch(4); // advice + advice + source + advice adapter.setSource(new MessageSource() { @Override diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollingEndpointErrorHandlingTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollingEndpointErrorHandlingTests.java index 9e9cc80b83..294a18ebab 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollingEndpointErrorHandlingTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollingEndpointErrorHandlingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -39,7 +39,7 @@ public class PollingEndpointErrorHandlingTests { PollableChannel errorChannel = (PollableChannel) context.getBean("errorChannel"); Message errorMessage = errorChannel.receive(5000); assertNotNull("No error message received", errorMessage); - assertEquals("Message received was not an ErrorMessage", ErrorMessage.class,errorMessage.getClass()); + assertEquals("Message received was not an ErrorMessage", ErrorMessage.class, errorMessage.getClass()); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/annotation/MessageParameterAnnotatedEndpoint.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/annotation/MessageParameterAnnotatedEndpoint.java index 9c5e89d44f..e7e5068c9b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/annotation/MessageParameterAnnotatedEndpoint.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/annotation/MessageParameterAnnotatedEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -27,7 +27,7 @@ import org.springframework.messaging.support.GenericMessage; @MessageEndpoint public class MessageParameterAnnotatedEndpoint { - @ServiceActivator(inputChannel="inputChannel", outputChannel="outputChannel") + @ServiceActivator(inputChannel = "inputChannel", outputChannel = "outputChannel") public Message sayHello(Message message) { return new GenericMessage("hello " + message.getPayload()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests.java index 14f4fd943d..0400d70db7 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests.java @@ -131,7 +131,7 @@ public class GatewayInterfaceTests { Bar bar = ac.getBean(Bar.class); bar.foo("hello"); assertTrue(called.get()); - Map gateways = TestUtils.getPropertyValue(ac.getBean("&sampleGateway"), "gatewayMap", Map.class); + Map gateways = TestUtils.getPropertyValue(ac.getBean("&sampleGateway"), "gatewayMap", Map.class); ac.close(); } @@ -305,8 +305,8 @@ public class GatewayInterfaceTests { ac.close(); } - @Test(expected=IllegalArgumentException.class) - public void testWithServiceAsNotAnInterface(){ + @Test(expected = IllegalArgumentException.class) + public void testWithServiceAsNotAnInterface() { new GatewayProxyFactoryBean(NotAnInterface.class); } @@ -396,7 +396,7 @@ public class GatewayInterfaceTests { public interface Foo { - @Gateway(requestChannel="requestChannelFoo") + @Gateway(requestChannel = "requestChannelFoo") void foo(String payload); void baz(String payload); @@ -406,14 +406,14 @@ public class GatewayInterfaceTests { } public interface Bar extends Foo { - @Gateway(requestChannel="requestChannelBar") + @Gateway(requestChannel = "requestChannelBar") void bar(String payload); void qux(String payload, @Header("name") String nameHeader); } public static class NotAnInterface { - public void fail(String payload){} + public void fail(String payload) { } } public interface Baz { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInvokingMessageHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInvokingMessageHandlerTests.java index 72d0ba8656..e362d6d480 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInvokingMessageHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInvokingMessageHandlerTests.java @@ -40,7 +40,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class GatewayInvokingMessageHandlerTests { @Autowired diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapperToMessageTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapperToMessageTests.java index e33e1b96b9..4c0d380be6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapperToMessageTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapperToMessageTests.java @@ -292,7 +292,7 @@ public class GatewayMethodInboundMessageMapperToMessageTests { void sendPayloadAndHeader(String payload, @Header("foo") String foo); - void sendPayloadAndOptionalHeader(String payload, @Header(value="foo", required=false) String foo); + void sendPayloadAndOptionalHeader(String payload, @Header(value = "foo", required = false) String foo); void sendPayloadAndHeadersMap(String payload, @Headers Map headers); @@ -300,7 +300,7 @@ public class GatewayMethodInboundMessageMapperToMessageTests { void sendMessageAndHeader(Message message, @Header("foo") String foo); - void sendMessageAndOptionalHeader(Message message, @Header(value="foo", required=false) String foo); + void sendMessageAndOptionalHeader(Message message, @Header(value = "foo", required = false) String foo); // invalid methods diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayRequiresReplyTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayRequiresReplyTests.java index 7cd98fe1cc..3533708e43 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayRequiresReplyTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayRequiresReplyTests.java @@ -67,7 +67,7 @@ public class GatewayRequiresReplyTests { } public static class LongRunningService { - public String echo(String value) throws Exception{ + public String echo(String value) throws Exception { Thread.sleep(5000); return value; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayXmlAndAnnotationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayXmlAndAnnotationTests.java index 2fc28cfc3d..62a8ef7fea 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayXmlAndAnnotationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayXmlAndAnnotationTests.java @@ -78,10 +78,10 @@ public class GatewayXmlAndAnnotationTests { @Gateway String annotationShouldntOverrideDefault(String foo); - @Gateway(replyTimeout=234) + @Gateway(replyTimeout = 234) String annotationShouldOverrideDefault(String foo); - @Gateway(replyTimeout=-1) + @Gateway(replyTimeout = -1) String annotationShouldOverrideDefaultToInfinity(String foo); String explicitTimeoutShouldOverrideDefault(String foo); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests.java index 85c38b3a39..eae1ec7524 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests.java @@ -67,31 +67,31 @@ public class InnerGatewayWithChainTests { @Test - public void testExceptionHandledByMainGateway(){ + public void testExceptionHandledByMainGateway() { String reply = testGatewayWithErrorChannelA.echo(5); assertEquals("ERROR from errorChannelA", reply); } @Test - public void testExceptionHandledByMainGatewayNoErrorChannelInChain(){ + public void testExceptionHandledByMainGatewayNoErrorChannelInChain() { String reply = testGatewayWithErrorChannelAA.echo(0); assertEquals("ERROR from errorChannelA", reply); } @Test - public void testExceptionHandledByInnerGateway(){ + public void testExceptionHandledByInnerGateway() { String reply = testGatewayWithErrorChannelA.echo(0); assertEquals("ERROR from errorChannelB", reply); } // if no error channels explicitly defined exception is rethrown - @Test(expected=ArithmeticException.class) - public void testGatewaysNoErrorChannel(){ + @Test(expected = ArithmeticException.class) + public void testGatewaysNoErrorChannel() { testGatewayWithNoErrorChannelAAA.echo(0); } @Test - public void testWithSPCADefaultErrorChannel() throws Exception{ + public void testWithSPCADefaultErrorChannel() throws Exception { MessageHandler handler = mock(MessageHandler.class); errorChannel.subscribe(handler); inboundAdapterDefaultErrorChannel.start(); @@ -101,7 +101,7 @@ public class InnerGatewayWithChainTests { } @Test - public void testWithSPCAAssignedErrorChannel() throws Exception{ + public void testWithSPCAAssignedErrorChannel() throws Exception { MessageHandler handler = mock(MessageHandler.class); assignedErrorChannel.subscribe(handler); inboundAdapterAssignedErrorChannel.start(); @@ -110,7 +110,7 @@ public class InnerGatewayWithChainTests { verify(handler, times(1)).handleMessage(Mockito.any(Message.class)); } - public interface TestGateway{ + public interface TestGateway { String echo(int value); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/MessagingGatewayTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/MessagingGatewayTests.java index 5dd412336f..de92be9adc 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/MessagingGatewayTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/MessagingGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -65,7 +65,7 @@ public class MessagingGatewayTests { @Before public void initializeSample() { - this.messagingGateway = new MessagingGatewaySupport() {}; + this.messagingGateway = new MessagingGatewaySupport() { }; this.messagingGateway.setRequestChannel(requestChannel); this.messagingGateway.setReplyChannel(replyChannel); TestApplicationContext applicationContext = TestUtils.createTestApplicationContext(); @@ -87,7 +87,7 @@ public class MessagingGatewayTests { assertEquals(1, this.messagingGateway.getMessageCount()); } - @Test(expected=MessageDeliveryException.class) + @Test(expected = MessageDeliveryException.class) public void sendMessage_failure() { Mockito.when(messageMock.getHeaders()).thenReturn(new MessageHeaders(null)); Mockito.when(requestChannel.send(messageMock, 1000L)).thenReturn(false); @@ -109,7 +109,7 @@ public class MessagingGatewayTests { Mockito.verify(requestChannel).send(Mockito.any(Message.class), Mockito.eq(1000L)); } - @Test(expected=MessageDeliveryException.class) + @Test(expected = MessageDeliveryException.class) public void sendObject_failure() { Mockito.doAnswer(new Answer() { @@ -249,7 +249,7 @@ public class MessagingGatewayTests { } // should fail but it doesn't now - @Test(expected=MessagingException.class) + @Test(expected = MessagingException.class) public void validateErroMessageCanNotBeReplyMessage() { DirectChannel reqChannel = new DirectChannel(); reqChannel.subscribe(new MessageHandler() { @@ -264,7 +264,7 @@ public class MessagingGatewayTests { handler.afterPropertiesSet(); errorChannel.subscribe(handler); - this.messagingGateway = new MessagingGatewaySupport() {}; + this.messagingGateway = new MessagingGatewaySupport() { }; this.messagingGateway.setRequestChannel(reqChannel); this.messagingGateway.setErrorChannel(errorChannel); @@ -292,7 +292,7 @@ public class MessagingGatewayTests { handler.afterPropertiesSet(); errorChannel.subscribe(handler); - this.messagingGateway = new MessagingGatewaySupport() {}; + this.messagingGateway = new MessagingGatewaySupport() { }; this.messagingGateway.setRequestChannel(reqChannel); this.messagingGateway.setErrorChannel(errorChannel); @@ -304,13 +304,13 @@ public class MessagingGatewayTests { this.messagingGateway.send("hello"); } public static class MyErrorService { - public Message handleErrorMessage(Message errorMessage){ + public Message handleErrorMessage(Message errorMessage) { return errorMessage; } } public static class MyOneWayErrorService { - public void handleErrorMessage(Message errorMessage){ + public void handleErrorMessage(Message errorMessage) { } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/MultipleEndpointGatewayTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/MultipleEndpointGatewayTests.java index cd75d326e7..7f08f0fb25 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/MultipleEndpointGatewayTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/MultipleEndpointGatewayTests.java @@ -42,31 +42,31 @@ public class MultipleEndpointGatewayTests { private SampleGateway gatewayB; @Test - public void gatewayNoDefaultReplyChannel(){ + public void gatewayNoDefaultReplyChannel() { gatewayA.echo("echoAsMessageChannel"); // there is nothing to assert. Successful execution of the above is all we care in this test } @Test - public void gatewayWithDefaultReplyChannel(){ + public void gatewayWithDefaultReplyChannel() { gatewayB.echo("echoAsMessageChannelIgnoreDefOutChannel"); // there is nothing to assert. Successful execution of the above is all we care in this test } @Test - public void gatewayWithReplySentBackToDefaultReplyChannel(){ + public void gatewayWithReplySentBackToDefaultReplyChannel() { gatewayB.echo("echoAsMessageChannelDefaultOutputChannel"); // there is nothing to assert. Successful execution of the above is all we care in this test } - public interface SampleGateway{ + public interface SampleGateway { Object echo(Object value); } public static class SampleEchoService { - public Object echo(Object value){ + public Object echo(Object value) { return "R:" + value; } - public Message echoAsMessage(Object value){ + public Message echoAsMessage(Object value) { return MessageBuilder.withPayload("R:" + value).build(); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/NestedGatewayTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/NestedGatewayTests.java index 0503c2fe0d..3876fc2291 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/NestedGatewayTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/NestedGatewayTests.java @@ -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. @@ -43,7 +43,7 @@ public class NestedGatewayTests { return requestMessage.getPayload() + "-reply"; } }); - final MessagingGatewaySupport innerGateway = new MessagingGatewaySupport() {}; + final MessagingGatewaySupport innerGateway = new MessagingGatewaySupport() { }; innerGateway.setRequestChannel(innerChannel); innerGateway.setBeanFactory(mock(BeanFactory.class)); innerGateway.afterPropertiesSet(); @@ -54,7 +54,7 @@ public class NestedGatewayTests { "pre-" + requestMessage.getPayload()).getPayload() + "-post"; } }); - MessagingGatewaySupport outerGateway = new MessagingGatewaySupport() {}; + MessagingGatewaySupport outerGateway = new MessagingGatewaySupport() { }; outerGateway.setRequestChannel(outerChannel); outerGateway.setBeanFactory(mock(BeanFactory.class)); outerGateway.afterPropertiesSet(); @@ -72,7 +72,7 @@ public class NestedGatewayTests { return requestMessage.getPayload() + "-reply"; } }); - MessagingGatewaySupport gateway = new MessagingGatewaySupport() {}; + MessagingGatewaySupport gateway = new MessagingGatewaySupport() { }; gateway.setRequestChannel(requestChannel); gateway.setBeanFactory(mock(BeanFactory.class)); gateway.afterPropertiesSet(); @@ -93,7 +93,7 @@ public class NestedGatewayTests { return requestMessage.getPayload() + "-reply"; } }); - MessagingGatewaySupport gateway = new MessagingGatewaySupport() {}; + MessagingGatewaySupport gateway = new MessagingGatewaySupport() { }; gateway.setRequestChannel(requestChannel); gateway.setBeanFactory(mock(BeanFactory.class)); gateway.afterPropertiesSet(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/BridgeHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/BridgeHandlerTests.java index ae2abdaba1..7be44303b4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/BridgeHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/BridgeHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -36,7 +36,7 @@ import org.springframework.messaging.core.DestinationResolutionException; */ public class BridgeHandlerTests { - private BridgeHandler handler= new BridgeHandler(); + private BridgeHandler handler = new BridgeHandler(); @Factory public static Matcher> sameExceptImmutableHeaders(Message expected) { @@ -60,7 +60,7 @@ public class BridgeHandlerTests { handler.handleMessage(request); } - @Test(timeout=1000) + @Test(timeout = 1000) public void missingOutputChannelAllowedForReplyChannelMessages() throws Exception { PollableChannel replyChannel = new QueueChannel(); Message request = MessageBuilder.withPayload("tst").setReplyChannel(replyChannel ).build(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/ExpressionEvaluatingMessageProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/ExpressionEvaluatingMessageProcessorTests.java index 8d783a955b..8813f2eeaa 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/ExpressionEvaluatingMessageProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/ExpressionEvaluatingMessageProcessorTests.java @@ -84,7 +84,7 @@ public class ExpressionEvaluatingMessageProcessorTests { @SuppressWarnings("unused") class TestTarget { public String stringify(int number) { - return number+""; + return number + ""; } } Expression expression = expressionParser.parseExpression("#target.stringify(payload)"); @@ -137,7 +137,7 @@ public class ExpressionEvaluatingMessageProcessorTests { EvaluationContext evaluationContext = TestUtils.getPropertyValue(processor, "evaluationContext", EvaluationContext.class); evaluationContext.setVariable("target", new TestTarget()); String result = (String) processor.processMessage(new GenericMessage("classpath*:*.properties")); - assertTrue("Wrong result: "+result, result.contains("log4j.properties")); + assertTrue("Wrong result: " + result, result.contains("log4j.properties")); } @SuppressWarnings({ "rawtypes", "unchecked" }) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorAnnotationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorAnnotationTests.java index 4fcdc3ec1b..0b3685008c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorAnnotationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorAnnotationTests.java @@ -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. @@ -347,7 +347,7 @@ public class MethodInvokingMessageProcessorAnnotationTests { private final Log logger = LogFactory.getLog(this.getClass()); - public Map mapOnly(Map map) { + public Map mapOnly(Map map) { return map; } @@ -363,11 +363,11 @@ public class MethodInvokingMessageProcessorAnnotationTests { return fname + day; } - public Integer optionalHeader(@Header(required=false) Integer num) { + public Integer optionalHeader(@Header(required = false) Integer num) { return num; } - public Integer requiredHeader(@Header(value="num", required=true) Integer num) { + public Integer requiredHeader(@Header(value = "num", required = true) Integer num) { return num; } @@ -376,7 +376,7 @@ public class MethodInvokingMessageProcessorAnnotationTests { return lastName + ", " + firstName; } - public String optionalAndRequiredHeader(@Header(required=false) String prop, @Header(value="num", required=true) Integer num) { + public String optionalAndRequiredHeader(@Header(required = false) String prop, @Header(value = "num", required = true) Integer num) { return prop + num; } @@ -419,7 +419,7 @@ public class MethodInvokingMessageProcessorAnnotationTests { @Header("month") String argB, @Payload Employee payloadArg, @Payload("fname") String value, - @Headers Map headers) { + @Headers Map headers) { return new Object[] { argA, argB, payloadArg, value, headers }; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorTests.java index b785181e94..b87a95fc42 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorTests.java @@ -526,8 +526,8 @@ public class MethodInvokingMessageProcessorTests { private final Map arguments = new LinkedHashMap(); - public void optionalHeaders(Optional foo, @Header(value="foo", required=false) String foo1, - @Header(value="foo") Optional foo2) { + public void optionalHeaders(Optional foo, @Header(value = "foo", required = false) String foo1, + @Header(value = "foo") Optional foo2) { this.arguments.put("foo", (foo.isPresent() ? foo.get() : null)); this.arguments.put("foo1", foo1); this.arguments.put("foo2", (foo2.isPresent() ? foo2.get() : null)); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/history/AnnotatedAdapter.java b/spring-integration-core/src/test/java/org/springframework/integration/history/AnnotatedAdapter.java index 7d19a6b325..8142ad96a6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/history/AnnotatedAdapter.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/history/AnnotatedAdapter.java @@ -28,12 +28,12 @@ import org.springframework.integration.annotation.MessageEndpoint; * */ @MessageEndpoint(value = "outputAdapter") -public class AnnotatedAdapter implements ApplicationContextAware{ +public class AnnotatedAdapter implements ApplicationContextAware { private volatile ApplicationContext applicationContext; @SuppressWarnings("serial") public void handle(Message message) { - applicationContext.publishEvent(new ApplicationEvent(message) {}); + applicationContext.publishEvent(new ApplicationEvent(message) { }); } public void setApplicationContext(ApplicationContext applicationContext) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/history/AnotatedTests.java b/spring-integration-core/src/test/java/org/springframework/integration/history/AnotatedTests.java index 91a44a55bb..af279e5151 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/history/AnotatedTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/history/AnotatedTests.java @@ -45,7 +45,7 @@ import org.springframework.integration.test.util.TestUtils; public class AnotatedTests { @Test - public void testHistoryWithAnnotatedComponents() throws Exception{ + public void testHistoryWithAnnotatedComponents() throws Exception { ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("annotated-config.xml", this.getClass()); ApplicationListener listener = new ApplicationListener() { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/history/MessageHistoryIntegrationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/history/MessageHistoryIntegrationTests.java index 96d7166cfe..b570e556c7 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/history/MessageHistoryIntegrationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/history/MessageHistoryIntegrationTests.java @@ -201,7 +201,7 @@ public class MessageHistoryIntegrationTests { Mockito.verify(handler, Mockito.times(1)).handleMessage(Mockito.any(Message.class)); } - @Test(expected=BeanCreationException.class) + @Test(expected = BeanCreationException.class) public void testMessageHistoryMoreThanOneNamespaceFail() { new ClassPathXmlApplicationContext("messageHistoryWithHistoryWriterNamespace-fail.xml", MessageHistoryIntegrationTests.class); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonInboundMessageMapperTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonInboundMessageMapperTests.java index cd4520b734..d6e75b496c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonInboundMessageMapperTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonInboundMessageMapperTests.java @@ -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. @@ -117,7 +117,7 @@ public abstract class AbstractJsonInboundMessageMapperTests { String jsonMessage = "{\"headers\":{\"timestamp\":1,\"id\":\"" + id + "\",\"foo\":123,\"bar\":\"abc\"},\"payload\":[\"myPayloadStuff1\",\"myPayloadStuff2\",\"myPayloadStuff3\"]}"; List expectedList = Arrays.asList("myPayloadStuff1", "myPayloadStuff2", "myPayloadStuff3"); Message> expected = MessageBuilder.withPayload(expectedList).setHeader("foo", 123).setHeader("bar", "abc").build(); - JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(new ParameterizedTypeReference>(){}.getType(), getParser()); + JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(new ParameterizedTypeReference>() { }.getType(), getParser()); Message result = mapper.toMessage(jsonMessage); assertThat(result, sameExceptImmutableHeaders(expected)); } @@ -130,7 +130,7 @@ public abstract class AbstractJsonInboundMessageMapperTests { String jsonMessage = "{\"headers\":{\"timestamp\":1,\"id\":\"" + id + "\",\"foo\":123,\"bar\":\"abc\"},\"payload\":[" + getBeanAsJson(bean1) + "," + getBeanAsJson(bean2) + "]}"; List expectedList = Arrays.asList(bean1, bean2); Message> expected = MessageBuilder.withPayload(expectedList).setHeader("foo", 123).setHeader("bar", "abc").build(); - JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(new ParameterizedTypeReference>(){}.getType(), getParser()); + JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(new ParameterizedTypeReference>() { }.getType(), getParser()); Message result = mapper.toMessage(jsonMessage); assertThat(result, sameExceptImmutableHeaders(expected)); } @@ -153,7 +153,7 @@ public abstract class AbstractJsonInboundMessageMapperTests { mapper.toMessage(jsonMessage); fail(); } - catch(IllegalArgumentException ex) { + catch (IllegalArgumentException ex) { //Expected } } @@ -167,7 +167,7 @@ public abstract class AbstractJsonInboundMessageMapperTests { mapper.toMessage(jsonMessage); fail(); } - catch(IllegalArgumentException ex) { + catch (IllegalArgumentException ex) { //Expected } } @@ -182,7 +182,7 @@ public abstract class AbstractJsonInboundMessageMapperTests { mapper.toMessage(jsonMessage); fail(); } - catch(IllegalArgumentException ex) { + catch (IllegalArgumentException ex) { //Expected } } @@ -198,7 +198,7 @@ public abstract class AbstractJsonInboundMessageMapperTests { mapper.toMessage(jsonMessage); fail(); } - catch(IllegalArgumentException ex) { + catch (IllegalArgumentException ex) { //Expected } } @@ -213,7 +213,7 @@ public abstract class AbstractJsonInboundMessageMapperTests { mapper.toMessage(jsonMessage); fail(); } - catch(IllegalArgumentException ex) { + catch (IllegalArgumentException ex) { //Expected } } @@ -231,7 +231,7 @@ public abstract class AbstractJsonInboundMessageMapperTests { mapper.toMessage(jsonMessage); fail(); } - catch(IllegalArgumentException ex) { + catch (IllegalArgumentException ex) { //Expected } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonOutboundMessageMapperTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonOutboundMessageMapperTests.java index 3eb565e96a..8cd3981181 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonOutboundMessageMapperTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonOutboundMessageMapperTests.java @@ -52,8 +52,8 @@ public class JsonOutboundMessageMapperTests { JsonOutboundMessageMapper mapper = new JsonOutboundMessageMapper(); String result = mapper.fromMessage(testMessage); assertTrue(result.contains("\"headers\":{")); - assertTrue(result.contains("\"timestamp\":"+testMessage.getHeaders().getTimestamp())); - assertTrue(result.contains("\"id\":\""+testMessage.getHeaders().getId()+"\"")); + assertTrue(result.contains("\"timestamp\":" + testMessage.getHeaders().getTimestamp())); + assertTrue(result.contains("\"id\":\"" + testMessage.getHeaders().getId() + "\"")); assertTrue(result.contains("\"payload\":\"myPayloadStuff\"")); } @@ -66,8 +66,8 @@ public class JsonOutboundMessageMapperTests { JsonOutboundMessageMapper mapper = new JsonOutboundMessageMapper(); String result = mapper.fromMessage(testMessage); assertTrue(result.contains("\"headers\":{")); - assertTrue(result.contains("\"timestamp\":"+testMessage.getHeaders().getTimestamp())); - assertTrue(result.contains("\"id\":\""+testMessage.getHeaders().getId()+"\"")); + assertTrue(result.contains("\"timestamp\":" + testMessage.getHeaders().getTimestamp())); + assertTrue(result.contains("\"id\":\"" + testMessage.getHeaders().getId() + "\"")); assertTrue(result.contains("\"payload\":\"myPayloadStuff\"")); assertTrue(result.contains("\"history\":")); assertTrue(result.contains("testName-1")); @@ -95,8 +95,8 @@ public class JsonOutboundMessageMapperTests { JsonOutboundMessageMapper mapper = new JsonOutboundMessageMapper(); String result = mapper.fromMessage(testMessage); assertTrue(result.contains("\"headers\":{")); - assertTrue(result.contains("\"timestamp\":"+testMessage.getHeaders().getTimestamp())); - assertTrue(result.contains("\"id\":\""+testMessage.getHeaders().getId()+"\"")); + assertTrue(result.contains("\"timestamp\":" + testMessage.getHeaders().getTimestamp())); + assertTrue(result.contains("\"id\":\"" + testMessage.getHeaders().getId() + "\"")); TestBean parsedPayload = extractJsonPayloadToTestBean(result); assertEquals(payload, parsedPayload); } @@ -117,7 +117,7 @@ public class JsonOutboundMessageMapperTests { JsonParser parser = jsonFactory.createParser(json); do { parser.nextToken(); - } while(parser.getCurrentToken() != JsonToken.FIELD_NAME || !parser.getCurrentName().equals("payload")); + } while (parser.getCurrentToken() != JsonToken.FIELD_NAME || !parser.getCurrentName().equals("payload")); parser.nextToken(); return objectMapper.readValue(parser, TestBean.class); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonPathTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonPathTests.java index f894596840..73babbaf36 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonPathTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonPathTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-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. @@ -179,7 +179,7 @@ public class JsonPathTests { @Test public void testInt3139JsonPathSplitter() { this.splitterInput.send(testMessage); - for(int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { Message receive = this.splitterOutput.receive(10000); assertNotNull(receive); assertTrue(receive.getPayload() instanceof Map); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerParserTests.java index a6494e2923..881c39b948 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerParserTests.java @@ -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. @@ -76,7 +76,7 @@ public class ObjectToJsonTransformerParserTests { private volatile MessageChannel boonJsonNodeInput; @Test - public void testContentType(){ + public void testContentType() { ObjectToJsonTransformer transformer = TestUtils.getPropertyValue(context.getBean("defaultTransformer"), "handler.transformer", ObjectToJsonTransformer.class); assertEquals("application/json", TestUtils.getPropertyValue(transformer, "contentType")); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderAtConfigTests.java b/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderAtConfigTests.java index 268a3daf07..b7ae20e286 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderAtConfigTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderAtConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-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. @@ -45,7 +45,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @author Gary Russell * @author Marius Bogoevici */ -@ContextConfiguration(classes=MBConfig.class) +@ContextConfiguration(classes = MBConfig.class) @RunWith(SpringJUnit4ClassRunner.class) public class MessageBuilderAtConfigTests { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderTests.java b/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderTests.java index 8bc4a602c3..ceacb8e6c2 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderTests.java @@ -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. @@ -61,8 +61,8 @@ public class MessageBuilderTests { @Autowired private MessageBuilderFactory messageBuilderFactory; - @Test(expected= IllegalArgumentException.class) // priority must be an Integer - public void testPriorityHeader(){ + @Test(expected = IllegalArgumentException.class) // priority must be an Integer + public void testPriorityHeader() { MessageBuilder.withPayload("ha").setHeader("priority", "10").build(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingMessageSourceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingMessageSourceTests.java index f70d521a66..229a1ceb11 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingMessageSourceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingMessageSourceTests.java @@ -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. @@ -70,7 +70,7 @@ public class MethodInvokingMessageSourceTests { assertEquals(123, result.getHeaders().get("bar")); } - @Test(expected=MessagingException.class) + @Test(expected = MessagingException.class) public void testNoMatchingMethodName() { MethodInvokingMessageSource source = new MethodInvokingMessageSource(); source.setBeanFactory(mock(BeanFactory.class)); @@ -79,7 +79,7 @@ public class MethodInvokingMessageSourceTests { source.receive(); } - @Test(expected=MessagingException.class) + @Test(expected = MessagingException.class) public void testInvalidMethodWithArg() { MethodInvokingMessageSource source = new MethodInvokingMessageSource(); source.setBeanFactory(mock(BeanFactory.class)); @@ -88,7 +88,7 @@ public class MethodInvokingMessageSourceTests { source.receive(); } - @Test(expected=MessagingException.class) + @Test(expected = MessagingException.class) public void testInvalidMethodWithNoReturnValue() { MethodInvokingMessageSource source = new MethodInvokingMessageSource(); source.setBeanFactory(mock(BeanFactory.class)); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/resource/ResourceInboundChannelAdapterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/resource/ResourceInboundChannelAdapterParserTests.java index f29fca2f6f..fcebd924de 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/resource/ResourceInboundChannelAdapterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/resource/ResourceInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -71,7 +71,7 @@ public class ResourceInboundChannelAdapterParserTests { @Test - public void testDefaultConfig(){ + public void testDefaultConfig() { ApplicationContext context = new ClassPathXmlApplicationContext("ResourcePatternResolver-config.xml", this.getClass()); SourcePollingChannelAdapter resourceAdapter = context.getBean("resourceAdapterDefault", SourcePollingChannelAdapter.class); ResourceRetrievingMessageSource source = TestUtils.getPropertyValue(resourceAdapter, "source", ResourceRetrievingMessageSource.class); @@ -83,13 +83,13 @@ public class ResourceInboundChannelAdapterParserTests { assertEquals(context, TestUtils.getPropertyValue(source, "patternResolver")); } - @Test(expected=BeanCreationException.class) - public void testDefaultConfigNoLocationPattern(){ + @Test(expected = BeanCreationException.class) + public void testDefaultConfigNoLocationPattern() { new ClassPathXmlApplicationContext("ResourcePatternResolver-config-fail.xml", this.getClass()); } @Test - public void testCustomPatternResolver(){ + public void testCustomPatternResolver() { ApplicationContext context = new ClassPathXmlApplicationContext("ResourcePatternResolver-config-custom.xml", this.getClass()); SourcePollingChannelAdapter resourceAdapter = context.getBean("resourceAdapterDefault", SourcePollingChannelAdapter.class); ResourceRetrievingMessageSource source = TestUtils.getPropertyValue(resourceAdapter, "source", ResourceRetrievingMessageSource.class); @@ -99,10 +99,10 @@ public class ResourceInboundChannelAdapterParserTests { @SuppressWarnings("unchecked") @Test - public void testUsage() throws Exception{ + public void testUsage() throws Exception { for (int i = 0; i < 10; i++) { - File f = new File(workDir, "testUsage"+i); + File f = new File(workDir, "testUsage" + i); f.createNewFile(); } @@ -118,10 +118,10 @@ public class ResourceInboundChannelAdapterParserTests { @SuppressWarnings("unchecked") @Test - public void testUsageWithCustomResourceFilter() throws Exception{ + public void testUsageWithCustomResourceFilter() throws Exception { for (int i = 0; i < 10; i++) { - File f = new File(workDir, "testUsageWithRf"+i); + File f = new File(workDir, "testUsageWithRf" + i); f.createNewFile(); } @@ -141,10 +141,10 @@ public class ResourceInboundChannelAdapterParserTests { } @Test - public void testUsageWithEmptyFilter() throws Exception{ + public void testUsageWithEmptyFilter() throws Exception { for (int i = 0; i < 10; i++) { - File f = new File(workDir, "testUsageWithRf"+i); + File f = new File(workDir, "testUsageWithRf" + i); f.createNewFile(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/ErrorMessageExceptionTypeRouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/ErrorMessageExceptionTypeRouterTests.java index f0e12786df..60f6b9844c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/ErrorMessageExceptionTypeRouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/ErrorMessageExceptionTypeRouterTests.java @@ -56,7 +56,7 @@ public class ErrorMessageExceptionTypeRouterTests { private QueueChannel defaultChannel = new QueueChannel(); @Before - public void prepare(){ + public void prepare() { beanFactory.registerSingleton("illegalArgumentChannel", illegalArgumentChannel); beanFactory.registerSingleton("runtimeExceptionChannel", runtimeExceptionChannel); beanFactory.registerSingleton("messageHandlingExceptionChannel", messageHandlingExceptionChannel); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/PayloadTypeRouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/PayloadTypeRouterTests.java index 5955027faa..91e1276459 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/PayloadTypeRouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/PayloadTypeRouterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -500,7 +500,7 @@ public class PayloadTypeRouterTests { assertNotNull(c2Channel.receive(100)); } - @Test(expected=MessageHandlingException.class) + @Test(expected = MessageHandlingException.class) public void classLosesOverLessDistantAmbiguousInterfaces() throws Exception { QueueChannel defaultChannel = new QueueChannel(); defaultChannel.setBeanName("defaultChannel"); @@ -533,7 +533,7 @@ public class PayloadTypeRouterTests { router.handleMessage(message); } - @Test(expected=MessageHandlingException.class) + @Test(expected = MessageHandlingException.class) public void classLosesOverAmbiguousInterfacesAtSameLevel() throws Exception { QueueChannel defaultChannel = new QueueChannel(); defaultChannel.setBeanName("defaultChannel"); @@ -567,24 +567,24 @@ public class PayloadTypeRouterTests { } @SuppressWarnings("serial") - public static class C1 extends C2 implements I1A, I1B {} + public static class C1 extends C2 implements I1A, I1B { } - public interface I1A extends Serializable {} + public interface I1A extends Serializable { } - public interface I1B extends I2 {} + public interface I1B extends I2 { } - public interface I2 extends I3 {} + public interface I2 extends I3 { } - public interface I3 extends I4 {} + public interface I3 extends I4 { } - public interface I4 extends I5A, I5B {} + public interface I4 extends I5A, I5B { } - public interface I5A {} + public interface I5A { } - public interface I5B {} + public interface I5B { } - public static class C2 extends C3 {} + public static class C2 extends C3 { } - public static class C3 implements I4 {} + public static class C3 implements I4 { } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/RouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/RouterTests.java index 8d32b1b7c3..229fa53ece 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/RouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/RouterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -101,7 +101,7 @@ public class RouterTests { public void channelMappingIsRequiredWhenResolvingChannelNames() { AbstractMappingMessageRouter router = new AbstractMappingMessageRouter() { @SuppressWarnings("unchecked") - protected List getChannelKeys(Message message){ + protected List getChannelKeys(Message message) { return CollectionUtils.arrayToList(new String[] { "notImportant" }); } }; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/config/ExceptionTypeRouterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/config/ExceptionTypeRouterParserTests.java index 19e7a12ffd..bcd99a20b5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/config/ExceptionTypeRouterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/config/ExceptionTypeRouterParserTests.java @@ -37,7 +37,7 @@ public class ExceptionTypeRouterParserTests { @SuppressWarnings("unchecked") @Test - public void testExceptionTypeRouterConfig(){ + public void testExceptionTypeRouterConfig() { ApplicationContext context = new ClassPathXmlApplicationContext("ExceptionTypeRouterParserTests-context.xml", this.getClass()); MessageChannel inputChannel = context.getBean("inChannel", MessageChannel.class); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java index 4f27134da9..6c00ef1197 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java @@ -69,8 +69,8 @@ public class PayloadTypeRouterParserTests { assertTrue(chanel4.receive(100).getPayload().getClass().isArray()); } - @Test(expected=BeanDefinitionStoreException.class) - public void testNoMappingElement(){ + @Test(expected = BeanDefinitionStoreException.class) + public void testNoMappingElement() { ByteArrayInputStream stream = new ByteArrayInputStream(routerConfigNoMaping.getBytes()); GenericApplicationContext ac = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ac); @@ -106,7 +106,7 @@ public class PayloadTypeRouterParserTests { ""; - public interface TestService{ + public interface TestService { void foo(Message message); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/config/RouterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/config/RouterParserTests.java index 0d8b3e78ff..9a45dcf65e 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/config/RouterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/config/RouterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -168,7 +168,7 @@ public class RouterParserTests { } } - @Test(expected=MessageDeliveryException.class) + @Test(expected = MessageDeliveryException.class) public void testResolutionRequiredIsFalse() { this.resolutionRequiredIsFalseInput.send(new GenericMessage("channelThatDoesNotExist")); } @@ -224,7 +224,7 @@ public class RouterParserTests { } @Test - public void testErrorChannel(){ + public void testErrorChannel() { MessageHandler handler = mock(MessageHandler.class); this.errorChannel.subscribe(handler); this.routerAndErrorChannelInputChannel.send(new GenericMessage("fail")); @@ -232,13 +232,13 @@ public class RouterParserTests { } @Test // should not fail - public void routerFactoryBeanTest(){ + public void routerFactoryBeanTest() { new ClassPathXmlApplicationContext("rfb-fix-config.xml", this.getClass()); } - public static class NonExistingChannelRouter{ - public String route(String payload){ + public static class NonExistingChannelRouter { + public String route(String payload) { return "foo"; } } @@ -254,7 +254,7 @@ public class RouterParserTests { @Override protected List getChannelKeys(Message message) { - return Collections.singletonList((Object)this.channel); + return Collections.singletonList((Object) this.channel); } } @@ -277,7 +277,7 @@ public class RouterParserTests { @Router public String route(Message message) { - return (String)message.getPayload(); + return (String) message.getPayload(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/splitter/SplitterIntegrationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/splitter/SplitterIntegrationTests.java index c3f55198f5..43cd200c9f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/splitter/SplitterIntegrationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/splitter/SplitterIntegrationTests.java @@ -52,7 +52,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class SplitterIntegrationTests { @Autowired diff --git a/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreReaperTests.java b/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreReaperTests.java index ef02246f13..74280cef62 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreReaperTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreReaperTests.java @@ -89,7 +89,7 @@ public class MessageStoreReaperTests { } @Test - public void testSmartLifecycle() throws Exception{ + public void testSmartLifecycle() throws Exception { GenericMessage testMessage = new GenericMessage("foo"); messageStore2.addMessageToGroup("FOO", testMessage); @@ -99,7 +99,7 @@ public class MessageStoreReaperTests { reaper2.setTimeout(0); - if (!reaper2.isAutoStartup()){ + if (!reaper2.isAutoStartup()) { reaper2.start(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/store/SimpleMessageGroupTests.java b/spring-integration-core/src/test/java/org/springframework/integration/store/SimpleMessageGroupTests.java index d3b722f9a5..f7acf18d51 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/store/SimpleMessageGroupTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/store/SimpleMessageGroupTests.java @@ -48,16 +48,16 @@ public class SimpleMessageGroupTests { private SimpleMessageGroup group = new SimpleMessageGroup(Collections.> emptyList(), key); @SuppressWarnings("unchecked") - public void prepareForSequenceAwareMessageGroup() throws Exception{ + public void prepareForSequenceAwareMessageGroup() throws Exception { Class clazz = - (Class)Class.forName("org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler$SequenceAwareMessageGroup"); + (Class) Class.forName("org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler$SequenceAwareMessageGroup"); Constructor ctr = clazz.getDeclaredConstructor(MessageGroup.class); ctr.setAccessible(true); group = ctr.newInstance(group); } @Test - public void shouldFindSupersedingMessagesIfSequenceAware() throws Exception{ + public void shouldFindSupersedingMessagesIfSequenceAware() throws Exception { this.prepareForSequenceAwareMessageGroup(); final Message message1 = MessageBuilder.withPayload("test").setSequenceNumber(1).build(); final Message message2 = MessageBuilder.fromMessage(message1).setSequenceNumber(1).build(); @@ -68,7 +68,7 @@ public class SimpleMessageGroupTests { } @Test - public void shouldIgnoreMessagesWithZeroSequenceNumberIfSequenceAware() throws Exception{ + public void shouldIgnoreMessagesWithZeroSequenceNumberIfSequenceAware() throws Exception { this.prepareForSequenceAwareMessageGroup(); final Message message1 = MessageBuilder.withPayload("test").build(); final Message message2 = MessageBuilder.fromMessage(message1).build(); @@ -79,7 +79,7 @@ public class SimpleMessageGroupTests { } @Test // should not fail with NPE (see INT-2666) - public void shouldIgnoreNullValuesWhenInitializedWithCollectionContainingNulls() throws Exception{ + public void shouldIgnoreNullValuesWhenInitializedWithCollectionContainingNulls() throws Exception { Message m1 = mock(Message.class); Message m2 = mock(Message.class); final List> messages = new ArrayList>(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/support/MessageScenariosTests.java b/spring-integration-core/src/test/java/org/springframework/integration/support/MessageScenariosTests.java index bcb966111f..a73730fc4c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/support/MessageScenariosTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/support/MessageScenariosTests.java @@ -37,40 +37,40 @@ public class MessageScenariosTests extends AbstractRequestResponseScenarioTests @Override protected List defineRequestResponseScenarios() { - List scenarios= new ArrayList(); + List scenarios = new ArrayList(); RequestResponseScenario scenario1 = new RequestResponseScenario( - "inputChannel","outputChannel") + "inputChannel", "outputChannel") .setPayload("hello") .setResponseValidator(new PayloadValidator() { @Override protected void validateResponse(String response) { - assertEquals("HELLO",response); + assertEquals("HELLO", response); } }); scenarios.add(scenario1); RequestResponseScenario scenario2 = new RequestResponseScenario( - "inputChannel","outputChannel") + "inputChannel", "outputChannel") .setMessage(MessageBuilder.withPayload("hello").setHeader("foo", "bar").build()) .setResponseValidator(new MessageValidator() { @Override protected void validateMessage(Message message) { - assertThat(message,hasPayload("HELLO")); - assertThat(message,hasHeader("foo","bar")); + assertThat(message, hasPayload("HELLO")); + assertThat(message, hasHeader("foo", "bar")); } }); scenarios.add(scenario2); RequestResponseScenario scenario3 = new RequestResponseScenario( - "inputChannel2","outputChannel2") + "inputChannel2", "outputChannel2") .setMessage(MessageBuilder.withPayload("hello").setHeader("foo", "bar").build()) .setResponseValidator(new MessageValidator() { @Override protected void validateMessage(Message message) { - assertThat(message,hasPayload("HELLO")); - assertThat(message,hasHeader("foo","bar")); + assertThat(message, hasPayload("HELLO")); + assertThat(message, hasHeader("foo", "bar")); } }); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/support/SingleScenarioTests.java b/spring-integration-core/src/test/java/org/springframework/integration/support/SingleScenarioTests.java index 0378ebc948..94ab83981c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/support/SingleScenarioTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/support/SingleScenarioTests.java @@ -29,12 +29,12 @@ public class SingleScenarioTests extends SingleRequestResponseScenarioTests { @Override protected RequestResponseScenario defineRequestResponseScenario() { RequestResponseScenario scenario = new RequestResponseScenario( - "inputChannel","outputChannel") + "inputChannel", "outputChannel") .setPayload("hello") .setResponseValidator(new PayloadValidator() { @Override protected void validateResponse(String response) { - assertEquals("HELLO",response); + assertEquals("HELLO", response); } }); return scenario; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/support/locks/DefaultLockRegistryTests.java b/spring-integration-core/src/test/java/org/springframework/integration/support/locks/DefaultLockRegistryTests.java index 75d6cd1d3f..9c9f9f3cbb 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/support/locks/DefaultLockRegistryTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/support/locks/DefaultLockRegistryTests.java @@ -31,13 +31,13 @@ import org.junit.Test; */ public class DefaultLockRegistryTests { - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testBadMask() { new DefaultLockRegistry(4); } - @Test(expected=IllegalArgumentException.class) - public void testBadMaskOutOfRange() {// 32bits + @Test(expected = IllegalArgumentException.class) + public void testBadMaskOutOfRange() { // 32bits new DefaultLockRegistry(0xffffffff); } @@ -60,13 +60,15 @@ public class DefaultLockRegistryTests { @Override public int hashCode() { return 0; - }}); + } + }); Lock lock2 = registry.obtain(new Object() { @Override public int hashCode() { return 256; - }}); + } + }); assertSame(lock1, lock2); } @@ -78,13 +80,15 @@ public class DefaultLockRegistryTests { @Override public int hashCode() { return 0; - }}); + } + }); Lock lock2 = registry.obtain(new Object() { @Override public int hashCode() { return 255; - }}); + } + }); assertNotSame(lock1, lock2); } @@ -97,25 +101,29 @@ public class DefaultLockRegistryTests { @Override public int hashCode() { return 0; - }}); + } + }); locks[1] = registry.obtain(new Object() { @Override public int hashCode() { return 1; - }}); + } + }); locks[2] = registry.obtain(new Object() { @Override public int hashCode() { return 2; - }}); + } + }); locks[3] = registry.obtain(new Object() { @Override public int hashCode() { return 3; - }}); + } + }); for (int i = 0; i < 4; i++) { for (int j = 1; j < 4; j++) { if (i != j) { @@ -129,25 +137,29 @@ public class DefaultLockRegistryTests { @Override public int hashCode() { return 0; - }}); + } + }); moreLocks[1] = registry.obtain(new Object() { @Override public int hashCode() { return 1; - }}); + } + }); moreLocks[2] = registry.obtain(new Object() { @Override public int hashCode() { return 2; - }}); + } + }); moreLocks[3] = registry.obtain(new Object() { @Override public int hashCode() { return 3; - }}); + } + }); assertSame(locks[0], moreLocks[0]); assertSame(locks[1], moreLocks[1]); assertSame(locks[2], moreLocks[2]); @@ -157,25 +169,29 @@ public class DefaultLockRegistryTests { @Override public int hashCode() { return 4; - }}); + } + }); moreLocks[1] = registry.obtain(new Object() { @Override public int hashCode() { return 5; - }}); + } + }); moreLocks[2] = registry.obtain(new Object() { @Override public int hashCode() { return 6; - }}); + } + }); moreLocks[3] = registry.obtain(new Object() { @Override public int hashCode() { return 7; - }}); + } + }); assertSame(locks[0], moreLocks[0]); assertSame(locks[1], moreLocks[1]); assertSame(locks[2], moreLocks[2]); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageRatioTests.java b/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageRatioTests.java index 2ec00af804..2993a739ad 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageRatioTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageRatioTests.java @@ -111,7 +111,7 @@ public class ExponentialMovingAverageRatioTests { @Test public void testGetMeanFailuresHighRate() throws Exception { assertEquals(1, history.getMean(), 0.01); - history.success();// need an extra now that we can't determine the time between the first and previous + history.success(); // need an extra now that we can't determine the time between the first and previous history.success(); assertEquals(average(1), history.getMean(), 0.01); history.failure(); @@ -123,7 +123,7 @@ public class ExponentialMovingAverageRatioTests { @Test public void testGetMeanFailuresLowRate() throws Exception { assertEquals(1, history.getMean(), 0.01); - history.failure();// need an extra now that we can't determine the time between the first and previous + history.failure(); // need an extra now that we can't determine the time between the first and previous history.failure(); assertEquals(average(0), history.getMean(), 0.01); history.failure(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageTests.java b/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageTests.java index db6da494b9..54a3968dd5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -68,7 +68,7 @@ public class ExponentialMovingAverageTests { assertEquals(0, history.getStandardDeviation(), 0.01); history.append(1); history.append(2); - assertFalse(0==history.getStandardDeviation()); + assertFalse(0 == history.getStandardDeviation()); history.reset(); assertEquals(0, history.getStandardDeviation(), 0.01); // INT-2165 diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/ObjectToMapTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/ObjectToMapTransformerTests.java index f8a4ae0440..190bb1a317 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/ObjectToMapTransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/ObjectToMapTransformerTests.java @@ -142,8 +142,8 @@ public class ObjectToMapTransformerTests { assertEquals(valueFromTheMap, valueFromExpression); } - @Test(expected=MessageTransformationException.class) - public void testObjectToSpelMapTransformerWithCycle(){ + @Test(expected = MessageTransformationException.class) + public void testObjectToSpelMapTransformerWithCycle() { Employee employee = this.buildEmployee(); Child child = new Child(); Person parent = employee.getPerson(); @@ -155,15 +155,15 @@ public class ObjectToMapTransformerTests { } @SuppressWarnings({ "unchecked", "rawtypes" }) - public Employee buildEmployee(){ + public Employee buildEmployee() { Address companyAddress = new Address(); companyAddress.setCity("Philadelphia"); companyAddress.setStreet("1123 Main"); companyAddress.setZip("12345"); Map coordinates = new HashMap(); - coordinates.put("latitude", new Long[]{(long)1, (long)5, (long)13}); - coordinates.put("longitude", new Long[]{(long)156}); + coordinates.put("latitude", new Long[]{(long) 1, (long) 5, (long) 13}); + coordinates.put("longitude", new Long[]{(long) 156}); companyAddress.setCoordinates(coordinates); List datesA = new ArrayList(); @@ -209,7 +209,7 @@ public class ObjectToMapTransformerTests { remarksA.put("foo", "foo"); remarksA.put("bar", "bar"); remarksB.put("baz", "baz"); - List> remarks = new ArrayList>(); + List> remarks = new ArrayList>(); remarks.add(remarksA); remarks.add(remarksB); person.setRemarks(remarks); @@ -230,7 +230,7 @@ public class ObjectToMapTransformerTests { return employee; } - public static class Employee{ + public static class Employee { private List departments; private List> listOfDates; private String companyName; @@ -276,7 +276,7 @@ public class ObjectToMapTransformerTests { } } - public static class Person{ + public static class Person { private String fname; private String lname; private String[] akaNames; @@ -339,7 +339,7 @@ public class ObjectToMapTransformerTests { } } - public static class Address{ + public static class Address { private String street; private String city; private String zip; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadDeserializingTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadDeserializingTransformerTests.java index 968045aa3e..dd865163ed 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadDeserializingTransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadDeserializingTransformerTests.java @@ -74,7 +74,7 @@ public class PayloadDeserializingTransformerTests { @Test public void customDeserializer() { PayloadDeserializingTransformer transformer = new PayloadDeserializingTransformer(); - transformer.setConverter(new Converter(){ + transformer.setConverter(new Converter() { public Object convert(byte[] source) { return "Converted"; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadSerializingTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadSerializingTransformerTests.java index 776872c954..0e7851beaa 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadSerializingTransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadSerializingTransformerTests.java @@ -73,7 +73,7 @@ public class PayloadSerializingTransformerTests { @Test public void customSerializer() { PayloadSerializingTransformer transformer = new PayloadSerializingTransformer(); - transformer.setConverter(new Converter(){ + transformer.setConverter(new Converter() { public byte[] convert(Object source) { return "Converted".getBytes(); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadTransformerTests.java index 2f225a5f64..5199cd903e 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadTransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/PayloadTransformerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -39,14 +39,14 @@ public class PayloadTransformerTests { assertEquals(3, result.getPayload()); } - @Test(expected=MessagingException.class) + @Test(expected = MessagingException.class) public void testExceptionThrownByTransformer() { TestPayloadTransformer transformer = new TestPayloadTransformer(); Message message = new GenericMessage("bad"); transformer.transform(message); } - @Test(expected=MessagingException.class) + @Test(expected = MessagingException.class) public void testWrongPayloadType() { TestPayloadTransformer transformer = new TestPayloadTransformer(); Message message = new GenericMessage(new Date()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/util/BeanFactoryTypeConverterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/util/BeanFactoryTypeConverterTests.java index 2e5dc4ac12..b0466b972d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/util/BeanFactoryTypeConverterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/util/BeanFactoryTypeConverterTests.java @@ -76,7 +76,7 @@ public class BeanFactoryTypeConverterTests { @SuppressWarnings("unchecked") @Test - public void testEmptyCollectionConversion(){ + public void testEmptyCollectionConversion() { BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter(); List sourceObject = new ArrayList(); ArrayList convertedCollection = @@ -85,7 +85,7 @@ public class BeanFactoryTypeConverterTests { } @Test - public void testToStringConversion(){ + public void testToStringConversion() { BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter(); typeConverter.setBeanFactory(new DefaultListableBeanFactory()); String converted = (String) typeConverter.convertValue(new Integer(1234), TypeDescriptor.valueOf(Integer.class), TypeDescriptor.valueOf(String.class)); @@ -93,7 +93,7 @@ public class BeanFactoryTypeConverterTests { } @Test - public void testToNonStringConversionNotSupportedByGenericConversionService(){ + public void testToNonStringConversionNotSupportedByGenericConversionService() { BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter(); typeConverter.setBeanFactory(new DefaultListableBeanFactory()); @SuppressWarnings("unchecked") @@ -114,7 +114,7 @@ public class BeanFactoryTypeConverterTests { BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter(); typeConverter.setBeanFactory(new DefaultListableBeanFactory()); Message message = new GenericMessage("foo"); - message = MessageHistory.write(message, new NamedComponent(){ + message = MessageHistory.write(message, new NamedComponent() { @Override public String getComponentName() { return "bar"; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/util/SimplePoolTests.java b/spring-integration-core/src/test/java/org/springframework/integration/util/SimplePoolTests.java index 19a1701634..1d598ee129 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/util/SimplePoolTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/util/SimplePoolTests.java @@ -85,7 +85,7 @@ public class SimplePoolTests { pool.getItem(); fail("Expected exception"); } - catch (MessagingException e) {} + catch (MessagingException e) { } // resize up pool.setPoolSize(4); @@ -125,7 +125,7 @@ public class SimplePoolTests { assertEquals(2, pool.getAllocatedCount()); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testForeignObject() { final Set strings = new HashSet(); final AtomicBoolean stale = new AtomicBoolean(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/util/UUIDConverterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/util/UUIDConverterTests.java index 99cc433c69..5942ebe482 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/util/UUIDConverterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/util/UUIDConverterTests.java @@ -60,7 +60,7 @@ public class UUIDConverterTests { } catch (IllegalArgumentException e) { String message = e.getMessage(); - assertTrue("Wrong message: "+message, message.contains("Invalid UUID string")); + assertTrue("Wrong message: " + message, message.contains("Invalid UUID string")); } assertNotNull(UUIDConverter.getUUID(name)); } @@ -84,7 +84,7 @@ public class UUIDConverterTests { assertNotNull(UUIDConverter.getUUID(new Date())); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testConvertNonSerializable() throws Exception { assertNotNull(UUIDConverter.getUUID(new Object())); } diff --git a/spring-integration-feed/src/main/java/org/springframework/integration/feed/inbound/FeedEntryMessageSource.java b/spring-integration-feed/src/main/java/org/springframework/integration/feed/inbound/FeedEntryMessageSource.java index a5e0ed5e61..e469213d0c 100644 --- a/spring-integration-feed/src/main/java/org/springframework/integration/feed/inbound/FeedEntryMessageSource.java +++ b/spring-integration-feed/src/main/java/org/springframework/integration/feed/inbound/FeedEntryMessageSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -172,7 +172,7 @@ public class FeedEntryMessageSource extends IntegrationObjectSupport implements this.lastTime = lastModifiedDate.getTime(); } else { - this.lastTime += 1;//NOSONAR - single poller thread + this.lastTime += 1; //NOSONAR - single poller thread } this.metadataStore.put(this.metadataKey, this.lastTime + ""); return next; diff --git a/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests.java b/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests.java index a9bd4ba06b..ecc33f11c5 100644 --- a/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests.java +++ b/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -124,7 +124,7 @@ public class FeedInboundChannelAdapterParserTests { @Test @Ignore // goes against the real feed - public void validateSuccessfulNewsRetrievalWithHttpUrl() throws Exception{ + public void validateSuccessfulNewsRetrievalWithHttpUrl() throws Exception { final CountDownLatch latch = new CountDownLatch(3); MessageHandler handler = spy(new MessageHandler() { public void handleMessage(Message message) throws MessagingException { diff --git a/spring-integration-feed/src/test/java/org/springframework/integration/feed/inbound/FeedEntryMessageSourceTests.java b/spring-integration-feed/src/test/java/org/springframework/integration/feed/inbound/FeedEntryMessageSourceTests.java index b278ae385f..e5b16629c0 100644 --- a/spring-integration-feed/src/test/java/org/springframework/integration/feed/inbound/FeedEntryMessageSourceTests.java +++ b/spring-integration-feed/src/test/java/org/springframework/integration/feed/inbound/FeedEntryMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -54,7 +54,7 @@ public class FeedEntryMessageSourceTests { } } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testFailureWhenNotInitialized() throws Exception { URL url = new ClassPathResource("org/springframework/integration/feed/sample.rss").getURL(); FeedEntryMessageSource feedEntrySource = new FeedEntryMessageSource(url, "foo"); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java index 2649b424cc..d5566f9463 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java @@ -39,7 +39,7 @@ import org.springframework.integration.file.support.FileExistsMode; * @since 1.0.3 */ public class FileWritingMessageHandlerFactoryBean - extends AbstractSimpleMessageHandlerFactoryBean{ + extends AbstractSimpleMessageHandlerFactoryBean { private volatile File directory; diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractPersistentAcceptOnceFileListFilter.java b/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractPersistentAcceptOnceFileListFilter.java index 563dbcd2d6..361f047de7 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractPersistentAcceptOnceFileListFilter.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractPersistentAcceptOnceFileListFilter.java @@ -72,7 +72,7 @@ public abstract class AbstractPersistentAcceptOnceFileListFilter extends Abst @Override protected boolean accept(F file) { String key = buildKey(file); - synchronized(this.monitor) { + synchronized (this.monitor) { String newValue = value(file); String oldValue = this.store.putIfAbsent(key, newValue); if (oldValue == null) { // not in store diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java index d609a87c50..2909bb20e3 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java @@ -66,7 +66,7 @@ public class RemoteFileTemplate implements RemoteFileOperations, Initializ */ protected final SessionFactory sessionFactory; - private volatile String temporaryFileSuffix =".writing"; + private volatile String temporaryFileSuffix = ".writing"; private volatile boolean autoCreateDirectory = false; @@ -242,10 +242,10 @@ public class RemoteFileTemplate implements RemoteFileOperations, Initializ this.fileNameProcessor.setBeanFactory(beanFactory); } } - if (this.autoCreateDirectory){ + if (this.autoCreateDirectory) { Assert.hasText(this.remoteFileSeparator, "'remoteFileSeparator' must not be empty when 'autoCreateDirectory' is set to 'true'"); } - if (this.hasExplicitlySetSuffix && !this.useTemporaryFileName){ + if (this.hasExplicitlySetSuffix && !this.useTemporaryFileName) { this.logger.warn("Since 'use-temporary-file-name' is set to 'false' the value of 'temporary-file-suffix' has no effect"); } } @@ -538,7 +538,7 @@ public class RemoteFileTemplate implements RemoteFileOperations, Initializ } } - private String normalizeDirectoryPath(String directoryPath){ + private String normalizeDirectoryPath(String directoryPath) { if (!StringUtils.hasText(directoryPath)) { directoryPath = ""; } diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java index 07cbd91466..b3d0ba6805 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java @@ -32,7 +32,7 @@ import org.springframework.integration.file.remote.session.Session; */ public final class RemoteFileUtils { - private RemoteFileUtils() {} + private RemoteFileUtils() { } /** * Recursively create remote directories. @@ -46,13 +46,13 @@ public final class RemoteFileUtils { public static void makeDirectories(String path, Session session, String remoteFileSeparator, Log logger) throws IOException { - if (!session.exists(path)){ + if (!session.exists(path)) { int nextSeparatorIndex = path.lastIndexOf(remoteFileSeparator); - if (nextSeparatorIndex > -1){ + if (nextSeparatorIndex > -1) { List pathsToCreate = new LinkedList(); - while (nextSeparatorIndex > -1){ + while (nextSeparatorIndex > -1) { String pathSegment = path.substring(0, nextSeparatorIndex); if (pathSegment.length() == 0 || session.exists(pathSegment)) { // no more paths to create @@ -65,7 +65,7 @@ public final class RemoteFileUtils { } for (String pathToCreate : pathsToCreate) { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Creating '" + pathToCreate + "'"); } session.mkdir(pathToCreate); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java index 04dafab549..9a50c5cf45 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java @@ -691,7 +691,7 @@ public abstract class AbstractRemoteFileOutboundGateway extends AbstractReply String path = this.doPut(this.getMessageBuilderFactory().withPayload(filteredFile) .copyHeaders(requestMessage.getHeaders()) .build(), subDirectory); - if (path == null) {//NOSONAR - false positive + if (path == null) { //NOSONAR - false positive if (logger.isDebugEnabled()) { logger.debug("File " + filteredFile.getAbsolutePath() + " removed before transfer; ignoring"); } @@ -700,7 +700,7 @@ public abstract class AbstractRemoteFileOutboundGateway extends AbstractReply replies.add(path); } } - else if (this.options.contains(Option.RECURSIVE)){ + else if (this.options.contains(Option.RECURSIVE)) { String newSubDirectory = (StringUtils.hasText(subDirectory) ? subDirectory + this.remoteFileTemplate.getRemoteFileSeparator() : "") + filteredFile.getName(); @@ -878,7 +878,7 @@ public abstract class AbstractRemoteFileOutboundGateway extends AbstractReply outputStream.close(); tempFile.delete(); - if (e instanceof RuntimeException){ + if (e instanceof RuntimeException) { throw (RuntimeException) e; } else { @@ -1054,8 +1054,8 @@ public abstract class AbstractRemoteFileOutboundGateway extends AbstractReply return localDir; } - private String generateLocalFileName(Message message, String remoteFileName){ - if (this.localFilenameGeneratorExpression != null){ + private String generateLocalFileName(Message message, String remoteFileName) { + if (this.localFilenameGeneratorExpression != null) { EvaluationContext evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); evaluationContext.setVariable("remoteFileName", remoteFileName); return this.localFilenameGeneratorExpression.getValue(evaluationContext, message, String.class); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/CachingSessionFactory.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/CachingSessionFactory.java index b1c089ca62..fe4597bf3c 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/CachingSessionFactory.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/CachingSessionFactory.java @@ -178,16 +178,16 @@ public class CachingSessionFactory implements SessionFactory, DisposableBe @Override public synchronized void close() { if (this.released) { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Session " + this.targetSession + " already released."); } } else { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Releasing Session " + this.targetSession + " back to the pool."); } if (this.sharedSessionEpoch != CachingSessionFactory.this.sharedSessionEpoch) { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Closing session " + this.targetSession + " after reset."); } this.targetSession.close(); @@ -209,22 +209,22 @@ public class CachingSessionFactory implements SessionFactory, DisposableBe } @Override - public boolean remove(String path) throws IOException{ + public boolean remove(String path) throws IOException { return this.targetSession.remove(path); } @Override - public F[] list(String path) throws IOException{ + public F[] list(String path) throws IOException { return this.targetSession.list(path); } @Override - public void read(String source, OutputStream os) throws IOException{ + public void read(String source, OutputStream os) throws IOException { this.targetSession.read(source, os); } @Override - public void write(InputStream inputStream, String destination) throws IOException{ + public void write(InputStream inputStream, String destination) throws IOException { this.targetSession.write(inputStream, destination); } @@ -254,7 +254,7 @@ public class CachingSessionFactory implements SessionFactory, DisposableBe } @Override - public boolean exists(String path) throws IOException{ + public boolean exists(String path) throws IOException { return this.targetSession.exists(path); } diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java index 76803420a2..dc5353f9d3 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java @@ -75,7 +75,7 @@ public abstract class AbstractInboundFileSynchronizer /** * Extension used when downloading files. We change it right after we know it's downloaded. */ - private volatile String temporaryFileSuffix =".writing"; + private volatile String temporaryFileSuffix = ".writing"; private volatile Expression localFilenameGeneratorExpression; @@ -298,7 +298,7 @@ public abstract class AbstractInboundFileSynchronizer session.read(remoteFilePath, outputStream); } catch (Exception e) { - if (e instanceof RuntimeException){ + if (e instanceof RuntimeException) { throw (RuntimeException) e; } else { @@ -327,8 +327,8 @@ public abstract class AbstractInboundFileSynchronizer } } - private String generateLocalFileName(String remoteFileName){ - if (this.localFilenameGeneratorExpression != null){ + private String generateLocalFileName(String remoteFileName) { + if (this.localFilenameGeneratorExpression != null) { return this.localFilenameGeneratorExpression.getValue(this.evaluationContext, remoteFileName, String.class); } return remoteFileName; diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java index 0b98a341a3..c1687bb663 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -93,7 +93,7 @@ public abstract class AbstractInboundFileSynchronizingMessageSource Comparator comparator) { Assert.notNull(synchronizer, "synchronizer must not be null"); this.synchronizer = synchronizer; - if (comparator == null){ + if (comparator == null) { this.fileSource = new FileReadingMessageSource(); } else { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/splitter/FileSplitter.java b/spring-integration-file/src/main/java/org/springframework/integration/file/splitter/FileSplitter.java index e10b4cb447..727074be80 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/splitter/FileSplitter.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/splitter/FileSplitter.java @@ -196,7 +196,7 @@ public class FileSplitter extends AbstractMessageSplitter { bufferedReader.close(); this.done = true; } - catch (IOException e1) {} + catch (IOException e1) { } throw new MessageHandlingException(message, "IOException while iterating", e); } } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/BigMGetTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/BigMGetTests.java index bb893fe337..f72e3f41eb 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/BigMGetTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/BigMGetTests.java @@ -50,7 +50,7 @@ public abstract class BigMGetTests { for (int i = 0; i < FILES; i++) { File f = new File("/tmp/bigmget/file" + i); f.createNewFile(); - FileOutputStream fos = new FileOutputStream(f);//NOSONAR + FileOutputStream fos = new FileOutputStream(f); //NOSONAR fos.write(buff); fos.close(); } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests.java index 78771aec91..29d85b0190 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/FileReadingMessageSourceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -54,7 +54,7 @@ public class FileReadingMessageSourceIntegrationTests { @AfterClass public static void cleanUp() throws Throwable { - if(inputDir.exists()) { + if (inputDir.exists()) { inputDir.delete(); } } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/FileReadingMessageSourcePersistentFilterIntegrationTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/FileReadingMessageSourcePersistentFilterIntegrationTests.java index 524b37b623..299df932ee 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/FileReadingMessageSourcePersistentFilterIntegrationTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/FileReadingMessageSourcePersistentFilterIntegrationTests.java @@ -48,7 +48,7 @@ public class FileReadingMessageSourcePersistentFilterIntegrationTests { @AfterClass public static void cleanUp() throws Throwable { - if(inputDir.exists()) { + if (inputDir.exists()) { inputDir.delete(); } } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithClasspathInPropertiesTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithClasspathInPropertiesTests.java index 77b77dc832..d94965ca5d 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithClasspathInPropertiesTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithClasspathInPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 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. @@ -37,7 +37,7 @@ import static org.junit.Assert.assertEquals; @RunWith(SpringJUnit4ClassRunner.class) public class FileInboundChannelAdapterWithClasspathInPropertiesTests { - @Autowired(required=true) + @Autowired(required = true) private FileReadingMessageSource source; private DirectFieldAccessor accessor; diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileMessageHistoryTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileMessageHistoryTests.java index b818d067d7..94ede31110 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileMessageHistoryTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileMessageHistoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -46,7 +46,7 @@ public class FileMessageHistoryTests { @Test - public void testMessageHistory() throws Exception{ + public void testMessageHistory() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("file-message-history-context.xml", this.getClass()); TemporaryFolder input = context.getBean(TemporaryFolder.class); File file = input.newFile("FileMessageHistoryTest.txt"); diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java index 6c15587d2a..89094dbefe 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -43,7 +43,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class FileInboundChannelAdapterWithRecursiveDirectoryTests { @Autowired diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/gateway/RemoteFileOutboundGatewayTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/gateway/RemoteFileOutboundGatewayTests.java index 5b8525356a..edde70663e 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/gateway/RemoteFileOutboundGatewayTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/gateway/RemoteFileOutboundGatewayTests.java @@ -723,7 +723,7 @@ public class RemoteFileOutboundGatewayTests { } }); - try{ + try { gw.handleRequestMessage(new GenericMessage("f1")); fail("Expected exception"); } @@ -732,7 +732,7 @@ public class RemoteFileOutboundGatewayTests { assertEquals("test remove .writing", e.getCause().getMessage()); @SuppressWarnings("unchecked") RemoteFileTemplate template = new RemoteFileTemplate(sessionFactory); - File outFile = new File(this.tmpDir + "/f1"+ template.getTemporaryFileSuffix()); + File outFile = new File(this.tmpDir + "/f1" + template.getTemporaryFileSuffix()); assertFalse(outFile.exists()); } } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandlerTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandlerTests.java index 7bab3448f8..ccc10aadb6 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandlerTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -60,7 +60,7 @@ public class FileTransferringMessageHandlerTests { @SuppressWarnings("unchecked") @Test - public void testRemoteDirWithEmptyString() throws Exception{ + public void testRemoteDirWithEmptyString() throws Exception { SessionFactory sf = mock(SessionFactory.class); Session session = mock(Session.class); @@ -83,7 +83,7 @@ public class FileTransferringMessageHandlerTests { @SuppressWarnings("unchecked") @Test - public void testTemporaryRemoteDir() throws Exception{ + public void testTemporaryRemoteDir() throws Exception { SessionFactory sf = mock(SessionFactory.class); Session session = mock(Session.class); @@ -110,7 +110,7 @@ public class FileTransferringMessageHandlerTests { @SuppressWarnings("unchecked") @Test - public void testRemoteDirWithNull() throws Exception{ + public void testRemoteDirWithNull() throws Exception { SessionFactory sf = mock(SessionFactory.class); Session session = mock(Session.class); @@ -133,7 +133,7 @@ public class FileTransferringMessageHandlerTests { } @SuppressWarnings("unchecked") - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testEmptyTemporaryFileSuffixCannotBeNull() throws Exception { SessionFactory sf = mock(SessionFactory.class); Session session = mock(Session.class); @@ -148,7 +148,7 @@ public class FileTransferringMessageHandlerTests { @SuppressWarnings("unchecked") @Test - public void testUseTemporaryFileNameFalse() throws Exception{ + public void testUseTemporaryFileNameFalse() throws Exception { SessionFactory sf = mock(SessionFactory.class); Session session = mock(Session.class); @@ -168,7 +168,7 @@ public class FileTransferringMessageHandlerTests { @SuppressWarnings("unchecked") @Test - public void testServerException() throws Exception{ + public void testServerException() throws Exception { SessionFactory sf = mock(SessionFactory.class); CachingSessionFactory csf = new CachingSessionFactory(sf, 2); FileTransferringMessageHandler handler = new FileTransferringMessageHandler(csf); diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/session/DelegatingSessionFactoryTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/session/DelegatingSessionFactoryTests.java index ddc24fde9f..78079df1ed 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/session/DelegatingSessionFactoryTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/session/DelegatingSessionFactoryTests.java @@ -132,7 +132,7 @@ public class DelegatingSessionFactoryTests { return sff; } - @ServiceActivator(inputChannel="c1") + @ServiceActivator(inputChannel = "c1") @Bean MessageHandler handler() { AbstractRemoteFileOutboundGateway gateway = new AbstractRemoteFileOutboundGateway(dsf(), "ls", "payload") { diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/tail/TailRule.java b/spring-integration-file/src/test/java/org/springframework/integration/file/tail/TailRule.java index 35b88a504b..86ee05c0ff 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/tail/TailRule.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/tail/TailRule.java @@ -65,7 +65,8 @@ public class TailRule extends TestWatcher { @Override public void evaluate() throws Throwable { // skip - }}; + } + }; } } return super.apply(base, description); diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/DefaultFtpsSessionFactory.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/DefaultFtpsSessionFactory.java index 8c262cd090..ec479f18d9 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/DefaultFtpsSessionFactory.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/DefaultFtpsSessionFactory.java @@ -126,7 +126,7 @@ public class DefaultFtpsSessionFactory extends AbstractFtpSessionFactory { } @Override - public void rename(String pathFrom, String pathTo) throws IOException{ + public void rename(String pathFrom, String pathTo) throws IOException { this.client.deleteFile(pathTo); boolean completed = this.client.rename(pathFrom, pathTo); if (!completed) { @@ -193,7 +193,7 @@ public class FtpSession implements Session { @Override - public boolean exists(String path) throws IOException{ + public boolean exists(String path) throws IOException { Assert.hasText(path, "'path' must not be empty"); String currentWorkingPath = this.client.printWorkingDirectory(); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpMessageHistoryTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpMessageHistoryTests.java index af3455200b..4e78c3770e 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpMessageHistoryTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpMessageHistoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -29,7 +29,7 @@ import org.springframework.integration.endpoint.SourcePollingChannelAdapter; */ public class FtpMessageHistoryTests { @Test - public void testMessageHistory() throws Exception{ + public void testMessageHistory() throws Exception { ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("ftp-message-history-context.xml", this.getClass()); SourcePollingChannelAdapter adapter = ac.getBean("adapterFtp", SourcePollingChannelAdapter.class); assertEquals("adapterFtp", adapter.getComponentName()); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests.java index a4457eacf1..8427e49e31 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests.java @@ -42,19 +42,19 @@ import org.springframework.messaging.MessagingException; */ public class FtpParserInboundTests { @Before - public void prepare(){ + public void prepare() { new File("target/foo").delete(); } @Test - public void testLocalFilesAutoCreationTrue() throws Exception{ + public void testLocalFilesAutoCreationTrue() throws Exception { assertTrue(!new File("target/foo").exists()); new ClassPathXmlApplicationContext("FtpParserInboundTests-context.xml", this.getClass()); assertTrue(new File("target/foo").exists()); assertTrue(!new File("target/bar").exists()); } @Test - public void testLocalFilesAutoCreationFalse() throws Exception{ + public void testLocalFilesAutoCreationFalse() throws Exception { assertTrue(!new File("target/bar").exists()); try { new ClassPathXmlApplicationContext("FtpParserInboundTests-fail-context.xml", this.getClass()); @@ -71,7 +71,7 @@ public class FtpParserInboundTests { } @After - public void cleanUp() throws Exception{ + public void cleanUp() throws Exception { new File("target/foo").delete(); } } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java index 09263e9247..62a06f6e9b 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java @@ -83,7 +83,7 @@ public class FtpInboundChannelAdapterParserTests { private ApplicationContext context; @Test - public void testFtpInboundChannelAdapterComplete() throws Exception{ + public void testFtpInboundChannelAdapterComplete() throws Exception { assertFalse(TestUtils.getPropertyValue(ftpInbound, "autoStartup", Boolean.class)); PriorityBlockingQueue blockingQueue = TestUtils.getPropertyValue(ftpInbound, "source.fileSource.toBeReceived", PriorityBlockingQueue.class); Comparator comparator = blockingQueue.comparator(); @@ -125,7 +125,7 @@ public class FtpInboundChannelAdapterParserTests { } @Test - public void cachingSessionFactory() throws Exception{ + public void cachingSessionFactory() throws Exception { Object sessionFactory = TestUtils.getPropertyValue(simpleAdapterWithCachedSessions, "source.synchronizer.remoteFileTemplate.sessionFactory"); assertEquals(CachingSessionFactory.class, sessionFactory.getClass()); FtpInboundFileSynchronizer fisync = diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java index 79eb64e24c..2018204545 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -37,21 +37,21 @@ public class FtpInboundOutboundSanitySample { @Test @Ignore - public void testFtpInboundChannelAdapter() throws Exception{ + public void testFtpInboundChannelAdapter() throws Exception { File fileA = new File("local-test-dir/a.test"); - if (fileA.exists()){ + if (fileA.exists()) { fileA.delete(); } File fileB = new File("local-test-dir/b.test"); - if (fileB.exists()){ + if (fileB.exists()) { fileB.delete(); } fileA = new File("remote-target-dir/a.test"); - if (fileA.exists()){ + if (fileA.exists()) { fileA.delete(); } fileB = new File("remote-target-dir/b.test"); - if (fileB.exists()){ + if (fileB.exists()) { fileB.delete(); } @@ -65,7 +65,7 @@ public class FtpInboundOutboundSanitySample { @Test @Ignore - public void testFtpOutboundChannelAdapter() throws Exception{ + public void testFtpOutboundChannelAdapter() throws Exception { ApplicationContext ac = new ClassPathXmlApplicationContext("FtpOutboundChannelAdapterSample-context.xml", this.getClass()); File fileA = new File("local-test-dir/a.test"); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests.java index b611e5ee45..e11ac3f72d 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -49,7 +49,7 @@ public class FtpsInboundChannelAdapterParserTests { private MessageChannel ftpChannel; @Test - public void testFtpsInboundChannelAdapterComplete() throws Exception{ + public void testFtpsInboundChannelAdapterComplete() throws Exception { assertEquals("ftpInbound", ftpInbound.getComponentName()); assertEquals("ftp:inbound-channel-adapter", ftpInbound.getComponentType()); assertNotNull(TestUtils.getPropertyValue(ftpInbound, "poller")); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsOutboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsOutboundChannelAdapterParserTests.java index 20d67565a8..a0cd5f05ae 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsOutboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsOutboundChannelAdapterParserTests.java @@ -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. @@ -54,7 +54,7 @@ public class FtpsOutboundChannelAdapterParserTests { private FileNameGenerator fileNameGenerator; @Test - public void testFtpsOutboundChannelAdapterComplete() throws Exception{ + public void testFtpsOutboundChannelAdapterComplete() throws Exception { assertTrue(ftpOutbound instanceof EventDrivenConsumer); assertEquals(this.ftpChannel, TestUtils.getPropertyValue(ftpOutbound, "inputChannel")); assertEquals("ftpOutbound", ftpOutbound.getComponentName()); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTests.java index d80c7e11d0..468839c22c 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTests.java @@ -72,9 +72,9 @@ public class FtpInboundRemoteFileSystemSynchronizerTests { @Before @After - public void cleanup(){ + public void cleanup() { File file = new File("test"); - if (file.exists()){ + if (file.exists()) { String[] files = file.list(); for (String fileName : files) { new File(file, fileName).delete(); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpOutboundTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpOutboundTests.java index 7fbe6df517..415117e5ec 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpOutboundTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpOutboundTests.java @@ -76,7 +76,7 @@ public class FtpOutboundTests { private TestFtpSessionFactory sessionFactory; @Before - public void prepare(){ + public void prepare() { ftpClient = mock(FTPClient.class); sessionFactory = new TestFtpSessionFactory(); sessionFactory.setUsername("kermit"); @@ -88,7 +88,7 @@ public class FtpOutboundTests { @Test public void testHandleFileContentMessage() throws Exception { File file = new File("remote-target-dir/handlerContent.test"); - if (file.exists()){ + if (file.exists()) { file.delete(); } assertFalse(file.exists()); @@ -112,7 +112,7 @@ public class FtpOutboundTests { @Test public void testHandleFileAsByte() throws Exception { File file = new File("remote-target-dir/handlerContent.test"); - if (file.exists()){ + if (file.exists()) { file.delete(); } assertFalse(file.exists()); @@ -143,7 +143,7 @@ public class FtpOutboundTests { handler.setFileNameGenerator(new FileNameGenerator() { @Override public String generateFileName(Message message) { - return ((File)message.getPayload()).getName() + ".test"; + return ((File) message.getPayload()).getName() + ".test"; } }); handler.setBeanFactory(mock(BeanFactory.class)); @@ -169,7 +169,7 @@ public class FtpOutboundTests { handler.setFileNameGenerator(new FileNameGenerator() { @Override public String generateFileName(Message message) { - return ((File)message.getPayload()).getName() + ".test"; + return ((File) message.getPayload()).getName() + ".test"; } }); handler.setBeanFactory(mock(BeanFactory.class)); @@ -180,7 +180,7 @@ public class FtpOutboundTests { Log logger = spy(TestUtils.getPropertyValue(handler, "remoteFileTemplate.logger", Log.class)); when(logger.isWarnEnabled()).thenReturn(true); final AtomicReference logged = new AtomicReference(); - doAnswer(new Answer(){ + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/FtpRemoteFileTemplateTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/FtpRemoteFileTemplateTests.java index 3c7b7a5382..d84a53cbce 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/FtpRemoteFileTemplateTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/FtpRemoteFileTemplateTests.java @@ -134,7 +134,7 @@ public class FtpRemoteFileTemplateTests { template.send(new GenericMessage(file)); fail("exception expected"); } - catch(MessagingException e) { + catch (MessagingException e) { assertEquals("bar", e.getCause().getMessage()); } File newFile = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/SessionFactoryTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/SessionFactoryTests.java index ebd67d0ffa..98eb86e26a 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/SessionFactoryTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/session/SessionFactoryTests.java @@ -47,7 +47,7 @@ import org.springframework.messaging.MessagingException; * @author Gary Russell * */ -@SuppressWarnings({"rawtypes","unchecked"}) +@SuppressWarnings({"rawtypes", "unchecked"}) public class SessionFactoryTests { @@ -90,13 +90,13 @@ public class SessionFactoryTests { TestUtils.getPropertyValue(sessionFactory, "controlEncoding")); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testEmptyControlEncoding() { DefaultFtpSessionFactory sessionFactory = new DefaultFtpSessionFactory(); sessionFactory.setControlEncoding(""); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testNullControlEncoding() { DefaultFtpSessionFactory sessionFactory = new DefaultFtpSessionFactory(); sessionFactory.setControlEncoding(null); @@ -104,16 +104,16 @@ public class SessionFactoryTests { @Test - public void testClientModes() throws Exception{ + public void testClientModes() throws Exception { DefaultFtpSessionFactory sessionFactory = new DefaultFtpSessionFactory(); Field[] fields = FTPClient.class.getDeclaredFields(); for (Field field : fields) { - if (field.getName().endsWith("MODE")){ + if (field.getName().endsWith("MODE")) { try { int clientMode = field.getInt(null); sessionFactory.setClientMode(clientMode); if (!(clientMode == FTPClient.ACTIVE_LOCAL_DATA_CONNECTION_MODE || - clientMode == FTPClient.PASSIVE_LOCAL_DATA_CONNECTION_MODE)){ + clientMode == FTPClient.PASSIVE_LOCAL_DATA_CONNECTION_MODE)) { fail(); } } @@ -128,7 +128,7 @@ public class SessionFactoryTests { @Test - public void testStaleConnection() throws Exception{ + public void testStaleConnection() throws Exception { SessionFactory sessionFactory = Mockito.mock(SessionFactory.class); Session sessionA = Mockito.mock(Session.class); Session sessionB = Mockito.mock(Session.class); @@ -148,7 +148,7 @@ public class SessionFactoryTests { } @Test - public void testSameSessionFromThePool() throws Exception{ + public void testSameSessionFromThePool() throws Exception { SessionFactory sessionFactory = Mockito.mock(SessionFactory.class); Session session = Mockito.mock(Session.class); Mockito.when(sessionFactory.getSession()).thenReturn(session); @@ -163,8 +163,8 @@ public class SessionFactoryTests { Mockito.verify(sessionFactory, Mockito.times(2)).getSession(); } - @Test (expected=MessagingException.class) // timeout expire - public void testSessionWaitExpire() throws Exception{ + @Test (expected = MessagingException.class) // timeout expire + public void testSessionWaitExpire() throws Exception { SessionFactory sessionFactory = Mockito.mock(SessionFactory.class); Session session = Mockito.mock(Session.class); Mockito.when(sessionFactory.getSession()).thenReturn(session); @@ -180,7 +180,7 @@ public class SessionFactoryTests { @Test @Ignore - public void testConnectionLimit() throws Exception{ + public void testConnectionLimit() throws Exception { ExecutorService executor = Executors.newCachedThreadPool(); DefaultFtpSessionFactory sessionFactory = new DefaultFtpSessionFactory(); sessionFactory.setHost("192.168.28.143"); diff --git a/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/config/xml/GemfireIntegrationNamespaceHandler.java b/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/config/xml/GemfireIntegrationNamespaceHandler.java index bf576b5c06..84b748a3be 100644 --- a/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/config/xml/GemfireIntegrationNamespaceHandler.java +++ b/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/config/xml/GemfireIntegrationNamespaceHandler.java @@ -22,7 +22,7 @@ import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHa * @author David Turanski * @since 2.1 */ -public class GemfireIntegrationNamespaceHandler extends AbstractIntegrationNamespaceHandler{ +public class GemfireIntegrationNamespaceHandler extends AbstractIntegrationNamespaceHandler { /* (non-Javadoc) * @see org.springframework.beans.factory.xml.NamespaceHandler#init() diff --git a/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducer.java b/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducer.java index 814c64edfd..259fc25375 100644 --- a/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducer.java +++ b/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducer.java @@ -92,8 +92,8 @@ public class CacheListeningMessageProducer extends ExpressionMessageProducerSupp this.region.getAttributesMutator().removeCacheListener(this.listener); } catch (CacheClosedException e) { - if (this.logger.isDebugEnabled()){ - this.logger.debug(e.getMessage(),e); + if (this.logger.isDebugEnabled()) { + this.logger.debug(e.getMessage(), e); } } diff --git a/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/store/GemfireMessageStore.java b/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/store/GemfireMessageStore.java index 4abd15d3c4..6778231e94 100644 --- a/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/store/GemfireMessageStore.java +++ b/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/store/GemfireMessageStore.java @@ -58,7 +58,7 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore implements * * @param messageStoreRegion The region. */ - public GemfireMessageStore(Region messageStoreRegion) { + public GemfireMessageStore(Region messageStoreRegion) { this.cache = null; this.messageStoreRegion = messageStoreRegion; } @@ -88,14 +88,14 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore implements } try { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("creating message store region as '" + MESSAGE_STORE_REGION_NAME + "'"); } RegionAttributesFactoryBean attributesFactoryBean = new RegionAttributesFactoryBean(); attributesFactoryBean.setIgnoreJTA(this.ignoreJta); attributesFactoryBean.afterPropertiesSet(); - RegionFactoryBean messageRegionFactoryBean = new RegionFactoryBean() {}; + RegionFactoryBean messageRegionFactoryBean = new RegionFactoryBean() { }; messageRegionFactoryBean.setBeanName(MESSAGE_STORE_REGION_NAME); messageRegionFactoryBean.setAttributes(attributesFactoryBean.getObject()); messageRegionFactoryBean.setCache(this.cache); diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/CacheServerProcess.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/CacheServerProcess.java index 046d0d88ec..8b764a00c5 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/CacheServerProcess.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/CacheServerProcess.java @@ -54,7 +54,7 @@ public class CacheServerProcess { Cache cache = new CacheFactory(props).create(); // Create region. - Region region = cache.createRegionFactory(RegionShortcut.REPLICATE) + Region region = cache.createRegionFactory(RegionShortcut.REPLICATE) .setScope(Scope.DISTRIBUTED_ACK) .create("test"); diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java index 8d9be093c0..d93a56535e 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java @@ -143,7 +143,7 @@ public class ForkUtil { // ignore and move on } } - if (controlFileExists(className)){ + if (controlFileExists(className)) { System.out.println("Started cache server"); } else { diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducerTests.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducerTests.java index 80ae47502d..4052c62796 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducerTests.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -49,7 +49,7 @@ public class CacheListeningMessageProducerTests { CacheFactoryBean cacheFactoryBean = new CacheFactoryBean(); Cache cache = cacheFactoryBean.getObject(); - RegionFactoryBean regionFactoryBean = new RegionFactoryBean() {}; + RegionFactoryBean regionFactoryBean = new RegionFactoryBean() { }; regionFactoryBean.setName("test.receiveNewValuePayloadForCreateEvent"); regionFactoryBean.setCache(cache); this.setRegionAttributes(regionFactoryBean); @@ -75,7 +75,7 @@ public class CacheListeningMessageProducerTests { CacheFactoryBean cacheFactoryBean = new CacheFactoryBean(); Cache cache = cacheFactoryBean.getObject(); - RegionFactoryBean regionFactoryBean = new RegionFactoryBean() {}; + RegionFactoryBean regionFactoryBean = new RegionFactoryBean() { }; regionFactoryBean.setName("test.receiveNewValuePayloadForUpdateEvent"); regionFactoryBean.setCache(cache); this.setRegionAttributes(regionFactoryBean); @@ -105,7 +105,7 @@ public class CacheListeningMessageProducerTests { CacheFactoryBean cacheFactoryBean = new CacheFactoryBean(); Cache cache = cacheFactoryBean.getObject(); - RegionFactoryBean regionFactoryBean = new RegionFactoryBean() {}; + RegionFactoryBean regionFactoryBean = new RegionFactoryBean() { }; regionFactoryBean.setName("test.receiveOldValuePayloadForDestroyEvent"); regionFactoryBean.setCache(cache); this.setRegionAttributes(regionFactoryBean); @@ -134,7 +134,7 @@ public class CacheListeningMessageProducerTests { CacheFactoryBean cacheFactoryBean = new CacheFactoryBean(); Cache cache = cacheFactoryBean.getObject(); - RegionFactoryBean regionFactoryBean = new RegionFactoryBean() {}; + RegionFactoryBean regionFactoryBean = new RegionFactoryBean() { }; regionFactoryBean.setName("test.receiveOldValuePayloadForDestroyEvent"); regionFactoryBean.setCache(cache); this.setRegionAttributes(regionFactoryBean); diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CqInboundChannelAdapterTests.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CqInboundChannelAdapterTests.java index 0812a71ad1..295827a0b3 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CqInboundChannelAdapterTests.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CqInboundChannelAdapterTests.java @@ -77,7 +77,7 @@ public class CqInboundChannelAdapterTests { @Test public void testCqEvent() throws InterruptedException { assertTrue(TestUtils.getPropertyValue(withDurable, "durable", Boolean.class)); - region.put("one",1); + region.put("one", 1); Message msg = outputChannel1.receive(10000); assertNotNull(msg); assertTrue(msg.getPayload() instanceof CqEvent); @@ -85,10 +85,10 @@ public class CqInboundChannelAdapterTests { @Test public void testPayloadExpression() throws InterruptedException { - region.put("one",1); + region.put("one", 1); Message msg = outputChannel2.receive(10000); assertNotNull(msg); - assertEquals(1,msg.getPayload()); + assertEquals(1, msg.getPayload()); } @AfterClass diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/GemfireInboundChannelAdapterTests.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/GemfireInboundChannelAdapterTests.java index 16e23ca037..bcff80678b 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/GemfireInboundChannelAdapterTests.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/GemfireInboundChannelAdapterTests.java @@ -84,7 +84,7 @@ public class GemfireInboundChannelAdapterTests { region2.put("payload", "payload"); assertTrue(eventHandler2.event instanceof EntryEvent); - EntryEvent event = (EntryEvent)eventHandler2.event; + EntryEvent event = (EntryEvent) eventHandler2.event; assertEquals("payload", event.getNewValue()); } diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/outbound/CacheWritingMessageHandlerTests.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/outbound/CacheWritingMessageHandlerTests.java index f7c72196c2..5093578567 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/outbound/CacheWritingMessageHandlerTests.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/outbound/CacheWritingMessageHandlerTests.java @@ -52,7 +52,7 @@ public class CacheWritingMessageHandlerTests { public void mapPayloadWritesToCache() throws Exception { CacheFactoryBean cacheFactoryBean = new CacheFactoryBean(); Cache cache = cacheFactoryBean.getObject(); - RegionFactoryBean regionFactoryBean = new RegionFactoryBean() {}; + RegionFactoryBean regionFactoryBean = new RegionFactoryBean() { }; regionFactoryBean.setName("test.mapPayloadWritesToCache"); regionFactoryBean.setCache(cache); regionFactoryBean.afterPropertiesSet(); @@ -77,7 +77,7 @@ public class CacheWritingMessageHandlerTests { public void ExpressionsWriteToCache() throws Exception { CacheFactoryBean cacheFactoryBean = new CacheFactoryBean(); Cache cache = cacheFactoryBean.getObject(); - RegionFactoryBean regionFactoryBean = new RegionFactoryBean() {}; + RegionFactoryBean regionFactoryBean = new RegionFactoryBean() { }; regionFactoryBean.setName("test.expressionsWriteToCache"); regionFactoryBean.setCache(cache); regionFactoryBean.afterPropertiesSet(); diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/GemfireMessageStoreTests.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/GemfireMessageStoreTests.java index 07c91cd36f..b5051356bd 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/GemfireMessageStoreTests.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/GemfireMessageStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -68,7 +68,7 @@ public class GemfireMessageStoreTests { @Test public void testRegionConstructor() throws Exception { - RegionFactoryBean region = new RegionFactoryBean() {}; + RegionFactoryBean region = new RegionFactoryBean() { }; region.setName("someRegion"); region.setCache(this.cache); region.afterPropertiesSet(); diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/util/AggregatorWithGemfireLocksTests.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/util/AggregatorWithGemfireLocksTests.java index 3973304223..db0013375c 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/util/AggregatorWithGemfireLocksTests.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/util/AggregatorWithGemfireLocksTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-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. @@ -159,7 +159,7 @@ public class AggregatorWithGemfireLocksTests { @Override public boolean canRelease(MessageGroup group) { - synchronized(this) { + synchronized (this) { this.callers.incrementAndGet(); this.maxCallers.set(Math.max(this.maxCallers.get(), this.callers.get())); } diff --git a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessorTests.java b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessorTests.java index daf8d9aede..515870fc98 100644 --- a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessorTests.java +++ b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -66,19 +66,19 @@ public class GroovyScriptExecutingMessageProcessorTests { public void testSimpleExecution() throws Exception { int count = countHolder.getAndIncrement(); String script = "return \"payload is $payload, header is $headers.testHeader\""; - Message message = MessageBuilder.withPayload("foo").setHeader("testHeader", "bar"+count).build(); + Message message = MessageBuilder.withPayload("foo").setHeader("testHeader", "bar" + count).build(); TestResource resource = new TestResource(script, "simpleTest"); ScriptSource scriptSource = new ResourceScriptSource(resource); MessageProcessor processor = new GroovyScriptExecutingMessageProcessor(scriptSource); Object result = processor.processMessage(message); - assertEquals("payload is foo, header is bar"+count, result.toString()); + assertEquals("payload is foo, header is bar" + count, result.toString()); } @Test public void testSimpleExecutionWithScriptVariableGenerator() throws Exception { int count = countHolder.getAndIncrement(); String script = "return \"payload is $payload, header is $headers.testHeader and date is $date\""; - Message message = MessageBuilder.withPayload("foo").setHeader("testHeader", "bar"+count).build(); + Message message = MessageBuilder.withPayload("foo").setHeader("testHeader", "bar" + count).build(); TestResource resource = new TestResource(script, "simpleTest"); ScriptSource scriptSource = new ResourceScriptSource(resource); Object result = null; @@ -107,7 +107,7 @@ public class GroovyScriptExecutingMessageProcessorTests { long lastModified = resource.lastModified(); Thread.sleep(20L); resource.setScript("foo"); - assertFalse("Expected last modified to change: "+lastModified+"=="+resource.lastModified(), lastModified==resource.lastModified()); + assertFalse("Expected last modified to change: " + lastModified + "==" + resource.lastModified(), lastModified == resource.lastModified()); } @Test diff --git a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyScriptPayloadMessageProcessorTests.java b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyScriptPayloadMessageProcessorTests.java index 4a804e668e..789207af1d 100644 --- a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyScriptPayloadMessageProcessorTests.java +++ b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyScriptPayloadMessageProcessorTests.java @@ -75,7 +75,7 @@ public class GroovyScriptPayloadMessageProcessorTests { Message message = MessageBuilder.withPayload("\"spam is $spam foo is $headers.foo\"") .setHeader("foo", "bar").build(); ScriptVariableGenerator scriptVariableGenerator = - new DefaultScriptVariableGenerator(Collections.singletonMap("spam",(Object)"bucket")); + new DefaultScriptVariableGenerator(Collections.singletonMap("spam", (Object) "bucket")); MessageProcessor processor = new GroovyCommandMessageProcessor(scriptVariableGenerator); Object result = processor.processMessage(message); assertEquals("spam is bucket foo is bar", result.toString()); @@ -116,7 +116,7 @@ public class GroovyScriptPayloadMessageProcessorTests { } }; ScriptVariableGenerator scriptVariableGenerator = - new DefaultScriptVariableGenerator(Collections.singletonMap("spam",(Object)"bucket")); + new DefaultScriptVariableGenerator(Collections.singletonMap("spam", (Object) "bucket")); Message message = MessageBuilder.withPayload("\"spam is $spam, foo is $foo\"").build(); processor = new GroovyCommandMessageProcessor(binding, scriptVariableGenerator); Object result = processor.processMessage(message); diff --git a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyHeaderEnricherTests.java b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyHeaderEnricherTests.java index 736aa7208e..0e3dd5333c 100644 --- a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyHeaderEnricherTests.java +++ b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyHeaderEnricherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -63,14 +63,14 @@ public class GroovyHeaderEnricherTests { private EventDrivenConsumer headerEnricherWithInlineGroovyScript; @Test - public void referencedScript() throws Exception{ + public void referencedScript() throws Exception { inputA.send(new GenericMessage("Hello")); assertEquals("groovy", outputA.receive(1000).getHeaders().get("TEST_HEADER")); } @SuppressWarnings("unchecked") @Test - public void inlineScript() throws Exception{ + public void inlineScript() throws Exception { Map> headers = TestUtils.getPropertyValue(headerEnricherWithInlineGroovyScript, "handler.transformer.headersToAdd", Map.class); assertEquals(1, headers.size()); diff --git a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyRefreshTests.java b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyRefreshTests.java index 71b7d0cbbe..f39f170643 100644 --- a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyRefreshTests.java +++ b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyRefreshTests.java @@ -85,7 +85,7 @@ public class GroovyRefreshTests { } public InputStream getInputStream() throws IOException { - if (++count>scripts.length-1) { + if (++count > scripts.length - 1) { count = 0; } return new ByteArrayInputStream(scripts[count].getBytes()); diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUtils.java b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUtils.java index 71eb760f69..d7c8f87340 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUtils.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -103,14 +103,14 @@ abstract class HttpAdapterParsingUtils { } - static void setHttpMethodOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){ + static void setHttpMethodOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String httpMethod = element.getAttribute("http-method"); String httpMethodExpression = element.getAttribute("http-method-expression"); boolean hasHttpMethod = StringUtils.hasText(httpMethod); boolean hasHttpMethodExpression = StringUtils.hasText(httpMethodExpression); - if (hasHttpMethod && hasHttpMethodExpression){ + if (hasHttpMethod && hasHttpMethodExpression) { parserContext.getReaderContext().error("The 'http-method' and 'http-method-expression' are mutually exclusive. " + "You can only have one or the other", element); } @@ -120,23 +120,23 @@ abstract class HttpAdapterParsingUtils { expressionDef = new RootBeanDefinition(LiteralExpression.class); expressionDef.getConstructorArgumentValues().addGenericArgumentValue(httpMethod); } - else if (hasHttpMethodExpression){ + else if (hasHttpMethodExpression) { expressionDef = new RootBeanDefinition(ExpressionFactoryBean.class); expressionDef.getConstructorArgumentValues().addGenericArgumentValue(httpMethodExpression); } - if (expressionDef != null){ + if (expressionDef != null) { builder.addPropertyValue("httpMethodExpression", expressionDef); } } - static void setExpectedResponseOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){ + static void setExpectedResponseOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String expectedResponseType = element.getAttribute("expected-response-type"); String expectedResponseTypeExpression = element.getAttribute("expected-response-type-expression"); boolean hasExpectedResponseType = StringUtils.hasText(expectedResponseType); boolean hasExpectedResponseTypeExpression = StringUtils.hasText(expectedResponseTypeExpression); - if (hasExpectedResponseType && hasExpectedResponseTypeExpression){ + if (hasExpectedResponseType && hasExpectedResponseTypeExpression) { parserContext.getReaderContext().error("The 'expected-response-type' and 'expected-response-type-expression' are mutually exclusive. " + "You can only have one or the other", element); } @@ -146,11 +146,11 @@ abstract class HttpAdapterParsingUtils { expressionDef = new RootBeanDefinition(LiteralExpression.class); expressionDef.getConstructorArgumentValues().addGenericArgumentValue(expectedResponseType); } - else if (hasExpectedResponseTypeExpression){ + else if (hasExpectedResponseTypeExpression) { expressionDef = new RootBeanDefinition(ExpressionFactoryBean.class); expressionDef.getConstructorArgumentValues().addGenericArgumentValue(expectedResponseTypeExpression); } - if (expressionDef != null){ + if (expressionDef != null) { builder.addPropertyValue("expectedResponseTypeExpression", expressionDef); } } diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/converter/SerializingHttpMessageConverter.java b/spring-integration-http/src/main/java/org/springframework/integration/http/converter/SerializingHttpMessageConverter.java index 4ecab84ae1..2486233270 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/converter/SerializingHttpMessageConverter.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/converter/SerializingHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -61,7 +61,7 @@ public class SerializingHttpMessageConverter extends AbstractHttpMessageConverte @SuppressWarnings("rawtypes") public Serializable readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException { try { - return (Serializable) new ObjectInputStream(inputMessage.getBody()).readObject();//NOSONAR + return (Serializable) new ObjectInputStream(inputMessage.getBody()).readObject(); //NOSONAR } catch (ClassNotFoundException e) { throw new IllegalArgumentException(e); diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/multipart/UploadedMultipartFile.java b/spring-integration-http/src/main/java/org/springframework/integration/http/multipart/UploadedMultipartFile.java index 86fa539c61..b754d0dae0 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/multipart/UploadedMultipartFile.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/multipart/UploadedMultipartFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -64,13 +64,13 @@ public class UploadedMultipartFile implements MultipartFile { this.originalFilename = originalFilename; } - public UploadedMultipartFile(byte[] bytes, String contentType, String formParameterName,//NOSONAR - direct storage + public UploadedMultipartFile(byte[] bytes, String contentType, String formParameterName, //NOSONAR - direct storage String originalFilename) { Assert.notNull(bytes, "bytes must not be null"); Assert.hasText(contentType, "contentType is required"); Assert.hasText(formParameterName, "formParameterName is required"); Assert.hasText(originalFilename, "originalFilename is required"); - this.bytes = bytes;//NOSONAR - direct storage + this.bytes = bytes; //NOSONAR - direct storage this.size = bytes.length; this.file = null; this.contentType = contentType; @@ -87,7 +87,7 @@ public class UploadedMultipartFile implements MultipartFile { @Override public byte[] getBytes() throws IOException { if (this.bytes != null) { - return this.bytes;//NOSONAR - direct access + return this.bytes; //NOSONAR - direct access } return FileCopyUtils.copyToByteArray(this.file); } diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java b/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java index 7ca35ad396..d06c08e4ed 100755 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -358,8 +358,8 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe try { HttpMethod httpMethod = this.determineHttpMethod(requestMessage); - if (!this.shouldIncludeRequestBody(httpMethod) && this.extractPayloadExplicitlySet){ - if (logger.isWarnEnabled()){ + if (!this.shouldIncludeRequestBody(httpMethod) && this.extractPayloadExplicitlySet) { + if (logger.isWarnEnabled()) { logger.warn("The 'extractPayload' attribute has no relevance for the current request since the HTTP Method is '" + httpMethod + "', and no request body will be sent for that method."); } @@ -458,7 +458,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe if (MediaType.APPLICATION_FORM_URLENCODED.equals(httpHeaders.getContentType()) || MediaType.MULTIPART_FORM_DATA.equals(httpHeaders.getContentType())) { if (!(payload instanceof MultiValueMap)) { - payload = this.convertToMultiValueMap((Map) payload); + payload = this.convertToMultiValueMap((Map) payload); } } return new HttpEntity(payload, httpHeaders); @@ -492,7 +492,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe // We need to check separately for MULTIPART as well as URLENCODED simply because // MultiValueMap is actually valid content for serialization if (this.isFormData((Map) content)) { - if (this.isMultipart((Map)content)) { + if (this.isMultipart((Map) content)) { contentType = MediaType.MULTIPART_FORM_DATA; } else { @@ -589,9 +589,9 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe } } - private Object determineExpectedResponseType(Message requestMessage) throws Exception{ + private Object determineExpectedResponseType(Message requestMessage) throws Exception { Object expectedResponseType = null; - if (this.expectedResponseTypeExpression != null){ + if (this.expectedResponseTypeExpression != null) { expectedResponseType = this.expectedResponseTypeExpression.getValue(this.evaluationContext, requestMessage); } if (expectedResponseType != null) { @@ -600,7 +600,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe || expectedResponseType instanceof ParameterizedTypeReference, "'expectedResponseType' can be an instance of 'Class', 'String' or 'ParameterizedTypeReference'; " + "evaluation resulted in a" + expectedResponseType.getClass() + "."); - if (expectedResponseType instanceof String && StringUtils.hasText((String) expectedResponseType)){ + if (expectedResponseType instanceof String && StringUtils.hasText((String) expectedResponseType)) { expectedResponseType = ClassUtils.forName((String) expectedResponseType, getApplicationContext().getClassLoader()); } diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java b/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java index 4d1a8b6ac7..2bdaa9771e 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java @@ -310,7 +310,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper, BeanF * {@link DefaultHttpHeaderMapper#setUserDefinedHeaderPrefix(String)}. The default is 'X-'. * @param outboundHeaderNames The outbound header names. */ - public void setOutboundHeaderNames(String[] outboundHeaderNames) {//NOSONAR - false positive + public void setOutboundHeaderNames(String[] outboundHeaderNames) { //NOSONAR - false positive if (HTTP_REQUEST_HEADER_NAMES == outboundHeaderNames) { this.isDefaultOutboundMapper = true; } @@ -344,7 +344,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper, BeanF * {@link DefaultHttpHeaderMapper#setUserDefinedHeaderPrefix(String)}. The default is 'X-'. * @param inboundHeaderNames The inbound header names. */ - public void setInboundHeaderNames(String[] inboundHeaderNames) {//NOSONAR - false positive + public void setInboundHeaderNames(String[] inboundHeaderNames) { //NOSONAR - false positive this.inboundHeaderNames = inboundHeaderNames != null ? Arrays.copyOf(inboundHeaderNames, inboundHeaderNames.length) : new String[0]; this.inboundHeaderNamesLower = new String[this.inboundHeaderNames.length]; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java index 86d6333e8d..1686cc4d64 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-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. @@ -193,7 +193,7 @@ public class HttpProxyScenarioTests { HttpEntity entity = (HttpEntity) invocation.getArguments()[2]; assertThat(entity.getBody(), instanceOf(byte[].class)); - assertEquals("foo", new String((byte[])entity.getBody())); + assertEquals("foo", new String((byte[]) entity.getBody())); MultiValueMap responseHeaders = new LinkedMultiValueMap(httpHeaders); responseHeaders.set("Connection", "close"); diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java index 63ff4b3fe8..6c366e0995 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java @@ -129,11 +129,11 @@ public class HttpInboundGatewayParserTests { assertEquals(4567L, TestUtils.getPropertyValue(messagingTemplate, "receiveTimeout")); boolean registerDefaultConverters = - TestUtils.getPropertyValue(this.gateway,"mergeWithDefaultConverters", Boolean.class); + TestUtils.getPropertyValue(this.gateway, "mergeWithDefaultConverters", Boolean.class); assertFalse("By default the register-default-converters flag should be false", registerDefaultConverters); @SuppressWarnings("unchecked") List> messageConverters = - TestUtils.getPropertyValue(this.gateway,"messageConverters", List.class); + TestUtils.getPropertyValue(this.gateway, "messageConverters", List.class); assertTrue("The default converters should have been registered, given there are no custom converters", messageConverters.size() > 0); diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParserTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParserTests.java index 55245c9d53..d020581c06 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParserTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -170,7 +170,7 @@ public class HttpOutboundChannelAdapterParserTests { assertEquals(customRestTemplate, restTemplate); } - @Test(expected=BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) public void failWithRestTemplateAndRestAttributes() { new ClassPathXmlApplicationContext("HttpOutboundChannelAdapterParserTests-fail-context.xml", this.getClass()); } @@ -263,7 +263,7 @@ public class HttpOutboundChannelAdapterParserTests { assertThat(this.withPoller1, Matchers.instanceOf(PollingConsumer.class)); } - @Test(expected=BeanDefinitionParsingException.class) + @Test(expected = BeanDefinitionParsingException.class) public void failWithUrlAndExpression() { new ClassPathXmlApplicationContext("HttpOutboundChannelAdapterParserTests-url-fail-context.xml", this.getClass()); } diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java index 49875d1ae9..b030fbad7f 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java @@ -308,7 +308,7 @@ public class HttpRequestHandlingControllerTests extends AbstractHttpInboundTests assertEquals(1, errors.getErrorCount()); ObjectError error = errors.getAllErrors().get(0); assertEquals(3, error.getArguments().length); - assertTrue("Wrong message: "+error, ((String)error.getArguments()[1]).startsWith("failed to send Message")); + assertTrue("Wrong message: " + error, ((String) error.getArguments()[1]).startsWith("failed to send Message")); } @Test diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayWithPathMappingTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayWithPathMappingTests.java index dde4b88023..323ecd5ddc 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayWithPathMappingTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayWithPathMappingTests.java @@ -130,7 +130,7 @@ public class HttpRequestHandlingMessagingGatewayWithPathMappingTests extends Abs Object result = gateway.doHandleRequest(request, response); assertTrue(result instanceof Message); - assertEquals("bill", ((Message)result).getPayload()); + assertEquals("bill", ((Message) result).getPayload()); } @SuppressWarnings("unchecked") @@ -176,7 +176,7 @@ public class HttpRequestHandlingMessagingGatewayWithPathMappingTests extends Abs Object result = gateway.doHandleRequest(request, response); assertTrue(result instanceof Message); - assertEquals("bill", ((Map) ((Message)result).getPayload()).get("f")); + assertEquals("bill", ((Map) ((Message) result).getPayload()).get("f")); } } diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java index 575d276bd9..3dad1e8ae1 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -79,7 +79,7 @@ import org.springframework.web.client.RestTemplate; public class HttpRequestExecutingMessageHandlerTests { public static ParameterizedTypeReference> testParameterizedTypeReference() { - return new ParameterizedTypeReference>() {}; + return new ParameterizedTypeReference>() { }; } @Test @@ -239,7 +239,7 @@ public class HttpRequestExecutingMessageHandlerTests { setBeanFactory(handler); handler.afterPropertiesSet(); Map form = new LinkedHashMap(); - form.put("a", new int[]{1,2,3}); + form.put("a", new int[]{1, 2, 3}); form.put("b", "4"); form.put("c", new String[] { "5" }); form.put("d", "6"); @@ -743,7 +743,7 @@ public class HttpRequestExecutingMessageHandlerTests { try { handler.handleRequestMessage(message); } - catch (Exception e) {} + catch (Exception e) { } assertEquals(theURL, restTemplate.actualUrl.get()); } @@ -760,7 +760,7 @@ public class HttpRequestExecutingMessageHandlerTests { try { handler.handleRequestMessage(message); } - catch (Exception e) {} + catch (Exception e) { } assertEquals("http://my.RabbitMQ.com/api/queues/%2f/si.test.queue?foo#bar", restTemplate.actualUrl.get()); } @@ -866,12 +866,12 @@ public class HttpRequestExecutingMessageHandlerTests { private final String name; - public City(String name){ + public City(String name) { this.name = name; } @Override - public String toString(){ + public String toString() { return name; } diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java index 56986461ff..ca162933f2 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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,8 +55,8 @@ import org.springframework.util.CollectionUtils; public class DefaultHttpHeaderMapperFromMessageInboundTests { // Allow tests - @Test(expected=IllegalArgumentException.class) - public void validateAllowWithWrongMethodName(){ + @Test(expected = IllegalArgumentException.class) + public void validateAllowWithWrongMethodName() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Allow", "bar"); @@ -66,7 +66,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateAllowAsString(){ + public void validateAllowAsString() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Allow", "GET"); @@ -78,7 +78,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateAllowAsStringCaseInsensitive(){ + public void validateAllowAsStringCaseInsensitive() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("allow", "GET"); @@ -90,7 +90,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateAllowAsHttpMethod(){ + public void validateAllowAsHttpMethod() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Allow", HttpMethod.GET); @@ -102,7 +102,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateAllowAsDelimitedString(){ + public void validateAllowAsDelimitedString() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Allow", "GET, POST"); @@ -115,7 +115,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateAllowAsStringArray(){ + public void validateAllowAsStringArray() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Allow", new String[]{"GET", "POST"}); @@ -128,7 +128,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateAllowAsHttpMethodArray(){ + public void validateAllowAsHttpMethodArray() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Allow", new HttpMethod[]{HttpMethod.GET, HttpMethod.POST}); @@ -141,7 +141,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateAllowAsCollectionOfString(){ + public void validateAllowAsCollectionOfString() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Allow", CollectionUtils.arrayToList(new String[]{"GET", "POST"})); @@ -154,7 +154,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateAllowAsCollectionOfHttpMethods(){ + public void validateAllowAsCollectionOfHttpMethods() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Allow", CollectionUtils.arrayToList(new HttpMethod[]{HttpMethod.GET, HttpMethod.POST})); @@ -174,7 +174,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { // ETag tests @Test - public void validateETag(){ + public void validateETag() { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("ETag", "\"1234\""); @@ -187,7 +187,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { // Expires tests @Test - public void validateExpiresAsNumber() throws ParseException{ + public void validateExpiresAsNumber() throws ParseException { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Expires", 12345678); @@ -200,7 +200,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateExpiresAsString() throws ParseException{ + public void validateExpiresAsString() throws ParseException { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Expires", "12345678"); @@ -212,7 +212,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { assertEquals(simpleDateFormat.parse("Thu, 01 Jan 1970 03:25:45 GMT").getTime(), headers.getExpires()); } @Test - public void validateExpiresAsDate() throws ParseException{ + public void validateExpiresAsDate() throws ParseException { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Expires", new Date(12345678)); @@ -227,7 +227,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { // Last-Modified tests @Test - public void validateLastModifiedAsNumber() throws ParseException{ + public void validateLastModifiedAsNumber() throws ParseException { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Last-Modified", 12345678); @@ -240,7 +240,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateLastModifiedAsString() throws ParseException{ + public void validateLastModifiedAsString() throws ParseException { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Last-Modified", "12345678"); @@ -252,7 +252,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { assertEquals(simpleDateFormat.parse("Thu, 01 Jan 1970 03:25:45 GMT").getTime(), headers.getLastModified()); } @Test - public void validateLastModifiedAsDate() throws ParseException{ + public void validateLastModifiedAsDate() throws ParseException { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Last-Modified", new Date(12345678)); @@ -267,7 +267,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { // Location tests @Test - public void validateLocation() throws Exception{ + public void validateLocation() throws Exception { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Location", "http://foo.com"); @@ -280,7 +280,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { // Transfer Encoding tests @Test - public void validateTransferEncodingNotMappedFromMessageHeaders() throws Exception{ + public void validateTransferEncodingNotMappedFromMessageHeaders() throws Exception { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map messageHeaders = new HashMap(); messageHeaders.put("Transfer-Encoding", "chunked"); @@ -292,7 +292,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateTransferEncodingMappedFromHttpHeaders() throws Exception{ + public void validateTransferEncodingMappedFromHttpHeaders() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setInboundHeaderNames(new String[] {"Transfer-Encoding"}); HttpHeaders headers = new HttpHeaders(); @@ -305,7 +305,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateTransferEncodingNotMappedFromHttpHeadersByDefault() throws Exception{ + public void validateTransferEncodingNotMappedFromHttpHeadersByDefault() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); HttpHeaders headers = new HttpHeaders(); @@ -320,7 +320,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { // Pragma tested as part of DefaultHttpHeaderMapperFromMessageOutboundTests @Test - public void validateCustomHeaderNamesMappedToHttpHeaders() throws Exception{ + public void validateCustomHeaderNamesMappedToHttpHeaders() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setOutboundHeaderNames(new String[] {"foo", "bar"}); Map messageHeaders = new HashMap(); @@ -336,7 +336,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeaderNamePatternsMappedToHttpHeaders() throws Exception{ + public void validateCustomHeaderNamePatternsMappedToHttpHeaders() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setOutboundHeaderNames(new String[] {"x*", "*z", "a*f"}); Map messageHeaders = new HashMap(); @@ -363,7 +363,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeaders() throws Exception{ + public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeaders() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setOutboundHeaderNames(new String[] {"foo*", "HTTP_RESPONSE_HEADERS"}); Map messageHeaders = new HashMap(); @@ -380,7 +380,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefix() throws Exception{ + public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefix() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setUserDefinedHeaderPrefix("Z-"); mapper.setOutboundHeaderNames(new String[] {"foo*", "HTTP_RESPONSE_HEADERS"}); @@ -398,7 +398,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixEmptyString() throws Exception{ + public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixEmptyString() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setUserDefinedHeaderPrefix(""); mapper.setOutboundHeaderNames(new String[] {"foo*", "HTTP_RESPONSE_HEADERS"}); @@ -416,7 +416,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixNull() throws Exception{ + public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixNull() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setUserDefinedHeaderPrefix(null); mapper.setOutboundHeaderNames(new String[] {"foo*", "HTTP_RESPONSE_HEADERS"}); @@ -434,7 +434,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeaderNamesMappedFromHttpHeaders() throws Exception{ + public void validateCustomHeaderNamesMappedFromHttpHeaders() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setInboundHeaderNames(new String[] {"foo", "bar"}); HttpHeaders headers = new HttpHeaders(); @@ -447,7 +447,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeaderNamePatternsMappedFromHttpHeaders() throws Exception{ + public void validateCustomHeaderNamePatternsMappedFromHttpHeaders() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setInboundHeaderNames(new String[] {"x*", "*z", "a*f"}); HttpHeaders headers = new HttpHeaders(); @@ -470,7 +470,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeaderNamePatternsAndStandardRequestHeadersMappedFromHttpHeaders() throws Exception{ + public void validateCustomHeaderNamePatternsAndStandardRequestHeadersMappedFromHttpHeaders() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setInboundHeaderNames(new String[] {"foo*", "HTTP_REQUEST_HEADERS"}); HttpHeaders headers = new HttpHeaders(); @@ -485,7 +485,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeadersWithNonStringValuesAndNoConverter() throws Exception{ + public void validateCustomHeadersWithNonStringValuesAndNoConverter() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setOutboundHeaderNames(new String[] {"customHeader*"}); @@ -501,7 +501,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { @Test - public void validateCustomHeadersWithNonStringValuesAndDefaultConverterOnly() throws Exception{ + public void validateCustomHeadersWithNonStringValuesAndDefaultConverterOnly() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setOutboundHeaderNames(new String[] {"customHeader*"}); ConversionService cs = new DefaultConversionService(); @@ -522,7 +522,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void validateCustomHeadersWithNonStringValuesAndDefaultConverterWithCustomConverter() throws Exception{ + public void validateCustomHeadersWithNonStringValuesAndDefaultConverterWithCustomConverter() throws Exception { DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setOutboundHeaderNames(new String[] {"customHeader*"}); GenericConversionService cs = new DefaultConversionService(); @@ -557,7 +557,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void testInt2995IfModifiedSince() throws Exception{ + public void testInt2995IfModifiedSince() throws Exception { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Date ifModifiedSince = new Date(); long ifModifiedSinceTime = ifModifiedSince.getTime(); @@ -571,7 +571,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } @Test - public void testContentTypeHeader() throws Exception{ + public void testContentTypeHeader() throws Exception { HeaderMapper mapper = DefaultHttpHeaderMapper.inboundMapper(); Map map = new HashMap(); map.put(MessageHeaders.CONTENT_TYPE, "text/plain"); @@ -586,7 +586,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { } - public static class TestClassConverter implements Converter{ + public static class TestClassConverter implements Converter { @Override public String convert(TestClass source) { diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/IpHeaders.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/IpHeaders.java index b15d95d05f..6457e7d143 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/IpHeaders.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/IpHeaders.java @@ -90,6 +90,6 @@ public final class IpHeaders { */ public static final String LOCAL_ADDRESS = IP + "localInetAddress"; - private IpHeaders() {} + private IpHeaders() { } } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpAdapterParserUtils.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpAdapterParserUtils.java index 77fa2ed808..7684773442 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpAdapterParserUtils.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpAdapterParserUtils.java @@ -124,7 +124,7 @@ public abstract class IpAdapterParserUtils { public static final String MAPPER = "mapper"; - private IpAdapterParserUtils() {} + private IpAdapterParserUtils() { } /** * Adds a constructor-arg to the provided bean definition builder diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpInboundGateway.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpInboundGateway.java index 6ef26c56a8..e7bdc26d67 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpInboundGateway.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpInboundGateway.java @@ -193,7 +193,7 @@ public class TcpInboundGateway extends MessagingGatewaySupport implements this.connections.remove(connection.getConnectionId()); } @Override - public String getComponentType(){ + public String getComponentType() { return "ip:tcp-inbound-gateway"; } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpOutboundGateway.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpOutboundGateway.java index 1d59bcb37b..187508d1ee 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpOutboundGateway.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpOutboundGateway.java @@ -242,7 +242,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler } @Override - public String getComponentType(){ + public String getComponentType() { return "ip:tcp-outbound-gateway"; } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapter.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapter.java index c8b715eca0..e789155e54 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapter.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapter.java @@ -190,7 +190,7 @@ public class TcpReceivingChannelAdapter } @Override - public String getComponentType(){ + public String getComponentType() { return "ip:tcp-inbound-channel-adapter"; } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandler.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandler.java index 76f18d3e68..595d74b1ea 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandler.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandler.java @@ -222,7 +222,7 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements } @Override - public String getComponentType(){ + public String getComponentType() { return "ip:tcp-outbound-channel-adapter"; } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java index 42fd097def..93a48717b2 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java @@ -661,7 +661,8 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport connection.sendExceptionToListener(new EOFException("Connection is closed")); } } - }}); + } + }); } catch (RejectedExecutionException e) { delayRead(selector, now, key); @@ -874,7 +875,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport public boolean closeConnection(String connectionId) { Assert.notNull(connectionId, "'connectionId' to close must not be null"); // closed connections are removed from #connections in #harvestClosedConnections() - synchronized(this.connections) { + synchronized (this.connections) { boolean closed = false; TcpConnectionSupport connection = this.connections.get(connectionId); if (connection != null) { diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionInterceptorFactoryChain.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionInterceptorFactoryChain.java index 92cf0cc8f1..37274d7ff0 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionInterceptorFactoryChain.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionInterceptorFactoryChain.java @@ -28,7 +28,7 @@ public class TcpConnectionInterceptorFactoryChain { private TcpConnectionInterceptorFactory[] interceptorFactories; public TcpConnectionInterceptorFactory[] getInterceptorFactories() { - return this.interceptorFactories;//NOSONAR + return this.interceptorFactories; //NOSONAR } public void setInterceptors(TcpConnectionInterceptorFactory[] interceptorFactories) { diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetConnection.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetConnection.java index fc65e155cf..980121a1b6 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetConnection.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetConnection.java @@ -82,7 +82,7 @@ public class TcpNetConnection extends TcpConnectionSupport implements Scheduling try { this.socket.close(); } - catch (Exception e) {} + catch (Exception e) { } super.close(); } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetServerConnectionFactory.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetServerConnectionFactory.java index c2fb1dc2e2..1a5eda01a0 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetServerConnectionFactory.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetServerConnectionFactory.java @@ -191,7 +191,7 @@ public class TcpNetServerConnectionFactory extends AbstractServerConnectionFacto try { this.serverSocket.close(); } - catch (IOException e) {} + catch (IOException e) { } this.serverSocket = null; super.stop(); } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java index 1635e6c8b6..bb82895546 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java @@ -124,11 +124,11 @@ public class TcpNioConnection extends TcpConnectionSupport { try { this.channelInputStream.close(); } - catch (IOException e) {} + catch (IOException e) { } try { this.socketChannel.close(); } - catch (Exception e) {} + catch (Exception e) { } super.close(); } @@ -140,7 +140,7 @@ public class TcpNioConnection extends TcpConnectionSupport { @Override @SuppressWarnings("unchecked") public void send(Message message) throws Exception { - synchronized(this.socketChannel) { + synchronized (this.socketChannel) { if (this.bufferedOutputStream == null) { int writeBufferSize = this.socketChannel.socket().getSendBufferSize(); this.bufferedOutputStream = new BufferedOutputStream(this.getChannelOutputStream(), @@ -215,7 +215,7 @@ public class TcpNioConnection extends TcpConnectionSupport { logger.trace(this.getConnectionId() + " Nio message assembler running..."); } boolean moreDataAvailable = true; - while(moreDataAvailable) { + while (moreDataAvailable) { try { try { if (dataAvailable()) { @@ -275,7 +275,7 @@ public class TcpNioConnection extends TcpConnectionSupport { // a new one wasn't run try { if (dataAvailable()) { - synchronized(this.executionControl) { + synchronized (this.executionControl) { if (this.executionControl.incrementAndGet() <= 1) { // only continue if we don't already have another assembler running this.executionControl.set(1); @@ -444,7 +444,7 @@ public class TcpNioConnection extends TcpConnectionSupport { } private void checkForAssembler() { - synchronized(this.executionControl) { + synchronized (this.executionControl) { if (this.executionControl.incrementAndGet() <= 1) { // only execute run() if we don't already have one running this.executionControl.set(1); diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java index 95dfde8163..db6298fffa 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java @@ -166,7 +166,7 @@ public class TcpNioSSLConnection extends TcpNioConnection { } switch (result.getHandshakeStatus()) { case FINISHED: - resumeWriterIfNeeded();//NOSONAR - fall-through inteded + resumeWriterIfNeeded(); //NOSONAR - fall-through inteded // switch fall-through intended case NOT_HANDSHAKING: case NEED_UNWRAP: diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/ByteArrayCrLfSerializer.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/ByteArrayCrLfSerializer.java index 9b3a0ba701..d6fe91a273 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/ByteArrayCrLfSerializer.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/ByteArrayCrLfSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -58,7 +58,7 @@ public class ByteArrayCrLfSerializer extends AbstractByteArraySerializer { throw new SoftEndOfStreamException("Stream closed between payloads"); } checkClosure(bite); - if (n > 0 && bite == '\n' && buffer[n-1] == '\r') { + if (n > 0 && bite == '\n' && buffer[n - 1] == '\r') { break; } buffer[n++] = (byte) bite; @@ -67,7 +67,7 @@ public class ByteArrayCrLfSerializer extends AbstractByteArraySerializer { + this.maxMessageSize); } } - return n-1; // trim \r + return n - 1; // trim \r } catch (SoftEndOfStreamException e) { throw e; diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/TcpDeserializationExceptionEvent.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/TcpDeserializationExceptionEvent.java index 53cb36cf25..1bce1e133b 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/TcpDeserializationExceptionEvent.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/TcpDeserializationExceptionEvent.java @@ -35,15 +35,15 @@ public class TcpDeserializationExceptionEvent extends IpIntegrationEvent { private final int offset; - public TcpDeserializationExceptionEvent(Object source, Throwable cause, byte[] buffer,//NOSONAR - direct storage + public TcpDeserializationExceptionEvent(Object source, Throwable cause, byte[] buffer, //NOSONAR - direct storage int offset) { super(source, cause); - this.buffer = buffer;//NOSONAR - direct storage + this.buffer = buffer; //NOSONAR - direct storage this.offset = offset; } public byte[] getBuffer() { - return this.buffer;//NOSONAR - direct access + return this.buffer; //NOSONAR - direct access } public int getOffset() { diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/udp/UnicastReceivingChannelAdapter.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/udp/UnicastReceivingChannelAdapter.java index c5d3d9ec05..e67fdc1c94 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/udp/UnicastReceivingChannelAdapter.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/udp/UnicastReceivingChannelAdapter.java @@ -279,7 +279,7 @@ public class UnicastReceivingChannelAdapter extends AbstractInternetProtocolRece } @Override - public String getComponentType(){ + public String getComponentType() { return "ip:udp-inbound-channel-adapter"; } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/udp/UnicastSendingMessageHandler.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/udp/UnicastSendingMessageHandler.java index 7fb635073e..26baf5b526 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/udp/UnicastSendingMessageHandler.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/udp/UnicastSendingMessageHandler.java @@ -281,7 +281,7 @@ public class UnicastSendingMessageHandler extends throw e; } catch (Exception e) { - try{ + try { this.socket.close(); } catch (Exception e1) { } @@ -297,7 +297,7 @@ public class UnicastSendingMessageHandler extends public void startAckThread() { if (!this.ackThreadRunning) { - synchronized(this) { + synchronized (this) { if (!this.ackThreadRunning) { try { getSocket(); @@ -437,7 +437,7 @@ public class UnicastSendingMessageHandler extends } @Override - public String getComponentType(){ + public String getComponentType() { return "ip:udp-outbound-channel-adapter"; } @@ -496,7 +496,7 @@ public class UnicastSendingMessageHandler extends this.ackThreadRunning = true; this.ackLatch.countDown(); DatagramPacket ackPack = new DatagramPacket(new byte[100], 100); - while(true) { + while (true) { this.getSocket().receive(ackPack); String id = new String(ackPack.getData(), ackPack.getOffset(), ackPack.getLength()); if (logger.isDebugEnabled()) { diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java index 5d39ccf330..b9850e4f58 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -44,5 +44,5 @@ public abstract class RegexUtils { return out; } - private RegexUtils() {} + private RegexUtils() { } } diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests.java index 8f0801dd9a..ab46185fb3 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests.java @@ -97,62 +97,62 @@ public class ParserUnitTests { ApplicationContext ctx; @Autowired - @Qualifier(value="testInUdp") + @Qualifier(value = "testInUdp") UnicastReceivingChannelAdapter udpIn; @Autowired - @Qualifier(value="testInUdpMulticast") + @Qualifier(value = "testInUdpMulticast") MulticastReceivingChannelAdapter udpInMulticast; @Autowired - @Qualifier(value="testInTcp") + @Qualifier(value = "testInTcp") TcpReceivingChannelAdapter tcpIn; @Autowired - @Qualifier(value="testOutUdp.handler") + @Qualifier(value = "testOutUdp.handler") UnicastSendingMessageHandler udpOut; @Autowired - @Qualifier(value="testOutUdpiMulticast.handler") + @Qualifier(value = "testOutUdpiMulticast.handler") MulticastSendingMessageHandler udpOutMulticast; @Autowired - @Qualifier(value="testOutTcpNio") + @Qualifier(value = "testOutTcpNio") AbstractEndpoint tcpOutEndpoint; @Autowired - @Qualifier(value="testOutTcpNio.handler") + @Qualifier(value = "testOutTcpNio.handler") TcpSendingMessageHandler tcpOut; @Autowired EventDrivenConsumer testOutTcpNio; @Autowired - @Qualifier(value="inGateway1") + @Qualifier(value = "inGateway1") TcpInboundGateway tcpInboundGateway1; @Autowired - @Qualifier(value="inGateway2") + @Qualifier(value = "inGateway2") TcpInboundGateway tcpInboundGateway2; @Autowired - @Qualifier(value="outGateway.handler") + @Qualifier(value = "outGateway.handler") TcpOutboundGateway tcpOutboundGateway; @Autowired - @Qualifier(value="outAdviceGateway.handler") + @Qualifier(value = "outAdviceGateway.handler") TcpOutboundGateway outAdviceGateway; // verify we can still inject by generated name @Autowired - @Qualifier(value="org.springframework.integration.ip.tcp.TcpOutboundGateway#0") + @Qualifier(value = "org.springframework.integration.ip.tcp.TcpOutboundGateway#0") TcpOutboundGateway tcpOutboundGatewayByGeneratedName; @Autowired EventDrivenConsumer outGateway; @Autowired - @Qualifier(value="externalTE") + @Qualifier(value = "externalTE") TaskExecutor taskExecutor; @Autowired @@ -201,11 +201,11 @@ public class ParserUnitTests { AbstractConnectionFactory cfS3; @Autowired - @Qualifier(value="tcpNewOut1.handler") + @Qualifier(value = "tcpNewOut1.handler") TcpSendingMessageHandler tcpNewOut1; @Autowired - @Qualifier(value="tcpNewOut2.handler") + @Qualifier(value = "tcpNewOut2.handler") TcpSendingMessageHandler tcpNewOut2; @Autowired @@ -242,7 +242,7 @@ public class ParserUnitTests { TaskScheduler sched; @Autowired - @Qualifier(value="tcpOutClientMode.handler") + @Qualifier(value = "tcpOutClientMode.handler") TcpSendingMessageHandler tcpOutClientMode; @Autowired @@ -290,14 +290,14 @@ public class ParserUnitTests { assertEquals(30, dfa.getPropertyValue("soReceiveBufferSize")); assertEquals(31, dfa.getPropertyValue("soSendBufferSize")); assertEquals(32, dfa.getPropertyValue("soTimeout")); - assertEquals("testInUdp",udpIn.getComponentName()); + assertEquals("testInUdp", udpIn.getComponentName()); assertEquals("ip:udp-inbound-channel-adapter", udpIn.getComponentType()); assertEquals("127.0.0.1", dfa.getPropertyValue("localAddress")); assertSame(taskExecutor, dfa.getPropertyValue("taskExecutor")); assertEquals(errorChannel, dfa.getPropertyValue("errorChannel")); DatagramPacketMessageMapper mapper = (DatagramPacketMessageMapper) dfa.getPropertyValue("mapper"); DirectFieldAccessor mapperAccessor = new DirectFieldAccessor(mapper); - assertFalse((Boolean)mapperAccessor.getPropertyValue("lookupHost")); + assertFalse((Boolean) mapperAccessor.getPropertyValue("lookupHost")); assertFalse(TestUtils.getPropertyValue(udpIn, "autoStartup", Boolean.class)); assertEquals(1234, dfa.getPropertyValue("phase")); } @@ -317,14 +317,14 @@ public class ParserUnitTests { assertNull(dfa.getPropertyValue("errorChannel")); DatagramPacketMessageMapper mapper = (DatagramPacketMessageMapper) dfa.getPropertyValue("mapper"); DirectFieldAccessor mapperAccessor = new DirectFieldAccessor(mapper); - assertTrue((Boolean)mapperAccessor.getPropertyValue("lookupHost")); + assertTrue((Boolean) mapperAccessor.getPropertyValue("lookupHost")); } @Test public void testInTcp() { DirectFieldAccessor dfa = new DirectFieldAccessor(tcpIn); assertSame(cfS1, dfa.getPropertyValue("serverConnectionFactory")); - assertEquals("testInTcp",tcpIn.getComponentName()); + assertEquals("testInTcp", tcpIn.getComponentName()); assertEquals("ip:tcp-inbound-channel-adapter", tcpIn.getComponentType()); assertEquals(errorChannel, dfa.getPropertyValue("errorChannel")); assertFalse(cfS1.isLookupHost()); @@ -376,7 +376,7 @@ public class ParserUnitTests { assertEquals("127.0.0.1", dfa.getPropertyValue("localAddress")); assertSame(taskExecutor, dfa.getPropertyValue("taskExecutor")); assertEquals(23, dfa.getPropertyValue("order")); - assertEquals("testOutUdp",udpOut.getComponentName()); + assertEquals("testOutUdp", udpOut.getComponentName()); assertEquals("ip:udp-outbound-channel-adapter", udpOut.getComponentType()); } @@ -438,7 +438,7 @@ public class ParserUnitTests { public void testOutTcp() { DirectFieldAccessor dfa = new DirectFieldAccessor(tcpOut); assertSame(cfC1, dfa.getPropertyValue("clientConnectionFactory")); - assertEquals("testOutTcpNio",tcpOut.getComponentName()); + assertEquals("testOutTcpNio", tcpOut.getComponentName()); assertEquals("ip:tcp-outbound-channel-adapter", tcpOut.getComponentType()); assertFalse(cfC1.isLookupHost()); assertEquals(35, dfa.getPropertyValue("order")); @@ -454,7 +454,7 @@ public class ParserUnitTests { DirectFieldAccessor dfa = new DirectFieldAccessor(tcpInboundGateway1); assertSame(cfS2, dfa.getPropertyValue("serverConnectionFactory")); assertEquals(456L, dfa.getPropertyValue("replyTimeout")); - assertEquals("inGateway1",tcpInboundGateway1.getComponentName()); + assertEquals("inGateway1", tcpInboundGateway1.getComponentName()); assertEquals("ip:tcp-inbound-gateway", tcpInboundGateway1.getComponentType()); assertEquals(errorChannel, dfa.getPropertyValue("errorChannel")); assertTrue(cfS2.isLookupHost()); @@ -470,7 +470,7 @@ public class ParserUnitTests { DirectFieldAccessor dfa = new DirectFieldAccessor(tcpInboundGateway2); assertSame(cfS3, dfa.getPropertyValue("serverConnectionFactory")); assertEquals(456L, dfa.getPropertyValue("replyTimeout")); - assertEquals("inGateway2",tcpInboundGateway2.getComponentName()); + assertEquals("inGateway2", tcpInboundGateway2.getComponentName()); assertEquals("ip:tcp-inbound-gateway", tcpInboundGateway2.getComponentType()); assertNull(dfa.getPropertyValue("errorChannel")); assertEquals(Boolean.FALSE, dfa.getPropertyValue("isClientMode")); @@ -487,7 +487,7 @@ public class ParserUnitTests { MessagingTemplate.class); assertEquals(Long.valueOf(567), TestUtils.getPropertyValue(messagingTemplate, "sendTimeout", Long.class)); assertEquals("789", TestUtils.getPropertyValue(tcpOutboundGateway, "remoteTimeoutExpression.literalValue")); - assertEquals("outGateway",tcpOutboundGateway.getComponentName()); + assertEquals("outGateway", tcpOutboundGateway.getComponentName()); assertEquals("ip:tcp-outbound-gateway", tcpOutboundGateway.getComponentType()); assertTrue(cfC2.isLookupHost()); assertEquals(24, dfa.getPropertyValue("order")); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/InterceptedSharedConnectionTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/InterceptedSharedConnectionTests.java index dea76dc4bc..afd2317267 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/InterceptedSharedConnectionTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/InterceptedSharedConnectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -49,7 +49,7 @@ public class InterceptedSharedConnectionTests { AbstractApplicationContext ctx; @Autowired - @Qualifier(value="inboundServer") + @Qualifier(value = "inboundServer") TcpReceivingChannelAdapter listener; private static Level existingLogLevel; diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SharedConnectionTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SharedConnectionTests.java index eed6e067de..ea9e3751bd 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SharedConnectionTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SharedConnectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -49,7 +49,7 @@ public class SharedConnectionTests { AbstractApplicationContext ctx; @Autowired - @Qualifier(value="inboundServer") + @Qualifier(value = "inboundServer") TcpReceivingChannelAdapter listener; /** diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpConfigInboundGatewayTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpConfigInboundGatewayTests.java index ab16865528..a82cf25bb8 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpConfigInboundGatewayTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpConfigInboundGatewayTests.java @@ -53,99 +53,99 @@ public class TcpConfigInboundGatewayTests { AbstractApplicationContext ctx; @Autowired - @Qualifier(value="crLfServer") + @Qualifier(value = "crLfServer") AbstractServerConnectionFactory crLfServer; @Autowired - @Qualifier(value="stxEtxServer") + @Qualifier(value = "stxEtxServer") AbstractServerConnectionFactory stxEtxServer; @Autowired - @Qualifier(value="lengthHeaderServer") + @Qualifier(value = "lengthHeaderServer") AbstractServerConnectionFactory lengthHeaderServer; @Autowired - @Qualifier(value="javaSerialServer") + @Qualifier(value = "javaSerialServer") AbstractServerConnectionFactory javaSerialServer; @Autowired - @Qualifier(value="crLfClient") + @Qualifier(value = "crLfClient") AbstractClientConnectionFactory crLfClient; @Autowired - @Qualifier(value="stxEtxClient") + @Qualifier(value = "stxEtxClient") AbstractClientConnectionFactory stxEtxClient; @Autowired - @Qualifier(value="lengthHeaderClient") + @Qualifier(value = "lengthHeaderClient") AbstractClientConnectionFactory lengthHeaderClient; @Autowired - @Qualifier(value="javaSerialClient") + @Qualifier(value = "javaSerialClient") AbstractClientConnectionFactory javaSerialClient; @Autowired - @Qualifier(value="crLfServerNio") + @Qualifier(value = "crLfServerNio") AbstractServerConnectionFactory crLfServerNio; @Autowired - @Qualifier(value="stxEtxServerNio") + @Qualifier(value = "stxEtxServerNio") AbstractServerConnectionFactory stxEtxServerNio; @Autowired - @Qualifier(value="lengthHeaderServerNio") + @Qualifier(value = "lengthHeaderServerNio") AbstractServerConnectionFactory lengthHeaderServerNio; @Autowired - @Qualifier(value="javaSerialServerNio") + @Qualifier(value = "javaSerialServerNio") AbstractServerConnectionFactory javaSerialServerNio; @Autowired - @Qualifier(value="crLfClientNio") + @Qualifier(value = "crLfClientNio") AbstractClientConnectionFactory crLfClientNio; @Autowired - @Qualifier(value="stxEtxClientNio") + @Qualifier(value = "stxEtxClientNio") AbstractClientConnectionFactory stxEtxClientNio; @Autowired - @Qualifier(value="lengthHeaderClientNio") + @Qualifier(value = "lengthHeaderClientNio") AbstractClientConnectionFactory lengthHeaderClientNio; @Autowired - @Qualifier(value="javaSerialClientNio") + @Qualifier(value = "javaSerialClientNio") AbstractClientConnectionFactory javaSerialClientNio; @Autowired - @Qualifier(value="gatewayCrLf") + @Qualifier(value = "gatewayCrLf") TcpInboundGateway gatewayCrLf; @Autowired - @Qualifier(value="gatewayStxEtx") + @Qualifier(value = "gatewayStxEtx") TcpInboundGateway gatewayStxEtx; @Autowired - @Qualifier(value="gatewayLength") + @Qualifier(value = "gatewayLength") TcpInboundGateway gatewayLength; @Autowired - @Qualifier(value="gatewaySerialized") + @Qualifier(value = "gatewaySerialized") TcpInboundGateway gatewaySerialized; @Autowired - @Qualifier(value="gatewayCrLfNio") + @Qualifier(value = "gatewayCrLfNio") TcpInboundGateway gatewayCrLfNio; @Autowired - @Qualifier(value="gatewayStxEtxNio") + @Qualifier(value = "gatewayStxEtxNio") TcpInboundGateway gatewayStxEtxNio; @Autowired - @Qualifier(value="gatewayLengthNio") + @Qualifier(value = "gatewayLengthNio") TcpInboundGateway gatewayLengthNio; @Autowired - @Qualifier(value="gatewaySerializedNio") + @Qualifier(value = "gatewaySerializedNio") TcpInboundGateway gatewaySerializedNio; @Test diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpConfigOutboundGatewayTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpConfigOutboundGatewayTests.java index 6653482c42..ec82bfc450 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpConfigOutboundGatewayTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpConfigOutboundGatewayTests.java @@ -22,16 +22,17 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory; +import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory; +import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.PollableChannel; import org.springframework.messaging.SubscribableChannel; -import org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory; -import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory; -import org.springframework.integration.support.MessageBuilder; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -50,38 +51,39 @@ public class TcpConfigOutboundGatewayTests { AbstractApplicationContext ctx; @Autowired - @Qualifier(value="crLfServer") + @Qualifier(value = "crLfServer") AbstractServerConnectionFactory crLfServer; @Autowired - @Qualifier(value="stxEtxServer") + @Qualifier(value = "stxEtxServer") AbstractServerConnectionFactory stxEtxServer; @Autowired - @Qualifier(value="lengthHeaderServer") + @Qualifier(value = "lengthHeaderServer") AbstractServerConnectionFactory lengthHeaderServer; @Autowired - @Qualifier(value="javaSerialServer") + @Qualifier(value = "javaSerialServer") AbstractServerConnectionFactory javaSerialServer; - @Autowired @Qualifier(value="crLfClient") + @Autowired + @Qualifier(value = "crLfClient") AbstractClientConnectionFactory crLfClient; @Autowired - @Qualifier(value="stxEtxClient") + @Qualifier(value = "stxEtxClient") AbstractClientConnectionFactory stxEtxClient; @Autowired - @Qualifier(value="lengthHeaderClient") + @Qualifier(value = "lengthHeaderClient") AbstractClientConnectionFactory lengthHeaderClient; @Autowired - @Qualifier(value="javaSerialClient") + @Qualifier(value = "javaSerialClient") AbstractClientConnectionFactory javaSerialClient; @Autowired - @Qualifier(value="gatewayCrLf") + @Qualifier(value = "gatewayCrLf") TcpInboundGateway gatewayCrLf; // @Autowired diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java index ace35ef994..d48d278cbf 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java @@ -803,7 +803,7 @@ public class TcpSendingMessageHandlerTests extends AbstractTcpChannelAdapterTest for (int i = 0; i < 2; i++) { Message mOut = channel.receive(10000); assertNotNull(mOut); - replies.add(new String((byte[])mOut.getPayload())); + replies.add(new String((byte[]) mOut.getPayload())); } assertTrue(replies.remove("Reply1")); assertTrue(replies.remove("Reply2")); @@ -868,7 +868,7 @@ public class TcpSendingMessageHandlerTests extends AbstractTcpChannelAdapterTest for (int i = 0; i < 2; i++) { Message mOut = channel.receive(10000); assertNotNull(mOut); - replies.add(new String((byte[])mOut.getPayload())); + replies.add(new String((byte[]) mOut.getPayload())); } assertTrue(replies.remove("Reply1")); assertTrue(replies.remove("Reply2")); @@ -962,7 +962,7 @@ public class TcpSendingMessageHandlerTests extends AbstractTcpChannelAdapterTest for (i = 100; i < 200; i++) { Message mOut = channel.receive(20000); assertNotNull(mOut); - replies.add(new String((byte[])mOut.getPayload())); + replies.add(new String((byte[]) mOut.getPayload())); } for (i = 0; i < 100; i++) { assertTrue("Reply" + i + " missing", replies.remove("Reply" + i)); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java index 0899f6d2bd..8e57dc2931 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -111,7 +111,7 @@ public class ConnectionEventTests { conn.send(new GenericMessage("bar")); fail("Expected exception"); } - catch (Exception e) {} + catch (Exception e) { } assertTrue(theEvent.size() > 0); assertNotNull(theEvent.get(0)); assertTrue(theEvent.get(0) instanceof TcpConnectionExceptionEvent); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactoryTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactoryTests.java index ba5691eef2..9ea8857192 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactoryTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -106,7 +106,7 @@ public class FailoverClientConnectionFactoryTests { Mockito.verify(conn2).send(message); } - @Test(expected=IOException.class) + @Test(expected = IOException.class) public void testFailoverAllDead() throws Exception { AbstractClientConnectionFactory factory1 = mock(AbstractClientConnectionFactory.class); AbstractClientConnectionFactory factory2 = mock(AbstractClientConnectionFactory.class); @@ -161,7 +161,7 @@ public class FailoverClientConnectionFactoryTests { Mockito.verify(conn1, times(2)).send(message); } - @Test(expected=IOException.class) + @Test(expected = IOException.class) public void testFailoverConnectNone() throws Exception { AbstractClientConnectionFactory factory1 = mock(AbstractClientConnectionFactory.class); AbstractClientConnectionFactory factory2 = mock(AbstractClientConnectionFactory.class); @@ -234,7 +234,7 @@ public class FailoverClientConnectionFactoryTests { failoverFactory.getConnection().send(message); fail("ExpectedFailure"); } - catch (IOException e) {} + catch (IOException e) { } failoverFactory.getConnection().send(message); Mockito.verify(conn2).send(message); Mockito.verify(conn1, times(3)).send(message); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/HelloWorldInterceptor.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/HelloWorldInterceptor.java index ba91cf3a25..2f8fdf97cf 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/HelloWorldInterceptor.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/HelloWorldInterceptor.java @@ -62,7 +62,7 @@ public class HelloWorldInterceptor extends TcpConnectionInterceptorSupport { @Override public boolean onMessage(Message message) { if (!this.negotiated) { - synchronized(this) { + synchronized (this) { if (!this.negotiated) { Object payload = message.getPayload(); logger.debug(this.toString() + " received " + payload); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SOLingerTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SOLingerTests.java index 7521a7ca54..a985793a66 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SOLingerTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SOLingerTests.java @@ -64,7 +64,7 @@ public class SOLingerTests { private AbstractServerConnectionFactory inCFNioLinger; @Test - public void configOk() {} + public void configOk() { } @Test public void finReceivedNet() { diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java index 1c0a978381..59b57c6b8a 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -282,7 +282,8 @@ public class TcpNioConnectionTests { @Override public boolean matches(Field field) { return field.getName().equals("open"); - }}); + } + }); Field field = fields.get(0); // Can't use Mockito because isOpen() is final ReflectionUtils.setField(field, chan1, true); @@ -385,7 +386,7 @@ public class TcpNioConnectionTests { }).when(channel).read(Mockito.any(ByteBuffer.class)); final TcpNioConnection connection = new TcpNioConnection(channel, false, false, null, null); connection.setTaskExecutor(exec); - connection.registerListener(new TcpListener(){ + connection.registerListener(new TcpListener() { @Override public boolean onMessage(Message message) { messageLatch.countDown(); @@ -476,12 +477,12 @@ public class TcpNioConnectionTests { stream.read(out, 1, 5); fail("Expected IndexOutOfBoundsException"); } - catch (IndexOutOfBoundsException e) {} + catch (IndexOutOfBoundsException e) { } try { stream.read(null, 1, 5); fail("Expected IllegalArgumentException"); } - catch (IllegalArgumentException e) {} + catch (IllegalArgumentException e) { } assertEquals(0, stream.read(out, 0, 0)); assertEquals(3, stream.read(out)); } @@ -497,7 +498,7 @@ public class TcpNioConnectionTests { final CountDownLatch latch = new CountDownLatch(1); final byte[] out = new byte[4]; ExecutorService exec = Executors.newSingleThreadExecutor(); - exec.execute(new Runnable(){ + exec.execute(new Runnable() { @Override public void run() { try { @@ -617,7 +618,7 @@ public class TcpNioConnectionTests { socket = SocketFactory.getDefault().createSocket("localhost", port); break; } - catch (ConnectException e) {} + catch (ConnectException e) { } Thread.sleep(100); } assertTrue("Could not open socket to localhost:" + port, n < 100); @@ -664,7 +665,7 @@ public class TcpNioConnectionTests { socket = SocketFactory.getDefault().createSocket("localhost", port); break; } - catch (ConnectException e) {} + catch (ConnectException e) { } Thread.sleep(100); } assertTrue("Could not open socket to localhost:" + port, n < 100); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMessageMapperTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMessageMapperTests.java index 5ead730e69..eed024afa7 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMessageMapperTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMessageMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -73,7 +73,7 @@ public class DatagramPacketMessageMapperTests { assertEquals(messageOut.getHeaders().get(IpHeaders.ACK_ID).toString(), message.getHeaders().getId().toString()); } - assertTrue(((String)messageOut.getHeaders().get(IpHeaders.HOSTNAME)).contains("localhost")); + assertTrue(((String) messageOut.getHeaders().get(IpHeaders.HOSTNAME)).contains("localhost")); mapper.setLookupHost(false); messageOut = mapper.toMessage(packet); assertEquals(new String(message.getPayload()), new String(messageOut.getPayload())); @@ -81,7 +81,7 @@ public class DatagramPacketMessageMapperTests { assertEquals(messageOut.getHeaders().get(IpHeaders.ACK_ID).toString(), message.getHeaders().getId().toString()); } - assertFalse(((String)messageOut.getHeaders().get(IpHeaders.HOSTNAME)).contains("localhost")); + assertFalse(((String) messageOut.getHeaders().get(IpHeaders.HOSTNAME)).contains("localhost")); } @Test diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMulticastSendingHandlerTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMulticastSendingHandlerTests.java index d8f4469728..16f6f83b05 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMulticastSendingHandlerTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketMulticastSendingHandlerTests.java @@ -147,7 +147,7 @@ public class DatagramPacketMulticastSendingHandlerTests { int length = receivedPacket.getLength(); int offset = receivedPacket.getOffset(); byte[] dest = new byte[6]; - System.arraycopy(src, offset+length-6, dest, 0, 6); + System.arraycopy(src, offset + length - 6, dest, 0, 6); assertEquals(payload, new String(dest)); LogFactory.getLog(getClass()).debug(Thread.currentThread().getName() + " received packet"); DatagramPacketMessageMapper mapper = new DatagramPacketMessageMapper(); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketSendingHandlerTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketSendingHandlerTests.java index 8de31f6aaf..bdae6a8640 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketSendingHandlerTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketSendingHandlerTests.java @@ -136,7 +136,7 @@ public class DatagramPacketSendingHandlerTests { int length = receivedPacket.getLength(); int offset = receivedPacket.getOffset(); byte[] dest = new byte[6]; - System.arraycopy(src, offset+length-6, dest, 0, 6); + System.arraycopy(src, offset + length - 6, dest, 0, 6); assertEquals(payload, new String(dest)); handler.stop(); } diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/MultiClientTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/MultiClientTests.java index f1adf4221c..839663bbcf 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/MultiClientTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/MultiClientTests.java @@ -80,7 +80,8 @@ public class MultiClientTests { } } sender.stop(); - }}); + } + }); t.setDaemon(true); t.start(); } @@ -132,7 +133,8 @@ public class MultiClientTests { } } sender.stop(); - }}); + } + }); t.setDaemon(true); t.start(); } @@ -184,7 +186,8 @@ public class MultiClientTests { } } sender.stop(); - }}); + } + }); t.setDaemon(true); t.start(); } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageStore.java index afc803ebb0..c3e088ca78 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageStore.java @@ -348,7 +348,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.jdbcTemplate.update(getQuery(Query.CREATE_MESSAGE), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Inserting message with id key=" + messageId); } ps.setString(1, messageId); @@ -372,7 +372,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa updatedDate : this.jdbcTemplate.queryForObject(getQuery(Query.GET_GROUP_CREATED_DATE), new Object[] { groupKey, this.region}, Timestamp.class); - if (groupNotExist){ + if (groupNotExist) { try { this.doCreateMessageGroup(groupKey, createdDate); } @@ -390,7 +390,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.jdbcTemplate.update(getQuery(Query.CREATE_GROUP_TO_MESSAGE), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Inserting message with id key=" + messageId + " and created date=" + createdDate); } ps.setString(1, groupKey); @@ -478,7 +478,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.jdbcTemplate.update(getQuery(Query.REMOVE_MESSAGE_FROM_GROUP), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Removing message from group with group key=" + groupKey); } ps.setString(1, groupKey); @@ -498,7 +498,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa final String groupKey = getKey(groupId); - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Removing messages from group with group key=" + groupKey); } this.jdbcTemplate.batchUpdate(getQuery(Query.REMOVE_MESSAGE_FROM_GROUP), @@ -537,7 +537,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.jdbcTemplate.update(getQuery(Query.REMOVE_GROUP_TO_MESSAGE_JOIN), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Removing relationships for the group with group key=" + groupKey); } ps.setString(1, groupKey); @@ -548,7 +548,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.jdbcTemplate.update(getQuery(Query.DELETE_MESSAGE_GROUP), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Marking messages with group key=" + groupKey); } ps.setString(1, groupKey); @@ -565,7 +565,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.jdbcTemplate.update(getQuery(Query.COMPLETE_GROUP), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Completing MessageGroup: " + groupKey); } ps.setTimestamp(1, new Timestamp(updatedDate)); @@ -584,7 +584,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.jdbcTemplate.update(getQuery(Query.UPDATE_LAST_RELEASED_SEQUENCE), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Updating the sequence number of the last released Message in the MessageGroup: " + groupKey); } ps.setTimestamp(1, new Timestamp(updatedDate)); @@ -601,7 +601,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa String key = getKey(groupId); Message polledMessage = this.doPollForMessage(key); - if (polledMessage != null){ + if (polledMessage != null) { this.removeMessagesFromGroup(groupId, polledMessage); } return polledMessage; @@ -657,7 +657,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa * * @return the JdbcOperations implementation */ - protected JdbcOperations getJdbcOperations(){ + protected JdbcOperations getJdbcOperations() { return this.jdbcTemplate; } @@ -672,17 +672,17 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa List> messages = this.jdbcTemplate.query(getQuery(Query.POLL_FROM_GROUP), new Object[] { groupIdKey, this.region, groupIdKey, this.region }, this.mapper); Assert.isTrue(messages.size() == 0 || messages.size() == 1); - if (messages.size() > 0){ + if (messages.size() > 0) { return messages.get(0); } return null; } - private void doCreateMessageGroup(final String groupKey, final Timestamp createdDate){ + private void doCreateMessageGroup(final String groupKey, final Timestamp createdDate) { this.jdbcTemplate.update(getQuery(Query.CREATE_MESSAGE_GROUP), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Creating message group with id key=" + groupKey + " and created date=" + createdDate); } ps.setString(1, groupKey); @@ -693,11 +693,11 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa }); } - private void doUpdateMessageGroup(final String groupKey, final Timestamp updatedDate){ + private void doUpdateMessageGroup(final String groupKey, final Timestamp updatedDate) { this.jdbcTemplate.update(getQuery(Query.UPDATE_MESSAGE_GROUP), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Updating message group with id key=" + groupKey + " and updated date=" + updatedDate); } ps.setTimestamp(1, updatedDate); @@ -707,11 +707,11 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa }); } - private void updateMessageGroup(final String groupId){ + private void updateMessageGroup(final String groupId) { this.jdbcTemplate.update(getQuery(Query.UPDATE_GROUP), new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { - if (logger.isDebugEnabled()){ + if (logger.isDebugEnabled()) { logger.debug("Updating MessageGroup: " + groupId); } ps.setTimestamp(1, new Timestamp(System.currentTimeMillis())); @@ -721,7 +721,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa }); } - private List getMessageIdsForGroup(Object groupId){ + private List getMessageIdsForGroup(Object groupId) { String key = getKey(groupId); final List messageIds = new ArrayList(); diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java index 9c6a2e674c..f833f16954 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java @@ -119,7 +119,7 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler im this.poller.setMaxRowsPerPoll(this.maxRowsPerPoll); } - if (this.handler!= null) { + if (this.handler != null) { this.handler.setBeanFactory(this.getBeanFactory()); this.handler.afterPropertiesSet(); } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java index 81e877b7dd..9d93df6098 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java @@ -130,7 +130,7 @@ public class JdbcPollingChannelAdapter extends IntegrationObjectSupport implemen protected void onInit() throws Exception { super.onInit(); if (!this.sqlParameterSourceFactorySet && this.getBeanFactory() != null) { - ((ExpressionEvaluatingSqlParameterSourceFactory)this.sqlParameterSourceFactory) + ((ExpressionEvaluatingSqlParameterSourceFactory) this.sqlParameterSourceFactory) .setBeanFactory(this.getBeanFactory()); } } @@ -213,7 +213,7 @@ public class JdbcPollingChannelAdapter extends IntegrationObjectSupport implemen return payload; } @Override - public String getComponentType(){ + public String getComponentType() { return "jdbc:inbound-channel-adapter"; } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java index c88a05c59b..fa8425443d 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java @@ -432,7 +432,7 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean { /** * @return the name of the Stored Procedure or Function if set. Null otherwise. * */ - @ManagedAttribute(defaultValue="Null if not Set.") + @ManagedAttribute(defaultValue = "Null if not Set.") public String getStoredProcedureName() { return this.storedProcedureNameExpression instanceof LiteralExpression ? this.storedProcedureNameExpression.getValue(String.class) : null; @@ -441,7 +441,7 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean { /** * @return the Stored Procedure Name Expression as a String if set. Null otherwise. * */ - @ManagedAttribute(defaultValue="Null if not Set.") + @ManagedAttribute(defaultValue = "Null if not Set.") public String getStoredProcedureNameExpressionAsString() { return this.storedProcedureNameExpression != null ? this.storedProcedureNameExpression.getExpressionString() diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapter.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapter.java index 2aec8f79ac..21e9301ebe 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapter.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapter.java @@ -109,7 +109,7 @@ public class StoredProcPollingChannelAdapter extends IntegrationObjectSupport im } @Override - public String getComponentType(){ + public String getComponentType() { return "stored-proc:inbound-channel-adapter"; } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParser.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParser.java index 6a7fb179ac..19244e3be5 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParser.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -72,7 +72,7 @@ public class JdbcPollingChannelAdapterParser extends AbstractPollingInboundChann IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "update-sql-parameter-source-factory"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "select-sql-parameter-source"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-rows-per-poll"); - if (update!=null) { + if (update != null) { builder.addPropertyValue("updateSql", update); } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "update-per-row"); diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests.java index fcab2fa6fc..9832014320 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests.java @@ -39,7 +39,7 @@ import org.springframework.transaction.annotation.Transactional; @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class JdbcMessageStoreChannelTests { @Autowired diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreRegionTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreRegionTests.java index 176f52b0b1..f8d18badca 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreRegionTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreRegionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -128,7 +128,7 @@ public class JdbcMessageStoreRegionTests { messageStore1.addMessageToGroup("group1", MessageBuilder.withPayload("payload1").build()); - List regions = jdbcTemplate.query("Select * from INT_MESSAGE_GROUP where REGION = 'region1'", new RowMapper(){ + List regions = jdbcTemplate.query("Select * from INT_MESSAGE_GROUP where REGION = 'region1'", new RowMapper() { public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString("REGION"); @@ -141,7 +141,7 @@ public class JdbcMessageStoreRegionTests { messageStore2.addMessageToGroup("group1", MessageBuilder.withPayload("payload1").build()); - List regions2 = jdbcTemplate.query("Select * from INT_MESSAGE_GROUP where REGION = 'region2'", new RowMapper(){ + List regions2 = jdbcTemplate.query("Select * from INT_MESSAGE_GROUP where REGION = 'region2'", new RowMapper() { public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString("REGION"); diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests.java index bea58883b9..4d7629fc5c 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests.java @@ -110,7 +110,7 @@ public class JdbcMessageStoreTests { @Test @Transactional - public void testWithMessageHistory() throws Exception{ + public void testWithMessageHistory() throws Exception { Message message = new GenericMessage("Hello"); DirectChannel fooChannel = new DirectChannel(); @@ -533,7 +533,7 @@ public class JdbcMessageStoreTests { //now clear the messages for (Message message : messageGroup.getMessages()) { messageStore.removeMessagesFromGroup(groupId, message); - }//end for + } //end for //'add' the other message --> emulated by getting the messageGroup messageGroup = messageStore.getMessageGroup(groupId); //should be marked 'complete' --> old behavior it would not diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java index 20b90bf094..45cb288d44 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-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. @@ -100,13 +100,13 @@ public class StoredProcJavaConfigTests { } @Bean - @ServiceActivator(inputChannel="control") + @ServiceActivator(inputChannel = "control") public ExpressionControlBusFactoryBean controlBus() { return new ExpressionControlBusFactoryBean(); } @Bean - @InboundChannelAdapter(value = "fooChannel", poller = @Poller(fixedDelay="5000")) + @InboundChannelAdapter(value = "fooChannel", poller = @Poller(fixedDelay = "5000")) public MessageSource storedProc() { StoredProcPollingChannelAdapter source = new StoredProcPollingChannelAdapter(storedProcExecutor()); source.setExpectSingleResult(true); diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJmxManagedBeanTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJmxManagedBeanTests.java index 436dcd1a4e..f5ed3d8a48 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJmxManagedBeanTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJmxManagedBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -52,7 +52,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class StoredProcJmxManagedBeanTests { @Autowired @@ -176,7 +176,7 @@ public class StoredProcJmxManagedBeanTests { private final AtomicInteger count = new AtomicInteger(); public Integer next() throws InterruptedException { - if (count.get()>2){ + if (count.get() > 2) { //prevent message overload return null; } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java index 1b0f170a72..450a83f8b0 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java @@ -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. @@ -130,7 +130,7 @@ public class StoredProcOutboundGatewayWithNamespaceIntegrationTests { private final AtomicInteger count = new AtomicInteger(); public Integer next() throws InterruptedException { - if (count.get()>2){ + if (count.get() > 2) { //prevent message overload return null; } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithSpringContextIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithSpringContextIntegrationTests.java index 17351fb033..5b1a04685e 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithSpringContextIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithSpringContextIntegrationTests.java @@ -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. @@ -83,7 +83,7 @@ public class StoredProcOutboundGatewayWithSpringContextIntegrationTests { private final AtomicInteger count = new AtomicInteger(); public Integer next() throws InterruptedException { - if (count.get()>2){ + if (count.get() > 2) { //prevent message overload return null; } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespace2IntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespace2IntegrationTests.java index c8982387d6..50f69fc624 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespace2IntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespace2IntegrationTests.java @@ -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. @@ -75,7 +75,7 @@ public class StoredProcPollingChannelAdapterWithNamespace2IntegrationTests { private final AtomicInteger count = new AtomicInteger(); public Integer next() throws InterruptedException { - if (count.get()>2){ + if (count.get() > 2) { //prevent message overload return null; } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.java index d5feb7a04d..1db60096ba 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -78,7 +78,7 @@ public class StoredProcPollingChannelAdapterWithNamespaceIntegrationTests { private final AtomicInteger count = new AtomicInteger(); public Integer next() throws InterruptedException { - if (count.get()>2){ + if (count.get() > 2) { //prevent message overload return null; } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.java index 971f7a8d36..4976aa0ec2 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.java @@ -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. @@ -75,7 +75,7 @@ public class StoredProcPollingChannelAdapterWithSpringContextIntegrationTests { private final AtomicInteger count = new AtomicInteger(); public Integer next() throws InterruptedException { - if (count.get()>2){ + if (count.get() > 2) { //prevent message overload return null; } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java index 43079c66a1..217c402dbf 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java @@ -58,7 +58,7 @@ public class JdbcMessageHandlerParserTests { private static volatile int adviceCalled; @Test - public void testSimpleOutboundChannelAdapter(){ + public void testSimpleOutboundChannelAdapter() { setUp("handlingWithJdbcOperationsJdbcOutboundChannelAdapterTest.xml", getClass()); Message message = MessageBuilder.withPayload("foo").setHeader("business.key", "FOO").build(); channel.send(message); @@ -71,7 +71,7 @@ public class JdbcMessageHandlerParserTests { } @Test - public void testDollarHeaderOutboundChannelAdapter(){ + public void testDollarHeaderOutboundChannelAdapter() { setUp("handlingDollarHeaderJdbcOutboundChannelAdapterTest.xml", getClass()); Message message = MessageBuilder.withPayload("foo").setHeader("$foo_id", "abc").build(); channel.send(message); @@ -81,7 +81,7 @@ public class JdbcMessageHandlerParserTests { } @Test - public void testMapPayloadOutboundChannelAdapter(){ + public void testMapPayloadOutboundChannelAdapter() { setUp("handlingMapPayloadJdbcOutboundChannelAdapterTest.xml", getClass()); assertTrue(context.containsBean("jdbcAdapter")); System.out.println(context.getBean("jdbcAdapter").getClass().getName()); @@ -93,7 +93,7 @@ public class JdbcMessageHandlerParserTests { } @Test - public void testMapPayloadNestedQueryOutboundChannelAdapter(){ + public void testMapPayloadNestedQueryOutboundChannelAdapter() { setUp("handlingMapPayloadNestedQueryJdbcOutboundChannelAdapterTest.xml", getClass()); Message message = MessageBuilder.withPayload(Collections.singletonMap("foo", "bar")).build(); channel.send(message); @@ -103,7 +103,7 @@ public class JdbcMessageHandlerParserTests { } @Test - public void testParameterSourceOutboundChannelAdapter(){ + public void testParameterSourceOutboundChannelAdapter() { setUp("handlingParameterSourceJdbcOutboundChannelAdapterTest.xml", getClass()); Message message = MessageBuilder.withPayload("foo").build(); channel.send(message); @@ -113,7 +113,7 @@ public class JdbcMessageHandlerParserTests { } @Test - public void testOutboundAdapterWithPoller() throws Exception{ + public void testOutboundAdapterWithPoller() throws Exception { setUp("JdbcOutboundAdapterWithPollerTest-context.xml", this.getClass()); MessageChannel target = context.getBean("target", MessageChannel.class); Message message = MessageBuilder.withPayload("foo").setHeader("business.key", "FOO").build(); @@ -125,7 +125,7 @@ public class JdbcMessageHandlerParserTests { } @Test - public void testOutboundChannelAdapterWithinChain(){ + public void testOutboundChannelAdapterWithinChain() { setUp("handlingJdbcOutboundChannelAdapterWithinChainTest.xml", getClass()); Message message = MessageBuilder.withPayload("foo").setHeader("business.key", "FOO").build(); channel.send(message); @@ -135,15 +135,15 @@ public class JdbcMessageHandlerParserTests { } @After - public void tearDown(){ - if(context != null){ + public void tearDown() { + if (context != null) { context.close(); } } - public void setUp(String name, Class cls){ + public void setUp(String name, Class cls) { context = new ClassPathXmlApplicationContext(name, cls); - jdbcTemplate = new JdbcTemplate(this.context.getBean("dataSource",DataSource.class)); + jdbcTemplate = new JdbcTemplate(this.context.getBean("dataSource", DataSource.class)); channel = this.context.getBean("target", MessageChannel.class); } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java index 1a6a6ed02e..850ea1bb5d 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java @@ -134,7 +134,7 @@ public class JdbcOutboundGatewayParserTests { } @Test - public void testWithPoller() throws Exception{ + public void testWithPoller() throws Exception { setUp("JdbcOutboundGatewayWithPollerTest-context.xml", this.getClass()); Message message = MessageBuilder.withPayload(Collections.singletonMap("foo", "bar")).build(); MessageChannel target = context.getBean("target", MessageChannel.class); @@ -152,7 +152,7 @@ public class JdbcOutboundGatewayParserTests { } @Test - public void testWithSelectQueryOnly() throws Exception{ + public void testWithSelectQueryOnly() throws Exception { this.context = new ClassPathXmlApplicationContext("JdbcOutboundGatewayWithSelectTest-context.xml", this.getClass()); Message message = MessageBuilder.withPayload(Integer.valueOf(100)).build(); MessageChannel requestChannel = context.getBean("request", MessageChannel.class); diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParserTests.java index 4d94a0b62a..3e3e2be4cc 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -133,12 +133,12 @@ public class JdbcPollingChannelAdapterParserTests { this.jdbcTemplate.update("insert into item values(1,'',42)"); Message message = messagingTemplate.receive(); assertNotNull(message); - assertEquals(42, ((Map) ((List )message.getPayload()).get(0)).get("STATUS")); + assertEquals(42, ((Map) ((List ) message.getPayload()).get(0)).get("STATUS")); this.jdbcTemplate.update("insert into item values(2,'',84)"); this.appCtx.getBean(Status.class).which = 84; message = messagingTemplate.receive(); assertNotNull(message); - assertEquals(84, ((Map) ((List )message.getPayload()).get(0)).get("STATUS")); + assertEquals(84, ((Map) ((List ) message.getPayload()).get(0)).get("STATUS")); } @Test diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcMessageHandlerParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcMessageHandlerParserTests.java index 8300b4ad6f..9aa264fe55 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcMessageHandlerParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcMessageHandlerParserTests.java @@ -170,13 +170,13 @@ public class StoredProcMessageHandlerParserTests { } @After - public void tearDown(){ - if(context != null){ + public void tearDown() { + if (context != null) { context.close(); } } - public void setUp(String name, Class cls){ + public void setUp(String name, Class cls) { context = new ClassPathXmlApplicationContext(name, cls); consumer = this.context.getBean("storedProcedureOutboundChannelAdapter", EventDrivenConsumer.class); } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java index 809443197d..17f6aa4215 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java @@ -289,13 +289,13 @@ public class StoredProcOutboundGatewayParserTests { } @After - public void tearDown(){ - if(context != null){ + public void tearDown() { + if (context != null) { context.close(); } } - public void setUp(String name, Class cls){ + public void setUp(String name, Class cls) { this.context = new ClassPathXmlApplicationContext(name, cls); this.outboundGateway = this.context.getBean("storedProcedureOutboundGateway", EventDrivenConsumer.class); } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreMultipleChannelTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreMultipleChannelTests.java index e1b46d3454..46eeff62dc 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreMultipleChannelTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreMultipleChannelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -59,7 +59,7 @@ import org.springframework.transaction.support.TransactionTemplate; */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) @Ignore public class MySqlJdbcMessageStoreMultipleChannelTests { diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/TestService.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/TestService.java index 114ef1b009..80fb1cede9 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/TestService.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/TestService.java @@ -67,7 +67,7 @@ public class TestService { seen.put(message, message); log.info("Pre: " + message); - if (this.threadSleep >0) { + if (this.threadSleep > 0) { try { Thread.sleep(2000); } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/storedproc/ProcedureParameterTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/storedproc/ProcedureParameterTests.java index 21946dd871..0436120f68 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/storedproc/ProcedureParameterTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/storedproc/ProcedureParameterTests.java @@ -34,7 +34,7 @@ public class ProcedureParameterTests { try { new ProcedureParameter(null, "value", "expression"); } - catch(IllegalArgumentException e) { + catch (IllegalArgumentException e) { assertEquals("'name' must not be empty.", e.getMessage()); return; } @@ -70,7 +70,7 @@ public class ProcedureParameterTests { try { ProcedureParameter.convertStaticParameters(procedureParameters); } - catch(IllegalArgumentException e) { + catch (IllegalArgumentException e) { assertEquals("'procedureParameters' must not contain null values.", e.getMessage()); return; } @@ -88,7 +88,7 @@ public class ProcedureParameterTests { try { ProcedureParameter.convertExpressions(procedureParameters); } - catch(IllegalArgumentException e) { + catch (IllegalArgumentException e) { assertEquals("'procedureParameters' must not contain null values.", e.getMessage()); return; } diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/DynamicJmsTemplate.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/DynamicJmsTemplate.java index 25fde9075d..8b5251744f 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/DynamicJmsTemplate.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/DynamicJmsTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -31,7 +31,7 @@ public class DynamicJmsTemplate extends JmsTemplate { if (priority == null) { return super.getPriority(); } - Assert.isTrue(priority >=0 && priority <= 9, "JMS priority must be in the range of 0-9"); + Assert.isTrue(priority >= 0 && priority <= 9, "JMS priority must be in the range of 0-9"); return priority.intValue(); } diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java index bf67c58b81..3aa2ec49af 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java @@ -725,7 +725,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp } else { if (this.idleReplyContainerTimeout > 0) { - synchronized(this.lifeCycleMonitor) { + synchronized (this.lifeCycleMonitor) { this.lastSend = System.currentTimeMillis(); if (!this.replyContainer.isRunning()) { if (logger.isDebugEnabled()) { @@ -775,7 +775,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp // do not propagate back the gateway's internal correlation id jmsReplyHeaders.remove(this.correlationKey); } - if (result instanceof Message){ + if (result instanceof Message) { return getMessageBuilderFactory().fromMessage((Message) result).copyHeaders(jmsReplyHeaders); } else { @@ -977,7 +977,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp */ private javax.jms.Message retryableReceiveReply(Session session, Destination replyTo, String messageSelector) throws JMSException { - Connection consumerConnection = null;//NOSONAR + Connection consumerConnection = null; //NOSONAR Session consumerSession = session; MessageConsumer messageConsumer = null; JMSException exception = null; @@ -1396,7 +1396,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp if (this.replyDestination instanceof TemporaryQueue) { return "Temporary queue:" + this.replyDestination.toString(); } - else if (super.getDestination() != null){ + else if (super.getDestination() != null) { try { return super.getDestinationDescription(); } @@ -1473,7 +1473,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp @Override public void run() { - synchronized(JmsOutboundGateway.this.lifeCycleMonitor) { + synchronized (JmsOutboundGateway.this.lifeCycleMonitor) { if (System.currentTimeMillis() - JmsOutboundGateway.this.lastSend > JmsOutboundGateway.this.idleReplyContainerTimeout && JmsOutboundGateway.this.replies.size() == 0) { diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java index 7117c8889b..a2bf2289b4 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java @@ -84,7 +84,7 @@ public class SubscribableJmsChannel extends AbstractJmsChannel implements Subscr @Override public void onInit() throws Exception { - if (this.initialized){ + if (this.initialized) { return; } super.onInit(); @@ -92,7 +92,7 @@ public class SubscribableJmsChannel extends AbstractJmsChannel implements Subscr this.configureDispatcher(isPubSub); MessageListener listener = new DispatchingMessageListener( this.getJmsTemplate(), this.dispatcher, - this, isPubSub,this.getMessageBuilderFactory()); + this, isPubSub, this.getMessageBuilderFactory()); this.container.setMessageListener(listener); if (!this.container.isActive()) { this.container.afterPropertiesSet(); diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java index c955b321a5..ee0365239f 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -458,15 +458,15 @@ public class JmsChannelFactoryBean extends AbstractFactoryBean message = MessageBuilder.withPayload("test") .setHeader(JmsHeaders.REPLY_TO, replyTo).build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); @@ -172,7 +172,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testUserDefinedPropertyWithUnsupportedType() throws JMSException { - Destination destination = new Destination() {}; + Destination destination = new Destination() { }; Message message = MessageBuilder.withPayload("test") .setHeader("destination", destination) .build(); @@ -185,7 +185,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testJmsReplyToMappedToHeader() throws JMSException { - Destination replyTo = new Destination() {}; + Destination replyTo = new Destination() { }; javax.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSReplyTo(replyTo); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsInboundChannelAdapterTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsInboundChannelAdapterTests.java index 43ad07a997..0f728727ba 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsInboundChannelAdapterTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsInboundChannelAdapterTests.java @@ -39,7 +39,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @since 4.0 * */ -@ContextConfiguration(classes=CFConfig.class) +@ContextConfiguration(classes = CFConfig.class) @RunWith(SpringJUnit4ClassRunner.class) @DirtiesContext public class JmsInboundChannelAdapterTests extends ActiveMQMultiContextTests { diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundChannelAdapterTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundChannelAdapterTests.java index f3e227521f..c7ccb87f96 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundChannelAdapterTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundChannelAdapterTests.java @@ -40,7 +40,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @since 4.0 * */ -@ContextConfiguration(classes=CFConfig.class) +@ContextConfiguration(classes = CFConfig.class) @RunWith(SpringJUnit4ClassRunner.class) @DirtiesContext public class JmsOutboundChannelAdapterTests extends ActiveMQMultiContextTests { diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundInsideChainTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundInsideChainTests.java index 75f7a40643..c66fb6f1a1 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundInsideChainTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundInsideChainTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -53,7 +53,7 @@ public class JmsOutboundInsideChainTests { private PollableChannel repliesChannel; @Test - public void testJmsOutboundChannelInsideChain(){ + public void testJmsOutboundChannelInsideChain() { String testString = "test"; Message shippedMessage = MessageBuilder.withPayload(testString).build(); this.outboundChainChannel.send(shippedMessage); @@ -62,7 +62,7 @@ public class JmsOutboundInsideChainTests { } @Test - public void testJmsOutboundGatewayRequiresReply(){ + public void testJmsOutboundGatewayRequiresReply() { this.outboundGatewayChainChannel.send(MessageBuilder.withPayload("test").build()); assertNotNull(this.repliesChannel.receive(2000)); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java index 280164c006..939c54a749 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java @@ -266,7 +266,7 @@ public class PollableJmsChannelTests { private final boolean preReceiveFlag; - public SampleInterceptor(boolean preReceiveFlag){ + public SampleInterceptor(boolean preReceiveFlag) { this.preReceiveFlag = preReceiveFlag; } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java index 6a81b469d0..029c3af4a3 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java @@ -34,6 +34,7 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; + import javax.jms.Destination; import javax.jms.MessageListener; @@ -353,7 +354,8 @@ public class SubscribableJmsChannelTests { logList.add(message); } return null; - }}).when(logger).warn(anyString(), any(Exception.class)); + } + }).when(logger).warn(anyString(), any(Exception.class)); when(logger.isWarnEnabled()).thenReturn(true); Object listener = container.getMessageListener(); DirectFieldAccessor dfa = new DirectFieldAccessor(listener); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ActiveMqTestUtils.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ActiveMqTestUtils.java index bbfa845ad5..8403b85232 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ActiveMqTestUtils.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ActiveMqTestUtils.java @@ -44,10 +44,10 @@ public class ActiveMqTestUtils { } private static void deleteDir(File directory) { - if (directory.exists()){ + if (directory.exists()) { String[] children = directory.list(); - if (children != null){ - for (int i=0; i < children.length; i++) { + if (children != null) { + for (int i = 0; i < children.length; i++) { deleteDir(new File(directory, children[i])); } } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java index 06254740bf..ddd917e87f 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java @@ -83,7 +83,7 @@ public class ExceptionHandlingSiConsumerTests { } @Test - public void nonSiProducer_siConsumer_sync_withOutboundGateway() throws Exception{ + public void nonSiProducer_siConsumer_sync_withOutboundGateway() throws Exception { ActiveMqTestUtils.prepare(); final ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("Exception-nonSiProducer-siConsumer.xml", ExceptionHandlingSiConsumerTests.class); SampleGateway gateway = applicationContext.getBean("sampleGateway", SampleGateway.class); @@ -99,7 +99,7 @@ public class ExceptionHandlingSiConsumerTests { throw new SampleException("echoWithException"); } - public String echo(String value){ + public String echo(String value) { return value; } } @@ -107,7 +107,7 @@ public class ExceptionHandlingSiConsumerTests { @SuppressWarnings("serial") public static class SampleException extends RuntimeException { - public SampleException(String message){ + public SampleException(String message) { super(message); } } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java index 7f6bfc3386..80cfd49971 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java @@ -47,7 +47,7 @@ public class JmsChannelHistoryTests { @SuppressWarnings("rawtypes") @Test - public void testMessageHistory() throws Exception{ + public void testMessageHistory() throws Exception { AbstractMessageListenerContainer mlContainer = mock(AbstractMessageListenerContainer.class); JmsTemplate template = mock(JmsTemplate.class); SubscribableJmsChannel channel = new SubscribableJmsChannel(mlContainer, template); @@ -56,20 +56,21 @@ public class JmsChannelHistoryTests { Message message = new GenericMessage("hello"); doAnswer(new Answer() { - @SuppressWarnings("unchecked") + @Override + @SuppressWarnings("unchecked") public Object answer(InvocationOnMock invocation) { - Message msg = (Message) invocation.getArguments()[0]; - MessageHistory history = MessageHistory.read(msg); - assertTrue(history.get(0).contains("jmsChannel")); - return null; - }}) - .when(template).convertAndSend(Mockito.any(Message.class)); + Message msg = (Message) invocation.getArguments()[0]; + MessageHistory history = MessageHistory.read(msg); + assertTrue(history.get(0).contains("jmsChannel")); + return null; + } + }).when(template).convertAndSend(Mockito.any(Message.class)); channel.send(message); verify(template, times(1)).convertAndSend(Mockito.any(Message.class)); } @Test - public void testFullConfig() throws Exception{ + public void testFullConfig() throws Exception { ActiveMqTestUtils.prepare(); ApplicationContext ac = new ClassPathXmlApplicationContext("JmsChannelHistoryTests-context.xml", this.getClass()); SubscribableChannel channel = ac.getBean("jmsChannel", SubscribableChannel.class); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsInboundChannelAdapterParserTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsInboundChannelAdapterParserTests.java index a405848ebf..dca37790b4 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsInboundChannelAdapterParserTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -126,7 +126,7 @@ public class JmsInboundChannelAdapterParserTests { context.close(); } - @Test(expected=BeanCreationException.class) + @Test(expected = BeanCreationException.class) public void adapterWithDestinationNameOnly() { new ClassPathXmlApplicationContext("jmsInboundWithDestinationNameOnly.xml", this.getClass()).close(); } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java index aae1f6eeee..0ff491a846 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java @@ -46,7 +46,7 @@ import org.springframework.messaging.PollableChannel; public class JmsMessageHistoryTests { @Test - public void testInboundAdapter() throws Exception{ + public void testInboundAdapter() throws Exception { ActiveMqTestUtils.prepare(); ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("MessageHistoryTests-context.xml", JmsMessageHistoryTests.class); SampleGateway gateway = applicationContext.getBean("sampleGateway", SampleGateway.class); @@ -118,13 +118,13 @@ public class JmsMessageHistoryTests { } - public static class SampleComponent implements NamedComponent{ + public static class SampleComponent implements NamedComponent { private String name; private String type; - public SampleComponent(String name, String type){ + public SampleComponent(String name, String type) { this.name = name; this.type = type; } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java index c9f0b8cd37..fa9cf06a46 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java @@ -77,14 +77,14 @@ public class JmsOutboundGatewayParserTests { private static volatile int adviceCalled; @Test - public void testWithDeliveryPersistentAttribute(){ + public void testWithDeliveryPersistentAttribute() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "jmsOutboundGatewayWithDeliveryPersistent.xml", this.getClass()); EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("jmsGateway"); DirectFieldAccessor accessor = new DirectFieldAccessor(endpoint); JmsOutboundGateway gateway = (JmsOutboundGateway) accessor.getPropertyValue("handler"); accessor = new DirectFieldAccessor(gateway); - int deliveryMode = (Integer)accessor.getPropertyValue("deliveryMode"); + int deliveryMode = (Integer) accessor.getPropertyValue("deliveryMode"); assertEquals(DeliveryMode.PERSISTENT, deliveryMode); assertTrue(TestUtils.getPropertyValue(gateway, "async", Boolean.class)); DefaultMessageListenerContainer container = TestUtils.getPropertyValue(gateway, "replyContainer", @@ -112,7 +112,7 @@ public class JmsOutboundGatewayParserTests { } @Test - public void testAdvised(){ + public void testAdvised() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "jmsOutboundGatewayWithDeliveryPersistent.xml", this.getClass()); EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("advised"); @@ -125,14 +125,14 @@ public class JmsOutboundGatewayParserTests { } @Test - public void testDefault(){ + public void testDefault() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "jmsOutboundGatewayWithConverter.xml", this.getClass()); PollingConsumer endpoint = (PollingConsumer) context.getBean("jmsGateway"); DirectFieldAccessor accessor = new DirectFieldAccessor(endpoint); JmsOutboundGateway gateway = (JmsOutboundGateway) accessor.getPropertyValue("handler"); accessor = new DirectFieldAccessor(gateway); - MessageConverter converter = (MessageConverter)accessor.getPropertyValue("messageConverter"); + MessageConverter converter = (MessageConverter) accessor.getPropertyValue("messageConverter"); assertTrue("Wrong message converter", converter instanceof StubMessageConverter); context.close(); } @@ -245,7 +245,7 @@ public class JmsOutboundGatewayParserTests { assertNotNull(componentHistoryRecord); assertEquals("jms:inbound-gateway", componentHistoryRecord.get("type")); MessagingTemplate messagingTemplate = new MessagingTemplate(); - messagingTemplate.setDefaultDestination((MessageChannel)message.getHeaders().getReplyChannel()); + messagingTemplate.setDefaultDestination((MessageChannel) message.getHeaders().getReplyChannel()); messagingTemplate.send(message); } }; @@ -288,15 +288,15 @@ public class JmsOutboundGatewayParserTests { } - public interface SampleGateway{ + public interface SampleGateway { String echo(String value); } - public static class SampleService{ + public static class SampleService { - public String echo(String value){ + public String echo(String value) { return value.toUpperCase(); } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsWithMarshallingMessageConverterTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsWithMarshallingMessageConverterTests.java index 934497831a..cdc7e9526c 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsWithMarshallingMessageConverterTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsWithMarshallingMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -76,12 +76,12 @@ public class JmsWithMarshallingMessageConverterTests { public void marshal(Object graph, Result result) throws IOException, XmlMappingException { String payload = null; if (graph instanceof Message) { - payload = (String) ((Message)graph).getPayload(); + payload = (String) ((Message) graph).getPayload(); } else { payload = (String) graph; } - ((StreamResult)result).getOutputStream().write(payload.getBytes()); + ((StreamResult) result).getOutputStream().write(payload.getBytes()); } public boolean supports(Class clazz) { @@ -97,7 +97,7 @@ public class JmsWithMarshallingMessageConverterTests { } public Object unmarshal(Source source) throws IOException, XmlMappingException { - InputStream io = ((StreamSource)source).getInputStream(); + InputStream io = ((StreamSource) source).getInputStream(); byte[] bytes = new byte[io.available()]; io.read(bytes); return new GenericMessage(new String(bytes)); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/MiscellaneousTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/MiscellaneousTests.java index 6eea7038dc..6eee25ab41 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/MiscellaneousTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/MiscellaneousTests.java @@ -46,7 +46,7 @@ public class MiscellaneousTests { * when requests are queued up (e.g., single consumer receiver) */ @Test - public void testTimeoutHonoringWhenRequestsQueuedUp() throws Exception{ + public void testTimeoutHonoringWhenRequestsQueuedUp() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("honor-timeout.xml", this.getClass()); final RequestReplyExchanger gateway = context.getBean(RequestReplyExchanger.class); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/PipelineJmsTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/PipelineJmsTests.java index 4528a43ff1..30a7e00ad5 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/PipelineJmsTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/PipelineJmsTests.java @@ -66,7 +66,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline1() throws Exception{ + public void testPipeline1() throws Exception { this.test("pipeline-01.xml"); } @@ -76,7 +76,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline2() throws Exception{ + public void testPipeline2() throws Exception { this.test("pipeline-02.xml"); } @@ -86,7 +86,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline3() throws Exception{ + public void testPipeline3() throws Exception { this.test("pipeline-03.xml"); } @@ -96,7 +96,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline4() throws Exception{ + public void testPipeline4() throws Exception { this.test("pipeline-04.xml"); } @@ -106,7 +106,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline5() throws Exception{ + public void testPipeline5() throws Exception { this.test("pipeline-05.xml"); } @@ -116,7 +116,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline6() throws Exception{ + public void testPipeline6() throws Exception { this.test("pipeline-06.xml"); } @@ -126,7 +126,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline7() throws Exception{ + public void testPipeline7() throws Exception { this.test("pipeline-07.xml"); } @@ -136,7 +136,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline8() throws Exception{ + public void testPipeline8() throws Exception { this.test("pipeline-08.xml"); } @@ -146,7 +146,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests { * All reply queues are TEMPORARY */ @Test - public void testPipeline9() throws Exception{ + public void testPipeline9() throws Exception { this.test("pipeline-09.xml"); } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/PipelineNamedReplyQueuesJmsTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/PipelineNamedReplyQueuesJmsTests.java index f5166b4a5c..c72dab9743 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/PipelineNamedReplyQueuesJmsTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/PipelineNamedReplyQueuesJmsTests.java @@ -70,7 +70,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * jms:out -> jms:in */ @Test - public void testPipeline1() throws Exception{ + public void testPipeline1() throws Exception { this.test("pipeline-named-queue-01.xml"); } @@ -80,7 +80,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * jms:out(reply-destination-name="pipeline02-03") -> jms:in */ @Test - public void testPipeline2() throws Exception{ + public void testPipeline2() throws Exception { this.test("pipeline-named-queue-02.xml"); } @@ -92,7 +92,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * jms:out(reply-destination-name="pipeline02a-01") -> jms:in */ @Test - public void testPipeline2a() throws Exception{ + public void testPipeline2a() throws Exception { int timeouts = this.test("pipeline-named-queue-02a.xml"); assertEquals(0, timeouts); } @@ -103,7 +103,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * jms:out(reply-destination-name="pipeline03-03") -> jms:in */ @Test - public void testPipeline3() throws Exception{ + public void testPipeline3() throws Exception { this.test("pipeline-named-queue-03.xml"); } @@ -116,7 +116,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * Ensures reply came from service after third gateway */ @Test - public void testPipeline3a() throws Exception{ + public void testPipeline3a() throws Exception { int timeouts = this.test("pipeline-named-queue-03a.xml", 50000); assertEquals(0, timeouts); } @@ -126,7 +126,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * jms:out(reply-destination-name="pipeline04-02") -> jms:in */ @Test - public void testPipeline4() throws Exception{ + public void testPipeline4() throws Exception { int timeouts = this.test("pipeline-named-queue-04.xml", 30000); assertEquals(0, timeouts); } @@ -136,7 +136,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * jms:out(reply-destination-name="pipeline05-02", correlation-key="JMSCorrelationID") -> jms:in */ @Test - public void testPipeline5() throws Exception{ + public void testPipeline5() throws Exception { this.test("pipeline-named-queue-05.xml"); } @@ -145,7 +145,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * jms:out(reply-destination-name="pipeline06-02", correlation-key="foo") -> jms:in(correlation-key="foo") */ @Test - public void testPipeline6() throws Exception{ + public void testPipeline6() throws Exception { this.test("pipeline-named-queue-06.xml"); } @@ -154,7 +154,7 @@ public class PipelineNamedReplyQueuesJmsTests extends ActiveMQMultiContextTests * jms:out(reply-destination-name="pipeline07-02", correlation-key="foo") -> jms:in(correlation-key="foo") */ @Test - public void testPipeline7() throws Exception{ + public void testPipeline7() throws Exception { this.test("pipeline-named-queue-07.xml"); } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java index 3f51c921dc..2fc59db682 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java @@ -58,8 +58,8 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti @Rule public LongRunningIntegrationTest longTests = new LongRunningIntegrationTest(); - @Test(expected=MessageTimeoutException.class) - public void messageCorrelationBasedOnRequestMessageIdOptimized() throws Exception{ + @Test(expected = MessageTimeoutException.class) + public void messageCorrelationBasedOnRequestMessageIdOptimized() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("producer-cached-consumers.xml", this.getClass()); @@ -95,7 +95,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti } @Test - public void messageCorrelationBasedOnRequestMessageIdNonOptimized() throws Exception{ + public void messageCorrelationBasedOnRequestMessageIdNonOptimized() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("producer-cached-consumers.xml", this.getClass()); @@ -131,7 +131,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti } @Test - public void messageCorrelationBasedOnRequestCorrelationIdOptimized() throws Exception{ + public void messageCorrelationBasedOnRequestCorrelationIdOptimized() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("producer-cached-consumers.xml", this.getClass()); try { @@ -165,8 +165,8 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti } } - @Test(expected=MessageTimeoutException.class) - public void messageCorrelationBasedOnRequestCorrelationIdNonOptimized() throws Exception{ + @Test(expected = MessageTimeoutException.class) + public void messageCorrelationBasedOnRequestCorrelationIdNonOptimized() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("producer-cached-consumers.xml", this.getClass()); try { @@ -201,7 +201,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti } @Test - public void messageCorrelationBasedOnRequestCorrelationIdTimedOutFirstReplyOptimized() throws Exception{ + public void messageCorrelationBasedOnRequestCorrelationIdTimedOutFirstReplyOptimized() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("producer-cached-consumers.xml", this.getClass()); @@ -217,7 +217,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti try { gateway.exchange(gateway.exchange(new GenericMessage("foo"))); } - catch (Exception e) {/*ignore*/} + catch (Exception e) { /*ignore*/ } } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCorrelationKeyProvidedTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCorrelationKeyProvidedTests.java index f0d99e2b59..b9d9e8902f 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCorrelationKeyProvidedTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCorrelationKeyProvidedTests.java @@ -44,7 +44,7 @@ public class RequestReplyScenariosWithCorrelationKeyProvidedTests extends Active public LongRunningIntegrationTest longTests = new LongRunningIntegrationTest(); @Test - public void messageCorrelationBasedCustomCorrelationKey() throws Exception{ + public void messageCorrelationBasedCustomCorrelationKey() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("explicit-correlation-key.xml", this.getClass()); @@ -55,7 +55,7 @@ public class RequestReplyScenariosWithCorrelationKeyProvidedTests extends Active } @Test - public void messageCorrelationBasedCustomCorrelationKeyAsJMSCorrelationID() throws Exception{ + public void messageCorrelationBasedCustomCorrelationKeyAsJMSCorrelationID() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("explicit-correlation-key.xml", this.getClass()); @@ -66,7 +66,7 @@ public class RequestReplyScenariosWithCorrelationKeyProvidedTests extends Active } @Test - public void messageCorrelationBasedOnProvidedJMSCorrelationID() throws Exception{ + public void messageCorrelationBasedOnProvidedJMSCorrelationID() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("explicit-correlation-key.xml", this.getClass()); @@ -81,7 +81,7 @@ public class RequestReplyScenariosWithCorrelationKeyProvidedTests extends Active } @Test - public void messageCorrelationBasedCustomCorrelationKeyDelayedReplies() throws Exception{ + public void messageCorrelationBasedCustomCorrelationKeyDelayedReplies() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("explicit-correlation-key.xml", this.getClass()); @@ -105,7 +105,7 @@ public class RequestReplyScenariosWithCorrelationKeyProvidedTests extends Active public static class DelayedService { - public String echo(String s) throws Exception{ + public String echo(String s) throws Exception { Thread.sleep(200); return s; } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java index ae92c24740..76f69e4959 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java @@ -47,8 +47,8 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu @Rule public LongRunningIntegrationTest longTests = new LongRunningIntegrationTest(); - @Test(expected=MessageTimeoutException.class) - public void messageCorrelationBasedOnRequestMessageIdOptimized() throws Exception{ + @Test(expected = MessageTimeoutException.class) + public void messageCorrelationBasedOnRequestMessageIdOptimized() throws Exception { ActiveMqTestUtils.prepare(); AbstractApplicationContext context = new ClassPathXmlApplicationContext("producer-no-cached-consumers.xml", this.getClass()); try { @@ -82,7 +82,7 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu } @Test - public void messageCorrelationBasedOnRequestMessageIdNonOptimized() throws Exception{ + public void messageCorrelationBasedOnRequestMessageIdNonOptimized() throws Exception { ActiveMqTestUtils.prepare(); AbstractApplicationContext context = new ClassPathXmlApplicationContext("producer-no-cached-consumers.xml", this.getClass()); try { @@ -115,7 +115,7 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu } @Test - public void messageCorrelationBasedOnRequestCorrelationIdOptimized() throws Exception{ + public void messageCorrelationBasedOnRequestCorrelationIdOptimized() throws Exception { ActiveMqTestUtils.prepare(); AbstractApplicationContext context = new ClassPathXmlApplicationContext("producer-no-cached-consumers.xml", this.getClass()); try { @@ -148,8 +148,8 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu } } - @Test(expected=MessageTimeoutException.class) - public void messageCorrelationBasedOnRequestCorrelationIdNonOptimized() throws Exception{ + @Test(expected = MessageTimeoutException.class) + public void messageCorrelationBasedOnRequestCorrelationIdNonOptimized() throws Exception { ActiveMqTestUtils.prepare(); AbstractApplicationContext context = new ClassPathXmlApplicationContext("producer-no-cached-consumers.xml", this.getClass()); try { diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java index 85126365be..fee610f5af 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java @@ -66,7 +66,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti public LongRunningIntegrationTest longTests = new LongRunningIntegrationTest(); @Test - public void messageCorrelationBasedOnRequestMessageId() throws Exception{ + public void messageCorrelationBasedOnRequestMessageId() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("producer-temp-reply-consumers.xml", this.getClass()); @@ -109,7 +109,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti } @Test - public void messageCorrelationBasedOnRequestCorrelationIdTimedOutFirstReply() throws Exception{ + public void messageCorrelationBasedOnRequestCorrelationIdTimedOutFirstReply() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("producer-temp-reply-consumers.xml", this.getClass()); @@ -132,11 +132,11 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti fail(); } String requestPayload = (String) extractPayload(message); - if (requestPayload.equals("foo")){ + if (requestPayload.equals("foo")) { try { Thread.sleep(6000); } - catch (Exception e) {/*ignore*/} + catch (Exception e) { /*ignore*/ } } try { TextMessage replyMessage = session.createTextMessage(); @@ -175,7 +175,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti * once a failure detected and that the messages will still be properly correlated */ @Test - public void brokenBrokerTest() throws Exception{ + public void brokenBrokerTest() throws Exception { BrokerService broker = new BrokerService(); broker.setPersistent(false); @@ -193,15 +193,15 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti int timeoutCounter = 0; for (int i = 0; i < 50; i++) { try { - assertEquals(i+"", gateway.exchange(new GenericMessage(String.valueOf(i))).getPayload()); + assertEquals(i + "", gateway.exchange(new GenericMessage(String.valueOf(i))).getPayload()); replyCounter++; } catch (Exception e) { timeoutCounter++; } - if (i == 0 || i == 20 || i == 40){ + if (i == 0 || i == 20 || i == 40) { Object replyDestination = TestUtils.getPropertyValue(context.getBean("jog"), "handler.replyDestination"); - if (replyDestination != null){ + if (replyDestination != null) { broker.removeDestination((ActiveMQDestination) replyDestination); } } @@ -210,7 +210,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti } @Test - public void testConcurrently() throws Exception{ + public void testConcurrently() throws Exception { ActiveMqTestUtils.prepare(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("mult-producer-and-consumers-temp-reply.xml", this.getClass()); @@ -228,7 +228,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti try { String reply = (String) gateway.exchange(new GenericMessage(String.valueOf(y))).getPayload(); - if (!String.valueOf(y).equals(reply)){ + if (!String.valueOf(y).equals(reply)) { missmatches.incrementAndGet(); } } @@ -258,7 +258,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti assertEquals(0, timeouts.get()); } - private void print(AtomicInteger failures, AtomicInteger timeouts, AtomicInteger missmatches, long echangesProcessed){ + private void print(AtomicInteger failures, AtomicInteger timeouts, AtomicInteger missmatches, long echangesProcessed) { System.out.println("============================"); System.out.println(echangesProcessed + " exchanges processed"); System.out.println("Failures: " + failures.get()); @@ -267,10 +267,10 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti System.out.println("============================"); } - public static class MyRandomlySlowService{ + public static class MyRandomlySlowService { Random random = new Random(); List list = new ArrayList(); - public String secho(String value) throws Exception{ + public String secho(String value) throws Exception { int i = random.nextInt(2000); // if (i >= 2000){ // System.out.println("SLEEPIING: " + i); diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/OperationInvokingMessageHandler.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/OperationInvokingMessageHandler.java index f6769b0ee2..822581d667 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/OperationInvokingMessageHandler.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/OperationInvokingMessageHandler.java @@ -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. @@ -190,7 +190,7 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa */ private ObjectName resolveObjectName(Message message) { ObjectName objectName = this.objectName; - if (objectName == null){ + if (objectName == null) { Object objectNameHeader = message.getHeaders().get(JmxHeaders.OBJECT_NAME); if (objectNameHeader instanceof ObjectName) { objectName = (ObjectName) objectNameHeader; @@ -213,7 +213,7 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa */ private String resolveOperationName(Message message) { String operationName = this.operationName; - if (operationName == null){ + if (operationName == null) { operationName = message.getHeaders().get(JmxHeaders.OPERATION_NAME, String.class); } Assert.notNull(operationName, "Failed to resolve operation name."); diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java index ac947a28d9..660657d0d9 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java @@ -73,7 +73,7 @@ public class IntegrationMBeanExportConfiguration implements ImportAware, Environ private Environment environment; - @Autowired(required=false) + @Autowired(required = false) @Qualifier(IntegrationManagementConfigurer.MANAGEMENT_CONFIGURER_NAME) private IntegrationManagementConfigurer configurer; diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java b/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java index 5643ab13dc..d903d192e8 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java @@ -737,7 +737,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati } if (endpointNames.contains(name)) { int count = 0; - String unique = name+"#"+count; + String unique = name + "#" + count; while (endpointNames.contains(unique)) { unique = name + "#" + (++count); } @@ -787,7 +787,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati } } } - return null;//NOSONAR - intentional null return + return null; //NOSONAR - intentional null return } private Object extractTarget(Object bean) { diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/OperationInvokingMessageHandlerTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/OperationInvokingMessageHandlerTests.java index 09f918b607..1fb65eb242 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/OperationInvokingMessageHandlerTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/OperationInvokingMessageHandlerTests.java @@ -104,7 +104,7 @@ public class OperationInvokingMessageHandlerTests { handler.handleMessage(message); } - @Test(expected=MessagingException.class) + @Test(expected = MessagingException.class) public void invocationWithMapPayloadNotEnoughParameters() throws Exception { QueueChannel outputChannel = new QueueChannel(); OperationInvokingMessageHandler handler = new OperationInvokingMessageHandler(); @@ -164,7 +164,7 @@ public class OperationInvokingMessageHandlerTests { } @Override - public void y(String s){} + public void y(String s) { } } } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/CustomObjectNameTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/CustomObjectNameTests.java index 4ac4d86761..bb7ee3ff57 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/CustomObjectNameTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/CustomObjectNameTests.java @@ -103,7 +103,7 @@ public class CustomObjectNameTests { assertTrue(AopUtils.isJdkDynamicProxy(this.customHandler)); } - @IntegrationManagedResource(objectName="${customChannelName}", description="custom channel") + @IntegrationManagedResource(objectName = "${customChannelName}", description = "custom channel") public static class ChannelWithCustomObjectName extends AbstractMessageChannel { @Override @@ -113,9 +113,9 @@ public class CustomObjectNameTests { } - @IntegrationManagedResource(objectName="${customHandlerName}", description="custom handler", - currencyTimeLimit=1000, log=true, logFile="foo", persistLocation="bar", persistName="baz", persistPeriod=10, - persistPolicy="Never") + @IntegrationManagedResource(objectName = "${customHandlerName}", description = "custom handler", + currencyTimeLimit = 1000, log = true, logFile = "foo", persistLocation = "bar", persistName = "baz", persistPeriod = 10, + persistPolicy = "Never") @Transactional public static class HandlerWithCustomObjectName extends AbstractMessageHandler { diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanRegistrationTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanRegistrationTests.java index 585227a86e..b73bdd7cf4 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanRegistrationTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanRegistrationTests.java @@ -75,7 +75,7 @@ public class MBeanRegistrationTests { public void testServiceActivatorMBeanHasTrackableComponent() throws Exception { System.err.println(server.queryNames(new ObjectName("test.MBeanRegistration:*"), null)); Set names = server.queryNames(new ObjectName("test.MBeanRegistration:type=ServiceActivatingHandler,name=service,*"), null); - Map infos = new HashMap(); + Map infos = new HashMap(); for (MBeanOperationInfo info : server.getMBeanInfo(names.iterator().next()).getOperations()) { infos.put(info.getName(), info); } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/NotificationPublishingChannelAdapterParserTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/NotificationPublishingChannelAdapterParserTests.java index e5c5d82215..fd914c10c9 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/NotificationPublishingChannelAdapterParserTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/NotificationPublishingChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -148,7 +148,7 @@ public class NotificationPublishingChannelAdapterParserTests { for (ObjectInstance mbean : mbeans) { if (mbean.toString().contains("MessageHistoryConfigurer")) { ObjectName objectName = mbean.getObjectName(); - try{ + try { server.setAttribute(objectName, new Attribute("ComponentNamePatternsString", "foo, bar")); fail("Exception expected"); } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/OperationInvokingChannelAdapterParserTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/OperationInvokingChannelAdapterParserTests.java index da57aca855..21d22c711e 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/OperationInvokingChannelAdapterParserTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/OperationInvokingChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -121,7 +121,7 @@ public class OperationInvokingChannelAdapterParserTests { } } - private Message createMessage(String payload){ + private Message createMessage(String payload) { return MessageBuilder.withPayload(payload) .setHeader(JmxHeaders.OBJECT_NAME, "org.springframework.integration.jmx.config:type=TestBean,name=foo") .setHeader(JmxHeaders.OPERATION_NAME, "blah").build(); diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/SimpleDynamicRouter.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/SimpleDynamicRouter.java index c685046cdf..dd8889c5f7 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/SimpleDynamicRouter.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/SimpleDynamicRouter.java @@ -32,13 +32,13 @@ import org.springframework.util.Assert; * */ @ManagedResource -public class SimpleDynamicRouter{ +public class SimpleDynamicRouter { private final Map channelMappings = new HashMap(); /** * * @param channelMappings */ - public SimpleDynamicRouter(Map channelMappings){ + public SimpleDynamicRouter(Map channelMappings) { Assert.notEmpty(channelMappings, "you must provide at least one channel mappings"); for (String key : channelMappings.keySet()) { this.channelMappings.put(key, channelMappings.get(key)); @@ -50,27 +50,27 @@ public class SimpleDynamicRouter{ * @param channelName */ @ManagedOperation - public void addChannelMapping(String key, String channelName){ + public void addChannelMapping(String key, String channelName) { this.channelMappings.put(key, channelName); } /** * * @param key */ - public void removeChannelMapping(String key){ + public void removeChannelMapping(String key) { this.channelMappings.remove(key); } /** * */ - public Map getChannelMappings(){ + public Map getChannelMappings() { return channelMappings; } /** * * @param key */ - public String route(Object key){ + public String route(Object key) { String className = key.getClass().getName(); return this.channelMappings.get(className); } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/ChainWithMessageProducingHandlersTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/ChainWithMessageProducingHandlersTests.java index cf779348a9..9748febb75 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/ChainWithMessageProducingHandlersTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/ChainWithMessageProducingHandlersTests.java @@ -42,17 +42,17 @@ public class ChainWithMessageProducingHandlersTests { private ApplicationContext applicationContext; @Test - public void testSuccessfulApplicationContext(){ + public void testSuccessfulApplicationContext() { // this is all we need to do. Until INT-1431 was solved initialization of this AC would fail. assertNotNull(applicationContext); } - public static class SampleProducer{ - public String echo(String value){ + public static class SampleProducer { + public String echo(String value) { return value; } } - public static class SampleService{ - public void echo(String value){} + public static class SampleService { + public void echo(String value) { } } } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/HandlerMonitoringIntegrationTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/HandlerMonitoringIntegrationTests.java index 47eab1cd33..37b243cdfe 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/HandlerMonitoringIntegrationTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/HandlerMonitoringIntegrationTests.java @@ -127,7 +127,7 @@ public class HandlerMonitoringIntegrationTests { public static class HandlerInterceptor { @Before("execution(* *..*Tests*(String)) && args(input)") public void around(String input) { - logger.debug("Handling: "+input); + logger.debug("Handling: " + input); } } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MBeanExporterIntegrationTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MBeanExporterIntegrationTests.java index 717fb3fd8f..6912f084c6 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MBeanExporterIntegrationTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MBeanExporterIntegrationTests.java @@ -64,7 +64,7 @@ public class MBeanExporterIntegrationTests { @After public void close() { - if (context!=null) { + if (context != null) { context.close(); } } @@ -378,7 +378,7 @@ public class MBeanExporterIntegrationTests { public String execute() throws Exception { Thread.sleep(10L); // make the duration non-zero counter++; - return "count="+counter; + return "count=" + counter; } @Override diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceMonitoringIntegrationTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceMonitoringIntegrationTests.java index 3132e74c58..bed1e8e376 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceMonitoringIntegrationTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceMonitoringIntegrationTests.java @@ -90,7 +90,7 @@ public class MessageSourceMonitoringIntegrationTests { public String execute() throws Exception { Thread.sleep(10L); // make the duration non-zero counter++; - return "count="+counter; + return "count=" + counter; } public int getCounter() { diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration_/mbeanexporterhelper/INT_2626Tests.java b/spring-integration-jmx/src/test/java/org/springframework/integration_/mbeanexporterhelper/INT_2626Tests.java index c5472e4852..b9420c05a7 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration_/mbeanexporterhelper/INT_2626Tests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration_/mbeanexporterhelper/INT_2626Tests.java @@ -28,7 +28,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class INT_2626Tests { @Test // This context failed to load before the INT-2626 fix was applied - public void testInt2626(){ + public void testInt2626() { new ClassPathXmlApplicationContext("INT-2626-config.xml", this.getClass()).close(); } } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/JpaOutboundChannelAdapterParser.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/JpaOutboundChannelAdapterParser.java index 7c4a338b4d..4714d945a8 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/JpaOutboundChannelAdapterParser.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/JpaOutboundChannelAdapterParser.java @@ -79,7 +79,7 @@ public class JpaOutboundChannelAdapterParser extends AbstractOutboundChannelAdap final Element transactionalElement = DomUtils.getChildElementByTagName(element, "transactional"); - if(transactionalElement != null) { + if (transactionalElement != null) { BeanDefinition txAdviceDefinition = IntegrationNamespaceUtils.configureTransactionAttributes(transactionalElement); ManagedList adviceChain = new ManagedList(); diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java index 4ca41cb4ff..8d164f15af 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java @@ -123,10 +123,10 @@ public class DefaultJpaOperations extends AbstractJpaOperations { final String entityName = JpaUtils.getEntityName(entityManager, entityClass); final Query query = entityManager.createQuery("select x from " + entityName + " x", entityClass); - if(firstResult > 0) { + if (firstResult > 0) { query.setFirstResult(firstResult); } - if(maxNumberOfResults > 0) { + if (maxNumberOfResults > 0) { query.setMaxResults(maxNumberOfResults); } @@ -141,10 +141,10 @@ public class DefaultJpaOperations extends AbstractJpaOperations { final Query query = entityManager.createNamedQuery(selectNamedQuery); setParametersIfRequired(selectNamedQuery, parameterSource, query); - if(firstResult > 0) { + if (firstResult > 0) { query.setFirstResult(firstResult); } - if(maxNumberOfResults > 0) { + if (maxNumberOfResults > 0) { query.setMaxResults(maxNumberOfResults); } @@ -167,10 +167,10 @@ public class DefaultJpaOperations extends AbstractJpaOperations { setParametersIfRequired(selectQuery, parameterSource, query); - if(firstResult > 0) { + if (firstResult > 0) { query.setFirstResult(firstResult); } - if(maxNumberOfResults > 0) { + if (maxNumberOfResults > 0) { query.setMaxResults(maxNumberOfResults); } @@ -179,19 +179,19 @@ public class DefaultJpaOperations extends AbstractJpaOperations { @Override public List getResultListForQuery(String query, ParameterSource source) { - return getResultListForQuery(query,source, 0, 0); + return getResultListForQuery(query, source, 0, 0); } @Override public List getResultListForQuery(String queryString, ParameterSource source, int firstResult, int maxNumberOfResults) { - Query query = getQuery(queryString,source); + Query query = getQuery(queryString, source); - if(firstResult > 0) { + if (firstResult > 0) { query.setFirstResult(firstResult); } - if(maxNumberOfResults > 0) { + if (maxNumberOfResults > 0) { query.setMaxResults(maxNumberOfResults); } @@ -200,7 +200,7 @@ public class DefaultJpaOperations extends AbstractJpaOperations { @Override public Object getSingleResultForQuery(String queryString, ParameterSource source) { - Query query = getQuery(queryString,source); + Query query = getQuery(queryString, source); return query.getSingleResult(); } @@ -296,9 +296,9 @@ public class DefaultJpaOperations extends AbstractJpaOperations { private void setParametersIfRequired(String queryString, ParameterSource source, Query query) { Set> parameters = query.getParameters(); - if(parameters != null && !parameters.isEmpty()) { - if(source != null) { - for(Parameter param:parameters) { + if (parameters != null && !parameters.isEmpty()) { + if (source != null) { + for (Parameter param:parameters) { String paramName = param.getName(); Integer position = param.getPosition(); @@ -318,7 +318,7 @@ public class DefaultJpaOperations extends AbstractJpaOperations { } else { - if(StringUtils.hasText(paramName)) { + if (StringUtils.hasText(paramName)) { paramValue = source.getValue(paramName); query.setParameter(paramName, paramValue); } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java index fc35a0e7cb..90895539dd 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java @@ -354,13 +354,13 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { private int evaluateExpressionForNumericResult(final Message requestMessage, Expression expression) { int evaluatedResult = 0; - if(expression != null) { + if (expression != null) { Object evaluationResult = expression.getValue(this.evaluationContext, requestMessage); - if(evaluationResult != null) { - if(evaluationResult instanceof Number) { + if (evaluationResult != null) { + if (evaluationResult instanceof Number) { evaluatedResult = ((Number) evaluationResult).intValue(); } - else if(evaluationResult instanceof String){ + else if (evaluationResult instanceof String) { try { evaluatedResult = Integer.parseInt((String) evaluationResult); } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapter.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapter.java index 4ce3077d5f..2a030a549c 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapter.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapter.java @@ -48,7 +48,7 @@ import org.springframework.util.Assert; * @since 2.2 * */ -public class JpaPollingChannelAdapter extends IntegrationObjectSupport implements MessageSource{ +public class JpaPollingChannelAdapter extends IntegrationObjectSupport implements MessageSource { private final JpaExecutor jpaExecutor; @@ -91,7 +91,7 @@ public class JpaPollingChannelAdapter extends IntegrationObjectSupport implement } @Override - public String getComponentType(){ + public String getComponentType() { return "jpa:inbound-channel-adapter"; } diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/config/xml/JpaInboundChannelAdapterParserTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/config/xml/JpaInboundChannelAdapterParserTests.java index 70ac865af7..5c4c54ca64 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/config/xml/JpaInboundChannelAdapterParserTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/config/xml/JpaInboundChannelAdapterParserTests.java @@ -147,13 +147,13 @@ public class JpaInboundChannelAdapterParserTests { } @After - public void tearDown(){ - if(context != null){ + public void tearDown() { + if (context != null) { context.close(); } } - public void setUp(String name, Class cls, String consumerId){ + public void setUp(String name, Class cls, String consumerId) { context = new ClassPathXmlApplicationContext(name, cls); consumer = this.context.getBean(consumerId, SourcePollingChannelAdapter.class); } diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/config/xml/JpaMessageHandlerParserTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/config/xml/JpaMessageHandlerParserTests.java index f2373e886f..fdb4f9582f 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/config/xml/JpaMessageHandlerParserTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/config/xml/JpaMessageHandlerParserTests.java @@ -212,13 +212,13 @@ public class JpaMessageHandlerParserTests { } @After - public void tearDown(){ - if(context != null){ + public void tearDown() { + if (context != null) { context.close(); } } - public void setUp(String name, Class cls){ + public void setUp(String name, Class cls) { context = new ClassPathXmlApplicationContext(name, cls); consumer = this.context.getBean("jpaOutboundChannelAdapter", EventDrivenConsumer.class); } diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/Gender.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/Gender.java index 0132b1e6d7..d3132f94ec 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/Gender.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/Gender.java @@ -28,7 +28,7 @@ import java.util.Map; */ public enum Gender { - MALE("M"),FEMALE("F"); + MALE("M"), FEMALE("F"); private String identifier; private static Map identifierMap; @@ -44,7 +44,7 @@ public enum Gender { static { EnumSet all = EnumSet.allOf(Gender.class); identifierMap = new HashMap(); - for(Gender gender:all) { + for (Gender gender:all) { identifierMap.put(gender.getIdentifier(), gender); } } diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentDomain.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentDomain.java index c15c26daf3..e5e25ecdbb 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentDomain.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentDomain.java @@ -40,35 +40,35 @@ import javax.persistence.TemporalType; * @since 2.2 * */ -@Entity(name="Student") -@Table(name="Student") +@Entity(name = "Student") +@Table(name = "Student") @NamedQueries({ - @NamedQuery(name="selectAllStudents", query="select s from Student s"), - @NamedQuery(name="selectStudent", query="select s from Student s where s.lastName = 'Last One'"), - @NamedQuery(name="updateStudent", query="update Student s set s.lastName = :lastName, s.lastUpdated = :lastUpdated where s.rollNumber in (select max(a.rollNumber) from Student a)") + @NamedQuery(name = "selectAllStudents", query = "select s from Student s"), + @NamedQuery(name = "selectStudent", query = "select s from Student s where s.lastName = 'Last One'"), + @NamedQuery(name = "updateStudent", query = "update Student s set s.lastName = :lastName, s.lastUpdated = :lastUpdated where s.rollNumber in (select max(a.rollNumber) from Student a)") }) -@NamedNativeQuery(resultClass=StudentDomain.class, name="updateStudentNativeQuery", query="update Student s set s.lastName = :lastName, lastUpdated = :lastUpdated where s.rollNumber in (select max(a.rollNumber) from Student a)") +@NamedNativeQuery(resultClass = StudentDomain.class, name = "updateStudentNativeQuery", query = "update Student s set s.lastName = :lastName, lastUpdated = :lastUpdated where s.rollNumber in (select max(a.rollNumber) from Student a)") public class StudentDomain { @Id - @Column(name="rollNumber") - @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name = "rollNumber") + @GeneratedValue(strategy = GenerationType.AUTO) private Long rollNumber; - @Column(name="firstName") + @Column(name = "firstName") private String firstName; - @Column(name="lastName") + @Column(name = "lastName") private String lastName; - @Column(name="gender") + @Column(name = "gender") private String gender; - @Column(name="dateOfBirth") + @Column(name = "dateOfBirth") @Temporal(TemporalType.DATE) private Date dateOfBirth; - @Column(name="lastUpdated") + @Column(name = "lastUpdated") @Temporal(TemporalType.TIMESTAMP) private Date lastUpdated; diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentReadStatus.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentReadStatus.java index 90d3956b50..5a66d82a71 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentReadStatus.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentReadStatus.java @@ -32,14 +32,14 @@ import javax.persistence.TemporalType; * */ @Entity -@Table(name="StudentReadStatus") +@Table(name = "StudentReadStatus") public class StudentReadStatus { @Id - @Column(name="rollNumber") + @Column(name = "rollNumber") private int rollNumber; - @Column(name="readAt") + @Column(name = "readAt") @Temporal(TemporalType.TIMESTAMP) private Date readAt; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java index ab69931709..037c6cf3dc 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java @@ -328,13 +328,13 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl Flags flags = getFolder().getPermanentFlags(); - if (flags != null){ + if (flags != null) { recentFlagSupported = flags.contains(Flags.Flag.RECENT); } for (Message message : filteredMessages) { - if (!recentFlagSupported){ - if (flags != null && flags.contains(Flags.Flag.USER)){ - if (this.logger.isDebugEnabled()){ + if (!recentFlagSupported) { + if (flags != null && flags.contains(Flags.Flag.USER)) { + if (this.logger.isDebugEnabled()) { this.logger.debug("USER flags are supported by this mail server. Flagging message with '" + this.userFlag + "' user flag"); } @@ -343,7 +343,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl message.setFlags(siFlags, true); } else { - if (this.logger.isDebugEnabled()){ + if (this.logger.isDebugEnabled()) { this.logger.debug("USER flags are not supported by this mail server. " + "Flagging message with system flag"); } @@ -367,7 +367,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl filteredMessages.add(message); } else { - if (this.logger.isDebugEnabled()){ + if (this.logger.isDebugEnabled()) { this.logger.debug("Fetched email with subject '" + message.getSubject() + "' will be discarded by the matching filter" + " and will not be flagged as SEEN."); } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java index 3b6caf4689..f36a6bbef3 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java @@ -182,7 +182,7 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport implements Be } } - private Runnable createMessageSendingTask(final Message mailMessage){ + private Runnable createMessageSendingTask(final Message mailMessage) { Runnable sendingTask = new Runnable() { @Override public void run() { @@ -190,7 +190,7 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport implements Be ImapIdleChannelAdapter.this.getMessageBuilderFactory().withPayload(mailMessage).build(); if (TransactionSynchronizationManager.isActualTransactionActive()) { - if (ImapIdleChannelAdapter.this.transactionSynchronizationFactory != null){ + if (ImapIdleChannelAdapter.this.transactionSynchronizationFactory != null) { TransactionSynchronization synchronization = ImapIdleChannelAdapter.this.transactionSynchronizationFactory .create(ImapIdleChannelAdapter.this); @@ -302,7 +302,7 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport implements Be @Override public Date nextExecutionTime(TriggerContext triggerContext) { - if (this.delayNextExecution){ + if (this.delayNextExecution) { this.delayNextExecution = false; return new Date(System.currentTimeMillis() + ImapIdleChannelAdapter.this.reconnectDelay); } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailHeaders.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailHeaders.java index d069e41ac9..84fbd9bf70 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailHeaders.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailHeaders.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -36,7 +36,7 @@ public abstract class MailHeaders { public static final String FROM = PREFIX + "from"; - public static final String REPLY_TO = PREFIX+ "replyTo"; + public static final String REPLY_TO = PREFIX + "replyTo"; public static final String MULTIPART_MODE = PREFIX + "multipartMode"; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailSendingMessageHandler.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailSendingMessageHandler.java index 575f88ea6b..f6e9cd143b 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailSendingMessageHandler.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailSendingMessageHandler.java @@ -122,7 +122,7 @@ public class MailSendingMessageHandler extends AbstractMessageHandler { return mailMessage; } - private MailMessage createMailMessageWithContentType(Message message, String contentType){ + private MailMessage createMailMessageWithContentType(Message message, String contentType) { Assert.state(this.mailSender instanceof JavaMailSender, "this adapter requires a 'JavaMailSender' to send a 'MimeMailMessage'"); @@ -168,7 +168,7 @@ public class MailSendingMessageHandler extends AbstractMessageHandler { mailMessage.setSubject(subject); } String[] to = this.retrieveHeaderValueAsStringArray(headers, MailHeaders.TO); - if (to != null){ + if (to != null) { mailMessage.setTo(to); } if (mailMessage instanceof SimpleMailMessage) { @@ -204,7 +204,7 @@ public class MailSendingMessageHandler extends AbstractMessageHandler { returnedHeaders = StringUtils.commaDelimitedListToStringArray((String) value); } } - if (returnedHeaders == null || ObjectUtils.isEmpty(returnedHeaders)){ + if (returnedHeaders == null || ObjectUtils.isEmpty(returnedHeaders)) { returnedHeaders = null; } return returnedHeaders; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/ImapIdleChannelAdapterParser.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/ImapIdleChannelAdapterParser.java index 55d5009d39..c1cc30cb3f 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/ImapIdleChannelAdapterParser.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/ImapIdleChannelAdapterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -48,7 +48,7 @@ public class ImapIdleChannelAdapterParser extends AbstractChannelAdapterParser { IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel", "errorChannel"); Element txElement = DomUtils.getChildElementByTagName(element, "transactional"); - if (txElement != null){ + if (txElement != null) { IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, txElement, "synchronization-factory", "transactionSynchronizationFactory"); } @@ -83,14 +83,14 @@ public class ImapIdleChannelAdapterParser extends AbstractChannelAdapterParser { IntegrationNamespaceUtils.setValueIfAttributeDefined(receiverBuilder, element, "max-fetch-size"); receiverBuilder.addPropertyValue("shouldDeleteMessages", element.getAttribute("should-delete-messages")); String markAsRead = element.getAttribute("should-mark-messages-as-read"); - if (StringUtils.hasText(markAsRead)){ + if (StringUtils.hasText(markAsRead)) { receiverBuilder.addPropertyValue("shouldMarkMessagesAsRead", markAsRead); } String selectorExpression = element.getAttribute("mail-filter-expression"); RootBeanDefinition expressionDef = null; - if (StringUtils.hasText(selectorExpression)){ + if (StringUtils.hasText(selectorExpression)) { expressionDef = new RootBeanDefinition("org.springframework.integration.config.ExpressionFactoryBean"); expressionDef.getConstructorArgumentValues().addGenericArgumentValue(selectorExpression); receiverBuilder.addPropertyValue("selectorExpression", expressionDef); diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailInboundChannelAdapterParser.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailInboundChannelAdapterParser.java index 68d6e5b0c5..800dc247e8 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailInboundChannelAdapterParser.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailInboundChannelAdapterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -81,14 +81,14 @@ public class MailInboundChannelAdapterParser extends AbstractPollingInboundChann } receiverBuilder.addPropertyValue("shouldDeleteMessages", element.getAttribute("should-delete-messages")); String markAsRead = element.getAttribute("should-mark-messages-as-read"); - if (StringUtils.hasText(markAsRead)){ + if (StringUtils.hasText(markAsRead)) { receiverBuilder.addPropertyValue("shouldMarkMessagesAsRead", markAsRead); } String selectorExpression = element.getAttribute("mail-filter-expression"); RootBeanDefinition expressionDef = null; - if (StringUtils.hasText(selectorExpression)){ + if (StringUtils.hasText(selectorExpression)) { expressionDef = new RootBeanDefinition("org.springframework.integration.config.ExpressionFactoryBean"); expressionDef.getConstructorArgumentValues().addGenericArgumentValue(selectorExpression); receiverBuilder.addPropertyValue("selectorExpression", expressionDef); diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/MailToStringTransformer.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/MailToStringTransformer.java index 612863c778..22635984d3 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/MailToStringTransformer.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/MailToStringTransformer.java @@ -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. @@ -63,7 +63,7 @@ public class MailToStringTransformer extends AbstractMailMessageTransformer contextHolder = TestUtils.getPropertyValue(receiver, "contextHolder",ThreadLocal.class); + ThreadLocal contextHolder = TestUtils.getPropertyValue(receiver, "contextHolder", ThreadLocal.class); Folder folder = mock(Folder.class); MailReceiverContext context = new MailReceiverContext(folder); contextHolder.set(context); diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/PoorMansMailServer.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/PoorMansMailServer.java index 29c8f20e39..7952a0b10e 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/PoorMansMailServer.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/PoorMansMailServer.java @@ -321,7 +321,7 @@ public class PoorMansMailServer { else if (line.contains("NOOP")) { write(tag + "OK NOOP completed"); } - else if(line.endsWith("STORE 1 +FLAGS (testSIUserFlag)")) { + else if (line.endsWith("STORE 1 +FLAGS (testSIUserFlag)")) { write(tag + "OK STORE completed"); assertions.add("storeUserFlag"); } diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/Pop3MailReceiverTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/Pop3MailReceiverTests.java index 088f742557..3dba513a79 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/Pop3MailReceiverTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/Pop3MailReceiverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -45,9 +45,9 @@ import org.springframework.beans.factory.BeanFactory; */ public class Pop3MailReceiverTests { @Test - public void receiveAndDelete() throws Exception{ + public void receiveAndDelete() throws Exception { AbstractMailReceiver receiver = new Pop3MailReceiver(); - ((Pop3MailReceiver)receiver).setShouldDeleteMessages(true); + ((Pop3MailReceiver) receiver).setShouldDeleteMessages(true); receiver = spy(receiver); receiver.setBeanFactory(mock(BeanFactory.class)); receiver.afterPropertiesSet(); @@ -65,7 +65,7 @@ public class Pop3MailReceiverTests { public Object answer(InvocationOnMock invocation) throws Throwable { DirectFieldAccessor accessor = new DirectFieldAccessor(invocation.getMock()); int folderOpenMode = (Integer) accessor.getPropertyValue("folderOpenMode"); - if (folderOpenMode != Folder.READ_WRITE){ + if (folderOpenMode != Folder.READ_WRITE) { throw new IllegalArgumentException("Folder had to be open in READ_WRITE mode"); } return null; @@ -89,9 +89,9 @@ public class Pop3MailReceiverTests { verify(msg2, times(1)).setFlag(Flag.DELETED, true); } @Test - public void receiveAndDontDelete() throws Exception{ + public void receiveAndDontDelete() throws Exception { AbstractMailReceiver receiver = new Pop3MailReceiver(); - ((Pop3MailReceiver)receiver).setShouldDeleteMessages(false); + ((Pop3MailReceiver) receiver).setShouldDeleteMessages(false); receiver = spy(receiver); receiver.setBeanFactory(mock(BeanFactory.class)); receiver.afterPropertiesSet(); @@ -128,7 +128,7 @@ public class Pop3MailReceiverTests { verify(msg2, times(0)).setFlag(Flag.DELETED, true); } @Test - public void receiveAndDontSetDeleteWithUrl() throws Exception{ + public void receiveAndDontSetDeleteWithUrl() throws Exception { AbstractMailReceiver receiver = new Pop3MailReceiver("pop3://some.host"); receiver = spy(receiver); receiver.setBeanFactory(mock(BeanFactory.class)); @@ -166,7 +166,7 @@ public class Pop3MailReceiverTests { verify(msg2, times(0)).setFlag(Flag.DELETED, true); } @Test - public void receiveAndDontSetDeleteWithoutUrl() throws Exception{ + public void receiveAndDontSetDeleteWithoutUrl() throws Exception { AbstractMailReceiver receiver = new Pop3MailReceiver(); receiver = spy(receiver); receiver.setBeanFactory(mock(BeanFactory.class)); diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/FailedMailConfigurationTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/FailedMailConfigurationTests.java index 0c38e01604..753f51c0c8 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/FailedMailConfigurationTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/FailedMailConfigurationTests.java @@ -28,15 +28,15 @@ public class FailedMailConfigurationTests { /** * validates that if 'should-delete-messages' is not set the context fails */ - @Test(expected=XmlBeanDefinitionStoreException.class) - public void testImapIdleWithNoDeleteMessageAttribute(){ + @Test(expected = XmlBeanDefinitionStoreException.class) + public void testImapIdleWithNoDeleteMessageAttribute() { new ClassPathXmlApplicationContext("failed-imap-config.xml", this.getClass()); } /** * validates that if 'should-delete-messages' is not set the context fails */ - @Test(expected=XmlBeanDefinitionStoreException.class) - public void testAdapterWithNoDeleteMessageAttribute(){ + @Test(expected = XmlBeanDefinitionStoreException.class) + public void testAdapterWithNoDeleteMessageAttribute() { new ClassPathXmlApplicationContext("failed-adapter-config.xml", this.getClass()); } } diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests.java index a39d8cb63e..b6101267b6 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -283,7 +283,7 @@ public class InboundChannelAdapterParserTests { .close(); fail("expected a parser error"); } - catch(BeanDefinitionStoreException e) { + catch (BeanDefinitionStoreException e) { assertEquals(SAXParseException.class, e.getCause().getClass()); } } @@ -310,7 +310,7 @@ public class InboundChannelAdapterParserTests { .close(); fail("expected a parser error"); } - catch(BeanCreationException e) { + catch (BeanCreationException e) { assertTrue(e.getMessage().contains("searchTermStrategy is only allowed with imap")); } } diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MessageWithContentTypeTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MessageWithContentTypeTests.java index 770c151695..00d23c54bc 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MessageWithContentTypeTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MessageWithContentTypeTests.java @@ -55,7 +55,7 @@ public class MessageWithContentTypeTests { @Test @Ignore - public void testSendEmail() throws Exception{ + public void testSendEmail() throws Exception { ApplicationContext ac = new ClassPathXmlApplicationContext("MessageWithContentTypeTests-context.xml", this.getClass()); MessageChannel inputChannel = ac.getBean("inputChannel", MessageChannel.class); StringWriter writer = new StringWriter(); @@ -65,7 +65,7 @@ public class MessageWithContentTypeTests { } @Test - public void testMessageConversionWithHtmlAndContentType() throws Exception{ + public void testMessageConversionWithHtmlAndContentType() throws Exception { JavaMailSender sender = mock(JavaMailSender.class); MailSendingMessageHandler handler = new MailSendingMessageHandler(sender); StringWriter writer = new StringWriter(); @@ -93,7 +93,7 @@ public class MessageWithContentTypeTests { verify(sender, times(1)).send(Mockito.any(MimeMessage.class)); } - private static class TestMimeMessage extends MimeMessage{ + private static class TestMimeMessage extends MimeMessage { TestMimeMessage() { super(Session.getDefaultInstance(new Properties())); } diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoParserUtils.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoParserUtils.java index 514fdea082..91d5c2694d 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoParserUtils.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoParserUtils.java @@ -44,16 +44,16 @@ final class MongoParserUtils { * @param parserContext * @param builder */ - public static void processCommonAttributes(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){ + public static void processCommonAttributes(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String mongoDbTemplate = element.getAttribute("mongo-template"); String mongoDbFactory = element.getAttribute("mongodb-factory"); - if (StringUtils.hasText(mongoDbTemplate) && StringUtils.hasText(mongoDbFactory)){ + if (StringUtils.hasText(mongoDbTemplate) && StringUtils.hasText(mongoDbFactory)) { parserContext.getReaderContext().error("Only one of '" + mongoDbTemplate + "' or '" + mongoDbFactory + "' is allowed", element); } - if (StringUtils.hasText(mongoDbTemplate)){ + if (StringUtils.hasText(mongoDbTemplate)) { builder.addConstructorArgReference(mongoDbTemplate); if (StringUtils.hasText(element.getAttribute("mongo-converter"))) { parserContext.getReaderContext().error("'mongo-converter' is not allowed with 'mongo-template'", @@ -73,7 +73,7 @@ final class MongoParserUtils { parserContext, element, false); - if (collectionNameExpressionDef != null){ + if (collectionNameExpressionDef != null) { builder.addPropertyValue("collectionNameExpression", collectionNameExpressionDef); } diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSource.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSource.java index 459064b817..ce2024c8a6 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSource.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSource.java @@ -88,7 +88,7 @@ public class MongoDbMessageSource extends IntegrationObjectSupport * @param mongoDbFactory The mongodb factory. * @param queryExpression The query expression. */ - public MongoDbMessageSource(MongoDbFactory mongoDbFactory, Expression queryExpression){ + public MongoDbMessageSource(MongoDbFactory mongoDbFactory, Expression queryExpression) { Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null"); Assert.notNull(queryExpression, "'queryExpression' must not be null"); @@ -106,7 +106,7 @@ public class MongoDbMessageSource extends IntegrationObjectSupport * @param mongoTemplate The mongo template. * @param queryExpression The query expression. */ - public MongoDbMessageSource(MongoOperations mongoTemplate, Expression queryExpression){ + public MongoDbMessageSource(MongoOperations mongoTemplate, Expression queryExpression) { Assert.notNull(mongoTemplate, "'mongoTemplate' must not be null"); Assert.notNull(queryExpression, "'queryExpression' must not be null"); @@ -176,7 +176,7 @@ public class MongoDbMessageSource extends IntegrationObjectSupport this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); - if (this.mongoTemplate == null){ + if (this.mongoTemplate == null) { this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mongoConverter); } this.initialized = true; @@ -200,18 +200,18 @@ public class MongoDbMessageSource extends IntegrationObjectSupport Assert.notNull(collectionName, "'collectionNameExpression' must not evaluate to null"); Object result = null; - if (this.expectSingleResult){ + if (this.expectSingleResult) { result = this.mongoTemplate. findOne(query, this.entityClass, collectionName); } else { List results = this.mongoTemplate. find(query, this.entityClass, collectionName); - if (!CollectionUtils.isEmpty(results)){ + if (!CollectionUtils.isEmpty(results)) { result = results; } } - if (result != null){ + if (result != null) { message = this.getMessageBuilderFactory().withPayload(result) .setHeader(MongoHeaders.COLLECTION_NAME, collectionName) .build(); diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandler.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandler.java index 2aff72f280..f33de79156 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandler.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandler.java @@ -56,7 +56,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler { * * @param mongoDbFactory The mongodb factory. */ - public MongoDbStoringMessageHandler(MongoDbFactory mongoDbFactory){ + public MongoDbStoringMessageHandler(MongoDbFactory mongoDbFactory) { Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null"); this.mongoDbFactory = mongoDbFactory; @@ -68,7 +68,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler { * * @param mongoTemplate The MongoOperations implementation. */ - public MongoDbStoringMessageHandler(MongoOperations mongoTemplate){ + public MongoDbStoringMessageHandler(MongoOperations mongoTemplate) { Assert.notNull(mongoTemplate, "'mongoTemplate' must not be null"); this.mongoTemplate = mongoTemplate; @@ -107,7 +107,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler { protected void onInit() throws Exception { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); - if (this.mongoTemplate == null){ + if (this.mongoTemplate == null) { this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mongoConverter); } this.initialized = true; diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java index a62e191e37..4eb6ff5c96 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java @@ -251,7 +251,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore long lastModified = 0; int lastReleasedSequenceNumber = 0; boolean completeGroup = false; - if (messageWrappers.size() > 0){ + if (messageWrappers.size() > 0) { MessageWrapper messageWrapper = messageWrappers.get(0); timestamp = messageWrapper.get_Group_timestamp(); lastModified = messageWrapper.get_Group_update_timestamp(); @@ -265,7 +265,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore MessageGroup messageGroup = getMessageGroupFactory().create(messages, groupId, timestamp, completeGroup); messageGroup.setLastModified(lastModified); - if (lastReleasedSequenceNumber > 0){ + if (lastReleasedSequenceNumber > 0) { messageGroup.setLastReleasedMessageSequenceNumber(lastReleasedSequenceNumber); } @@ -517,27 +517,27 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore throw new IllegalStateException("failed to load class: " + messageType, e); } - Long groupTimestamp = (Long)source.get(GROUP_TIMESTAMP_KEY); - Long lastModified = (Long)source.get(GROUP_UPDATE_TIMESTAMP_KEY); - Integer lastReleasedSequenceNumber = (Integer)source.get(LAST_RELEASED_SEQUENCE_NUMBER); - Boolean completeGroup = (Boolean)source.get(GROUP_COMPLETE_KEY); + Long groupTimestamp = (Long) source.get(GROUP_TIMESTAMP_KEY); + Long lastModified = (Long) source.get(GROUP_UPDATE_TIMESTAMP_KEY); + Integer lastReleasedSequenceNumber = (Integer) source.get(LAST_RELEASED_SEQUENCE_NUMBER); + Boolean completeGroup = (Boolean) source.get(GROUP_COMPLETE_KEY); MessageWrapper wrapper = new MessageWrapper(message); - if (source.containsField(GROUP_ID_KEY)){ + if (source.containsField(GROUP_ID_KEY)) { wrapper.set_GroupId(source.get(GROUP_ID_KEY)); } - if (groupTimestamp != null){ + if (groupTimestamp != null) { wrapper.set_Group_timestamp(groupTimestamp); } - if (lastModified != null){ + if (lastModified != null) { wrapper.set_Group_update_timestamp(lastModified); } - if (lastReleasedSequenceNumber != null){ + if (lastReleasedSequenceNumber != null) { wrapper.set_LastReleasedSequenceNumber(lastReleasedSequenceNumber); } - if (completeGroup != null){ + if (completeGroup != null) { wrapper.set_Group_complete(completeGroup); } @@ -614,7 +614,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore } - private static class MessageHistoryToDBObjectConverter implements Converter { + private static class MessageHistoryToDBObjectConverter implements Converter { @Override public DBObject convert(MessageHistory source) { diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests.java index b5725eeefc..cdc76d2db2 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests.java @@ -35,7 +35,7 @@ import org.springframework.integration.test.util.TestUtils; public class MongoDbInboundChannelAdapterParserTests { @Test - public void minimalConfig(){ + public void minimalConfig() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("inbound-adapter-parser-config.xml", this.getClass()); SourcePollingChannelAdapter spca = context.getBean("minimalConfig.adapter", SourcePollingChannelAdapter.class); @@ -50,7 +50,7 @@ public class MongoDbInboundChannelAdapterParserTests { } @Test - public void fullConfigWithCollectionExpression(){ + public void fullConfigWithCollectionExpression() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("inbound-adapter-parser-config.xml", this.getClass()); SourcePollingChannelAdapter spca = context.getBean("fullConfigWithCollectionExpression.adapter", SourcePollingChannelAdapter.class); @@ -66,7 +66,7 @@ public class MongoDbInboundChannelAdapterParserTests { } @Test - public void fullConfigWithCollectionName(){ + public void fullConfigWithCollectionName() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("inbound-adapter-parser-config.xml", this.getClass()); SourcePollingChannelAdapter spca = context.getBean("fullConfigWithCollectionName.adapter", SourcePollingChannelAdapter.class); @@ -82,7 +82,7 @@ public class MongoDbInboundChannelAdapterParserTests { } @Test - public void fullConfigWithMongoTemplate(){ + public void fullConfigWithMongoTemplate() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("inbound-adapter-parser-config.xml", this.getClass()); SourcePollingChannelAdapter spca = context.getBean("fullConfigWithMongoTemplate.adapter", SourcePollingChannelAdapter.class); @@ -96,13 +96,13 @@ public class MongoDbInboundChannelAdapterParserTests { assertEquals("foo", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue")); } - @Test(expected=BeanDefinitionParsingException.class) - public void templateAndFactoryFail(){ + @Test(expected = BeanDefinitionParsingException.class) + public void templateAndFactoryFail() { new ClassPathXmlApplicationContext("inbound-adapter-parser-fail-template-factory-config.xml", this.getClass()); } - @Test(expected=BeanDefinitionParsingException.class) - public void templateAndConverterFail(){ + @Test(expected = BeanDefinitionParsingException.class) + public void templateAndConverterFail() { new ClassPathXmlApplicationContext("inbound-adapter-parser-fail-template-converter-config.xml", this.getClass()); } } diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterIntegrationTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterIntegrationTests.java index 0f9ffcab77..ad778dad00 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterIntegrationTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterIntegrationTests.java @@ -40,7 +40,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila @Test @MongoDbAvailable - public void testWithDefaultMongoFactory() throws Exception{ + public void testWithDefaultMongoFactory() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-config.xml", this.getClass()); MessageChannel channel = context.getBean("simpleAdapter", MessageChannel.class); @@ -54,7 +54,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila @Test @MongoDbAvailable - public void testWithNamedCollection() throws Exception{ + public void testWithNamedCollection() throws Exception { MongoDbFactory mongoDbFactory = this.prepareMongoFactory("foo"); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-config.xml", this.getClass()); @@ -68,7 +68,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila @Test @MongoDbAvailable - public void testWithTemplate() throws Exception{ + public void testWithTemplate() throws Exception { MongoDbFactory mongoDbFactory = this.prepareMongoFactory("foo"); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-config.xml", this.getClass()); @@ -82,7 +82,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila @Test @MongoDbAvailable - public void testSavingDbObject() throws Exception{ + public void testSavingDbObject() throws Exception { BasicDBObject dbObject = (BasicDBObject) JSON.parse("{'foo' : 'bar'}"); @@ -99,7 +99,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila @Test @MongoDbAvailable - public void testSavingJSONString() throws Exception{ + public void testSavingJSONString() throws Exception { String object = "{'foo' : 'bar'}"; @@ -116,7 +116,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila @Test @MongoDbAvailable - public void testWithMongoConverter() throws Exception{ + public void testWithMongoConverter() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-config.xml", this.getClass()); MessageChannel channel = context.getBean("simpleAdapterWithConverter", MessageChannel.class); diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterParserTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterParserTests.java index 80135b0f8b..048fce89a9 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterParserTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterParserTests.java @@ -45,7 +45,7 @@ import org.springframework.messaging.MessageHandler; public class MongoDbOutboundChannelAdapterParserTests { @Test - public void minimalConfig(){ + public void minimalConfig() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); MongoDbStoringMessageHandler handler = @@ -60,7 +60,7 @@ public class MongoDbOutboundChannelAdapterParserTests { } @Test - public void fullConfigWithCollectionExpression(){ + public void fullConfigWithCollectionExpression() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); MongoDbStoringMessageHandler handler = @@ -75,7 +75,7 @@ public class MongoDbOutboundChannelAdapterParserTests { } @Test - public void fullConfigWithCollection(){ + public void fullConfigWithCollection() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); MongoDbStoringMessageHandler handler = @@ -90,7 +90,7 @@ public class MongoDbOutboundChannelAdapterParserTests { } @Test - public void fullConfigWithMongoTemplate(){ + public void fullConfigWithMongoTemplate() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); MongoDbStoringMessageHandler handler = @@ -103,18 +103,18 @@ public class MongoDbOutboundChannelAdapterParserTests { assertEquals("foo", TestUtils.getPropertyValue(handler, "collectionNameExpression.literalValue")); } - @Test(expected=BeanDefinitionParsingException.class) - public void templateAndFactoryFail(){ + @Test(expected = BeanDefinitionParsingException.class) + public void templateAndFactoryFail() { new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-factory-config.xml", this.getClass()); } - @Test(expected=BeanDefinitionParsingException.class) - public void templateAndConverterFail(){ + @Test(expected = BeanDefinitionParsingException.class) + public void templateAndConverterFail() { new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-converter-config.xml", this.getClass()); } @Test - public void testInt3024PollerAndRequestHandlerAdviceChain(){ + public void testInt3024PollerAndRequestHandlerAdviceChain() { ApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); AbstractEndpoint endpoint = context.getBean("pollableAdapter", AbstractEndpoint.class); assertThat(endpoint, Matchers.instanceOf(PollingConsumer.class)); diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSourceTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSourceTests.java index c612da692a..615b9a3fe4 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSourceTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSourceTests.java @@ -55,19 +55,19 @@ public class MongoDbMessageSourceTests extends MongoDbAvailableTests { * Tests by providing a null MongoDB Factory * */ - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void withNullMongoDBFactory() { Expression expression = mock(Expression.class); - new MongoDbMessageSource((MongoDbFactory)null, expression); + new MongoDbMessageSource((MongoDbFactory) null, expression); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void withNullMongoTemplate() { Expression expression = mock(Expression.class); - new MongoDbMessageSource((MongoOperations)null, expression); + new MongoDbMessageSource((MongoOperations) null, expression); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void withNullQueryExpression() { MongoDbFactory mongoDbFactory = mock(MongoDbFactory.class); new MongoDbMessageSource(mongoDbFactory, null); @@ -87,7 +87,7 @@ public class MongoDbMessageSourceTests extends MongoDbAvailableTests { messageSource.setBeanFactory(mock(BeanFactory.class)); messageSource.afterPropertiesSet(); @SuppressWarnings("unchecked") - List results = ((List)messageSource.receive().getPayload()); + List results = ((List) messageSource.receive().getPayload()); assertEquals(1, results.size()); DBObject resultObject = results.get(0); @@ -109,7 +109,7 @@ public class MongoDbMessageSourceTests extends MongoDbAvailableTests { messageSource.setBeanFactory(mock(BeanFactory.class)); messageSource.afterPropertiesSet(); @SuppressWarnings("unchecked") - List results = ((List)messageSource.receive().getPayload()); + List results = ((List) messageSource.receive().getPayload()); assertEquals(1, results.size()); Person person = results.get(0); assertEquals("Oleg", person.getName()); @@ -131,7 +131,7 @@ public class MongoDbMessageSourceTests extends MongoDbAvailableTests { messageSource.setExpectSingleResult(true); messageSource.setBeanFactory(mock(BeanFactory.class)); messageSource.afterPropertiesSet(); - Person person = (Person)messageSource.receive().getPayload(); + Person person = (Person) messageSource.receive().getPayload(); assertEquals("Oleg", person.getName()); assertEquals("PA", person.getAddress().getState()); @@ -153,7 +153,7 @@ public class MongoDbMessageSourceTests extends MongoDbAvailableTests { messageSource.setBeanFactory(mock(BeanFactory.class)); messageSource.afterPropertiesSet(); @SuppressWarnings("unchecked") - List results = ((List)messageSource.receive().getPayload()); + List results = ((List) messageSource.receive().getPayload()); Person person = results.get(0); assertEquals("Oleg", person.getName()); assertEquals("PA", person.getAddress().getState()); @@ -267,7 +267,7 @@ public class MongoDbMessageSourceTests extends MongoDbAvailableTests { messageSource.afterPropertiesSet(); DBObject result = (DBObject) messageSource.receive().getPayload(); Object id = result.get("_id"); - result.put("company","PepBoys"); + result.put("company", "PepBoys"); template.save(result, "data"); result = (DBObject) messageSource.receive().getPayload(); assertEquals(id, result.get("_id")); diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandlerTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandlerTests.java index 37f5e41d39..58b7a74c24 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandlerTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandlerTests.java @@ -50,14 +50,14 @@ import com.mongodb.DBObject; */ public class MongoDbStoringMessageHandlerTests extends MongoDbAvailableTests { - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void withNullMongoDBFactory() { - new MongoDbStoringMessageHandler((MongoDbFactory)null); + new MongoDbStoringMessageHandler((MongoDbFactory) null); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void withNullMongoTemplate() { - new MongoDbStoringMessageHandler((MongoOperations)null); + new MongoDbStoringMessageHandler((MongoOperations) null); } diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java index 15847aaa0e..20f7126b0b 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java @@ -60,7 +60,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testNonExistingEmptyMessageGroup() throws Exception{ + public void testNonExistingEmptyMessageGroup() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = getMessageGroupStore(); MessageGroup messageGroup = store.getMessageGroup(1); @@ -71,7 +71,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testMessageGroupWithAddedMessagePrimitiveGroupId() throws Exception{ + public void testMessageGroupWithAddedMessagePrimitiveGroupId() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageStore messageStore = this.getMessageStore(); @@ -91,7 +91,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader() throws Exception{ + public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageStore messageStore = this.getMessageStore(); @@ -117,7 +117,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testCountMessagesInGroup() throws Exception{ + public void testCountMessagesInGroup() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); Message messageA = new GenericMessage("A"); @@ -129,7 +129,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testPollMessages() throws Exception{ + public void testPollMessages() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); Message messageA = new GenericMessage("A"); @@ -149,7 +149,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testSameMessageMultipleGroupsPoll() throws Exception{ + public void testSameMessageMultipleGroupsPoll() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); Message messageA = new GenericMessage("A"); @@ -185,7 +185,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testSameMessageMultipleGroupsRemove() throws Exception{ + public void testSameMessageMultipleGroupsRemove() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); @@ -222,7 +222,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exception{ + public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); @@ -251,7 +251,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testMessageGroupMarkingMessage() throws Exception{ + public void testMessageGroupMarkingMessage() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); @@ -276,7 +276,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testRemoveMessageGroup() throws Exception{ + public void testRemoveMessageGroup() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageStore messageStore = this.getMessageStore(); @@ -299,7 +299,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testCompleteMessageGroup() throws Exception{ + public void testCompleteMessageGroup() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); @@ -314,7 +314,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testLastReleasedSequenceNumber() throws Exception{ + public void testLastReleasedSequenceNumber() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); @@ -329,7 +329,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testRemoveMessageFromTheGroup() throws Exception{ + public void testRemoveMessageFromTheGroup() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); @@ -348,7 +348,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testMultipleMessageStores() throws Exception{ + public void testMultipleMessageStores() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store1 = this.getMessageGroupStore(); @@ -374,7 +374,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testMessageGroupIterator() throws Exception{ + public void testMessageGroupIterator() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store1 = this.getMessageGroupStore(); MessageGroupStore store2 = this.getMessageGroupStore(); @@ -468,7 +468,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail // } - protected void testWithAggregatorWithShutdown(String config) throws Exception{ + protected void testWithAggregatorWithShutdown(String config) throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config, this.getClass()); @@ -497,7 +497,7 @@ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvail @Test @MongoDbAvailable - public void testWithMessageHistory() throws Exception{ + public void testWithMessageHistory() throws Exception { this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageStoreTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageStoreTests.java index e4dafb7545..92380a6592 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageStoreTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageStoreTests.java @@ -107,7 +107,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT @Test @MongoDbAvailable - public void testWithMessageHistory() throws Exception{ + public void testWithMessageHistory() throws Exception { cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageStore store = getMessageStore(); Foo foo = new Foo(); @@ -145,7 +145,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT @Test @MongoDbAvailable - public void testInt3153SequenceDetails() throws Exception{ + public void testInt3153SequenceDetails() throws Exception { cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageStore store = getMessageStore(); Message messageToStore = MessageBuilder.withPayload("test") @@ -162,7 +162,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT @Test @MongoDbAvailable - public void testInt3076MessageAsPayload() throws Exception{ + public void testInt3076MessageAsPayload() throws Exception { MessageStore store = this.getMessageStore(); Person p = new Person(); p.setFname("John"); @@ -180,7 +180,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT @Test @MongoDbAvailable - public void testInt3076AdviceMessage() throws Exception{ + public void testInt3076AdviceMessage() throws Exception { MessageStore store = this.getMessageStore(); Person p = new Person(); p.setFname("John"); @@ -199,7 +199,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT @Test @MongoDbAvailable - public void testAdviceMessageAsPayload() throws Exception{ + public void testAdviceMessageAsPayload() throws Exception { MessageStore store = this.getMessageStore(); Person p = new Person(); p.setFname("John"); @@ -219,7 +219,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT @Test @MongoDbAvailable - public void testMutableMessageAsPayload() throws Exception{ + public void testMutableMessageAsPayload() throws Exception { MessageStore store = this.getMessageStore(); Person p = new Person(); p.setFname("John"); @@ -237,7 +237,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT @Test @MongoDbAvailable - public void testInt3076ErrorMessage() throws Exception{ + public void testInt3076ErrorMessage() throws Exception { MessageStore store = this.getMessageStore(); Person p = new Person(); p.setFname("John"); @@ -279,14 +279,14 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT } } - public static class Bar implements Serializable{ + public static class Bar implements Serializable { /** * */ private static final long serialVersionUID = 1L; private final String name; - public Bar(String name){ + public Bar(String name) { this.name = name; } @@ -315,7 +315,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT private final String name = "abx"; - private Abc(){} + private Abc() { } public String getName() { return name; @@ -331,11 +331,11 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT @SuppressWarnings("unused") private final String name = "xyz"; - private Xyz(){} + private Xyz() { } } - public static class Person implements Serializable{ + public static class Person implements Serializable { /** * diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java index b53df566ca..d07705077e 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java @@ -158,7 +158,7 @@ public class ConfigurableMongoDbMessageGroupStoreTests extends AbstractMongoDbMe @Override @SuppressWarnings("unchecked") public Message convert(DBObject source) { - return MessageBuilder.withPayload(source.get("payload")).copyHeaders((Map) source.get("headers")).build(); + return MessageBuilder.withPayload(source.get("payload")).copyHeaders((Map) source.get("headers")).build(); } } diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java index 85f6ef13cd..dac3ce4c9e 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java @@ -190,9 +190,9 @@ public class DefaultMqttPahoClientFactory implements MqttPahoClientFactory { private final boolean retained; - public Will(String topic, byte[] payload, int qos, boolean retained) {//NOSONAR + public Will(String topic, byte[] payload, int qos, boolean retained) { //NOSONAR this.topic = topic; - this.payload = payload;//NOSONAR + this.payload = payload; //NOSONAR this.qos = qos; this.retained = retained; } @@ -202,7 +202,7 @@ public class DefaultMqttPahoClientFactory implements MqttPahoClientFactory { } protected byte[] getPayload() { - return this.payload;//NOSONAR + return this.payload; //NOSONAR } protected int getQos() { diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/AbstractMqttMessageDrivenChannelAdapter.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/AbstractMqttMessageDrivenChannelAdapter.java index e2c03e9e4f..3a1a877d55 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/AbstractMqttMessageDrivenChannelAdapter.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/AbstractMqttMessageDrivenChannelAdapter.java @@ -137,7 +137,7 @@ public abstract class AbstractMqttMessageDrivenChannelAdapter extends MessagePro } @Override - public String getComponentType(){ + public String getComponentType() { return "mqtt:inbound-channel-adapter"; } diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/outbound/AbstractMqttMessageHandler.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/outbound/AbstractMqttMessageHandler.java index 06c5185c65..3a6095bf02 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/outbound/AbstractMqttMessageHandler.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/outbound/AbstractMqttMessageHandler.java @@ -100,7 +100,7 @@ public abstract class AbstractMqttMessageHandler extends AbstractMessageHandler } protected void incrementClientInstance() { - this.clientInstance++;//NOSONAR - false positive - called from synchronized block + this.clientInstance++; //NOSONAR - false positive - called from synchronized block } @Override diff --git a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/BackToBackAdapterTests.java b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/BackToBackAdapterTests.java index 096a39ccce..d2d09aeae8 100644 --- a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/BackToBackAdapterTests.java +++ b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/BackToBackAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -340,7 +340,7 @@ public class BackToBackAdapterTests { if (event instanceof MqttMessageSentEvent) { this.sent = (MqttMessageSentEvent) event; } - else if (event instanceof MqttMessageDeliveredEvent){ + else if (event instanceof MqttMessageDeliveredEvent) { this.delivered = (MqttMessageDeliveredEvent) event; } latch.countDown(); diff --git a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/BrokerRunning.java b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/BrokerRunning.java index 32d879a16c..4b869b4d92 100644 --- a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/BrokerRunning.java +++ b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/BrokerRunning.java @@ -42,7 +42,7 @@ public class BrokerRunning extends TestWatcher { private static Log logger = LogFactory.getLog(BrokerRunning.class); // Static so that we only test once on failure: speeds up test suite - private static Map brokerOnline = new HashMap(); + private static Map brokerOnline = new HashMap(); private final int port; diff --git a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java index 27f7478871..63fc95adee 100644 --- a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java +++ b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java @@ -163,7 +163,7 @@ public class MqttAdapterTests { final MqttToken token = mock(MqttToken.class); final AtomicBoolean connectCalled = new AtomicBoolean(); - doAnswer(new Answer(){ + doAnswer(new Answer() { @Override public MqttToken answer(InvocationOnMock invocation) throws Throwable { diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java index d25b033d26..be32942a11 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java @@ -125,7 +125,7 @@ public class SubscribableRedisChannel extends AbstractMessageChannel implements @Override public void onInit() throws Exception { - if (this.initialized){ + if (this.initialized) { return; } super.onInit(); @@ -133,7 +133,7 @@ public class SubscribableRedisChannel extends AbstractMessageChannel implements Integer maxSubscribers = this.getIntegrationProperty(IntegrationProperties.CHANNELS_MAX_BROADCAST_SUBSCRIBERS, Integer.class); this.setMaxSubscribers(maxSubscribers); } - if (this.messageConverter == null){ + if (this.messageConverter == null) { this.messageConverter = new SimpleMessageConverter(); } if (this.messageConverter instanceof BeanFactoryAware) { diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisStoreInboundChannelAdapterParser.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisStoreInboundChannelAdapterParser.java index 0e73cd3cd7..c176d67507 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisStoreInboundChannelAdapterParser.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisStoreInboundChannelAdapterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -41,11 +41,11 @@ public class RedisStoreInboundChannelAdapterParser extends AbstractPollingInboun BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(RedisStoreMessageSource.class); String redisTemplate = element.getAttribute("redis-template"); String connectionFactory = element.getAttribute("connection-factory"); - if (StringUtils.hasText(redisTemplate) && StringUtils.hasText(connectionFactory)){ + if (StringUtils.hasText(redisTemplate) && StringUtils.hasText(connectionFactory)) { parserContext.getReaderContext().error("Only one of '" + redisTemplate + "' or '" + connectionFactory + "' is allowed.", element); } - if (StringUtils.hasText(redisTemplate)){ + if (StringUtils.hasText(redisTemplate)) { builder.addConstructorArgReference(redisTemplate); } else { diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParser.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParser.java index c902713714..edbfe2c515 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParser.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParser.java @@ -44,11 +44,11 @@ public class RedisStoreOutboundChannelAdapterParser extends AbstractOutboundChan String redisTemplateRef = element.getAttribute("redis-template"); String connectionFactory = element.getAttribute("connection-factory"); - if (StringUtils.hasText(redisTemplateRef) && StringUtils.hasText(connectionFactory)){ + if (StringUtils.hasText(redisTemplateRef) && StringUtils.hasText(connectionFactory)) { parserContext.getReaderContext().error("Only one of 'redis-template' or 'connection-factory'" + " is allowed.", element); } - if (StringUtils.hasText(redisTemplateRef)){ + if (StringUtils.hasText(redisTemplateRef)) { builder.addConstructorArgReference(redisTemplateRef); } else { diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisStoreMessageSource.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisStoreMessageSource.java index d9ee9e27b7..e6539322a3 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisStoreMessageSource.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisStoreMessageSource.java @@ -123,7 +123,7 @@ public class RedisStoreMessageSource extends IntegrationObjectSupport ((IntegrationResourceHolder) holder).addAttribute("store", store); } - if (store instanceof Collection && ((Collection)store).size() < 1){ + if (store instanceof Collection && ((Collection) store).size() < 1) { return null; } else { @@ -131,7 +131,7 @@ public class RedisStoreMessageSource extends IntegrationObjectSupport } } - private RedisStore createStoreView(String key){ + private RedisStore createStoreView(String key) { RedisCollectionFactoryBean fb = new RedisCollectionFactoryBean(); fb.setKey(key); fb.setTemplate(this.redisTemplate); diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/RedisStoreWritingMessageHandler.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/RedisStoreWritingMessageHandler.java index 6db3b2607e..b73c7144cd 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/RedisStoreWritingMessageHandler.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/RedisStoreWritingMessageHandler.java @@ -280,7 +280,7 @@ public class RedisStoreWritingMessageHandler extends AbstractMessageHandler { } @SuppressWarnings("unchecked") - private void writeToZset(RedisZSet zset, final Message message) throws Exception{ + private void writeToZset(RedisZSet zset, final Message message) throws Exception { final Object payload = message.getPayload(); final BoundZSetOperations ops = (BoundZSetOperations) this.redisTemplate.boundZSetOps(zset.getKey()); @@ -305,7 +305,7 @@ public class RedisStoreWritingMessageHandler extends AbstractMessageHandler { this.processInPipeline(new PipelineCallback() { @Override public void process() { - for (Object object : ((Collection)payload)) { + for (Object object : ((Collection) payload)) { incrementOrOverwrite(ops, object, determineScore(message), zsetIncrementHeader); } } @@ -320,8 +320,8 @@ public class RedisStoreWritingMessageHandler extends AbstractMessageHandler { } } - private boolean extractZsetIncrementHeader(Message message){ - if (message.getHeaders().containsKey(RedisHeaders.ZSET_INCREMENT_SCORE)){ + private boolean extractZsetIncrementHeader(Message message) { + if (message.getHeaders().containsKey(RedisHeaders.ZSET_INCREMENT_SCORE)) { return this.zsetIncrementScoreExpression.getValue(this.evaluationContext, message, Boolean.class); } return true; @@ -353,7 +353,7 @@ public class RedisStoreWritingMessageHandler extends AbstractMessageHandler { this.processInPipeline(new PipelineCallback() { @Override public void process() { - for (Object object : ((Collection)payload)) { + for (Object object : ((Collection) payload)) { ops.add(object); } } @@ -445,7 +445,7 @@ public class RedisStoreWritingMessageHandler extends AbstractMessageHandler { } } - private boolean verifyAllMapValuesOfTypeNumber(Map map) { + private boolean verifyAllMapValuesOfTypeNumber(Map map) { for (Object value : map.values()) { if (!(value instanceof Number)) { if (this.logger.isWarnEnabled()) { diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/store/RedisMessageStore.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/store/RedisMessageStore.java index f97cdc69d5..94e7a203d1 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/store/RedisMessageStore.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/store/RedisMessageStore.java @@ -56,7 +56,7 @@ public class RedisMessageStore extends AbstractKeyValueMessageStore { } @Override - protected Object doRetrieve(Object id){ + protected Object doRetrieve(Object id) { Assert.notNull(id, "'id' must not be null"); BoundValueOperations ops = this.redisTemplate.boundValueOps(id); return ops.get(); @@ -83,7 +83,7 @@ public class RedisMessageStore extends AbstractKeyValueMessageStore { protected Object doRemove(Object id) { Assert.notNull(id, "'id' must not be null"); Object removedObject = this.doRetrieve(id); - if (removedObject != null){ + if (removedObject != null) { this.redisTemplate.delete(id); } return removedObject; diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/channel/SubscribableRedisChannelTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/channel/SubscribableRedisChannelTests.java index 6666c6a36b..ae15addc4f 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/channel/SubscribableRedisChannelTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/channel/SubscribableRedisChannelTests.java @@ -83,7 +83,7 @@ public class SubscribableRedisChannelTests extends RedisAvailableTests { @Test @RedisAvailable - public void dispatcherHasNoSubscribersTest() throws Exception{ + public void dispatcherHasNoSubscribersTest() throws Exception { RedisConnectionFactory connectionFactory = this.getConnectionFactoryForTest(); SubscribableRedisChannel channel = new SubscribableRedisChannel(connectionFactory, "si.test.channel.no.subs"); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisChannelParserTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisChannelParserTests.java index f6b0ca0ad8..39b8ca6403 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisChannelParserTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisChannelParserTests.java @@ -49,7 +49,7 @@ public class RedisChannelParserTests extends RedisAvailableTests { @Test @RedisAvailable - public void testPubSubChannelConfig(){ + public void testPubSubChannelConfig() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("RedisChannelParserTests-context.xml", this.getClass()); SubscribableChannel redisChannel = context.getBean("redisChannel", SubscribableChannel.class); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisOutboundChannelAdapterParserTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisOutboundChannelAdapterParserTests.java index 338df671b6..af78bd24e4 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisOutboundChannelAdapterParserTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -90,7 +90,7 @@ public class RedisOutboundChannelAdapterParserTests extends RedisAvailableTests @Test @RedisAvailable - public void testOutboundChannelAdapterMessaging() throws Exception{ + public void testOutboundChannelAdapterMessaging() throws Exception { MessageChannel sendChannel = context.getBean("sendChannel", MessageChannel.class); this.awaitContainerSubscribed(TestUtils.getPropertyValue(fooInbound, "container", RedisMessageListenerContainer.class)); @@ -110,7 +110,7 @@ public class RedisOutboundChannelAdapterParserTests extends RedisAvailableTests @Test //INT-2275 @RedisAvailable - public void testOutboundChannelAdapterWithinChain() throws Exception{ + public void testOutboundChannelAdapterWithinChain() throws Exception { MessageChannel sendChannel = context.getBean("redisOutboudChain", MessageChannel.class); this.awaitContainerSubscribed(TestUtils.getPropertyValue(fooInbound, "container", RedisMessageListenerContainer.class)); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueGatewayIntegrationTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueGatewayIntegrationTests.java index a1bdd35af4..e9d5f52aa2 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueGatewayIntegrationTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueGatewayIntegrationTests.java @@ -92,7 +92,7 @@ public class RedisQueueGatewayIntegrationTests extends RedisAvailableTests { try { this.sendChannel.send(new GenericMessage("test1")); } - catch(Exception e) { + catch (Exception e) { assertTrue(e.getMessage().contains("No reply produced")); } finally { @@ -108,7 +108,7 @@ public class RedisQueueGatewayIntegrationTests extends RedisAvailableTests { try { this.sendChannel.send(new GenericMessage("test1")); } - catch(Exception e) { + catch (Exception e) { assertTrue(e.getMessage().contains("No reply produced")); } finally { diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreInboundChannelAdapterParserTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreInboundChannelAdapterParserTests.java index 149a19a862..740449b76e 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreInboundChannelAdapterParserTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -51,28 +51,28 @@ public class RedisStoreInboundChannelAdapterParserTests { private ApplicationContext context; @Autowired - private RedisTemplate redisTemplate; + private RedisTemplate redisTemplate; @Test - public void validateWithStringTemplate(){ + public void validateWithStringTemplate() { RedisStoreMessageSource withStringTemplate = TestUtils.getPropertyValue(context.getBean("withStringTemplate"), "source", RedisStoreMessageSource.class); - assertEquals("'presidents'", ((SpelExpression)TestUtils.getPropertyValue(withStringTemplate, "keyExpression")).getExpressionString()); - assertEquals("LIST", ((CollectionType)TestUtils.getPropertyValue(withStringTemplate, "collectionType")).toString()); + assertEquals("'presidents'", ((SpelExpression) TestUtils.getPropertyValue(withStringTemplate, "keyExpression")).getExpressionString()); + assertEquals("LIST", ((CollectionType) TestUtils.getPropertyValue(withStringTemplate, "collectionType")).toString()); assertTrue(TestUtils.getPropertyValue(withStringTemplate, "redisTemplate") instanceof StringRedisTemplate); } @Test - public void validateWithExternalTemplate(){ + public void validateWithExternalTemplate() { RedisStoreMessageSource withExternalTemplate = TestUtils.getPropertyValue(context.getBean("withExternalTemplate"), "source", RedisStoreMessageSource.class); - assertEquals("'presidents'", ((SpelExpression)TestUtils.getPropertyValue(withExternalTemplate, "keyExpression")).getExpressionString()); - assertEquals("LIST", ((CollectionType)TestUtils.getPropertyValue(withExternalTemplate, "collectionType")).toString()); + assertEquals("'presidents'", ((SpelExpression) TestUtils.getPropertyValue(withExternalTemplate, "keyExpression")).getExpressionString()); + assertEquals("LIST", ((CollectionType) TestUtils.getPropertyValue(withExternalTemplate, "collectionType")).toString()); assertSame(redisTemplate, TestUtils.getPropertyValue(withExternalTemplate, "redisTemplate")); } - @Test(expected=BeanDefinitionParsingException.class) - public void testTemplateAndCfMutualExclusivity(){ + @Test(expected = BeanDefinitionParsingException.class) + public void testTemplateAndCfMutualExclusivity() { new ClassPathXmlApplicationContext("inbound-template-cf-fail.xml", this.getClass()).close(); } diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java index 7383a457f3..531cc6376d 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java @@ -56,13 +56,13 @@ public class RedisStoreOutboundChannelAdapterParserTests { private ApplicationContext context; @Autowired - private RedisTemplate redisTemplate; + private RedisTemplate redisTemplate; @Test public void validateWithStringTemplate() throws Exception { RedisStoreWritingMessageHandler withStringTemplate = context.getBean("withStringTemplate.handler", RedisStoreWritingMessageHandler.class); - assertEquals("pepboys", ((LiteralExpression)TestUtils.getPropertyValue(withStringTemplate, + assertEquals("pepboys", ((LiteralExpression) TestUtils.getPropertyValue(withStringTemplate, "keyExpression")).getExpressionString()); assertEquals("PROPERTIES", (TestUtils.getPropertyValue(withStringTemplate, "collectionType")).toString()); assertTrue(TestUtils.getPropertyValue(withStringTemplate, "redisTemplate") instanceof StringRedisTemplate); @@ -78,11 +78,11 @@ public class RedisStoreOutboundChannelAdapterParserTests { } @Test - public void validateWithStringObjectTemplate(){ + public void validateWithStringObjectTemplate() { RedisStoreWritingMessageHandler withStringObjectTemplate = TestUtils.getPropertyValue(context.getBean("withStringObjectTemplate.adapter"), "handler", RedisStoreWritingMessageHandler.class); - assertEquals("pepboys", ((LiteralExpression)TestUtils.getPropertyValue(withStringObjectTemplate, + assertEquals("pepboys", ((LiteralExpression) TestUtils.getPropertyValue(withStringObjectTemplate, "keyExpression")).getExpressionString()); assertEquals("PROPERTIES", (TestUtils.getPropertyValue(withStringObjectTemplate, "collectionType")).toString()); assertFalse(TestUtils.getPropertyValue(withStringObjectTemplate, "redisTemplate") instanceof StringRedisTemplate); @@ -97,11 +97,11 @@ public class RedisStoreOutboundChannelAdapterParserTests { } @Test - public void validateWithExternalTemplate(){ + public void validateWithExternalTemplate() { RedisStoreWritingMessageHandler withExternalTemplate = TestUtils.getPropertyValue(context.getBean("withExternalTemplate.adapter"), "handler", RedisStoreWritingMessageHandler.class); - assertEquals("pepboys", ((LiteralExpression)TestUtils.getPropertyValue(withExternalTemplate, + assertEquals("pepboys", ((LiteralExpression) TestUtils.getPropertyValue(withExternalTemplate, "keyExpression")).getExpressionString()); assertEquals("PROPERTIES", (TestUtils.getPropertyValue(withExternalTemplate, "collectionType")).toString()); assertSame(redisTemplate, TestUtils.getPropertyValue(withExternalTemplate, "redisTemplate")); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisInboundChannelAdapterTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisInboundChannelAdapterTests.java index 5c69ad86e8..25fbb9c60d 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisInboundChannelAdapterTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisInboundChannelAdapterTests.java @@ -79,7 +79,7 @@ public class RedisInboundChannelAdapterTests extends RedisAvailableTests { int counter = 0; for (int i = 0; i < numToTest; i++) { Message message = channel.receive(5000); - if (message == null){ + if (message == null) { throw new RuntimeException("Failed to receive message # " + i + " iteration " + iteration); } assertNotNull(message); @@ -112,7 +112,7 @@ public class RedisInboundChannelAdapterTests extends RedisAvailableTests { counter = 0; for (int i = 0; i < numToTest; i++) { Message message = channel.receive(5000); - if (message == null){ + if (message == null) { throw new RuntimeException("Failed to receive message # " + i + " iteration " + iteration); } assertNotNull(message); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/metadata/RedisMetadataStoreTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/metadata/RedisMetadataStoreTests.java index 16bd3b4296..3532e1b8f5 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/metadata/RedisMetadataStoreTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/metadata/RedisMetadataStoreTests.java @@ -62,7 +62,7 @@ public class RedisMetadataStoreTests extends RedisAvailableTests { metadataStore.put("RedisMetadataStoreTests-Spring", "Integration"); StringRedisTemplate redisTemplate = new StringRedisTemplate(jcf); - BoundHashOperations ops = redisTemplate.boundHashOps("testMetadata"); + BoundHashOperations ops = redisTemplate.boundHashOps("testMetadata"); assertEquals("Integration", ops.get("RedisMetadataStoreTests-Spring")); } diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/outbound/RedisStoreWritingMessageHandlerTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/outbound/RedisStoreWritingMessageHandlerTests.java index 0d4846cbca..11cfcdc685 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/outbound/RedisStoreWritingMessageHandlerTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/outbound/RedisStoreWritingMessageHandlerTests.java @@ -56,7 +56,7 @@ import org.springframework.messaging.support.GenericMessage; * @author Mark Fisher * @author Gary Russell */ -public class RedisStoreWritingMessageHandlerTests extends RedisAvailableTests{ +public class RedisStoreWritingMessageHandlerTests extends RedisAvailableTests { @Test @RedisAvailable @@ -121,7 +121,7 @@ public class RedisStoreWritingMessageHandlerTests extends RedisAvailableTests{ } @RedisAvailable - @Test(expected=MessageHandlingException.class) + @Test(expected = MessageHandlingException.class) public void testListWithListPayloadParsedAndNoKey() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); this.deleteKey(jcf, "foo"); @@ -266,7 +266,7 @@ public class RedisStoreWritingMessageHandlerTests extends RedisAvailableTests{ @Test @RedisAvailable - public void testZsetWithListPayloadParsedAndProvidedKeyScoreIncrementAsStringHeader() {// see INT-2775 + public void testZsetWithListPayloadParsedAndProvidedKeyScoreIncrementAsStringHeader() { // see INT-2775 RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); this.deleteKey(jcf, "foo"); String key = "foo"; @@ -468,7 +468,7 @@ public class RedisStoreWritingMessageHandlerTests extends RedisAvailableTests{ this.deletePresidents(jcf); } - @Test(expected=IllegalStateException.class) + @Test(expected = IllegalStateException.class) @RedisAvailable public void testListWithMapKeyExpression() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); @@ -481,7 +481,7 @@ public class RedisStoreWritingMessageHandlerTests extends RedisAvailableTests{ handler.afterPropertiesSet(); } - @Test(expected=IllegalStateException.class) + @Test(expected = IllegalStateException.class) @RedisAvailable public void testSetWithMapKeyExpression() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); @@ -495,7 +495,7 @@ public class RedisStoreWritingMessageHandlerTests extends RedisAvailableTests{ handler.afterPropertiesSet(); } - @Test(expected=IllegalStateException.class) + @Test(expected = IllegalStateException.class) @RedisAvailable public void testZsetWithMapKeyExpression() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); @@ -551,7 +551,7 @@ public class RedisStoreWritingMessageHandlerTests extends RedisAvailableTests{ this.deleteKey(jcf, "foo"); } - private RedisTemplate initTemplate(RedisConnectionFactory rcf, RedisTemplate redisTemplate) { + private RedisTemplate initTemplate(RedisConnectionFactory rcf, RedisTemplate redisTemplate) { redisTemplate.setConnectionFactory(rcf); redisTemplate.setKeySerializer(new StringRedisSerializer()); redisTemplate.afterPropertiesSet(); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/rules/RedisAvailableTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/rules/RedisAvailableTests.java index 9b0db8b3ea..6851a5fce2 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/rules/RedisAvailableTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/rules/RedisAvailableTests.java @@ -112,7 +112,7 @@ public class RedisAvailableTests { } } - protected void prepareList(RedisConnectionFactory connectionFactory){ + protected void prepareList(RedisConnectionFactory connectionFactory) { StringRedisTemplate redisTemplate = createStringRedisTemplate(connectionFactory); redisTemplate.delete("presidents"); @@ -135,7 +135,7 @@ public class RedisAvailableTests { ops.rightPush("George Washington"); } - protected void prepareZset(RedisConnectionFactory connectionFactory){ + protected void prepareZset(RedisConnectionFactory connectionFactory) { StringRedisTemplate redisTemplate = createStringRedisTemplate(connectionFactory); @@ -159,7 +159,7 @@ public class RedisAvailableTests { ops.add("George Washington", 18); } - protected void deletePresidents(RedisConnectionFactory connectionFactory){ + protected void deletePresidents(RedisConnectionFactory connectionFactory) { this.deleteKey(connectionFactory, "presidents"); } diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisChannelMessageStoreTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisChannelMessageStoreTests.java index c2f3e4fa90..fd5a83b273 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisChannelMessageStoreTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisChannelMessageStoreTests.java @@ -138,10 +138,10 @@ public class RedisChannelMessageStoreTests extends RedisAvailableTests { for (int i = 0; i < 10; i++) { Message m = this.testChannel3.receive(0); assertNotNull(m); - assertEquals(Integer.valueOf(9-i), new IntegrationMessageHeaderAccessor(m).getPriority()); + assertEquals(Integer.valueOf(9 - i), new IntegrationMessageHeaderAccessor(m).getPriority()); m = this.testChannel3.receive(0); assertNotNull(m); - assertEquals(Integer.valueOf(9-i), new IntegrationMessageHeaderAccessor(m).getPriority()); + assertEquals(Integer.valueOf(9 - i), new IntegrationMessageHeaderAccessor(m).getPriority()); } Message m = this.testChannel3.receive(0); assertNotNull(m); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisMessageGroupStoreTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisMessageGroupStoreTests.java index 96de064bd0..6aae11810d 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisMessageGroupStoreTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisMessageGroupStoreTests.java @@ -68,7 +68,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testNonExistingEmptyMessageGroup() throws Exception{ + public void testNonExistingEmptyMessageGroup() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -80,7 +80,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exception{ + public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -107,7 +107,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testMessageGroupWithAddedMessage() throws Exception{ + public void testMessageGroupWithAddedMessage() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -125,7 +125,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testRemoveMessageGroup() throws Exception{ + public void testRemoveMessageGroup() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -152,7 +152,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testCompleteMessageGroup() throws Exception{ + public void testCompleteMessageGroup() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -166,7 +166,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testLastReleasedSequenceNumber() throws Exception{ + public void testLastReleasedSequenceNumber() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -180,7 +180,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testRemoveMessageFromTheGroup() throws Exception{ + public void testRemoveMessageFromTheGroup() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -204,7 +204,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testWithMessageHistory() throws Exception{ + public void testWithMessageHistory() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -231,7 +231,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { } @Test @RedisAvailable - public void testRemoveNonExistingMessageFromTheGroup() throws Exception{ + public void testRemoveNonExistingMessageFromTheGroup() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -242,7 +242,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testRemoveNonExistingMessageFromNonExistingTheGroup() throws Exception{ + public void testRemoveNonExistingMessageFromNonExistingTheGroup() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); store.removeMessagesFromGroup(1, new GenericMessage("2")); @@ -252,7 +252,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testMultipleInstancesOfGroupStore() throws Exception{ + public void testMultipleInstancesOfGroupStore() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store1 = new RedisMessageStore(jcf); @@ -274,7 +274,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testIteratorOfMessageGroups() throws Exception{ + public void testIteratorOfMessageGroups() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); RedisMessageStore store1 = new RedisMessageStore(jcf); RedisMessageStore store2 = new RedisMessageStore(jcf); @@ -290,7 +290,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { while (messageGroups.hasNext()) { MessageGroup group = messageGroups.next(); String groupId = (String) group.getGroupId(); - if (groupId.equals("1")){ + if (groupId.equals("1")) { assertEquals(1, group.getMessages().size()); } else if (groupId.equals("2")) { @@ -316,7 +316,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable @Ignore - public void testConcurrentModifications() throws Exception{ + public void testConcurrentModifications() throws Exception { RedisConnectionFactory jcf = getConnectionFactoryForTest(); final RedisMessageStore store1 = new RedisMessageStore(jcf); final RedisMessageStore store2 = new RedisMessageStore(jcf); @@ -334,7 +334,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Override public void run() { MessageGroup group = store1.addMessageToGroup(1, message); - if (group.getMessages().size() != 1){ + if (group.getMessages().size() != 1) { failures.add("ADD"); throw new AssertionFailedError("Failed on ADD"); } @@ -345,7 +345,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { public void run() { store2.removeMessagesFromGroup(1, message); MessageGroup group = store2.getMessageGroup(1); - if (group.getMessages().size() != 0){ + if (group.getMessages().size() != 0) { failures.add("REMOVE"); throw new AssertionFailedError("Failed on Remove"); } @@ -361,7 +361,7 @@ public class RedisMessageGroupStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testWithAggregatorWithShutdown(){ + public void testWithAggregatorWithShutdown() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("redis-aggregator-config.xml", getClass()); MessageChannel input = context.getBean("inputChannel", MessageChannel.class); QueueChannel output = context.getBean("outputChannel", QueueChannel.class); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisMessageStoreTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisMessageStoreTests.java index 93813c8df1..465827429a 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisMessageStoreTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/store/RedisMessageStoreTests.java @@ -58,7 +58,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testGetNonExistingMessage(){ + public void testGetNonExistingMessage() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); Message message = store.getMessage(UUID.randomUUID()); @@ -67,7 +67,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testGetMessageCountWhenEmpty(){ + public void testGetMessageCountWhenEmpty() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); assertEquals(0, store.getMessageCount()); @@ -75,7 +75,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testAddStringMessage(){ + public void testAddStringMessage() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); Message stringMessage = new GenericMessage("Hello Redis"); @@ -86,7 +86,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testAddSerializableObjectMessage(){ + public void testAddSerializableObjectMessage() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); Address address = new Address(); @@ -101,7 +101,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { @Test(expected = IllegalArgumentException.class) @RedisAvailable - public void testAddNonSerializableObjectMessage(){ + public void testAddNonSerializableObjectMessage() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -112,7 +112,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { @SuppressWarnings("unchecked") @Test @RedisAvailable - public void testAddAndGetStringMessage(){ + public void testAddAndGetStringMessage() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); Message stringMessage = new GenericMessage("Hello Redis"); @@ -125,7 +125,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { @SuppressWarnings("unchecked") @Test @RedisAvailable - public void testAddAndRemoveStringMessage(){ + public void testAddAndRemoveStringMessage() { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); Message stringMessage = new GenericMessage("Hello Redis"); @@ -138,7 +138,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { @Test @RedisAvailable - public void testWithMessageHistory() throws Exception{ + public void testWithMessageHistory() throws Exception { RedisConnectionFactory jcf = this.getConnectionFactoryForTest(); RedisMessageStore store = new RedisMessageStore(jcf); @@ -185,7 +185,7 @@ public class RedisMessageStoreTests extends RedisAvailableTests { private String name; - public Person(Address address, String name){ + public Person(Address address, String name) { this.address = address; this.name = name; } diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/util/AggregatorWithRedisLocksTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/util/AggregatorWithRedisLocksTests.java index 9c71ab0bbe..f445a33509 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/util/AggregatorWithRedisLocksTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/util/AggregatorWithRedisLocksTests.java @@ -202,7 +202,7 @@ public class AggregatorWithRedisLocksTests extends RedisAvailableTests { @Override public boolean canRelease(MessageGroup group) { - synchronized(this) { + synchronized (this) { this.callers.incrementAndGet(); this.maxCallers.set(Math.max(this.maxCallers.get(), this.callers.get())); } diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/ScriptExecutor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/ScriptExecutor.java index 43465eec47..9509f2e644 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/ScriptExecutor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/ScriptExecutor.java @@ -37,6 +37,6 @@ public interface ScriptExecutor { * @param variables The variables. * @return The result of the execution. */ - Object executeScript(ScriptSource scriptSource, Map variables); + Object executeScript(ScriptSource scriptSource, Map variables); } diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutor.java index 33792215b4..e6087b6692 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutor.java @@ -41,7 +41,7 @@ import org.springframework.integration.scripting.ScriptExecutor; @Override protected Object postProcess(Object result, ScriptEngine scriptEngine, String script, Bindings bindings) { - Object newResult= result; + Object newResult = result; if (newResult == null) { String returnVariableName = PythonVariableParser.parseReturnVariable(script); if (bindings != null) { @@ -55,9 +55,9 @@ import org.springframework.integration.scripting.ScriptExecutor; } public static class PythonVariableParser { - public static String parseReturnVariable(String script){ + public static String parseReturnVariable(String script) { String[] lines = script.trim().split("\n"); - String lastLine = lines[lines.length -1]; + String lastLine = lines[lines.length - 1]; String[] tokens = lastLine.split("="); return tokens[0].trim(); } diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutingMessageProcessor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutingMessageProcessor.java index a92fd3ff1e..6e86d217a1 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutingMessageProcessor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutingMessageProcessor.java @@ -89,7 +89,7 @@ public class ScriptExecutingMessageProcessor extends AbstractScriptExecutingMess @Override protected Object executeScript(ScriptSource scriptSource, Map variables) throws Exception { Assert.notNull(scriptSource, "scriptSource must not be null"); - return this.scriptExecutor.executeScript(scriptSource,variables); + return this.scriptExecutor.executeScript(scriptSource, variables); } } diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java index dbc30cfd87..b7c769ab55 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java @@ -25,7 +25,7 @@ import org.springframework.integration.scripting.ScriptExecutor; public abstract class ScriptExecutorFactory { public static ScriptExecutor getScriptExecutor(String language) { - if (language.equalsIgnoreCase("python") || language.equalsIgnoreCase("jython")){ + if (language.equalsIgnoreCase("python") || language.equalsIgnoreCase("jython")) { return new PythonScriptExecutor(); } else if (language.equalsIgnoreCase("ruby") || language.equalsIgnoreCase("jruby")) { diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java index 8bf813ea5b..63f30d48e0 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -51,13 +51,13 @@ public class Jsr223HeaderEnricherTests { private QueueChannel outputB; @Test - public void referencedScript() throws Exception{ + public void referencedScript() throws Exception { inputA.send(new GenericMessage("Hello")); assertEquals("jruby", outputA.receive(20000).getHeaders().get("TEST_HEADER")); } @Test - public void inlineScript() throws Exception{ + public void inlineScript() throws Exception { inputB.send(new GenericMessage("Hello")); assertEquals("js", outputB.receive(20000).getHeaders().get("TEST_HEADER")); } diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223RefreshTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223RefreshTests.java index 98577caed9..d9c5dac5a9 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223RefreshTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223RefreshTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -84,7 +84,7 @@ public class Jsr223RefreshTests { } public InputStream getInputStream() throws IOException { - if (++count>scripts.length-1) { + if (++count > scripts.length - 1) { count = 0; } return new ByteArrayInputStream(scripts[count].getBytes()); diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223ServiceActivatorTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223ServiceActivatorTests.java index 1c9debabda..801f1ed105 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223ServiceActivatorTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223ServiceActivatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -82,7 +82,7 @@ public class Jsr223ServiceActivatorTests { // different assertFalse(value1.substring(value1.indexOf(":") + 1, value1.lastIndexOf(":")) .equals(value2.substring(value1.indexOf(":") + 1, value1.lastIndexOf(":")))); - assertFalse(value1.substring(value1.indexOf(":") +1, value1.lastIndexOf(":")) + assertFalse(value1.substring(value1.indexOf(":") + 1, value1.lastIndexOf(":")) .equals(value1.substring(value1.lastIndexOf(":")))); assertFalse(value2.substring(value1.indexOf(":") + 1, value1.lastIndexOf(":")) diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/Jsr223ScriptExecutingMessageProcessorTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/Jsr223ScriptExecutingMessageProcessorTests.java index 17fd6c8401..30db89faa6 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/Jsr223ScriptExecutingMessageProcessorTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/Jsr223ScriptExecutingMessageProcessorTests.java @@ -46,10 +46,10 @@ public class Jsr223ScriptExecutingMessageProcessorTests { executor = ScriptExecutorFactory.getScriptExecutor("jruby"); } @Test - public void testExecuteWithVariables(){ - Map vars = new HashMap(); - vars.put("one",1); - vars.put("two","two"); + public void testExecuteWithVariables() { + Map vars = new HashMap(); + vars.put("one", 1); + vars.put("two", "two"); vars.put("three", 3); ScriptSource scriptSource = new ResourceScriptSource(new ClassPathResource("/org/springframework/integration/scripting/jsr223/print_message.rb")); @@ -61,11 +61,11 @@ public class Jsr223ScriptExecutingMessageProcessorTests { Object obj = messageProcessor.processMessage(message); - assertEquals("hello modified",obj.toString().substring(0,"hello modified".length())); + assertEquals("hello modified", obj.toString().substring(0, "hello modified".length())); } @Test - public void testWithNoVars(){ + public void testWithNoVars() { ScriptSource scriptSource = new ResourceScriptSource(new ClassPathResource("/org/springframework/integration/scripting/jsr223/print_message.rb")); ScriptExecutingMessageProcessor messageProcessor = new ScriptExecutingMessageProcessor(scriptSource, executor); @@ -75,7 +75,7 @@ public class Jsr223ScriptExecutingMessageProcessorTests { Object obj = messageProcessor.processMessage(message); - assertEquals("hello modified",obj.toString().substring(0,"hello modified".length())); + assertEquals("hello modified", obj.toString().substring(0, "hello modified".length())); } } diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutorTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutorTests.java index a2f192abe2..8c6108ddfa 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutorTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutorTests.java @@ -47,23 +47,23 @@ public class PythonScriptExecutorTests { @Test public void testLiteral() { Object obj = executor.executeScript(new StaticScriptSource("3+4") ); - assertEquals(7,obj); + assertEquals(7, obj); obj = executor.executeScript(new StaticScriptSource("'hello,world'") ); - assertEquals("hello,world",obj); + assertEquals("hello,world", obj); } @Test public void test1() { Object obj = executor.executeScript(new StaticScriptSource("x=2") ); - assertEquals(2,obj); + assertEquals(2, obj); } @Test public void test2() { Object obj = executor.executeScript(new StaticScriptSource("def foo(y):\n\tx=y\n\treturn y\nz=foo(2)") ); - assertEquals(2,obj); + assertEquals(2, obj); } @Test @@ -91,9 +91,9 @@ public class PythonScriptExecutorTests { @Test public void testEmbeddedVariable() { - Map variables = new HashMap(); + Map variables = new HashMap(); variables.put("scope", "world"); - Object obj = executor.executeScript(new StaticScriptSource("\"hello, %s\"% scope"),variables); - assertEquals("hello, world",obj); + Object obj = executor.executeScript(new StaticScriptSource("\"hello, %s\"% scope"), variables); + assertEquals("hello, world", obj); } } diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/PythonVariableParserTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/PythonVariableParserTests.java index f0cc12440b..41b2140f3f 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/PythonVariableParserTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/jsr223/PythonVariableParserTests.java @@ -34,10 +34,10 @@ public class PythonVariableParserTests { @Test public void testBasic() throws IOException { String var = PythonScriptExecutor.PythonVariableParser.parseReturnVariable("x=2"); - assertEquals("x",var); + assertEquals("x", var); var = PythonScriptExecutor.PythonVariableParser.parseReturnVariable("\n\n\nx = 2\n\n\n"); - assertEquals("x",var); + assertEquals("x", var); var = PythonScriptExecutor.PythonVariableParser.parseReturnVariable("\n\n\nx\n\n\n"); } @@ -48,6 +48,6 @@ public class PythonVariableParserTests { ScriptSource source = new ResourceScriptSource(new ClassPathResource("/org/springframework/integration/scripting/jsr223/test2.py")); String var = PythonScriptExecutor.PythonVariableParser.parseReturnVariable(source.getScriptAsString()); - assertEquals("bar",var); + assertEquals("bar", var); } } diff --git a/spring-integration-security/src/main/java/org/springframework/integration/security/channel/SecurityContextPropagationChannelInterceptor.java b/spring-integration-security/src/main/java/org/springframework/integration/security/channel/SecurityContextPropagationChannelInterceptor.java index 0364e3feb0..3dbfe97b7f 100644 --- a/spring-integration-security/src/main/java/org/springframework/integration/security/channel/SecurityContextPropagationChannelInterceptor.java +++ b/spring-integration-security/src/main/java/org/springframework/integration/security/channel/SecurityContextPropagationChannelInterceptor.java @@ -85,7 +85,7 @@ public class SecurityContextPropagationChannelInterceptor SecurityContextHolder.setContext(originalContext); } } - catch (Throwable t) {//NOSONAR + catch (Throwable t) { //NOSONAR SecurityContextHolder.clearContext(); } } diff --git a/spring-integration-security/src/main/java/org/springframework/integration/security/config/ChannelSecurityInterceptorBeanPostProcessor.java b/spring-integration-security/src/main/java/org/springframework/integration/security/config/ChannelSecurityInterceptorBeanPostProcessor.java index 9f8fa15c5c..270f944675 100644 --- a/spring-integration-security/src/main/java/org/springframework/integration/security/config/ChannelSecurityInterceptorBeanPostProcessor.java +++ b/spring-integration-security/src/main/java/org/springframework/integration/security/config/ChannelSecurityInterceptorBeanPostProcessor.java @@ -53,8 +53,8 @@ public class ChannelSecurityInterceptorBeanPostProcessor extends AbstractAutoPro public ChannelSecurityInterceptorBeanPostProcessor(Map> securityInterceptorMappings, Map> accessPolicyMapping) { - this.securityInterceptorMappings = securityInterceptorMappings;//NOSONAR (inconsistent sync) - this.accessPolicyMapping = accessPolicyMapping;//NOSONAR (inconsistent sync) + this.securityInterceptorMappings = securityInterceptorMappings; //NOSONAR (inconsistent sync) + this.accessPolicyMapping = accessPolicyMapping; //NOSONAR (inconsistent sync) } @Override diff --git a/spring-integration-security/src/test/java/org/springframework/integration/security/MockAuthenticationManager.java b/spring-integration-security/src/test/java/org/springframework/integration/security/MockAuthenticationManager.java index a8638faf27..9485fe0e66 100644 --- a/spring-integration-security/src/test/java/org/springframework/integration/security/MockAuthenticationManager.java +++ b/spring-integration-security/src/test/java/org/springframework/integration/security/MockAuthenticationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -29,7 +29,7 @@ public class MockAuthenticationManager implements AuthenticationManager { private final boolean grantAccess; - public MockAuthenticationManager(boolean grantAccess){ + public MockAuthenticationManager(boolean grantAccess) { this.grantAccess = grantAccess; } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/gateway/SftpOutboundGateway.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/gateway/SftpOutboundGateway.java index e27d15d8aa..e299e3311d 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/gateway/SftpOutboundGateway.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/gateway/SftpOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -118,7 +118,7 @@ public class SftpOutboundGateway extends AbstractRemoteFileOutboundGateway { this.channel.rename(pathFrom, pathTo); } catch (SftpException sftpex) { - if (this.logger.isDebugEnabled()){ + if (this.logger.isDebugEnabled()) { this.logger.debug("Initial File rename failed, possibly because file already exists. Will attempt to delete file: " + pathTo + " and execute rename again."); } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java index b27be57b78..9248544b53 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -53,12 +53,12 @@ import org.springframework.messaging.PollableChannel; public class InboundChannelAdapterParserTests { @Before - public void prepare(){ + public void prepare() { new File("foo").delete(); } @Test - public void testAutoStartup() throws Exception{ + public void testAutoStartup() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("SftpInboundAutostartup-context.xml", this.getClass()); @@ -68,7 +68,7 @@ public class InboundChannelAdapterParserTests { } @Test - public void testWithLocalFiles() throws Exception{ + public void testWithLocalFiles() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("InboundChannelAdapterParserTests-context.xml", this.getClass()); assertTrue(new File("src/main/resources").exists()); @@ -114,15 +114,15 @@ public class InboundChannelAdapterParserTests { context.close(); } - @Test(expected=BeanDefinitionStoreException.class) + @Test(expected = BeanDefinitionStoreException.class) //exactly one of 'filename-pattern' or 'filter' is allowed on SFTP inbound adapter - public void testFailWithFilePatternAndFilter() throws Exception{ + public void testFailWithFilePatternAndFilter() throws Exception { assertTrue(!new File("target/bar").exists()); new ClassPathXmlApplicationContext("InboundChannelAdapterParserTests-context-fail.xml", this.getClass()).close(); } @Test @Ignore - public void testLocalFilesAreFound() throws Exception{ + public void testLocalFilesAreFound() throws Exception { assertTrue(new File("target").exists()); ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "InboundChannelAdapterParserTests-context.xml", this.getClass()); @@ -131,7 +131,7 @@ public class InboundChannelAdapterParserTests { } @Test - public void testLocalDirAutoCreated() throws Exception{ + public void testLocalDirAutoCreated() throws Exception { assertFalse(new File("foo").exists()); ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "InboundChannelAdapterParserTests-context.xml", this.getClass()); @@ -139,14 +139,14 @@ public class InboundChannelAdapterParserTests { context.close(); } - @Test(expected=BeanCreationException.class) - public void testLocalDirAutoCreateFailed() throws Exception{ + @Test(expected = BeanCreationException.class) + public void testLocalDirAutoCreateFailed() throws Exception { new ClassPathXmlApplicationContext("InboundChannelAdapterParserTests-context-fail-autocreate.xml", this.getClass()).close(); } @After - public void cleanUp() throws Exception{ + public void cleanUp() throws Exception { new File("foo").delete(); } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests.java index d050577f06..4667ff6625 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -60,14 +60,14 @@ public class OutboundChannelAdapterParserTests { private static volatile int adviceCalled; @Test - public void testOutboundChannelAdapterWithId(){ + public void testOutboundChannelAdapterWithId() { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("OutboundChannelAdapterParserTests-context.xml", this.getClass()); Object consumer = context.getBean("sftpOutboundAdapter"); assertTrue(consumer instanceof EventDrivenConsumer); PublishSubscribeChannel channel = context.getBean("inputChannel", PublishSubscribeChannel.class); assertEquals(channel, TestUtils.getPropertyValue(consumer, "inputChannel")); - assertEquals("sftpOutboundAdapter", ((EventDrivenConsumer)consumer).getComponentName()); + assertEquals("sftpOutboundAdapter", ((EventDrivenConsumer) consumer).getComponentName()); FileTransferringMessageHandler handler = TestUtils.getPropertyValue(consumer, "handler", FileTransferringMessageHandler.class); String remoteFileSeparator = (String) TestUtils.getPropertyValue(handler, @@ -106,13 +106,13 @@ public class OutboundChannelAdapterParserTests { } @Test - public void testOutboundChannelAdapterWithWithRemoteDirectoryAndFileExpression(){ + public void testOutboundChannelAdapterWithWithRemoteDirectoryAndFileExpression() { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("OutboundChannelAdapterParserTests-context.xml", this.getClass()); Object consumer = context.getBean("sftpOutboundAdapterWithExpression"); assertTrue(consumer instanceof EventDrivenConsumer); assertEquals(context.getBean("inputChannel"), TestUtils.getPropertyValue(consumer, "inputChannel")); - assertEquals("sftpOutboundAdapterWithExpression", ((EventDrivenConsumer)consumer).getComponentName()); + assertEquals("sftpOutboundAdapterWithExpression", ((EventDrivenConsumer) consumer).getComponentName()); FileTransferringMessageHandler handler = TestUtils.getPropertyValue(consumer, "handler", FileTransferringMessageHandler.class); SpelExpression remoteDirectoryExpression = (SpelExpression) TestUtils.getPropertyValue(handler, "remoteFileTemplate.directoryExpressionProcessor.expression"); assertNotNull(remoteDirectoryExpression); @@ -127,17 +127,17 @@ public class OutboundChannelAdapterParserTests { } @Test - public void testOutboundChannelAdapterWithNoTemporaryFileName(){ + public void testOutboundChannelAdapterWithNoTemporaryFileName() { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("OutboundChannelAdapterParserTests-context.xml", this.getClass()); Object consumer = context.getBean("sftpOutboundAdapterWithNoTemporaryFileName"); FileTransferringMessageHandler handler = TestUtils.getPropertyValue(consumer, "handler", FileTransferringMessageHandler.class); - assertFalse((Boolean)TestUtils.getPropertyValue(handler,"remoteFileTemplate.useTemporaryFileName")); + assertFalse((Boolean) TestUtils.getPropertyValue(handler, "remoteFileTemplate.useTemporaryFileName")); context.close(); } @Test - public void advised(){ + public void advised() { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("OutboundChannelAdapterParserTests-context.xml", this.getClass()); Object consumer = context.getBean("advised"); @@ -148,7 +148,7 @@ public class OutboundChannelAdapterParserTests { } @Test - public void testFailWithRemoteDirAndExpression(){ + public void testFailWithRemoteDirAndExpression() { try { new ClassPathXmlApplicationContext("OutboundChannelAdapterParserTests-context-fail.xml", this.getClass()) .close(); @@ -160,8 +160,8 @@ public class OutboundChannelAdapterParserTests { } - @Test(expected=BeanDefinitionStoreException.class) - public void testFailWithFileExpressionAndFileGenerator(){ + @Test(expected = BeanDefinitionStoreException.class) + public void testFailWithFileExpressionAndFileGenerator() { new ClassPathXmlApplicationContext("OutboundChannelAdapterParserTests-context-fail-fileFileGen.xml", this.getClass()).close(); } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java index c765479cee..9590c8d948 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java @@ -37,21 +37,21 @@ public class SftpInboundOutboundSanitySample { @Test @Ignore - public void testInbound() throws Exception{ + public void testInbound() throws Exception { File fileA = new File("local-test-dir/a.test"); - if (fileA.exists()){ + if (fileA.exists()) { fileA.delete(); } File fileB = new File("local-test-dir/b.test"); - if (fileB.exists()){ + if (fileB.exists()) { fileB.delete(); } fileA = new File("remote-target-dir/a.test-foo"); - if (fileA.exists()){ + if (fileA.exists()) { fileA.delete(); } fileB = new File("remote-target-dir/b.test-foo"); - if (fileB.exists()){ + if (fileB.exists()) { fileB.delete(); } @@ -65,7 +65,7 @@ public class SftpInboundOutboundSanitySample { @Test @Ignore - public void testOutbound() throws Exception{ + public void testOutbound() throws Exception { ApplicationContext ac = new ClassPathXmlApplicationContext("SftpOutboundTransferSample-ignored.xml", this.getClass()); File fileA = new File("local-test-dir/a.test"); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpMessageHistoryTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpMessageHistoryTests.java index 3a95cf382b..484ae8f252 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpMessageHistoryTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpMessageHistoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -30,7 +30,7 @@ import org.springframework.integration.endpoint.SourcePollingChannelAdapter; public class SftpMessageHistoryTests { @Test - public void testMessageHistoryCompliance(){ + public void testMessageHistoryCompliance() { ApplicationContext ac = new ClassPathXmlApplicationContext("MessageHistory-context.xml", SftpMessageHistoryTests.class); SourcePollingChannelAdapter spca = ac.getBean("sftpAdapter", SourcePollingChannelAdapter.class); assertEquals("sftpAdapter", spca.getComponentName()); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java index 6f443e4fc8..7cba632c54 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java @@ -34,12 +34,12 @@ public class SftpOutboundTransferSample { @Test @Ignore - public void testOutbound() throws Exception{ + public void testOutbound() throws Exception { ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("SftpOutboundTransferSample-ignored.xml", SftpOutboundTransferSample.class); ac.start(); File file = new File("/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-sftp/local-test-dir/foo.txt"); - if (file.exists()){ + if (file.exists()) { Message message = MessageBuilder.withPayload(file).build(); MessageChannel inputChannel = ac.getBean("inputChannel", MessageChannel.class); inputChannel.send(message); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java index 39c32d2540..212645ca7a 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -72,9 +72,9 @@ public class SftpInboundRemoteFileSystemSynchronizerTests { @Before @After - public void cleanup(){ + public void cleanup() { File file = new File("test"); - if (file.exists()){ + if (file.exists()) { String[] files = file.list(); for (String fileName : files) { new File(file, fileName).delete(); @@ -186,7 +186,7 @@ public class SftpInboundRemoteFileSystemSynchronizerTests { String[] files = new File("remote-test-dir").list(); for (String fileName : files) { - when(channel.get("remote-test-dir/"+fileName)) + when(channel.get("remote-test-dir/" + fileName)) .thenReturn(new FileInputStream("remote-test-dir/" + fileName)); } when(channel.ls("remote-test-dir")).thenReturn(sftpEntries); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpOutboundTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpOutboundTests.java index 4b0b9ed45b..f898179b68 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpOutboundTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpOutboundTests.java @@ -109,7 +109,7 @@ public class SftpOutboundTests { @Test public void testHandleStringMessage() throws Exception { File file = new File("remote-target-dir", "foo.txt"); - if (file.exists()){ + if (file.exists()) { file.delete(); } SessionFactory sessionFactory = new TestSftpSessionFactory(); @@ -132,7 +132,7 @@ public class SftpOutboundTests { @Test public void testHandleBytesMessage() throws Exception { File file = new File("remote-target-dir", "foo.txt"); - if (file.exists()){ + if (file.exists()) { file.delete(); } SessionFactory sessionFactory = new TestSftpSessionFactory(); @@ -384,9 +384,9 @@ public class SftpOutboundTests { @Override public Object answer(InvocationOnMock invocation) throws Throwable { - File file = new File((String)invocation.getArguments()[1]); + File file = new File((String) invocation.getArguments()[1]); assertTrue(file.getName().endsWith(".writing")); - FileCopyUtils.copy((InputStream)invocation.getArguments()[0], new FileOutputStream(file)); + FileCopyUtils.copy((InputStream) invocation.getArguments()[0], new FileOutputStream(file)); return null; } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java index 3719af84cc..c8f1d4933e 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpRemoteFileTemplateTests.java @@ -52,7 +52,7 @@ import com.jcraft.jsch.SftpException; * @since 4.1 * */ -@ContextConfiguration(classes=TestSftpServerConfig.class) +@ContextConfiguration(classes = TestSftpServerConfig.class) @RunWith(SpringJUnit4ClassRunner.class) @DirtiesContext public class SftpRemoteFileTemplateTests { diff --git a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/support/StompHeaderMapper.java b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/support/StompHeaderMapper.java index 8c9f111795..97a719a61d 100644 --- a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/support/StompHeaderMapper.java +++ b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/support/StompHeaderMapper.java @@ -78,7 +78,7 @@ public class StompHeaderMapper implements HeaderMapper { private volatile String[] outboundHeaderNames = STOMP_OUTBOUND_HEADER_NAMES; - public void setInboundHeaderNames(String[] inboundHeaderNames) {//NOSONAR - false positive + public void setInboundHeaderNames(String[] inboundHeaderNames) { //NOSONAR - false positive Assert.notNull(inboundHeaderNames, "'inboundHeaderNames' must not be null."); Assert.noNullElements(inboundHeaderNames, "'inboundHeaderNames' must not contains null elements."); Arrays.sort(inboundHeaderNames); @@ -87,7 +87,7 @@ public class StompHeaderMapper implements HeaderMapper { } } - public void setOutboundHeaderNames(String[] outboundHeaderNames) {//NOSONAR - false positive + public void setOutboundHeaderNames(String[] outboundHeaderNames) { //NOSONAR - false positive Assert.notNull(outboundHeaderNames, "'outboundHeaderNames' must not be null."); Assert.noNullElements(outboundHeaderNames, "'outboundHeaderNames' must not contains null elements."); Arrays.sort(outboundHeaderNames); diff --git a/spring-integration-stream/src/main/java/org/springframework/integration/stream/ByteStreamWritingMessageHandler.java b/spring-integration-stream/src/main/java/org/springframework/integration/stream/ByteStreamWritingMessageHandler.java index 5cded4fbb9..81b71ff3ea 100644 --- a/spring-integration-stream/src/main/java/org/springframework/integration/stream/ByteStreamWritingMessageHandler.java +++ b/spring-integration-stream/src/main/java/org/springframework/integration/stream/ByteStreamWritingMessageHandler.java @@ -71,7 +71,7 @@ public class ByteStreamWritingMessageHandler extends AbstractMessageHandler { if (payload instanceof String) { this.stream.write(((String) payload).getBytes()); } - else if (payload instanceof byte[]){ + else if (payload instanceof byte[]) { this.stream.write((byte[]) payload); } else { diff --git a/spring-integration-stream/src/test/java/org/springframework/integration/stream/ByteStreamSourceTests.java b/spring-integration-stream/src/test/java/org/springframework/integration/stream/ByteStreamSourceTests.java index dcf5a81772..d8faf4678c 100644 --- a/spring-integration-stream/src/test/java/org/springframework/integration/stream/ByteStreamSourceTests.java +++ b/spring-integration-stream/src/test/java/org/springframework/integration/stream/ByteStreamSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -32,7 +32,7 @@ public class ByteStreamSourceTests { @Test public void testEndOfStream() { - byte[] bytes = new byte[] {1,2,3}; + byte[] bytes = new byte[] {1, 2, 3}; ByteArrayInputStream stream = new ByteArrayInputStream(bytes); ByteStreamReadingMessageSource source = new ByteStreamReadingMessageSource(stream); Message message1 = source.receive(); @@ -47,7 +47,7 @@ public class ByteStreamSourceTests { @Test public void testByteArrayIsTruncated() { - byte[] bytes = new byte[] {0,1,2,3,4,5}; + byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5}; ByteArrayInputStream stream = new ByteArrayInputStream(bytes); ByteStreamReadingMessageSource source = new ByteStreamReadingMessageSource(stream); source.setBytesPerMessage(4); @@ -61,7 +61,7 @@ public class ByteStreamSourceTests { @Test public void testByteArrayIsNotTruncated() { - byte[] bytes = new byte[] {0,1,2,3,4,5}; + byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5}; ByteArrayInputStream stream = new ByteArrayInputStream(bytes); ByteStreamReadingMessageSource source = new ByteStreamReadingMessageSource(stream); source.setBytesPerMessage(4); diff --git a/spring-integration-stream/src/test/java/org/springframework/integration/stream/ByteStreamWritingMessageHandlerTests.java b/spring-integration-stream/src/test/java/org/springframework/integration/stream/ByteStreamWritingMessageHandlerTests.java index ecd5fbf948..e41c68305e 100644 --- a/spring-integration-stream/src/test/java/org/springframework/integration/stream/ByteStreamWritingMessageHandlerTests.java +++ b/spring-integration-stream/src/test/java/org/springframework/integration/stream/ByteStreamWritingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -78,7 +78,7 @@ public class ByteStreamWritingMessageHandlerTests { @Test public void singleByteArray() { - handler.handleMessage(new GenericMessage(new byte[] {1,2,3})); + handler.handleMessage(new GenericMessage(new byte[] {1, 2, 3})); byte[] result = stream.toByteArray(); assertEquals(3, result.length); assertEquals(1, result[0]); @@ -98,9 +98,9 @@ public class ByteStreamWritingMessageHandlerTests { public void maxMessagesPerTaskSameAsMessageCount() { endpoint.setTrigger(trigger); endpoint.setMaxMessagesPerPoll(3); - channel.send(new GenericMessage(new byte[] {1,2,3}), 0); - channel.send(new GenericMessage(new byte[] {4,5,6}), 0); - channel.send(new GenericMessage(new byte[] {7,8,9}), 0); + channel.send(new GenericMessage(new byte[] {1, 2, 3}), 0); + channel.send(new GenericMessage(new byte[] {4, 5, 6}), 0); + channel.send(new GenericMessage(new byte[] {7, 8, 9}), 0); endpoint.start(); trigger.await(); endpoint.stop(); @@ -114,9 +114,9 @@ public class ByteStreamWritingMessageHandlerTests { public void maxMessagesPerTaskLessThanMessageCount() { endpoint.setTrigger(trigger); endpoint.setMaxMessagesPerPoll(2); - channel.send(new GenericMessage(new byte[] {1,2,3}), 0); - channel.send(new GenericMessage(new byte[] {4,5,6}), 0); - channel.send(new GenericMessage(new byte[] {7,8,9}), 0); + channel.send(new GenericMessage(new byte[] {1, 2, 3}), 0); + channel.send(new GenericMessage(new byte[] {4, 5, 6}), 0); + channel.send(new GenericMessage(new byte[] {7, 8, 9}), 0); endpoint.start(); trigger.await(); endpoint.stop(); @@ -130,9 +130,9 @@ public class ByteStreamWritingMessageHandlerTests { endpoint.setTrigger(trigger); endpoint.setMaxMessagesPerPoll(5); endpoint.setReceiveTimeout(0); - channel.send(new GenericMessage(new byte[] {1,2,3}), 0); - channel.send(new GenericMessage(new byte[] {4,5,6}), 0); - channel.send(new GenericMessage(new byte[] {7,8,9}), 0); + channel.send(new GenericMessage(new byte[] {1, 2, 3}), 0); + channel.send(new GenericMessage(new byte[] {4, 5, 6}), 0); + channel.send(new GenericMessage(new byte[] {7, 8, 9}), 0); endpoint.start(); trigger.await(); endpoint.stop(); @@ -146,9 +146,9 @@ public class ByteStreamWritingMessageHandlerTests { endpoint.setTrigger(trigger); endpoint.setMaxMessagesPerPoll(2); endpoint.setReceiveTimeout(0); - channel.send(new GenericMessage(new byte[] {1,2,3}), 0); - channel.send(new GenericMessage(new byte[] {4,5,6}), 0); - channel.send(new GenericMessage(new byte[] {7,8,9}), 0); + channel.send(new GenericMessage(new byte[] {1, 2, 3}), 0); + channel.send(new GenericMessage(new byte[] {4, 5, 6}), 0); + channel.send(new GenericMessage(new byte[] {7, 8, 9}), 0); endpoint.start(); trigger.await(); endpoint.stop(); @@ -170,9 +170,9 @@ public class ByteStreamWritingMessageHandlerTests { endpoint.setTrigger(trigger); endpoint.setMaxMessagesPerPoll(5); endpoint.setReceiveTimeout(0); - channel.send(new GenericMessage(new byte[] {1,2,3}), 0); - channel.send(new GenericMessage(new byte[] {4,5,6}), 0); - channel.send(new GenericMessage(new byte[] {7,8,9}), 0); + channel.send(new GenericMessage(new byte[] {1, 2, 3}), 0); + channel.send(new GenericMessage(new byte[] {4, 5, 6}), 0); + channel.send(new GenericMessage(new byte[] {7, 8, 9}), 0); endpoint.start(); trigger.await(); endpoint.stop(); @@ -193,9 +193,9 @@ public class ByteStreamWritingMessageHandlerTests { endpoint.setMaxMessagesPerPoll(2); endpoint.setTrigger(trigger); endpoint.setReceiveTimeout(0); - channel.send(new GenericMessage(new byte[] {1,2,3}), 0); - channel.send(new GenericMessage(new byte[] {4,5,6}), 0); - channel.send(new GenericMessage(new byte[] {7,8,9}), 0); + channel.send(new GenericMessage(new byte[] {1, 2, 3}), 0); + channel.send(new GenericMessage(new byte[] {4, 5, 6}), 0); + channel.send(new GenericMessage(new byte[] {7, 8, 9}), 0); endpoint.start(); trigger.await(); endpoint.stop(); @@ -216,9 +216,9 @@ public class ByteStreamWritingMessageHandlerTests { endpoint.setTrigger(trigger); endpoint.setMaxMessagesPerPoll(2); endpoint.setReceiveTimeout(0); - channel.send(new GenericMessage(new byte[] {1,2,3}), 0); - channel.send(new GenericMessage(new byte[] {4,5,6}), 0); - channel.send(new GenericMessage(new byte[] {7,8,9}), 0); + channel.send(new GenericMessage(new byte[] {1, 2, 3}), 0); + channel.send(new GenericMessage(new byte[] {4, 5, 6}), 0); + channel.send(new GenericMessage(new byte[] {7, 8, 9}), 0); endpoint.start(); trigger.await(); endpoint.stop(); diff --git a/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java b/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java index 4582f8fa2c..6b2baa07fe 100644 --- a/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java +++ b/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -60,7 +60,7 @@ public class ConsoleInboundChannelAdapterParserTests { assertTrue(source instanceof NamedComponent); assertEquals("adapterWithDefaultCharset.adapter", adapter.getComponentName()); assertEquals("stream:stdin-channel-adapter(character)", adapter.getComponentType()); - assertEquals("stream:stdin-channel-adapter(character)", ((NamedComponent)source).getComponentType()); + assertEquals("stream:stdin-channel-adapter(character)", ((NamedComponent) source).getComponentType()); DirectFieldAccessor sourceAccessor = new DirectFieldAccessor(source); Reader bufferedReader = (Reader) sourceAccessor.getPropertyValue("reader"); assertEquals(BufferedReader.class, bufferedReader.getClass()); diff --git a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java index 85e50056cc..dbe95767d2 100644 --- a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java +++ b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java @@ -89,7 +89,7 @@ public class RFC5424SyslogParser { Object structuredData = getStructuredData(r); String message; - if(r.is(SPACE)) { + if (r.is(SPACE)) { r.getc(); message = r.rest(); } @@ -133,12 +133,12 @@ public class RFC5424SyslogParser { map.put(SyslogHeaders.UNDECODED, line); } } - catch(IllegalStateException e) { + catch (IllegalStateException e) { map.put(SyslogHeaders.DECODE_ERRORS, "true"); map.put(SyslogHeaders.ERRORS, e.getMessage()); map.put(SyslogHeaders.UNDECODED, line); } - catch(StringIndexOutOfBoundsException sob) { + catch (StringIndexOutOfBoundsException sob) { map.put(SyslogHeaders.DECODE_ERRORS, "true"); map.put(SyslogHeaders.ERRORS, "Unexpected end of message: " + sob.getMessage()); map.put(SyslogHeaders.UNDECODED, line); @@ -155,11 +155,11 @@ public class RFC5424SyslogParser { int c = r.getc(); - if(c == NILVALUE) { + if (c == NILVALUE) { return null; } - if(!Character.isDigit(c)) { + if (!Character.isDigit(c)) { throw new IllegalStateException("Year expected @" + r.idx); } @@ -173,7 +173,7 @@ public class RFC5424SyslogParser { } private Object getStructuredData(Reader r) { - if(r.is(NILVALUE)) { + if (r.is(NILVALUE)) { r.getc(); return null; } @@ -354,28 +354,28 @@ public class RFC5424SyslogParser { } public static Severity parseInt(int syslogSeverity) { - if(syslogSeverity == 7) { + if (syslogSeverity == 7) { return DEBUG; } - if(syslogSeverity == 6) { + if (syslogSeverity == 6) { return INFO; } - if(syslogSeverity == 5) { + if (syslogSeverity == 5) { return NOTICE; } - if(syslogSeverity == 4) { + if (syslogSeverity == 4) { return WARN; } - if(syslogSeverity == 3) { + if (syslogSeverity == 3) { return ERROR; } - if(syslogSeverity == 2) { + if (syslogSeverity == 2) { return CRITICAL; } - if(syslogSeverity == 1) { + if (syslogSeverity == 1) { return ALERT; } - if(syslogSeverity == 0) { + if (syslogSeverity == 0) { return EMERGENCY; } return UNDEFINED; diff --git a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterFactoryBean.java b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterFactoryBean.java index 3483fa8e63..82298c46ef 100644 --- a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterFactoryBean.java +++ b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterFactoryBean.java @@ -183,7 +183,7 @@ public class SyslogReceivingChannelAdapterFactoryBean extends AbstractFactoryBea } Assert.isNull(this.udpAdapter, "Cannot specifiy 'udp-attributes' when the protocol is 'tcp'"); } - else if(this.protocol == Protocol.udp) { + else if (this.protocol == Protocol.udp) { adapter = new UdpSyslogReceivingChannelAdapter(); if (this.udpAdapter != null) { Assert.isNull(this.port, "Cannot specify both 'port' and 'udpAdapter'"); diff --git a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/inbound/RFC6587SyslogDeserializer.java b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/inbound/RFC6587SyslogDeserializer.java index 2e2f12bb03..1345ebe0d5 100644 --- a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/inbound/RFC6587SyslogDeserializer.java +++ b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/inbound/RFC6587SyslogDeserializer.java @@ -108,7 +108,7 @@ public class RFC6587SyslogDeserializer implements Deserializer> { int length = peek & 0xf; int c; while (isDigit((c = stream.read()))) { - length = length*10 + (c & 0xf); + length = length * 10 + (c & 0xf); } return length; } diff --git a/spring-integration-syslog/src/test/java/org/springframework/integration/syslog/inbound/SyslogReceivingChannelAdapterTests.java b/spring-integration-syslog/src/test/java/org/springframework/integration/syslog/inbound/SyslogReceivingChannelAdapterTests.java index 13c3f1184a..117341d087 100644 --- a/spring-integration-syslog/src/test/java/org/springframework/integration/syslog/inbound/SyslogReceivingChannelAdapterTests.java +++ b/spring-integration-syslog/src/test/java/org/springframework/integration/syslog/inbound/SyslogReceivingChannelAdapterTests.java @@ -197,7 +197,7 @@ public class SyslogReceivingChannelAdapterTests { Log logger = spy(TestUtils.getPropertyValue(adapter, "logger", Log.class)); doReturn(true).when(logger).isDebugEnabled(); final CountDownLatch sawLog = new CountDownLatch(1); - doAnswer(new Answer(){ + doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/matcher/EventuallyMatcher.java b/spring-integration-test/src/main/java/org/springframework/integration/test/matcher/EventuallyMatcher.java index fba5c6cb53..3b241cd2c5 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/matcher/EventuallyMatcher.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/matcher/EventuallyMatcher.java @@ -50,7 +50,7 @@ public class EventuallyMatcher extends DiagnosingMatcher { } public static Matcher eventually(int nbAttempts, int pause, Matcher delegate) { - return new EventuallyMatcher(delegate,nbAttempts,pause); + return new EventuallyMatcher(delegate, nbAttempts, pause); } public static Matcher eventually(Matcher delegate) { diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/support/AbstractRequestResponseScenarioTests.java b/spring-integration-test/src/main/java/org/springframework/integration/test/support/AbstractRequestResponseScenarioTests.java index 0fecf9431f..e405b14566 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/support/AbstractRequestResponseScenarioTests.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/support/AbstractRequestResponseScenarioTests.java @@ -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()); } } diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/support/AbstractResponseValidator.java b/spring-integration-test/src/main/java/org/springframework/integration/test/support/AbstractResponseValidator.java index 5fcc7f1cae..17b3593547 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/support/AbstractResponseValidator.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/support/AbstractResponseValidator.java @@ -35,7 +35,7 @@ public abstract class AbstractResponseValidator 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 )); } /** diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/support/LongRunningIntegrationTest.java b/spring-integration-test/src/main/java/org/springframework/integration/test/support/LongRunningIntegrationTest.java index 9757b0dc85..51724a1975 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/support/LongRunningIntegrationTest.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/support/LongRunningIntegrationTest.java @@ -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; diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/support/MessageValidator.java b/spring-integration-test/src/main/java/org/springframework/integration/test/support/MessageValidator.java index 23ecb2e531..2223c54865 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/support/MessageValidator.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/support/MessageValidator.java @@ -27,12 +27,12 @@ import org.springframework.messaging.Message; public abstract class MessageValidator extends AbstractResponseValidator> { @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); } diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/support/PayloadValidator.java b/spring-integration-test/src/main/java/org/springframework/integration/test/support/PayloadValidator.java index 83a4f9933a..b11a1204c1 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/support/PayloadValidator.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/support/PayloadValidator.java @@ -22,7 +22,7 @@ package org.springframework.integration.test.support; * */ public abstract class PayloadValidator extends AbstractResponseValidator { - protected final boolean extractPayload(){ + protected final boolean extractPayload() { return true; } } diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/support/RequestResponseScenario.java b/spring-integration-test/src/main/java/org/springframework/integration/test/support/RequestResponseScenario.java index 7ecbfd6b49..b0cec5e8fb 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/support/RequestResponseScenario.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/support/RequestResponseScenario.java @@ -34,8 +34,8 @@ public class RequestResponseScenario { private AbstractResponseValidator responseValidator; private String name; - protected Message getMessage(){ - if (message == null){ + protected Message getMessage() { + if (message == null) { return new GenericMessage(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"); } } diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/util/TestUtils.java b/spring-integration-test/src/main/java/org/springframework/integration/test/util/TestUtils.java index dce72e89b0..b89997a048 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/util/TestUtils.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/util/TestUtils.java @@ -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); diff --git a/spring-integration-test/src/test/java/org/springframework/integration/test/matcher/PayloadMatcherTests.java b/spring-integration-test/src/test/java/org/springframework/integration/test/matcher/PayloadMatcherTests.java index 276e5a0cef..98089497ae 100644 --- a/spring-integration-test/src/test/java/org/springframework/integration/test/matcher/PayloadMatcherTests.java +++ b/spring-integration-test/src/test/java/org/springframework/integration/test/matcher/PayloadMatcherTests.java @@ -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: ")); } } diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/TwitterInboundChannelAdapterParser.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/TwitterInboundChannelAdapterParser.java index 360f9c0308..72988be438 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/TwitterInboundChannelAdapterParser.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/TwitterInboundChannelAdapterParser.java @@ -63,7 +63,7 @@ public class TwitterInboundChannelAdapterParser extends AbstractPollingInboundCh else if ("mentions-inbound-channel-adapter".equals(elementName)) { clazz = MentionsReceivingMessageSource.class; } - else if ("search-inbound-channel-adapter".equals(elementName)){ + else if ("search-inbound-channel-adapter".equals(elementName)) { clazz = SearchReceivingMessageSource.class; } else { diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterHeaders.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterHeaders.java index 9e480166bb..4fdd928c20 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterHeaders.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterHeaders.java @@ -32,6 +32,6 @@ public final class TwitterHeaders { public static final String SEARCH_METADATA = PREFIX + "searchMetadata"; - private TwitterHeaders() {} + private TwitterHeaders() { } } diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractTwitterMessageSource.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractTwitterMessageSource.java index 980e4342ee..df1e766dc8 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractTwitterMessageSource.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractTwitterMessageSource.java @@ -86,7 +86,7 @@ abstract class AbstractTwitterMessageSource extends IntegrationObjectSupport Assert.notNull(twitter, "twitter must not be null"); Assert.notNull(metadataKey, "metadataKey must not be null"); this.twitter = twitter; - if (this.twitter.isAuthorized()){ + if (this.twitter.isAuthorized()) { UserOperations userOperations = this.twitter.userOperations(); String profileId = String.valueOf(userOperations.getProfileId()); if (profileId != null) { @@ -220,9 +220,9 @@ abstract class AbstractTwitterMessageSource extends IntegrationObjectSupport /** * Remove the metadata key and the corresponding value from the Metadata Store. */ - @ManagedOperation(description="Remove the metadata key and the corresponding value from the Metadata Store.") + @ManagedOperation(description = "Remove the metadata key and the corresponding value from the Metadata Store.") void resetMetadataStore() { - synchronized(this) { + synchronized (this) { this.metadataStore.remove(this.metadataKey); this.lastProcessedId = -1L; this.lastEnqueuedId = -1L; diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSearchReceivingMessageSourceParserTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSearchReceivingMessageSourceParserTests.java index 6213856251..a7ebd3348f 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSearchReceivingMessageSourceParserTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSearchReceivingMessageSourceParserTests.java @@ -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. @@ -36,7 +36,7 @@ import org.springframework.social.twitter.api.Twitter; public class TestSearchReceivingMessageSourceParserTests { @Test - public void testSearchReceivingDefaultTemplate(){ + public void testSearchReceivingDefaultTemplate() { ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext( "TestSearchReceivingMessageSourceParser-context.xml", this.getClass()); SourcePollingChannelAdapter spca = ac.getBean("searchAdapterWithTemplate", SourcePollingChannelAdapter.class); diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParserTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParserTests.java index 45d4a5ad14..b2a3492628 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParserTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParserTests.java @@ -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. @@ -47,7 +47,7 @@ public class TestSendingMessageHandlerParserTests { private static volatile int adviceCalled; @Test - public void testSendingMessageHandlerSuccessfulBootstrap(){ + public void testSendingMessageHandlerSuccessfulBootstrap() { ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext( "TestSendingMessageHandlerParser-context.xml", this.getClass()); EventDrivenConsumer dmAdapter = ac.getBean("dmAdapter", EventDrivenConsumer.class); diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TestReceivingUsingNamespace.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TestReceivingUsingNamespace.java index 8d6b11f207..4bb221d1c8 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TestReceivingUsingNamespace.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TestReceivingUsingNamespace.java @@ -37,7 +37,7 @@ public class TestReceivingUsingNamespace { /* * In order to run this test you need to provide oauth properties in sample.properties on the classpath. */ - public void testUpdatesWithRealTwitter() throws Exception{ + public void testUpdatesWithRealTwitter() throws Exception { CountDownLatch latch = new CountDownLatch(1); ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("TestReceivingUsingNamespace-context.xml", this.getClass()); diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TestSearchOutboundGateway.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TestSearchOutboundGateway.java index 99049e64d9..763aacff59 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TestSearchOutboundGateway.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TestSearchOutboundGateway.java @@ -38,7 +38,7 @@ public class TestSearchOutboundGateway { /* * In order to run this test you need to provide oauth properties in sample.properties on the classpath. */ - public void testSearch() throws Exception{ + public void testSearch() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("TestSearchOutboundGateway-context.xml", this.getClass()); MessageChannel search = ctx.getBean("search", MessageChannel.class); diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/DirectMessageReceivingMessageSourceTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/DirectMessageReceivingMessageSourceTests.java index 85a64b9c02..f5fd2f30b5 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/DirectMessageReceivingMessageSourceTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/DirectMessageReceivingMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -34,7 +34,7 @@ public class DirectMessageReceivingMessageSourceTests { @SuppressWarnings("unchecked") @Test @Ignore - public void demoReceiveDm() throws Exception{ + public void demoReceiveDm() throws Exception { PropertiesFactoryBean pf = new PropertiesFactoryBean(); pf.setLocation(new ClassPathResource("sample.properties")); pf.afterPropertiesSet(); @@ -48,7 +48,7 @@ public class DirectMessageReceivingMessageSourceTests { tSource.afterPropertiesSet(); for (int i = 0; i < 50; i++) { Message message = (Message) tSource.receive(); - if (message != null){ + if (message != null) { DirectMessage tweet = message.getPayload(); System.out.println(tweet.getSender().getScreenName() + " - " + tweet.getText() + " - " + tweet.getCreatedAt()); } diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceTests.java index f9f88f0650..002af95df6 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -58,7 +58,7 @@ public class SearchReceivingMessageSourceTests { @SuppressWarnings("unchecked") @Test @Ignore - public void demoReceiveSearchResults() throws Exception{ + public void demoReceiveSearchResults() throws Exception { PropertiesFactoryBean pf = new PropertiesFactoryBean(); pf.setLocation(new ClassPathResource("sample.properties")); pf.afterPropertiesSet(); @@ -73,7 +73,7 @@ public class SearchReceivingMessageSourceTests { tSource.afterPropertiesSet(); for (int i = 0; i < 50; i++) { Message message = (Message) tSource.receive(); - if (message != null){ + if (message != null) { Tweet tweet = message.getPayload(); System.out.println(tweet.getFromUser() + " - " + tweet.getText() + " - " + tweet.getCreatedAt()); } diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests.java index 7ba75f7623..8f4f4b209d 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-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. @@ -140,7 +140,7 @@ public class SearchReceivingMessageSourceWithRedisTests extends RedisAvailableTe @ImportResource("classpath:org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests-context.xml") static class SearchReceivingMessageSourceWithRedisTestsConfig { - @Bean(name="twitterTemplate") + @Bean(name = "twitterTemplate") public TwitterTemplate twitterTemplate() { final TwitterTemplate twitterTemplate = mock(TwitterTemplate.class); diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/TimelineReceivingMessageSourceTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/TimelineReceivingMessageSourceTests.java index 3d59c06544..df6c0dae1b 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/TimelineReceivingMessageSourceTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/TimelineReceivingMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -35,7 +35,7 @@ public class TimelineReceivingMessageSourceTests { @SuppressWarnings("unchecked") @Test @Ignore - public void demoReceiveTimeline() throws Exception{ + public void demoReceiveTimeline() throws Exception { PropertiesFactoryBean pf = new PropertiesFactoryBean(); pf.setLocation(new ClassPathResource("sample.properties")); pf.afterPropertiesSet(); @@ -49,7 +49,7 @@ public class TimelineReceivingMessageSourceTests { tSource.afterPropertiesSet(); for (int i = 0; i < 50; i++) { Message message = (Message) tSource.receive(); - if (message != null){ + if (message != null) { Tweet tweet = message.getPayload(); System.out.println(tweet.getFromUser() + " - " + tweet.getText() + " - " + tweet.getCreatedAt()); } diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/DirectMessageSendingMessageHandlerTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/DirectMessageSendingMessageHandlerTests.java index 898b703350..2a70d22604 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/DirectMessageSendingMessageHandlerTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/DirectMessageSendingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -34,7 +34,7 @@ import org.springframework.social.twitter.api.impl.TwitterTemplate; public class DirectMessageSendingMessageHandlerTests { @Test @Ignore - public void validateSendDirectMessage() throws Exception{ + public void validateSendDirectMessage() throws Exception { PropertiesFactoryBean pf = new PropertiesFactoryBean(); pf.setLocation(new ClassPathResource("sample.properties")); pf.afterPropertiesSet(); diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/StatusUpdatingMessageHandlerTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/StatusUpdatingMessageHandlerTests.java index c95ea6671b..6b230c745a 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/StatusUpdatingMessageHandlerTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/StatusUpdatingMessageHandlerTests.java @@ -64,7 +64,7 @@ public class StatusUpdatingMessageHandlerTests { Twitter twitter; @Test @Ignore - public void demoSendStatusMessage() throws Exception{ + public void demoSendStatusMessage() throws Exception { PropertiesFactoryBean pf = new PropertiesFactoryBean(); pf.setLocation(new ClassPathResource("sample.properties")); pf.afterPropertiesSet(); diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/TwitterSearchOutboundGatewayTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/TwitterSearchOutboundGatewayTests.java index 3959d10d7b..8b4f0a8f73 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/TwitterSearchOutboundGatewayTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/TwitterSearchOutboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-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. @@ -61,9 +61,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @since 4.0 * */ -@ContextConfiguration(classes=TwitterConfig.class) +@ContextConfiguration(classes = TwitterConfig.class) @RunWith(SpringJUnit4ClassRunner.class) -@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class TwitterSearchOutboundGatewayTests { @Autowired diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceInboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceInboundGateway.java index bbb2ccb87f..3ab00c54cf 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceInboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceInboundGateway.java @@ -58,7 +58,7 @@ public abstract class AbstractWebServiceInboundGateway extends MessagingGatewayS if (!isRunning()) { throw new ServiceUnavailableException("503 Service Unavailable"); } - Assert.notNull(messageContext,"'messageContext' is required; it must not be null."); + Assert.notNull(messageContext, "'messageContext' is required; it must not be null."); try { this.activeCount.incrementAndGet(); @@ -76,7 +76,7 @@ public abstract class AbstractWebServiceInboundGateway extends MessagingGatewayS } } - protected void fromSoapHeaders(MessageContext messageContext, AbstractIntegrationMessageBuilder builder){ + protected void fromSoapHeaders(MessageContext messageContext, AbstractIntegrationMessageBuilder builder) { WebServiceMessage request = messageContext.getRequest(); String[] propertyNames = messageContext.getPropertyNames(); if (propertyNames != null) { @@ -93,7 +93,7 @@ public abstract class AbstractWebServiceInboundGateway extends MessagingGatewayS } } - protected void toSoapHeaders(WebServiceMessage response, Message replyMessage){ + protected void toSoapHeaders(WebServiceMessage response, Message replyMessage) { if (response instanceof SoapMessage) { this.headerMapper.fromHeadersToReply( replyMessage.getHeaders(), (SoapMessage) response); diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceOutboundGateway.java index 66056eaf52..fccba58315 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceOutboundGateway.java @@ -221,7 +221,7 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro private final Message requestMessage; - public RequestMessageCallback(WebServiceMessageCallback requestCallback, Message requestMessage){ + public RequestMessageCallback(WebServiceMessageCallback requestCallback, Message requestMessage) { this.requestCallback = requestCallback; this.requestMessage = requestMessage; } @@ -229,7 +229,7 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro @Override public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException { Object payload = this.requestMessage.getPayload(); - if (message instanceof SoapMessage){ + if (message instanceof SoapMessage) { this.doWithMessageInternal(message, payload); AbstractWebServiceOutboundGateway.this.headerMapper .fromHeadersToRequest(this.requestMessage.getHeaders(), (SoapMessage) message); @@ -254,7 +254,7 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro Object resultObject = this.doExtractData(message); - if (resultObject != null && message instanceof SoapMessage){ + if (resultObject != null && message instanceof SoapMessage) { Map mappedMessageHeaders = AbstractWebServiceOutboundGateway.this.headerMapper.toHeadersFromReply((SoapMessage) message); return AbstractWebServiceOutboundGateway.this.getMessageBuilderFactory() diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceInboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceInboundGateway.java index 653c9bec63..82aea9a06d 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceInboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceInboundGateway.java @@ -94,7 +94,7 @@ public class MarshallingWebServiceInboundGateway extends AbstractWebServiceInbou } @Override - protected void doInvoke(MessageContext messageContext) throws Exception{ + protected void doInvoke(MessageContext messageContext) throws Exception { WebServiceMessage request = messageContext.getRequest(); Assert.notNull(request, "Invalid message context: request was null."); Object requestObject = MarshallingUtils.unmarshal(this.unmarshaller, request); diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java index a421289959..8ff8be1818 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java @@ -104,7 +104,7 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb */ private void configureMarshallers(Marshaller marshaller, Unmarshaller unmarshaller) { Assert.notNull(marshaller, "marshaller must not be null"); - if (unmarshaller == null){ + if (unmarshaller == null) { Assert.isInstanceOf(Unmarshaller.class, marshaller, "Marshaller [" + marshaller + "] does not implement the Unmarshaller interface. " + "Please set an Unmarshaller explicitly by using one of the constructors that accepts " + diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java index 1443475fed..c62d74e369 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java @@ -113,7 +113,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG this.transform(source, message.getPayloadResult()); } - private Source extractSource(Object requestPayload) throws IOException, TransformerException{ + private Source extractSource(Object requestPayload) throws IOException, TransformerException { Source source = null; if (requestPayload instanceof Source) { @@ -156,11 +156,11 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG if (payloadSource != null && this.result != null) { this.transform(payloadSource, this.result); - if (this.result instanceof StringResult){ + if (this.result instanceof StringResult) { return this.result.toString(); } - else if (this.result instanceof DOMResult){ - return ((DOMResult)this.result).getNode(); + else if (this.result instanceof DOMResult) { + return ((DOMResult) this.result).getNode(); } else { return this.result; @@ -178,7 +178,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG @Override public DOMSource extractData(Source source) throws IOException, TransformerException { if (source instanceof DOMSource) { - return (DOMSource)source; + return (DOMSource) source; } DOMResult result = new DOMResult(); this.transform(source, result); diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SoapHeaderMapper.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SoapHeaderMapper.java index fffc6b3534..2d7f58e251 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SoapHeaderMapper.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SoapHeaderMapper.java @@ -28,6 +28,6 @@ import org.springframework.ws.soap.SoapMessage; * @author Oleg Zhurakousky * @since 2.1 */ -public interface SoapHeaderMapper extends RequestReplyHeaderMapper{ +public interface SoapHeaderMapper extends RequestReplyHeaderMapper { } diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParser.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParser.java index bd31bbdd31..89fb521c9a 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParser.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParser.java @@ -59,12 +59,12 @@ public class WebServiceInboundGatewayParser extends AbstractInboundGatewayParser } } else { // check if unmarshaller is defined which is a mistake without marshaller - if (StringUtils.hasText(unmarshallerRef)){ + if (StringUtils.hasText(unmarshallerRef)) { throw new IllegalArgumentException("An 'unmarshaller' is not allowed without 'marshaller'."); } } - if (StringUtils.hasText(marshallerRef) || StringUtils.hasText(unmarshallerRef)){ + if (StringUtils.hasText(marshallerRef) || StringUtils.hasText(unmarshallerRef)) { String extractPayload = element.getAttribute("extract-payload"); if (StringUtils.hasText(extractPayload)) { this.logger.warn("Setting 'extract-payload' attribute has no effect when used with a marshalling Web Service Inbound Gateway."); diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/MarshallingWebServiceIntegrationTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/MarshallingWebServiceIntegrationTests.java index 4b61be2bd5..e1e5a8ea9e 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/MarshallingWebServiceIntegrationTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/MarshallingWebServiceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 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. @@ -76,7 +76,7 @@ public class MarshallingWebServiceIntegrationTests { private Result stringResult = new StreamResult(output); - @Before public void setupMocks(){ + @Before public void setupMocks() { MockitoAnnotations.initMocks(this); } @@ -125,7 +125,7 @@ public class MarshallingWebServiceIntegrationTests { } public static class StubEndpoint { - @ServiceActivator(inputChannel="requests") + @ServiceActivator(inputChannel = "requests") public Object handle(Object o) { return o; } diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java index cd7feaff8f..081fe0fa51 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -37,12 +37,12 @@ import org.mockito.stubbing.Answer; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.handler.ReplyRequiredException; +import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.PollableChannel; -import org.springframework.integration.handler.ReplyRequiredException; import org.springframework.messaging.support.GenericMessage; -import org.springframework.integration.support.MessageBuilder; import org.springframework.ws.WebServiceMessage; import org.springframework.ws.WebServiceMessageFactory; import org.springframework.ws.client.core.WebServiceMessageCallback; @@ -78,6 +78,7 @@ public class SimpleWebServiceOutboundGatewayTests { SimpleWebServiceOutboundGateway gateway = new SimpleWebServiceOutboundGateway(new TestDestinationProvider(uri)); final AtomicReference soapActionFromCallback = new AtomicReference(); gateway.setRequestCallback(new WebServiceMessageCallback() { + @Override public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException { SoapMessage soapMessage = (SoapMessage) message; soapActionFromCallback.set(soapMessage.getSoapAction()); @@ -126,11 +127,13 @@ public class SimpleWebServiceOutboundGatewayTests { Mockito.when(messageSender.supports(Mockito.any(URI.class))).thenReturn(true); Mockito.doAnswer(new Answer() { - public Object answer(InvocationOnMock invocation) throws Exception{ + @Override + public Object answer(InvocationOnMock invocation) throws Exception { Object[] args = invocation.getArguments(); WebServiceMessageFactory factory = (WebServiceMessageFactory) args[0]; return factory.createWebServiceMessage(new ByteArrayInputStream(mockResponseMessage.getBytes())); - }}).when(wsConnection).receive(Mockito.any(WebServiceMessageFactory.class)); + } + }).when(wsConnection).receive(Mockito.any(WebServiceMessageFactory.class)); return messageSender; } @@ -143,6 +146,7 @@ public class SimpleWebServiceOutboundGatewayTests { this.uri = URI.create(uri); } + @Override public URI getDestination() { return this.uri; } diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java index 7be4f4ed08..0c487d9943 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java @@ -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. @@ -217,7 +217,7 @@ public class WebServiceOutboundGatewayParserTests { DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); WebServiceMessageSender messageSender = (WebServiceMessageSender) context.getBean("messageSender"); - assertEquals(messageSender, ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders"))[0]); + assertEquals(messageSender, ((WebServiceMessageSender[]) accessor.getPropertyValue("messageSenders"))[0]); } @Test public void simpleGatewayWithCustomMessageSenderList() { @@ -230,9 +230,9 @@ public class WebServiceOutboundGatewayParserTests { DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); WebServiceMessageSender messageSender = (WebServiceMessageSender) context.getBean("messageSender"); - assertEquals(messageSender, ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders"))[0]); + assertEquals(messageSender, ((WebServiceMessageSender[]) accessor.getPropertyValue("messageSenders"))[0]); assertEquals("Wrong number of message senders ", - 2 , ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders")).length); + 2 , ((WebServiceMessageSender[]) accessor.getPropertyValue("messageSenders")).length); } @Test @@ -275,7 +275,7 @@ public class WebServiceOutboundGatewayParserTests { PeriodicTrigger trigger = (PeriodicTrigger) triggerObject; DirectFieldAccessor accessor = new DirectFieldAccessor(trigger); assertEquals("PeriodicTrigger had wrong period", - 5000, ((Long)accessor.getPropertyValue("period")).longValue()); + 5000, ((Long) accessor.getPropertyValue("period")).longValue()); } @Test @@ -378,7 +378,7 @@ public class WebServiceOutboundGatewayParserTests { assertNull(accessor.getPropertyValue("uri")); Object destinationProviderObject = new DirectFieldAccessor( accessor.getPropertyValue("webServiceTemplate")).getPropertyValue("destinationProvider"); - assertEquals("Wrong DestinationProvider", stubProvider,destinationProviderObject); + assertEquals("Wrong DestinationProvider", stubProvider, destinationProviderObject); } @Test diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayWithHeaderMapperTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayWithHeaderMapperTests.java index 2cfd5e5eb1..d778d93ea8 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayWithHeaderMapperTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayWithHeaderMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -37,18 +37,21 @@ import org.junit.Test; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.integration.mapping.AbstractHeaderMapper; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.mapping.AbstractHeaderMapper; import org.springframework.integration.support.MessageBuilder; import org.springframework.integration.test.util.TestUtils; import org.springframework.integration.ws.AbstractWebServiceOutboundGateway; import org.springframework.integration.ws.DefaultSoapHeaderMapper; import org.springframework.integration.ws.SimpleWebServiceOutboundGateway; import org.springframework.integration.ws.WebServiceHeaders; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageChannel; import org.springframework.oxm.Unmarshaller; import org.springframework.oxm.XmlMappingException; import org.springframework.util.xml.DomUtils; @@ -62,8 +65,6 @@ import org.springframework.ws.transport.WebServiceConnection; import org.springframework.ws.transport.WebServiceMessageSender; import org.springframework.xml.namespace.QNameUtils; import org.springframework.xml.transform.StringResult; -import org.w3c.dom.Document; -import org.w3c.dom.Element; /** * @author Oleg Zhurakousky @@ -85,7 +86,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { @SuppressWarnings("unchecked") @Test - public void headerMapperParserTest() throws Exception{ + public void headerMapperParserTest() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("ws-outbound-gateway-with-headermappers.xml", this.getClass()); SimpleWebServiceOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean("withHeaderMapper"), "handler", SimpleWebServiceOutboundGateway.class); DefaultSoapHeaderMapper headerMapper = TestUtils.getPropertyValue(gateway, "headerMapper", DefaultSoapHeaderMapper.class); @@ -111,7 +112,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { } @Test - public void withHeaderMapperString() throws Exception{ + public void withHeaderMapperString() throws Exception { String payload = "bill"; Message replyMessage = this.process(payload, "withHeaderMapper", "inputChannel", true); assertTrue(replyMessage.getPayload() instanceof String); @@ -120,15 +121,15 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { } @Test - public void withHeaderMapperStringPOX() throws Exception{ + public void withHeaderMapperStringPOX() throws Exception { String payload = "bill"; Message replyMessage = this.process(payload, "withHeaderMapper", "inputChannel", false); assertTrue(replyMessage.getPayload() instanceof String); - assertTrue(((String)replyMessage.getPayload()).contains("oleg")); + assertTrue(((String) replyMessage.getPayload()).contains("oleg")); } @Test - public void withHeaderMapperSource() throws Exception{ + public void withHeaderMapperSource() throws Exception { DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbfac.newDocumentBuilder(); Document document = docBuilder.parse(new ByteArrayInputStream("bill".getBytes())); @@ -140,7 +141,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { } @Test - public void withHeaderMapperSourcePOX() throws Exception{ + public void withHeaderMapperSourcePOX() throws Exception { DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbfac.newDocumentBuilder(); Document document = docBuilder.parse(new ByteArrayInputStream("bill".getBytes())); @@ -151,7 +152,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { } @Test - public void withHeaderMapperDocument() throws Exception{ + public void withHeaderMapperDocument() throws Exception { DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbfac.newDocumentBuilder(); Document payload = docBuilder.parse(new ByteArrayInputStream("bill".getBytes())); @@ -162,7 +163,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { } @Test - public void withHeaderMapperDocumentPOX() throws Exception{ + public void withHeaderMapperDocumentPOX() throws Exception { DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbfac.newDocumentBuilder(); Document payload = docBuilder.parse(new ByteArrayInputStream("bill".getBytes())); @@ -172,7 +173,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { } @Test - public void withHeaderMapperAndMarshaller() throws Exception{ + public void withHeaderMapperAndMarshaller() throws Exception { Person person = new Person(); person.setName("Bill Clinton"); Message replyMessage = this.process(person, "marshallingWithHeaderMapper", "inputMarshallingChannel", true); @@ -181,11 +182,11 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { } @SuppressWarnings("rawtypes") - public Message process(Object payload, String gatewayName, String channelName, final boolean soap) throws Exception{ + public Message process(Object payload, String gatewayName, String channelName, final boolean soap) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("ws-outbound-gateway-with-headermappers.xml", this.getClass()); AbstractWebServiceOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean(gatewayName), "handler", AbstractWebServiceOutboundGateway.class); - if (!soap){ + if (!soap) { WebServiceTemplate template = TestUtils.getPropertyValue(gateway, "webServiceTemplate", WebServiceTemplate.class); template.setMessageFactory(new StubMessageFactory()); } @@ -196,50 +197,55 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { Mockito.when(messageSender.supports(Mockito.any(URI.class))).thenReturn(true); Mockito.doAnswer(new Answer() { - public Object answer(InvocationOnMock invocation) { - Object[] args = invocation.getArguments(); - WebServiceMessage wsMessage = (WebServiceMessage) args[0]; -// try { // uncomment if you want to see a pretty-print of SOAP message -// Transformer transformer = TransformerFactory.newInstance().newTransformer(); -// transformer.setOutputProperty(OutputKeys.INDENT, "yes"); -// transformer.transform(new DOMSource(soapMessage.getDocument()), new StreamResult(System.out)); -// } catch (Exception e) { + @Override + public Object answer(InvocationOnMock invocation) { + Object[] args = invocation.getArguments(); + WebServiceMessage wsMessage = (WebServiceMessage) args[0]; +// try { // uncomment if you want to see a pretty-print of SOAP message +// Transformer transformer = TransformerFactory.newInstance().newTransformer(); +// transformer.setOutputProperty(OutputKeys.INDENT, "yes"); +// transformer.transform(new DOMSource(soapMessage.getDocument()), new StreamResult(System.out)); +// } +// catch (Exception e) { // // ignore -// } - if (soap){ - SoapHeader soapHeader = ((SoapMessage)wsMessage).getSoapHeader(); - assertNotNull(soapHeader.getAttributeValue(QNameUtils.parseQNameString("foo"))); - assertNotNull(soapHeader.getAttributeValue(QNameUtils.parseQNameString("foobar"))); - assertNotNull(soapHeader.getAttributeValue(QNameUtils.parseQNameString("abaz"))); - assertNull(soapHeader.getAttributeValue(QNameUtils.parseQNameString("bar"))); - } - - return null; - }}) - .when(wsConnection).send(Mockito.any(WebServiceMessage.class)); +// } + if (soap) { + SoapHeader soapHeader = ((SoapMessage) wsMessage).getSoapHeader(); + assertNotNull(soapHeader.getAttributeValue(QNameUtils.parseQNameString("foo"))); + assertNotNull(soapHeader.getAttributeValue(QNameUtils.parseQNameString("foobar"))); + assertNotNull(soapHeader.getAttributeValue(QNameUtils.parseQNameString("abaz"))); + assertNull(soapHeader.getAttributeValue(QNameUtils.parseQNameString("bar"))); + } + return null; + } + }).when(wsConnection).send(Mockito.any(WebServiceMessage.class)); Mockito.doAnswer(new Answer() { - public Object answer(InvocationOnMock invocation) throws Exception{ - Object[] args = invocation.getArguments(); - WebServiceMessageFactory factory = (WebServiceMessageFactory) args[0]; - String responseMessage = factory instanceof SoapMessageFactory ? responseSoapMessage : responseNonSoapMessage; - WebServiceMessage wsMessage = factory.createWebServiceMessage(new ByteArrayInputStream(responseMessage.getBytes())); - if (soap){ + @Override + public Object answer(InvocationOnMock invocation) throws Exception { + Object[] args = invocation.getArguments(); + WebServiceMessageFactory factory = (WebServiceMessageFactory) args[0]; + String responseMessage = factory instanceof SoapMessageFactory ? responseSoapMessage + : responseNonSoapMessage; + WebServiceMessage wsMessage = factory + .createWebServiceMessage(new ByteArrayInputStream(responseMessage.getBytes())); + if (soap) { - ((SoapMessage)wsMessage).getSoapHeader().addAttribute(QNameUtils.parseQNameString("bar"), "bar"); - ((SoapMessage)wsMessage).getSoapHeader().addAttribute(QNameUtils.parseQNameString("baz"), "baz"); - } + ((SoapMessage) wsMessage).getSoapHeader().addAttribute(QNameUtils.parseQNameString("bar"), "bar"); + ((SoapMessage) wsMessage).getSoapHeader().addAttribute(QNameUtils.parseQNameString("baz"), "baz"); + } -// try { // uncomment if you want to see a pretty-print of SOAP message -// Transformer transformer = TransformerFactory.newInstance().newTransformer(); -// transformer.setOutputProperty(OutputKeys.INDENT, "yes"); -// transformer.transform(new DOMSource(soapMessage.getDocument()), new StreamResult(System.out)); -// } catch (Exception e) { +// try { // uncomment if you want to see a pretty-print of SOAP message +// Transformer transformer = TransformerFactory.newInstance().newTransformer(); +// transformer.setOutputProperty(OutputKeys.INDENT, "yes"); +// transformer.transform(new DOMSource(soapMessage.getDocument()), new StreamResult(System.out)); +// } +// catch (Exception e) { // // ignore -// } - return wsMessage; - }}) - .when(wsConnection).receive(Mockito.any(WebServiceMessageFactory.class)); +// } + return wsMessage; + } + }).when(wsConnection).receive(Mockito.any(WebServiceMessageFactory.class)); gateway.setMessageSender(messageSender); @@ -254,7 +260,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { return replyMessage; } - public static class Person{ + public static class Person { private String name; public String getName() { @@ -268,10 +274,12 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { public static class SampleUnmarshaller implements Unmarshaller { + @Override public boolean supports(Class clazz) { return true; } + @Override public Object unmarshal(Source source) throws IOException, XmlMappingException { Element documentElement = (Element) ((DOMSource) source).getNode(); @@ -282,15 +290,15 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests { } } - private String extractStringResult(Message replyMessage) throws Exception{ + private String extractStringResult(Message replyMessage) throws Exception { Transformer transformer = TransformerFactory.newInstance().newTransformer(); StringResult result = new StringResult(); Object payload = replyMessage.getPayload(); - if (payload instanceof DOMSource){ - transformer.transform(((DOMSource)replyMessage.getPayload()), result); + if (payload instanceof DOMSource) { + transformer.transform(((DOMSource) replyMessage.getPayload()), result); } - else if (payload instanceof Document){ - transformer.transform(new DOMSource((Document)replyMessage.getPayload()), result); + else if (payload instanceof Document) { + transformer.transform(new DOMSource((Document) replyMessage.getPayload()), result); } else { throw new IllegalArgumentException("Unsupported payload type: " + payload.getClass().getName()); diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/AbstractXPathMessageSelector.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/AbstractXPathMessageSelector.java index e27837375f..ec1acd07a8 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/AbstractXPathMessageSelector.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/AbstractXPathMessageSelector.java @@ -50,7 +50,7 @@ public abstract class AbstractXPathMessageSelector implements MessageSelector { * @param namespace namespace URI */ public AbstractXPathMessageSelector(String xPathExpression, String prefix, String namespace) { - Map namespaces = new HashMap(); + Map namespaces = new HashMap(); namespaces.put(prefix, namespace); this.xPathExpresion = XPathExpressionFactory.createXPathExpression(xPathExpression, namespaces); } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/DefaultXmlPayloadConverterTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/DefaultXmlPayloadConverterTests.java index 349f7ae53c..065cca7bbc 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/DefaultXmlPayloadConverterTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/DefaultXmlPayloadConverterTests.java @@ -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. @@ -92,31 +92,31 @@ public class DefaultXmlPayloadConverterTests { @Test - public void testGetSourcePassingDocument() throws Exception{ + public void testGetSourcePassingDocument() throws Exception { Source source = converter.convertToSource(testDocument); assertEquals(DOMSource.class, source.getClass()); } @Test - public void testGetSourcePassingString() throws Exception{ + public void testGetSourcePassingString() throws Exception { Source source = converter.convertToSource(testDocumentAsString); assertEquals(StringSource.class, source.getClass()); } @Test - public void testGetSourcePassingSource() throws Exception{ + public void testGetSourcePassingSource() throws Exception { SAXSource passedInSource = new SAXSource(); Source source = converter.convertToSource(passedInSource); assertEquals(source, passedInSource); } - @Test(expected=MessagingException.class) - public void testInvalidPayload(){ + @Test(expected = MessagingException.class) + public void testInvalidPayload() { converter.convertToSource(12); } @Test - public void testGetNodePassingDOMSource(){ + public void testGetNodePassingDOMSource() { Node element = testDocument.getElementsByTagName("test").item(0); Node n = converter.convertToNode(new DOMSource(element)); assertTrue("Wrong node returned", element == n); @@ -133,7 +133,7 @@ public class DefaultXmlPayloadConverterTests { } @Test - public void testConvertSourceToDocument() throws Exception{ + public void testConvertSourceToDocument() throws Exception { Node element = testDocument.getElementsByTagName("test").item(0); DOMSource domSource = new DOMSource(element); Document doc = converter.convertToDocument(element); diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/MarshallingTransformerParserTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/MarshallingTransformerParserTests.java index 92d628a71c..924e0bd091 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/MarshallingTransformerParserTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/MarshallingTransformerParserTests.java @@ -96,7 +96,7 @@ public class MarshallingTransformerParserTests { input.send(message); Message result = output.receive(0); assertTrue("Wrong payload type", result.getPayload() instanceof String); - String resultPayload = (String)result.getPayload(); + String resultPayload = (String) result.getPayload(); assertEquals("Wrong payload", "testReturn", resultPayload); } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/StubDocumentBuilderFactory.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/StubDocumentBuilderFactory.java index d290ff97c1..5a54593401 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/StubDocumentBuilderFactory.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/StubDocumentBuilderFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -23,7 +23,7 @@ import javax.xml.parsers.ParserConfigurationException; /** * @author Jonas Partner */ -public class StubDocumentBuilderFactory extends DocumentBuilderFactory{ +public class StubDocumentBuilderFactory extends DocumentBuilderFactory { @Override public Object getAttribute(String name) throws IllegalArgumentException { diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/StubResultTransformer.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/StubResultTransformer.java index cb6be95397..76a4788dd5 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/StubResultTransformer.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/StubResultTransformer.java @@ -24,7 +24,7 @@ public class StubResultTransformer implements ResultTransformer { Object toReturn; - public StubResultTransformer(Object toReturn){ + public StubResultTransformer(Object toReturn) { this.toReturn = toReturn; } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/TestXmlApplicationContext.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/TestXmlApplicationContext.java index 223b5cf9e3..0f75818ea9 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/TestXmlApplicationContext.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/TestXmlApplicationContext.java @@ -28,7 +28,7 @@ public class TestXmlApplicationContext extends AbstractXmlApplicationContext { private final Resource[] resources; - public TestXmlApplicationContext(String ... xmlStrings){ + public TestXmlApplicationContext(String ... xmlStrings) { resources = new Resource[xmlStrings.length]; for (int i = 0 ; i < xmlStrings.length; i++) { resources[i] = new TestResource(xmlStrings[i]); @@ -41,11 +41,11 @@ public class TestXmlApplicationContext extends AbstractXmlApplicationContext { return resources; } - private static class TestResource extends AbstractResource{ + private static class TestResource extends AbstractResource { String xmlString; - TestResource(String xmlString){ + TestResource(String xmlString) { this.xmlString = xmlString; } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathExpressionParserTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathExpressionParserTests.java index 5d143ad85c..e4e6d2d42d 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathExpressionParserTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathExpressionParserTests.java @@ -32,15 +32,15 @@ public class XPathExpressionParserTests { public void testSimpleStringExpression() throws Exception { String xmlDoc = ""; XPathExpression xPathExpression = getXPathExpression(xmlDoc); - assertEquals("outputOne",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("outputOne", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); } @Test public void testNamespacedStringExpression() throws Exception { String xmlDoc = ""; XPathExpression xPathExpression = getXPathExpression(xmlDoc); - assertEquals("outputOne",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); - assertEquals("",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("outputOne", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); } @Test @@ -48,8 +48,8 @@ public class XPathExpressionParserTests { StringBuffer xmlDoc = new StringBuffer(""); xmlDoc.append(""); XPathExpression xPathExpression = getXPathExpression(xmlDoc.toString()); - assertEquals("outputOne",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); - assertEquals("",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("outputOne", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); } @Test @@ -60,8 +60,8 @@ public class XPathExpressionParserTests { .append(""); XPathExpression xPathExpression = getXPathExpression(xmlDoc.toString()); - assertEquals("outputOne",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); - assertEquals("",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("outputOne", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); } @Test @@ -85,12 +85,12 @@ public class XPathExpressionParserTests { } - @Test(expected=BeanDefinitionStoreException.class) + @Test(expected = BeanDefinitionStoreException.class) public void testNamespacePrefixButNoUri() throws Exception { String xmlDoc = ""; XPathExpression xPathExpression = getXPathExpression(xmlDoc); - assertEquals("outputOne",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); - assertEquals("",xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("outputOne", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); + assertEquals("", xPathExpression.evaluateAsString(XmlTestUtil.getDocumentForString("outputOne"))); } @@ -148,7 +148,7 @@ public class XPathExpressionParserTests { } - public XPathExpression getXPathExpression(String contextXml){ + public XPathExpression getXPathExpression(String contextXml) { TestXmlApplicationContext ctx = TestXmlApplicationContextHelper.getTestAppContext(contextXml); return (XPathExpression) ctx.getBean("xpathExpression"); } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathRouterParserTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathRouterParserTests.java index d7cb02f575..bcd3075ebd 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathRouterParserTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathRouterParserTests.java @@ -76,7 +76,7 @@ public class XPathRouterParserTests { ConfigurableApplicationContext appContext; - public EventDrivenConsumer buildContext(String routerDef){ + public EventDrivenConsumer buildContext(String routerDef) { appContext = TestXmlApplicationContextHelper.getTestAppContext( channelConfig + routerDef); appContext.getAutowireCapableBeanFactory().autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false); EventDrivenConsumer consumer = (EventDrivenConsumer) appContext.getBean("router"); @@ -86,8 +86,8 @@ public class XPathRouterParserTests { @After - public void tearDown(){ - if(appContext != null){ + public void tearDown() { + if (appContext != null) { appContext.close(); } } @@ -191,7 +191,7 @@ public class XPathRouterParserTests { Object defaultOutputChannelValue = accessor.getPropertyValue("defaultOutputChannel"); assertEquals("Default output channel not correctly set ", defaultOutput, defaultOutputChannelValue); inputChannel.send(MessageBuilder.withPayload("").build()); - assertEquals("Wrong count of messages on default output channel",1, defaultOutput.getQueueSize()); + assertEquals("Wrong count of messages on default output channel", 1, defaultOutput.getQueueSize()); } @Test diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/router/XPathRouterTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/router/XPathRouterTests.java index 64f933e763..4d73fadc88 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/router/XPathRouterTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/router/XPathRouterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -113,8 +113,8 @@ public class XPathRouterTests { XPathRouter router = new XPathRouter("./three/text()"); Document testDocument = XmlTestUtil.getDocumentForString("bobdave"); Object[] channelNames = router.getChannelKeys(new GenericMessage(testDocument.getElementsByTagName("two").item(0))).toArray(); - assertEquals("bob",channelNames[0]); - assertEquals("dave",channelNames[1]); + assertEquals("bob", channelNames[0]); + assertEquals("dave", channelNames[1]); } @Test diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/selector/StringValueTestXPathMessageSelectorTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/selector/StringValueTestXPathMessageSelectorTests.java index cc0b1c2f79..792715dbf0 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/selector/StringValueTestXPathMessageSelectorTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/selector/StringValueTestXPathMessageSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -42,19 +42,19 @@ public class StringValueTestXPathMessageSelectorTests { @Test public void testMatchWithSimpleStringAndNamespace() { - StringValueTestXPathMessageSelector selector = new StringValueTestXPathMessageSelector("/ns1:one/ns1:two","ns1","www.example.org", "red"); + StringValueTestXPathMessageSelector selector = new StringValueTestXPathMessageSelector("/ns1:one/ns1:two", "ns1", "www.example.org", "red"); assertTrue(selector.accept(new GenericMessage("red"))); } @Test public void testCaseSensitiveByDefault() { - StringValueTestXPathMessageSelector selector = new StringValueTestXPathMessageSelector("/ns1:one/ns1:two","ns1","www.example.org", "red"); + StringValueTestXPathMessageSelector selector = new StringValueTestXPathMessageSelector("/ns1:one/ns1:two", "ns1", "www.example.org", "red"); assertFalse(selector.accept(new GenericMessage("RED"))); } @Test public void testNotCaseSensitive() { - StringValueTestXPathMessageSelector selector = new StringValueTestXPathMessageSelector("/ns1:one/ns1:two","ns1","www.example.org", "red"); + StringValueTestXPathMessageSelector selector = new StringValueTestXPathMessageSelector("/ns1:one/ns1:two", "ns1", "www.example.org", "red"); selector.setCaseSensitive(false); assertTrue(selector.accept(new GenericMessage("RED"))); } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelectorTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelectorTests.java index e088823299..9a69bc6ab8 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelectorTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelectorTests.java @@ -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. @@ -33,19 +33,19 @@ import org.springframework.integration.xml.selector.XmlValidatingMessageSelector public class XmlValidatingMessageSelectorTests { @Test - public void validateCreationWithSchemaAndDefaultSchemaType() throws Exception{ + public void validateCreationWithSchemaAndDefaultSchemaType() throws Exception { Resource resource = new ByteArrayResource("".getBytes()); new XmlValidatingMessageSelector(resource, (SchemaType) null); } @Test - public void validateCreationWithSchemaAndProvidedSchemaType() throws Exception{ + public void validateCreationWithSchemaAndProvidedSchemaType() throws Exception { Resource resource = new ByteArrayResource("".getBytes()); new XmlValidatingMessageSelector(resource, SchemaType.XML_SCHEMA); } @Test - public void validateFailureInvalidSchemaLanguage() throws Exception{ + public void validateFailureInvalidSchemaLanguage() throws Exception { ConfigurableApplicationContext context = null; try { context = new ClassPathXmlApplicationContext("XmlValidatingMessageSelectorTests-context.xml", this.getClass()); @@ -54,14 +54,14 @@ public class XmlValidatingMessageSelectorTests { assertTrue(e.getMessage().contains("java.lang.IllegalArgumentException: No enum constant")); } finally { - if(context != null) { + if (context != null) { context.close(); } } } - @Test(expected=IllegalArgumentException.class) - public void validateFailureWhenNoSchemaResourceProvided() throws Exception{ + @Test(expected = IllegalArgumentException.class) + public void validateFailureWhenNoSchemaResourceProvided() throws Exception { new XmlValidatingMessageSelector(null, (SchemaType) null); } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/source/StringSourceTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/source/StringSourceTests.java index b8c9ba697e..5e269795bc 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/source/StringSourceTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/source/StringSourceTests.java @@ -33,39 +33,39 @@ public class StringSourceTests { StringSourceFactory sourceFactory; @Before - public void setUp() throws Exception{ + public void setUp() throws Exception { sourceFactory = new StringSourceFactory(); } @Test - public void testWithDocument() throws Exception{ + public void testWithDocument() throws Exception { String docString = "one"; Document doc = XmlTestUtil.getDocumentForString(docString); - StringSource source = (StringSource)sourceFactory.createSource(doc); + StringSource source = (StringSource) sourceFactory.createSource(doc); BufferedReader reader = new BufferedReader(source.getReader()); - String docAsString =reader.readLine(); - assertXMLEqual("Wrong content in StringSource","one", docAsString); + String docAsString = reader.readLine(); + assertXMLEqual("Wrong content in StringSource", "one", docAsString); } @Test - public void testWithString() throws Exception{ + public void testWithString() throws Exception { String docString = "one"; - StringSource source = (StringSource)sourceFactory.createSource(docString); + StringSource source = (StringSource) sourceFactory.createSource(docString); BufferedReader reader = new BufferedReader(source.getReader()); - String docAsString =reader.readLine(); - assertXMLEqual("Wrong content in StringSource","one", docAsString); + String docAsString = reader.readLine(); + assertXMLEqual("Wrong content in StringSource", "one", docAsString); } - @Test(expected=MessagingException.class) - public void testWithUnsupportedPayload() throws Exception{ + @Test(expected = MessagingException.class) + public void testWithUnsupportedPayload() throws Exception { String docString = "one"; StringBuffer buffer = new StringBuffer(docString); - StringSource source = (StringSource)sourceFactory.createSource(buffer); + StringSource source = (StringSource) sourceFactory.createSource(buffer); BufferedReader reader = new BufferedReader(source.getReader()); - String docAsString =reader.readLine(); - assertXMLEqual("Wrong content in StringSource","one", docAsString); + String docAsString = reader.readLine(); + assertXMLEqual("Wrong content in StringSource", "one", docAsString); } } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/splitter/XPathMessageSplitterTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/splitter/XPathMessageSplitterTests.java index ded441906d..2d23b2830a 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/splitter/XPathMessageSplitterTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/splitter/XPathMessageSplitterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -45,7 +45,7 @@ public class XPathMessageSplitterTests { @Before - public void setUp(){ + public void setUp() { String splittingXPath = "/orders/order"; splitter = new XPathMessageSplitter(splittingXPath); splitter.setOutputChannel(replyChannel); @@ -80,8 +80,8 @@ public class XPathMessageSplitterTests { assertEquals("Wrong number of messages", 3, docMessages.size()); for (Message message : docMessages) { assertTrue("unexpected payload type" + message.getPayload().getClass().getName(), message.getPayload() instanceof Document); - Document docPayload = (Document)message.getPayload(); - assertEquals("Wrong root element name" ,"order", docPayload.getDocumentElement().getLocalName()); + Document docPayload = (Document) message.getPayload(); + assertEquals("Wrong root element name" , "order", docPayload.getDocumentElement().getLocalName()); } } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/ResultToStringTransformerTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/ResultToStringTransformerTests.java index 8e3be324d9..ea1e80d89f 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/ResultToStringTransformerTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/ResultToStringTransformerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -64,7 +64,7 @@ public class ResultToStringTransformerTests { String formattedDoc = "test"; DOMResult domResult = XmlTestUtil.getDomResultForString(doc); Properties outputProperties = new Properties(); - outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION,"yes"); + outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperties(outputProperties); Object transformed = transformer.transformResult(domResult); assertTrue("Wrong transformed type expected String", transformed instanceof String); diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltTransformerTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltTransformerTests.java index 9937637c63..3108140c4c 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltTransformerTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltTransformerTests.java @@ -128,8 +128,8 @@ public class XsltTransformerTests { input.send(message); Message resultMessage = output.receive(); assertEquals("Wrong payload type", String.class, resultMessage.getPayload().getClass()); - String stringPayload = (String)resultMessage.getPayload(); - assertEquals("Wrong content of payload", "hello world text",stringPayload.trim()); + String stringPayload = (String) resultMessage.getPayload(); + assertEquals("Wrong content of payload", "hello world text", stringPayload.trim()); } @Test diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbAnnotatedPerson.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbAnnotatedPerson.java index 7f6a79085d..2152ad7a6c 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbAnnotatedPerson.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbAnnotatedPerson.java @@ -20,10 +20,10 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -@XmlType @XmlRootElement(name="person") +@XmlType @XmlRootElement(name = "person") public class JaxbAnnotatedPerson { - @XmlElement(name="firstname") + @XmlElement(name = "firstname") public String getFirstName() { return firstName; } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbMarshallingIntegrationTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbMarshallingIntegrationTests.java index 735be2490c..6df03ef64e 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbMarshallingIntegrationTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbMarshallingIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -57,27 +57,27 @@ public class JaxbMarshallingIntegrationTests extends AbstractJUnit4SpringContext @SuppressWarnings("unchecked") @Test - public void testMarshalling() throws Exception{ + public void testMarshalling() throws Exception { JaxbAnnotatedPerson person = new JaxbAnnotatedPerson(); person.setFirstName("john"); marshallIn.send(new GenericMessage(person)); GenericMessage res = (GenericMessage) marshalledOut.receive(2000); - assertNotNull("No response recevied" ,res); + assertNotNull("No response recevied" , res); assertTrue("payload was not a DOMResult" , res.getPayload() instanceof DOMResult); - Document doc = (Document)((DOMResult)res.getPayload()).getNode(); - assertEquals("Wrong name for root element ", "person",doc.getDocumentElement().getLocalName()); + Document doc = (Document) ((DOMResult) res.getPayload()).getNode(); + assertEquals("Wrong name for root element ", "person", doc.getDocumentElement().getLocalName()); } @SuppressWarnings("unchecked") @Test - public void testUnmarshalling() throws Exception{ + public void testUnmarshalling() throws Exception { StringSource source = new StringSource("bob"); unmarshallIn.send(new GenericMessage(source)); GenericMessage res = (GenericMessage) unmarshallOut.receive(2000); assertNotNull("No response", res); assertTrue("Not a Person ", res.getPayload() instanceof JaxbAnnotatedPerson); - JaxbAnnotatedPerson person = (JaxbAnnotatedPerson)res.getPayload(); + JaxbAnnotatedPerson person = (JaxbAnnotatedPerson) res.getPayload(); assertEquals("Worng firstname", "bob", person.getFirstName()); } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/util/XmlTestUtil.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/util/XmlTestUtil.java index 21d5cc920b..2c36b7b71a 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/util/XmlTestUtil.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/util/XmlTestUtil.java @@ -67,7 +67,7 @@ public class XmlTestUtil { return res; } - public static String docToString(Document doc) throws Exception{ + public static String docToString(Document doc) throws Exception { DOMSource source = new DOMSource(doc); StringResult stringResult = new StringResult(); transform(source, stringResult); diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/AbstractXmppInboundChannelAdapterParser.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/AbstractXmppInboundChannelAdapterParser.java index 4c76fbaadc..2bfb4a9af9 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/AbstractXmppInboundChannelAdapterParser.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/AbstractXmppInboundChannelAdapterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -56,7 +56,7 @@ public abstract class AbstractXmppInboundChannelAdapterParser extends AbstractCh String connectionName = element.getAttribute("xmpp-connection"); - if (StringUtils.hasText(connectionName)){ + if (StringUtils.hasText(connectionName)) { builder.addConstructorArgReference(connectionName); } else if (parserContext.getRegistry().containsBeanDefinition(XmppNamespaceHandler.XMPP_CONNECTION_BEAN_NAME)) { @@ -73,7 +73,7 @@ public abstract class AbstractXmppInboundChannelAdapterParser extends AbstractCh return builder.getBeanDefinition(); } - protected void postProcess(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){ + protected void postProcess(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { // no op } diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/AbstractXmppOutboundChannelAdapterParser.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/AbstractXmppOutboundChannelAdapterParser.java index 19a176a488..e626b1aae5 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/AbstractXmppOutboundChannelAdapterParser.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/AbstractXmppOutboundChannelAdapterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -42,7 +42,7 @@ public abstract class AbstractXmppOutboundChannelAdapterParser extends AbstractO IntegrationNamespaceUtils.configureHeaderMapper(element, builder, parserContext, DefaultXmppHeaderMapper.class, null); String connectionName = element.getAttribute("xmpp-connection"); - if (StringUtils.hasText(connectionName)){ + if (StringUtils.hasText(connectionName)) { builder.addConstructorArgReference(connectionName); } else if (parserContext.getRegistry().containsBeanDefinition(XmppNamespaceHandler.XMPP_CONNECTION_BEAN_NAME)) { diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/ChatMessageInboundChannelAdapterParser.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/ChatMessageInboundChannelAdapterParser.java index acb54ee523..27e0b0d913 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/ChatMessageInboundChannelAdapterParser.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/ChatMessageInboundChannelAdapterParser.java @@ -39,7 +39,7 @@ public class ChatMessageInboundChannelAdapterParser extends AbstractXmppInboundC } @Override - protected void postProcess(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){ + protected void postProcess(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { if (element.hasAttribute("extract-payload")) { parserContext.getReaderContext() .warning("The 'extract-payload' is deprecated. Use 'payload-expression' instead.", element); diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests.java index 681064d353..36c82439da 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -54,7 +54,7 @@ public class PresenceOutboundChannelAdapterParserTests { private static volatile int adviceCalled; @Test - public void testRosterEventOutboundChannelAdapterParserAsPollingConsumer(){ + public void testRosterEventOutboundChannelAdapterParserAsPollingConsumer() { Object pollingConsumer = context.getBean("pollingOutboundRosterAdapter"); assertTrue(pollingConsumer instanceof PollingConsumer); AbstractXmppConnectionAwareMessageHandler handler = (AbstractXmppConnectionAwareMessageHandler) TestUtils @@ -63,7 +63,7 @@ public class PresenceOutboundChannelAdapterParserTests { } @Test - public void testRosterEventOutboundChannelAdapterParserEventConsumer(){ + public void testRosterEventOutboundChannelAdapterParserEventConsumer() { Object eventConsumer = context.getBean("eventOutboundRosterAdapter"); assertTrue(eventConsumer instanceof EventDrivenConsumer); AbstractXmppConnectionAwareMessageHandler handler = (AbstractXmppConnectionAwareMessageHandler) TestUtils @@ -72,7 +72,7 @@ public class PresenceOutboundChannelAdapterParserTests { } @Test - public void advised(){ + public void advised() { Object eventConsumer = context.getBean("advised"); assertTrue(eventConsumer instanceof EventDrivenConsumer); MessageHandler handler = TestUtils.getPropertyValue(eventConsumer, "handler", MessageHandler.class); @@ -81,7 +81,7 @@ public class PresenceOutboundChannelAdapterParserTests { } @Test - public void testRosterEventOutboundChannel(){ + public void testRosterEventOutboundChannel() { Object channel = context.getBean("eventOutboundRosterChannel"); assertTrue(channel instanceof SubscribableChannel); UnicastingDispatcher dispatcher = (UnicastingDispatcher) TestUtils diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/OutboundChatTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/OutboundChatTests.java index 80dee4479b..58450e7830 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/OutboundChatTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/OutboundChatTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -35,7 +35,7 @@ public class OutboundChatTests { @Test @Ignore public void run() throws Exception { - Thread.sleep(10 * 1000*100); + Thread.sleep(10 * 1000 * 100); } } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/SmackMessageSampleTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/SmackMessageSampleTests.java index 1f8f4b8681..635a603f49 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/SmackMessageSampleTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/SmackMessageSampleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -32,7 +32,7 @@ public class SmackMessageSampleTests { @Test @Ignore - public void validateSmackMessageSent(){ + public void validateSmackMessageSent() { ApplicationContext ac = new ClassPathXmlApplicationContext("SmackMessageSampleTest-context.xml", this.getClass()); MessageChannel xmppInput = ac.getBean("xmppInput", MessageChannel.class); diff --git a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/leader/LeaderInitiator.java b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/leader/LeaderInitiator.java index ffa313fa90..995434a006 100644 --- a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/leader/LeaderInitiator.java +++ b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/leader/LeaderInitiator.java @@ -146,7 +146,7 @@ public class LeaderInitiator implements SmartLifecycle { */ @Override public void start() { - synchronized(this.lifecycleMonitor) { + synchronized (this.lifecycleMonitor) { if (!this.running) { if (this.client.getState() != CuratorFrameworkState.STARTED) { // we want to do curator start here because it needs to diff --git a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/lock/ZookeeperLockRegistry.java b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/lock/ZookeeperLockRegistry.java index 61927ba8ff..e4fe7af5d2 100644 --- a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/lock/ZookeeperLockRegistry.java +++ b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/lock/ZookeeperLockRegistry.java @@ -115,10 +115,10 @@ public class ZookeeperLockRegistry implements ExpirableLockRegistry { if (!this.trackingTime) { throw new IllegalStateException("Ths KeyToPathStrategy is bounded; expiry is not supported"); } - synchronized(this.locks) { + synchronized (this.locks) { Iterator> iterator = this.locks.entrySet().iterator(); long now = System.currentTimeMillis(); - while(iterator.hasNext()) { + while (iterator.hasNext()) { Entry entry = iterator.next(); ZkLock lock = entry.getValue(); if (now - lock.getLastUsed() > age diff --git a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java index 253ec9b99d..196d852d40 100644 --- a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java +++ b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java @@ -57,7 +57,7 @@ public class ZookeeperMetadataStore implements ListenableMetadataStore, SmartLif * An internal map storing local updates, ensuring that they have precedence if the cache contains stale data. * As changes are propagated back from Zookeeper to the cache, entries are removed. */ - private final ConcurrentMap updateMap = new ConcurrentHashMap(); + private final ConcurrentMap updateMap = new ConcurrentHashMap(); private volatile String root = "/SpringIntegration-MetadataStore"; diff --git a/spring-integration-zookeeper/src/test/java/org/springframework/integration/zookeeper/ZookeeperTestSupport.java b/spring-integration-zookeeper/src/test/java/org/springframework/integration/zookeeper/ZookeeperTestSupport.java index 573a9c92cb..6eb0cfb97d 100644 --- a/spring-integration-zookeeper/src/test/java/org/springframework/integration/zookeeper/ZookeeperTestSupport.java +++ b/spring-integration-zookeeper/src/test/java/org/springframework/integration/zookeeper/ZookeeperTestSupport.java @@ -64,7 +64,7 @@ public class ZookeeperTestSupport { } @Before - public void setUp() throws Exception{ + public void setUp() throws Exception { client = createNewClient(); } diff --git a/spring-integration-zookeeper/src/test/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStoreTests.java b/spring-integration-zookeeper/src/test/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStoreTests.java index d5effe3583..4471d2ffb4 100644 --- a/spring-integration-zookeeper/src/test/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStoreTests.java +++ b/spring-integration-zookeeper/src/test/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStoreTests.java @@ -229,7 +229,7 @@ public class ZookeeperMetadataStoreTests extends ZookeeperTestSupport { // register listeners final List> notifiedChanges = new ArrayList>(); - final Map barriers = new HashMap(); + final Map barriers = new HashMap(); barriers.put("add", new CyclicBarrier(2)); barriers.put("remove", new CyclicBarrier(2)); barriers.put("update", new CyclicBarrier(2)); @@ -299,7 +299,7 @@ public class ZookeeperMetadataStoreTests extends ZookeeperTestSupport { // register listeners final List> notifiedChanges = new ArrayList>(); - final Map barriers = new HashMap(); + final Map barriers = new HashMap(); barriers.put("add", new CyclicBarrier(2)); barriers.put("remove", new CyclicBarrier(2)); barriers.put("update", new CyclicBarrier(2)); diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index 402a6afd5c..17bac679ca 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -163,8 +163,8 @@ - - + + diff --git a/src/checkstyle/fixWhiteAround.gradle b/src/checkstyle/fixWhiteAround.gradle new file mode 100644 index 0000000000..94cf02812c --- /dev/null +++ b/src/checkstyle/fixWhiteAround.gradle @@ -0,0 +1,64 @@ +task fixWhiteAround << { + fileTree("${buildDir}/reports/checkstyle").include('*.xml').each { report -> + def xml = new XmlParser(false, false).parse(report) + xml.file.each { f -> + def errors = f.error + def thisErrors = [] + errors.each { error -> + if (error.@source == 'com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck' || + error.@source == 'com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck') { + thisErrors.add(error) + } + } + if (thisErrors) { + def errorInx = 0 + def error = thisErrors[errorInx++] + def file = new File(f.@name) + println "Fixing file $file ..." + boolean headerFixed + def outSource = '' + file.eachLine { line, ln -> + if (!headerFixed) { + def matcher = line =~ /Copyright (20\d\d)(?:-(20\d\d))?/ + if (matcher.count) { + def year1 = matcher[0][1] + if (now != year1) { + if (now != matcher[0][2]) { + line = line.replaceFirst(/(20\d\d)(?:-20\d\d)?/, year1 + "-$now") + } + } + headerFixed = true + } + } + + if (error && ln == (error.@line as int)) { + def message = error.@message + + def index = (error.@column as int) - 1 + def chars = line.toCharArray() + for (int i = 0; i < index; i++) { + if (chars[i] == '\t') { // tabs before code == 8 + index -= 7; + } + else if (chars[i] != ' ') { // tabs after code start are only counted as 1 + break; + } + } + + line = line.substring(0, index) + ' ' + line.substring(index) + + println "Fixed line $line" + + while (error && ln == (error.@line as int)) { + error = thisErrors[errorInx++] + } + } + + outSource += line + System.lineSeparator() + } + file.write(outSource) + println() + } + } + } +}