diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MessageSequenceComparatorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MessageSequenceComparatorTests.java index 2a66e0512a..a81f926521 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MessageSequenceComparatorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MessageSequenceComparatorTests.java @@ -22,7 +22,6 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -62,8 +61,8 @@ public class MessageSequenceComparatorTests { @Test public void testEqualWithDefaultValues() { MessageSequenceComparator comparator = new MessageSequenceComparator(); - StringMessage message1 = new StringMessage("test1"); - StringMessage message2 = new StringMessage("test2"); + Message message1 = MessageBuilder.withPayload("test1").build(); + Message message2 = MessageBuilder.withPayload("test2").build(); assertEquals(0, comparator.compare(message1, message2)); } 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 4e5a576233..d12b0a40dd 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 @@ -38,6 +38,7 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; + import org.springframework.aop.framework.ProxyFactory; import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.support.ConversionServiceFactory; @@ -49,10 +50,10 @@ import org.springframework.integration.annotation.Headers; import org.springframework.integration.annotation.Payloads; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.MessagingTemplate; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.EventDrivenConsumer; import org.springframework.integration.store.MessageGroup; import org.springframework.integration.store.SimpleMessageGroup; @@ -377,8 +378,8 @@ public class MethodInvokingMessageGroupProcessorTests { SingleAnnotationTestBean bean = new SingleAnnotationTestBean(); MethodInvokingMessageGroupProcessor aggregator = new MethodInvokingMessageGroupProcessor(bean); SimpleMessageGroup group = new SimpleMessageGroup("FOO"); - group.add(new StringMessage("foo")); - group.add(new StringMessage("bar")); + group.add(new GenericMessage("foo")); + group.add(new GenericMessage("bar")); assertEquals("foo", aggregator.aggregatePayloads(group, null)); } @@ -462,8 +463,8 @@ public class MethodInvokingMessageGroupProcessorTests { NoAnnotationTestBean bean = new NoAnnotationTestBean(); MethodInvokingMessageGroupProcessor aggregator = new MethodInvokingMessageGroupProcessor(bean); SimpleMessageGroup group = new SimpleMessageGroup("FOO"); - group.add(new StringMessage("foo")); - group.add(new StringMessage("bar")); + group.add(new GenericMessage("foo")); + group.add(new GenericMessage("bar")); assertEquals("foo", aggregator.aggregatePayloads(group, null)); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/bus/ApplicationContextMessageBusTests.java b/spring-integration-core/src/test/java/org/springframework/integration/bus/ApplicationContextMessageBusTests.java index 4ededf477c..efbef48e40 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/bus/ApplicationContextMessageBusTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/bus/ApplicationContextMessageBusTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,6 @@ import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageSource; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.EventDrivenConsumer; import org.springframework.integration.endpoint.PollingConsumer; import org.springframework.integration.endpoint.SourcePollingChannelAdapter; @@ -80,7 +79,7 @@ public class ApplicationContextMessageBusTests { TestApplicationContext context = TestUtils.createTestApplicationContext(); QueueChannel sourceChannel = new QueueChannel(); context.registerChannel("sourceChannel", sourceChannel); - sourceChannel.send(new StringMessage("test")); + sourceChannel.send(new GenericMessage("test")); QueueChannel targetChannel = new QueueChannel(); context.registerChannel("targetChannel", targetChannel); context.refresh(); @@ -128,7 +127,7 @@ public class ApplicationContextMessageBusTests { context.registerEndpoint("testEndpoint1", endpoint1); context.registerEndpoint("testEndpoint2", endpoint2); context.refresh(); - inputChannel.send(new StringMessage("testing")); + inputChannel.send(new GenericMessage("testing")); Message message1 = outputChannel1.receive(3000); Message message2 = outputChannel2.receive(0); context.stop(); @@ -166,7 +165,7 @@ public class ApplicationContextMessageBusTests { context.registerEndpoint("testEndpoint1", endpoint1); context.registerEndpoint("testEndpoint2", endpoint2); context.refresh(); - inputChannel.send(new StringMessage("testing")); + inputChannel.send(new GenericMessage("testing")); latch.await(500, TimeUnit.MILLISECONDS); assertEquals("both handlers should have been invoked", 0, latch.getCount()); Message message1 = outputChannel1.receive(500); 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 abbf5e264a..865945d635 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-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; + import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.annotation.MessageEndpoint; @@ -28,8 +29,8 @@ import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor; import org.springframework.integration.context.IntegrationContextUtils; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.EventDrivenConsumer; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.integration.handler.ServiceActivatingHandler; @@ -63,7 +64,7 @@ public class DirectChannelSubscriptionTests { EventDrivenConsumer endpoint = new EventDrivenConsumer(sourceChannel, serviceActivator); context.registerEndpoint("testEndpoint", endpoint); context.refresh(); - this.sourceChannel.send(new StringMessage("foo")); + this.sourceChannel.send(new GenericMessage("foo")); Message response = this.targetChannel.receive(); assertEquals("foo!", response.getPayload()); context.stop(); @@ -77,7 +78,7 @@ public class DirectChannelSubscriptionTests { TestEndpoint endpoint = new TestEndpoint(); postProcessor.postProcessAfterInitialization(endpoint, "testEndpoint"); context.refresh(); - this.sourceChannel.send(new StringMessage("foo")); + this.sourceChannel.send(new GenericMessage("foo")); Message response = this.targetChannel.receive(); assertEquals("foo-from-annotated-endpoint", response.getPayload()); context.stop(); @@ -96,7 +97,7 @@ public class DirectChannelSubscriptionTests { context.registerEndpoint("testEndpoint", endpoint); context.refresh(); try { - this.sourceChannel.send(new StringMessage("foo")); + this.sourceChannel.send(new GenericMessage("foo")); } finally { context.stop(); @@ -114,7 +115,7 @@ public class DirectChannelSubscriptionTests { postProcessor.postProcessAfterInitialization(endpoint, "testEndpoint"); context.refresh(); try { - this.sourceChannel.send(new StringMessage("foo")); + this.sourceChannel.send(new GenericMessage("foo")); } finally { context.stop(); @@ -125,7 +126,7 @@ public class DirectChannelSubscriptionTests { static class TestBean { public Message handle(Message message) { - return new StringMessage(message.getPayload() + "!"); + return new GenericMessage(message.getPayload() + "!"); } } @@ -135,7 +136,7 @@ public class DirectChannelSubscriptionTests { @ServiceActivator(inputChannel="sourceChannel", outputChannel="targetChannel") public Message handle(Message message) { - return new StringMessage(message.getPayload() + "-from-annotated-endpoint"); + return new GenericMessage(message.getPayload() + "-from-annotated-endpoint"); } } 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 bf756be4f7..68c6ae6528 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-2008 the original author or authors. + * Copyright 2002-2010 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,8 +25,8 @@ import java.util.List; import org.junit.Test; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -36,9 +36,9 @@ public class ChannelPurgerTests { @Test public void testPurgeAllWithoutSelector() { QueueChannel channel = new QueueChannel(); - channel.send(new StringMessage("test1")); - channel.send(new StringMessage("test2")); - channel.send(new StringMessage("test3")); + channel.send(new GenericMessage("test1")); + channel.send(new GenericMessage("test2")); + channel.send(new GenericMessage("test3")); ChannelPurger purger = new ChannelPurger(channel); List> purgedMessages = purger.purge(); assertEquals(3, purgedMessages.size()); @@ -48,9 +48,9 @@ public class ChannelPurgerTests { @Test public void testPurgeAllWithSelector() { QueueChannel channel = new QueueChannel(); - channel.send(new StringMessage("test1")); - channel.send(new StringMessage("test2")); - channel.send(new StringMessage("test3")); + channel.send(new GenericMessage("test1")); + channel.send(new GenericMessage("test2")); + channel.send(new GenericMessage("test3")); ChannelPurger purger = new ChannelPurger(new MessageSelector() { public boolean accept(Message message) { return false; @@ -64,9 +64,9 @@ public class ChannelPurgerTests { @Test public void testPurgeNoneWithSelector() { QueueChannel channel = new QueueChannel(); - channel.send(new StringMessage("test1")); - channel.send(new StringMessage("test2")); - channel.send(new StringMessage("test3")); + channel.send(new GenericMessage("test1")); + channel.send(new GenericMessage("test2")); + channel.send(new GenericMessage("test3")); ChannelPurger purger = new ChannelPurger(new MessageSelector() { public boolean accept(Message message) { return true; @@ -82,9 +82,9 @@ public class ChannelPurgerTests { @Test public void testPurgeSubsetWithSelector() { QueueChannel channel = new QueueChannel(); - channel.send(new StringMessage("test1")); - channel.send(new StringMessage("test2")); - channel.send(new StringMessage("test3")); + channel.send(new GenericMessage("test1")); + channel.send(new GenericMessage("test2")); + channel.send(new GenericMessage("test3")); ChannelPurger purger = new ChannelPurger(new MessageSelector() { public boolean accept(Message message) { return (message.getPayload().equals("test2")); @@ -102,10 +102,10 @@ public class ChannelPurgerTests { public void testMultipleChannelsWithNoSelector() { QueueChannel channel1 = new QueueChannel(); QueueChannel channel2 = new QueueChannel(); - channel1.send(new StringMessage("test1")); - channel1.send(new StringMessage("test2")); - channel2.send(new StringMessage("test1")); - channel2.send(new StringMessage("test2")); + channel1.send(new GenericMessage("test1")); + channel1.send(new GenericMessage("test2")); + channel2.send(new GenericMessage("test1")); + channel2.send(new GenericMessage("test2")); ChannelPurger purger = new ChannelPurger(channel1, channel2); List> purgedMessages = purger.purge(); assertEquals(4, purgedMessages.size()); @@ -117,12 +117,12 @@ public class ChannelPurgerTests { public void testMultipleChannelsWithSelector() { QueueChannel channel1 = new QueueChannel(); QueueChannel channel2 = new QueueChannel(); - channel1.send(new StringMessage("test1")); - channel1.send(new StringMessage("test2")); - channel1.send(new StringMessage("test3")); - channel2.send(new StringMessage("test1")); - channel2.send(new StringMessage("test2")); - channel2.send(new StringMessage("test3")); + channel1.send(new GenericMessage("test1")); + channel1.send(new GenericMessage("test2")); + channel1.send(new GenericMessage("test3")); + channel2.send(new GenericMessage("test1")); + channel2.send(new GenericMessage("test2")); + channel2.send(new GenericMessage("test3")); ChannelPurger purger = new ChannelPurger(new MessageSelector() { public boolean accept(Message message) { return (message.getPayload().equals("test2")); @@ -144,10 +144,10 @@ public class ChannelPurgerTests { public void testPurgeNoneWithSelectorAndMultipleChannels() { QueueChannel channel1 = new QueueChannel(); QueueChannel channel2 = new QueueChannel(); - channel1.send(new StringMessage("test1")); - channel1.send(new StringMessage("test2")); - channel2.send(new StringMessage("test1")); - channel2.send(new StringMessage("test2")); + channel1.send(new GenericMessage("test1")); + channel1.send(new GenericMessage("test2")); + channel2.send(new GenericMessage("test1")); + channel2.send(new GenericMessage("test2")); ChannelPurger purger = new ChannelPurger(new MessageSelector() { public boolean accept(Message message) { return true; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/DatatypeChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/DatatypeChannelTests.java index 8cb035e997..18731a9c02 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/DatatypeChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/DatatypeChannelTests.java @@ -38,7 +38,6 @@ import org.springframework.integration.context.IntegrationContextUtils; import org.springframework.integration.core.ErrorMessage; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -49,13 +48,13 @@ public class DatatypeChannelTests { @Test public void supportedType() { MessageChannel channel = createChannel(String.class); - assertTrue(channel.send(new StringMessage("test"))); + assertTrue(channel.send(new GenericMessage("test"))); } @Test(expected = MessageDeliveryException.class) public void unsupportedTypeAndNoConversionService() { MessageChannel channel = createChannel(Integer.class); - channel.send(new StringMessage("123")); + channel.send(new GenericMessage("123")); } @Test @@ -63,7 +62,7 @@ public class DatatypeChannelTests { QueueChannel channel = createChannel(Integer.class); ConversionService conversionService = ConversionServiceFactory.createDefaultConversionService(); channel.setConversionService(conversionService); - assertTrue(channel.send(new StringMessage("123"))); + assertTrue(channel.send(new GenericMessage("123"))); } @Test(expected = MessageDeliveryException.class) @@ -139,7 +138,7 @@ public class DatatypeChannelTests { @Test public void multipleTypes() { MessageChannel channel = createChannel(String.class, Integer.class); - assertTrue(channel.send(new StringMessage("test1"))); + assertTrue(channel.send(new GenericMessage("test1"))); assertTrue(channel.send(new GenericMessage(2))); Exception exception = null; try { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/DirectChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/DirectChannelTests.java index e17ad8da5d..c76eb5b7b4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/DirectChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/DirectChannelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,8 +26,8 @@ import org.junit.Test; import org.springframework.beans.DirectFieldAccessor; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageHandler; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.dispatcher.RoundRobinLoadBalancingStrategy; import org.springframework.integration.dispatcher.UnicastingDispatcher; @@ -42,7 +42,7 @@ public class DirectChannelTests { DirectChannel channel = new DirectChannel(); ThreadNameExtractingTestTarget target = new ThreadNameExtractingTestTarget(); channel.subscribe(target); - StringMessage message = new StringMessage("test"); + GenericMessage message = new GenericMessage("test"); assertTrue(channel.send(message)); assertEquals(Thread.currentThread().getName(), target.threadName); DirectFieldAccessor channelAccessor = new DirectFieldAccessor(channel); @@ -58,7 +58,7 @@ public class DirectChannelTests { final DirectChannel channel = new DirectChannel(); ThreadNameExtractingTestTarget target = new ThreadNameExtractingTestTarget(latch); channel.subscribe(target); - final StringMessage message = new StringMessage("test"); + final GenericMessage message = new GenericMessage("test"); new Thread(new Runnable() { public void run() { channel.send(message); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/ExecutorChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/ExecutorChannelTests.java index 517421cef2..e1cc15e3d6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/ExecutorChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/ExecutorChannelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,8 +31,8 @@ import org.junit.Test; import org.springframework.core.task.SimpleAsyncTaskExecutor; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageHandler; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.dispatcher.RoundRobinLoadBalancingStrategy; import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor; import org.springframework.scheduling.concurrent.CustomizableThreadFactory; @@ -50,7 +50,7 @@ public class ExecutorChannelTests { CountDownLatch latch = new CountDownLatch(1); TestHandler handler = new TestHandler(latch); channel.subscribe(handler); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); latch.await(1000, TimeUnit.MILLISECONDS); assertEquals(0, latch.getCount()); assertNotNull(handler.thread); @@ -73,7 +73,7 @@ public class ExecutorChannelTests { channel.subscribe(handler2); channel.subscribe(handler3); for (int i = 0; i < numberOfMessages; i++) { - channel.send(new StringMessage("test-" + i)); + channel.send(new GenericMessage("test-" + i)); } latch.await(3000, TimeUnit.MILLISECONDS); assertEquals(0, latch.getCount()); @@ -107,7 +107,7 @@ public class ExecutorChannelTests { channel.subscribe(handler3); handler2.shouldFail = true; for (int i = 0; i < numberOfMessages; i++) { - channel.send(new StringMessage("test-" + i)); + channel.send(new GenericMessage("test-" + i)); } latch.await(3000, TimeUnit.MILLISECONDS); assertEquals(0, latch.getCount()); @@ -140,7 +140,7 @@ public class ExecutorChannelTests { channel.subscribe(handler3); handler1.shouldFail = true; for (int i = 0; i < numberOfMessages; i++) { - channel.send(new StringMessage("test-" + i)); + channel.send(new GenericMessage("test-" + i)); } latch.await(3000, TimeUnit.MILLISECONDS); assertEquals(0, latch.getCount()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/MessagingTemplateTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/MessagingTemplateTests.java index c9729a0d73..70529219d5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/MessagingTemplateTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/MessagingTemplateTests.java @@ -35,11 +35,11 @@ import org.junit.Test; import org.springframework.context.support.StaticApplicationContext; import org.springframework.integration.Message; import org.springframework.integration.core.ChannelResolutionException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.PollingConsumer; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.integration.test.util.TestUtils; @@ -86,7 +86,7 @@ public class MessagingTemplateTests { public void send() { MessagingTemplate template = new MessagingTemplate(); QueueChannel channel = new QueueChannel(); - template.send(channel, new StringMessage("test")); + template.send(channel, new GenericMessage("test")); Message reply = channel.receive(0); assertNotNull(reply); assertEquals("test", reply.getPayload()); @@ -97,7 +97,7 @@ public class MessagingTemplateTests { QueueChannel channel = new QueueChannel(); MessagingTemplate template = new MessagingTemplate(); template.setDefaultChannel(channel); - template.send(new StringMessage("test")); + template.send(new GenericMessage("test")); Message reply = channel.receive(0); assertNotNull(reply); assertEquals("test", reply.getPayload()); @@ -107,7 +107,7 @@ public class MessagingTemplateTests { public void sendWithDefaultChannelProvidedByConstructor() { QueueChannel channel = new QueueChannel(); MessagingTemplate template = new MessagingTemplate(channel); - template.send(new StringMessage("test")); + template.send(new GenericMessage("test")); Message reply = channel.receive(0); assertNotNull(reply); assertEquals("test", reply.getPayload()); @@ -118,7 +118,7 @@ public class MessagingTemplateTests { QueueChannel explicitChannel = new QueueChannel(); QueueChannel defaultChannel = new QueueChannel(); MessagingTemplate template = new MessagingTemplate(defaultChannel); - template.send(explicitChannel, new StringMessage("test")); + template.send(explicitChannel, new GenericMessage("test")); Message reply = explicitChannel.receive(0); assertNotNull(reply); assertEquals("test", reply.getPayload()); @@ -128,13 +128,13 @@ public class MessagingTemplateTests { @Test(expected = IllegalStateException.class) public void sendWithoutChannelArgFailsIfNoDefaultAvailable() { MessagingTemplate template = new MessagingTemplate(); - template.send(new StringMessage("test")); + template.send(new GenericMessage("test")); } @Test public void receive() { QueueChannel channel = new QueueChannel(); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); MessagingTemplate template = new MessagingTemplate(); Message reply = template.receive(channel); assertEquals("test", reply.getPayload()); @@ -143,7 +143,7 @@ public class MessagingTemplateTests { @Test public void receiveWithDefaultChannelProvidedBySetter() { QueueChannel channel = new QueueChannel(); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); MessagingTemplate template = new MessagingTemplate(); template.setDefaultChannel(channel); Message reply = template.receive(); @@ -153,7 +153,7 @@ public class MessagingTemplateTests { @Test public void receiveWithDefaultChannelProvidedByConstructor() { QueueChannel channel = new QueueChannel(); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); MessagingTemplate template = new MessagingTemplate(channel); Message reply = template.receive(); assertEquals("test", reply.getPayload()); @@ -163,7 +163,7 @@ public class MessagingTemplateTests { public void receiveWithExplicitChannelTakesPrecedenceOverDefault() { QueueChannel explicitChannel = new QueueChannel(); QueueChannel defaultChannel = new QueueChannel(); - explicitChannel.send(new StringMessage("test")); + explicitChannel.send(new GenericMessage("test")); MessagingTemplate template = new MessagingTemplate(defaultChannel); template.setReceiveTimeout(0); Message reply = template.receive(explicitChannel); @@ -188,7 +188,7 @@ public class MessagingTemplateTests { public void sendAndReceive() { MessagingTemplate template = new MessagingTemplate(); template.setReceiveTimeout(3000); - Message reply = template.sendAndReceive(this.requestChannel, new StringMessage("test")); + Message reply = template.sendAndReceive(this.requestChannel, new GenericMessage("test")); assertEquals("TEST", reply.getPayload()); } @@ -197,7 +197,7 @@ public class MessagingTemplateTests { MessagingTemplate template = new MessagingTemplate(); template.setReceiveTimeout(3000); template.setDefaultChannel(this.requestChannel); - Message reply = template.sendAndReceive(new StringMessage("test")); + Message reply = template.sendAndReceive(new GenericMessage("test")); assertEquals("TEST", reply.getPayload()); } @@ -206,7 +206,7 @@ public class MessagingTemplateTests { QueueChannel defaultChannel = new QueueChannel(); MessagingTemplate template = new MessagingTemplate(defaultChannel); template.setReceiveTimeout(3000); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); Message reply = template.sendAndReceive(this.requestChannel, message); assertEquals("TEST", reply.getPayload()); assertNull(defaultChannel.receive(0)); @@ -215,7 +215,7 @@ public class MessagingTemplateTests { @Test(expected = IllegalStateException.class) public void sendAndReceiveWithoutChannelArgFailsIfNoDefaultAvailable() { MessagingTemplate template = new MessagingTemplate(); - template.sendAndReceive(new StringMessage("test")); + template.sendAndReceive(new GenericMessage("test")); } @Test 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 cf732d25d1..8499ff4d7d 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -16,6 +16,20 @@ package org.springframework.integration.channel; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicBoolean; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -24,26 +38,18 @@ import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.runners.MockitoJUnitRunner; import org.mockito.stubbing.Answer; + import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.task.SimpleAsyncTaskExecutor; import org.springframework.integration.Message; import org.springframework.integration.MessageRejectedException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageHandler; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.dispatcher.RoundRobinLoadBalancingStrategy; import org.springframework.integration.dispatcher.UnicastingDispatcher; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.*; - /** * @author Oleg Zhurakousky */ @@ -72,7 +78,7 @@ public class MixedDispatcherConfigurationScenarioTests { @Mock private MessageHandler handlerC; - private Message message = new StringMessage("test"); + private Message message = new GenericMessage("test"); @Before 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 ff9779447a..2747a25310 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 @@ -32,8 +32,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.junit.Test; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -43,12 +43,12 @@ public class PriorityChannelTests { @Test public void testCapacityEnforced() { PriorityChannel channel = new PriorityChannel(3); - assertTrue(channel.send(new StringMessage("test1"), 0)); - assertTrue(channel.send(new StringMessage("test2"), 0)); - assertTrue(channel.send(new StringMessage("test3"), 0)); - assertFalse(channel.send(new StringMessage("test4"), 0)); + assertTrue(channel.send(new GenericMessage("test1"), 0)); + assertTrue(channel.send(new GenericMessage("test2"), 0)); + assertTrue(channel.send(new GenericMessage("test3"), 0)); + assertFalse(channel.send(new GenericMessage("test4"), 0)); channel.receive(0); - assertTrue(channel.send(new StringMessage("test5"))); + assertTrue(channel.send(new GenericMessage("test5"))); } @Test @@ -74,11 +74,11 @@ public class PriorityChannelTests { @Test public void testCustomComparator() { PriorityChannel channel = new PriorityChannel(5, new StringPayloadComparator()); - Message messageA = new StringMessage("A"); - Message messageB = new StringMessage("B"); - Message messageC = new StringMessage("C"); - Message messageD = new StringMessage("D"); - Message messageE = new StringMessage("E"); + Message messageA = new GenericMessage("A"); + Message messageB = new GenericMessage("B"); + Message messageC = new GenericMessage("C"); + Message messageD = new GenericMessage("D"); + Message messageE = new GenericMessage("E"); channel.send(messageC); channel.send(messageA); channel.send(messageE); @@ -96,7 +96,7 @@ public class PriorityChannelTests { PriorityChannel channel = new PriorityChannel(5); Message highPriority = createPriorityMessage(5); Message lowPriority = createPriorityMessage(-5); - Message nullPriority = new StringMessage("test:NULL"); + Message nullPriority = new GenericMessage("test:NULL"); channel.send(lowPriority); channel.send(highPriority); channel.send(nullPriority); @@ -110,7 +110,7 @@ public class PriorityChannelTests { PriorityChannel channel = new PriorityChannel(); Message highPriority = createPriorityMessage(5); Message lowPriority = createPriorityMessage(-5); - Message nullPriority = new StringMessage("test:NULL"); + Message nullPriority = new GenericMessage("test:NULL"); channel.send(lowPriority); channel.send(highPriority); channel.send(nullPriority); @@ -125,10 +125,10 @@ public class PriorityChannelTests { final AtomicBoolean sentSecondMessage = new AtomicBoolean(false); final CountDownLatch latch = new CountDownLatch(1); Executor executor = Executors.newSingleThreadScheduledExecutor(); - channel.send(new StringMessage("test-1")); + channel.send(new GenericMessage("test-1")); executor.execute(new Runnable() { public void run() { - sentSecondMessage.set(channel.send(new StringMessage("test-2"), 10)); + sentSecondMessage.set(channel.send(new GenericMessage("test-2"), 10)); latch.countDown(); } }); @@ -148,10 +148,10 @@ public class PriorityChannelTests { final AtomicBoolean sentSecondMessage = new AtomicBoolean(false); final CountDownLatch latch = new CountDownLatch(1); Executor executor = Executors.newSingleThreadScheduledExecutor(); - channel.send(new StringMessage("test-1")); + channel.send(new GenericMessage("test-1")); executor.execute(new Runnable() { public void run() { - sentSecondMessage.set(channel.send(new StringMessage("test-2"), 3000)); + sentSecondMessage.set(channel.send(new GenericMessage("test-2"), 3000)); latch.countDown(); } }); @@ -173,10 +173,10 @@ public class PriorityChannelTests { final AtomicBoolean sentSecondMessage = new AtomicBoolean(false); final CountDownLatch latch = new CountDownLatch(1); Executor executor = Executors.newSingleThreadScheduledExecutor(); - channel.send(new StringMessage("test-1")); + channel.send(new GenericMessage("test-1")); executor.execute(new Runnable() { public void run() { - sentSecondMessage.set(channel.send(new StringMessage("test-2"), -1)); + sentSecondMessage.set(channel.send(new GenericMessage("test-2"), -1)); latch.countDown(); } }); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/QueueChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/QueueChannelTests.java index e58358becb..c67de18b3b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/QueueChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/QueueChannelTests.java @@ -33,7 +33,6 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.selector.UnexpiredMessageSelector; /** @@ -198,9 +197,9 @@ public class QueueChannelTests { @Test public void testClear() { QueueChannel channel = new QueueChannel(2); - StringMessage message1 = new StringMessage("test1"); - StringMessage message2 = new StringMessage("test2"); - StringMessage message3 = new StringMessage("test3"); + GenericMessage message1 = new GenericMessage("test1"); + GenericMessage message2 = new GenericMessage("test2"); + GenericMessage message3 = new GenericMessage("test3"); assertTrue(channel.send(message1)); assertTrue(channel.send(message2)); assertFalse(channel.send(message3, 0)); @@ -231,11 +230,11 @@ public class QueueChannelTests { .setExpirationDate(future).build(); assertTrue(channel.send(expiredMessage, 0)); assertTrue(channel.send(unexpiredMessage, 0)); - assertFalse(channel.send(new StringMessage("atCapacity"), 0)); + assertFalse(channel.send(new GenericMessage("atCapacity"), 0)); List> purgedMessages = channel.purge(new UnexpiredMessageSelector()); assertNotNull(purgedMessages); assertEquals(1, purgedMessages.size()); - assertTrue(channel.send(new StringMessage("roomAvailable"), 0)); + assertTrue(channel.send(new GenericMessage("roomAvailable"), 0)); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java index f62499b6fa..53a6530ad4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java @@ -43,7 +43,6 @@ import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.dispatcher.RoundRobinLoadBalancingStrategy; import org.springframework.integration.dispatcher.UnicastingDispatcher; import org.springframework.integration.util.ErrorHandlingTaskExecutor; @@ -147,7 +146,7 @@ public class ChannelParserTests { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("channelParserTests.xml", this .getClass()); MessageChannel channel = (MessageChannel) context.getBean("integerChannel"); - channel.send(new StringMessage("incorrect type")); + channel.send(new GenericMessage("incorrect type")); } @Test @@ -165,7 +164,7 @@ public class ChannelParserTests { .getClass()); MessageChannel channel = (MessageChannel) context.getBean("stringOrNumberChannel"); assertTrue(channel.send(new GenericMessage(123))); - assertTrue(channel.send(new StringMessage("accepted type"))); + assertTrue(channel.send(new GenericMessage("accepted type"))); } @Test(expected = MessageDeliveryException.class) @@ -183,7 +182,7 @@ public class ChannelParserTests { PollableChannel channel = (PollableChannel) context.getBean("channelWithInterceptorRef"); TestChannelInterceptor interceptor = (TestChannelInterceptor) context.getBean("interceptor"); assertEquals(0, interceptor.getSendCount()); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); assertEquals(1, interceptor.getSendCount()); assertEquals(0, interceptor.getReceiveCount()); channel.receive(); @@ -195,7 +194,7 @@ public class ChannelParserTests { ApplicationContext context = new ClassPathXmlApplicationContext("channelInterceptorParserTests.xml", this .getClass()); PollableChannel channel = (PollableChannel) context.getBean("channelWithInterceptorInnerBean"); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); Message transformed = channel.receive(1000); assertEquals("TEST", transformed.getPayload()); } @@ -223,10 +222,10 @@ public class ChannelParserTests { ApplicationContext context = new ClassPathXmlApplicationContext("priorityChannelParserTests.xml", this .getClass()); PollableChannel channel = (PollableChannel) context.getBean("priorityChannelWithCustomComparator"); - channel.send(new StringMessage("C")); - channel.send(new StringMessage("A")); - channel.send(new StringMessage("D")); - channel.send(new StringMessage("B")); + channel.send(new GenericMessage("C")); + channel.send(new GenericMessage("A")); + channel.send(new GenericMessage("D")); + channel.send(new GenericMessage("B")); Message reply1 = channel.receive(0); Message reply2 = channel.receive(0); Message reply3 = channel.receive(0); @@ -250,7 +249,7 @@ public class ChannelParserTests { assertEquals(3, channel.receive(0).getPayload()); boolean threwException = false; try { - channel.send(new StringMessage("wrong type")); + channel.send(new GenericMessage("wrong type")); } catch (MessageDeliveryException e) { assertEquals("wrong type", e.getFailedMessage().getPayload()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/TestSource.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/TestSource.java index 3243dade8e..a18e063ca5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/TestSource.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/TestSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -17,8 +17,8 @@ package org.springframework.integration.channel.config; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSource; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -33,7 +33,7 @@ public class TestSource implements MessageSource { } public Message receive() { - return new StringMessage(this.text); + return new GenericMessage(this.text); } } 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 31c899a091..dc194f6a12 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-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -28,11 +28,12 @@ import java.util.concurrent.TimeUnit; 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.integration.config.TestChannelInterceptor; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -55,12 +56,12 @@ public class ThreadLocalChannelParserTests { @Test public void testSendInAnotherThread() throws Exception { - simpleChannel.send(new StringMessage("test")); + simpleChannel.send(new GenericMessage("test")); Executor otherThreadExecutor = Executors.newSingleThreadExecutor(); final CountDownLatch latch = new CountDownLatch(1); otherThreadExecutor.execute(new Runnable() { public void run() { - simpleChannel.send(new StringMessage("crap")); + simpleChannel.send(new GenericMessage("crap")); latch.countDown(); } }); @@ -72,11 +73,11 @@ public class ThreadLocalChannelParserTests { @Test public void testReceiveInAnotherThread() throws Exception { - simpleChannel.send(new StringMessage("test-1.1")); - simpleChannel.send(new StringMessage("test-1.2")); - simpleChannel.send(new StringMessage("test-1.3")); - channelWithInterceptor.send(new StringMessage("test-2.1")); - channelWithInterceptor.send(new StringMessage("test-2.2")); + simpleChannel.send(new GenericMessage("test-1.1")); + simpleChannel.send(new GenericMessage("test-1.2")); + simpleChannel.send(new GenericMessage("test-1.3")); + channelWithInterceptor.send(new GenericMessage("test-2.1")); + channelWithInterceptor.send(new GenericMessage("test-2.2")); Executor otherThreadExecutor = Executors.newSingleThreadExecutor(); final List otherThreadResults = new ArrayList(); final CountDownLatch latch = new CountDownLatch(2); @@ -108,7 +109,7 @@ public class ThreadLocalChannelParserTests { @Test public void testInterceptor() { int before = interceptor.getSendCount(); - channelWithInterceptor.send(new StringMessage("test")); + channelWithInterceptor.send(new GenericMessage("test")); 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 9b222e4ea2..dafff23b79 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 @@ -27,15 +27,16 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; + import org.springframework.beans.DirectFieldAccessor; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; import org.springframework.integration.channel.AbstractMessageChannel; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.util.StringUtils; /** @@ -50,7 +51,7 @@ public class ChannelInterceptorTests { @Test public void testPreSendInterceptorReturnsMessage() { channel.addInterceptor(new PreSendReturnsMessageInterceptor()); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); Message result = channel.receive(0); assertNotNull(result); assertEquals("test", result.getPayload()); @@ -61,7 +62,7 @@ public class ChannelInterceptorTests { public void testPreSendInterceptorReturnsNull() { PreSendReturnsNullInterceptor interceptor = new PreSendReturnsNullInterceptor(); channel.addInterceptor(interceptor); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); channel.send(message); assertEquals(1, interceptor.getCount()); Message result = channel.receive(0); @@ -81,7 +82,7 @@ public class ChannelInterceptorTests { invoked.set(true); } }); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); assertTrue(invoked.get()); } @@ -104,10 +105,10 @@ public class ChannelInterceptorTests { }); assertEquals(0, invokedCounter.get()); assertEquals(0, sentCounter.get()); - singleItemChannel.send(new StringMessage("test1")); + singleItemChannel.send(new GenericMessage("test1")); assertEquals(1, invokedCounter.get()); assertEquals(1, sentCounter.get()); - singleItemChannel.send(new StringMessage("test2"), 0); + singleItemChannel.send(new GenericMessage("test2"), 0); assertEquals(2, invokedCounter.get()); assertEquals(1, sentCounter.get()); } @@ -115,7 +116,7 @@ public class ChannelInterceptorTests { @Test public void testPreReceiveInterceptorReturnsTrue() { channel.addInterceptor(new PreReceiveReturnsTrueInterceptor()); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); channel.send(message); Message result = channel.receive(0); assertEquals(1, PreReceiveReturnsTrueInterceptor.counter.get()); @@ -125,7 +126,7 @@ public class ChannelInterceptorTests { @Test public void testPreReceiveInterceptorReturnsFalse() { channel.addInterceptor(new PreReceiveReturnsFalseInterceptor()); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); channel.send(message); Message result = channel.receive(0); assertEquals(1, PreReceiveReturnsFalseInterceptor.counter.get()); @@ -151,7 +152,7 @@ public class ChannelInterceptorTests { channel.receive(0); assertEquals(1, invokedCount.get()); assertEquals(0, messageCount.get()); - channel.send(new StringMessage("test")); + channel.send(new GenericMessage("test")); Message result = channel.receive(0); assertNotNull(result); assertEquals(2, invokedCount.get()); 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 5473f7f9e2..686a83bb98 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,8 +26,8 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.MessageDeliveryException; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -41,7 +41,7 @@ public class MessageSelectingInterceptorTests { MessageSelectingInterceptor interceptor = new MessageSelectingInterceptor(selector); QueueChannel channel = new QueueChannel(); channel.addInterceptor(interceptor); - assertTrue(channel.send(new StringMessage("test1"))); + assertTrue(channel.send(new GenericMessage("test1"))); } @Test(expected=MessageDeliveryException.class) @@ -51,7 +51,7 @@ public class MessageSelectingInterceptorTests { MessageSelectingInterceptor interceptor = new MessageSelectingInterceptor(selector); QueueChannel channel = new QueueChannel(); channel.addInterceptor(interceptor); - channel.send(new StringMessage("test1")); + channel.send(new GenericMessage("test1")); } @Test @@ -62,7 +62,7 @@ public class MessageSelectingInterceptorTests { MessageSelectingInterceptor interceptor = new MessageSelectingInterceptor(selector1, selector2); QueueChannel channel = new QueueChannel(); channel.addInterceptor(interceptor); - assertTrue(channel.send(new StringMessage("test1"))); + assertTrue(channel.send(new GenericMessage("test1"))); assertEquals(2, counter.get()); } @@ -78,7 +78,7 @@ public class MessageSelectingInterceptorTests { QueueChannel channel = new QueueChannel(); channel.addInterceptor(interceptor); try { - channel.send(new StringMessage("test1")); + channel.send(new GenericMessage("test1")); } catch (MessageDeliveryException e) { exceptionThrown = true; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/WireTapTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/WireTapTests.java index 99aa8df0de..bbef01f175 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/WireTapTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/WireTapTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -24,9 +24,9 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -38,7 +38,7 @@ public class WireTapTests { QueueChannel mainChannel = new QueueChannel(); QueueChannel secondaryChannel = new QueueChannel(); mainChannel.addInterceptor(new WireTap(secondaryChannel)); - mainChannel.send(new StringMessage("testing")); + mainChannel.send(new GenericMessage("testing")); Message original = mainChannel.receive(0); assertNotNull(original); Message intercepted = secondaryChannel.receive(0); @@ -51,7 +51,7 @@ public class WireTapTests { QueueChannel mainChannel = new QueueChannel(); QueueChannel secondaryChannel = new QueueChannel(); mainChannel.addInterceptor(new WireTap(secondaryChannel, new TestSelector(false))); - mainChannel.send(new StringMessage("testing")); + mainChannel.send(new GenericMessage("testing")); Message original = mainChannel.receive(0); assertNotNull(original); Message intercepted = secondaryChannel.receive(0); @@ -63,7 +63,7 @@ public class WireTapTests { QueueChannel mainChannel = new QueueChannel(); QueueChannel secondaryChannel = new QueueChannel(); mainChannel.addInterceptor(new WireTap(secondaryChannel, new TestSelector(true))); - mainChannel.send(new StringMessage("testing")); + mainChannel.send(new GenericMessage("testing")); Message original = mainChannel.receive(0); assertNotNull(original); Message intercepted = secondaryChannel.receive(0); @@ -82,7 +82,7 @@ public class WireTapTests { QueueChannel secondaryChannel = new QueueChannel(); mainChannel.addInterceptor(new WireTap(secondaryChannel)); assertNull(secondaryChannel.receive(0)); - Message message = new StringMessage("testing"); + Message message = new GenericMessage("testing"); mainChannel.send(message); Message original = mainChannel.receive(0); Message intercepted = secondaryChannel.receive(0); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java index bde41bf5e1..f5f86d2551 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java @@ -31,9 +31,9 @@ import org.springframework.integration.Message; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.context.BeanFactoryChannelResolver; import org.springframework.integration.core.ChannelResolutionException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.EventDrivenConsumer; import org.springframework.integration.endpoint.SourcePollingChannelAdapter; @@ -108,7 +108,7 @@ public class ChannelAdapterParserTests { assertTrue(adapter instanceof EventDrivenConsumer); TestConsumer consumer = (TestConsumer) this.applicationContext.getBean("consumer"); assertNull(consumer.getLastMessage()); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); assertTrue(((MessageChannel) channel).send(message)); assertNotNull(consumer.getLastMessage()); assertEquals(message, consumer.getLastMessage()); @@ -126,7 +126,7 @@ public class ChannelAdapterParserTests { assertTrue(adapter instanceof EventDrivenConsumer); TestBean testBean = (TestBean) this.applicationContext.getBean("testBean"); assertNull(testBean.getMessage()); - Message message = new StringMessage("consumer test"); + Message message = new GenericMessage("consumer test"); assertTrue(((MessageChannel) channel).send(message)); assertNotNull(testBean.getMessage()); assertEquals("consumer test", testBean.getMessage()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/FilterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/FilterParserTests.java index f98b5d7cc1..cffe4352e5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/FilterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/FilterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,10 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.Message; import org.springframework.integration.MessageRejectedException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.MessageSelector; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.StringUtils; @@ -72,7 +72,7 @@ public class FilterParserTests { @Test public void filterWithSelectorAdapterAccepts() { - adapterInput.send(new StringMessage("test")); + adapterInput.send(new GenericMessage("test")); Message reply = adapterOutput.receive(0); assertNotNull(reply); assertEquals("test", reply.getPayload()); @@ -80,14 +80,14 @@ public class FilterParserTests { @Test public void filterWithSelectorAdapterRejects() { - adapterInput.send(new StringMessage("")); + adapterInput.send(new GenericMessage("")); Message reply = adapterOutput.receive(0); assertNull(reply); } @Test public void filterWithSelectorImplementationAccepts() { - implementationInput.send(new StringMessage("test")); + implementationInput.send(new GenericMessage("test")); Message reply = implementationOutput.receive(0); assertNotNull(reply); assertEquals("test", reply.getPayload()); @@ -95,26 +95,26 @@ public class FilterParserTests { @Test public void filterWithSelectorImplementationRejects() { - implementationInput.send(new StringMessage("")); + implementationInput.send(new GenericMessage("")); Message reply = implementationOutput.receive(0); assertNull(reply); } @Test public void exceptionThrowingFilterAccepts() { - exceptionInput.send(new StringMessage("test")); + exceptionInput.send(new GenericMessage("test")); Message reply = implementationOutput.receive(0); assertNotNull(reply); } @Test(expected = MessageRejectedException.class) public void exceptionThrowingFilterRejects() { - exceptionInput.send(new StringMessage("")); + exceptionInput.send(new GenericMessage("")); } @Test public void filterWithDiscardChannel() { - discardInput.send(new StringMessage("")); + discardInput.send(new GenericMessage("")); Message discard = discardOutput.receive(0); assertNotNull(discard); assertEquals("", discard.getPayload()); @@ -125,7 +125,7 @@ public class FilterParserTests { public void filterWithDiscardChannelAndException() throws Exception { Exception exception = null; try { - discardAndExceptionInput.send(new StringMessage("")); + discardAndExceptionInput.send(new GenericMessage("")); } catch (Exception e) { exception = e; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/RouterFactoryBeanDelegationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/RouterFactoryBeanDelegationTests.java index 4d1d2dd2f3..d07b07023f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/RouterFactoryBeanDelegationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/RouterFactoryBeanDelegationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,6 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.router.AbstractMessageRouter; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -62,7 +61,7 @@ public class RouterFactoryBeanDelegationTests { @Test public void routeWithMappedType() { - input.send(new StringMessage("test")); + input.send(new GenericMessage("test")); assertNull(discard.receive(0)); assertNotNull(strings.receive(0)); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/SelectorChainParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/SelectorChainParserTests.java index 83be4697e5..0c0a38c25d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/SelectorChainParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/SelectorChainParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -28,8 +28,8 @@ import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.selector.MessageSelectorChain; import org.springframework.integration.selector.MessageSelectorChain.VotingStrategy; import org.springframework.test.context.ContextConfiguration; @@ -55,7 +55,7 @@ public class SelectorChainParserTests { assertEquals(VotingStrategy.ALL, this.getStrategy(chain)); assertEquals(selector1, selectors.get(0)); assertEquals(selector2, selectors.get(1)); - assertTrue(chain.accept(new StringMessage("test"))); + assertTrue(chain.accept(new GenericMessage("test"))); } @Test @@ -87,10 +87,10 @@ public class SelectorChainParserTests { assertEquals(VotingStrategy.MAJORITY_OR_TIE, this.getStrategy(chain4)); List selectorList4 = this.getSelectors(chain4); assertEquals(selector6, selectorList4.get(0)); - assertTrue(chain1.accept(new StringMessage("test1"))); - assertTrue(chain2.accept(new StringMessage("test2"))); - assertTrue(chain3.accept(new StringMessage("test3"))); - assertTrue(chain4.accept(new StringMessage("test4"))); + assertTrue(chain1.accept(new GenericMessage("test1"))); + assertTrue(chain2.accept(new GenericMessage("test2"))); + assertTrue(chain3.accept(new GenericMessage("test3"))); + assertTrue(chain4.accept(new GenericMessage("test4"))); } 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 6ba971d1d5..bc80ad427e 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-2008 the original author or authors. + * Copyright 2002-2010 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,8 +29,8 @@ import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.annotation.ServiceActivator; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.test.util.TestUtils; import org.springframework.integration.test.util.TestUtils.TestApplicationContext; @@ -54,7 +54,7 @@ public class ServiceActivatorAnnotationPostProcessorTests { assertEquals(1, latch.getCount()); assertNull(testBean.getMessageText()); MessageChannel testChannel = (MessageChannel) context.getBean("testChannel"); - testChannel.send(new StringMessage("test-123")); + testChannel.send(new GenericMessage("test-123")); latch.await(1000, TimeUnit.MILLISECONDS); assertEquals(0, latch.getCount()); assertEquals("test-123", testBean.getMessageText()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBeanTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBeanTests.java index 5c9ed61633..cee852cefe 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBeanTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBeanTests.java @@ -27,10 +27,11 @@ import org.aopalliance.aop.Advice; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.junit.Test; + import org.springframework.integration.Message; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSource; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.scheduling.PollerMetadata; import org.springframework.integration.test.util.TestUtils; import org.springframework.integration.test.util.TestUtils.TestApplicationContext; @@ -77,7 +78,7 @@ public class SourcePollingChannelAdapterFactoryBeanTests { private static class TestSource implements MessageSource { public Message receive() { - return new StringMessage("test"); + return new GenericMessage("test"); } } 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 01ec050a1a..b1db187c25 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-2008 the original author or authors. + * Copyright 2002-2010 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 java.util.concurrent.ConcurrentMap; import org.springframework.integration.Message; import org.springframework.integration.aggregator.MessageSequenceComparator; import org.springframework.integration.annotation.Aggregator; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; /** * @author Marius Bogoevici @@ -47,7 +47,7 @@ public class TestAggregatorBean { correlationId = message.getHeaders().getCorrelationId(); } } - Message returnedMessage = new StringMessage(buffer.toString()); + Message returnedMessage = new GenericMessage(buffer.toString()); if (correlationId!=null) { aggregatedMessages.put(correlationId, returnedMessage); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/TestSource.java b/spring-integration-core/src/test/java/org/springframework/integration/config/TestSource.java index 6b63262d35..a63b5ead99 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/TestSource.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/TestSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -17,17 +17,16 @@ package org.springframework.integration.config; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSource; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher */ -@SuppressWarnings("unchecked") -public class TestSource implements MessageSource { +public class TestSource implements MessageSource { - public Message receive() { - return new StringMessage("test"); + public Message receive() { + return new GenericMessage("test"); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/TopLevelSelectorParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/TopLevelSelectorParserTests.java index 9e0443f67c..f5c719c069 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/TopLevelSelectorParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/TopLevelSelectorParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,8 +23,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.core.StringMessage; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -41,7 +41,7 @@ public class TopLevelSelectorParserTests { @Test public void topLevelSelector() { MessageSelector selector = (MessageSelector) context.getBean("selector"); - assertTrue(selector.accept(new StringMessage("test"))); + assertTrue(selector.accept(new GenericMessage("test"))); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/WireTapParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/WireTapParserTests.java index 9db8772367..9e96490dc2 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/WireTapParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/WireTapParserTests.java @@ -28,9 +28,9 @@ import org.springframework.beans.DirectFieldAccessor; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; import org.springframework.integration.channel.interceptor.WireTap; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -44,7 +44,7 @@ public class WireTapParserTests { MessageChannel mainChannel = (MessageChannel) context.getBean("noSelectors"); PollableChannel wireTapChannel = (PollableChannel) context.getBean("wireTapChannel"); assertNull(wireTapChannel.receive(0)); - Message original = new StringMessage("test"); + Message original = new GenericMessage("test"); mainChannel.send(original); Message intercepted = wireTapChannel.receive(0); assertNotNull(intercepted); @@ -58,7 +58,7 @@ public class WireTapParserTests { MessageChannel mainChannel = (MessageChannel) context.getBean("accepting"); PollableChannel wireTapChannel = (PollableChannel) context.getBean("wireTapChannel"); assertNull(wireTapChannel.receive(0)); - Message original = new StringMessage("test"); + Message original = new GenericMessage("test"); mainChannel.send(original); Message intercepted = wireTapChannel.receive(0); assertNotNull(intercepted); @@ -72,7 +72,7 @@ public class WireTapParserTests { MessageChannel mainChannel = (MessageChannel) context.getBean("rejecting"); PollableChannel wireTapChannel = (PollableChannel) context.getBean("wireTapChannel"); assertNull(wireTapChannel.receive(0)); - Message original = new StringMessage("test"); + Message original = new GenericMessage("test"); mainChannel.send(original); Message intercepted = wireTapChannel.receive(0); assertNull(intercepted); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/FilterAnnotationPostProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/FilterAnnotationPostProcessorTests.java index a9611ab404..1ec8b93d24 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/FilterAnnotationPostProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/FilterAnnotationPostProcessorTests.java @@ -27,7 +27,7 @@ import org.springframework.integration.annotation.Filter; import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.test.util.TestUtils; import org.springframework.integration.test.util.TestUtils.TestApplicationContext; @@ -81,10 +81,10 @@ public class FilterAnnotationPostProcessorTests { private void testValidFilter(Object filter) { postProcessor.postProcessAfterInitialization(filter, "testFilter"); context.refresh(); - inputChannel.send(new StringMessage("good")); + inputChannel.send(new GenericMessage("good")); Message passed = outputChannel.receive(0); assertNotNull(passed); - inputChannel.send(new StringMessage("bad")); + inputChannel.send(new GenericMessage("bad")); assertNull(outputChannel.receive(0)); context.stop(); } 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 478f8f026a..557be05b5c 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 @@ -36,10 +36,10 @@ import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.context.BeanFactoryChannelResolver; import org.springframework.integration.core.ChannelResolver; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.AbstractEndpoint; import org.springframework.integration.test.util.TestUtils; import org.springframework.integration.test.util.TestUtils.TestApplicationContext; @@ -70,7 +70,7 @@ public class MessagingAnnotationPostProcessorTests { "serviceActivatorAnnotationPostProcessorTests.xml", this.getClass()); MessageChannel inputChannel = (MessageChannel) context.getBean("inputChannel"); PollableChannel outputChannel = (PollableChannel) context.getBean("outputChannel"); - inputChannel.send(new StringMessage("world")); + inputChannel.send(new GenericMessage("world")); Message reply = outputChannel.receive(0); assertEquals("hello world", reply.getPayload()); context.stop(); @@ -82,7 +82,7 @@ public class MessagingAnnotationPostProcessorTests { context.start(); MessageChannel inputChannel = (MessageChannel) context.getBean("inputChannel"); PollableChannel outputChannel = (PollableChannel) context.getBean("outputChannel"); - inputChannel.send(new StringMessage("world")); + inputChannel.send(new GenericMessage("world")); Message message = outputChannel.receive(1000); assertEquals("hello world", message.getPayload()); context.stop(); @@ -95,7 +95,7 @@ public class MessagingAnnotationPostProcessorTests { context.start(); MessageChannel inputChannel = (MessageChannel) context.getBean("inputChannel"); PollableChannel outputChannel = (PollableChannel) context.getBean("outputChannel"); - inputChannel.send(new StringMessage("world")); + inputChannel.send(new GenericMessage("world")); Message message = outputChannel.receive(1000); assertEquals("hello world", message.getPayload()); context.stop(); @@ -108,7 +108,7 @@ public class MessagingAnnotationPostProcessorTests { context.start(); MessageChannel inputChannel = (MessageChannel) context.getBean("inputChannel"); PollableChannel outputChannel = (PollableChannel) context.getBean("outputChannel"); - inputChannel.send(new StringMessage("123")); + inputChannel.send(new GenericMessage("123")); Message message = outputChannel.receive(1000); assertEquals(246, message.getPayload()); context.stop(); @@ -127,7 +127,7 @@ public class MessagingAnnotationPostProcessorTests { context.refresh(); ChannelResolver channelResolver = new BeanFactoryChannelResolver(context); MessageChannel testChannel = channelResolver.resolveChannelName("testChannel"); - testChannel.send(new StringMessage("foo")); + testChannel.send(new GenericMessage("foo")); latch.await(1000, TimeUnit.MILLISECONDS); assertEquals(0, latch.getCount()); assertEquals("foo", testBean.getMessageText()); @@ -176,7 +176,7 @@ public class MessagingAnnotationPostProcessorTests { Object proxy = proxyFactory.getProxy(); postProcessor.postProcessAfterInitialization(proxy, "proxy"); context.refresh(); - inputChannel.send(new StringMessage("world")); + inputChannel.send(new GenericMessage("world")); Message message = outputChannel.receive(1000); assertEquals("hello world", message.getPayload()); context.stop(); @@ -194,7 +194,7 @@ public class MessagingAnnotationPostProcessorTests { postProcessor.afterPropertiesSet(); postProcessor.postProcessAfterInitialization(new SimpleAnnotatedEndpointSubclass(), "subclass"); context.refresh(); - inputChannel.send(new StringMessage("world")); + inputChannel.send(new GenericMessage("world")); Message message = outputChannel.receive(1000); assertEquals("hello world", message.getPayload()); context.stop(); @@ -214,7 +214,7 @@ public class MessagingAnnotationPostProcessorTests { Object proxy = proxyFactory.getProxy(); postProcessor.postProcessAfterInitialization(proxy, "proxy"); context.refresh(); - inputChannel.send(new StringMessage("world")); + inputChannel.send(new GenericMessage("world")); Message message = outputChannel.receive(1000); assertEquals("hello world", message.getPayload()); context.stop(); @@ -232,7 +232,7 @@ public class MessagingAnnotationPostProcessorTests { postProcessor.afterPropertiesSet(); postProcessor.postProcessAfterInitialization(new SimpleAnnotatedEndpointImplementation(), "impl"); context.refresh(); - inputChannel.send(new StringMessage("ABC")); + inputChannel.send(new GenericMessage("ABC")); Message message = outputChannel.receive(1000); assertEquals("test-ABC", message.getPayload()); context.stop(); @@ -250,7 +250,7 @@ public class MessagingAnnotationPostProcessorTests { postProcessor.afterPropertiesSet(); postProcessor.postProcessAfterInitialization(new SimpleAnnotatedEndpointImplementation(), "impl"); context.refresh(); - inputChannel.send(new StringMessage("ABC")); + inputChannel.send(new GenericMessage("ABC")); Message message = outputChannel.receive(1000); assertEquals("test-ABC", message.getPayload()); context.stop(); @@ -270,7 +270,7 @@ public class MessagingAnnotationPostProcessorTests { Object proxy = proxyFactory.getProxy(); postProcessor.postProcessAfterInitialization(proxy, "proxy"); context.refresh(); - inputChannel.send(new StringMessage("ABC")); + inputChannel.send(new GenericMessage("ABC")); Message message = outputChannel.receive(1000); assertEquals("test-ABC", message.getPayload()); context.stop(); @@ -289,7 +289,7 @@ public class MessagingAnnotationPostProcessorTests { TransformerAnnotationTestBean testBean = new TransformerAnnotationTestBean(); postProcessor.postProcessAfterInitialization(testBean, "testBean"); context.refresh(); - inputChannel.send(new StringMessage("foo")); + inputChannel.send(new GenericMessage("foo")); Message reply = outputChannel.receive(0); assertEquals("FOO", reply.getPayload()); context.stop(); 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 315adfbe05..e8e0898a28 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 @@ -26,7 +26,7 @@ import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.annotation.Router; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.test.util.TestUtils; import org.springframework.integration.test.util.TestUtils.TestApplicationContext; @@ -57,7 +57,7 @@ public class RouterAnnotationPostProcessorTests { TestRouter testRouter = new TestRouter(); postProcessor.postProcessAfterInitialization(testRouter, "test"); context.refresh(); - inputChannel.send(new StringMessage("foo")); + inputChannel.send(new GenericMessage("foo")); Message replyMessage = outputChannel.receive(0); assertEquals("foo", replyMessage.getPayload()); context.stop(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/SplitterAnnotationPostProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/SplitterAnnotationPostProcessorTests.java index 64516a4da5..6c4aeb79ad 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/SplitterAnnotationPostProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/SplitterAnnotationPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -28,7 +28,7 @@ import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.annotation.Splitter; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.test.util.TestUtils; import org.springframework.integration.test.util.TestUtils.TestApplicationContext; @@ -59,7 +59,7 @@ public class SplitterAnnotationPostProcessorTests { TestSplitter splitter = new TestSplitter(); postProcessor.postProcessAfterInitialization(splitter, "testSplitter"); context.refresh(); - inputChannel.send(new StringMessage("this.is.a.test")); + inputChannel.send(new GenericMessage("this.is.a.test")); Message message1 = outputChannel.receive(500); assertNotNull(message1); assertEquals("this", message1.getPayload()); 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 32141b84ad..670656a0cd 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-2009 the original author or authors. + * Copyright 2002-2010 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,8 +32,8 @@ import org.springframework.integration.MessageRejectedException; import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.annotation.ServiceActivator; import org.springframework.integration.channel.DirectChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.dispatcher.RoundRobinLoadBalancingStrategy; /** @@ -53,11 +53,11 @@ public class SubscriberOrderTests { context.refresh(); TestBean testBean = (TestBean) context.getBean("testBean"); MessageChannel channel = (MessageChannel) context.getBean("input"); - channel.send(new StringMessage("test-1")); - channel.send(new StringMessage("test-2")); - channel.send(new StringMessage("test-3")); - channel.send(new StringMessage("test-4")); - channel.send(new StringMessage("test-5")); + channel.send(new GenericMessage("test-1")); + channel.send(new GenericMessage("test-2")); + channel.send(new GenericMessage("test-3")); + channel.send(new GenericMessage("test-4")); + channel.send(new GenericMessage("test-5")); List calls = testBean.calls; assertEquals(5, calls.size()); assertEquals(1, calls.get(0).intValue()); @@ -81,16 +81,16 @@ public class SubscriberOrderTests { context.refresh(); TestBean testBean = (TestBean) context.getBean("testBean"); MessageChannel channel = (MessageChannel) context.getBean("input"); - channel.send(new StringMessage("test-1")); - channel.send(new StringMessage("test-2")); - channel.send(new StringMessage("test-3")); - channel.send(new StringMessage("test-4")); - channel.send(new StringMessage("test-5")); - channel.send(new StringMessage("test-6")); - channel.send(new StringMessage("test-7")); - channel.send(new StringMessage("test-8")); - channel.send(new StringMessage("test-9")); - channel.send(new StringMessage("test-10")); + channel.send(new GenericMessage("test-1")); + channel.send(new GenericMessage("test-2")); + channel.send(new GenericMessage("test-3")); + channel.send(new GenericMessage("test-4")); + channel.send(new GenericMessage("test-5")); + channel.send(new GenericMessage("test-6")); + channel.send(new GenericMessage("test-7")); + channel.send(new GenericMessage("test-8")); + channel.send(new GenericMessage("test-9")); + channel.send(new GenericMessage("test-10")); assertEquals(10, testBean.calls.size()); assertEquals(1, testBean.calls.get(0).intValue()); assertEquals(1, testBean.calls.get(1).intValue()); @@ -103,7 +103,7 @@ public class SubscriberOrderTests { assertEquals(5, testBean.calls.get(8).intValue()); assertEquals(5, testBean.calls.get(9).intValue()); testBean.reset(); - channel.send(new StringMessage("test-11")); + channel.send(new GenericMessage("test-11")); assertEquals(1, testBean.calls.size()); assertEquals(1, testBean.calls.get(0).intValue()); } @@ -121,11 +121,11 @@ public class SubscriberOrderTests { context.refresh(); TestBean testBean = (TestBean) context.getBean("testBean"); MessageChannel channel = (MessageChannel) context.getBean("input"); - channel.send(new StringMessage("test-1")); - channel.send(new StringMessage("test-2")); - channel.send(new StringMessage("test-3")); - channel.send(new StringMessage("test-4")); - channel.send(new StringMessage("test-5")); + channel.send(new GenericMessage("test-1")); + channel.send(new GenericMessage("test-2")); + channel.send(new GenericMessage("test-3")); + channel.send(new GenericMessage("test-4")); + channel.send(new GenericMessage("test-5")); List calls = testBean.calls; assertEquals(5, calls.size()); assertEquals(1, calls.get(0).intValue()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithCustomizedAggregator.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithCustomizedAggregator.java index 3225c29597..b0ebafaed2 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithCustomizedAggregator.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithCustomizedAggregator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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 java.util.concurrent.ConcurrentMap; import org.springframework.integration.Message; import org.springframework.integration.aggregator.MessageSequenceComparator; import org.springframework.integration.annotation.Aggregator; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.stereotype.Component; /** @@ -53,7 +53,7 @@ public class TestAnnotatedEndpointWithCustomizedAggregator { correlationId = message.getHeaders().getCorrelationId(); } } - Message returnedMessage = new StringMessage(buffer.toString()); + Message returnedMessage = new GenericMessage(buffer.toString()); aggregatedMessages.put(correlationId, returnedMessage); return returnedMessage; } 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 a9f225d6f4..007f24954d 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-2008 the original author or authors. + * Copyright 2002-2010 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.Message; import org.springframework.integration.aggregator.MessageSequenceComparator; import org.springframework.integration.annotation.Aggregator; import org.springframework.integration.annotation.MessageEndpoint; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; /** * @author Marius Bogoevici @@ -48,7 +48,7 @@ public class TestAnnotatedEndpointWithDefaultAggregator { correlationId = message.getHeaders().getCorrelationId(); } } - Message returnedMessage = new StringMessage(buffer.toString()); + Message returnedMessage = new GenericMessage(buffer.toString()); aggregatedMessages.put(correlationId, returnedMessage); return returnedMessage; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithReleaseStrategy.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithReleaseStrategy.java index ace4de0fff..c9e447151f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithReleaseStrategy.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/TestAnnotatedEndpointWithReleaseStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,9 +25,9 @@ import java.util.concurrent.ConcurrentMap; import org.springframework.integration.Message; import org.springframework.integration.aggregator.MessageSequenceComparator; import org.springframework.integration.annotation.Aggregator; -import org.springframework.integration.annotation.ReleaseStrategy; import org.springframework.integration.annotation.MessageEndpoint; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.annotation.ReleaseStrategy; +import org.springframework.integration.core.GenericMessage; /** * @author Marius Bogoevici @@ -49,7 +49,7 @@ public class TestAnnotatedEndpointWithReleaseStrategy { correlationId = message.getHeaders().getCorrelationId(); } } - Message returnedMessage = new StringMessage(buffer.toString()); + Message returnedMessage = new GenericMessage(buffer.toString()); aggregatedMessages.put(correlationId, returnedMessage); return returnedMessage; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/BridgeParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/BridgeParserTests.java index fed9705e38..8bc6493ceb 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/BridgeParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/BridgeParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -21,15 +21,16 @@ import static org.junit.Assert.assertThat; import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.junit.Test; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.message.MessageMatcher; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; @@ -68,7 +69,7 @@ public class BridgeParserTests extends AbstractJUnit4SpringContextTests { @Test public void pollableChannel() { - Message message = new StringMessage("test1"); + Message message = new GenericMessage("test1"); this.pollableChannel.send(message); Message reply = this.output1.receive(6000); assertThat(message, sameExceptImmutableHeaders(reply)); @@ -76,7 +77,7 @@ public class BridgeParserTests extends AbstractJUnit4SpringContextTests { @Test public void subscribableChannel() { - Message message = new StringMessage("test2"); + Message message = new GenericMessage("test2"); this.subscribableChannel.send(message); Message reply = this.output2.receive(0); assertThat(message, sameExceptImmutableHeaders(reply)); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests.java index 2eb27f5544..0c3759d4f5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests.java @@ -13,18 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.integration.config.xml; import static org.junit.Assert.assertTrue; 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.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -49,7 +51,7 @@ public class DelayerUsageTests { @Test public void testDelayWithDefaultScheduler(){ long start = System.currentTimeMillis(); - inputA.send(new StringMessage("Hello")); + inputA.send(new GenericMessage("Hello")); outputA.receive(); assertTrue((System.currentTimeMillis() - start) >= 1000); } @@ -66,13 +68,13 @@ public class DelayerUsageTests { @Test public void testDelayWithCustomScheduler(){ long start = System.currentTimeMillis(); - inputB.send(new StringMessage("1")); - inputB.send(new StringMessage("2")); - inputB.send(new StringMessage("3")); - inputB.send(new StringMessage("4")); - inputB.send(new StringMessage("5")); - inputB.send(new StringMessage("6")); - inputB.send(new StringMessage("7")); + inputB.send(new GenericMessage("1")); + inputB.send(new GenericMessage("2")); + inputB.send(new GenericMessage("3")); + inputB.send(new GenericMessage("4")); + inputB.send(new GenericMessage("5")); + inputB.send(new GenericMessage("6")); + inputB.send(new GenericMessage("7")); outputB1.receive(); outputB1.receive(); outputB1.receive(); 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 b57736e925..c8fb1133d5 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,10 +25,10 @@ import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.gateway.TestService; /** @@ -50,7 +50,7 @@ public class GatewayParserTests { public void testSolicitResponse() { ApplicationContext context = new ClassPathXmlApplicationContext("gatewayParserTests.xml", this.getClass()); PollableChannel channel = (PollableChannel) context.getBean("replyChannel"); - channel.send(new StringMessage("foo")); + channel.send(new GenericMessage("foo")); TestService service = (TestService) context.getBean("solicitResponse"); String result = service.solicitResponse(); assertEquals("foo", result); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests.java index 4cfa00186f..1857b453c5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests.java @@ -28,10 +28,10 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.gateway.SimpleMessagingGateway; import org.springframework.integration.transformer.MessageTransformationException; import org.springframework.test.context.ContextConfiguration; @@ -52,7 +52,7 @@ public class HeaderEnricherTests { public void replyChannel() { PollableChannel replyChannel = context.getBean("testReplyChannel", PollableChannel.class); MessageChannel inputChannel = context.getBean("replyChannelInput", MessageChannel.class); - inputChannel.send(new StringMessage("test")); + inputChannel.send(new GenericMessage("test")); Message result = replyChannel.receive(0); assertNotNull(result); assertEquals("TEST", result.getPayload()); @@ -63,7 +63,7 @@ public class HeaderEnricherTests { public void errorChannel() { PollableChannel errorChannel = context.getBean("testErrorChannel", PollableChannel.class); MessageChannel inputChannel = context.getBean("errorChannelInput", MessageChannel.class); - inputChannel.send(new StringMessage("test")); + inputChannel.send(new GenericMessage("test")); Message errorMessage = errorChannel.receive(1000); assertNotNull(errorMessage); Object errorPayload = errorMessage.getPayload(); 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 7a343da924..cc9b891441 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-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -16,9 +16,20 @@ package org.springframework.integration.config.xml; +import static org.junit.Assert.assertEquals; + +import java.io.ByteArrayInputStream; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + import junit.framework.Assert; + import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -28,21 +39,16 @@ import org.springframework.core.io.InputStreamResource; import org.springframework.integration.Message; import org.springframework.integration.MessageHeaders; import org.springframework.integration.channel.DirectChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.EventDrivenConsumer; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.io.ByteArrayInputStream; -import java.util.*; - -import static org.junit.Assert.assertEquals; - /** * @author Oleg Zhurakousky */ @@ -257,7 +263,7 @@ public class InnerDefinitionHandlerAwareEndpointParserTests { ApplicationContext ac = this.bootStrap(configProperty); MessageChannel input = (MessageChannel) ac.getBean("inChannel"); PollableChannel output = (PollableChannel) ac.getBean("outChannel"); - input.send(new StringMessage("foo")); + input.send(new GenericMessage("foo")); Message reply = output.receive(0); assertEquals("foo", reply.getPayload()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests.java index a977bdfea6..634dc470cc 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -28,7 +28,6 @@ import org.springframework.integration.Message; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -54,7 +53,7 @@ public class ObjectToStringTransformerParserTests { @Test public void directChannelWithStringMessage() { - directInput.send(new StringMessage("foo")); + directInput.send(new GenericMessage("foo")); Message result = output.receive(0); assertNotNull(result); assertEquals("foo", result.getPayload()); @@ -62,7 +61,7 @@ public class ObjectToStringTransformerParserTests { @Test public void queueChannelWithStringMessage() { - queueInput.send(new StringMessage("foo")); + queueInput.send(new GenericMessage("foo")); Message result = output.receive(3000); assertNotNull(result); assertEquals("foo", result.getPayload()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PayloadSerializingTransformerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PayloadSerializingTransformerParserTests.java index a5bad4516c..941fa77a01 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PayloadSerializingTransformerParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PayloadSerializingTransformerParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,7 +33,6 @@ import org.springframework.integration.Message; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.transformer.MessageTransformationException; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -60,7 +59,7 @@ public class PayloadSerializingTransformerParserTests { @Test public void directChannelWithStringMessage() throws Exception { - directInput.send(new StringMessage("foo")); + directInput.send(new GenericMessage("foo")); Message result = output.receive(0); assertNotNull(result); assertTrue(result.getPayload() instanceof byte[]); @@ -69,7 +68,7 @@ public class PayloadSerializingTransformerParserTests { @Test public void queueChannelWithStringMessage() throws Exception { - queueInput.send(new StringMessage("foo")); + queueInput.send(new GenericMessage("foo")); Message result = output.receive(3000); assertNotNull(result); assertTrue(result.getPayload() instanceof byte[]); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/core/MessageHistoryTests.java b/spring-integration-core/src/test/java/org/springframework/integration/core/MessageHistoryTests.java index e0a1dac305..9828e942ac 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/core/MessageHistoryTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/core/MessageHistoryTests.java @@ -36,7 +36,7 @@ public class MessageHistoryTests { @Test public void addComponents() { - StringMessage original = new StringMessage("foo"); + GenericMessage original = new GenericMessage("foo"); assertNull(MessageHistory.read(original)); Message result1 = MessageHistory.write(original, new TestComponent(1)); MessageHistory history1 = MessageHistory.read(result1); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryExceptionTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryExceptionTests.java index ca52ca2fe5..15d329b15e 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryExceptionTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryExceptionTests.java @@ -16,25 +16,26 @@ package org.springframework.integration.dispatcher; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.matchers.JUnitMatchers; -import org.springframework.integration.Message; -import org.springframework.integration.MessageDeliveryException; -import org.springframework.integration.core.StringMessage; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; import java.util.Arrays; import java.util.List; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.matchers.JUnitMatchers; + +import org.springframework.integration.Message; +import org.springframework.integration.MessageDeliveryException; +import org.springframework.integration.core.GenericMessage; /** * @author Iwein Fuld */ public class AggregateMessageDeliveryExceptionTests { - private Message message = new StringMessage("foo"); + private Message message = new GenericMessage("foo"); private AggregateMessageDeliveryException exception = new AggregateMessageDeliveryException(message, "something went wrong", exceptionsList()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/BroadcastingDispatcherTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/BroadcastingDispatcherTests.java index 7b40e48e8b..94482f04ea 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/BroadcastingDispatcherTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/BroadcastingDispatcherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,9 +37,9 @@ import org.junit.Test; import org.springframework.core.task.TaskExecutor; import org.springframework.integration.Message; import org.springframework.integration.MessagingException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageHandler; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -247,7 +247,7 @@ public class BroadcastingDispatcherTests { MessageHandler target2 = new MessageStoringTestEndpoint(messages); dispatcher.addHandler(target1); dispatcher.addHandler(target2); - dispatcher.dispatch(new StringMessage("test")); + dispatcher.dispatch(new GenericMessage("test")); assertEquals(2, messages.size()); assertEquals(0, (int) messages.get(0).getHeaders().getSequenceNumber()); assertEquals(0, (int) messages.get(0).getHeaders().getSequenceSize()); @@ -266,7 +266,7 @@ public class BroadcastingDispatcherTests { dispatcher.addHandler(target1); dispatcher.addHandler(target2); dispatcher.addHandler(target3); - Message inputMessage = new StringMessage("test"); + Message inputMessage = new GenericMessage("test"); Object originalId = inputMessage.getHeaders().getId(); dispatcher.dispatch(inputMessage); assertEquals(3, messages.size()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/FailOverDispatcherTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/FailOverDispatcherTests.java index 1a406e5a15..c6646753a5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/FailOverDispatcherTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dispatcher/FailOverDispatcherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -28,8 +28,8 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.MessageRejectedException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageHandler; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.handler.ServiceActivatingHandler; import org.springframework.integration.message.TestHandlers; @@ -43,7 +43,7 @@ public class FailOverDispatcherTests { UnicastingDispatcher dispatcher = new UnicastingDispatcher(); final CountDownLatch latch = new CountDownLatch(1); dispatcher.addHandler(createConsumer(TestHandlers.countDownHandler(latch))); - dispatcher.dispatch(new StringMessage("test")); + dispatcher.dispatch(new GenericMessage("test")); latch.await(500, TimeUnit.MILLISECONDS); assertEquals(0, latch.getCount()); } @@ -56,7 +56,7 @@ public class FailOverDispatcherTests { final AtomicInteger counter2 = new AtomicInteger(); dispatcher.addHandler(createConsumer(TestHandlers.countingCountDownHandler(counter1, latch))); dispatcher.addHandler(createConsumer(TestHandlers.countingCountDownHandler(counter2, latch))); - dispatcher.dispatch(new StringMessage("test")); + dispatcher.dispatch(new GenericMessage("test")); latch.await(500, TimeUnit.MILLISECONDS); assertEquals(0, latch.getCount()); assertEquals("only 1 handler should have received the message", 1, counter1.get() + counter2.get()); @@ -70,7 +70,7 @@ public class FailOverDispatcherTests { dispatcher.addHandler(target); dispatcher.addHandler(target); try { - dispatcher.dispatch(new StringMessage("test")); + dispatcher.dispatch(new GenericMessage("test")); } catch (Exception e) { // ignore @@ -90,7 +90,7 @@ public class FailOverDispatcherTests { dispatcher.addHandler(target3); dispatcher.removeHandler(target2); try { - dispatcher.dispatch(new StringMessage("test")); + dispatcher.dispatch(new GenericMessage("test")); } catch (Exception e) { // ignore @@ -109,7 +109,7 @@ public class FailOverDispatcherTests { dispatcher.addHandler(target2); dispatcher.addHandler(target3); try { - dispatcher.dispatch(new StringMessage("test1")); + dispatcher.dispatch(new GenericMessage("test1")); } catch (Exception e) { // ignore @@ -117,7 +117,7 @@ public class FailOverDispatcherTests { assertEquals(3, counter.get()); dispatcher.removeHandler(target2); try { - dispatcher.dispatch(new StringMessage("test2")); + dispatcher.dispatch(new GenericMessage("test2")); } catch (Exception e) { // ignore @@ -125,7 +125,7 @@ public class FailOverDispatcherTests { assertEquals(5, counter.get()); dispatcher.removeHandler(target1); try { - dispatcher.dispatch(new StringMessage("test3")); + dispatcher.dispatch(new GenericMessage("test3")); } catch (Exception e) { // ignore @@ -140,14 +140,14 @@ public class FailOverDispatcherTests { MessageHandler target = new CountingTestEndpoint(counter, false); dispatcher.addHandler(target); try { - dispatcher.dispatch(new StringMessage("test1")); + dispatcher.dispatch(new GenericMessage("test1")); } catch (Exception e) { // ignore } assertEquals(1, counter.get()); dispatcher.removeHandler(target); - dispatcher.dispatch(new StringMessage("test2")); + dispatcher.dispatch(new GenericMessage("test2")); } @Test @@ -160,7 +160,7 @@ public class FailOverDispatcherTests { dispatcher.addHandler(target1); dispatcher.addHandler(target2); dispatcher.addHandler(target3); - assertTrue(dispatcher.dispatch(new StringMessage("test"))); + assertTrue(dispatcher.dispatch(new GenericMessage("test"))); assertEquals("only the first target should have been invoked", 1, counter.get()); } @@ -174,7 +174,7 @@ public class FailOverDispatcherTests { dispatcher.addHandler(target1); dispatcher.addHandler(target2); dispatcher.addHandler(target3); - assertTrue(dispatcher.dispatch(new StringMessage("test"))); + assertTrue(dispatcher.dispatch(new GenericMessage("test"))); assertEquals("first two targets should have been invoked", 2, counter.get()); } @@ -189,7 +189,7 @@ public class FailOverDispatcherTests { dispatcher.addHandler(target2); dispatcher.addHandler(target3); try { - assertFalse(dispatcher.dispatch(new StringMessage("test"))); + assertFalse(dispatcher.dispatch(new GenericMessage("test"))); } catch (Exception e) { // ignore 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 afd2e85df7..e763a74eec 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-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -24,9 +24,9 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.util.TestTransactionManager; import org.springframework.transaction.IllegalTransactionStateException; import org.springframework.transaction.annotation.Propagation; @@ -45,7 +45,7 @@ public class PollingTransactionTests { PollableChannel output = (PollableChannel) context.getBean("output"); assertEquals(0, txManager.getCommitCount()); assertEquals(0, txManager.getRollbackCount()); - input.send(new StringMessage("test")); + input.send(new GenericMessage("test")); txManager.waitForCompletion(1000); Message message = output.receive(0); assertNotNull(message); @@ -63,7 +63,7 @@ public class PollingTransactionTests { PollableChannel output = (PollableChannel) context.getBean("output"); assertEquals(0, txManager.getCommitCount()); assertEquals(0, txManager.getRollbackCount()); - input.send(new StringMessage("test")); + input.send(new GenericMessage("test")); txManager.waitForCompletion(1000); Message message = output.receive(0); assertNull(message); @@ -80,7 +80,7 @@ public class PollingTransactionTests { PollableChannel input = (PollableChannel) context.getBean("input"); PollableChannel output = (PollableChannel) context.getBean("output"); assertEquals(0, txManager.getCommitCount()); - input.send(new StringMessage("test")); + input.send(new GenericMessage("test")); Message reply = output.receive(3000); assertNotNull(reply); txManager.waitForCompletion(3000); @@ -97,7 +97,7 @@ public class PollingTransactionTests { PollableChannel input = (PollableChannel) context.getBean("input"); PollableChannel output = (PollableChannel) context.getBean("output"); assertEquals(0, txManager.getCommitCount()); - input.send(new StringMessage("test")); + input.send(new GenericMessage("test")); Message reply = output.receive(3000); assertNotNull(reply); txManager.waitForCompletion(3000); @@ -114,7 +114,7 @@ public class PollingTransactionTests { PollableChannel input = (PollableChannel) context.getBean("input"); PollableChannel output = (PollableChannel) context.getBean("output"); assertEquals(0, txManager.getCommitCount()); - input.send(new StringMessage("test")); + input.send(new GenericMessage("test")); Message reply = output.receive(3000); assertNotNull(reply); assertEquals(0, txManager.getCommitCount()); @@ -130,7 +130,7 @@ public class PollingTransactionTests { PollableChannel input = (PollableChannel) context.getBean("input"); PollableChannel output = (PollableChannel) context.getBean("output"); assertEquals(0, txManager.getCommitCount()); - input.send(new StringMessage("test")); + input.send(new GenericMessage("test")); Message reply = output.receive(3000); assertNotNull(reply); assertEquals(0, txManager.getCommitCount()); @@ -147,7 +147,7 @@ public class PollingTransactionTests { PollableChannel output = (PollableChannel) context.getBean("output"); PollableChannel errorChannel = (PollableChannel) context.getBean("errorChannel"); assertEquals(0, txManager.getCommitCount()); - input.send(new StringMessage("test")); + input.send(new GenericMessage("test")); Message errorMessage = errorChannel.receive(3000); assertNotNull(errorMessage); Object payload = errorMessage.getPayload(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/CorrelationIdTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/CorrelationIdTests.java index 35d3e959a5..909964dec1 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/CorrelationIdTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/CorrelationIdTests.java @@ -20,11 +20,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; + import org.springframework.integration.Message; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.handler.ServiceActivatingHandler; import org.springframework.integration.splitter.AbstractMessageSplitter; import org.springframework.integration.splitter.MethodInvokingSplitter; @@ -85,7 +86,7 @@ public class CorrelationIdTests { @Test public void testCorrelationNotCopiedFromRequestMessgeIdIfAlreadySetByHandler() throws Exception { - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); DirectChannel inputChannel = new DirectChannel(); QueueChannel outputChannel = new QueueChannel(1); ServiceActivatingHandler serviceActivator = new ServiceActivatingHandler(new TestBean(), "createMessage"); @@ -99,7 +100,7 @@ public class CorrelationIdTests { @Test public void testCorrelationIdWithSplitterWhenNotValueSetOnIncomingMessage() throws Exception { - Message message = new StringMessage("test1,test2"); + Message message = new GenericMessage("test1,test2"); QueueChannel testChannel = new QueueChannel(); MethodInvokingSplitter splitter = new MethodInvokingSplitter( new TestBean(), TestBean.class.getMethod("split", String.class)); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollingConsumerEndpointTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollingConsumerEndpointTests.java index d806e7e767..bdaebe6f9e 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollingConsumerEndpointTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/PollingConsumerEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,9 +36,9 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.MessageRejectedException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageHandler; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.scheduling.Trigger; import org.springframework.scheduling.TriggerContext; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; @@ -57,9 +57,9 @@ public class PollingConsumerEndpointTests { private TestConsumer consumer = new TestConsumer(); - private Message message = new StringMessage("test"); + private Message message = new GenericMessage("test"); - private Message badMessage = new StringMessage("bad"); + private Message badMessage = new GenericMessage("bad"); private TestErrorHandler errorHandler = new TestErrorHandler(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReturnAddressTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReturnAddressTests.java index e1e385c541..1583f33c97 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReturnAddressTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReturnAddressTests.java @@ -25,10 +25,10 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; import org.springframework.integration.core.ChannelResolutionException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -105,7 +105,7 @@ public class ReturnAddressTests { "returnAddressTests.xml", this.getClass()); MessageChannel channel3 = (MessageChannel) context.getBean("channel3"); context.start(); - StringMessage message = new StringMessage("*"); + GenericMessage message = new GenericMessage("*"); channel3.send(message); } @@ -116,7 +116,7 @@ public class ReturnAddressTests { MessageChannel channel4 = (MessageChannel) context.getBean("channel4"); PollableChannel replyChannel = (PollableChannel) context.getBean("replyChannel"); context.start(); - StringMessage message = new StringMessage("*"); + GenericMessage message = new GenericMessage("*"); channel4.send(message); Message response = replyChannel.receive(3000); assertNotNull(response); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorEndpointTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorEndpointTests.java index 2c8d36ad7f..36a42de32e 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorEndpointTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorEndpointTests.java @@ -28,8 +28,8 @@ import org.springframework.integration.MessageHandlingException; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.channel.TestChannelResolver; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.handler.ServiceActivatingHandler; /** @@ -100,7 +100,7 @@ public class ServiceActivatorEndpointTests { Object handler = new Object() { @SuppressWarnings("unused") public Message handle(Message message) { - return new StringMessage("foo" + message.getPayload()); + return new GenericMessage("foo" + message.getPayload()); } }; ServiceActivatingHandler endpoint = new ServiceActivatingHandler(handler, "handle"); @@ -210,7 +210,7 @@ public class ServiceActivatorEndpointTests { @SuppressWarnings("unused") public Message handle(Message message) { - return new StringMessage(message.getPayload().toString().toUpperCase()); + return new GenericMessage(message.getPayload().toString().toUpperCase()); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorMethodResolutionTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorMethodResolutionTests.java index 824a06d8bb..7c42d27871 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorMethodResolutionTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorMethodResolutionTests.java @@ -23,7 +23,7 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.annotation.ServiceActivator; import org.springframework.integration.channel.QueueChannel; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.handler.ServiceActivatingHandler; /** @@ -37,7 +37,7 @@ public class ServiceActivatorMethodResolutionTests { ServiceActivatingHandler serviceActivator = new ServiceActivatingHandler(testBean); QueueChannel outputChannel = new QueueChannel(); serviceActivator.setOutputChannel(outputChannel); - serviceActivator.handleMessage(new StringMessage("foo")); + serviceActivator.handleMessage(new GenericMessage("foo")); Message result = outputChannel.receive(0); assertEquals("FOO", result.getPayload()); } @@ -54,7 +54,7 @@ public class ServiceActivatorMethodResolutionTests { ServiceActivatingHandler serviceActivator = new ServiceActivatingHandler(testBean); QueueChannel outputChannel = new QueueChannel(); serviceActivator.setOutputChannel(outputChannel); - serviceActivator.handleMessage(new StringMessage("foo")); + serviceActivator.handleMessage(new GenericMessage("foo")); Message result = outputChannel.receive(0); assertEquals("FOO", result.getPayload()); } 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 52e095edb5..8345423d29 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-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -19,7 +19,7 @@ package org.springframework.integration.endpoint.annotation; import org.springframework.integration.Message; import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.annotation.ServiceActivator; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; /** * @author Mark Fisher @@ -28,8 +28,8 @@ import org.springframework.integration.core.StringMessage; public class MessageParameterAnnotatedEndpoint { @ServiceActivator(inputChannel="inputChannel", outputChannel="outputChannel") - public StringMessage sayHello(Message message) { - return new StringMessage("hello " + message.getPayload()); + public Message sayHello(Message message) { + return new GenericMessage("hello " + message.getPayload()); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/filter/FilterContextTests.java b/spring-integration-core/src/test/java/org/springframework/integration/filter/FilterContextTests.java index 6300c4dd02..b6fd2dc05c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/filter/FilterContextTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/filter/FilterContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -24,9 +24,9 @@ import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -39,7 +39,7 @@ public class FilterContextTests { "filterContextTests.xml", this.getClass()); MessageChannel input = (MessageChannel) context.getBean("input"); PollableChannel output = (PollableChannel) context.getBean("output"); - input.send(new StringMessage("foo")); + input.send(new GenericMessage("foo")); Message reply = output.receive(0); assertNull(reply); } @@ -50,7 +50,7 @@ public class FilterContextTests { "filterContextTests.xml", this.getClass()); MessageChannel input = (MessageChannel) context.getBean("input"); PollableChannel output = (PollableChannel) context.getBean("output"); - input.send(new StringMessage("foobar")); + input.send(new GenericMessage("foobar")); Message reply = output.receive(0); assertEquals("foobar", reply.getPayload()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/filter/MessageFilterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/filter/MessageFilterTests.java index 54d23d364f..4681c46746 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/filter/MessageFilterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/filter/MessageFilterTests.java @@ -27,10 +27,9 @@ import org.springframework.integration.Message; import org.springframework.integration.MessageRejectedException; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.EventDrivenConsumer; -import org.springframework.integration.filter.MessageFilter; /** * @author Mark Fisher @@ -44,7 +43,7 @@ public class MessageFilterTests { return true; } }); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); QueueChannel output = new QueueChannel(); filter.setOutputChannel(output); filter.handleMessage(message); @@ -62,7 +61,7 @@ public class MessageFilterTests { }); QueueChannel output = new QueueChannel(); filter.setOutputChannel(output); - filter.handleMessage(new StringMessage("test")); + filter.handleMessage(new GenericMessage("test")); assertNull(output.receive(0)); } @@ -76,7 +75,7 @@ public class MessageFilterTests { filter.setThrowExceptionOnRejection(true); QueueChannel output = new QueueChannel(); filter.setOutputChannel(output); - filter.handleMessage(new StringMessage("test")); + filter.handleMessage(new GenericMessage("test")); } @Test @@ -91,7 +90,7 @@ public class MessageFilterTests { filter.setOutputChannel(outputChannel); EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, filter); endpoint.start(); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); assertTrue(inputChannel.send(message)); Message reply = outputChannel.receive(0); assertNotNull(reply); @@ -110,7 +109,7 @@ public class MessageFilterTests { filter.setOutputChannel(outputChannel); EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, filter); endpoint.start(); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); assertTrue(inputChannel.send(message)); assertNull(outputChannel.receive(0)); } @@ -128,7 +127,7 @@ public class MessageFilterTests { filter.setThrowExceptionOnRejection(true); EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, filter); endpoint.start(); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); assertTrue(inputChannel.send(message)); } @@ -146,7 +145,7 @@ public class MessageFilterTests { filter.setDiscardChannel(discardChannel); EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, filter); endpoint.start(); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); assertTrue(inputChannel.send(message)); Message reply = discardChannel.receive(0); assertNotNull(reply); @@ -169,7 +168,7 @@ public class MessageFilterTests { filter.setThrowExceptionOnRejection(true); EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, filter); endpoint.start(); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); try { assertTrue(inputChannel.send(message)); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/filter/MethodInvokingSelectorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/filter/MethodInvokingSelectorTests.java index 9af52cf745..9d51b2f932 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/filter/MethodInvokingSelectorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/filter/MethodInvokingSelectorTests.java @@ -25,7 +25,6 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.core.GenericMessage; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -36,7 +35,7 @@ public class MethodInvokingSelectorTests { @Test public void acceptedWithMethodName() { MethodInvokingSelector selector = new MethodInvokingSelector(new TestBean(), "acceptString"); - assertTrue(selector.accept(new StringMessage("should accept"))); + assertTrue(selector.accept(new GenericMessage("should accept"))); } @Test @@ -44,7 +43,7 @@ public class MethodInvokingSelectorTests { TestBean testBean = new TestBean(); Method method = testBean.getClass().getMethod("acceptString", new Class[] { Message.class }); MethodInvokingSelector selector = new MethodInvokingSelector(testBean, method); - assertTrue(selector.accept(new StringMessage("should accept"))); + assertTrue(selector.accept(new GenericMessage("should accept"))); } @Test @@ -64,7 +63,7 @@ public class MethodInvokingSelectorTests { @Test public void noArgMethodWithMethodName() { MethodInvokingSelector selector = new MethodInvokingSelector(new TestBean(), "noArgs"); - selector.accept(new StringMessage("test")); + selector.accept(new GenericMessage("test")); } @Test @@ -77,7 +76,7 @@ public class MethodInvokingSelectorTests { @Test(expected = IllegalArgumentException.class) public void voidReturningMethodWithMethodName() { MethodInvokingSelector selector = new MethodInvokingSelector(new TestBean(), "returnVoid"); - selector.accept(new StringMessage("test")); + selector.accept(new GenericMessage("test")); } @Test(expected = IllegalArgumentException.class) @@ -85,7 +84,7 @@ public class MethodInvokingSelectorTests { TestBean testBean = new TestBean(); Method method = testBean.getClass().getMethod("returnVoid", new Class[] { Message.class }); MethodInvokingSelector selector = new MethodInvokingSelector(testBean, method); - selector.accept(new StringMessage("test")); + selector.accept(new GenericMessage("test")); } 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 9e1c4763c1..b8fa2e093a 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -20,13 +20,14 @@ import junit.framework.Assert; 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.integration.Message; import org.springframework.integration.MessageHandlingException; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageHandler; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.core.SubscribableChannel; import org.springframework.integration.mapping.InboundMessageMapper; import org.springframework.test.context.ContextConfiguration; @@ -80,7 +81,7 @@ public class GatewayInvokingMessageHandlerTests { Assert.assertEquals("oleg", message.getHeaders().get("name")); } }); - channel.send(new StringMessage("hello")); + channel.send(new GenericMessage("hello")); } @Test @@ -177,7 +178,7 @@ public class GatewayInvokingMessageHandlerTests { } public MessageHandlingException echoWithMessagingException(String value) { - throw new MessageHandlingException(new StringMessage(value)); + throw new MessageHandlingException(new GenericMessage(value)); } public RuntimeException echoWithErrorAsync(String value) { throw new RuntimeException(value); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java index e9726dee57..3a8e809bd0 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java @@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit; import org.junit.Test; import org.mockito.Mockito; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -38,10 +39,10 @@ import org.springframework.integration.Message; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.context.IntegrationContextUtils; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.MessageHandler; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.EventDrivenConsumer; import org.springframework.util.ReflectionUtils; @@ -110,7 +111,7 @@ public class GatewayProxyFactoryBeanTests { @Test public void testSolicitResponse() throws Exception { QueueChannel replyChannel = new QueueChannel(); - replyChannel.send(new StringMessage("foo")); + replyChannel.send(new GenericMessage("foo")); GatewayProxyFactoryBean proxyFactory = new GatewayProxyFactoryBean(); proxyFactory.setServiceInterface(TestService.class); proxyFactory.setDefaultRequestChannel(new DirectChannel()); @@ -129,7 +130,7 @@ public class GatewayProxyFactoryBeanTests { new Thread(new Runnable() { public void run() { Message input = requestChannel.receive(); - StringMessage reply = new StringMessage(input.getPayload() + "456"); + GenericMessage reply = new GenericMessage(input.getPayload() + "456"); ((MessageChannel) input.getHeaders().getReplyChannel()).send(reply); } }).start(); @@ -208,7 +209,7 @@ public class GatewayProxyFactoryBeanTests { proxyFactory.setBeanName("testGateway"); proxyFactory.afterPropertiesSet(); TestService service = (TestService) proxyFactory.getObject(); - String result = service.requestReplyWithMessageParameter(new StringMessage("foo")); + String result = service.requestReplyWithMessageParameter(new GenericMessage("foo")); assertEquals("foobar", result); } @@ -218,7 +219,7 @@ public class GatewayProxyFactoryBeanTests { new Thread(new Runnable() { public void run() { Message input = requestChannel.receive(); - StringMessage reply = new StringMessage(input.getPayload() + "bar"); + GenericMessage reply = new GenericMessage(input.getPayload() + "bar"); ((MessageChannel) input.getHeaders().getReplyChannel()).send(reply); } }).start(); @@ -285,7 +286,7 @@ public class GatewayProxyFactoryBeanTests { new Thread(new Runnable() { public void run() { Message input = requestChannel.receive(); - StringMessage reply = new StringMessage(input.getPayload() + "bar"); + GenericMessage reply = new GenericMessage(input.getPayload() + "bar"); ((MessageChannel) input.getHeaders().getReplyChannel()).send(reply); } }).start(); 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 fc79273ba9..868b180e45 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-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -22,12 +22,13 @@ import static org.junit.Assert.assertThat; import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.junit.Test; + import org.springframework.integration.Message; import org.springframework.integration.MessageHandlingException; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.message.MessageMatcher; /** @@ -47,7 +48,7 @@ public class BridgeHandlerTests { public void simpleBridge() { QueueChannel outputChannel = new QueueChannel(); handler.setOutputChannel(outputChannel); - Message request = new StringMessage("test"); + Message request = new GenericMessage("test"); handler.handleMessage(request); Message reply = outputChannel.receive(0); assertNotNull(reply); @@ -56,7 +57,7 @@ public class BridgeHandlerTests { @Test(expected = MessageHandlingException.class) public void missingOutputChannelVerifiedAtRuntime() { - Message request = new StringMessage("test"); + Message request = new GenericMessage("test"); handler.handleMessage(request); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java index 39c9eb4417..ea88713b6a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,9 +34,9 @@ import org.springframework.integration.MessageDeliveryException; import org.springframework.integration.MessageHandlingException; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.context.IntegrationContextUtils; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageHandler; -import org.springframework.integration.core.StringMessage; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; /** @@ -230,7 +230,7 @@ public class DelayHandlerTests { public void verifyShutdownWithoutWaitingByDefault() throws Exception { DelayHandler delayHandler = new DelayHandler(5000); delayHandler.afterPropertiesSet(); - delayHandler.handleMessage(new StringMessage("foo")); + delayHandler.handleMessage(new GenericMessage("foo")); delayHandler.destroy(); final ThreadPoolTaskScheduler taskScheduler = (ThreadPoolTaskScheduler) new DirectFieldAccessor(delayHandler).getPropertyValue("taskScheduler"); @@ -255,7 +255,7 @@ public class DelayHandlerTests { DelayHandler delayHandler = new DelayHandler(5000); delayHandler.setWaitForTasksToCompleteOnShutdown(true); delayHandler.afterPropertiesSet(); - delayHandler.handleMessage(new StringMessage("foo")); + delayHandler.handleMessage(new GenericMessage("foo")); delayHandler.destroy(); final ThreadPoolTaskScheduler taskScheduler = (ThreadPoolTaskScheduler) new DirectFieldAccessor(delayHandler).getPropertyValue("taskScheduler"); 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 7179b6f007..c2a326f49b 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 @@ -25,6 +25,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.internal.matchers.TypeSafeMatcher; import org.junit.rules.ExpectedException; + import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.GenericApplicationContext; @@ -32,7 +33,6 @@ import org.springframework.context.support.StaticApplicationContext; import org.springframework.core.io.Resource; import org.springframework.expression.EvaluationException; import org.springframework.integration.core.GenericMessage; -import org.springframework.integration.core.StringMessage; /** * @author Dave Syer @@ -51,7 +51,7 @@ public class ExpressionEvaluatingMessageProcessorTests { @Test public void testProcessMessage() { ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload"); - assertEquals("foo", processor.processMessage(new StringMessage("foo"))); + assertEquals("foo", processor.processMessage(new GenericMessage("foo"))); } @Test @@ -64,7 +64,7 @@ public class ExpressionEvaluatingMessageProcessorTests { } ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("#target.stringify(payload)"); processor.getEvaluationContext().setVariable("target", new TestTarget()); - assertEquals("2", processor.processMessage(new StringMessage("2"))); + assertEquals("2", processor.processMessage(new GenericMessage("2"))); } @Test @@ -76,7 +76,7 @@ public class ExpressionEvaluatingMessageProcessorTests { } ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("#target.ping(payload)"); processor.getEvaluationContext().setVariable("target", new TestTarget()); - assertEquals(null, processor.processMessage(new StringMessage("2"))); + assertEquals(null, processor.processMessage(new GenericMessage("2"))); } @Test @@ -91,28 +91,28 @@ public class ExpressionEvaluatingMessageProcessorTests { ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("#target.find(payload)"); processor.setBeanFactory(new GenericApplicationContext().getBeanFactory()); processor.getEvaluationContext().setVariable("target", new TestTarget()); - String result = (String) processor.processMessage(new StringMessage("classpath:*.properties")); + String result = (String) processor.processMessage(new GenericMessage("classpath:*.properties")); assertTrue("Wrong result: "+result, result.contains("log4j.properties")); } @Test public void testProcessMessageWithDollarInBrackets() { ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers['$id']"); - StringMessage message = new StringMessage("foo"); + GenericMessage message = new GenericMessage("foo"); assertEquals(message.getHeaders().getId(), processor.processMessage(message)); } @Test public void testProcessMessageWithDollarPropertyAccess() { ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers.$id"); - StringMessage message = new StringMessage("foo"); + GenericMessage message = new GenericMessage("foo"); assertEquals(message.getHeaders().getId(), processor.processMessage(message)); } @Test public void testProcessMessageWithStaticKey() { ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers[headers.ID]"); - StringMessage message = new StringMessage("foo"); + GenericMessage message = new GenericMessage("foo"); assertEquals(message.getHeaders().getId(), processor.processMessage(message)); } @@ -124,7 +124,7 @@ public class ExpressionEvaluatingMessageProcessorTests { context.registerBeanDefinition("testString", beanDefinition); ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.concat(@testString)"); processor.setBeanFactory(context); - StringMessage message = new StringMessage("foo"); + GenericMessage message = new GenericMessage("foo"); assertEquals("foobar", processor.processMessage(message)); } @@ -136,7 +136,7 @@ public class ExpressionEvaluatingMessageProcessorTests { context.registerBeanDefinition("testString", beanDefinition); ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("@testString.concat(payload)"); processor.setBeanFactory(context); - StringMessage message = new StringMessage("foo"); + GenericMessage message = new GenericMessage("foo"); assertEquals("barfoo", processor.processMessage(message)); } @@ -155,7 +155,7 @@ public class ExpressionEvaluatingMessageProcessorTests { } }); ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.fixMe()"); - assertEquals("foo", processor.processMessage(new StringMessage("foo"))); + assertEquals("foo", processor.processMessage(new GenericMessage("foo"))); } @Test diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/HandlerMethodInheritanceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/HandlerMethodInheritanceTests.java index 5dc652bbda..a61e0d0778 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/HandlerMethodInheritanceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/HandlerMethodInheritanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -22,7 +22,7 @@ import java.lang.reflect.Method; import org.junit.Test; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.util.ReflectionUtils; /** @@ -43,7 +43,7 @@ public class HandlerMethodInheritanceTests { public void overridingMethodResolves() { Method[] candidates = HandlerMethodUtils.getCandidateHandlerMethods(new TestSubclass()); PayloadTypeMatchingHandlerMethodResolver resolver = new PayloadTypeMatchingHandlerMethodResolver(candidates); - Method resolved = resolver.resolveHandlerMethod(new StringMessage("test")); + Method resolved = resolver.resolveHandlerMethod(new GenericMessage("test")); Method expected = ReflectionUtils.findMethod( TestSubclass.class, "test", new Class[] { String.class }); assertEquals(expected, resolved); 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 f83f969edd..b217253f03 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 @@ -26,17 +26,17 @@ import java.util.Map; import java.util.Properties; import org.junit.Assert; -import org.junit.Test; +import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.MessageHandlingException; import org.springframework.integration.MessageHeaders; import org.springframework.integration.MessagingException; -import org.springframework.integration.annotation.Header; +import org.springframework.integration.annotation.Header; import org.springframework.integration.annotation.Headers; import org.springframework.integration.annotation.Payload; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -54,7 +54,7 @@ public class MethodInvokingMessageProcessorAnnotationTests { public void optionalHeader() throws Exception { Method method = TestService.class.getMethod("optionalHeader", Integer.class); MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(testService, method); - Object result = processor.processMessage(new StringMessage("foo")); + Object result = processor.processMessage(new GenericMessage("foo")); assertNull(result); } @@ -62,7 +62,7 @@ public class MethodInvokingMessageProcessorAnnotationTests { public void requiredHeaderNotProvided() throws Exception { Method method = TestService.class.getMethod("requiredHeader", Integer.class); MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(testService, method); - processor.processMessage(new StringMessage("foo")); + processor.processMessage(new GenericMessage("foo")); } @Test 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 1cedc0cce8..0c6323bafe 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 @@ -32,13 +32,13 @@ import org.junit.Rule; import org.junit.Test; import org.junit.internal.matchers.TypeSafeMatcher; import org.junit.rules.ExpectedException; + import org.springframework.integration.Message; import org.springframework.integration.MessageHandlingException; import org.springframework.integration.annotation.Header; import org.springframework.integration.annotation.ServiceActivator; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -70,7 +70,7 @@ public class MethodInvokingMessageProcessorTests { } MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new B(), "myMethod"); - Message message = (Message) processor.processMessage(new StringMessage("")); + Message message = (Message) processor.processMessage(new GenericMessage("")); assertEquals("A", message.getHeaders().get("A")); } @@ -94,7 +94,7 @@ public class MethodInvokingMessageProcessorTests { } MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new B(), "myMethod"); - Message message = (Message) processor.processMessage(new StringMessage("")); + Message message = (Message) processor.processMessage(new GenericMessage("")); assertEquals("B", message.getHeaders().get("B")); } @@ -119,7 +119,7 @@ public class MethodInvokingMessageProcessorTests { } MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new C(), "myMethod"); - Message message = (Message) processor.processMessage(new StringMessage("")); + Message message = (Message) processor.processMessage(new GenericMessage("")); assertEquals("C", message.getHeaders().get("C")); } @@ -141,7 +141,7 @@ public class MethodInvokingMessageProcessorTests { } MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new C(), "myMethod"); - Message message = (Message) processor.processMessage(new StringMessage("")); + Message message = (Message) processor.processMessage(new GenericMessage("")); assertEquals("C", message.getHeaders().get("C")); } @@ -149,7 +149,7 @@ public class MethodInvokingMessageProcessorTests { public void payloadAsMethodParameterAndObjectAsReturnValue() { MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new TestBean(), "acceptPayloadAndReturnObject"); - Object result = processor.processMessage(new StringMessage("testing")); + Object result = processor.processMessage(new GenericMessage("testing")); assertEquals("testing-1", result); } @@ -165,7 +165,7 @@ public class MethodInvokingMessageProcessorTests { public void payloadAsMethodParameterAndMessageAsReturnValue() { MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new TestBean(), "acceptPayloadAndReturnMessage"); - Message result = (Message) processor.processMessage(new StringMessage("testing")); + Message result = (Message) processor.processMessage(new GenericMessage("testing")); assertEquals("testing-2", result.getPayload()); } @@ -173,7 +173,7 @@ public class MethodInvokingMessageProcessorTests { public void messageAsMethodParameterAndObjectAsReturnValue() { MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new TestBean(), "acceptMessageAndReturnObject"); - Object result = processor.processMessage(new StringMessage("testing")); + Object result = processor.processMessage(new GenericMessage("testing")); assertEquals("testing-3", result); } @@ -181,7 +181,7 @@ public class MethodInvokingMessageProcessorTests { public void messageAsMethodParameterAndMessageAsReturnValue() { MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new TestBean(), "acceptMessageAndReturnMessage"); - Message result = (Message) processor.processMessage(new StringMessage("testing")); + Message result = (Message) processor.processMessage(new GenericMessage("testing")); assertEquals("testing-4", result.getPayload()); } @@ -189,7 +189,7 @@ public class MethodInvokingMessageProcessorTests { public void messageSubclassAsMethodParameterAndMessageAsReturnValue() { MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new TestBean(), "acceptMessageSubclassAndReturnMessage"); - Message result = (Message) processor.processMessage(new StringMessage("testing")); + Message result = (Message) processor.processMessage(new GenericMessage("testing")); assertEquals("testing-5", result.getPayload()); } @@ -197,7 +197,7 @@ public class MethodInvokingMessageProcessorTests { public void messageSubclassAsMethodParameterAndMessageSubclassAsReturnValue() { MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new TestBean(), "acceptMessageSubclassAndReturnMessageSubclass"); - Message result = (Message) processor.processMessage(new StringMessage("testing")); + Message result = (Message) processor.processMessage(new GenericMessage("testing")); assertEquals("testing-6", result.getPayload()); } @@ -249,7 +249,7 @@ public class MethodInvokingMessageProcessorTests { AnnotatedTestService service = new AnnotatedTestService(); Method method = service.getClass().getMethod("messageOnly", Message.class); MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(service, method); - Object result = processor.processMessage(new StringMessage("foo")); + Object result = processor.processMessage(new GenericMessage("foo")); assertEquals("foo", result); } @@ -267,7 +267,7 @@ public class MethodInvokingMessageProcessorTests { AnnotatedTestService service = new AnnotatedTestService(); Method method = service.getClass().getMethod("integerMethod", Integer.class); MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(service, method); - Object result = processor.processMessage(new StringMessage("456")); + Object result = processor.processMessage(new GenericMessage("456")); assertEquals(new Integer(456), result); } @@ -276,7 +276,7 @@ public class MethodInvokingMessageProcessorTests { AnnotatedTestService service = new AnnotatedTestService(); Method method = service.getClass().getMethod("integerMethod", Integer.class); MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(service, method); - processor.processMessage(new StringMessage("foo")); + processor.processMessage(new GenericMessage("foo")); } @Test @@ -286,7 +286,7 @@ public class MethodInvokingMessageProcessorTests { AnnotatedTestService service = new AnnotatedTestService(); Method method = service.getClass().getMethod("integerMethod", Integer.class); MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(service, method); - assertEquals("foo", processor.processMessage(new StringMessage("foo"))); + assertEquals("foo", processor.processMessage(new GenericMessage("foo"))); } @Test @@ -295,7 +295,7 @@ public class MethodInvokingMessageProcessorTests { TestErrorService service = new TestErrorService(); Method method = service.getClass().getMethod("error", String.class); MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(service, method); - assertEquals("foo", processor.processMessage(new StringMessage("foo"))); + assertEquals("foo", processor.processMessage(new GenericMessage("foo"))); } @Test @@ -304,7 +304,7 @@ public class MethodInvokingMessageProcessorTests { TestErrorService service = new TestErrorService(); Method method = service.getClass().getMethod("checked", String.class); MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(service, method); - assertEquals("foo", processor.processMessage(new StringMessage("foo"))); + assertEquals("foo", processor.processMessage(new GenericMessage("foo"))); } @Test @@ -406,7 +406,7 @@ public class MethodInvokingMessageProcessorTests { } public Message acceptPayloadAndReturnMessage(String s) { - return new StringMessage(s + "-2"); + return new GenericMessage(s + "-2"); } public String acceptMessageAndReturnObject(Message m) { @@ -414,15 +414,15 @@ public class MethodInvokingMessageProcessorTests { } public Message acceptMessageAndReturnMessage(Message m) { - return new StringMessage(m.getPayload() + "-4"); + return new GenericMessage(m.getPayload() + "-4"); } - public Message acceptMessageSubclassAndReturnMessage(StringMessage m) { - return new StringMessage(m.getPayload() + "-5"); + public Message acceptMessageSubclassAndReturnMessage(GenericMessage m) { + return new GenericMessage(m.getPayload() + "-5"); } - public StringMessage acceptMessageSubclassAndReturnMessageSubclass(StringMessage m) { - return new StringMessage(m.getPayload() + "-6"); + public GenericMessage acceptMessageSubclassAndReturnMessageSubclass(GenericMessage m) { + return new GenericMessage(m.getPayload() + "-6"); } public String acceptPayloadAndHeaderAndReturnObject(String s, @Header("number") Integer n) { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/PayloadTypeMatchingHandlerMethodResolverTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/PayloadTypeMatchingHandlerMethodResolverTests.java index 1ba72fa9e5..fad8c9f201 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/PayloadTypeMatchingHandlerMethodResolverTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/PayloadTypeMatchingHandlerMethodResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 @@ import org.junit.Test; import org.springframework.integration.annotation.Header; import org.springframework.integration.core.GenericMessage; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -47,7 +46,7 @@ public class PayloadTypeMatchingHandlerMethodResolverTests { public void stringPayload() throws Exception { Class[] types = new Class[] { String.class }; Method expected = TestService.class.getMethod("stringPayload", types); - Method resolved = resolver.resolveHandlerMethod(new StringMessage("foo")); + Method resolved = resolver.resolveHandlerMethod(new GenericMessage("foo")); assertEquals(expected, resolved); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/PayloadTypeMatchingHandlerMethodResolverWithMessageParameterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/PayloadTypeMatchingHandlerMethodResolverWithMessageParameterTests.java index 6f72102245..81abe44202 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/PayloadTypeMatchingHandlerMethodResolverWithMessageParameterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/PayloadTypeMatchingHandlerMethodResolverWithMessageParameterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -28,7 +28,6 @@ import org.springframework.integration.Message; import org.springframework.integration.annotation.Header; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -49,7 +48,7 @@ public class PayloadTypeMatchingHandlerMethodResolverWithMessageParameterTests { public void stringPayload() throws Exception { Class[] types = new Class[] { Message.class }; Method expected = TestService.class.getMethod("stringPayload", types); - Method resolved = resolver.resolveHandlerMethod(new StringMessage("foo")); + Method resolved = resolver.resolveHandlerMethod(new TestStringMessage("foo")); assertEquals(expected, resolved); } @@ -115,9 +114,9 @@ public class PayloadTypeMatchingHandlerMethodResolverWithMessageParameterTests { Method[] candidates = HandlerMethodUtils.getCandidateHandlerMethods(service); PayloadTypeMatchingHandlerMethodResolver methodResovler = new PayloadTypeMatchingHandlerMethodResolver(candidates); - Class[] types = new Class[] { StringMessage.class }; + Class[] types = new Class[] { TestStringMessage.class }; Method expected = TestServiceWithMessageTypes.class.getMethod("stringMessage", types); - Message message = new StringMessage("foo"); + Message message = new TestStringMessage("foo"); Method resolved = methodResovler.resolveHandlerMethod(message); assertEquals(expected, resolved); assertEquals("foo", resolved.invoke(service, message)); @@ -215,7 +214,7 @@ public class PayloadTypeMatchingHandlerMethodResolverWithMessageParameterTests { public static class TestServiceWithMessageTypes { - public String stringMessage(StringMessage message) { + public String stringMessage(TestStringMessage message) { return message.getPayload(); } @@ -248,4 +247,14 @@ public class PayloadTypeMatchingHandlerMethodResolverWithMessageParameterTests { public class TestFooImpl2Subclass extends TestFooImpl2 { } + + @SuppressWarnings("serial") + private static class TestStringMessage extends GenericMessage { + + private TestStringMessage(String payload) { + super(payload); + } + + } + } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/StaticHandlerMethodResolverTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/StaticHandlerMethodResolverTests.java index f84f069e8b..094a4a35fc 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/StaticHandlerMethodResolverTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/StaticHandlerMethodResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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.junit.Test; import org.springframework.integration.annotation.Header; import org.springframework.integration.annotation.Headers; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; /** * @author Mark Fisher @@ -61,7 +61,7 @@ public class StaticHandlerMethodResolverTests { public void validPayloadMethod() throws Exception { Method method = TestBean.class.getDeclaredMethod("payloadMethod", new Class[] {String.class}); HandlerMethodResolver resolver = new StaticHandlerMethodResolver(method); - Method resolved = resolver.resolveHandlerMethod(new StringMessage("foo")); + Method resolved = resolver.resolveHandlerMethod(new GenericMessage("foo")); assertEquals(method, resolved); } @@ -75,7 +75,7 @@ public class StaticHandlerMethodResolverTests { public void validHeaderMethod() throws Exception { Method method = TestBean.class.getDeclaredMethod("headerMethod", new Class[] {String.class}); HandlerMethodResolver resolver = new StaticHandlerMethodResolver(method); - Method resolved = resolver.resolveHandlerMethod(new StringMessage("foo")); + Method resolved = resolver.resolveHandlerMethod(new GenericMessage("foo")); assertEquals(method, resolved); } @@ -83,7 +83,7 @@ public class StaticHandlerMethodResolverTests { public void validHeaderMapMethod() throws Exception { Method method = TestBean.class.getDeclaredMethod("headerMapMethod", new Class[] {Map.class}); HandlerMethodResolver resolver = new StaticHandlerMethodResolver(method); - Method resolved = resolver.resolveHandlerMethod(new StringMessage("foo")); + Method resolved = resolver.resolveHandlerMethod(new GenericMessage("foo")); assertEquals(method, resolved); } @@ -92,7 +92,7 @@ public class StaticHandlerMethodResolverTests { Class[] types = new Class[] { String.class, String.class }; Method method = TestBean.class.getDeclaredMethod("payloadAndHeaderMethod", types); HandlerMethodResolver resolver = new StaticHandlerMethodResolver(method); - Method resolved = resolver.resolveHandlerMethod(new StringMessage("foo")); + Method resolved = resolver.resolveHandlerMethod(new GenericMessage("foo")); assertEquals(method, resolved); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingMessageHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingMessageHandlerTests.java index 72bc93bbe8..0a645c8b6f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingMessageHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,6 @@ import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.core.GenericMessage; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.endpoint.PollingConsumer; import org.springframework.integration.handler.MethodInvokingMessageHandler; import org.springframework.integration.test.util.TestUtils; @@ -56,7 +55,7 @@ public class MethodInvokingMessageHandlerTests { @Test(expected = MessagingException.class) public void methodWithReturnValue() { - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); try { MethodInvokingMessageHandler handler = new MethodInvokingMessageHandler(new TestSink(), "methodWithReturnValue"); handler.handleMessage(message); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/selector/PayloadTypeSelectorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/message/selector/PayloadTypeSelectorTests.java index 00da8beb67..da49e0cc0b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/message/selector/PayloadTypeSelectorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/message/selector/PayloadTypeSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -24,7 +24,6 @@ import org.junit.Test; import org.springframework.integration.MessagingException; import org.springframework.integration.core.ErrorMessage; import org.springframework.integration.core.GenericMessage; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.selector.PayloadTypeSelector; /** @@ -35,19 +34,19 @@ public class PayloadTypeSelectorTests { @Test public void testAcceptedTypeIsSelected() { PayloadTypeSelector selector = new PayloadTypeSelector(String.class); - assertTrue(selector.accept(new StringMessage("test"))); + assertTrue(selector.accept(new GenericMessage("test"))); } @Test public void testNonAcceptedTypeIsNotSelected() { PayloadTypeSelector selector = new PayloadTypeSelector(Integer.class); - assertFalse(selector.accept(new StringMessage("test"))); + assertFalse(selector.accept(new GenericMessage("test"))); } @Test public void testMultipleAcceptedTypes() { PayloadTypeSelector selector = new PayloadTypeSelector(String.class, Integer.class); - assertTrue(selector.accept(new StringMessage("test1"))); + assertTrue(selector.accept(new GenericMessage("test1"))); assertTrue(selector.accept(new GenericMessage(2))); assertFalse(selector.accept(new ErrorMessage(new RuntimeException()))); } 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 53ab10096b..38e4c4131b 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 @@ import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.core.ErrorMessage; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -51,7 +50,7 @@ public class ErrorMessageExceptionTypeRouterTests { @Test public void mostSpecificCause() { - Message failedMessage = new StringMessage("foo"); + Message failedMessage = new GenericMessage("foo"); IllegalArgumentException rootCause = new IllegalArgumentException("bad argument"); RuntimeException middleCause = new RuntimeException(rootCause); MessageHandlingException error = new MessageHandlingException(failedMessage, "failed", middleCause); @@ -73,7 +72,7 @@ public class ErrorMessageExceptionTypeRouterTests { @Test public void fallbackToNextMostSpecificCause() { - Message failedMessage = new StringMessage("foo"); + Message failedMessage = new GenericMessage("foo"); IllegalArgumentException rootCause = new IllegalArgumentException("bad argument"); RuntimeException middleCause = new RuntimeException(rootCause); MessageHandlingException error = new MessageHandlingException(failedMessage, "failed", middleCause); @@ -94,7 +93,7 @@ public class ErrorMessageExceptionTypeRouterTests { @Test public void fallbackToErrorMessageType() { - Message failedMessage = new StringMessage("foo"); + Message failedMessage = new GenericMessage("foo"); IllegalArgumentException rootCause = new IllegalArgumentException("bad argument"); RuntimeException middleCause = new RuntimeException(rootCause); MessageHandlingException error = new MessageHandlingException(failedMessage, "failed", middleCause); @@ -114,7 +113,7 @@ public class ErrorMessageExceptionTypeRouterTests { @Test public void fallbackToDefaultChannel() { - Message failedMessage = new StringMessage("foo"); + Message failedMessage = new GenericMessage("foo"); IllegalArgumentException rootCause = new IllegalArgumentException("bad argument"); RuntimeException middleCause = new RuntimeException(rootCause); MessageHandlingException error = new MessageHandlingException(failedMessage, "failed", middleCause); @@ -130,7 +129,7 @@ public class ErrorMessageExceptionTypeRouterTests { @Test(expected = MessageDeliveryException.class) public void noMatchAndNoDefaultChannel() { - Message failedMessage = new StringMessage("foo"); + Message failedMessage = new GenericMessage("foo"); IllegalArgumentException rootCause = new IllegalArgumentException("bad argument"); RuntimeException middleCause = new RuntimeException(rootCause); MessageHandlingException error = new MessageHandlingException(failedMessage, "failed", middleCause); @@ -146,7 +145,7 @@ public class ErrorMessageExceptionTypeRouterTests { @Test public void exceptionPayloadButNotErrorMessage() { - Message failedMessage = new StringMessage("foo"); + Message failedMessage = new GenericMessage("foo"); IllegalArgumentException rootCause = new IllegalArgumentException("bad argument"); RuntimeException middleCause = new RuntimeException(rootCause); MessageHandlingException error = new MessageHandlingException(failedMessage, "failed", middleCause); @@ -168,7 +167,7 @@ public class ErrorMessageExceptionTypeRouterTests { @Test public void intermediateCauseHasNoMappingButMostSpecificCauseDoes() { - Message failedMessage = new StringMessage("foo"); + Message failedMessage = new GenericMessage("foo"); IllegalArgumentException rootCause = new IllegalArgumentException("bad argument"); RuntimeException middleCause = new RuntimeException(rootCause); MessageHandlingException error = new MessageHandlingException(failedMessage, "failed", middleCause); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/MethodInvokingRouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/MethodInvokingRouterTests.java index 9032686ee7..b4801f0846 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/MethodInvokingRouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/MethodInvokingRouterTests.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import org.junit.Test; + import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.annotation.Header; @@ -34,7 +35,6 @@ import org.springframework.integration.core.ChannelResolver; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -123,9 +123,9 @@ public class MethodInvokingRouterTests { channelResolver.addChannel("foo-channel", fooChannel); channelResolver.addChannel("bar-channel", barChannel); router.setChannelResolver(channelResolver); - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); router.handleMessage(fooMessage); Message result1 = fooChannel.receive(0); assertNotNull(result1); @@ -155,9 +155,9 @@ public class MethodInvokingRouterTests { } private void doTestChannelInstanceResolutionByPayload(MethodInvokingRouter router, TestChannelResolver channelResolver) { - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); QueueChannel fooChannel = new QueueChannel(); QueueChannel barChannel = new QueueChannel(); channelResolver.addChannel("foo-channel", fooChannel); @@ -197,9 +197,9 @@ public class MethodInvokingRouterTests { channelResolver.addChannel("foo-channel", fooChannel); channelResolver.addChannel("bar-channel", barChannel); router.setChannelResolver(channelResolver); - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); router.handleMessage(fooMessage); Message result1 = fooChannel.receive(0); assertNotNull(result1); @@ -234,9 +234,9 @@ public class MethodInvokingRouterTests { channelResolver.addChannel("foo-channel", fooChannel); channelResolver.addChannel("bar-channel", barChannel); router.setChannelResolver(channelResolver); - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); router.handleMessage(fooMessage); Message result1a = fooChannel.receive(0); Message result1b = barChannel.receive(0); @@ -277,9 +277,9 @@ public class MethodInvokingRouterTests { channelResolver.addChannel("foo-channel", fooChannel); channelResolver.addChannel("bar-channel", barChannel); router.setChannelResolver(channelResolver); - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); router.handleMessage(fooMessage); Message result1a = fooChannel.receive(0); assertNotNull(result1a); @@ -320,9 +320,9 @@ public class MethodInvokingRouterTests { channelResolver.addChannel("foo-channel", fooChannel); channelResolver.addChannel("bar-channel", barChannel); router.setChannelResolver(channelResolver); - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); router.handleMessage(fooMessage); Message result1a = fooChannel.receive(0); assertNotNull(result1a); @@ -363,9 +363,9 @@ public class MethodInvokingRouterTests { channelResolver.addChannel("foo-channel", fooChannel); channelResolver.addChannel("bar-channel", barChannel); router.setChannelResolver(channelResolver); - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); router.handleMessage(fooMessage); Message result1a = fooChannel.receive(0); Message result1b = barChannel.receive(0); @@ -406,9 +406,9 @@ public class MethodInvokingRouterTests { channelResolver.addChannel("foo-channel", fooChannel); channelResolver.addChannel("bar-channel", barChannel); router.setChannelResolver(channelResolver); - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); router.handleMessage(fooMessage); Message result1a = fooChannel.receive(0); Message result1b = barChannel.receive(0); @@ -449,9 +449,9 @@ public class MethodInvokingRouterTests { channelResolver.addChannel("foo-channel", fooChannel); channelResolver.addChannel("bar-channel", barChannel); router.setChannelResolver(channelResolver); - Message fooMessage = new StringMessage("foo"); - Message barMessage = new StringMessage("bar"); - Message badMessage = new StringMessage("bad"); + Message fooMessage = new GenericMessage("foo"); + Message barMessage = new GenericMessage("bar"); + Message badMessage = new GenericMessage("bad"); router.handleMessage(fooMessage); Message result1a = fooChannel.receive(0); Message result1b = barChannel.receive(0); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/MultiChannelRouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/MultiChannelRouterTests.java index 122f0da5c9..4a5df75991 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/MultiChannelRouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/MultiChannelRouterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -22,11 +22,12 @@ import static org.junit.Assert.assertNotNull; import java.util.List; import org.junit.Test; + import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.channel.TestChannelResolver; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.util.CollectionUtils; /** @@ -48,7 +49,7 @@ public class MultiChannelRouterTests { channelResolver.addChannel("channel1", channel1); channelResolver.addChannel("channel2", channel2); router.setChannelResolver(channelResolver); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result1 = channel1.receive(25); assertNotNull(result1); @@ -68,7 +69,7 @@ public class MultiChannelRouterTests { }; TestChannelResolver channelResolver = new TestChannelResolver(); router.setChannelResolver(channelResolver); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -80,7 +81,7 @@ public class MultiChannelRouterTests { return CollectionUtils.arrayToList(new String[] {"noSuchChannel"}); } }; - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } 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 cd9a9a5b39..1d322557be 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-2009 the original author or authors. + * Copyright 2002-2010 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,6 @@ import org.springframework.integration.MessageHandlingException; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -47,7 +46,7 @@ public class PayloadTypeRouterTests { payloadTypeChannelMap.put(Integer.class, integerChannel); PayloadTypeRouter router = new PayloadTypeRouter(); router.setPayloadTypeChannelMap(payloadTypeChannelMap); - Message message1 = new StringMessage("test"); + Message message1 = new GenericMessage("test"); Message message2 = new GenericMessage(123); MessageChannel result1 = router.determineTargetChannel(message1); MessageChannel result2 = router.determineTargetChannel(message2); @@ -196,7 +195,7 @@ public class PayloadTypeRouterTests { payloadTypeChannelMap.put(Integer.class, integerChannel); PayloadTypeRouter router = new PayloadTypeRouter(); router.setPayloadTypeChannelMap(payloadTypeChannelMap); - Message message1 = new StringMessage("test"); + Message message1 = new GenericMessage("test"); Message message2 = new GenericMessage(123); router.handleMessage(message1); router.handleMessage(message2); @@ -217,7 +216,7 @@ public class PayloadTypeRouterTests { PayloadTypeRouter router = new PayloadTypeRouter(); router.setPayloadTypeChannelMap(payloadTypeChannelMap); router.setDefaultOutputChannel(defaultChannel); - Message message1 = new StringMessage("test"); + Message message1 = new GenericMessage("test"); Message message2 = new GenericMessage(123); router.handleMessage(message1); router.handleMessage(message2); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/RecipientListRouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/RecipientListRouterTests.java index 5fd12a330a..52c32cb990 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/RecipientListRouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/RecipientListRouterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,9 +30,9 @@ import org.springframework.beans.DirectFieldAccessor; import org.springframework.integration.Message; import org.springframework.integration.MessageDeliveryException; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.router.RecipientListRouter.Recipient; /** @@ -68,7 +68,7 @@ public class RecipientListRouterTests { RecipientListRouter router = new RecipientListRouter(); router.setChannels(channels); router.afterPropertiesSet(); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result1 = channel1.receive(25); assertNotNull(result1); @@ -84,7 +84,7 @@ public class RecipientListRouterTests { channel.setBeanName("channel"); RecipientListRouter router = new RecipientListRouter(); router.setChannels(Collections.singletonList((MessageChannel) channel)); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result1 = channel.receive(25); assertNotNull(result1); @@ -108,8 +108,8 @@ public class RecipientListRouterTests { channels.add(channelB); channels.add(channelC); router.setChannels(channels); - channelA.send(new StringMessage("blocker")); - Message message = new StringMessage("test"); + channelA.send(new GenericMessage("blocker")); + Message message = new GenericMessage("test"); try { router.handleMessage(message); } @@ -138,8 +138,8 @@ public class RecipientListRouterTests { channels.add(channelB); channels.add(channelC); router.setChannels(channels); - channelB.send(new StringMessage("blocker")); - Message message = new StringMessage("test"); + channelB.send(new GenericMessage("blocker")); + Message message = new GenericMessage("test"); try { router.handleMessage(message); } @@ -170,8 +170,8 @@ public class RecipientListRouterTests { channels.add(channelB); channels.add(channelC); router.setChannels(channels); - channelC.send(new StringMessage("blocker")); - Message message = new StringMessage("test"); + channelC.send(new GenericMessage("blocker")); + Message message = new GenericMessage("test"); try { router.handleMessage(message); } @@ -205,8 +205,8 @@ public class RecipientListRouterTests { channels.add(channelB); channels.add(channelC); router.setChannels(channels); - channelA.send(new StringMessage("blocker")); - Message message = new StringMessage("test"); + channelA.send(new GenericMessage("blocker")); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result1a = channelA.receive(0); Message result1b = channelB.receive(0); @@ -235,8 +235,8 @@ public class RecipientListRouterTests { channels.add(channelB); channels.add(channelC); router.setChannels(channels); - channelB.send(new StringMessage("blocker")); - Message message = new StringMessage("test"); + channelB.send(new GenericMessage("blocker")); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result1a = channelA.receive(0); Message result1b = channelB.receive(0); @@ -265,8 +265,8 @@ public class RecipientListRouterTests { channels.add(channelB); channels.add(channelC); router.setChannels(channels); - channelC.send(new StringMessage("blocker")); - Message message = new StringMessage("test"); + channelC.send(new GenericMessage("blocker")); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result1a = channelA.receive(0); Message result1b = channelB.receive(0); @@ -290,7 +290,7 @@ public class RecipientListRouterTests { channels.add(channelA); channels.add(channelB); router.setChannels(channels); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result1a = channelA.receive(0); Message result1b = channelB.receive(0); @@ -318,7 +318,7 @@ public class RecipientListRouterTests { channels.add(channelA); channels.add(channelB); router.setChannels(channels); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result1a = channelA.receive(0); Message result1b = channelB.receive(0); @@ -368,7 +368,7 @@ public class RecipientListRouterTests { recipients.add(new Recipient(channel5, new AlwaysFalseSelector())); RecipientListRouter router = new RecipientListRouter(); router.setRecipients(recipients); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); Message reply1 = channel1.receive(0); assertEquals(message, reply1); 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 87a28bc00a..a24de11929 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-2008 the original author or authors. + * Copyright 2002-2010 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,14 +23,15 @@ import java.util.Collections; import java.util.List; import org.junit.Test; + import org.springframework.context.support.GenericApplicationContext; import org.springframework.integration.Message; import org.springframework.integration.MessageDeliveryException; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.channel.TestChannelResolver; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.util.CollectionUtils; /** @@ -45,7 +46,7 @@ public class RouterTests { return null; } }; - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -57,7 +58,7 @@ public class RouterTests { } }; router.setResolutionRequired(true); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -68,7 +69,7 @@ public class RouterTests { return Collections.emptyList(); } }; - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -80,7 +81,7 @@ public class RouterTests { } }; router.setResolutionRequired(true); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -93,7 +94,7 @@ public class RouterTests { }; TestChannelResolver channelResolver = new TestChannelResolver(); router.setChannelResolver(channelResolver); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -107,7 +108,7 @@ public class RouterTests { TestChannelResolver channelResolver = new TestChannelResolver(); router.setChannelResolver(channelResolver); router.setResolutionRequired(true); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -121,7 +122,7 @@ public class RouterTests { }; TestChannelResolver channelResolver = new TestChannelResolver(); router.setChannelResolver(channelResolver); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -136,7 +137,7 @@ public class RouterTests { TestChannelResolver channelResolver = new TestChannelResolver(); router.setChannelResolver(channelResolver); router.setResolutionRequired(true); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -147,7 +148,7 @@ public class RouterTests { return "notImportant"; } }; - router.handleMessage(new StringMessage("this should fail")); + router.handleMessage(new GenericMessage("this should fail")); } @Test(expected = MessagingException.class) @@ -158,7 +159,7 @@ public class RouterTests { return CollectionUtils.arrayToList(new String[] { "notImportant" }); } }; - router.handleMessage(new StringMessage("this should fail")); + router.handleMessage(new GenericMessage("this should fail")); } @Test @@ -172,7 +173,7 @@ public class RouterTests { GenericApplicationContext context = new GenericApplicationContext(); context.getBeanFactory().registerSingleton("testChannel", testChannel); router.setBeanFactory(context); - router.handleMessage(new StringMessage("test")); + router.handleMessage(new GenericMessage("test")); Message reply = testChannel.receive(0); assertEquals("test", reply.getPayload()); } @@ -189,7 +190,7 @@ public class RouterTests { GenericApplicationContext context = new GenericApplicationContext(); context.getBeanFactory().registerSingleton("testChannel", testChannel); router.setBeanFactory(context); - router.handleMessage(new StringMessage("test")); + router.handleMessage(new GenericMessage("test")); Message reply = testChannel.receive(0); assertEquals("test", reply.getPayload()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/SingleChannelRouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/SingleChannelRouterTests.java index e6df36933c..3b9ba6457a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/SingleChannelRouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/SingleChannelRouterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,8 +25,8 @@ import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.channel.TestChannelResolver; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -41,7 +41,7 @@ public class SingleChannelRouterTests { return channel; } }; - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result = channel.receive(25); assertNotNull(result); @@ -59,7 +59,7 @@ public class SingleChannelRouterTests { TestChannelResolver channelResolver = new TestChannelResolver(); channelResolver.addChannel("testChannel", channel); router.setChannelResolver(channelResolver); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); Message result = channel.receive(25); assertNotNull(result); @@ -73,7 +73,7 @@ public class SingleChannelRouterTests { return null; } }; - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(message); } @@ -86,7 +86,7 @@ public class SingleChannelRouterTests { }; TestChannelResolver channelResolver = new TestChannelResolver(); router.setChannelResolver(channelResolver); - Message message = new StringMessage("test"); + Message message = new GenericMessage("test"); router.handleMessage(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 3d0db4ddee..c139b7b432 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 @@ -20,6 +20,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import java.util.Collection; import java.util.Collections; @@ -39,16 +42,11 @@ import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.MessageHandler; import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.core.SubscribableChannel; import org.springframework.integration.router.AbstractMessageRouter; import org.springframework.integration.router.MethodInvokingRouter; import org.springframework.integration.test.util.TestUtils; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - /** * @author Mark Fisher * @author Jonas Partner @@ -63,11 +61,11 @@ public class RouterParserTests { MessageChannel input = (MessageChannel) context.getBean("input"); PollableChannel output1 = (PollableChannel) context.getBean("output1"); PollableChannel output2 = (PollableChannel) context.getBean("output2"); - input.send(new StringMessage("1")); + input.send(new GenericMessage("1")); Message result1 = output1.receive(1000); assertEquals("1", result1.getPayload()); assertNull(output2.receive(0)); - input.send(new StringMessage("2")); + input.send(new GenericMessage("2")); Message result2 = output2.receive(1000); assertEquals("2", result2.getPayload()); assertNull(output1.receive(0)); @@ -82,7 +80,7 @@ public class RouterParserTests { PollableChannel output1 = (PollableChannel) context.getBean("output1"); PollableChannel output2 = (PollableChannel) context.getBean("output2"); PollableChannel defaultOutput = (PollableChannel) context.getBean("defaultOutput"); - input.send(new StringMessage("99")); + input.send(new GenericMessage("99")); assertNull(output1.receive(0)); assertNull(output2.receive(0)); Message result = defaultOutput.receive(0); @@ -96,7 +94,7 @@ public class RouterParserTests { context.start(); MessageChannel input = (MessageChannel) context.getBean("inputForAbstractMessageRouterImplementation"); PollableChannel output = (PollableChannel) context.getBean("output3"); - input.send(new StringMessage("test-implementation")); + input.send(new GenericMessage("test-implementation")); Message result = output.receive(0); assertNotNull(result); assertEquals("test-implementation", result.getPayload()); @@ -109,7 +107,7 @@ public class RouterParserTests { context.start(); MessageChannel input = (MessageChannel) context.getBean("inputForAnnotatedRouter"); PollableChannel output = (PollableChannel) context.getBean("output4"); - input.send(new StringMessage("test-annotation")); + input.send(new GenericMessage("test-annotation")); Message result = output.receive(0); assertNotNull(result); assertEquals("test-annotation", result.getPayload()); @@ -130,7 +128,7 @@ public class RouterParserTests { "routerParserTests.xml", this.getClass()); context.start(); MessageChannel input = (MessageChannel) context.getBean("ignoreChannelNameResolutionFailuresInput"); - input.send(new StringMessage("channelThatDoesNotExist")); + input.send(new GenericMessage("channelThatDoesNotExist")); } @Test @@ -165,7 +163,7 @@ public class RouterParserTests { PollableChannel out1 = context.getBean("sequenceOut1", PollableChannel.class); PollableChannel out2 = context.getBean("sequenceOut2", PollableChannel.class); PollableChannel out3 = context.getBean("sequenceOut3", PollableChannel.class); - Message originalMessage = new StringMessage("test"); + Message originalMessage = new GenericMessage("test"); input.send(originalMessage); Message message1 = out1.receive(0); Message message2 = out2.receive(0); @@ -189,7 +187,7 @@ public class RouterParserTests { DirectChannel inputChannel = context.getBean("inputChannel", DirectChannel.class); SubscribableChannel errorChannel = context.getBean("errorChannel", SubscribableChannel.class); errorChannel.subscribe(handler); - inputChannel.send(new StringMessage("fail")); + inputChannel.send(new GenericMessage("fail")); verify(handler, times(1)).handleMessage(Mockito.any(Message.class)); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/router/config/SplitterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/router/config/SplitterParserTests.java index 5c142fa6af..9ae8f25edd 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/router/config/SplitterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/router/config/SplitterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,9 +23,9 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -39,7 +39,7 @@ public class SplitterParserTests { context.start(); MessageChannel input = (MessageChannel) context.getBean("splitterAdapterWithRefAndMethodInput"); PollableChannel output = (PollableChannel) context.getBean("output"); - input.send(new StringMessage("this.is.a.test")); + input.send(new GenericMessage("this.is.a.test")); Message result1 = output.receive(1000); assertEquals("this", result1.getPayload()); Message result2 = output.receive(1000); @@ -58,7 +58,7 @@ public class SplitterParserTests { context.start(); MessageChannel input = (MessageChannel) context.getBean("splitterAdapterWithRefOnlyInput"); PollableChannel output = (PollableChannel) context.getBean("output"); - input.send(new StringMessage("this.is.a.test")); + input.send(new GenericMessage("this.is.a.test")); Message result1 = output.receive(1000); assertEquals("this", result1.getPayload()); Message result2 = output.receive(1000); @@ -77,7 +77,7 @@ public class SplitterParserTests { context.start(); MessageChannel input = (MessageChannel) context.getBean("splitterImplementationInput"); PollableChannel output = (PollableChannel) context.getBean("output"); - input.send(new StringMessage("this.is.a.test")); + input.send(new GenericMessage("this.is.a.test")); Message result1 = output.receive(1000); assertEquals("this", result1.getPayload()); Message result2 = output.receive(1000); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/selector/MessageSelectorChainTests.java b/spring-integration-core/src/test/java/org/springframework/integration/selector/MessageSelectorChainTests.java index d229e845d0..2210d0413d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/selector/MessageSelectorChainTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/selector/MessageSelectorChainTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -22,15 +22,15 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher */ public class MessageSelectorChainTests { - private final Message message = new StringMessage("test"); + private final Message message = new GenericMessage("test"); @Test diff --git a/spring-integration-core/src/test/java/org/springframework/integration/splitter/MethodInvokingSplitterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/splitter/MethodInvokingSplitterTests.java index 02e0d8e608..d81d5a1e96 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/splitter/MethodInvokingSplitterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/splitter/MethodInvokingSplitterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,13 +25,13 @@ import java.util.Arrays; import java.util.List; import org.junit.Test; + import org.springframework.integration.Message; import org.springframework.integration.annotation.Header; import org.springframework.integration.annotation.Splitter; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -42,7 +42,7 @@ public class MethodInvokingSplitterTests { @Test public void splitStringToStringArray() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("stringToStringArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -58,7 +58,7 @@ public class MethodInvokingSplitterTests { @Test public void splitStringToStringList() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("stringToStringList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -74,7 +74,7 @@ public class MethodInvokingSplitterTests { @Test public void splitMessageToStringArray() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("messageToStringArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -90,7 +90,7 @@ public class MethodInvokingSplitterTests { @Test public void splitMessageToStringList() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("messageToStringList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -106,7 +106,7 @@ public class MethodInvokingSplitterTests { @Test public void splitMessageToMessageArray() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("messageToMessageArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -122,7 +122,7 @@ public class MethodInvokingSplitterTests { @Test public void splitMessageToMessageList() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("messageToMessageList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -138,7 +138,7 @@ public class MethodInvokingSplitterTests { @Test public void splitStringToMessageArray() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("stringToMessageArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -154,7 +154,7 @@ public class MethodInvokingSplitterTests { @Test public void splitStringToMessageList() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("stringToMessageList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -170,7 +170,7 @@ public class MethodInvokingSplitterTests { @Test public void splitStringToStringArrayConfiguredByMethodName() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean, "stringToStringArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -186,7 +186,7 @@ public class MethodInvokingSplitterTests { @Test public void splitStringToStringListConfiguredByMethodName() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean, "stringToStringList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -202,7 +202,7 @@ public class MethodInvokingSplitterTests { @Test public void splitMessageToStringArrayConfiguredByMethodName() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean, "messageToStringArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -218,7 +218,7 @@ public class MethodInvokingSplitterTests { @Test public void splitMessageToStringListConfiguredByMethodName() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean, "messageToStringList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -234,7 +234,7 @@ public class MethodInvokingSplitterTests { @Test public void splitMessageToMessageArrayConfiguredByMethodName() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean, "messageToMessageArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -250,7 +250,7 @@ public class MethodInvokingSplitterTests { @Test public void splitMessageToMessageListConfiguredByMethodName() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean, "messageToMessageList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -266,7 +266,7 @@ public class MethodInvokingSplitterTests { @Test public void splitStringToMessageArrayConfiguredByMethodName() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean, "stringToMessageArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -282,7 +282,7 @@ public class MethodInvokingSplitterTests { @Test public void splitStringToMessageListConfiguredByMethodName() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean, "stringToMessageList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -321,7 +321,7 @@ public class MethodInvokingSplitterTests { @Test public void headerForObjectReturnValues() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("stringToStringArray"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -341,7 +341,7 @@ public class MethodInvokingSplitterTests { @Test public void headerForMessageReturnValues() throws Exception { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); MethodInvokingSplitter splitter = this.getSplitter("messageToMessageList"); QueueChannel replyChannel = new QueueChannel(); splitter.setOutputChannel(replyChannel); @@ -401,7 +401,7 @@ public class MethodInvokingSplitterTests { @Test public void singleAnnotation() { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); SingleAnnotationTestBean annotatedBean = new SingleAnnotationTestBean(); MethodInvokingSplitter splitter = new MethodInvokingSplitter(annotatedBean); QueueChannel replyChannel = new QueueChannel(); @@ -423,7 +423,7 @@ public class MethodInvokingSplitterTests { @Test public void singlePublicMethod() { - StringMessage message = new StringMessage("foo.bar"); + GenericMessage message = new GenericMessage("foo.bar"); SinglePublicMethodTestBean testBean = new SinglePublicMethodTestBean(); MethodInvokingSplitter splitter = new MethodInvokingSplitter(testBean); QueueChannel replyChannel = new QueueChannel(); @@ -469,9 +469,9 @@ public class MethodInvokingSplitterTests { public Message[] messageToMessageArray(Message input) { String[] strings = input.getPayload().toString().split("\\."); - Message[] messages = new StringMessage[strings.length]; + Message[] messages = new TestStringMessage[strings.length]; for (int i = 0; i < strings.length; i++) { - messages[i] = new StringMessage(strings[i]); + messages[i] = new TestStringMessage(strings[i]); } return messages; } @@ -480,16 +480,16 @@ public class MethodInvokingSplitterTests { String[] strings = input.getPayload().toString().split("\\."); List> messages = new ArrayList>(); for (String s : strings) { - messages.add(new StringMessage(s)); + messages.add(new GenericMessage(s)); } return messages; } public Message[] stringToMessageArray(String input) { String[] strings = input.split("\\."); - Message[] messages = new StringMessage[strings.length]; + Message[] messages = new TestStringMessage[strings.length]; for (int i = 0; i < strings.length; i++) { - messages[i] = new StringMessage(strings[i]); + messages[i] = new TestStringMessage(strings[i]); } return messages; } @@ -498,7 +498,7 @@ public class MethodInvokingSplitterTests { String[] strings = input.split("\\."); List> messages = new ArrayList>(); for (String s : strings) { - messages.add(new StringMessage(s)); + messages.add(new GenericMessage(s)); } return messages; } @@ -567,4 +567,12 @@ public class MethodInvokingSplitterTests { } } + + @SuppressWarnings("serial") + private static class TestStringMessage extends GenericMessage { + + private TestStringMessage(String payload) { + super(payload); + } + } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/store/MessageGroupQueueTests.java b/spring-integration-core/src/test/java/org/springframework/integration/store/MessageGroupQueueTests.java index 9295088f7e..e0b78789cf 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/store/MessageGroupQueueTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/store/MessageGroupQueueTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.integration.store; import static org.junit.Assert.assertEquals; @@ -32,13 +33,13 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; + import org.springframework.integration.Message; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; /** * @author Dave Syer * @since 2.0 - * */ public class MessageGroupQueueTests { @@ -47,7 +48,7 @@ public class MessageGroupQueueTests { @Test public void testPutAndPoll() throws Exception { MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), "FOO"); - queue.put(new StringMessage("foo")); + queue.put(new GenericMessage("foo")); Message result = queue.poll(100, TimeUnit.MILLISECONDS); assertNotNull(result); } @@ -55,7 +56,7 @@ public class MessageGroupQueueTests { @Test public void testSize() throws Exception { MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), "FOO"); - queue.put(new StringMessage("foo")); + queue.put(new GenericMessage("foo")); assertEquals(1, queue.size()); queue.poll(100, TimeUnit.MILLISECONDS); assertEquals(0, queue.size()); @@ -65,9 +66,9 @@ public class MessageGroupQueueTests { public void testCapacityAfterExpiry() throws Exception { SimpleMessageStore messageGroupStore = new SimpleMessageStore(); MessageGroupQueue queue = new MessageGroupQueue(messageGroupStore, "FOO", 2); - queue.put(new StringMessage("foo")); + queue.put(new GenericMessage("foo")); assertEquals(1, queue.remainingCapacity()); - queue.put(new StringMessage("bar")); + queue.put(new GenericMessage("bar")); assertEquals(0, queue.remainingCapacity()); Message result = queue.poll(100, TimeUnit.MILLISECONDS); assertNotNull(result); @@ -78,14 +79,14 @@ public class MessageGroupQueueTests { public void testCapacityExceeded() throws Exception { SimpleMessageStore messageGroupStore = new SimpleMessageStore(); MessageGroupQueue queue = new MessageGroupQueue(messageGroupStore, "FOO", 1); - queue.put(new StringMessage("foo")); - assertFalse(queue.offer(new StringMessage("bar"), 100, TimeUnit.MILLISECONDS)); + queue.put(new GenericMessage("foo")); + assertFalse(queue.offer(new GenericMessage("bar"), 100, TimeUnit.MILLISECONDS)); } @Test public void testPutAndTake() throws Exception { MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), "FOO"); - queue.put(new StringMessage("foo")); + queue.put(new GenericMessage("foo")); Message result = queue.take(); assertNotNull(result); } @@ -115,7 +116,7 @@ public class MessageGroupQueueTests { public Boolean call() throws Exception { boolean result = true; for (int j = 0; j < maxPerTask; j++) { - result &= queue.add(new StringMessage("count=" + big + ":" + j)); + result &= queue.add(new GenericMessage("count=" + big + ":" + j)); if (!result) { logger.warn("Failed to add"); } 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 46574a8b03..e45ec51813 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 @@ -21,15 +21,14 @@ import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - /** * @author Dave Syer - * */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) @@ -45,7 +44,7 @@ public class MessageStoreReaperTests { @Test public void testExpiry() throws Exception { - messageStore.addMessageToGroup("FOO", new StringMessage("foo")); + messageStore.addMessageToGroup("FOO", new GenericMessage("foo")); assertEquals(1, messageStore.getMessageGroup("FOO").size()); // wait for expiry... Thread.sleep(200L); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreTests.java b/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreTests.java index 7e73c26370..b35e60de0f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreTests.java @@ -25,8 +25,9 @@ import java.util.Iterator; import java.util.List; import org.junit.Test; + import org.springframework.integration.Message; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; import org.springframework.test.util.ReflectionTestUtils; /** @@ -65,7 +66,7 @@ public class MessageStoreTests { private static class TestMessageStore extends AbstractMessageGroupStore { - MessageGroup testMessages = new SimpleMessageGroup(Arrays.asList(new StringMessage("foo")), "bar"); + MessageGroup testMessages = new SimpleMessageGroup(Arrays.asList(new GenericMessage("foo")), "bar"); private boolean removed = false; @Override diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptorTests.java index 6e8c7e48df..5af5d192f5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -16,14 +16,16 @@ package org.springframework.integration.transformer; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.channel.QueueChannel; -import org.springframework.integration.core.StringMessage; +import org.springframework.integration.core.GenericMessage; /** * @author Jonas Partner @@ -32,7 +34,7 @@ public class MessageTransformingChannelInterceptorTests { private QueueChannel channel; - private StringMessage message; + private GenericMessage message; private TestTransformer transformer; @@ -42,7 +44,7 @@ public class MessageTransformingChannelInterceptorTests { @Before public void setUp() { channel = new QueueChannel(); - message = new StringMessage("test"); + message = new GenericMessage("test"); transformer = new TestTransformer(); channelInterceptor = new MessageTransformingChannelInterceptor(transformer); channel.addInterceptor(channelInterceptor); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/MethodInvokingTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/MethodInvokingTransformerTests.java index 92979f83f2..cadd2252e7 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/MethodInvokingTransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/MethodInvokingTransformerTests.java @@ -30,7 +30,6 @@ import org.springframework.integration.annotation.Header; import org.springframework.integration.annotation.Transformer; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; import org.springframework.integration.handler.MethodInvokingMessageProcessor; /** @@ -43,7 +42,7 @@ public class MethodInvokingTransformerTests { TestBean testBean = new TestBean(); Method testMethod = testBean.getClass().getMethod("exclaim", String.class); MethodInvokingTransformer transformer = new MethodInvokingTransformer(testBean, testMethod); - Message message = new StringMessage("foo"); + Message message = new GenericMessage("foo"); Message result = transformer.transform(message); assertEquals("FOO!", result.getPayload()); } @@ -52,7 +51,7 @@ public class MethodInvokingTransformerTests { public void simplePayloadConfiguredWithMethodName() throws Exception { TestBean testBean = new TestBean(); MethodInvokingTransformer transformer = new MethodInvokingTransformer(testBean, "exclaim"); - Message message = new StringMessage("foo"); + Message message = new GenericMessage("foo"); Message result = transformer.transform(message); assertEquals("FOO!", result.getPayload()); } @@ -208,7 +207,7 @@ public class MethodInvokingTransformerTests { public void nullReturningMethod() { TestBean testBean = new TestBean(); MethodInvokingTransformer transformer = new MethodInvokingTransformer(testBean, "nullReturnValueTest"); - StringMessage message = new StringMessage("test"); + GenericMessage message = new GenericMessage("test"); Message result = transformer.transform(message); assertNull(result); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/ObjectToStringTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/ObjectToStringTransformerTests.java index e7e08f602f..b4016c2adc 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/ObjectToStringTransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/ObjectToStringTransformerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -22,7 +22,6 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.core.GenericMessage; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -32,7 +31,7 @@ public class ObjectToStringTransformerTests { @Test public void stringPayload() { Transformer transformer = new ObjectToStringTransformer(); - Message result = transformer.transform(new StringMessage("foo")); + Message result = transformer.transform(new GenericMessage("foo")); assertEquals("foo", result.getPayload()); } 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 a9948f15ba..c3151eeb5a 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 @@ import org.springframework.core.convert.converter.Converter; import org.springframework.integration.Message; import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageBuilder; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -40,7 +39,7 @@ public class PayloadSerializingTransformerTests { @Test public void serializeString() throws Exception { PayloadSerializingTransformer transformer = new PayloadSerializingTransformer(); - Message result = transformer.transform(new StringMessage("foo")); + Message result = transformer.transform(new GenericMessage("foo")); Object payload = result.getPayload(); assertNotNull(payload); assertTrue(payload instanceof byte[]); 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 301b813ca2..1e62c7f117 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-2008 the original author or authors. + * Copyright 2002-2010 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,6 @@ import org.junit.Test; import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.core.GenericMessage; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -35,7 +34,7 @@ public class PayloadTransformerTests { @Test public void testSuccessfulTransformation() { TestPayloadTransformer transformer = new TestPayloadTransformer(); - Message message = new StringMessage("foo"); + Message message = new GenericMessage("foo"); Message result = transformer.transform(message); assertEquals(3, result.getPayload()); } @@ -43,7 +42,7 @@ public class PayloadTransformerTests { @Test(expected=MessagingException.class) public void testExceptionThrownByTransformer() { TestPayloadTransformer transformer = new TestPayloadTransformer(); - Message message = new StringMessage("bad"); + Message message = new GenericMessage("bad"); transformer.transform(message); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/TransformerContextTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/TransformerContextTests.java index 9aa6271c86..3f8db13845 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/TransformerContextTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/TransformerContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,9 +23,9 @@ import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.core.GenericMessage; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.core.PollableChannel; -import org.springframework.integration.core.StringMessage; /** * @author Mark Fisher @@ -38,7 +38,7 @@ public class TransformerContextTests { "transformerContextTests.xml", this.getClass()); MessageChannel input = (MessageChannel) context.getBean("input"); PollableChannel output = (PollableChannel) context.getBean("output"); - input.send(new StringMessage("foo")); + input.send(new GenericMessage("foo")); Message reply = output.receive(0); assertEquals("FOO", reply.getPayload()); }