01: package org.objectweb.celtix.bus.ws.rm;
02:
03: import java.util.ArrayList;
04:
05: import javax.xml.ws.handler.Handler;
06:
07: import junit.framework.TestCase;
08:
09: import org.easymock.classextension.EasyMock;
10: import org.objectweb.celtix.bindings.AbstractBindingBase;
11: import org.objectweb.celtix.bus.handlers.HandlerChainInvoker;
12: import org.objectweb.celtix.context.ObjectMessageContext;
13: import org.objectweb.celtix.context.ObjectMessageContextImpl;
14: import org.objectweb.celtix.transports.Transport;
15: import org.objectweb.celtix.ws.rm.Identifier;
16: import org.objectweb.celtix.ws.rm.TerminateSequenceType;
17:
18: public class TerminateSequenceRequestTest extends TestCase {
19:
20: public void testConstruction() {
21:
22: ObjectMessageContext objectCtx = new ObjectMessageContextImpl();
23: RMSource source = EasyMock.createMock(RMSource.class);
24: AbstractBindingBase binding = EasyMock
25: .createMock(AbstractBindingBase.class);
26: Transport transport = EasyMock.createMock(Transport.class);
27: HandlerChainInvoker hci = new HandlerChainInvoker(
28: new ArrayList<Handler>());
29:
30: Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
31: sid.setValue("TerminatedSequence");
32: SourceSequence seq = new SourceSequence(sid, null, null);
33:
34: binding.createObjectContext();
35: EasyMock.expectLastCall().andReturn(objectCtx);
36: binding.createHandlerInvoker();
37: EasyMock.expectLastCall().andReturn(hci);
38:
39: EasyMock.replay(source);
40: EasyMock.replay(binding);
41:
42: TerminateSequenceRequest req = new TerminateSequenceRequest(
43: binding, transport, seq);
44: assertNotNull(req);
45:
46: assertNotNull(TerminateSequenceRequest
47: .createDataBindingCallback());
48:
49: Object[] params = req.getObjectMessageContext()
50: .getMessageObjects();
51: assertEquals(1, params.length);
52: TerminateSequenceType ts = (TerminateSequenceType) params[0];
53:
54: assertEquals(sid, ts.getIdentifier());
55:
56: EasyMock.verify(source);
57: EasyMock.verify(binding);
58: }
59: }
|