use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class ProxyTest method testOfferedIdentifier.
@Test
public void testOfferedIdentifier() {
OfferType offer = control.createMock(OfferType.class);
Identifier id = control.createMock(Identifier.class);
EasyMock.expect(offer.getIdentifier()).andReturn(id).anyTimes();
control.replay();
Proxy proxy = new Proxy(rme);
assertNull(proxy.getOfferedIdentifier());
proxy.setOfferedIdentifier(offer);
assertSame(id, proxy.getOfferedIdentifier());
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class ProxyTest method testTerminate.
@Test
public void testTerminate() throws NoSuchMethodException, RMException {
Method m = Proxy.class.getDeclaredMethod("invoke", new Class[] { OperationInfo.class, ProtocolVariation.class, Object[].class, Map.class });
Proxy proxy = EasyMock.createMockBuilder(Proxy.class).addMockedMethod(m).createMock(control);
proxy.setReliableEndpoint(rme);
Endpoint endpoint = control.createMock(Endpoint.class);
EasyMock.expect(rme.getEndpoint(ProtocolVariation.RM10WSA200408)).andReturn(endpoint).anyTimes();
EndpointInfo epi = control.createMock(EndpointInfo.class);
EasyMock.expect(endpoint.getEndpointInfo()).andReturn(epi).anyTimes();
ServiceInfo si = control.createMock(ServiceInfo.class);
EasyMock.expect(epi.getService()).andReturn(si).anyTimes();
InterfaceInfo ii = control.createMock(InterfaceInfo.class);
EasyMock.expect(si.getInterface()).andReturn(ii).anyTimes();
OperationInfo oi = control.createMock(OperationInfo.class);
EasyMock.expect(ii.getOperation(RM10Constants.TERMINATE_SEQUENCE_QNAME)).andReturn(oi).anyTimes();
SourceSequence ss = control.createMock(SourceSequence.class);
Identifier id = control.createMock(Identifier.class);
EasyMock.expect(ss.getIdentifier()).andReturn(id).anyTimes();
EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
expectInvoke(proxy, oi, null);
control.replay();
proxy.terminate(ss);
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class RMManagerTest method testGetExistingSequence.
@Test
public void testGetExistingSequence() throws NoSuchMethodException, SequenceFault, RMException {
Method m = RMManager.class.getDeclaredMethod("getSource", new Class[] { Message.class });
manager = control.createMock(RMManager.class, new Method[] { m });
Message message = control.createMock(Message.class);
Identifier inSid = control.createMock(Identifier.class);
Source source = control.createMock(Source.class);
EasyMock.expect(manager.getSource(message)).andReturn(source);
SourceSequence sseq = control.createMock(SourceSequence.class);
EasyMock.expect(source.getCurrent(inSid)).andReturn(sseq);
control.replay();
assertSame(sseq, manager.getSequence(inSid, message, null));
control.verify();
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class ServantTest method testInvokeForCloseSequence.
@Test
public void testInvokeForCloseSequence() {
RMEndpoint rme = control.createMock(RMEndpoint.class);
RMManager manager = new RMManager();
Destination destination = new Destination(rme);
Source source = new Source(rme);
DestinationSequence seq = control.createMock(DestinationSequence.class);
org.apache.cxf.ws.rm.v200702.Identifier sid = new org.apache.cxf.ws.rm.v200702.Identifier();
sid.setValue("123");
EasyMock.expect(seq.getIdentifier()).andReturn(sid).anyTimes();
EasyMock.expect(rme.getDestination()).andReturn(destination).anyTimes();
EasyMock.expect(rme.getManager()).andReturn(manager).anyTimes();
EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
Message message = createTestCloseSequenceMessage(sid.getValue());
BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
OperationInfo oi = control.createMock(OperationInfo.class);
EasyMock.expect(boi.getOperationInfo()).andReturn(oi).anyTimes();
EasyMock.expect(oi.getName()).andReturn(RM11Constants.INSTANCE.getCloseSequenceOperationName()).anyTimes();
message.getExchange().put(BindingOperationInfo.class, boi);
control.replay();
TestServant servant = new TestServant(rme);
servant.invoke(message.getExchange(), message.getContent(List.class).get(0));
assertTrue(servant.called);
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class SourceSequenceTest method testEqualsAndHashCode.
@Test
public void testEqualsAndHashCode() {
SourceSequence seq = new SourceSequence(id, ProtocolVariation.RM10WSA200408);
SourceSequence otherSeq = null;
assertTrue(!seq.equals(otherSeq));
otherSeq = new SourceSequence(id, ProtocolVariation.RM10WSA200408);
assertEquals(seq, otherSeq);
assertEquals(seq.hashCode(), otherSeq.hashCode());
Identifier otherId = factory.createIdentifier();
otherId.setValue("otherSeq");
otherSeq = new SourceSequence(otherId, ProtocolVariation.RM10WSA200408);
assertTrue(!seq.equals(otherSeq));
assertTrue(seq.hashCode() != otherSeq.hashCode());
}
Aggregations