Search in sources :

Example 76 with Identifier

use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.

the class SourceSequenceTest method testCheckOfferingSequenceClosed.

@Test
public void testCheckOfferingSequenceClosed() {
    SourceSequence seq = null;
    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(new Long(1)).anyTimes();
    EasyMock.expect(did.getValue()).andReturn("dseq").anyTimes();
    control.replay();
    seq = new SourceSequence(id, null, did, ProtocolVariation.RM10WSA200408);
    seq.setSource(source);
    seq.nextMessageNumber(did, 1, false);
    assertTrue(seq.isLastMessage());
    control.verify();
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Test(org.junit.Test)

Example 77 with Identifier

use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.

the class SourceSequenceTest method testConstructors.

@Test
public void testConstructors() {
    Identifier otherId = factory.createIdentifier();
    otherId.setValue("otherSeq");
    SourceSequence seq = null;
    seq = new SourceSequence(id, ProtocolVariation.RM10WSA200408);
    assertEquals(id, seq.getIdentifier());
    assertTrue(!seq.isLastMessage());
    assertTrue(!seq.isExpired());
    assertEquals(0, seq.getCurrentMessageNr());
    assertNotNull(seq.getAcknowledgement());
    assertEquals(0, seq.getAcknowledgement().getAcknowledgementRange().size());
    assertTrue(!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());
    assertTrue(!seq.isLastMessage());
    assertTrue(!seq.isExpired());
    assertEquals(0, seq.getCurrentMessageNr());
    assertNotNull(seq.getAcknowledgement());
    assertEquals(0, seq.getAcknowledgement().getAcknowledgementRange().size());
    assertTrue(!seq.allAcknowledged());
    assertFalse(seq.offeredBy(otherId));
    seq = new SourceSequence(id, expiry, otherId, ProtocolVariation.RM10WSA200408);
    assertTrue(seq.offeredBy(otherId));
    assertFalse(seq.offeredBy(id));
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Date(java.util.Date) Test(org.junit.Test)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 Test (org.junit.Test)40 ArrayList (java.util.ArrayList)11 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 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 PreparedStatement (java.sql.PreparedStatement)4