Search in sources :

Example 81 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.

the class RMTxStoreTest method testReconnect.

@Test
public void testReconnect() throws Exception {
    // set the initial reconnect delay to 100 msec for testing
    long ird = store.getInitialReconnectDelay();
    store.setInitialReconnectDelay(100);
    SourceSequence seq = control.createMock(SourceSequence.class);
    Identifier sid1 = RMUtils.getWSRMFactory().createIdentifier();
    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);
    // intentionally invalidate the connection
    try {
        store.getConnection().close();
    } catch (SQLException ex) {
    // ignore
    }
    control.replay();
    try {
        store.createSourceSequence(seq);
        fail("Expected RMStoreException was not thrown.");
    } catch (RMStoreException ex) {
        SQLException se = (SQLException) ex.getCause();
        // expects a transient or non-transient connection exception
        assertTrue(se.getSQLState().startsWith("08"));
    }
    // wait 200 msecs to make sure an reconnect is attempted
    Thread.sleep(200);
    control.reset();
    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);
    control.replay();
    store.createSourceSequence(seq);
    control.verify();
    // revert to the old initial reconnect delay
    store.setInitialReconnectDelay(ird);
    store.removeSourceSequence(sid1);
}
Also used : RMStoreException(org.apache.cxf.ws.rm.persistence.RMStoreException) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SQLException(java.sql.SQLException) SourceSequence(org.apache.cxf.ws.rm.SourceSequence) Test(org.junit.Test)

Example 82 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.

the class RMSoapOutInterceptorTest method setUpOutbound.

private void setUpOutbound() {
    ObjectFactory factory = new ObjectFactory();
    s1 = factory.createSequenceType();
    Identifier sid = factory.createIdentifier();
    sid.setValue("sequence1");
    s1.setIdentifier(sid);
    s1.setMessageNumber(ONE);
    s2 = factory.createSequenceType();
    sid = factory.createIdentifier();
    sid.setValue("sequence2");
    s2.setIdentifier(sid);
    s2.setMessageNumber(TEN);
    ack1 = factory.createSequenceAcknowledgement();
    SequenceAcknowledgement.AcknowledgementRange r = factory.createSequenceAcknowledgementAcknowledgementRange();
    r.setLower(ONE);
    r.setUpper(ONE);
    ack1.getAcknowledgementRange().add(r);
    ack1.setIdentifier(s1.getIdentifier());
    ack2 = factory.createSequenceAcknowledgement();
    r = factory.createSequenceAcknowledgementAcknowledgementRange();
    r.setLower(ONE);
    r.setUpper(TEN);
    ack2.getAcknowledgementRange().add(r);
    ack2.setIdentifier(s2.getIdentifier());
    ar1 = factory.createAckRequestedType();
    ar1.setIdentifier(s1.getIdentifier());
    ar2 = factory.createAckRequestedType();
    ar2.setIdentifier(s2.getIdentifier());
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) ObjectFactory(org.apache.cxf.ws.rm.v200702.ObjectFactory) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

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