Search in sources :

Example 71 with Identifier

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

the class RMTxStoreTestBase method testCreateDeleteDestSequences.

@Test
public void testCreateDeleteDestSequences() {
    DestinationSequence seq = control.createMock(DestinationSequence.class);
    Identifier 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);
    control.replay();
    store.createDestinationSequence(seq);
    control.verify();
    control.reset();
    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);
    control.replay();
    try {
        store.createDestinationSequence(seq);
        fail("Expected RMStoreException was not thrown.");
    } catch (RMStoreException ex) {
        SQLException se = (SQLException) ex.getCause();
        // duplicate key value
        assertEquals("23505", se.getSQLState());
    }
    control.verify();
    control.reset();
    Identifier sid2 = new Identifier();
    sid2.setValue("sequence2");
    EasyMock.expect(seq.getIdentifier()).andReturn(sid2);
    epr = RMUtils.createReference(NON_ANON_ACKS_TO);
    EasyMock.expect(seq.getAcksTo()).andReturn(epr);
    EasyMock.expect(seq.getEndpointIdentifier()).andReturn(CLIENT_ENDPOINT_ID);
    EasyMock.expect(seq.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408);
    control.replay();
    store.createDestinationSequence(seq);
    control.verify();
    store.removeDestinationSequence(sid1);
    store.removeDestinationSequence(sid2);
    // deleting once again is a no-op
    store.removeDestinationSequence(sid2);
}
Also used : RMStoreException(org.apache.cxf.ws.rm.persistence.RMStoreException) DestinationSequence(org.apache.cxf.ws.rm.DestinationSequence) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) SQLException(java.sql.SQLException) Test(org.junit.Test)

Example 72 with Identifier

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

the class SoapFaultFactory method setDetail.

void setDetail(SoapFault fault, Object detail, EncoderDecoder codec) throws Exception {
    String name = fault.getSubCode().getLocalPart();
    Element element = null;
    if (RMConstants.INVALID_ACKNOWLEDGMENT_FAULT_CODE.equals(name)) {
        element = codec.encodeSequenceAcknowledgement((SequenceAcknowledgement) detail);
    } else if (!RMConstants.CREATE_SEQUENCE_REFUSED_FAULT_CODE.equals(name) && !RMConstants.WSRM_REQUIRED_FAULT_CODE.equals(name)) {
        element = codec.encodeIdentifier((Identifier) detail);
    }
    fault.setDetail(element);
}
Also used : Element(org.w3c.dom.Element) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Example 73 with Identifier

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

the class DestinationTest method testAddRemoveSequence.

@Test
public void testAddRemoveSequence() {
    DestinationSequence ds = control.createMock(DestinationSequence.class);
    ds.setDestination(destination);
    EasyMock.expectLastCall();
    Identifier id = control.createMock(Identifier.class);
    EasyMock.expect(ds.getIdentifier()).andReturn(id).times(3);
    String sid = "s1";
    EasyMock.expect(id.getValue()).andReturn(sid).times(3);
    RMManager manager = control.createMock(RMManager.class);
    EasyMock.expect(rme.getManager()).andReturn(manager).times(2);
    RMStore store = control.createMock(RMStore.class);
    EasyMock.expect(manager.getStore()).andReturn(store).times(2);
    store.createDestinationSequence(ds);
    EasyMock.expectLastCall();
    store.removeDestinationSequence(id);
    EasyMock.expectLastCall();
    control.replay();
    destination.addSequence(ds);
    assertEquals(1, destination.getAllSequences().size());
    assertSame(ds, destination.getSequence(id));
    destination.removeSequence(ds);
    assertEquals(0, destination.getAllSequences().size());
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) Test(org.junit.Test)

Example 74 with Identifier

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

the class ProxyTest method testOfferedIdentifier.

@Test
public void testOfferedIdentifier() {
    OfferType offer = control.createMock(OfferType.class);
    Identifier id = control.createMock(Identifier.class);
    EasyMock.expect(offer.getIdentifier()).andReturn(id).anyTimes();
    control.replay();
    Proxy proxy = new Proxy(rme);
    assertNull(proxy.getOfferedIdentifier());
    proxy.setOfferedIdentifier(offer);
    assertSame(id, proxy.getOfferedIdentifier());
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) OfferType(org.apache.cxf.ws.rm.v200702.OfferType) Test(org.junit.Test)

Example 75 with Identifier

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

the class ProxyTest method testTerminate.

@Test
public void testTerminate() throws NoSuchMethodException, RMException {
    Method m = Proxy.class.getDeclaredMethod("invoke", new Class[] { OperationInfo.class, ProtocolVariation.class, Object[].class, Map.class });
    Proxy proxy = EasyMock.createMockBuilder(Proxy.class).addMockedMethod(m).createMock(control);
    proxy.setReliableEndpoint(rme);
    Endpoint endpoint = control.createMock(Endpoint.class);
    EasyMock.expect(rme.getEndpoint(ProtocolVariation.RM10WSA200408)).andReturn(endpoint).anyTimes();
    EndpointInfo epi = control.createMock(EndpointInfo.class);
    EasyMock.expect(endpoint.getEndpointInfo()).andReturn(epi).anyTimes();
    ServiceInfo si = control.createMock(ServiceInfo.class);
    EasyMock.expect(epi.getService()).andReturn(si).anyTimes();
    InterfaceInfo ii = control.createMock(InterfaceInfo.class);
    EasyMock.expect(si.getInterface()).andReturn(ii).anyTimes();
    OperationInfo oi = control.createMock(OperationInfo.class);
    EasyMock.expect(ii.getOperation(RM10Constants.TERMINATE_SEQUENCE_QNAME)).andReturn(oi).anyTimes();
    SourceSequence ss = control.createMock(SourceSequence.class);
    Identifier id = control.createMock(Identifier.class);
    EasyMock.expect(ss.getIdentifier()).andReturn(id).anyTimes();
    EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
    expectInvoke(proxy, oi, null);
    control.replay();
    proxy.terminate(ss);
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Endpoint(org.apache.cxf.endpoint.Endpoint) Method(java.lang.reflect.Method) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) Test(org.junit.Test)

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