Package org.apache.cxf.ws.rm

Examples of org.apache.cxf.ws.rm.SourceSequence


        store.removeDestinationSequence(sid1);
    }
   
    @Test
    public void testUpdateSourceSequence() throws SQLException {
        SourceSequence seq = control.createMock(SourceSequence.class);
        Identifier sid1 = new Identifier();
        sid1.setValue("sequence1");
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
        EasyMock.expect(seq.getExpires()).andReturn(null);
        EasyMock.expect(seq.getOfferingSequenceIdentifier()).andReturn(null);
        EasyMock.expect(seq.getEndpointIdentifier()).andReturn(CLIENT_ENDPOINT_ID);
       
        control.replay();
        store.createSourceSequence(seq);  
        control.verify();       
       
        control.reset();
        EasyMock.expect(seq.getCurrentMessageNr()).andReturn(ONE);
        EasyMock.expect(seq.isLastMessage()).andReturn(false);
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);  
       
        control.replay();
        store.beginTransaction();
        store.updateSourceSequence(seq);
        store.abort();
       
        control.reset();
        EasyMock.expect(seq.getCurrentMessageNr()).andReturn(TEN);
        EasyMock.expect(seq.isLastMessage()).andReturn(true)
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
       
        control.replay();
        store.beginTransaction();
        store.updateSourceSequence(seq);
        store.abort();
View Full Code Here


    public void testGetSourceSequence() throws SQLException, IOException {
       
        Identifier sid1 = null;
        Identifier sid2 = null;
       
        SourceSequence seq =
            store.getSourceSequence(new Identifier(), ProtocolVariation.RM10WSA200408);
        assertNull(seq);
       
        try {
            sid1 = setupSourceSequence("sequence1");
View Full Code Here

    @Test
    public void testCreateSequenceStoreOutboundMessage() throws SQLException, IOException {
        Identifier sid1 = null;
        try {
            SourceSequence seq = control.createMock(SourceSequence.class);
            sid1 = new Identifier();
            sid1.setValue("sequence1");
            EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
            EasyMock.expect(seq.getExpires()).andReturn(null);
            EasyMock.expect(seq.getOfferingSequenceIdentifier()).andReturn(null);
            EasyMock.expect(seq.getEndpointIdentifier()).andReturn(CLIENT_ENDPOINT_ID);
       
            control.replay();
            store.createSourceSequence(seq);  
            control.reset();
           
            Collection<SourceSequence> seqs =
                store.getSourceSequences(CLIENT_ENDPOINT_ID, ProtocolVariation.RM10WSA200408);
            assertEquals(1, seqs.size());
            SourceSequence rseq = seqs.iterator().next();
            assertFalse(rseq.isLastMessage());
           
            Collection<RMMessage> out = store.getMessages(sid1, true);
            assertEquals(0, out.size());
           
            // set the last message flag
            EasyMock.expect(seq.getIdentifier()).andReturn(sid1).anyTimes();
            EasyMock.expect(seq.isLastMessage()).andReturn(true);

            setupOutboundMessage(seq, 1L, null);
            out = store.getMessages(sid1, true);
            assertEquals(1, out.size());
            checkRecoveredMessages(out);

            // verify the updated sequence
            seqs = store.getSourceSequences(CLIENT_ENDPOINT_ID, ProtocolVariation.RM10WSA200408);
            assertEquals(1, seqs.size());
            rseq = seqs.iterator().next();
           
            assertTrue(rseq.isLastMessage());
           
            // set the last message flag
            EasyMock.expect(seq.getIdentifier()).andReturn(sid1).anyTimes();
            EasyMock.expect(seq.getCurrentMessageNr()).andReturn(2L);
            EasyMock.expect(seq.isLastMessage()).andReturn(true);

            control.replay();
            store.persistOutgoing(seq, null);
            control.reset();
           
            seqs = store.getSourceSequences(CLIENT_ENDPOINT_ID, ProtocolVariation.RM10WSA200408);
            assertEquals(1, seqs.size());
            rseq = seqs.iterator().next();
           
            assertEquals(2, rseq.getCurrentMessageNr());
        } finally {
            if (null != sid1) {
                store.removeSourceSequence(sid1);
            }
            Collection<Long> msgNrs = new ArrayList<Long>();
View Full Code Here

       
        return sid;
    }
   
    private Identifier setupSourceSequence(String s) throws SQLException {
        SourceSequence seq = control.createMock(SourceSequence.class);       
        Identifier sid = new Identifier();
        sid.setValue(s);     
           
        Date expiry = null;
        Identifier osid = null;
        Long cmn = ONE;
        boolean lm = false;
       
        if ("sequence2".equals(s)) {
            expiry = new Date(System.currentTimeMillis() + 3600 * 1000);
            osid = new Identifier();
            osid.setValue("offeringSequence");
            cmn = TEN;
            lm = true;           
        }
       
        EasyMock.expect(seq.getIdentifier()).andReturn(sid);
        EasyMock.expect(seq.getExpires()).andReturn(expiry);
        EasyMock.expect(seq.getOfferingSequenceIdentifier()).andReturn(osid);
        EasyMock.expect(seq.getEndpointIdentifier()).andReturn(CLIENT_ENDPOINT_ID);
        EasyMock.expect(seq.getCurrentMessageNr()).andReturn(cmn);
        EasyMock.expect(seq.isLastMessage()).andReturn(lm);
        EasyMock.expect(seq.getIdentifier()).andReturn(sid);
       
        control.replay();
        store.createSourceSequence(seq);          
        store.beginTransaction();
        store.updateSourceSequence(seq);
View Full Code Here

    }
   
    @Test
    public void testPurgeAcknowledgedSome() {
        Long[] messageNumbers = {TEN, ONE};
        SourceSequence sequence = setUpSequence("sequence1",
                                          messageNumbers,
                                          new boolean[] {true, false});
        List<RetransmissionQueueImpl.ResendCandidate> sequenceList =
            new ArrayList<RetransmissionQueueImpl.ResendCandidate>();
        queue.getUnacknowledged().put("sequence1", sequenceList);
View Full Code Here

    }
   
    @Test
    public void testPurgeAcknowledgedNone() {
        Long[] messageNumbers = {TEN, ONE};
        SourceSequence sequence = setUpSequence("sequence1",
                                           messageNumbers,
                                           new boolean[] {false, false});
        List<RetransmissionQueueImpl.ResendCandidate> sequenceList =
            new ArrayList<RetransmissionQueueImpl.ResendCandidate>();
        queue.getUnacknowledged().put("sequence1", sequenceList);
View Full Code Here

    }

    @Test
    public void testPurgeAcknowledgedAll() {
        Long[] messageNumbers = {TEN, ONE};
        SourceSequence sequence = setUpSequence("sequence1",
                                          messageNumbers,
                                          new boolean[] {true, true});
        List<RetransmissionQueueImpl.ResendCandidate> sequenceList =
            new ArrayList<RetransmissionQueueImpl.ResendCandidate>();
        queue.getUnacknowledged().put("sequence1", sequenceList);
View Full Code Here

    }

    @Test
    public void testCountUnacknowledged() {
        Long[] messageNumbers = {TEN, ONE};
        SourceSequence sequence = setUpSequence("sequence1",
                                          messageNumbers,
                                          null);
        List<RetransmissionQueueImpl.ResendCandidate> sequenceList =
            new ArrayList<RetransmissionQueueImpl.ResendCandidate>();
       
View Full Code Here

    }
   
    @Test
    public void testCountUnacknowledgedUnknownSequence() {
        Long[] messageNumbers = {TEN, ONE};
        SourceSequence sequence = setUpSequence("sequence1",
                                          messageNumbers,
                                          null);
        ready(false);

        assertEquals("unexpected unacked count",
View Full Code Here

    }
   
    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);
        id.getValue();
        EasyMock.expectLastCall().andReturn(sid);
        identifiers.add(id);
        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) {
            // Will be called once or twice depending on whether any more
            // unacknowledged messages are left for this sequence
            sequence.getIdentifier();
            EasyMock.expectLastCall().andReturn(id).times(1, 2);

            // Would be called only when there are no more
            // unacknowledged messages left for this sequence
            id.getValue();
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.rm.SourceSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.