use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class DestinationTest method testAcknowledgeAlreadyAcknowledgedMessage.
@Test
public void testAcknowledgeAlreadyAcknowledgedMessage() throws SequenceFault, RMException, NoSuchMethodException, IOException {
Method m1 = Destination.class.getDeclaredMethod("getSequence", new Class[] { Identifier.class });
destination = EasyMock.createMockBuilder(Destination.class).addMockedMethod(m1).createMock(control);
Message message = setupMessage();
RMProperties rmps = control.createMock(RMProperties.class);
EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_INBOUND)).andReturn(rmps);
SequenceType st = control.createMock(SequenceType.class);
EasyMock.expect(rmps.getSequence()).andReturn(st);
Identifier id = control.createMock(Identifier.class);
EasyMock.expect(st.getIdentifier()).andReturn(id);
DestinationSequence ds = control.createMock(DestinationSequence.class);
EasyMock.expect(destination.getSequence(id)).andReturn(ds);
long nr = 10;
EasyMock.expect(st.getMessageNumber()).andReturn(nr);
ds.applyDeliveryAssurance(nr, message);
EasyMock.expectLastCall().andReturn(false);
InterceptorChain ic = control.createMock(InterceptorChain.class);
EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
control.replay();
destination.acknowledge(message);
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class DestinationTest method testAcknowledgeUnknownSequence.
@Test
public void testAcknowledgeUnknownSequence() throws RMException, IOException {
Message message = setupMessage();
RMProperties rmps = control.createMock(RMProperties.class);
EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_INBOUND)).andReturn(rmps);
EasyMock.expect(RMContextUtils.getProtocolVariation(message)).andReturn(ProtocolVariation.RM10WSA200408);
SequenceType st = control.createMock(SequenceType.class);
EasyMock.expect(rmps.getSequence()).andReturn(st);
Identifier id = control.createMock(Identifier.class);
EasyMock.expect(st.getIdentifier()).andReturn(id).times(2);
String sid = "sid";
EasyMock.expect(id.getValue()).andReturn(sid);
control.replay();
try {
destination.acknowledge(message);
fail("Expected SequenceFault not thrown.");
} catch (SequenceFault ex) {
assertEquals(RM10Constants.UNKNOWN_SEQUENCE_FAULT_QNAME, ex.getFaultCode());
}
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class DestinationTest method testGetSequence.
@Test
public void testGetSequence() {
Identifier id = control.createMock(Identifier.class);
String sid = "s1";
EasyMock.expect(id.getValue()).andReturn(sid);
control.replay();
assertNull(destination.getSequence(id));
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class DestinationSequenceTest method testEqualsAndHashCode.
@Test
public void testEqualsAndHashCode() {
DestinationSequence seq = new DestinationSequence(id, ref, destination, ProtocolVariation.RM10WSA200408);
DestinationSequence otherSeq = null;
assertFalse(seq.equals(otherSeq));
otherSeq = new DestinationSequence(id, ref, destination, ProtocolVariation.RM10WSA200408);
assertEquals(seq, otherSeq);
assertEquals(seq.hashCode(), otherSeq.hashCode());
Identifier otherId = factory.createIdentifier();
otherId.setValue("otherSeq");
otherSeq = new DestinationSequence(otherId, ref, destination, ProtocolVariation.RM10WSA200408);
assertFalse(seq.equals(otherSeq));
assertNotEquals(seq.hashCode(), otherSeq.hashCode());
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class ManagedRMManagerTest method createTestSourceSequence.
private SourceSequence createTestSourceSequence(Source source, String sid, EndpointReferenceType to, ProtocolVariation protocol, long[] acked) {
Identifier identifier = RMUtils.getWSRMFactory().createIdentifier();
identifier.setValue(sid);
SourceSequence ss = new SourceSequence(identifier, protocol);
ss.setSource(source);
ss.setTarget(to);
List<SequenceAcknowledgement.AcknowledgementRange> ranges = ss.getAcknowledgement().getAcknowledgementRange();
for (int i = 0; i < acked.length; i += 2) {
ranges.add(createAcknowledgementRange(acked[i], acked[i + 1]));
}
return ss;
}
Aggregations