Package edu.stanford.nlp.misc

Examples of edu.stanford.nlp.misc.DependencyAnalyzer$Identifier


        }
    }

    @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);
            EasyMock.expect(seq.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408);
View Full Code Here


        }
    }

    @Test
    public void testCreateSequenceStoreInboundMessage() throws SQLException, IOException {
        Identifier sid1 = null;
        try {
            DestinationSequence seq = control.createMock(DestinationSequence.class);
            sid1 = new Identifier();
            sid1.setValue("sequence1");
            EndpointReferenceType epr = RMUtils.createAnonymousReference();
            EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
            EasyMock.expect(seq.getAcksTo()).andReturn(epr);       
            EasyMock.expect(seq.getEndpointIdentifier()).andReturn(SERVER_ENDPOINT_ID);
            EasyMock.expect(seq.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408);
View Full Code Here

    }

    private Identifier setupDestinationSequence(String s) throws IOException, SQLException {
        DestinationSequence seq = control.createMock(DestinationSequence.class);
       
        Identifier sid = new Identifier();
        sid.setValue(s);
        EndpointReferenceType epr = RMUtils.createAnonymousReference();
       
        SequenceAcknowledgement ack = ack1;
        Long lmn = ZERO;
        ProtocolVariation pv = ProtocolVariation.RM10WSA200408;
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;
        ProtocolVariation pv = ProtocolVariation.RM10WSA200408;
       
        if ("sequence2".equals(s)) {
            expiry = new Date(System.currentTimeMillis() + 3600 * 1000);
            osid = new Identifier();
            osid.setValue("offeringSequence");
            cmn = TEN;
            lm = true;           
            pv = ProtocolVariation.RM11WSA200508;
        }
       
View Full Code Here

       
        return sid;
    }

    private void verifyDestinationSequence(String s, DestinationSequence seq) {
        Identifier sid = seq.getIdentifier();
        assertNotNull(sid);
        assertEquals(s, sid.getValue());
        if ("sequence1".equals(s)) {
            assertEquals(0, seq.getLastMessageNumber());
            SequenceAcknowledgement sa = seq.getAcknowledgment();
            assertNotNull(sa);
            verifyAcknowledgementRanges(sa.getAcknowledgementRange(), new long[]{1, 1});
View Full Code Here

            assertEquals(ProtocolVariation.RM11WSA200508, seq.getProtocol());
        }
    }
   
    private void verifySourceSequence(String s, SourceSequence seq) {
        Identifier sid = seq.getIdentifier();
        assertNotNull(sid);
        assertEquals(s, sid.getValue());
        if ("sequence1".equals(s)) {
            assertNull(seq.getExpires());
            assertEquals(1, seq.getCurrentMessageNr());
            assertFalse(seq.isLastMessage());
            assertEquals(ProtocolVariation.RM10WSA200408, seq.getProtocol());
View Full Code Here

    }
   
    private void purgeCandidates(SourceSequence seq, boolean any) {
        Collection<Long> purged = new ArrayList<Long>();
        Collection<ResendCandidate> resends = new ArrayList<ResendCandidate>();
        Identifier sid = seq.getIdentifier();
        synchronized (this) {
            LOG.fine("Start purging resend candidates.");
            List<ResendCandidate> sequenceCandidates = getSequenceCandidates(seq);
            if (null != sequenceCandidates) {
                for (int i = sequenceCandidates.size() - 1; i >= 0; i--) {
                    ResendCandidate candidate = sequenceCandidates.get(i);
                    long m = candidate.getNumber();
                    if (any || seq.isAcknowledged(m)) {
                        sequenceCandidates.remove(i);
                        candidate.resolved();
                        unacknowledgedCount--;
                        purged.add(m);
                        resends.add(candidate);
                    }
                }
                if (sequenceCandidates.isEmpty()) {
                    candidates.remove(sid.getValue());
                }
            }
            LOG.fine("Completed purging resend candidates.");
        }
        if (purged.size() > 0) {
            RMStore store = manager.getStore();
            if (null != store) {
                store.removeMessages(sid, purged, true);
            }
            RMEndpoint rmEndpoint = seq.getSource().getReliableEndpoint();
            for (ResendCandidate resend: resends) {
                rmEndpoint.handleAcknowledgment(sid.getValue(), resend.getNumber(), resend.getMessage());
            }
        }
    }
View Full Code Here

     * @return ResendCandidate
     */   
    protected ResendCandidate cacheUnacknowledged(Message message) {
        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
        SequenceType st = rmps.getSequence();
        Identifier sid = st.getIdentifier();
        String key = sid.getValue();
       
        ResendCandidate candidate = null;
       
        synchronized (this) {
            List<ResendCandidate> sequenceCandidates = getSequenceCandidates(key);
View Full Code Here

       
        Collection<SequenceAcknowledgement> acks = rmps.getAcks();
        Source source = rme.getSource();
        if (null != acks) {
            for (SequenceAcknowledgement ack : acks) {
                Identifier id = ack.getIdentifier();
                SourceSequence ss = source.getSequence(id);               
                if (null != ss) {
                    ss.setAcknowledged(ack);
                } else {
                    RMConstants consts = protocol.getConstants();
View Full Code Here

            EasyMock.expectLastCall().andReturn(sequence);
        }
        if (messageNumber != null) {
            EasyMock.expect(sequence.getMessageNumber()).andReturn(messageNumber).anyTimes();
        }
        Identifier id = createMock(Identifier.class);
        EasyMock.expect(sequence.getIdentifier()).andReturn(id).anyTimes();
        EasyMock.expect(id.getValue()).andReturn(sid).anyTimes();
        identifiers.add(id);
        sequences.add(sequence);
        return sequence;
    }
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.misc.DependencyAnalyzer$Identifier

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.