Search in sources :

Example 81 with Identifier

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

Example 82 with Identifier

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

the class AbstractEndpointTest method testGenerateSequenceIdentifier.

@Test
public void testGenerateSequenceIdentifier() {
    RMManager mgr = control.createMock(RMManager.class);
    EasyMock.expect(rme.getManager()).andReturn(mgr);
    SequenceIdentifierGenerator generator = control.createMock(SequenceIdentifierGenerator.class);
    EasyMock.expect(mgr.getIdGenerator()).andReturn(generator);
    Identifier id = control.createMock(Identifier.class);
    EasyMock.expect(generator.generateSequenceIdentifier()).andReturn(id);
    control.replay();
    AbstractEndpoint tested = new AbstractEndpoint(rme);
    assertSame(id, tested.generateSequenceIdentifier());
    control.verify();
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Test(org.junit.Test)

Example 83 with Identifier

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

the class AbstractSequenceTest method testIdentifierEquals.

@Test
public void testIdentifierEquals() {
    Identifier id1 = null;
    Identifier id2 = null;
    assertTrue(AbstractSequence.identifierEquals(id1, id2));
    ObjectFactory factory = new ObjectFactory();
    id1 = factory.createIdentifier();
    id1.setValue("seq1");
    assertFalse(AbstractSequence.identifierEquals(id1, id2));
    id2 = factory.createIdentifier();
    id2.setValue("seq2");
    assertFalse(AbstractSequence.identifierEquals(id1, id2));
    id2.setValue("seq1");
    assertTrue(AbstractSequence.identifierEquals(id1, id2));
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) ObjectFactory(org.apache.cxf.ws.rm.v200702.ObjectFactory) Test(org.junit.Test)

Example 84 with Identifier

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

the class ServantTest method verifyTerminateSequenceDefault.

private void verifyTerminateSequenceDefault(Servant servant, RMManager manager, String sidstr, ProtocolVariation protocol) throws SequenceFault {
    DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
    AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
    dp.setAcksPolicy(ap);
    manager.setDestinationPolicy(dp);
    Message message = createTestTerminateSequenceMessage(sidstr, protocol);
    Object tsr = servant.terminateSequence(message);
    if (ProtocolVariation.RM10WSA200408.getWSRMNamespace().equals(protocol.getWSRMNamespace())) {
        // rm 1.0
        assertNull(tsr);
    } else {
        // rm 1.1
        assertTrue(tsr instanceof TerminateSequenceResponseType);
        org.apache.cxf.ws.rm.v200702.Identifier sid = ((TerminateSequenceResponseType) tsr).getIdentifier();
        assertNotNull(sid);
        assertEquals(sidstr, sid.getValue());
    }
}
Also used : TerminateSequenceResponseType(org.apache.cxf.ws.rm.v200702.TerminateSequenceResponseType) AcksPolicyType(org.apache.cxf.ws.rm.manager.AcksPolicyType) Message(org.apache.cxf.message.Message) DestinationPolicyType(org.apache.cxf.ws.rm.manager.DestinationPolicyType)

Example 85 with Identifier

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

the class RetransmissionQueueImplTest method setUpSequence.

private SourceSequence setUpSequence(String sid, Long[] messageNumbers, boolean[] isAcked) {
    SourceSequence sequence = createMock(SourceSequence.class);
    Identifier id = createMock(Identifier.class);
    sequence.getIdentifier();
    EasyMock.expectLastCall().andReturn(id).anyTimes();
    id.getValue();
    EasyMock.expectLastCall().andReturn(sid).anyTimes();
    identifiers.add(id);
    Source source = createMock(Source.class);
    sequence.getSource();
    EasyMock.expectLastCall().andReturn(source).anyTimes();
    source.getReliableEndpoint();
    EasyMock.expectLastCall().andReturn(endpoint).anyTimes();
    boolean includesAcked = false;
    for (int i = 0; isAcked != null && i < isAcked.length; i++) {
        sequence.isAcknowledged(messageNumbers[i]);
        EasyMock.expectLastCall().andReturn(isAcked[i]);
        if (isAcked[i]) {
            includesAcked = true;
        }
    }
    if (includesAcked) {
        RMStore store = createMock(RMStore.class);
        manager.getStore();
        EasyMock.expectLastCall().andReturn(store);
    }
    return sequence;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) SourceSequence(org.apache.cxf.ws.rm.SourceSequence) Source(org.apache.cxf.ws.rm.Source) RMEndpoint(org.apache.cxf.ws.rm.RMEndpoint)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 Test (org.junit.Test)43 Message (org.apache.cxf.message.Message)13 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)13 SequenceAcknowledgement (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)13 SourceSequence (org.apache.cxf.ws.rm.SourceSequence)11 Connection (java.sql.Connection)10 ArrayList (java.util.ArrayList)9 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)9 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)9 SQLException (java.sql.SQLException)8 DestinationSequence (org.apache.cxf.ws.rm.DestinationSequence)8 Date (java.util.Date)7 Method (java.lang.reflect.Method)6 Endpoint (org.apache.cxf.endpoint.Endpoint)6 AttributedURIType (org.apache.cxf.ws.addressing.AttributedURIType)6 ProtocolVariation (org.apache.cxf.ws.rm.ProtocolVariation)6 RMStore (org.apache.cxf.ws.rm.persistence.RMStore)6 SequenceType (org.apache.cxf.ws.rm.v200702.SequenceType)6 PreparedStatement (java.sql.PreparedStatement)5