@Test
public void testWritesWithSmallBuffer() throws JournalException,
IOException, XMLStreamException {
startMockRmiJournalReceiver();
parameters.put(RmiTransport.PARAMETER_BUFFER_SIZE, "100");
RmiTransport transport = new RmiTransport(parameters, CRUCIAL, parent);
transport.openFile("someHash", "aFileName", new Date());
assertCorrectNumberOfCalls(1, 1, 0);
XMLEventFactory factory = XMLEventFactory.newInstance();
QName name1 = new QName("junkyElement1");
QName name2 = new QName("junkyElement12");
transport.getWriter()
.add(factory.createStartElement(name1, null, null));
transport.getWriter().add(factory.createEndElement(name1, null));
assertCorrectNumberOfCalls(1, 1, 0);
transport.getWriter()
.add(factory.createStartElement(name2, null, null));
transport.getWriter().add(factory.createEndElement(name2, null));
transport.closeFile();
assertCorrectNumberOfCalls(1, 3, 1);
transport.shutdown();
assertCorrectNumberOfCalls(1, 3, 1);
}