01: package org.objectweb.celtix.bus.ws.rm;
02:
03: import junit.framework.TestCase;
04:
05: import org.objectweb.celtix.configuration.Configuration;
06: import org.objectweb.celtix.ws.rm.Identifier;
07: import org.objectweb.celtix.ws.rm.policy.RMAssertionType;
08:
09: import static org.easymock.EasyMock.expectLastCall;
10: import static org.easymock.classextension.EasyMock.createMock;
11: import static org.easymock.classextension.EasyMock.replay;
12: import static org.easymock.classextension.EasyMock.reset;
13: import static org.easymock.classextension.EasyMock.verify;
14:
15: public class RMEndpointTest extends TestCase {
16:
17: private RMHandler handler;
18:
19: public void setUp() {
20: handler = createMock(RMHandler.class);
21: }
22:
23: public void testRMEndpointConstructor() {
24: RMEndpoint e = new RMEndpoint(handler);
25: assertSame(handler, e.getHandler());
26: }
27:
28: public void generateSequenceIndentifier() {
29: RMEndpoint e = new RMEndpoint(handler);
30: Identifier sid1 = e.generateSequenceIdentifier();
31: assertNotNull(sid1.getValue());
32: Identifier sid2 = e.generateSequenceIdentifier();
33: assertTrue(!sid1.equals(sid2));
34: }
35:
36: public void testGetPolicies() {
37: Configuration c = createMock(Configuration.class);
38: reset(handler);
39: handler.getConfiguration();
40: expectLastCall().andReturn(c);
41: c.getObject("policies");
42: expectLastCall().andReturn(null);
43: replay(handler);
44: replay(c);
45:
46: RMEndpoint e = new RMEndpoint(handler);
47: assertNull(e.getPolicies());
48: verify(handler);
49: verify(c);
50: }
51:
52: public void testGetRMAssertion() {
53: Configuration c = createMock(Configuration.class);
54: reset(handler);
55: handler.getConfiguration();
56: expectLastCall().andReturn(c);
57: c.getObject(RMAssertionType.class, "rmAssertion");
58: expectLastCall().andReturn(null);
59: replay(handler);
60: replay(c);
61:
62: RMEndpoint e = new RMEndpoint(handler);
63: RMAssertionType rma = e.getRMAssertion();
64: assertNotNull(rma);
65:
66: verify(handler);
67: verify(c);
68: }
69: }
|