use of org.orcid.jaxb.model.record.summary_rc1.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.orcid.jaxb.model.record.summary_rc1.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;
assertFalse(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);
assertFalse(seq.equals(otherSeq));
assertTrue(seq.hashCode() != otherSeq.hashCode());
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class SourceSequenceTest method testConstructors.
@Test
public void testConstructors() {
Identifier otherId = factory.createIdentifier();
otherId.setValue("otherSeq");
SourceSequence seq = new SourceSequence(id, ProtocolVariation.RM10WSA200408);
assertEquals(id, seq.getIdentifier());
assertFalse(seq.isLastMessage());
assertFalse(seq.isExpired());
assertEquals(0, seq.getCurrentMessageNr());
assertNotNull(seq.getAcknowledgement());
assertEquals(0, seq.getAcknowledgement().getAcknowledgementRange().size());
assertFalse(seq.allAcknowledged());
assertFalse(seq.offeredBy(otherId));
Date expiry = new Date(System.currentTimeMillis() + 3600 * 1000);
seq = new SourceSequence(id, expiry, null, ProtocolVariation.RM10WSA200408);
assertEquals(id, seq.getIdentifier());
assertFalse(seq.isLastMessage());
assertFalse(seq.isExpired());
assertEquals(0, seq.getCurrentMessageNr());
assertNotNull(seq.getAcknowledgement());
assertEquals(0, seq.getAcknowledgement().getAcknowledgementRange().size());
assertFalse(seq.allAcknowledged());
assertFalse(seq.offeredBy(otherId));
seq = new SourceSequence(id, expiry, otherId, ProtocolVariation.RM10WSA200408);
assertTrue(seq.offeredBy(otherId));
assertFalse(seq.offeredBy(id));
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class SourceSequenceTest method testCheckOfferingSequenceClosed.
@Test
public void testCheckOfferingSequenceClosed() {
setUpSource();
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).anyTimes();
Destination destination = control.createMock(Destination.class);
EasyMock.expect(rme.getDestination()).andReturn(destination).anyTimes();
DestinationSequence dseq = control.createMock(DestinationSequence.class);
Identifier did = control.createMock(Identifier.class);
EasyMock.expect(destination.getSequence(did)).andReturn(dseq).anyTimes();
EasyMock.expect(dseq.getLastMessageNumber()).andReturn(Long.valueOf(1)).anyTimes();
EasyMock.expect(did.getValue()).andReturn("dseq").anyTimes();
control.replay();
SourceSequence seq = new SourceSequence(id, null, did, ProtocolVariation.RM10WSA200408);
seq.setSource(source);
seq.nextMessageNumber(did, 1, false);
assertTrue(seq.isLastMessage());
control.verify();
}
use of org.orcid.jaxb.model.record.summary_rc1.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();
}
Aggregations