use of org.geotoolkit.sml.xml.v100.Identifier in project cxf by apache.
the class SoapFaultFactoryTest method createSoap12FaultWithIdentifierDetail.
@Test
public void createSoap12FaultWithIdentifierDetail() {
SoapBinding sb = control.createMock(SoapBinding.class);
EasyMock.expect(sb.getSoapVersion()).andReturn(Soap12.getInstance());
Identifier id = new Identifier();
id.setValue("sid");
setupSequenceFault(true, RM10Constants.UNKNOWN_SEQUENCE_FAULT_QNAME, id);
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.UNKNOWN_SEQUENCE_FAULT_QNAME, fault.getSubCode());
Element elem = fault.getDetail();
assertEquals(RM10Constants.NAMESPACE_URI, elem.getNamespaceURI());
assertEquals("Identifier", elem.getLocalName());
control.verify();
}
use of org.geotoolkit.sml.xml.v100.Identifier in project cxf by apache.
the class RetransmissionQueueImplTest method setUpSequence.
private SourceSequence setUpSequence(String sid, Long[] messageNumbers, boolean[] isAcked) {
SourceSequence sequence = createMock(SourceSequence.class);
Identifier id = createMock(Identifier.class);
sequence.getIdentifier();
EasyMock.expectLastCall().andReturn(id).anyTimes();
id.getValue();
EasyMock.expectLastCall().andReturn(sid).anyTimes();
identifiers.add(id);
Source source = createMock(Source.class);
sequence.getSource();
EasyMock.expectLastCall().andReturn(source).anyTimes();
source.getReliableEndpoint();
EasyMock.expectLastCall().andReturn(endpoint).anyTimes();
boolean includesAcked = false;
for (int i = 0; isAcked != null && i < isAcked.length; i++) {
sequence.isAcknowledged(messageNumbers[i]);
EasyMock.expectLastCall().andReturn(isAcked[i]);
if (isAcked[i]) {
includesAcked = true;
}
}
if (includesAcked) {
RMStore store = createMock(RMStore.class);
manager.getStore();
EasyMock.expectLastCall().andReturn(store);
}
return sequence;
}
use of org.geotoolkit.sml.xml.v100.Identifier in project cxf by apache.
the class RMInInterceptor method processAcknowledgments.
void processAcknowledgments(RMEndpoint rme, RMProperties rmps, ProtocolVariation protocol) throws SequenceFault, RMException {
Collection<SequenceAcknowledgement> acks = rmps.getAcks();
Source source = rme.getSource();
if (null != acks) {
for (SequenceAcknowledgement ack : acks) {
Identifier id = ack.getIdentifier();
SourceSequence ss = source.getSequence(id);
if (null != ss) {
ss.setAcknowledged(ack);
} else {
RMConstants consts = protocol.getConstants();
SequenceFaultFactory sff = new SequenceFaultFactory(consts);
throw sff.createUnknownSequenceFault(id);
}
}
}
}
use of org.geotoolkit.sml.xml.v100.Identifier in project cxf by apache.
the class RMTxStore method getSourceSequence.
public SourceSequence getSourceSequence(Identifier sid) {
if (LOG.isLoggable(Level.FINE)) {
LOG.info("Getting source sequences for id: " + sid);
}
Connection con = verifyConnection();
PreparedStatement stmt = null;
SQLException conex = null;
ResultSet res = null;
try {
stmt = getStatement(con, SELECT_SRC_SEQUENCE_STMT_STR);
stmt.setString(1, sid.getValue());
res = stmt.executeQuery();
if (res.next()) {
long cmn = res.getLong(1);
boolean lm = res.getBoolean(2);
long lval = res.getLong(3);
Date expiry = 0 == lval ? null : new Date(lval);
String oidValue = res.getString(4);
Identifier oi = null;
if (null != oidValue) {
oi = RMUtils.getWSRMFactory().createIdentifier();
oi.setValue(oidValue);
}
ProtocolVariation pv = decodeProtocolVersion(res.getString(5));
return new SourceSequence(sid, expiry, oi, cmn, lm, pv);
}
} catch (SQLException ex) {
conex = ex;
// ignore
LOG.log(Level.WARNING, new Message("SELECT_SRC_SEQ_FAILED_MSG", LOG).toString(), ex);
} finally {
releaseResources(stmt, res);
updateConnectionState(con, conex);
}
return null;
}
use of org.geotoolkit.sml.xml.v100.Identifier in project cxf by apache.
the class RMTxStore method getDestinationSequences.
public Collection<DestinationSequence> getDestinationSequences(String endpointIdentifier) {
if (LOG.isLoggable(Level.FINE)) {
LOG.info("Getting destination sequences for endpoint: " + endpointIdentifier);
}
Connection con = verifyConnection();
PreparedStatement stmt = null;
SQLException conex = null;
Collection<DestinationSequence> seqs = new ArrayList<>();
ResultSet res = null;
try {
stmt = getStatement(con, SELECT_DEST_SEQUENCES_STMT_STR);
stmt.setString(1, endpointIdentifier);
res = stmt.executeQuery();
while (res.next()) {
Identifier sid = new Identifier();
sid.setValue(res.getString(1));
EndpointReferenceType acksTo = RMUtils.createReference(res.getString(2));
long lm = res.getLong(3);
ProtocolVariation pv = decodeProtocolVersion(res.getString(4));
boolean t = res.getBoolean(5);
InputStream is = res.getBinaryStream(6);
SequenceAcknowledgement ack = null;
if (null != is) {
ack = PersistenceUtils.getInstance().deserialiseAcknowledgment(is);
}
DestinationSequence seq = new DestinationSequence(sid, acksTo, lm, t, ack, pv);
seqs.add(seq);
}
} catch (SQLException ex) {
conex = ex;
LOG.log(Level.WARNING, new Message("SELECT_DEST_SEQ_FAILED_MSG", LOG).toString(), ex);
} finally {
releaseResources(stmt, res);
updateConnectionState(con, conex);
}
return seqs;
}
Aggregations