01: package org.objectweb.celtix.bus.jaxws;
02:
03: import java.util.Map;
04:
05: import javax.xml.ws.Binding;
06: import javax.xml.ws.handler.MessageContext;
07:
08: import junit.framework.TestCase;
09:
10: import org.easymock.IMocksControl;
11: import org.easymock.classextension.EasyMock;
12: import org.objectweb.celtix.context.ObjectMessageContext;
13: import org.objectweb.celtix.context.ObjectMessageContextImpl;
14:
15: public class BindingProviderImplTest extends TestCase {
16:
17: private ObjectMessageContext objectCtx;
18: private BindingProviderImpl bindingProviderImpl;
19: private Binding binding;
20: private IMocksControl control;
21:
22: public void setUp() throws Exception {
23: objectCtx = new ObjectMessageContextImpl();
24: bindingProviderImpl = new BindingProviderImpl();
25: control = EasyMock.createNiceControl();
26: binding = control.createMock(Binding.class);
27: }
28:
29: public void testResponseContext() {
30: objectCtx.put("foo", new String("fooObject"));
31: objectCtx.setScope("foo", MessageContext.Scope.APPLICATION);
32: bindingProviderImpl.populateResponseContext(objectCtx);
33: Map<String, Object> map = bindingProviderImpl
34: .getResponseContext();
35: String str = (String) map.get("foo");
36: assertTrue(str.equals("fooObject"));
37: }
38:
39: public void testBinding() {
40: bindingProviderImpl.setBinding(binding);
41: Binding thebinding = bindingProviderImpl.getBinding();
42: assertEquals("Objects should be equal", binding, thebinding);
43: }
44:
45: public void testRequestContext() {
46: Map<String, Object> map = bindingProviderImpl
47: .getRequestContext();
48: assertNotNull(map);
49: }
50:
51: }
|