Search in sources :

Example 6 with JDBCSequentialFile

use of org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFile in project activemq-artemis by apache.

the class JDBCSequentialFileFactoryTest method testAsyncAppendToFile.

@Test
public void testAsyncAppendToFile() throws Exception {
    JDBCSequentialFile file = (JDBCSequentialFile) factory.createSequentialFile("test.txt");
    file.open();
    // Create buffer and fill with test data
    int bufferSize = 1024;
    ActiveMQBuffer src = ActiveMQBuffers.fixedBuffer(bufferSize);
    for (int i = 0; i < bufferSize; i++) {
        src.writeByte((byte) 1);
    }
    IOCallbackCountdown callback = new IOCallbackCountdown(1);
    file.internalWrite(src, callback);
    callback.assertEmpty(5);
    checkData(file, src);
}
Also used : JDBCSequentialFile(org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFile) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer) Test(org.junit.Test)

Aggregations

ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)6 JDBCSequentialFile (org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFile)6 Test (org.junit.Test)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)2 JDBCSequentialFileFactory (org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFileFactory)2 ArrayList (java.util.ArrayList)1 SequentialFile (org.apache.activemq.artemis.core.io.SequentialFile)1 PagingStore (org.apache.activemq.artemis.core.paging.PagingStore)1 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)1 PropertySQLProvider (org.apache.activemq.artemis.jdbc.store.sql.PropertySQLProvider)1 SQLProvider (org.apache.activemq.artemis.jdbc.store.sql.SQLProvider)1