Search in sources :

Example 16 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore 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 17 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore in project cxf by apache.

the class RMManagerTest method testRecoverReliableEndpoint.

@Test
public void testRecoverReliableEndpoint() {
    manager = new RMManager();
    Endpoint endpoint = control.createMock(Endpoint.class);
    Conduit conduit = control.createMock(Conduit.class);
    control.replay();
    manager.recoverReliableEndpoint(endpoint, conduit);
    control.verify();
    control.reset();
    RMStore store = control.createMock(RMStore.class);
    manager.setStore(store);
    control.replay();
    manager.recoverReliableEndpoint(endpoint, conduit);
    control.verify();
}
Also used : Endpoint(org.apache.cxf.endpoint.Endpoint) Conduit(org.apache.cxf.transport.Conduit) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) Test(org.junit.Test)

Example 18 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore in project cxf by apache.

the class AbstractClientPersistenceTest method verifyRecovery.

void verifyRecovery() throws Exception {
    RMManager manager = bus.getExtension(RMManager.class);
    assertNotNull(manager);
    RMStore store = manager.getStore();
    assertNotNull(store);
    Client client = ClientProxy.getClient(greeter);
    String id = RMUtils.getEndpointIdentifier(client.getEndpoint());
    Collection<DestinationSequence> dss = store.getDestinationSequences(id);
    assertEquals(1, dss.size());
    Collection<SourceSequence> sss = store.getSourceSequences(id);
    assertEquals(1, sss.size());
    int i = 0;
    while (store.getMessages(sss.iterator().next().getIdentifier(), true).size() > 0 && i < 10) {
        Thread.sleep(200);
        i++;
    }
    assertEquals(0, store.getMessages(sss.iterator().next().getIdentifier(), true).size());
    assertEquals(0, store.getMessages(sss.iterator().next().getIdentifier(), false).size());
}
Also used : DestinationSequence(org.apache.cxf.ws.rm.DestinationSequence) RMManager(org.apache.cxf.ws.rm.RMManager) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) Client(org.apache.cxf.endpoint.Client) SourceSequence(org.apache.cxf.ws.rm.SourceSequence) Endpoint(javax.xml.ws.Endpoint)

Example 19 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore in project cxf by apache.

the class AbstractClientPersistenceTest method verifyStorePopulation.

void verifyStorePopulation() {
    RMManager manager = bus.getExtension(RMManager.class);
    assertNotNull(manager);
    RMStore store = manager.getStore();
    assertNotNull(store);
    Client client = ClientProxy.getClient(greeter);
    String id = RMUtils.getEndpointIdentifier(client.getEndpoint());
    Collection<DestinationSequence> dss = store.getDestinationSequences(id);
    assertEquals(1, dss.size());
    Collection<SourceSequence> sss = store.getSourceSequences(id);
    assertEquals(1, sss.size());
    Collection<RMMessage> msgs = store.getMessages(sss.iterator().next().getIdentifier(), true);
    assertEquals(2, msgs.size());
    msgs = store.getMessages(sss.iterator().next().getIdentifier(), false);
    assertEquals(0, msgs.size());
}
Also used : DestinationSequence(org.apache.cxf.ws.rm.DestinationSequence) RMManager(org.apache.cxf.ws.rm.RMManager) RMMessage(org.apache.cxf.ws.rm.persistence.RMMessage) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) Client(org.apache.cxf.endpoint.Client) SourceSequence(org.apache.cxf.ws.rm.SourceSequence)

Aggregations

RMStore (org.apache.cxf.ws.rm.persistence.RMStore)19 Identifier (org.apache.cxf.ws.rm.v200702.Identifier)6 ArrayList (java.util.ArrayList)4 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)4 Test (org.junit.Test)4 Endpoint (org.apache.cxf.endpoint.Endpoint)3 CachedOutputStream (org.apache.cxf.io.CachedOutputStream)3 SourceSequence (org.apache.cxf.ws.rm.SourceSequence)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 Binding (org.apache.cxf.binding.Binding)2 SoapBinding (org.apache.cxf.binding.soap.SoapBinding)2 Client (org.apache.cxf.endpoint.Client)2 Service (org.apache.cxf.service.Service)2 DestinationSequence (org.apache.cxf.ws.rm.DestinationSequence)2 RMEndpoint (org.apache.cxf.ws.rm.RMEndpoint)2 RMManager (org.apache.cxf.ws.rm.RMManager)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 OutputStream (java.io.OutputStream)1 Map (java.util.Map)1