INT-1072: Resolved ConcurrentModificationException in MessageHistory and improved equality testing

This commit is contained in:
Iwein Fuld
2010-04-09 08:47:41 +00:00
parent 892eb1ad5c
commit d0caad8f4d
4 changed files with 39 additions and 63 deletions

View File

@@ -60,7 +60,7 @@ public class MethodInvokingMessageGroupProcessorTests {
return result;
}
public String know() {
public String know(List<Integer> flags) {
return "I'm not the one ";
}
}

View File

@@ -15,13 +15,13 @@
*/
package org.springframework.integration.history;
import org.junit.Test;
import org.springframework.integration.support.ComponentMetadata;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.springframework.integration.support.ComponentMetadata;
/**
* @author Oleg Zhurakousky
* @since 2.0
@@ -29,6 +29,7 @@ import org.springframework.integration.support.ComponentMetadata;
public class MessageHistoryTests {
private long times = 1000;
private ExecutorService executor = Executors.newCachedThreadPool();
@Test
public void testConcurrentModificationsOnObjectMethods() throws Exception{
final MessageHistory history = new MessageHistory();

View File

@@ -16,7 +16,9 @@
package org.springframework.integration.json;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.io.IOException;
@@ -50,8 +52,8 @@ public class InboundJsonMessageMapperTests {
String jsonMessage = "{\"headers\":{\"$timestamp\":1,\"$id\":\"" + id + "\"},\"payload\":\"myPayloadStuff\"}";
Message<String> expected = MessageBuilder.withPayload("myPayloadStuff").setHeader(MessageHeaders.TIMESTAMP, new Long(1)).setHeader(MessageHeaders.ID, id).build();
InboundJsonMessageMapper mapper = new InboundJsonMessageMapper(String.class);
Message<?> result = mapper.toMessage(jsonMessage);
assertEquals(expected, result);
Message<String> result = (Message<String>) mapper.toMessage(jsonMessage);
assertThat(result, is(expected));
}
@Test