Search in sources :

Example 1 with HugeBufferProducer

use of com.questdb.net.ha.producer.HugeBufferProducer in project questdb by bluestreak01.

the class MetadataReplicationTest method testReplication.

@Test
public void testReplication() {
    try (JournalWriter w = getFactory().writer(Quote.class)) {
        MockByteChannel channel = new MockByteChannel();
        HugeBufferProducer p = new HugeBufferProducer(new File(w.getLocation(), JournalConfiguration.FILE_NAME));
        HugeBufferConsumer c = new HugeBufferConsumer(new File(w.getLocation(), "_remote"));
        p.write(channel);
        c.read(channel);
        try (JournalWriter w2 = getFactory().writer(new JournalMetadata<>(c.getHb(), "xyz"))) {
            Assert.assertTrue(w.getMetadata().isCompatible(w2.getMetadata(), false));
        }
        p.free();
        c.free();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JournalWriter(com.questdb.store.JournalWriter) HugeBufferProducer(com.questdb.net.ha.producer.HugeBufferProducer) HugeBufferConsumer(com.questdb.net.ha.comsumer.HugeBufferConsumer) File(java.io.File) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Aggregations

HugeBufferConsumer (com.questdb.net.ha.comsumer.HugeBufferConsumer)1 HugeBufferProducer (com.questdb.net.ha.producer.HugeBufferProducer)1 JournalWriter (com.questdb.store.JournalWriter)1 AbstractTest (com.questdb.test.tools.AbstractTest)1 File (java.io.File)1 Test (org.junit.Test)1