01: package org.objectweb.celtix.bus.jaxws;
02:
03: import javax.xml.namespace.QName;
04: import javax.xml.ws.handler.HandlerResolver;
05:
06: import junit.framework.TestCase;
07:
08: import org.easymock.EasyMock;
09: import org.objectweb.celtix.Bus;
10: import org.objectweb.celtix.bus.busimpl.CeltixBus;
11: import org.objectweb.celtix.configuration.Configuration;
12: import org.objectweb.celtix.workqueue.WorkQueueManager;
13:
14: public class ServiceImplTest extends TestCase {
15:
16: public void testHandlerResolverAttribute() {
17: QName sn = new QName(
18: "http://objectweb.org/hello_world_soap_http", "Greeter");
19: Bus bus = org.easymock.classextension.EasyMock
20: .createMock(CeltixBus.class);
21: Configuration bc = EasyMock.createMock(Configuration.class);
22: bus.getConfiguration();
23: org.easymock.classextension.EasyMock.expectLastCall()
24: .andReturn(bc);
25: bc.getChild(ServiceImpl.PORT_CONFIGURATION_URI, sn.toString());
26: EasyMock.expectLastCall().andReturn(null);
27: WorkQueueManager wm = EasyMock
28: .createMock(WorkQueueManager.class);
29: bus.getWorkQueueManager();
30: EasyMock.expectLastCall().andReturn(wm);
31: wm.getAutomaticWorkQueue();
32: EasyMock.expectLastCall().andReturn(null);
33:
34: org.easymock.classextension.EasyMock.replay(bus);
35: EasyMock.replay(bc);
36: EasyMock.replay(wm);
37:
38: ServiceImpl s = new ServiceImpl(bus, null, sn, null);
39:
40: HandlerResolver defaultResolver = s.getHandlerResolver();
41: assertNotNull(defaultResolver);
42:
43: HandlerResolver hr = EasyMock.createMock(HandlerResolver.class);
44:
45: s.setHandlerResolver(hr);
46: assertSame(hr, s.getHandlerResolver());
47: assertTrue(defaultResolver != hr);
48:
49: }
50: }
|