Search in sources :

Example 66 with Identifier

use of org.geotoolkit.sml.xml.v100.Identifier in project cxf by apache.

the class Destination method ackRequested.

void ackRequested(Message message) throws SequenceFault, RMException {
    // TODO
    Collection<AckRequestedType> ars = RMContextUtils.retrieveRMProperties(message, false).getAcksRequested();
    if (null == ars) {
        return;
    }
    for (AckRequestedType ar : ars) {
        Identifier id = ar.getIdentifier();
        DestinationSequence seq = getSequence(id);
        if (null == seq) {
            continue;
        }
        ackImmediately(seq, message);
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType)

Example 67 with Identifier

use of org.geotoolkit.sml.xml.v100.Identifier in project cxf by apache.

the class EncoderDecoder10Impl method buildHeaderFaultObject.

@Override
protected Object buildHeaderFaultObject(SequenceFault sf) {
    org.apache.cxf.ws.rm.v200502.SequenceFaultType flt = new org.apache.cxf.ws.rm.v200502.SequenceFaultType();
    flt.setFaultCode(sf.getFaultCode());
    Object detail = sf.getDetail();
    if (detail instanceof Element) {
        flt.getAny().add(detail);
    } else if (detail instanceof Identifier) {
        flt.getAny().add(VersionTransformer.convert200502((Identifier) detail));
    } else if (detail instanceof SequenceAcknowledgement) {
        flt.getAny().add(VersionTransformer.convert200502((SequenceAcknowledgement) detail));
    }
    Element data = sf.getExtraDetail();
    if (data != null) {
        flt.getAny().add(data);
    }
    return flt;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) JAXBElement(javax.xml.bind.JAXBElement) Element(org.w3c.dom.Element) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Example 68 with Identifier

use of org.geotoolkit.sml.xml.v100.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 69 with Identifier

use of org.geotoolkit.sml.xml.v100.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)

Example 70 with Identifier

use of org.geotoolkit.sml.xml.v100.Identifier in project cxf by apache.

the class SoapFaultFactoryTest method createSoap12FaultWithAcknowledgementDetail.

@Test
public void createSoap12FaultWithAcknowledgementDetail() {
    SoapBinding sb = control.createMock(SoapBinding.class);
    EasyMock.expect(sb.getSoapVersion()).andReturn(Soap12.getInstance());
    SequenceAcknowledgement ack = new SequenceAcknowledgement();
    Identifier id = new Identifier();
    id.setValue("sid");
    ack.setIdentifier(id);
    SequenceAcknowledgement.AcknowledgementRange range = new SequenceAcknowledgement.AcknowledgementRange();
    range.setLower(Long.valueOf(1));
    range.setUpper(Long.valueOf(10));
    ack.getAcknowledgementRange().add(range);
    setupSequenceFault(true, RM10Constants.INVALID_ACKNOWLEDGMENT_FAULT_QNAME, ack);
    control.replay();
    SoapFaultFactory factory = new SoapFaultFactory(sb);
    SoapFault fault = (SoapFault) factory.createFault(sf, createInboundMessage());
    assertEquals("reason", fault.getReason());
    assertEquals(Soap12.getInstance().getSender(), fault.getFaultCode());
    assertEquals(RM10Constants.INVALID_ACKNOWLEDGMENT_FAULT_QNAME, fault.getSubCode());
    Element elem = fault.getDetail();
    assertEquals(RM10Constants.NAMESPACE_URI, elem.getNamespaceURI());
    assertEquals("SequenceAcknowledgement", elem.getLocalName());
    control.verify();
}
Also used : SoapFault(org.apache.cxf.binding.soap.SoapFault) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Element(org.w3c.dom.Element) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement) SoapBinding(org.apache.cxf.binding.soap.SoapBinding) Test(org.junit.Test)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 Test (org.junit.Test)43 ArrayList (java.util.ArrayList)13 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 InputStream (java.io.InputStream)6 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 JAXBElement (javax.xml.bind.JAXBElement)5 SoapBinding (org.apache.cxf.binding.soap.SoapBinding)5