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());
}
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();
}
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());
}
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());
}
Aggregations