use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.
the class RMTxStoreTwoSchemasTest method testStoreIsolation.
@Test
public void testStoreIsolation() throws Exception {
SourceSequence seq = control.createMock(SourceSequence.class);
Identifier sid1 = new Identifier();
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);
control.replay();
store1.createSourceSequence(seq);
control.verify();
SourceSequence rseq = store1.getSourceSequence(sid1);
assertNotNull(rseq);
rseq = store2.getSourceSequence(sid1);
assertNull(rseq);
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();
store2.createSourceSequence(seq);
control.verify();
rseq = store2.getSourceSequence(sid1);
assertNotNull(rseq);
// create another store
RMTxStore store3 = createStore(null);
store3.init();
rseq = store3.getSourceSequence(sid1);
assertNull(rseq);
// switch to the store1's schema
store3.setSchemaName(store1.getSchemaName());
store3.init();
rseq = store3.getSourceSequence(sid1);
assertNotNull(rseq);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.
the class RetransmissionQueueImplTest method setUpSequenceType.
private SequenceType setUpSequenceType(Message message, String sid, Long messageNumber) {
RMProperties rmps = createMock(RMProperties.class);
if (message != null) {
message.get(RMMessageConstants.RM_PROPERTIES_OUTBOUND);
EasyMock.expectLastCall().andReturn(rmps);
}
properties.add(rmps);
SequenceType sequence = createMock(SequenceType.class);
if (message != null) {
rmps.getSequence();
EasyMock.expectLastCall().andReturn(sequence);
}
if (messageNumber != null) {
EasyMock.expect(sequence.getMessageNumber()).andReturn(messageNumber).anyTimes();
}
Identifier id = createMock(Identifier.class);
EasyMock.expect(sequence.getIdentifier()).andReturn(id).anyTimes();
EasyMock.expect(id.getValue()).andReturn(sid).anyTimes();
identifiers.add(id);
sequences.add(sequence);
return sequence;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.
the class RMManagerTest method setUpRecoverReliableEndpoint.
void setUpRecoverReliableEndpoint(Endpoint endpoint, Conduit conduit, SourceSequence ss, DestinationSequence ds, RMMessage m) throws IOException {
RMStore store = control.createMock(RMStore.class);
RetransmissionQueue oqueue = control.createMock(RetransmissionQueue.class);
RedeliveryQueue iqueue = control.createMock(RedeliveryQueue.class);
manager.setStore(store);
manager.setRetransmissionQueue(oqueue);
manager.setRedeliveryQueue(iqueue);
Collection<SourceSequence> sss = new ArrayList<>();
if (null != ss) {
sss.add(ss);
}
EasyMock.expect(store.getSourceSequences("{S}s.{P}p@cxf")).andReturn(sss);
if (null == ss) {
return;
}
Collection<DestinationSequence> dss = new ArrayList<>();
if (null != ds) {
dss.add(ds);
}
EasyMock.expect(store.getDestinationSequences("{S}s.{P}p@cxf")).andReturn(dss);
if (null == ds) {
return;
}
Collection<RMMessage> ms = new ArrayList<>();
if (null != m) {
ms.add(m);
}
Identifier id = new Identifier();
id.setValue("S1");
EasyMock.expect(ss.getIdentifier()).andReturn(id).times(null == m ? 1 : 2);
EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
EasyMock.expect(store.getMessages(id, true)).andReturn(ms);
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(manager.createReliableEndpoint(endpoint)).andReturn(rme);
Source source = control.createMock(Source.class);
EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
Destination destination = control.createMock(Destination.class);
EasyMock.expect(rme.getDestination()).andReturn(destination);
destination.addSequence(ds, false);
EasyMock.expectLastCall();
Service service = control.createMock(Service.class);
EasyMock.expect(endpoint.getService()).andReturn(service).anyTimes();
Binding binding = control.createMock(Binding.class);
EasyMock.expect(endpoint.getBinding()).andReturn(binding).anyTimes();
EasyMock.expect(ss.isLastMessage()).andReturn(true).anyTimes();
EasyMock.expect(ss.getCurrentMessageNr()).andReturn(Long.valueOf(10)).anyTimes();
if (null == m) {
return;
}
EasyMock.expect(m.getMessageNumber()).andReturn(Long.valueOf(10)).times(2);
if (null == conduit) {
EasyMock.expect(m.getTo()).andReturn("toAddress");
}
InputStream is = new ByteArrayInputStream(new byte[0]);
CachedOutputStream cos = new CachedOutputStream();
IOUtils.copy(is, cos);
cos.flush();
is.close();
EasyMock.expect(m.getContent()).andReturn(cos).anyTimes();
oqueue.addUnacknowledged(EasyMock.isA(Message.class));
EasyMock.expectLastCall();
oqueue.start();
EasyMock.expectLastCall();
iqueue.start();
EasyMock.expectLastCall();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.
the class RMManagerTest method testGetNewSequence.
@Test
public void testGetNewSequence() throws NoSuchMethodException, SequenceFault, RMException {
Method m = RMManager.class.getDeclaredMethod("getSource", new Class[] { Message.class });
manager = control.createMock(RMManager.class, new Method[] { m });
Message message = control.createMock(Message.class);
Exchange exchange = control.createMock(Exchange.class);
EasyMock.expect(message.getContextualPropertyKeys()).andReturn(new HashSet<>()).anyTimes();
EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes();
EasyMock.expect(exchange.getOutMessage()).andReturn(message).anyTimes();
EasyMock.expect(exchange.getInMessage()).andReturn(null).anyTimes();
EasyMock.expect(exchange.getOutFaultMessage()).andReturn(null).anyTimes();
Conduit conduit = control.createMock(Conduit.class);
EasyMock.expect(exchange.getConduit(message)).andReturn(conduit).anyTimes();
Identifier inSid = control.createMock(Identifier.class);
AddressingProperties maps = control.createMock(AddressingProperties.class);
Source source = control.createMock(Source.class);
EasyMock.expect(manager.getSource(message)).andReturn(source);
EasyMock.expect(source.getCurrent(inSid)).andReturn(null);
AttributedURIType uri = control.createMock(AttributedURIType.class);
EasyMock.expect(maps.getTo()).andReturn(uri);
EasyMock.expect(uri.getValue()).andReturn("http://localhost:9001/TestPort");
EndpointReferenceType epr = RMUtils.createNoneReference();
EasyMock.expect(maps.getReplyTo()).andReturn(epr);
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).times(2);
Proxy proxy = control.createMock(Proxy.class);
EasyMock.expect(rme.getProxy()).andReturn(proxy);
CreateSequenceResponseType createResponse = control.createMock(CreateSequenceResponseType.class);
proxy.createSequence(EasyMock.isA(EndpointReferenceType.class), (RelatesToType) EasyMock.isNull(), EasyMock.eq(false), EasyMock.isA(ProtocolVariation.class), EasyMock.isA(Exchange.class), // NOPMD
CastUtils.cast(EasyMock.isA(HashMap.class), String.class, Object.class));
EasyMock.expectLastCall().andReturn(createResponse);
Servant servant = control.createMock(Servant.class);
EasyMock.expect(rme.getServant()).andReturn(servant);
servant.createSequenceResponse(createResponse, ProtocolVariation.RM10WSA200408);
EasyMock.expectLastCall();
SourceSequence sseq = control.createMock(SourceSequence.class);
EasyMock.expect(source.awaitCurrent(inSid)).andReturn(sseq);
sseq.setTarget(EasyMock.isA(EndpointReferenceType.class));
EasyMock.expectLastCall();
control.replay();
assertSame(sseq, manager.getSequence(inSid, message, maps));
control.verify();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.
the class RMManagerTest method setUpRecoverReliableEndpointWithAttachment.
void setUpRecoverReliableEndpointWithAttachment(Endpoint endpoint, Conduit conduit, SourceSequence ss, DestinationSequence ds, RMMessage m, Capture<Message> mc) throws IOException {
RMStore store = control.createMock(RMStore.class);
RetransmissionQueue oqueue = control.createMock(RetransmissionQueue.class);
RedeliveryQueue iqueue = control.createMock(RedeliveryQueue.class);
manager.setStore(store);
manager.setRetransmissionQueue(oqueue);
manager.setRedeliveryQueue(iqueue);
Collection<SourceSequence> sss = new ArrayList<>();
if (null != ss) {
sss.add(ss);
}
EasyMock.expect(store.getSourceSequences("{S}s.{P}p@cxf")).andReturn(sss);
if (null == ss) {
return;
}
Collection<DestinationSequence> dss = new ArrayList<>();
if (null != ds) {
dss.add(ds);
}
EasyMock.expect(store.getDestinationSequences("{S}s.{P}p@cxf")).andReturn(dss);
if (null == ds) {
return;
}
Collection<RMMessage> ms = new ArrayList<>();
if (null != m) {
ms.add(m);
}
Identifier id = new Identifier();
id.setValue("S1");
EasyMock.expect(ss.getIdentifier()).andReturn(id).times(null == m ? 1 : 2);
EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
EasyMock.expect(store.getMessages(id, true)).andReturn(ms);
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(manager.createReliableEndpoint(endpoint)).andReturn(rme);
Source source = control.createMock(Source.class);
EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
Destination destination = control.createMock(Destination.class);
EasyMock.expect(rme.getDestination()).andReturn(destination);
destination.addSequence(ds, false);
EasyMock.expectLastCall();
Service service = control.createMock(Service.class);
EasyMock.expect(endpoint.getService()).andReturn(service).anyTimes();
Binding binding = control.createMock(Binding.class);
EasyMock.expect(endpoint.getBinding()).andReturn(binding).anyTimes();
EasyMock.expect(ss.isLastMessage()).andReturn(true).anyTimes();
EasyMock.expect(ss.getCurrentMessageNr()).andReturn(Long.valueOf(10)).anyTimes();
if (null == m) {
return;
}
oqueue.addUnacknowledged(EasyMock.capture(mc));
EasyMock.expectLastCall();
oqueue.start();
EasyMock.expectLastCall();
iqueue.start();
EasyMock.expectLastCall();
}
Aggregations