store.removeDestinationSequence(sid2);
}
@Test
public void testCreateDeleteMessages() throws IOException, SQLException {
RMMessage msg = control.createMock(RMMessage.class);
Identifier sid1 = RMUtils.getWSRMFactory().createIdentifier();
sid1.setValue("sequence1");
EasyMock.expect(msg.getMessageNumber()).andReturn(ONE).times(2);
byte[] bytes = new byte[89];
EasyMock.expect(msg.getInputStream()).andReturn(new ByteArrayInputStream(bytes));
EasyMock.expect(msg.getSize()).andReturn(bytes.length);
control.replay();
store.beginTransaction();
store.storeMessage(sid1, msg, true);
store.storeMessage(sid1, msg, false);
store.commit();
control.verify();
control.reset();
EasyMock.expect(msg.getMessageNumber()).andReturn(ONE);
EasyMock.expect(msg.getInputStream()).andReturn(new ByteArrayInputStream(bytes));
EasyMock.expect(msg.getSize()).andReturn(bytes.length);
control.replay();
store.beginTransaction();
try {
store.storeMessage(sid1, msg, true);
} catch (SQLException ex) {
assertEquals("23505", ex.getSQLState());
}
store.abort();
control.verify();
control.reset();
EasyMock.expect(msg.getMessageNumber()).andReturn(TEN).times(2);
EasyMock.expect(msg.getInputStream()).andReturn(new ByteArrayInputStream(bytes));
EasyMock.expect(msg.getSize()).andReturn(bytes.length);
control.replay();
store.beginTransaction();
store.storeMessage(sid1, msg, true);
store.storeMessage(sid1, msg, false);