INT-1362-2: Reset RequestContextHolder in Tests

JIRA: https://jira.springsource.org/browse/INT-1362
This commit is contained in:
Artem Bilan
2013-10-30 13:46:19 +02:00
committed by Gary Russell
parent 2bf8196353
commit 653df623b2
8 changed files with 63 additions and 12 deletions

View File

@@ -16,9 +16,9 @@
package org.springframework.integration.groovy.config;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import groovy.lang.GroovyObject;
@@ -30,6 +30,7 @@ import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanCreationNotAllowedException;
import org.springframework.beans.factory.BeanIsAbstractException;
@@ -115,6 +116,8 @@ public class GroovyControlBusTests {
Message<?> message = MessageBuilder.withPayload("def result = requestScopedService.convert('testString')").build();
this.input.send(message);
assertEquals("cat", output.receive(0).getPayload());
RequestContextHolder.resetRequestAttributes();
}
@Test //INT-2567
@@ -180,7 +183,7 @@ public class GroovyControlBusTests {
private static class MockRequestAttributes implements RequestAttributes {
private Map<String, Object> fakeRequest = new HashMap<String, Object>();
private final Map<String, Object> fakeRequest = new HashMap<String, Object>();
public Object getAttribute(String name, int scope) {
return fakeRequest.get(name);