Search in sources :

Example 36 with Identifier

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);
}
Also used : InterceptorChain(org.apache.cxf.interceptor.InterceptorChain) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Message(org.apache.cxf.message.Message) Method(java.lang.reflect.Method) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) Test(org.junit.Test)

Example 37 with Identifier

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());
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Message(org.apache.cxf.message.Message) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) Test(org.junit.Test)

Example 38 with Identifier

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));
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Test(org.junit.Test)

Example 39 with Identifier

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());
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Test(org.junit.Test)

Example 40 with Identifier

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;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Endpoint(org.apache.cxf.endpoint.Endpoint)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 Test (org.junit.Test)43 Message (org.apache.cxf.message.Message)11 SourceSequence (org.apache.cxf.ws.rm.SourceSequence)11 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)11 SequenceAcknowledgement (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)11 Connection (java.sql.Connection)9 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)8 SQLException (java.sql.SQLException)7 ArrayList (java.util.ArrayList)7 Date (java.util.Date)7 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)7 DestinationSequence (org.apache.cxf.ws.rm.DestinationSequence)7 Method (java.lang.reflect.Method)6 AttributedURIType (org.apache.cxf.ws.addressing.AttributedURIType)6 RMStore (org.apache.cxf.ws.rm.persistence.RMStore)6 SequenceType (org.apache.cxf.ws.rm.v200702.SequenceType)6 SoapBinding (org.apache.cxf.binding.soap.SoapBinding)5 ProtocolVariation (org.apache.cxf.ws.rm.ProtocolVariation)5 Identifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier)5